diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-07-17 12:44:47 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2015-07-17 14:48:38 +0300 |
commit | 1f6882348e74f7a3b7c144f693c99b7120c5b89b (patch) | |
tree | c0bc541ec00d5068d9f72e1ba7737f42c5585341 | |
parent | 1c70472740a2973d56312130ebade3d3ded425d0 (diff) |
Convert form control buttons to the generic controller
Change-Id: Ibecf33160d5d021e84e796f6b16db673f644699d
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 14 | ||||
-rw-r--r-- | svx/source/form/fmobjfac.cxx | 1 | ||||
-rw-r--r-- | svx/source/form/tbxform.cxx | 125 | ||||
-rw-r--r-- | svx/source/inc/tbxform.hxx | 20 |
4 files changed, 14 insertions, 146 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index ce96b6dc2104..0c30cb6f6d0a 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -201,6 +201,20 @@ <value>insertcontrolsbar</value> </prop> </node> + <node oor:name="FormsControlsToolBox" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:Config</value> + </prop> + <prop oor:name="Module"> + <value/> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.framework.SubToolBarController</value> + </prop> + <prop oor:name="Value"> + <value>formcontrols;.uno:Config</value> + </prop> + </node> <node oor:name="AlignmentControl" oor:op="replace"> <prop oor:name="Command"> <value>.uno:ObjectAlign</value> diff --git a/svx/source/form/fmobjfac.cxx b/svx/source/form/fmobjfac.cxx index 7538d04851ff..a5e370bc5d6f 100644 --- a/svx/source/form/fmobjfac.cxx +++ b/svx/source/form/fmobjfac.cxx @@ -61,7 +61,6 @@ FmFormObjFactory::FmFormObjFactory() // Konfigurations-::com::sun::star::frame::Controller und NavigationBar registrieren - SvxFmTbxCtlConfig::RegisterControl( SID_FM_CONFIG ); SvxFmTbxCtlAbsRec::RegisterControl( SID_FM_RECORD_ABSOLUTE ); SvxFmTbxCtlRecText::RegisterControl( SID_FM_RECORD_TEXT ); SvxFmTbxCtlRecFromText::RegisterControl( SID_FM_RECORD_FROM_TEXT ); diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx index a0835371219b..a8ea0b9db228 100644 --- a/svx/source/form/tbxform.cxx +++ b/svx/source/form/tbxform.cxx @@ -100,131 +100,6 @@ void SvxFmAbsRecWin::KeyInput( const KeyEvent& rKeyEvent ) } -// class SvxFmTbxCtlConfig - - -struct MapSlotToCmd -{ - sal_uInt16 nSlotId; - const char* pCommand; -}; - -static const MapSlotToCmd SlotToCommands[] = -{ - { SID_FM_PUSHBUTTON, ".uno:Pushbutton" }, - { SID_FM_RADIOBUTTON, ".uno:RadioButton" }, - { SID_FM_CHECKBOX, ".uno:CheckBox" }, - { SID_FM_FIXEDTEXT, ".uno:Label" }, - { SID_FM_GROUPBOX, ".uno:GroupBox" }, - { SID_FM_LISTBOX, ".uno:ListBox" }, - { SID_FM_COMBOBOX, ".uno:ComboBox" }, - { SID_FM_EDIT, ".uno:Edit" }, - { SID_FM_DBGRID, ".uno:Grid" }, - { SID_FM_IMAGEBUTTON, ".uno:Imagebutton" }, - { SID_FM_IMAGECONTROL, ".uno:ImageControl" }, - { SID_FM_FILECONTROL, ".uno:FileControl" }, - { SID_FM_DATEFIELD, ".uno:DateField" }, - { SID_FM_TIMEFIELD, ".uno:TimeField" }, - { SID_FM_NUMERICFIELD, ".uno:NumericField" }, - { SID_FM_CURRENCYFIELD, ".uno:CurrencyField" }, - { SID_FM_PATTERNFIELD, ".uno:PatternField" }, - { SID_FM_DESIGN_MODE, ".uno:SwitchControlDesignMode" }, - { SID_FM_FORMATTEDFIELD, ".uno:FormattedField" }, - { SID_FM_SCROLLBAR, ".uno:ScrollBar" }, - { SID_FM_SPINBUTTON, ".uno:SpinButton" }, - { 0, "" } -}; - -SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlConfig, SfxUInt16Item ); - - -SvxFmTbxCtlConfig::SvxFmTbxCtlConfig( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) - : SfxToolBoxControl( nSlotId, nId, rTbx ) - ,nLastSlot( 0 ) -{ - rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) ); -} - - -void SvxFmTbxCtlConfig::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) -{ - if (nSID == SID_FM_CONFIG) - { - sal_uInt16 nSlot = 0; - if (eState >= SfxItemState::DEFAULT) - nSlot = static_cast<const SfxUInt16Item*>(pState)->GetValue(); - - switch( nSlot ) - { - case SID_FM_PUSHBUTTON: - case SID_FM_RADIOBUTTON: - case SID_FM_CHECKBOX: - case SID_FM_FIXEDTEXT: - case SID_FM_GROUPBOX: - case SID_FM_LISTBOX: - case SID_FM_COMBOBOX: - case SID_FM_NAVIGATIONBAR: - case SID_FM_EDIT: - case SID_FM_DBGRID: - case SID_FM_IMAGEBUTTON: - case SID_FM_IMAGECONTROL: - case SID_FM_FILECONTROL: - case SID_FM_DATEFIELD: - case SID_FM_TIMEFIELD: - case SID_FM_NUMERICFIELD: - case SID_FM_CURRENCYFIELD: - case SID_FM_PATTERNFIELD: - case SID_FM_DESIGN_MODE: - case SID_FM_FORMATTEDFIELD: - case SID_FM_SCROLLBAR: - case SID_FM_SPINBUTTON: - { // set a new image, matching to this slot - OUString aSlotURL = "slot:" + OUString::number( nSlot); - Image aImage = GetImage( m_xFrame, aSlotURL, hasBigImages() ); - GetToolBox().SetItemImage( GetId(), aImage ); - nLastSlot = nSlot; - } - break; - } - } - SfxToolBoxControl::StateChanged( nSID, eState,pState ); -} - - -VclPtr<SfxPopupWindow> SvxFmTbxCtlConfig::CreatePopupWindow() -{ - if ( GetSlotId() == SID_FM_CONFIG ) - { - ::svxform::FormToolboxes aToolboxes( m_xFrame ); - createAndPositionSubToolBar( aToolboxes.getToolboxResourceName( SID_FM_CONFIG ) ); - } - return NULL; -} - - -void SvxFmTbxCtlConfig::Select( sal_uInt16 /*nSelectModifier*/ ) -{ - - // Click auf den Button SID_FM_CONFIG in der ObjectBar - if ( nLastSlot ) - { - sal_uInt16 n = 0; - while( SlotToCommands[n].nSlotId > 0 ) - { - if ( SlotToCommands[n].nSlotId == nLastSlot ) - break; - n++; - } - - if ( SlotToCommands[n].nSlotId > 0 ) - { - Sequence< PropertyValue > aArgs; - Dispatch( OUString::createFromAscii( SlotToCommands[n].pCommand ), - aArgs ); - } - } -} - SFX_IMPL_TOOLBOX_CONTROL( SvxFmTbxCtlAbsRec, SfxInt32Item ); SvxFmTbxCtlAbsRec::SvxFmTbxCtlAbsRec( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx index 0b51c780c8ca..2b2e7f302ea7 100644 --- a/svx/source/inc/tbxform.hxx +++ b/svx/source/inc/tbxform.hxx @@ -41,26 +41,6 @@ protected: }; -class SvxFmTbxCtlConfig : public SfxToolBoxControl -{ -private: - sal_uInt16 nLastSlot; - -protected: - -public: - SFX_DECL_TOOLBOX_CONTROL(); - - SvxFmTbxCtlConfig( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~SvxFmTbxCtlConfig() {} - - virtual void Select( sal_uInt16 nSelectModifier ) SAL_OVERRIDE; - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) SAL_OVERRIDE; - virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; -}; - - class FixedText; class SvxFmTbxCtlAbsRec : public SfxToolBoxControl { |