xref: /aoo41x/main/svx/source/form/tbxform.cxx (revision f6e50924)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f6e50924SAndrew Rist  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f6e50924SAndrew Rist  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19*f6e50924SAndrew Rist  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
27cdf0e10cSrcweir #include <tools/ref.hxx>
28cdf0e10cSrcweir #include <tools/shl.hxx>
29cdf0e10cSrcweir #include <svl/intitem.hxx>
30cdf0e10cSrcweir #include <svl/eitem.hxx>
31cdf0e10cSrcweir #include <svl/stritem.hxx>
32cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
33cdf0e10cSrcweir #include <vcl/toolbox.hxx>
34cdf0e10cSrcweir #include <vcl/fixed.hxx>
35cdf0e10cSrcweir #include "fmitems.hxx"
36cdf0e10cSrcweir #include "formtoolbars.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <vcl/sound.hxx>
40cdf0e10cSrcweir #include <svx/dialmgr.hxx>
41cdf0e10cSrcweir #ifndef _SVX_DIALOGS_HRC
42cdf0e10cSrcweir #include <svx/dialogs.hrc>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #include "svx/tbxctl.hxx"
45cdf0e10cSrcweir #include "svx/tbxdraw.hxx"
46cdf0e10cSrcweir #include "tbxform.hxx"
47cdf0e10cSrcweir #ifndef _SVX_FMRESIDS_HRC
48cdf0e10cSrcweir #include "svx/fmresids.hrc"
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir #include "fmitems.hxx"
51cdf0e10cSrcweir #ifndef _SVX_FMHELP_HRC
52cdf0e10cSrcweir #include "fmhelp.hrc"
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
55cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
56cdf0e10cSrcweir #include <sfx2/imagemgr.hxx>
57cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
58cdf0e10cSrcweir 
59cdf0e10cSrcweir using namespace ::com::sun::star::uno;
60cdf0e10cSrcweir using namespace ::com::sun::star::beans;
61cdf0e10cSrcweir using namespace ::com::sun::star::frame;
62cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySet;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
65cdf0e10cSrcweir //========================================================================
66cdf0e10cSrcweir // class SvxFmAbsRecWin
67cdf0e10cSrcweir //========================================================================
68cdf0e10cSrcweir 
69cdf0e10cSrcweir // -----------------------------------------------------------------------
SvxFmAbsRecWin(Window * _pParent,SfxToolBoxControl * _pController)70cdf0e10cSrcweir SvxFmAbsRecWin::SvxFmAbsRecWin( Window* _pParent, SfxToolBoxControl* _pController )
71cdf0e10cSrcweir 	:NumericField( _pParent, WB_BORDER )
72cdf0e10cSrcweir 	,m_pController(_pController)
73cdf0e10cSrcweir {
74cdf0e10cSrcweir 	SetMin(1);
75cdf0e10cSrcweir 	SetFirst(1);
76cdf0e10cSrcweir 	SetSpinSize(1);
77cdf0e10cSrcweir 	SetSizePixel( Size(70,19) );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	SetDecimalDigits(0);
80cdf0e10cSrcweir 	SetStrictFormat(sal_True);
81cdf0e10cSrcweir }
82cdf0e10cSrcweir 
83cdf0e10cSrcweir // -----------------------------------------------------------------------
~SvxFmAbsRecWin()84cdf0e10cSrcweir SvxFmAbsRecWin::~SvxFmAbsRecWin()
85cdf0e10cSrcweir {
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
88cdf0e10cSrcweir // -----------------------------------------------------------------------
FirePosition(sal_Bool _bForce)89cdf0e10cSrcweir void SvxFmAbsRecWin::FirePosition( sal_Bool _bForce )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir 	if ( _bForce || ( GetText() != GetSavedValue() ) )
92cdf0e10cSrcweir 	{
93cdf0e10cSrcweir 		sal_Int64 nRecord = GetValue();
94cdf0e10cSrcweir 		if (nRecord < GetMin() || nRecord > GetMax())
95cdf0e10cSrcweir 		{
96cdf0e10cSrcweir 			Sound::Beep();
97cdf0e10cSrcweir 			return;
98cdf0e10cSrcweir 		}
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 		SfxInt32Item aPositionParam( FN_PARAM_1, static_cast<sal_Int32>(nRecord) );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir         Any a;
103cdf0e10cSrcweir         Sequence< PropertyValue > aArgs( 1 );
104cdf0e10cSrcweir         aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Position" ));
105cdf0e10cSrcweir         aPositionParam.QueryValue( a );
106cdf0e10cSrcweir         aArgs[0].Value = a;
107cdf0e10cSrcweir         m_pController->Dispatch( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AbsoluteRecord" )),
108cdf0e10cSrcweir                                  aArgs );
109cdf0e10cSrcweir         m_pController->updateStatus();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 		SaveValue();
112cdf0e10cSrcweir 	}
113cdf0e10cSrcweir }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir // -----------------------------------------------------------------------
LoseFocus()116cdf0e10cSrcweir void SvxFmAbsRecWin::LoseFocus()
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 	FirePosition( sal_False );
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir // -----------------------------------------------------------------------
KeyInput(const KeyEvent & rKeyEvent)122cdf0e10cSrcweir void SvxFmAbsRecWin::KeyInput( const KeyEvent& rKeyEvent )
123cdf0e10cSrcweir {
124cdf0e10cSrcweir 	if( rKeyEvent.GetKeyCode() == KEY_RETURN && GetText().Len() )
125cdf0e10cSrcweir 		FirePosition( sal_True );
126cdf0e10cSrcweir 	else
127cdf0e10cSrcweir 		NumericField::KeyInput( rKeyEvent );
128cdf0e10cSrcweir }
129cdf0e10cSrcweir 
130cdf0e10cSrcweir //========================================================================
131cdf0e10cSrcweir // class SvxFmTbxCtlConfig
132cdf0e10cSrcweir //========================================================================
133cdf0e10cSrcweir 
134cdf0e10cSrcweir struct MapSlotToCmd
135cdf0e10cSrcweir {
136cdf0e10cSrcweir     sal_uInt16      nSlotId;
137cdf0e10cSrcweir     const char* pCommand;
138cdf0e10cSrcweir };
139cdf0e10cSrcweir 
140cdf0e10cSrcweir static MapSlotToCmd SlotToCommands[] =
141cdf0e10cSrcweir {
142cdf0e10cSrcweir     { SID_FM_PUSHBUTTON,        ".uno:Pushbutton"       },
143cdf0e10cSrcweir     { SID_FM_RADIOBUTTON,       ".uno:RadioButton"      },
144cdf0e10cSrcweir     { SID_FM_CHECKBOX,          ".uno:CheckBox"         },
145cdf0e10cSrcweir     { SID_FM_FIXEDTEXT,         ".uno:Label"            },
146cdf0e10cSrcweir     { SID_FM_GROUPBOX,          ".uno:GroupBox"         },
147cdf0e10cSrcweir     { SID_FM_LISTBOX,           ".uno:ListBox"          },
148cdf0e10cSrcweir     { SID_FM_COMBOBOX,          ".uno:ComboBox"         },
149cdf0e10cSrcweir     { SID_FM_EDIT,              ".uno:Edit"             },
150cdf0e10cSrcweir     { SID_FM_DBGRID,            ".uno:Grid"             },
151cdf0e10cSrcweir     { SID_FM_IMAGEBUTTON,       ".uno:Imagebutton"      },
152cdf0e10cSrcweir     { SID_FM_IMAGECONTROL,      ".uno:ImageControl"     },
153cdf0e10cSrcweir     { SID_FM_FILECONTROL,       ".uno:FileControl"      },
154cdf0e10cSrcweir     { SID_FM_DATEFIELD,         ".uno:DateField"        },
155cdf0e10cSrcweir     { SID_FM_TIMEFIELD,         ".uno:TimeField"        },
156cdf0e10cSrcweir     { SID_FM_NUMERICFIELD,      ".uno:NumericField"     },
157cdf0e10cSrcweir     { SID_FM_CURRENCYFIELD,     ".uno:CurrencyField"    },
158cdf0e10cSrcweir     { SID_FM_PATTERNFIELD,      ".uno:PatternField"     },
159cdf0e10cSrcweir     { SID_FM_DESIGN_MODE,       ".uno:SwitchControlDesignMode" },
160cdf0e10cSrcweir     { SID_FM_FORMATTEDFIELD,    ".uno:FormattedField"   },
161cdf0e10cSrcweir     { SID_FM_SCROLLBAR,         ".uno:ScrollBar"        },
162cdf0e10cSrcweir     { SID_FM_SPINBUTTON,        ".uno:SpinButton"       },
163cdf0e10cSrcweir     { 0,                        ""                      }
164cdf0e10cSrcweir };
165cdf0e10cSrcweir 
166cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlConfig, SfxUInt16Item );
167cdf0e10cSrcweir 
168cdf0e10cSrcweir //-----------------------------------------------------------------------
SvxFmTbxCtlConfig(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)169cdf0e10cSrcweir SvxFmTbxCtlConfig::SvxFmTbxCtlConfig( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
170cdf0e10cSrcweir 	: SfxToolBoxControl( nSlotId, nId, rTbx )
171cdf0e10cSrcweir 	,nLastSlot( 0 )
172cdf0e10cSrcweir {
173cdf0e10cSrcweir     rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
174cdf0e10cSrcweir }
175cdf0e10cSrcweir 
176cdf0e10cSrcweir //-----------------------------------------------------------------------
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)177cdf0e10cSrcweir void SvxFmTbxCtlConfig::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
178cdf0e10cSrcweir {
179cdf0e10cSrcweir 	if (nSID == SID_FM_CONFIG)
180cdf0e10cSrcweir 	{
181cdf0e10cSrcweir 		sal_uInt16 nSlot   = 0;
182cdf0e10cSrcweir 		if (eState >= SFX_ITEM_AVAILABLE)
183cdf0e10cSrcweir 			nSlot = ((SfxUInt16Item*)pState)->GetValue();
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 		switch( nSlot )
186cdf0e10cSrcweir 		{
187cdf0e10cSrcweir 			case SID_FM_PUSHBUTTON:
188cdf0e10cSrcweir 			case SID_FM_RADIOBUTTON:
189cdf0e10cSrcweir 			case SID_FM_CHECKBOX:
190cdf0e10cSrcweir 			case SID_FM_FIXEDTEXT:
191cdf0e10cSrcweir 			case SID_FM_GROUPBOX:
192cdf0e10cSrcweir 			case SID_FM_LISTBOX:
193cdf0e10cSrcweir 			case SID_FM_COMBOBOX:
194cdf0e10cSrcweir             case SID_FM_NAVIGATIONBAR:
195cdf0e10cSrcweir 			case SID_FM_EDIT:
196cdf0e10cSrcweir 			case SID_FM_DBGRID:
197cdf0e10cSrcweir 			case SID_FM_IMAGEBUTTON:
198cdf0e10cSrcweir 			case SID_FM_IMAGECONTROL:
199cdf0e10cSrcweir 			case SID_FM_FILECONTROL:
200cdf0e10cSrcweir 			case SID_FM_DATEFIELD:
201cdf0e10cSrcweir 			case SID_FM_TIMEFIELD:
202cdf0e10cSrcweir 			case SID_FM_NUMERICFIELD:
203cdf0e10cSrcweir 			case SID_FM_CURRENCYFIELD:
204cdf0e10cSrcweir 			case SID_FM_PATTERNFIELD:
205cdf0e10cSrcweir 			case SID_FM_DESIGN_MODE:
206cdf0e10cSrcweir 			case SID_FM_FORMATTEDFIELD:
207cdf0e10cSrcweir             case SID_FM_SCROLLBAR:
208cdf0e10cSrcweir             case SID_FM_SPINBUTTON:
209cdf0e10cSrcweir 			{	// set a new image, matching to this slot
210cdf0e10cSrcweir                 rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
211cdf0e10cSrcweir                 aSlotURL += rtl::OUString::valueOf( sal_Int32( nSlot ));
212cdf0e10cSrcweir                 Image aImage = GetImage( m_xFrame,
213cdf0e10cSrcweir                                         aSlotURL,
214cdf0e10cSrcweir                                         hasBigImages(),
215cdf0e10cSrcweir                                         GetToolBox().GetSettings().GetStyleSettings().GetHighContrastMode() );
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 			    GetToolBox().SetItemImage( GetId(), aImage );
218cdf0e10cSrcweir 				nLastSlot = nSlot;
219cdf0e10cSrcweir 			}
220cdf0e10cSrcweir 			break;
221cdf0e10cSrcweir 		}
222cdf0e10cSrcweir 	}
223cdf0e10cSrcweir 	SfxToolBoxControl::StateChanged( nSID, eState,pState );
224cdf0e10cSrcweir }
225cdf0e10cSrcweir 
226cdf0e10cSrcweir //-----------------------------------------------------------------------
GetPopupWindowType() const227cdf0e10cSrcweir SfxPopupWindowType SvxFmTbxCtlConfig::GetPopupWindowType() const
228cdf0e10cSrcweir {
229cdf0e10cSrcweir 	return( nLastSlot == 0 ? SFX_POPUPWINDOW_ONCLICK : SFX_POPUPWINDOW_ONTIMEOUT );
230cdf0e10cSrcweir }
231cdf0e10cSrcweir 
232cdf0e10cSrcweir //-----------------------------------------------------------------------
CreatePopupWindow()233cdf0e10cSrcweir SfxPopupWindow* SvxFmTbxCtlConfig::CreatePopupWindow()
234cdf0e10cSrcweir {
235cdf0e10cSrcweir     if ( GetSlotId() == SID_FM_CONFIG )
236cdf0e10cSrcweir     {
237cdf0e10cSrcweir         ::svxform::FormToolboxes aToolboxes( m_xFrame );
238cdf0e10cSrcweir         createAndPositionSubToolBar( aToolboxes.getToolboxResourceName( SID_FM_CONFIG ) );
239cdf0e10cSrcweir     }
240cdf0e10cSrcweir 	return NULL;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir //-----------------------------------------------------------------------
Select(sal_uInt16)244cdf0e10cSrcweir void SvxFmTbxCtlConfig::Select( sal_uInt16 /*nModifier*/ )
245cdf0e10cSrcweir {
246cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
247cdf0e10cSrcweir 	// Click auf den Button SID_FM_CONFIG in der ObjectBar
248cdf0e10cSrcweir 	if ( nLastSlot )
249cdf0e10cSrcweir     {
250cdf0e10cSrcweir         sal_uInt16 n = 0;
251cdf0e10cSrcweir         while( SlotToCommands[n].nSlotId > 0 )
252cdf0e10cSrcweir         {
253cdf0e10cSrcweir             if ( SlotToCommands[n].nSlotId == nLastSlot )
254cdf0e10cSrcweir                 break;
255cdf0e10cSrcweir             n++;
256cdf0e10cSrcweir         }
257cdf0e10cSrcweir 
258cdf0e10cSrcweir         if ( SlotToCommands[n].nSlotId > 0 )
259cdf0e10cSrcweir         {
260cdf0e10cSrcweir             Sequence< PropertyValue > aArgs;
261cdf0e10cSrcweir             Dispatch( rtl::OUString::createFromAscii( SlotToCommands[n].pCommand ),
262cdf0e10cSrcweir                       aArgs );
263cdf0e10cSrcweir         }
264cdf0e10cSrcweir     }
265cdf0e10cSrcweir }
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 
268cdf0e10cSrcweir //========================================================================
269cdf0e10cSrcweir // class SvxFmTbxCtlAbsRec
270cdf0e10cSrcweir //========================================================================
271cdf0e10cSrcweir 
272cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlAbsRec, SfxInt32Item );
273cdf0e10cSrcweir DBG_NAME(SvxFmTbxCtlAbsRec);
274cdf0e10cSrcweir //-----------------------------------------------------------------------
SvxFmTbxCtlAbsRec(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)275cdf0e10cSrcweir SvxFmTbxCtlAbsRec::SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
276cdf0e10cSrcweir 	:SfxToolBoxControl( nSlotId, nId, rTbx )
277cdf0e10cSrcweir {
278cdf0e10cSrcweir 	DBG_CTOR(SvxFmTbxCtlAbsRec,NULL);
279cdf0e10cSrcweir }
280cdf0e10cSrcweir 
281cdf0e10cSrcweir //-----------------------------------------------------------------------
~SvxFmTbxCtlAbsRec()282cdf0e10cSrcweir SvxFmTbxCtlAbsRec::~SvxFmTbxCtlAbsRec()
283cdf0e10cSrcweir {
284cdf0e10cSrcweir 	DBG_DTOR(SvxFmTbxCtlAbsRec,NULL);
285cdf0e10cSrcweir }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir //-----------------------------------------------------------------------
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)288cdf0e10cSrcweir void SvxFmTbxCtlAbsRec::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
289cdf0e10cSrcweir {
290cdf0e10cSrcweir 	sal_uInt16 				nId = GetId();
291cdf0e10cSrcweir 	ToolBox*			pToolBox = &GetToolBox();
292cdf0e10cSrcweir 	SvxFmAbsRecWin*		pWin = (SvxFmAbsRecWin*)( pToolBox->GetItemWindow(nId) );
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 	DBG_ASSERT( pWin, "Control not found!" );
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	if (pState)
297cdf0e10cSrcweir 	{
298cdf0e10cSrcweir 		const SfxInt32Item* pItem = PTR_CAST( SfxInt32Item, pState );
299cdf0e10cSrcweir 		DBG_ASSERT( pItem, "SvxFmTbxCtlAbsRec::StateChanged: invalid item!" );
300cdf0e10cSrcweir 		pWin->SetValue( pItem ? pItem->GetValue() : -1 );
301cdf0e10cSrcweir 	}
302cdf0e10cSrcweir 
303cdf0e10cSrcweir 	sal_Bool bEnable = SFX_ITEM_DISABLED != eState && pState;
304cdf0e10cSrcweir 	if (!bEnable)
305cdf0e10cSrcweir 		pWin->SetText(String());
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
308cdf0e10cSrcweir 	// Enablen/disablen des Fensters
309cdf0e10cSrcweir 	pToolBox->EnableItem(nId, bEnable);
310cdf0e10cSrcweir 	SfxToolBoxControl::StateChanged( nSID, eState,pState );
311cdf0e10cSrcweir }
312cdf0e10cSrcweir 
313cdf0e10cSrcweir //-----------------------------------------------------------------------
CreateItemWindow(Window * pParent)314cdf0e10cSrcweir Window* SvxFmTbxCtlAbsRec::CreateItemWindow( Window* pParent )
315cdf0e10cSrcweir {
316cdf0e10cSrcweir 	SvxFmAbsRecWin* pWin = new SvxFmAbsRecWin( pParent, this );
317cdf0e10cSrcweir 	pWin->SetUniqueId( UID_ABSOLUTE_RECORD_WINDOW );
318cdf0e10cSrcweir 	return pWin;
319cdf0e10cSrcweir }
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 
322cdf0e10cSrcweir //========================================================================
323cdf0e10cSrcweir // SvxFmTbxCtlRecText
324cdf0e10cSrcweir //========================================================================
325cdf0e10cSrcweir 
326cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecText, SfxBoolItem );
327cdf0e10cSrcweir DBG_NAME(SvxFmTbxCtlRecText);
328cdf0e10cSrcweir //-----------------------------------------------------------------------
SvxFmTbxCtlRecText(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)329cdf0e10cSrcweir SvxFmTbxCtlRecText::SvxFmTbxCtlRecText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
330cdf0e10cSrcweir 	:SfxToolBoxControl( nSlotId, nId, rTbx )
331cdf0e10cSrcweir {
332cdf0e10cSrcweir 	DBG_CTOR(SvxFmTbxCtlRecText,NULL);
333cdf0e10cSrcweir }
334cdf0e10cSrcweir 
335cdf0e10cSrcweir //-----------------------------------------------------------------------
~SvxFmTbxCtlRecText()336cdf0e10cSrcweir SvxFmTbxCtlRecText::~SvxFmTbxCtlRecText()
337cdf0e10cSrcweir {
338cdf0e10cSrcweir 	DBG_DTOR(SvxFmTbxCtlRecText,NULL);
339cdf0e10cSrcweir }
340cdf0e10cSrcweir 
341cdf0e10cSrcweir //-----------------------------------------------------------------------
CreateItemWindow(Window * pParent)342cdf0e10cSrcweir Window*	SvxFmTbxCtlRecText::CreateItemWindow( Window* pParent )
343cdf0e10cSrcweir {
344cdf0e10cSrcweir 	XubString aText( SVX_RES(RID_STR_REC_TEXT) );
345cdf0e10cSrcweir 	FixedText* pFixedText = new FixedText( pParent );
346cdf0e10cSrcweir 	Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
347cdf0e10cSrcweir 	pFixedText->SetText( aText );
348cdf0e10cSrcweir 	aSize.Width() += 6;
349cdf0e10cSrcweir 	pFixedText->SetSizePixel( aSize );
350cdf0e10cSrcweir     pFixedText->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 	return pFixedText;
353cdf0e10cSrcweir }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 
356cdf0e10cSrcweir //========================================================================
357cdf0e10cSrcweir // SvxFmTbxCtlRecFromText
358cdf0e10cSrcweir //========================================================================
359cdf0e10cSrcweir 
360cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecFromText, SfxBoolItem );
361cdf0e10cSrcweir DBG_NAME(SvxFmTbxCtlRecFromText);
362cdf0e10cSrcweir //-----------------------------------------------------------------------
SvxFmTbxCtlRecFromText(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)363cdf0e10cSrcweir SvxFmTbxCtlRecFromText::SvxFmTbxCtlRecFromText( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
364cdf0e10cSrcweir 	:SfxToolBoxControl( nSlotId, nId, rTbx )
365cdf0e10cSrcweir {
366cdf0e10cSrcweir 	DBG_CTOR(SvxFmTbxCtlRecFromText,NULL);
367cdf0e10cSrcweir }
368cdf0e10cSrcweir 
369cdf0e10cSrcweir //-----------------------------------------------------------------------
~SvxFmTbxCtlRecFromText()370cdf0e10cSrcweir SvxFmTbxCtlRecFromText::~SvxFmTbxCtlRecFromText()
371cdf0e10cSrcweir {
372cdf0e10cSrcweir 	DBG_DTOR(SvxFmTbxCtlRecFromText,NULL);
373cdf0e10cSrcweir }
374cdf0e10cSrcweir 
375cdf0e10cSrcweir //-----------------------------------------------------------------------
CreateItemWindow(Window * pParent)376cdf0e10cSrcweir Window*	SvxFmTbxCtlRecFromText::CreateItemWindow( Window* pParent )
377cdf0e10cSrcweir {
378cdf0e10cSrcweir 	XubString aText( SVX_RES(RID_STR_REC_FROM_TEXT) );
379cdf0e10cSrcweir 	FixedText* pFixedText = new FixedText( pParent, WB_CENTER );
380cdf0e10cSrcweir 	Size aSize( pFixedText->GetTextWidth( aText ), pFixedText->GetTextHeight( ) );
381cdf0e10cSrcweir 	aSize.Width() += 12;
382cdf0e10cSrcweir 	pFixedText->SetText( aText );
383cdf0e10cSrcweir 	pFixedText->SetSizePixel( aSize );
384cdf0e10cSrcweir 	pFixedText->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
385cdf0e10cSrcweir 	return pFixedText;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 
389cdf0e10cSrcweir //========================================================================
390cdf0e10cSrcweir // SvxFmTbxCtlRecTotal
391cdf0e10cSrcweir //========================================================================
392cdf0e10cSrcweir DBG_NAME(SvxFmTbxCtlRecTotal);
393cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlRecTotal, SfxStringItem );
394cdf0e10cSrcweir 
395cdf0e10cSrcweir //-----------------------------------------------------------------------
SvxFmTbxCtlRecTotal(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)396cdf0e10cSrcweir SvxFmTbxCtlRecTotal::SvxFmTbxCtlRecTotal( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
397cdf0e10cSrcweir 	:SfxToolBoxControl( nSlotId, nId, rTbx )
398cdf0e10cSrcweir 	,pFixedText( NULL )
399cdf0e10cSrcweir {
400cdf0e10cSrcweir 	DBG_CTOR(SvxFmTbxCtlRecTotal,NULL);
401cdf0e10cSrcweir }
402cdf0e10cSrcweir 
403cdf0e10cSrcweir //-----------------------------------------------------------------------
~SvxFmTbxCtlRecTotal()404cdf0e10cSrcweir SvxFmTbxCtlRecTotal::~SvxFmTbxCtlRecTotal()
405cdf0e10cSrcweir {
406cdf0e10cSrcweir 	DBG_DTOR(SvxFmTbxCtlRecTotal,NULL);
407cdf0e10cSrcweir }
408cdf0e10cSrcweir 
409cdf0e10cSrcweir //-----------------------------------------------------------------------
CreateItemWindow(Window * pParent)410cdf0e10cSrcweir Window*	SvxFmTbxCtlRecTotal::CreateItemWindow( Window* pParent )
411cdf0e10cSrcweir {
412cdf0e10cSrcweir 	pFixedText = new FixedText( pParent );
413cdf0e10cSrcweir 	String aSample( "123456", sizeof( "123456" ) - 1 );
414cdf0e10cSrcweir 	Size aSize( pFixedText->GetTextWidth( aSample ), pFixedText->GetTextHeight( ) );
415cdf0e10cSrcweir 	aSize.Width() += 12;
416cdf0e10cSrcweir 	pFixedText->SetSizePixel( aSize );
417cdf0e10cSrcweir     pFixedText->SetBackground();
418cdf0e10cSrcweir     pFixedText->SetPaintTransparent(sal_True);
419cdf0e10cSrcweir 	return pFixedText;
420cdf0e10cSrcweir }
421cdf0e10cSrcweir 
422cdf0e10cSrcweir //-----------------------------------------------------------------------
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)423cdf0e10cSrcweir void SvxFmTbxCtlRecTotal::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
424cdf0e10cSrcweir {
425cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
426cdf0e10cSrcweir 	// Setzen des FixedTextes
427cdf0e10cSrcweir 	if (GetSlotId() != SID_FM_RECORD_TOTAL)
428cdf0e10cSrcweir 		return;
429cdf0e10cSrcweir 
430cdf0e10cSrcweir 	XubString aText;
431cdf0e10cSrcweir 	if (pState)
432cdf0e10cSrcweir 		aText = ((SfxStringItem*)pState)->GetValue();
433cdf0e10cSrcweir 	else
434cdf0e10cSrcweir 		aText = '?';
435cdf0e10cSrcweir 
436cdf0e10cSrcweir 	pFixedText->SetText( aText );
437cdf0e10cSrcweir 	pFixedText->Update();
438cdf0e10cSrcweir 	pFixedText->Flush();
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 	SfxToolBoxControl::StateChanged( nSID, eState,pState );
441cdf0e10cSrcweir }
442cdf0e10cSrcweir 
443cdf0e10cSrcweir //========================================================================
444cdf0e10cSrcweir // SvxFmTbxNextRec
445cdf0e10cSrcweir //========================================================================
446cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxNextRec, SfxBoolItem );
447cdf0e10cSrcweir 
448cdf0e10cSrcweir //-----------------------------------------------------------------------
SvxFmTbxNextRec(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)449cdf0e10cSrcweir SvxFmTbxNextRec::SvxFmTbxNextRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
450cdf0e10cSrcweir 	:SfxToolBoxControl( nSlotId, nId, rTbx )
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	rTbx.SetItemBits(nId, rTbx.GetItemBits(nId) | TIB_REPEAT);
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 	AllSettings	aSettings = rTbx.GetSettings();
455cdf0e10cSrcweir 	MouseSettings aMouseSettings = aSettings.GetMouseSettings();
456cdf0e10cSrcweir 	aMouseSettings.SetButtonRepeat(aMouseSettings.GetButtonRepeat() / 4);
457cdf0e10cSrcweir 	aSettings.SetMouseSettings(aMouseSettings);
458cdf0e10cSrcweir 	rTbx.SetSettings(aSettings, sal_True);
459cdf0e10cSrcweir }
460cdf0e10cSrcweir 
461cdf0e10cSrcweir //========================================================================
462cdf0e10cSrcweir // SvxFmTbxPrevRec
463cdf0e10cSrcweir //========================================================================
464cdf0e10cSrcweir SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxPrevRec, SfxBoolItem );
465cdf0e10cSrcweir 
466cdf0e10cSrcweir //-----------------------------------------------------------------------
SvxFmTbxPrevRec(sal_uInt16 nSlotId,sal_uInt16 nId,ToolBox & rTbx)467cdf0e10cSrcweir SvxFmTbxPrevRec::SvxFmTbxPrevRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
468cdf0e10cSrcweir 	:SfxToolBoxControl( nSlotId, nId, rTbx )
469cdf0e10cSrcweir {
470cdf0e10cSrcweir 	rTbx.SetItemBits(nId, rTbx.GetItemBits(nId) | TIB_REPEAT);
471cdf0e10cSrcweir }
472cdf0e10cSrcweir 
473cdf0e10cSrcweir 
474