basctl/Library_basctl.mk | 1 basctl/source/basicide/basidesh.cxx | 2 basctl/source/basicide/tbxctl.cxx | 143 ---------- basctl/source/basicide/tbxctl.hxx | 58 ---- officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu | 28 + svx/source/form/fmobjfac.cxx | 1 svx/source/form/tbxform.cxx | 125 -------- svx/source/inc/tbxform.hxx | 20 - 8 files changed, 28 insertions(+), 350 deletions(-)
New commits: commit 1f6882348e74f7a3b7c144f693c99b7120c5b89b Author: Maxim Monastirsky <[email protected]> Date: Fri Jul 17 12:44:47 2015 +0300 Convert form control buttons to the generic controller Change-Id: Ibecf33160d5d021e84e796f6b16db673f644699d diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index ce96b6d..0c30cb6 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 7538d04..a5e370b 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 a083537..a8ea0b9 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 0b51c78..2b2e7f3 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 { commit 1c70472740a2973d56312130ebade3d3ded425d0 Author: Maxim Monastirsky <[email protected]> Date: Fri Jul 17 12:27:48 2015 +0300 Convert dialog controls button to the generic controller Change-Id: I3d03fba86139a3495e1cfd67b3f17149c73e3377 diff --git a/basctl/Library_basctl.mk b/basctl/Library_basctl.mk index a5dea6e..ab3a9a6 100644 --- a/basctl/Library_basctl.mk +++ b/basctl/Library_basctl.mk @@ -98,7 +98,6 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\ basctl/source/basicide/register \ basctl/source/basicide/sbxitem \ basctl/source/basicide/scriptdocument \ - basctl/source/basicide/tbxctl \ basctl/source/basicide/unomodel \ basctl/source/dlged/dlgedclip \ basctl/source/dlged/dlged \ diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 742e48c..8f98d3c 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -27,7 +27,6 @@ #include <basdoc.hxx> #include <basicbox.hxx> #include <editeng/sizeitem.hxx> -#include <tbxctl.hxx> #include <iderdll2.hxx> #include <basidectrlr.hxx> #include <localizationmgr.hxx> @@ -167,7 +166,6 @@ Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) : void Shell::Init() { - TbxControls::RegisterControl( SID_CHOOSE_CONTROLS ); SvxPosSizeStatusBarControl::RegisterControl(); SvxInsertStatusBarControl::RegisterControl(); XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE ); diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx deleted file mode 100644 index 8e193ad..0000000 --- a/basctl/source/basicide/tbxctl.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <svx/svxids.hrc> - -#include "idetemp.hxx" -#include "tbxctl.hxx" - -#include <sfx2/dispatch.hxx> -#include <sfx2/imagemgr.hxx> -#include <sfx2/viewfrm.hxx> -#include <svl/aeitem.hxx> -#include <vcl/toolbox.hxx> - -namespace basctl -{ - -using namespace ::com::sun::star::uno; - -namespace -{ - OUString aSubToolBarResName( "private:resource/toolbar/insertcontrolsbar" ); -} - -SFX_IMPL_TOOLBOX_CONTROL( TbxControls, SfxAllEnumItem ) - -/************************************************************************* -|* -|* Toolbox Class -|* -\************************************************************************/ - -TbxControls::TbxControls( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : - SfxToolBoxControl( nSlotId, nId, rTbx ) -{ - nLastSlot = USHRT_MAX; - - rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWN | rTbx.GetItemBits( nId ) ); - rTbx.Invalidate(); -} - -void TbxControls::StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) -{ - if( pState ) - { - if (SfxAllEnumItem const* pItem = dynamic_cast<SfxAllEnumItem const*>(pState)) - { - sal_uInt16 nTemp = 0; - sal_uInt16 nLastEnum = pItem->GetValue(); - switch (nLastEnum) - { - case SVX_SNAP_PUSHBUTTON: nTemp = SID_INSERT_PUSHBUTTON; break; - case SVX_SNAP_CHECKBOX: nTemp = SID_INSERT_CHECKBOX; break; - case SVX_SNAP_RADIOBUTTON: nTemp = SID_INSERT_RADIOBUTTON; break; - case SVX_SNAP_SPINBUTTON: nTemp = SID_INSERT_SPINBUTTON; break; - case SVX_SNAP_FIXEDTEXT: nTemp = SID_INSERT_FIXEDTEXT; break; - case SVX_SNAP_GROUPBOX: nTemp = SID_INSERT_GROUPBOX; break; - case SVX_SNAP_LISTBOX: nTemp = SID_INSERT_LISTBOX; break; - case SVX_SNAP_COMBOBOX: nTemp = SID_INSERT_COMBOBOX; break; - case SVX_SNAP_EDIT: nTemp = SID_INSERT_EDIT; break; - case SVX_SNAP_HSCROLLBAR: nTemp = SID_INSERT_HSCROLLBAR; break; - case SVX_SNAP_VSCROLLBAR: nTemp = SID_INSERT_VSCROLLBAR; break; - case SVX_SNAP_PREVIEW: nTemp = SID_INSERT_PREVIEW; break; - case SVX_SNAP_URLBUTTON: nTemp = SID_INSERT_URLBUTTON; break; - case SVX_SNAP_IMAGECONTROL: nTemp = SID_INSERT_IMAGECONTROL; break; - case SVX_SNAP_PROGRESSBAR: nTemp = SID_INSERT_PROGRESSBAR; break; - case SVX_SNAP_HFIXEDLINE: nTemp = SID_INSERT_HFIXEDLINE; break; - case SVX_SNAP_VFIXEDLINE: nTemp = SID_INSERT_VFIXEDLINE; break; - case SVX_SNAP_DATEFIELD: nTemp = SID_INSERT_DATEFIELD; break; - case SVX_SNAP_TIMEFIELD: nTemp = SID_INSERT_TIMEFIELD; break; - case SVX_SNAP_NUMERICFIELD: nTemp = SID_INSERT_NUMERICFIELD; break; - case SVX_SNAP_CURRENCYFIELD: nTemp = SID_INSERT_CURRENCYFIELD; break; - case SVX_SNAP_FORMATTEDFIELD: nTemp = SID_INSERT_FORMATTEDFIELD; break; - case SVX_SNAP_PATTERNFIELD: nTemp = SID_INSERT_PATTERNFIELD; break; - case SVX_SNAP_FILECONTROL: nTemp = SID_INSERT_FILECONTROL; break; - case SVX_SNAP_TREECONTROL: nTemp = SID_INSERT_TREECONTROL; break; - } - if( nTemp ) - { - OUString aSlotURL( "slot:" ); - aSlotURL += OUString::number( nTemp); - Image aImage = GetImage( m_xFrame, - aSlotURL, - hasBigImages() - ); - ToolBox& rBox = GetToolBox(); - rBox.SetItemImage(GetId(), aImage); - nLastSlot = nLastEnum; - } - } - } - SfxToolBoxControl::StateChanged( nSID, eState,pState ); -} - -void TbxControls::Select( sal_uInt16 nModifier ) -{ - (void)nModifier; - SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS, nLastSlot ); - SfxViewFrame* pCurFrame = SfxViewFrame::Current(); - DBG_ASSERT( pCurFrame != NULL, "No current view frame!" ); - SfxDispatcher* pDispatcher = pCurFrame ? pCurFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_CHOOSE_CONTROLS, SfxCallMode::SYNCHRON, &aItem, 0L ); - } -} - -/************************************************************************* -|* -|* the window is created here -|* position of the toolbox can be requested with GetToolBox() -|* rItemRect are the screen coordinates -|* -\************************************************************************/ -VclPtr<SfxPopupWindow> TbxControls::CreatePopupWindow() -{ - if ( GetSlotId() == SID_CHOOSE_CONTROLS ) - createAndPositionSubToolBar( aSubToolBarResName ); - - return 0; -} - - -} // namespace basctl - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/tbxctl.hxx b/basctl/source/basicide/tbxctl.hxx deleted file mode 100644 index 2eabe8c..0000000 --- a/basctl/source/basicide/tbxctl.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_BASCTL_SOURCE_BASICIDE_TBXCTL_HXX -#define INCLUDED_BASCTL_SOURCE_BASICIDE_TBXCTL_HXX - -#include <sfx2/tbxctrl.hxx> - -namespace basctl -{ - -class TbxControls : public SfxToolBoxControl -{ -private: - - struct StateChangedInfo - { - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - bool bDisabled; - }; - - sal_uInt16 nLastSlot; - -protected: - virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, - const SfxPoolItem* pState ) SAL_OVERRIDE; -public: - SFX_DECL_TOOLBOX_CONTROL(); - - TbxControls(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); - virtual ~TbxControls() {} - - virtual VclPtr<SfxPopupWindow> CreatePopupWindow() SAL_OVERRIDE; - - using SfxToolBoxControl::Select; - void Select( sal_uInt16 nModifier ) SAL_OVERRIDE; -}; - -} // namespace basctl - -#endif // INCLUDED_BASCTL_SOURCE_BASICIDE_TBXCTL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu index 554eced..ce96b6d 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu @@ -187,6 +187,20 @@ </node> </node> <node oor:name="ToolBar"> + <node oor:name="BasicControlsToolBox" oor:op="replace"> + <prop oor:name="Command"> + <value>.uno:ChooseControls</value> + </prop> + <prop oor:name="Module"> + <value>com.sun.star.script.BasicIDE</value> + </prop> + <prop oor:name="Controller"> + <value>com.sun.star.comp.framework.SubToolBarController</value> + </prop> + <prop oor:name="Value"> + <value>insertcontrolsbar</value> + </prop> + </node> <node oor:name="AlignmentControl" oor:op="replace"> <prop oor:name="Command"> <value>.uno:ObjectAlign</value> _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
