From 8c69fcd6ebe514a3b10f929059f0c676913374f3 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Tue, 16 Jul 2013 16:12:48 +0200 Subject: [PATCH] Move hasBigImages() from ToolboxController to SfxToolBoxController. We want to decide whether the images are big or not based on the real (underlying) ToolBox, not on the global setting, because we can have both toolbars with large as well as small icons visible at the same time (small in sidebar, large in toolbars). Change-Id: I046a12a495f2038df9a571f5779794a639bae6dc --- .../source/ui/control/toolboxcontroller.cxx | 4 +--- include/sfx2/tbxctrl.hxx | 1 + include/svtools/toolboxcontroller.hxx | 1 - sfx2/source/toolbox/tbxitem.cxx | 5 +++++ svtools/source/uno/toolboxcontroller.cxx | 5 ----- svx/source/customshapes/tbxcustomshapes.cxx | 15 +++------------ svx/source/tbxctrls/tbxalign.cxx | 19 ++++++------------- 7 files changed, 16 insertions(+), 34 deletions(-) diff --git a/dbaccess/source/ui/control/toolboxcontroller.cxx b/dbaccess/source/ui/control/toolboxcontroller.cxx index 57e3b0054ab8..b833483fcc1d 100644 --- a/dbaccess/source/ui/control/toolboxcontroller.cxx +++ b/dbaccess/source/ui/control/toolboxcontroller.cxx @@ -200,8 +200,6 @@ namespace dbaui Reference xUIConfigMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( OUString("com.sun.star.sdb.OfficeDatabaseDocument") ); Reference xImageMgr(xUIConfigMgr->getImageManager(),UNO_QUERY); - short nImageType = hasBigImages() ? ImageType::SIZE_LARGE : ImageType::SIZE_DEFAULT; - Sequence< OUString> aSeq(1); sal_uInt16 nCount = pMenu->GetItemCount(); for (sal_uInt16 nPos = 0; nPos < nCount; ++nPos) @@ -211,7 +209,7 @@ namespace dbaui sal_uInt16 nItemId = pMenu->GetItemId(nPos); aSeq[0] = pMenu->GetItemCommand(nItemId); - Sequence< Reference > aImages = xImageMgr->getImages(nImageType,aSeq); + Sequence< Reference > aImages = xImageMgr->getImages(ImageType::SIZE_DEFAULT, aSeq); Image aImage(aImages[0]); pMenu->SetItemImage(nItemId,aImage); diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index e7b6e6921e5f..af1b1a640ab9 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -252,6 +252,7 @@ protected: // helper methods void createAndPositionSubToolBar( const OUString& rSubToolBarResName ); ::Size getPersistentFloatingSize( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, const OUString& rSubToolBarResName ); + bool hasBigImages() const; public: SFX_DECL_TOOLBOX_CONTROL(); diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx index 217d6cdf2dab..529313053066 100644 --- a/include/svtools/toolboxcontroller.hxx +++ b/include/svtools/toolboxcontroller.hxx @@ -158,7 +158,6 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL void bindListener(); void unbindListener(); sal_Bool isBound() const; - sal_Bool hasBigImages() const; // TODO remove ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > getURLTransformer() const; // TODO remove diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 34c4b1884a6e..b535d0c8c8b0 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -773,6 +773,11 @@ throw (::com::sun::star::uno::RuntimeException) return aToolboxSize; } +bool SfxToolBoxControl::hasBigImages() const +{ + return (GetToolBox().GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE); +} + void SfxToolBoxControl::createAndPositionSubToolBar( const OUString& rSubToolBarResName ) { SolarMutexGuard aGuard; diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 7b675a902250..b9364c4cc606 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -634,11 +634,6 @@ sal_Bool ToolboxController::isBound() const return sal_False; } -sal_Bool ToolboxController::hasBigImages() const -{ - return SvtMiscOptions().AreCurrentSymbolsLarge(); -} - void ToolboxController::updateStatus() { bindListener(); diff --git a/svx/source/customshapes/tbxcustomshapes.cxx b/svx/source/customshapes/tbxcustomshapes.cxx index 87dab72ad024..836a314a453f 100644 --- a/svx/source/customshapes/tbxcustomshapes.cxx +++ b/svx/source/customshapes/tbxcustomshapes.cxx @@ -153,21 +153,12 @@ OUString SAL_CALL SvxTbxCtlCustomShapes::getSubToolbarName() throw (::com::sun:: void SAL_CALL SvxTbxCtlCustomShapes::functionSelected( const OUString& rCommand ) throw (::com::sun::star::uno::RuntimeException) { - // remind the new command + // remember the new command m_aCommand = rCommand; + // Our sub-toolbar wants to execute a function. // We have to change the image of our toolbar button to reflect the new function. - SolarMutexGuard aGuard; - if ( !m_bDisposed ) - { - if ( !m_aCommand.isEmpty() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface()); - Image aImage = GetImage( xFrame, m_aCommand, hasBigImages() ); - if ( !!aImage ) - GetToolBox().SetItemImage( GetId(), aImage ); - } - } + updateImage(); } void SAL_CALL SvxTbxCtlCustomShapes::updateImage( ) throw (::com::sun::star::uno::RuntimeException) diff --git a/svx/source/tbxctrls/tbxalign.cxx b/svx/source/tbxctrls/tbxalign.cxx index b566c1f8ef64..13eff22a4e48 100644 --- a/svx/source/tbxctrls/tbxalign.cxx +++ b/svx/source/tbxctrls/tbxalign.cxx @@ -98,19 +98,12 @@ OUString SAL_CALL SvxTbxCtlAlign::getSubToolbarName() throw (::com::sun::star::u void SAL_CALL SvxTbxCtlAlign::functionSelected( const OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException) { - // Our sub-toolbar wants to executes a function. We have to change - // the image of our toolbar button to reflect the new function. - SolarMutexGuard aGuard; - if ( !m_bDisposed ) - { - if ( !aCommand.isEmpty() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( getFrameInterface()); - Image aImage = GetImage( xFrame, aCommand, hasBigImages() ); - if ( !!aImage ) - GetToolBox().SetItemImage( GetId(), aImage ); - } - } + // remember the new command + m_aCommand = aCommand; + + // Our sub-toolbar wants to execute a function. + // We have to change the image of our toolbar button to reflect the new function. + updateImage(); } void SAL_CALL SvxTbxCtlAlign::updateImage() throw (::com::sun::star::uno::RuntimeException)