Public feed
#3759873
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxxindex ccfca86..4b65cb6 100644--- a/dbaccess/source/ui/control/dbtreelistbox.cxx+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx@@ -500,7 +500,7 @@ namespace } if ( xFrame.is() )- _rMenu.SetItemImage(nId, vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, xFrame));+ _rMenu.SetItemImage(nId, vcl::CommandInfoProvider::GetImageForCommand(aCommand, xFrame)); } } // SelectionSupplierdiff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxxindex daac412..dff3368 100644--- a/dbaccess/source/ui/control/opendoccontrols.cxx+++ b/dbaccess/source/ui/control/opendoccontrols.cxx@@ -118,7 +118,7 @@ namespace dbaui m_sModule = OUString::createFromAscii( _pAsciiModuleName ); // our label should equal the UI text of the "Open" command- OUString sLabel(vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(".uno:Open", m_sModule));+ OUString sLabel(vcl::CommandInfoProvider::GetCommandPropertyFromModule(".uno:Open", m_sModule)); SetText(" " + sLabel.replaceAll("~", "")); // Place icon left of text and both centered in the button.diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxxindex 66b9109..0a66584 100644--- a/forms/source/solar/control/navtoolbar.cxx+++ b/forms/source/solar/control/navtoolbar.cxx@@ -287,7 +287,7 @@ namespace frm OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) ); m_pToolbar->SetItemCommand( pSupportedFeatures->nId, sCommandURL ); m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId,- vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(sCommandURL, m_sModuleId) );+ vcl::CommandInfoProvider::GetCommandPropertyFromModule(sCommandURL, m_sModuleId) ); } if ( pSupportedFeatures->bItemWindow )diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxxindex b307448..e91d5f3 100644--- a/framework/source/uielement/addonstoolbarmanager.cxx+++ b/framework/source/uielement/addonstoolbarmanager.cxx@@ -123,14 +123,14 @@ static Image RetrieveImage( Reference< css::frame::XFrame >& rFrame, if ( !!aImage ) return aImage; else- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, rFrame, eImageType);+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, rFrame, eImageType); if ( !!aImage ) return aImage; } aImage = framework::AddonsOptions().GetImageFromURL( aURL, bBigImage ); if ( !aImage )- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, rFrame, eImageType);+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, rFrame, eImageType); return aImage; }@@ -260,7 +260,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue m_pToolBar->InsertItem( nId, aTitle ); - OUString aShortcut(vcl::CommandInfoProvider::Instance().GetCommandShortcut(aURL, m_xFrame));+ OUString aShortcut(vcl::CommandInfoProvider::GetCommandShortcut(aURL, m_xFrame)); if (!aShortcut.isEmpty()) m_pToolBar->SetQuickHelpText(nId, aTitle + " (" + aShortcut + ")"); diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxxindex bbfaf0e..aaeaeb3 100644--- a/framework/source/uielement/macrosmenucontroller.cxx+++ b/framework/source/uielement/macrosmenucontroller.cxx@@ -83,7 +83,7 @@ void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo // insert basic OUString aCommand(".uno:MacroDialog");- OUString aDisplayName = vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand(aCommand, m_xFrame);+ OUString aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand(aCommand, m_xFrame); pPopupMenu->InsertItem( 2, aDisplayName ); pPopupMenu->SetItemCommand( 2, aCommand ); diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxxindex 0a50c02..685856a 100644--- a/framework/source/uielement/menubarmanager.cxx+++ b/framework/source/uielement/menubarmanager.cxx@@ -1089,9 +1089,9 @@ OUString MenuBarManager::RetrieveLabelFromCommand(const OUString& rCmdURL) if ( !m_bHasMenuBar ) { // This is a context menu, prefer "PopupLabel" over "Label".- return vcl::CommandInfoProvider::Instance().GetPopupLabelForCommand(rCmdURL, m_xFrame);+ return vcl::CommandInfoProvider::GetPopupLabelForCommand(rCmdURL, m_xFrame); }- return vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand(rCmdURL, m_xFrame);+ return vcl::CommandInfoProvider::GetMenuLabelForCommand(rCmdURL, m_xFrame); } bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandler )@@ -1187,7 +1187,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF } // Command can be just an alias to another command.- OUString aRealCommand = vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( aItemCommand, m_xFrame );+ OUString aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aItemCommand, m_xFrame ); if ( !aRealCommand.isEmpty() ) aItemCommand = aRealCommand; @@ -1293,7 +1293,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF // Set image for the addon popup menu item if ( bItemShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST )) {- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aItemCommand, rFrame);+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aItemCommand, rFrame); if ( !!aImage ) pPopup->SetItemImage( ITEMID_ADDONLIST, aImage ); }@@ -1324,12 +1324,12 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF if ( pMenuAttributes && !pMenuAttributes->aImageId.isEmpty() ) { // Retrieve image id from menu attributes- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, m_xFrame);+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, m_xFrame); } if ( !aImage ) {- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aItemCommand, m_xFrame);+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aItemCommand, m_xFrame); if ( !aImage ) aImage = AddonsOptions().GetImageFromURL( aItemCommand, false ); }@@ -1652,7 +1652,7 @@ void MenuBarManager::FillMenu( aProp[i].Value >>= bEnabled; } - if (vcl::CommandInfoProvider::Instance().IsExperimental(aCommandURL, rModuleIdentifier) &&+ if (vcl::CommandInfoProvider::IsExperimental(aCommandURL, rModuleIdentifier) && !SvtMiscOptions().IsExperimentalMode()) { continue;@@ -2090,7 +2090,7 @@ void MenuBarManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,b if ( !aImageId.isEmpty() ) {- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, _xFrame);+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, _xFrame); if ( !!aImage ) { bImageSet = true;@@ -2101,7 +2101,7 @@ void MenuBarManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,b if ( !bImageSet ) { OUString aMenuItemCommand = _pMenu->GetItemCommand( nId );- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aMenuItemCommand, _xFrame);+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aMenuItemCommand, _xFrame); if ( !aImage ) aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, false ); diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxxindex e8963fd..1cd1bef 100644--- a/framework/source/uielement/newmenucontroller.cxx+++ b/framework/source/uielement/newmenucontroller.cxx@@ -91,7 +91,7 @@ void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, bool bSetImages ) INetURLObject aURLObj( aImageId.isEmpty() ? aCmd : aImageId ); Image aImage = SvFileInformationManager::GetImageNoDefault( aURLObj ); if ( !aImage )- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCmd, xFrame);+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aCmd, xFrame); if ( !!aImage ) pPopupMenu->SetItemImage( nItemId, aImage );diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxxindex c4e627d..1e8adbb 100644--- a/framework/source/uielement/popuptoolbarcontroller.cxx+++ b/framework/source/uielement/popuptoolbarcontroller.cxx@@ -373,7 +373,7 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand ) { removeStatusListener( m_aCommandURL ); - OUString aRealCommand( vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( rCommand, m_xFrame ) );+ OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand( rCommand, m_xFrame ) ); m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand; addStatusListener( m_aCommandURL ); @@ -383,12 +383,12 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand ) { pToolBox->SetItemCommand( nId, rCommand ); pToolBox->SetHelpText( nId, OUString() ); // Will retrieve the new one from help.- pToolBox->SetItemText( nId, vcl::CommandInfoProvider::Instance().GetLabelForCommand( rCommand, m_xFrame ) );- pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::Instance().GetTooltipForCommand( rCommand, m_xFrame ) );+ pToolBox->SetItemText( nId, vcl::CommandInfoProvider::GetLabelForCommand( rCommand, m_xFrame ) );+ pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand( rCommand, m_xFrame ) ); vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize()); - Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommand, m_xFrame, eImageType);+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, eImageType); if ( !!aImage ) pToolBox->SetItemImage( nId, aImage ); }@@ -511,7 +511,7 @@ void SaveToolbarController::updateImage() if ( m_bReadOnly ) {- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(".uno:SaveAs", m_xFrame, eImageType);+ aImage = vcl::CommandInfoProvider::GetImageForCommand(".uno:SaveAs", m_xFrame, eImageType); } else if ( m_bModified ) {@@ -520,7 +520,7 @@ void SaveToolbarController::updateImage() } if ( !aImage )- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(m_aCommandURL, m_xFrame, eImageType);+ aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aCommandURL, m_xFrame, eImageType); if ( !!aImage ) pToolBox->SetItemImage( nId, aImage );@@ -539,7 +539,7 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent& if ( bLastReadOnly != m_bReadOnly ) { pToolBox->SetQuickHelpText( nId,- vcl::CommandInfoProvider::Instance().GetTooltipForCommand( m_bReadOnly ? OUString( ".uno:SaveAs" ) : m_aCommandURL, m_xFrame ) );+ vcl::CommandInfoProvider::GetTooltipForCommand( m_bReadOnly ? OUString( ".uno:SaveAs" ) : m_aCommandURL, m_xFrame ) ); pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~( m_bReadOnly ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) ); pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( m_bReadOnly ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN ) ); updateImage();diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxxindex 0c0e0e6..0f803e6 100644--- a/framework/source/uielement/statusbarmanager.cxx+++ b/framework/source/uielement/statusbarmanager.cxx@@ -451,7 +451,7 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() ) {- OUString aString( vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame));+ OUString aString( vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_xFrame)); StatusBarItemBits nItemBits( impl_convertItemStyleToItemBits( nStyle )); m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset );diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxxindex 36f679a..7c3086a 100644--- a/framework/source/uielement/subtoolbarcontroller.cxx+++ b/framework/source/uielement/subtoolbarcontroller.cxx@@ -297,7 +297,7 @@ void SubToolBarController::updateImage() else if (pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Size32) eImageType = vcl::ImageType::Size32; - Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(m_aLastCommand, getFrameInterface(), eImageType);+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aLastCommand, getFrameInterface(), eImageType); if ( !!aImage ) pToolBox->SetItemImage( nId, aImage ); }diff --git a/framework/source/uielement/thesaurusmenucontroller.cxx b/framework/source/uielement/thesaurusmenucontroller.cxxindex 360fd2f..c7227c4 100644--- a/framework/source/uielement/thesaurusmenucontroller.cxx+++ b/framework/source/uielement/thesaurusmenucontroller.cxx@@ -100,7 +100,7 @@ void ThesaurusMenuController::fillPopupMenu() pVCLMenu->InsertSeparator(); OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );- pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::Instance().GetPopupLabelForCommand( aThesaurusDialogCmd, m_xFrame ) );+ pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aThesaurusDialogCmd, m_xFrame ) ); pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd ); } }diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxxindex 489ad87..42be968 100644--- a/framework/source/uielement/toolbarmanager.cxx+++ b/framework/source/uielement/toolbarmanager.cxx@@ -313,7 +313,7 @@ void ToolBarManager::RefreshImages() else { OUString aCommandURL = m_pToolBar->GetItemCommand( it.first );- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, m_xFrame, eImageType);+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, m_xFrame, eImageType); // Try also to query for add-on images before giving up and use an // empty image. bool bBigImages = eImageType != vcl::ImageType::Size16;@@ -679,7 +679,7 @@ void ToolBarManager::CreateControllers() OUString aCommandURL( m_pToolBar->GetItemCommand( nId ) ); // Command can be just an alias to another command.- OUString aRealCommandURL( vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( aCommandURL, m_xFrame ) );+ OUString aRealCommandURL( vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, m_xFrame ) ); if ( !aRealCommandURL.isEmpty() ) aCommandURL = aRealCommandURL; @@ -758,7 +758,7 @@ void ToolBarManager::CreateControllers() new GenericToolbarController( m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL )); // Accessibility support: Set toggle button role for specific commands- sal_Int32 nProps = vcl::CommandInfoProvider::Instance().GetPropertiesForCommand(aCommandURL, m_xFrame);+ sal_Int32 nProps = vcl::CommandInfoProvider::GetPropertiesForCommand(aCommandURL, m_xFrame); if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON ) m_pToolBar->SetItemBits( nId, m_pToolBar->GetItemBits( nId ) | ToolBoxItemBits::CHECKABLE ); }@@ -1046,7 +1046,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine aProp[i].Value >>= nStyle; } - if (vcl::CommandInfoProvider::Instance().IsExperimental(aCommandURL, m_aModuleIdentifier) &&+ if (vcl::CommandInfoProvider::IsExperimental(aCommandURL, m_aModuleIdentifier) && !SvtMiscOptions().IsExperimentalMode()) { continue;@@ -1054,7 +1054,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() ) {- OUString aString(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame));+ OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_xFrame)); ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle ); if ( aMenuDesc.is() )@@ -1064,7 +1064,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine } m_pToolBar->InsertItem( nId, aString, nItemBits ); m_pToolBar->SetItemCommand( nId, aCommandURL );- OUString sTooltip = vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame);+ OUString sTooltip = vcl::CommandInfoProvider::GetTooltipForCommand(aCommandURL, m_xFrame); if (!sTooltip.isEmpty()) m_pToolBar->SetQuickHelpText( nId, sTooltip ); @@ -1483,7 +1483,7 @@ bool ToolBarManager::MenuItemAllowed( sal_uInt16 ) const pVisibleItemsPopupMenu->InsertItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->GetItemText( nId ), MenuItemBits::CHECKABLE ); pVisibleItemsPopupMenu->CheckItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->IsItemVisible( nId ) ); pVisibleItemsPopupMenu->SetItemCommand( STARTID_CUSTOMIZE_POPUPMENU+nPos, aCommandURL );- Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, m_xFrame));+ Image aImage(vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, m_xFrame)); commandToImage[aCommandURL] = aImage; pVisibleItemsPopupMenu->SetItemImage( STARTID_CUSTOMIZE_POPUPMENU+nPos, aImage ); }diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxxindex 003c74c..7a94b80 100644--- a/framework/source/uielement/toolbarsmenucontroller.cxx+++ b/framework/source/uielement/toolbarsmenucontroller.cxx@@ -147,7 +147,7 @@ void ToolbarsMenuController::addCommand( OUString aLabel; if ( rLabel.isEmpty() )- aLabel = vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand( rCommandURL, m_xFrame );+ aLabel = vcl::CommandInfoProvider::GetMenuLabelForCommand( rCommandURL, m_xFrame ); else aLabel = rLabel; @@ -167,7 +167,7 @@ void ToolbarsMenuController::addCommand( const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); if ( rSettings.GetUseImagesInMenus() )- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommandURL, m_xFrame);+ aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommandURL, m_xFrame); VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(VCLXPopupMenu::GetImplementation( rPopupMenu )); if ( pPopupMenu )diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxxindex 93f4f3f..6bf3c26 100644--- a/include/vcl/commandinfoprovider.hxx+++ b/include/vcl/commandinfoprovider.hxx@@ -27,6 +27,9 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/ui/XAcceleratorConfiguration.hpp> +using namespace css;+using namespace css::uno;+ namespace vcl { @@ -36,16 +39,8 @@ namespace vcl { class VCL_DLLPUBLIC CommandInfoProvider { public:- /** Return the singleton instance.-- It caches some objects for the last XFrame object given to- GetLabelForCommand. These objects are release and created new- when that method is called with a different XFrame from the- last call.-- Lifetime control should work but could be more elegant.- */- static CommandInfoProvider& Instance();+ CommandInfoProvider();+ ~CommandInfoProvider(); /** Return a label for the given command. @param rsCommandName@@ -55,15 +50,15 @@ public: @return The command labe. */- OUString GetLabelForCommand (+ static OUString GetLabelForCommand ( const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame); - OUString GetMenuLabelForCommand (+ static OUString GetMenuLabelForCommand ( const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame); - OUString GetPopupLabelForCommand (+ static OUString GetPopupLabelForCommand ( const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame); @@ -76,62 +71,53 @@ public: The returned label contains the keyboard accelerator, if one is defined and bIncludeShortcut is true. */- OUString GetTooltipForCommand (+ static OUString GetTooltipForCommand ( const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame); /** Returns the shortcut for a command in human-readable form */- OUString GetCommandShortcut (const OUString& rCommandName,+ static OUString GetCommandShortcut (const OUString& rCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame); - OUString GetRealCommandForCommand( const OUString& rCommandName,+ static OUString GetRealCommandForCommand( const OUString& rCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame ); - OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName );+ static OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName ); - Image GetImageForCommand(+ static Image GetImageForCommand( const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame, vcl::ImageType eImageType = vcl::ImageType::Small); - sal_Int32 GetPropertiesForCommand(+ static sal_Int32 GetPropertiesForCommand( const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame); - bool IsRotated(const OUString& rsCommandName);- bool IsMirrored(const OUString& rsCommandName);+ static bool IsRotated(const OUString& rsCommandName,const Reference<frame::XFrame>& rxFrame);+ static bool IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame); /** Returns whether the command is experimental. */- bool IsExperimental(+ static bool IsExperimental( const OUString& rsCommandName, const OUString& rModuleName); /** Do not call. Should be part of a local and hidden interface. */- void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame);+ static void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame); - void dispose();+ static void dispose(); private:- css::uno::Reference<css::uno::XComponentContext> mxContext;- css::uno::Reference<css::frame::XFrame> mxCachedDataFrame;- css::uno::Reference<css::ui::XAcceleratorConfiguration> mxCachedDocumentAcceleratorConfiguration;- css::uno::Reference<css::ui::XAcceleratorConfiguration> mxCachedModuleAcceleratorConfiguration;- css::uno::Reference<css::ui::XAcceleratorConfiguration> mxCachedGlobalAcceleratorConfiguration;- OUString msCachedModuleIdentifier;- css::uno::Reference<css::lang::XComponent> mxFrameListener;-- CommandInfoProvider();- ~CommandInfoProvider();-- css::uno::Reference<css::ui::XAcceleratorConfiguration> const & GetDocumentAcceleratorConfiguration();- css::uno::Reference<css::ui::XAcceleratorConfiguration> const & GetModuleAcceleratorConfiguration();- css::uno::Reference<css::ui::XAcceleratorConfiguration> const & GetGlobalAcceleratorConfiguration();- OUString const & GetModuleIdentifier();- css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties (- const OUString& rsCommandName);- OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName);- bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName);+ static css::uno::Reference<css::lang::XComponent> mxFrameListener;++ static css::uno::Reference<css::ui::XAcceleratorConfiguration> const GetDocumentAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame);+ static css::uno::Reference<css::ui::XAcceleratorConfiguration> const GetModuleAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame);+ static css::uno::Reference<css::ui::XAcceleratorConfiguration> const GetGlobalAcceleratorConfiguration();+ static OUString const GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame);+ static css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties (+ const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame);+ static OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName,const Reference<frame::XFrame>& rxFrame);+ static bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame); static OUString RetrieveShortcutsFromConfiguration( const css::uno::Reference<css::ui::XAcceleratorConfiguration>& rxConfiguration, const OUString& rsCommandName);diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxxindex cda7949..f6916c0 100644--- a/reportdesign/source/ui/report/ReportSection.cxx+++ b/reportdesign/source/ui/report/ReportSection.cxx@@ -447,7 +447,7 @@ void lcl_insertMenuItemImages( else { const OUString sCommand = rContextMenu.GetItemCommand(nId);- rContextMenu.SetItemImage(nId, vcl::CommandInfoProvider::Instance().GetImageForCommand(sCommand, _rFrame));+ rContextMenu.SetItemImage(nId, vcl::CommandInfoProvider::GetImageForCommand(sCommand, _rFrame)); if ( nId == SID_PAGEHEADERFOOTER ) { OUString sText = ModuleRes((_xReportDefinition.is() && _xReportDefinition->getPageHeaderOn()) ? RID_STR_PAGEHEADERFOOTER_DELETE : RID_STR_PAGEHEADERFOOTER_INSERT);diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxxindex dc799a1..f3c4452 100644--- a/sd/source/ui/controller/slidelayoutcontroller.cxx+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx@@ -239,11 +239,11 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, vcl::W sSlotStr = ".uno:DuplicatePage"; else sSlotStr = ".uno:Undo";- aSlotImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(sSlotStr, xFrame);+ aSlotImage = vcl::CommandInfoProvider::GetImageForCommand(sSlotStr, xFrame); OUString sSlotTitle; if( bInsertPage )- sSlotTitle = vcl::CommandInfoProvider::Instance().GetLabelForCommand( sSlotStr, xFrame );+ sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand( sSlotStr, xFrame ); else sSlotTitle = SD_RESSTR( STR_RESET_LAYOUT ); appendEntry( 2, sSlotTitle, aSlotImage);diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxxindex 8a3665b..378747e 100644--- a/sd/source/ui/view/ViewShellBase.cxx+++ b/sd/source/ui/view/ViewShellBase.cxx@@ -976,7 +976,7 @@ vcl::Window* ViewShellBase::GetViewWindow() OUString ViewShellBase::RetrieveLabelFromCommand( const OUString& aCmdURL ) const { Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY );- return vcl::CommandInfoProvider::Instance().GetLabelForCommand( aCmdURL, xFrame );+ return vcl::CommandInfoProvider::GetLabelForCommand( aCmdURL, xFrame ); } int ViewShellBase::getPart() constdiff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxxindex e992cc9..6c613f7 100644--- a/sfx2/source/appl/sfxhelp.cxx+++ b/sfx2/source/appl/sfxhelp.cxx@@ -447,7 +447,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask , OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* pWindow ) { OUString sModuleName = GetHelpModuleName_Impl();- OUString sRealCommand = vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( aCommandURL, getCurrentFrame() );+ OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, getCurrentFrame() ); OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName ); OString aNewHelpId;@@ -565,7 +565,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const if ( nProtocol == INetProtocol::Uno ) // Command can be just an alias to another command.- aRealCommand = vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( rURL, getCurrentFrame() );+ aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( rURL, getCurrentFrame() ); // no URL, just a HelpID (maybe empty in case of keyword search) aHelpURL = CreateHelpURL_Impl( aRealCommand.isEmpty() ? rURL : aRealCommand, aHelpModuleName );diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxxindex 45d26eb8..40a89a1 100644--- a/sfx2/source/sidebar/ControllerFactory.cxx+++ b/sfx2/source/sidebar/ControllerFactory.cxx@@ -125,7 +125,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController( // Add tooltip. if (xController.is()) {- const OUString sTooltip (vcl::CommandInfoProvider::Instance().GetTooltipForCommand(+ const OUString sTooltip (vcl::CommandInfoProvider::GetTooltipForCommand( rsCommandName, rxFrame)); pToolBox->SetQuickHelpText(nItemId, sTooltip);diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxxindex bb948b0..5cbb1be 100644--- a/sfx2/source/sidebar/SidebarToolBox.cxx+++ b/sfx2/source/sidebar/SidebarToolBox.cxx@@ -293,7 +293,7 @@ IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void) if(SfxViewFrame::Current()) { css::uno::Reference<frame::XFrame> xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, xFrame, eImageType);+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, xFrame, eImageType); // Try also to query for add-on images before giving up and use an // empty image. if (!aImage)diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxxindex 91e1c28..1686321 100644--- a/sfx2/source/view/viewsh.cxx+++ b/sfx2/source/view/viewsh.cxx@@ -724,7 +724,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); OUStringBuffer aBuffer( 60 );- aBuffer.append( vcl::CommandInfoProvider::Instance().GetLabelForCommand(+ aBuffer.append( vcl::CommandInfoProvider::GetLabelForCommand( ".uno:PrintDefault", xFrame )); aBuffer.append( " (" );diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxxindex fea4e30..0837033 100644--- a/svx/source/mnuctrls/smarttagmenu.cxx+++ b/svx/source/mnuctrls/smarttagmenu.cxx@@ -181,7 +181,7 @@ void SmartTagMenuController::FillMenu() { const OUString aCommand = ".uno:AutoCorrectDlg?OpenSmartTag:bool=true"; pVCLMenu->InsertSeparator();- pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::Instance().GetPopupLabelForCommand( aCommand, m_xFrame ) );+ pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aCommand, m_xFrame ) ); pVCLMenu->SetItemCommand( nMenuId, aCommand ); } }diff --git a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx b/svx/source/sidebar/shapes/DefaultShapesPanel.cxxindex dfc62187..5bc7620 100644--- a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx+++ b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx@@ -131,7 +131,7 @@ void DefaultShapesPanel::populateShapes() { sSlotStr = aSet.second[i]; aSlotImage = ::GetImage(mxFrame, sSlotStr, false);- sLabel = vcl::CommandInfoProvider::Instance().GetTooltipForCommand(sSlotStr, mxFrame);+ sLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, mxFrame); aSet.first->InsertItem(i, aSlotImage, sLabel); } }diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxxindex 4631e6c..fb2961e 100644--- a/sw/source/uibase/shells/frmsh.cxx+++ b/sw/source/uibase/shells/frmsh.cxx@@ -810,15 +810,15 @@ void SwFrameShell::GetState(SfxItemSet& rSet) { case SID_OBJECT_ALIGN_UP : case FN_FRAME_ALIGN_VERT_TOP:- sNewLabel = vcl::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignTop", GetFrame()->GetFrame().GetFrameInterface());+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignTop", GetFrame()->GetFrame().GetFrameInterface()); break; case SID_OBJECT_ALIGN_MIDDLE: case FN_FRAME_ALIGN_VERT_CENTER:- sNewLabel = vcl::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignVerticalCenter", GetFrame()->GetFrame().GetFrameInterface());+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignVerticalCenter", GetFrame()->GetFrame().GetFrameInterface()); break; case SID_OBJECT_ALIGN_DOWN: case FN_FRAME_ALIGN_VERT_BOTTOM:- sNewLabel = vcl::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignBottom", GetFrame()->GetFrame().GetFrameInterface());+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignBottom", GetFrame()->GetFrame().GetFrameInterface()); break; } }diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxxindex d398d6b..ce2c440 100644--- a/vcl/source/app/svmain.cxx+++ b/vcl/source/app/svmain.cxx@@ -528,7 +528,7 @@ void DeInitVCL() if (pSVData->mpCommandInfoProvider) {- pSVData->mpCommandInfoProvider->dispose();+ vcl::CommandInfoProvider::dispose(); pSVData->mpCommandInfoProvider = nullptr; } diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxxindex e48367c..5d7144f 100644--- a/vcl/source/helper/commandinfoprovider.cxx+++ b/vcl/source/helper/commandinfoprovider.cxx@@ -38,7 +38,6 @@ using namespace css; using namespace css::uno; - namespace { typedef ::cppu::WeakComponentImplHelper <@@ -49,9 +48,8 @@ namespace public FrameListenerInterfaceBase { public:- FrameListener (vcl::CommandInfoProvider& rInfoProvider, const Reference<frame::XFrame>& rxFrame)+ FrameListener (const Reference<frame::XFrame>& rxFrame) : FrameListenerInterfaceBase(m_aMutex),- mrInfoProvider(rInfoProvider), mxFrame(rxFrame) { if (mxFrame.is())@@ -64,7 +62,7 @@ namespace // The same frame can be reused for a different component, e.g. // starting component from the start center, so need to re-init the cached data. if (aEvent.Action == css::frame::FrameAction_COMPONENT_DETACHING)- mrInfoProvider.SetFrame(nullptr);+ vcl::CommandInfoProvider::SetFrame(nullptr); } virtual void SAL_CALL disposing() override {@@ -75,35 +73,18 @@ namespace throw (RuntimeException, std::exception) override { (void)rEvent;- mrInfoProvider.SetFrame(nullptr);+ vcl::CommandInfoProvider::SetFrame(nullptr); mxFrame = nullptr; } private:- vcl::CommandInfoProvider& mrInfoProvider; Reference<frame::XFrame> mxFrame; }; } namespace vcl { -CommandInfoProvider& CommandInfoProvider::Instance()-{- static CommandInfoProvider aProvider;- return aProvider;-}--CommandInfoProvider::CommandInfoProvider()- : mxContext(comphelper::getProcessComponentContext()),- mxCachedDataFrame(),- mxCachedDocumentAcceleratorConfiguration(),- mxCachedModuleAcceleratorConfiguration(),- mxCachedGlobalAcceleratorConfiguration(),- msCachedModuleIdentifier(),- mxFrameListener()-{- ImplGetSVData()->mpCommandInfoProvider = this;-}+CommandInfoProvider::CommandInfoProvider() { } void CommandInfoProvider::dispose() {@@ -112,11 +93,6 @@ void CommandInfoProvider::dispose() mxFrameListener->dispose(); mxFrameListener.clear(); }- mxCachedGlobalAcceleratorConfiguration.clear();- mxCachedModuleAcceleratorConfiguration.clear();- mxCachedDocumentAcceleratorConfiguration.clear();- mxCachedDataFrame.clear();- mxContext.clear(); } CommandInfoProvider::~CommandInfoProvider()@@ -130,7 +106,7 @@ OUString CommandInfoProvider::GetLabelForCommand ( { SetFrame(rxFrame); - return GetCommandProperty("Name", rsCommandName);+ return GetCommandProperty("Name", rsCommandName, rxFrame); } OUString CommandInfoProvider::GetMenuLabelForCommand (@@ -141,7 +117,7 @@ OUString CommandInfoProvider::GetMenuLabelForCommand ( // Here we want to use "Label", not "Name". "Name" is a stripped-down version of "Label" without accelerators // and ellipsis. In the menu, we want to have those accelerators and ellipsis.- return GetCommandProperty("Label", rsCommandName);+ return GetCommandProperty("Label", rsCommandName, rxFrame); } OUString CommandInfoProvider::GetPopupLabelForCommand (@@ -150,10 +126,10 @@ OUString CommandInfoProvider::GetPopupLabelForCommand ( { SetFrame(rxFrame); - OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName));+ OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName, rxFrame)); if (!sPopupLabel.isEmpty()) return sPopupLabel;- return GetCommandProperty("Label", rsCommandName);+ return GetCommandProperty("Label", rsCommandName, rxFrame); } OUString CommandInfoProvider::GetTooltipForCommand (@@ -162,7 +138,7 @@ OUString CommandInfoProvider::GetTooltipForCommand ( { SetFrame(rxFrame); - OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName));+ OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName, rxFrame)); if (sLabel.isEmpty()) { sLabel = GetPopupLabelForCommand(rsCommandName, rxFrame); // Remove '...' at the end and mnemonics (we don't want those in tooltips)@@ -186,11 +162,11 @@ OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName, OUString sShortcut; - sShortcut = RetrieveShortcutsFromConfiguration(GetDocumentAcceleratorConfiguration(), rsCommandName);+ sShortcut = RetrieveShortcutsFromConfiguration(GetDocumentAcceleratorConfiguration(rxFrame), rsCommandName); if (sShortcut.getLength() > 0) return sShortcut; - sShortcut = RetrieveShortcutsFromConfiguration(GetModuleAcceleratorConfiguration(), rsCommandName);+ sShortcut = RetrieveShortcutsFromConfiguration(GetModuleAcceleratorConfiguration(rxFrame), rsCommandName); if (sShortcut.getLength() > 0) return sShortcut; @@ -206,7 +182,7 @@ OUString CommandInfoProvider::GetRealCommandForCommand(const OUString& rCommandN { SetFrame(rxFrame); - return GetCommandProperty("TargetURL", rCommandName);+ return GetCommandProperty("TargetURL", rCommandName, rxFrame); } Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName,@@ -252,8 +228,8 @@ Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName, } try {- Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(ui::theModuleUIConfigurationManagerSupplier::get(mxContext));- Reference<ui::XUIConfigurationManager> xUICfgMgr(xModuleCfgMgrSupplier->getUIConfigurationManager(GetModuleIdentifier()));+ Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext()));+ Reference<ui::XUIConfigurationManager> xUICfgMgr(xModuleCfgMgrSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame))); Sequence< Reference<graphic::XGraphic> > aGraphicSeq; Reference<ui::XImageManager> xModuleImageManager(xUICfgMgr->getImageManager(), UNO_QUERY);@@ -280,7 +256,7 @@ sal_Int32 CommandInfoProvider::GetPropertiesForCommand ( SetFrame(rxFrame); sal_Int32 nValue = 0;- const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame)); for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex) { if (aProperties[nIndex].Name == "Properties")@@ -292,14 +268,14 @@ sal_Int32 CommandInfoProvider::GetPropertiesForCommand ( return nValue; } -bool CommandInfoProvider::IsRotated(const OUString& rsCommandName)+bool CommandInfoProvider::IsRotated(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame) {- return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName);+ return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName, rxFrame); } -bool CommandInfoProvider::IsMirrored(const OUString& rsCommandName)+bool CommandInfoProvider::IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame) {- return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName);+ return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName, rxFrame); } bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,@@ -310,7 +286,7 @@ bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName, { if( rModuleName.getLength() > 0) {- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext()); Reference<container::XNameAccess> xUICommandLabels; if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels ) xUICommandLabels->getByName(rsCommandName) >>= aProperties;@@ -333,98 +309,70 @@ bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName, void CommandInfoProvider::SetFrame (const Reference<frame::XFrame>& rxFrame) {- if (rxFrame != mxCachedDataFrame)+ if (mxFrameListener.is()) {- // Detach from the old frame.- if (mxFrameListener.is())- {- mxFrameListener->dispose();- mxFrameListener = nullptr;- }-- // Release objects that are tied to the old frame.- mxCachedDocumentAcceleratorConfiguration = nullptr;- mxCachedModuleAcceleratorConfiguration = nullptr;- msCachedModuleIdentifier.clear();- mxCachedDataFrame = rxFrame;-- // Connect to the new frame.- if (rxFrame.is())- mxFrameListener = new FrameListener(*this, rxFrame);+ mxFrameListener->dispose();+ mxFrameListener = nullptr; }+ // Connect to the new frame.+ if (rxFrame.is())+ mxFrameListener = new FrameListener(rxFrame); } -Reference<ui::XAcceleratorConfiguration> const & CommandInfoProvider::GetDocumentAcceleratorConfiguration()+Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetDocumentAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame) {- if ( ! mxCachedDocumentAcceleratorConfiguration.is())+ Reference<frame::XController> xController = rxFrame->getController();+ if (xController.is()) {- // Get the accelerator configuration for the document.- if (mxCachedDataFrame.is())+ Reference<frame::XModel> xModel (xController->getModel());+ if (xModel.is()) {- Reference<frame::XController> xController = mxCachedDataFrame->getController();- if (xController.is())+ Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);+ if (xSupplier.is()) {- Reference<frame::XModel> xModel (xController->getModel());- if (xModel.is())+ Reference<ui::XUIConfigurationManager> xConfigurationManager(+ xSupplier->getUIConfigurationManager(),+ UNO_QUERY);+ if (xConfigurationManager.is()) {- Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);- if (xSupplier.is())- {- Reference<ui::XUIConfigurationManager> xConfigurationManager(- xSupplier->getUIConfigurationManager(),- UNO_QUERY);- if (xConfigurationManager.is())- {- mxCachedDocumentAcceleratorConfiguration = xConfigurationManager->getShortCutManager();- }- }+ return xConfigurationManager->getShortCutManager(); } } } }- return mxCachedDocumentAcceleratorConfiguration;+ return nullptr; } -Reference<ui::XAcceleratorConfiguration> const & CommandInfoProvider::GetModuleAcceleratorConfiguration()+Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetModuleAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame) {- if ( ! mxCachedModuleAcceleratorConfiguration.is())+ css::uno::Reference<css::ui::XAcceleratorConfiguration> curModuleAcceleratorConfiguration;+ try {- try- {- Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::theModuleUIConfigurationManagerSupplier::get(mxContext);- Reference<ui::XUIConfigurationManager> xManager (- xSupplier->getUIConfigurationManager(GetModuleIdentifier()));- if (xManager.is())- {- mxCachedModuleAcceleratorConfiguration = xManager->getShortCutManager();- }- }- catch (Exception&)+ Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext());+ Reference<ui::XUIConfigurationManager> xManager (+ xSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));+ if (xManager.is()) {+ curModuleAcceleratorConfiguration = xManager->getShortCutManager(); } }- return mxCachedModuleAcceleratorConfiguration;+ catch (Exception&)+ {+ }+ return curModuleAcceleratorConfiguration; } -Reference<ui::XAcceleratorConfiguration> const & CommandInfoProvider::GetGlobalAcceleratorConfiguration()+Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetGlobalAcceleratorConfiguration() { // Get the global accelerator configuration.- if ( ! mxCachedGlobalAcceleratorConfiguration.is())- {- mxCachedGlobalAcceleratorConfiguration = ui::GlobalAcceleratorConfiguration::create(mxContext);- }+ return ui::GlobalAcceleratorConfiguration::create(comphelper::getProcessComponentContext()); - return mxCachedGlobalAcceleratorConfiguration; } -OUString const & CommandInfoProvider::GetModuleIdentifier()+OUString const CommandInfoProvider::GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame) {- if (msCachedModuleIdentifier.getLength() == 0)- {- Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(mxContext);- msCachedModuleIdentifier = xModuleManager->identify(mxCachedDataFrame);- }- return msCachedModuleIdentifier;+ Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(comphelper::getProcessComponentContext());+ return xModuleManager->identify(rxFrame); } OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(@@ -454,15 +402,15 @@ OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration( return OUString(); } -bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName)+bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame) { Sequence< OUString > aSequence; try {- const OUString sModuleIdentifier (GetModuleIdentifier());+ const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame)); if (!sModuleIdentifier.isEmpty()) {- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext()); Reference<container::XNameAccess> xUICommandLabels; if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) { xUICommandLabels->getByName(rsResourceName) >>= aSequence;@@ -480,16 +428,16 @@ bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const O return false; } -Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const OUString& rsCommandName)+Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame) { Sequence<beans::PropertyValue> aProperties; try {- const OUString sModuleIdentifier (GetModuleIdentifier());+ const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame)); if (sModuleIdentifier.getLength() > 0) {- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext()); Reference<container::XNameAccess> xUICommandLabels; if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) xUICommandLabels->getByName(rsCommandName) >>= aProperties;@@ -502,9 +450,9 @@ Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const O return aProperties; } -OUString CommandInfoProvider::GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName)+OUString CommandInfoProvider::GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame) {- const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame)); for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex) { if (aProperties[nIndex].Name == rsProperty)@@ -528,7 +476,7 @@ OUString CommandInfoProvider::GetCommandPropertyFromModule( const OUString& rCom { if( rModuleName.getLength() > 0) {- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext()); Reference<container::XNameAccess> xUICommandLabels; if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels ) xUICommandLabels->getByName(rCommandName) >>= aProperties;diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxxindex 32bd8b8..27c8107 100644--- a/vcl/source/window/builder.cxx+++ b/vcl/source/window/builder.cxx@@ -879,15 +879,15 @@ namespace if (aCommand.isEmpty()) return; - OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommand, rFrame));+ OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aCommand, rFrame)); if (!aLabel.isEmpty()) pButton->SetText(aLabel); - OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommand, rFrame));+ OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(aCommand, rFrame)); if (!aTooltip.isEmpty()) pButton->SetQuickHelpText(aTooltip); - Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, rFrame));+ Image aImage(vcl::CommandInfoProvider::GetImageForCommand(aCommand, rFrame)); pButton->SetModeImage(aImage); pButton->SetCommandHandler(aCommand);diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxxindex 00b931e..bdc0c7b 100644--- a/vcl/source/window/menu.cxx+++ b/vcl/source/window/menu.cxx@@ -510,9 +510,9 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::f if (rFrame.is()) {- OUString aLabel(CommandInfoProvider::Instance().GetPopupLabelForCommand(rCommand, rFrame));- OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));- Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, rFrame));+ OUString aLabel(CommandInfoProvider::GetPopupLabelForCommand(rCommand, rFrame));+ OUString aTooltip(CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));+ Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame)); InsertItem(nItemId, aLabel, aImage); SetHelpText(nItemId, aTooltip);diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxxindex b1238d2..aa585ad 100644--- a/vcl/source/window/toolbox.cxx+++ b/vcl/source/window/toolbox.cxx@@ -4538,9 +4538,9 @@ void ToolBox::statusChanged( const css::frame::FeatureStateEvent& Event ) // update image orientation for (std::vector<ImplToolItem>::const_iterator it = mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it) {- if (vcl::CommandInfoProvider::Instance().IsMirrored(it->maCommandStr))+ if (vcl::CommandInfoProvider::IsMirrored(it->maCommandStr, Event)) SetItemImageMirrorMode(it->mnId, mbImagesMirrored);- if (vcl::CommandInfoProvider::Instance().IsRotated(it->maCommandStr))+ if (vcl::CommandInfoProvider::IsRotated(it->maCommandStr, Event)) SetItemImageAngle(it->mnId, mnImagesRotationAngle); } }diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxxindex 037d228..e587825 100644--- a/vcl/source/window/toolbox2.cxx+++ b/vcl/source/window/toolbox2.cxx@@ -432,8 +432,8 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText, ToolBoxItem void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css::frame::XFrame>& rFrame, ToolBoxItemBits nBits, const Size& rRequestedSize, sal_uInt16 nPos) {- OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(rCommand, rFrame));- OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));+ OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(rCommand, rFrame));+ OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame)); vcl::ImageType eImageType = vcl::ImageType::Size16; @@ -442,8 +442,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css else if (GetToolboxButtonSize() == ToolBoxButtonSize::Size32) eImageType = vcl::ImageType::Size32; - CommandInfoProvider& rInfoProvider = vcl::CommandInfoProvider::Instance();- Image aImage(rInfoProvider.GetImageForCommand(rCommand, rFrame, eImageType));+ Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame, eImageType)); sal_uInt16 nItemId = GetItemCount() + 1; InsertItem(nItemId, aImage, aLabel, nBits, nPos);