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