From fb698d5e81c8b4149c092305506d40e2f7ef7f5d Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Sun, 23 Apr 2017 15:04:36 +0300 Subject: Replace GetImage with CommandInfoProvider::GetImageForCommand And move ToolBoxButtonSize->ImageType mapping code to a common place. Change-Id: If158f4b6f2750054fcf64491c2941706e7d3a329 --- .../source/controller/sidebar/ChartAxisPanel.cxx | 1 - .../controller/sidebar/ChartElementsPanel.cxx | 1 - .../controller/sidebar/ChartErrorBarPanel.cxx | 1 - .../source/controller/sidebar/ChartSeriesPanel.cxx | 1 - .../source/uielement/popuptoolbarcontroller.cxx | 16 +- include/sfx2/imagemgr.hxx | 39 ---- include/sfx2/tbxctrl.hxx | 3 - include/vcl/toolbox.hxx | 1 + sc/source/ui/miscdlgs/optsolver.cxx | 9 +- sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx | 1 - sd/inc/pch/precompiled_sd.hxx | 1 - sd/source/ui/annotations/annotationmanager.cxx | 8 +- sd/source/ui/slideshow/slideshowimpl.cxx | 10 +- sd/source/ui/view/outlview.cxx | 6 +- sd/source/ui/view/viewoverlaymanager.cxx | 1 - sd/uiconfig/simpress/ui/annotationmenu.ui | 10 + sfx2/Library_sfx.mk | 1 - sfx2/inc/pch/precompiled_sfx.hxx | 1 - sfx2/source/appl/app.cxx | 1 - sfx2/source/appl/imagemgr.cxx | 202 --------------------- sfx2/source/dialog/recfloat.cxx | 1 - sfx2/source/sidebar/ControllerItem.cxx | 1 - sfx2/source/sidebar/SidebarPanelBase.cxx | 1 - sfx2/source/sidebar/SidebarToolBox.cxx | 9 +- sfx2/source/sidebar/Tools.cxx | 4 +- sfx2/source/toolbox/tbxitem.cxx | 6 - svx/inc/pch/precompiled_svx.hxx | 1 - svx/source/form/tbxform.cxx | 1 - .../sidebar/possize/PosSizePropertyPanel.cxx | 1 - svx/source/sidebar/shapes/DefaultShapesPanel.cxx | 3 +- svx/source/tbxctrls/bulletsnumbering.cxx | 5 +- svx/source/tbxctrls/tbcontrl.cxx | 3 +- svx/source/tbxctrls/tbxdrctl.cxx | 1 - sw/source/uibase/ribbar/workctrl.cxx | 1 - sw/source/uibase/sidebar/WrapPropertyPanel.cxx | 18 +- vcl/source/window/toolbox2.cxx | 21 ++- 36 files changed, 53 insertions(+), 338 deletions(-) delete mode 100644 include/sfx2/imagemgr.hxx delete mode 100644 sfx2/source/appl/imagemgr.cxx diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx index 715f1e6c9700..cfad4732a591 100644 --- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx +++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx @@ -25,7 +25,6 @@ #include "ChartController.hxx" #include #include -#include #include #include #include diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index d25b9232ff3c..6ee81319f591 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -27,7 +27,6 @@ #include "ChartController.hxx" #include #include -#include #include #include #include diff --git a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx index f359d409f573..95100060cfb0 100644 --- a/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx +++ b/chart2/source/controller/sidebar/ChartErrorBarPanel.cxx @@ -26,7 +26,6 @@ #include "ChartController.hxx" #include #include -#include #include #include #include diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx index 6e48a4688e7f..ca18efbabe77 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx @@ -32,7 +32,6 @@ #include "ChartController.hxx" #include #include -#include #include #include #include diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 74ff9da3f400..7227f05bf847 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -56,16 +56,6 @@ using namespace framework; namespace { -vcl::ImageType getImageType(ToolBoxButtonSize eSize) -{ - vcl::ImageType eImageType = vcl::ImageType::Size16; - if (eSize == ToolBoxButtonSize::Large) - eImageType = vcl::ImageType::Size26; - else if (eSize == ToolBoxButtonSize::Size32) - eImageType = vcl::ImageType::Size32; - return eImageType; -} - typedef cppu::ImplInheritanceHelper< svt::ToolboxController, css::lang::XServiceInfo > ToolBarBase; @@ -383,9 +373,7 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand ) pToolBox->SetItemText( nId, vcl::CommandInfoProvider::GetLabelForCommand( rCommand, m_sModuleName ) ); pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand( rCommand, m_xFrame ) ); - vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize()); - - Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, eImageType); + Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, pToolBox->GetImageSize()); if ( !!aImage ) pToolBox->SetItemImage( nId, aImage ); } @@ -497,7 +485,7 @@ void SaveToolbarController::updateImage() if ( !getToolboxId( nId, &pToolBox ) ) return; - vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize()); + vcl::ImageType eImageType = pToolBox->GetImageSize(); Image aImage; diff --git a/include/sfx2/imagemgr.hxx b/include/sfx2/imagemgr.hxx deleted file mode 100644 index 36f914c53cdf..000000000000 --- a/include/sfx2/imagemgr.hxx +++ /dev/null @@ -1,39 +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_SFX2_IMAGEMGR_HXX -#define INCLUDED_SFX2_IMAGEMGR_HXX - -#include -#include -#include -#include - -#include -#include - -SFX2_DLLPUBLIC Image SAL_CALL GetImage( - const css::uno::Reference< css::frame::XFrame >& rFrame, - const OUString& aURL, - bool bBig -); - -#endif // INCLUDED_SFX2_IMAGEMGR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index caa0cfe9bfad..e6002abb8001 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -157,9 +157,6 @@ protected: // Must be called by subclass to set a new popup window instance void SetPopupWindow( SfxPopupWindow* pWindow ); - // helper methods - bool hasBigImages() const; - public: // XComponent virtual void SAL_CALL dispose() override; diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index a200557a4a2f..650fe127f55c 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -336,6 +336,7 @@ public: // sets a fixed button size (small, large or dontcare (==autosize)) void SetToolboxButtonSize( ToolBoxButtonSize eSize ); ToolBoxButtonSize GetToolboxButtonSize() const; + vcl::ImageType GetImageSize() const; void SetAlign( WindowAlign eNewAlign = WindowAlign::Top ); WindowAlign GetAlign() const { return meAlign; } diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 2d62a3308b37..8296542b6440 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -20,9 +20,9 @@ #include "rangelst.hxx" #include "scitems.hxx" #include -#include #include #include +#include #include #include @@ -349,13 +349,8 @@ void ScOptSolverDlg::dispose() void ScOptSolverDlg::Init(const ScAddress& rCursorPos) { - // Get the "Delete Rows" commandimagelist images from sfx instead of - // adding a second copy to sc (see ScTbxInsertCtrl::StateChanged) - - OUString aSlotURL( "slot:" ); - aSlotURL += OUString::number( SID_DEL_ROWS ); uno::Reference xFrame = GetBindings().GetActiveFrame(); - Image aDelNm = ::GetImage( xFrame, aSlotURL, false ); + Image aDelNm = vcl::CommandInfoProvider::GetImageForCommand(".uno:DeleteRows", xFrame); for (VclPtr & pButton : mpDelButton) { diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx index b35720c8f72a..937387ec2ece 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -23,7 +23,6 @@ #include "scresid.hxx" #include #include -#include #include #include #include diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx index 72edaa133137..27993c6c65be 100644 --- a/sd/inc/pch/precompiled_sd.hxx +++ b/sd/inc/pch/precompiled_sd.hxx @@ -346,7 +346,6 @@ #include #include #include -#include #include #include #include diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index b2680c08bf11..b5802d726994 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -46,7 +47,6 @@ #include -#include #include #include #include @@ -1206,12 +1206,8 @@ void AnnotationManagerImpl::ExecuteAnnotationContextMenu( const Reference< XAnno sal_uInt16 nId = pMenu->GetItemId( nPos ); if (!pMenu->IsItemEnabled(nId)) continue; - OString sIdent = pMenu->GetItemIdent(nId); - sal_uInt16 nSID = IdentToSID(sIdent); - OUString sSlotURL( "slot:" ); - sSlotURL += OUString::number(nSID); - Image aImage( GetImage( xFrame, sSlotURL, false ) ); + Image aImage( vcl::CommandInfoProvider::GetImageForCommand( pMenu->GetItemCommand( nId ), xFrame ) ); if( !!aImage ) pMenu->SetItemImage( nId, aImage ); } diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 521e18f86ce3..888e49fdd367 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -65,6 +64,7 @@ #include "res_bmp.hrc" #include "sdresid.hxx" #include +#include #include #include "comphelper/anytostring.hxx" @@ -2004,13 +2004,13 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, void) Reference< css::frame::XFrame > xFrame( pViewFrame->GetFrame().GetFrameInterface() ); if( xFrame.is() ) { - pMenu->SetItemImage(pMenu->GetItemId("next"), GetImage(xFrame, "slot:10617" , false)); - pMenu->SetItemImage(pMenu->GetItemId("prev"), GetImage(xFrame, "slot:10618" , false)); + pMenu->SetItemImage(pMenu->GetItemId("next"), vcl::CommandInfoProvider::GetImageForCommand(".uno:NextRecord", xFrame)); + pMenu->SetItemImage(pMenu->GetItemId("prev"), vcl::CommandInfoProvider::GetImageForCommand(".uno:PrevRecord", xFrame)); if( pPageMenu ) { - pPageMenu->SetItemImage(pPageMenu->GetItemId("first"), GetImage(xFrame, "slot:10616" , false)); - pPageMenu->SetItemImage(pPageMenu->GetItemId("last"), GetImage(xFrame, "slot:10619" , false)); + pPageMenu->SetItemImage(pPageMenu->GetItemId("first"), vcl::CommandInfoProvider::GetImageForCommand(".uno:FirstRecord", xFrame)); + pPageMenu->SetItemImage(pPageMenu->GetItemId("last"), vcl::CommandInfoProvider::GetImageForCommand(".uno:LastRecord", xFrame)); } } } diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index f0cbddc14394..5821dde1d610 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -20,6 +20,7 @@ #include "OutlineView.hxx" #include #include +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -146,9 +146,7 @@ OutlineView::OutlineView( DrawDocShell& rDocSh, vcl::Window* pWindow, OutlineVie maBulletFont.SetShadow(false); Reference xFrame (mrOutlineViewShell.GetViewShellBase().GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY); - - const OUString aSlotURL( ".uno:ShowSlide" ); - maSlideImage = GetImage( xFrame, aSlotURL, true ); + maSlideImage = vcl::CommandInfoProvider::GetImageForCommand(".uno:ShowSlide", xFrame, vcl::ImageType::Size26); // Tell undo manager of the document about the undo manager of the // outliner, so that the former can synchronize with the later. diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index 44aa1f59e3d0..19254e201c9c 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -20,7 +20,6 @@ #include "sddll.hxx" #include -#include #include #include #include diff --git a/sd/uiconfig/simpress/ui/annotationmenu.ui b/sd/uiconfig/simpress/ui/annotationmenu.ui index b5bf418e9784..0e8ba5f39645 100644 --- a/sd/uiconfig/simpress/ui/annotationmenu.ui +++ b/sd/uiconfig/simpress/ui/annotationmenu.ui @@ -9,6 +9,7 @@ True False + .uno:ReplyToAnnotation _Reply True @@ -23,6 +24,7 @@ True False + .uno:Bold _Bold True @@ -31,6 +33,7 @@ True False + .uno:Italic _Italic True @@ -39,6 +42,7 @@ True False + .uno:Underline _Underline True @@ -47,6 +51,7 @@ True False + .uno:Strikeout _Strikethrough True @@ -61,6 +66,7 @@ True False + .uno:Copy _Copy True @@ -69,6 +75,7 @@ True False + .uno:Paste _Paste True @@ -83,6 +90,7 @@ True False + .uno:DeleteAnnotation _Delete Comment True @@ -91,6 +99,7 @@ True False + .uno:DeleteAllAnnotationByAuthor Delete All Comments b_y %1 True @@ -99,6 +108,7 @@ True False + .uno:DeleteAllAnnotation Delete _All Comments True diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 2ad775dcc162..5b0ca8cccd85 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -105,7 +105,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/appl/fwkhelper \ sfx2/source/appl/helpdispatch \ sfx2/source/appl/helpinterceptor \ - sfx2/source/appl/imagemgr \ sfx2/source/appl/imestatuswindow \ sfx2/source/appl/impldde \ sfx2/source/appl/linkmgr2 \ diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx index 570c23b28def..7a3e57ac264d 100644 --- a/sfx2/inc/pch/precompiled_sfx.hxx +++ b/sfx2/inc/pch/precompiled_sfx.hxx @@ -460,7 +460,6 @@ #include #include #include -#include #include #include #include diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 0b14446a7098..234fa72c0f95 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -100,7 +100,6 @@ #include #include #include -#include #include "fwkhelper.hxx" using namespace ::com::sun::star; diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx deleted file mode 100644 index ad59dccc7a3a..000000000000 --- a/sfx2/source/appl/imagemgr.cxx +++ /dev/null @@ -1,202 +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 -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::ui; - -typedef std::unordered_map< OUString, - WeakReference< XImageManager >, - OUStringHash > ModuleIdToImagegMgr; - - -Image SAL_CALL GetImage( - const css::uno::Reference< css::frame::XFrame >& rFrame, - const OUString& aURL, - bool bBig -) -{ - // TODO/LATeR: shouldn't this become a method at SfxViewFrame?! That would save the UnoTunnel - if ( !rFrame.is() ) - return Image(); - - INetURLObject aObj( aURL ); - INetProtocol nProtocol = aObj.GetProtocol(); - - Reference < XController > xController; - Reference < XModel > xModel; - if ( rFrame.is() ) - xController = rFrame->getController(); - if ( xController.is() ) - xModel = xController->getModel(); - - OUString aCommandURL( aURL ); - if ( nProtocol == INetProtocol::Slot ) - { - sal_uInt16 nId = ( sal_uInt16 ) aURL.copy(5).toInt32(); - const SfxSlot* pSlot = nullptr; - if ( xModel.is() ) - { - Reference < XUnoTunnel > xObj( xModel, UNO_QUERY ); - Sequence < sal_Int8 > aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() ); - sal_Int64 nHandle = xObj.is() ? xObj->getSomething( aSeq ) : 0; - if ( nHandle ) - { - SfxObjectShell* pDoc = reinterpret_cast(sal::static_int_cast( nHandle )); - SfxModule* pModule = pDoc->GetFactory().GetModule(); - pSlot = pModule->GetSlotPool()->GetSlot( nId ); - } - } - else - pSlot = SfxSlotPool::GetSlotPool().GetSlot( nId ); - - if ( pSlot ) - { - aCommandURL = ".uno:"; - aCommandURL += OUString::createFromAscii( pSlot->GetUnoName() ); - } - else - aCommandURL.clear(); - } - - Reference< XImageManager > xDocImgMgr; - if ( xModel.is() ) - { - Reference< XUIConfigurationManagerSupplier > xSupplier( xModel, UNO_QUERY ); - if ( xSupplier.is() ) - { - Reference< XUIConfigurationManager > xDocUICfgMgr( xSupplier->getUIConfigurationManager(), UNO_QUERY ); - xDocImgMgr.set( xDocUICfgMgr->getImageManager(), UNO_QUERY ); - } - } - - sal_Int16 nImageType( css::ui::ImageType::COLOR_NORMAL| css::ui::ImageType::SIZE_DEFAULT ); - if ( bBig ) - nImageType |= css::ui::ImageType::SIZE_LARGE; - - if ( xDocImgMgr.is() ) - { - Sequence< Reference< css::graphic::XGraphic > > aGraphicSeq; - Sequence aImageCmdSeq { aCommandURL }; - - try - { - aGraphicSeq = xDocImgMgr->getImages( nImageType, aImageCmdSeq ); - Reference< css::graphic::XGraphic > xGraphic = aGraphicSeq[0]; - Image aImage( xGraphic ); - - if ( !!aImage ) - return aImage; - } - catch (const Exception&) - { - } - } - - static WeakReference< XModuleManager2 > s_xModuleManager; - - Reference< XModuleManager2 > xModuleManager = s_xModuleManager; - - if ( !xModuleManager.is() ) - { - xModuleManager = ModuleManager::create(::comphelper::getProcessComponentContext()); - s_xModuleManager = xModuleManager; - } - - try - { - if ( !aCommandURL.isEmpty() ) - { - Reference< XImageManager > xModuleImageManager; - OUString aModuleId = xModuleManager->identify( rFrame ); - - static ModuleIdToImagegMgr s_aModuleIdToImageMgrMap; - - ModuleIdToImagegMgr::iterator pIter = s_aModuleIdToImageMgrMap.find( aModuleId ); - if ( pIter != s_aModuleIdToImageMgrMap.end() ) - xModuleImageManager = pIter->second; - else - { - static WeakReference< XModuleUIConfigurationManagerSupplier > s_xModuleCfgMgrSupplier; - - Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = s_xModuleCfgMgrSupplier; - - if ( !xModuleCfgMgrSupplier.is() ) - { - xModuleCfgMgrSupplier = theModuleUIConfigurationManagerSupplier::get( - ::comphelper::getProcessComponentContext() ); - - s_xModuleCfgMgrSupplier = xModuleCfgMgrSupplier; - } - - Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( aModuleId ); - xModuleImageManager.set( xUICfgMgr->getImageManager(), UNO_QUERY ); - s_aModuleIdToImageMgrMap.insert( ModuleIdToImagegMgr::value_type( aModuleId, xModuleImageManager )); - } - - Sequence< Reference< css::graphic::XGraphic > > aGraphicSeq; - Sequence aImageCmdSeq { aCommandURL }; - - aGraphicSeq = xModuleImageManager->getImages( nImageType, aImageCmdSeq ); - - Reference< css::graphic::XGraphic > xGraphic = aGraphicSeq[0]; - Image aImage( xGraphic ); - - if ( !!aImage ) - return aImage; - else if ( nProtocol != INetProtocol::Uno && nProtocol != INetProtocol::Slot ) - return SvFileInformationManager::GetImageNoDefault( aObj, bBig ); - } - } - catch (const Exception&) - { - } - - return Image(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index aebfd9c9fe1f..d80d89f965a1 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -30,7 +30,6 @@ #include #include #include -#include SFX_IMPL_FLOATINGWINDOW( SfxRecordingFloatWrapper_Impl, SID_RECORDING_FLOATWINDOW ); diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index 2ebff3df3a8c..5bc39b3e664d 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -20,7 +20,6 @@ #include #include -#include #include #include #include diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx index 8c8db52d0731..e0d72cff36d2 100644 --- a/sfx2/source/sidebar/SidebarPanelBase.cxx +++ b/sfx2/source/sidebar/SidebarPanelBase.cxx @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx index 968366eab8f9..2dc0c5910c62 100644 --- a/sfx2/source/sidebar/SidebarToolBox.cxx +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -255,13 +255,6 @@ IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void) if (mbUseDefaultButtonSize) SetToolboxButtonSize(GetDefaultButtonSize()); - vcl::ImageType eImageType = vcl::ImageType::Size16; - ToolBoxButtonSize eSize = GetToolboxButtonSize(); - if (eSize == ToolBoxButtonSize::Large) - eImageType = vcl::ImageType::Size26; - else if (eSize == ToolBoxButtonSize::Size32) - eImageType = vcl::ImageType::Size32; - for (auto const& it : maControllers) { Reference xController(it.second, UNO_QUERY); @@ -275,7 +268,7 @@ IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void) { OUString aCommandURL = GetItemCommand(it.first); css::uno::Reference xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); - Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, xFrame, eImageType); + Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, xFrame, GetImageSize()); SetItemImage(it.first, aImage); } } diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx index b809f7ad96f5..e246599fd9c0 100644 --- a/sfx2/source/sidebar/Tools.cxx +++ b/sfx2/source/sidebar/Tools.cxx @@ -21,9 +21,9 @@ #include -#include #include #include +#include #include #include @@ -57,7 +57,7 @@ Image Tools::GetImage ( { if (rsURL.startsWith(".uno:")) { - const Image aPanelImage (::GetImage(rxFrame, rsURL, false)); + const Image aPanelImage(vcl::CommandInfoProvider::GetImageForCommand(rsURL, rxFrame)); return aPanelImage; } else diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index b908b6f932f6..5aed453f2392 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -87,7 +87,6 @@ #include #include "helpid.hrc" #include "workwin.hxx" -#include #include using namespace ::com::sun::star; @@ -572,11 +571,6 @@ Reference< css::awt::XWindow > SAL_CALL SfxToolBoxControl::createItemWindow( con return VCLUnoHelper::GetInterface( CreateItemWindow( VCLUnoHelper::GetWindow( rParent ))); } -bool SfxToolBoxControl::hasBigImages() const -{ - return (GetToolBox().GetToolboxButtonSize() == ToolBoxButtonSize::Large); -} - void SfxToolBoxControl::SetPopupWindow( SfxPopupWindow* pWindow ) { pImpl->mpPopupWindow = pWindow; diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index f9aaba9f6051..201a708a4a03 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -324,7 +324,6 @@ #include #include #include -#include #include #include #include diff --git a/svx/source/form/tbxform.cxx b/svx/source/form/tbxform.cxx index 467834bf9c54..23c97a7c0cbb 100644 --- a/svx/source/form/tbxform.cxx +++ b/svx/source/form/tbxform.cxx @@ -37,7 +37,6 @@ #include "fmhelp.hrc" #include #include -#include using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 7ca72f4def9d..d94f52d4211b 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx index a56e004fa670..c67e24a2328f 100644 --- a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx +++ b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx @@ -19,7 +19,6 @@ #include "DefaultShapesPanel.hxx" #include -#include #include #include #include @@ -131,7 +130,7 @@ void DefaultShapesPanel::populateShapes() for(std::map::size_type i = 0; i < aSet.second.size(); i++) { sSlotStr = aSet.second[i]; - aSlotImage = ::GetImage(mxFrame, sSlotStr, false); + aSlotImage = vcl::CommandInfoProvider::GetImageForCommand(sSlotStr, mxFrame); sLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, mxFrame); aSet.first->InsertItem(i, aSlotImage, sLabel); } diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx index dbabd99ae6f7..bf81afb5e032 100644 --- a/svx/source/tbxctrls/bulletsnumbering.cxx +++ b/svx/source/tbxctrls/bulletsnumbering.cxx @@ -12,12 +12,12 @@ #include #include -#include #include #include #include #include #include +#include #include #include @@ -120,7 +120,8 @@ NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController, AddStatusListener( ".uno:CurrentOutlineType" ); } - appendEntry( 1, aMoreItemText, ::GetImage( mrController.getFrameInterface(), ".uno:OutlineBullet", false ) ); + appendEntry( 1, aMoreItemText, + vcl::CommandInfoProvider::GetImageForCommand( ".uno:OutlineBullet", mrController.getFrameInterface() ) ); SetOutputSizePixel( getMenuSize() ); mpValueSet->SetSelectHdl( LINK( this, NumberingPopup, VSSelectValueSetHdl ) ); diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index e15a571fb1e2..41b4e8ed3f54 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -2915,7 +2914,7 @@ sal_Bool SvxColorToolBoxControl::opensSubToolbar() void SvxColorToolBoxControl::updateImage() { - Image aImage = GetImage( m_xFrame, m_aCommandURL, hasBigImages() ); + Image aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aCommandURL, m_xFrame, GetToolBox().GetImageSize()); if ( !!aImage ) { GetToolBox().SetItemImage( GetId(), aImage ); diff --git a/svx/source/tbxctrls/tbxdrctl.cxx b/svx/source/tbxctrls/tbxdrctl.cxx index 2cf2197108c3..cc45215d388a 100644 --- a/svx/source/tbxctrls/tbxdrctl.cxx +++ b/svx/source/tbxctrls/tbxdrctl.cxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index da384935b31e..f3bf91fec342 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx index 08e5f9392190..d3954521b35a 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx @@ -25,8 +25,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -148,20 +148,20 @@ void WrapPropertyPanel::Initialize() mpEnableContour->SetClickHdl(EnableContourLink); mpSpacingLB->SetSelectHdl(LINK(this, WrapPropertyPanel, SpacingLBHdl)); - mpRBNoWrap->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPOFF, false)); + mpRBNoWrap->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPOFF, mxFrame)); if ( AllSettings::GetLayoutRTL() ) { - mpRBWrapLeft->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPRIGHT, false)); - mpRBWrapRight->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPLEFT, false)); + mpRBWrapLeft->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPRIGHT, mxFrame)); + mpRBWrapRight->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPLEFT, mxFrame)); } else { - mpRBWrapLeft->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPLEFT, false)); - mpRBWrapRight->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPRIGHT, false)); + mpRBWrapLeft->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPLEFT, mxFrame)); + mpRBWrapRight->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPRIGHT, mxFrame)); } - mpRBWrapParallel->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPON, false)); - mpRBWrapThrough->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPTHROUGH, false)); - mpRBIdealWrap->SetModeRadioImage(::GetImage(mxFrame, UNO_WRAPIDEAL, false)); + mpRBWrapParallel->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPON, mxFrame)); + mpRBWrapThrough->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPTHROUGH, mxFrame)); + mpRBIdealWrap->SetModeRadioImage(vcl::CommandInfoProvider::GetImageForCommand(UNO_WRAPIDEAL, mxFrame)); aCustomEntry = mpCustomEntry->GetText(); diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index a8fd640005f1..4c74017a81f0 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -434,15 +434,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference sal_uInt16! @@ -633,6 +625,17 @@ ToolBoxButtonSize ToolBox::GetToolboxButtonSize() const return mpData->meButtonSize; } +ImageType ToolBox::GetImageSize() const +{ + ImageType eImageType = ImageType::Size16; + if (mpData->meButtonSize == ToolBoxButtonSize::Large) + eImageType = ImageType::Size26; + else if (mpData->meButtonSize == ToolBoxButtonSize::Size32) + eImageType = ImageType::Size32; + + return eImageType; +} + /*static*/ Size ToolBox::GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize) { OutputDevice *pDefault = Application::GetDefaultDevice(); -- cgit