[Libreoffice-commits] core.git: cui/source cui/uiconfig dbaccess/source forms/source framework/source include/vcl sd/source sfx2/source svx/source sw/source vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 26 12:53:06 UTC 2019


 cui/source/customize/CommandCategoryListBox.cxx        |    8 +--
 cui/source/customize/cfg.cxx                           |    8 +--
 cui/uiconfig/ui/optionsdialog.ui                       |    1 
 dbaccess/source/ui/app/AppDetailPageHelper.cxx         |    7 +-
 dbaccess/source/ui/control/opendoccontrols.cxx         |    3 -
 forms/source/solar/control/navtoolbar.cxx              |    5 +
 framework/source/uielement/macrosmenucontroller.cxx    |    3 -
 framework/source/uielement/menubarmanager.cxx          |    8 +--
 framework/source/uielement/popuptoolbarcontroller.cxx  |   12 +++-
 framework/source/uielement/statusbarmanager.cxx        |    3 -
 framework/source/uielement/thesaurusmenucontroller.cxx |    3 -
 framework/source/uielement/toolbarmanager.cxx          |   10 ++-
 framework/source/uielement/toolbarsmenucontroller.cxx  |    5 +
 include/vcl/commandinfoprovider.hxx                    |   30 +++++++----
 sd/source/ui/controller/slidelayoutcontroller.cxx      |    5 +
 sd/source/ui/view/ViewShellBase.cxx                    |    3 -
 sfx2/source/appl/sfxhelp.cxx                           |   16 ++++--
 sfx2/source/dialog/templdlg.cxx                        |    9 ++-
 sfx2/source/sidebar/ControllerFactory.cxx              |    5 +
 sfx2/source/view/viewsh.cxx                            |    6 +-
 svx/source/mnuctrls/smarttagmenu.cxx                   |    3 -
 svx/source/sidebar/shapes/DefaultShapesPanel.cxx       |    4 +
 svx/source/tbxctrls/tbcontrl.cxx                       |    6 +-
 sw/source/uibase/lingu/olmenu.cxx                      |   19 +++++--
 sw/source/uibase/shells/frmsh.cxx                      |   15 ++++-
 vcl/source/app/salvtables.cxx                          |   11 +++-
 vcl/source/app/weldutils.cxx                           |    6 +-
 vcl/source/helper/commandinfoprovider.cxx              |   44 ++++++-----------
 vcl/source/window/builder.cxx                          |    5 +
 vcl/source/window/menu.cxx                             |    5 +
 vcl/source/window/toolbox2.cxx                         |    5 +
 31 files changed, 172 insertions(+), 101 deletions(-)

New commits:
commit 3b0d29f1461c97c0c812a500b3414b9a50d694ff
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 25 11:21:28 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Nov 26 13:51:46 2019 +0100

    tdf#126043 fetch the command properties just once
    
    Change-Id: Iaf343e9858be36ca8772d9c12eee772d93b4c394
    Reviewed-on: https://gerrit.libreoffice.org/83668
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 10758d0af47a..7576d0771edc 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -216,11 +216,13 @@ void CommandCategoryListBox::FillFunctionsList(
 
     for (const auto & rInfo : xCommands)
     {
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rInfo.Command, m_sModuleLongName);
+
         OUString sUIName    = getCommandName(rInfo.Command);
-        OUString sLabel     = vcl::CommandInfoProvider::GetLabelForCommand(rInfo.Command, m_sModuleLongName);
-        OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand( rInfo.Command, m_xFrame);
+        OUString sLabel     = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
+        OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand(rInfo.Command, aProperties, m_xFrame);
         OUString sPopupLabel =
-                (vcl::CommandInfoProvider::GetPopupLabelForCommand(rInfo.Command, m_sModuleLongName))
+                (vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties))
                 .replaceFirst("~", "");
 
         // Apply the search filter
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 2ff9df40902d..d3a04baa1e7c 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1418,12 +1418,14 @@ int SvxConfigPage::AddFunction(int nTarget, bool bAllowDuplicates)
     OUString aDisplayName;
     OUString aModuleId = vcl::CommandInfoProvider::GetModuleIdentifier( m_xFrame );
 
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aURL, aModuleId);
+
     if ( typeid(*pCurrentSaveInData) == typeid(ContextMenuSaveInData) )
-        aDisplayName = vcl::CommandInfoProvider::GetPopupLabelForCommand( aURL, aModuleId );
+        aDisplayName = vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties);
     else if ( typeid(*pCurrentSaveInData) == typeid(MenuSaveInData) )
-        aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand( aURL, aModuleId );
+        aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand(aProperties);
     else
-        aDisplayName = vcl::CommandInfoProvider::GetLabelForCommand( aURL, aModuleId );
+        aDisplayName = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
 
     SvxConfigEntry* pNewEntryData =
         new SvxConfigEntry( aDisplayName, aURL, false, /*bParentData*/false );
diff --git a/cui/uiconfig/ui/optionsdialog.ui b/cui/uiconfig/ui/optionsdialog.ui
index b96ec45a95ea..87381b2cee59 100644
--- a/cui/uiconfig/ui/optionsdialog.ui
+++ b/cui/uiconfig/ui/optionsdialog.ui
@@ -16,6 +16,7 @@
     <property name="vexpand">True</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="optionsdialog|OptionsDialog">Options</property>
+    <property name="modal">True</property>
     <property name="type_hint">dialog</property>
     <child>
       <placeholder/>
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 77638fa3f798..9e3f52215737 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -193,8 +193,10 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
     m_aBorder->SetBorderStyle(WindowBorderStyle::MONO);
 
     m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:DBDisablePreview",
+        "com.sun.star.sdb.OfficeDatabaseDocument");
     m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,
-                             vcl::CommandInfoProvider::GetLabelForCommand(".uno:DBDisablePreview", "com.sun.star.sdb.OfficeDatabaseDocument"),
+                             vcl::CommandInfoProvider::GetLabelForCommand(aProperties),
                              ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWNONLY|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
     m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
     m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
@@ -974,7 +976,8 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
                 break;
         }
 
-        OUString aCommandLabel = vcl::CommandInfoProvider::GetLabelForCommand(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
+        OUString aCommandLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
         m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel));
         Resize();
 
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx
index 85bba326a054..1a86e465b3c9 100644
--- a/dbaccess/source/ui/control/opendoccontrols.cxx
+++ b/dbaccess/source/ui/control/opendoccontrols.cxx
@@ -111,7 +111,8 @@ namespace dbaui
         m_sModule = OUString::createFromAscii( _pAsciiModuleName );
 
         // our label should equal the UI text of the "Open" command
-        OUString sLabel(vcl::CommandInfoProvider::GetLabelForCommand(".uno:Open", m_sModule));
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:Open", m_sModule);
+        OUString sLabel(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
         m_xControl->set_label(" " + 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.cxx
index f72cc3193dfd..5acd1139e217 100644
--- a/forms/source/solar/control/navtoolbar.cxx
+++ b/forms/source/solar/control/navtoolbar.cxx
@@ -286,8 +286,9 @@ namespace frm
                 {
                     OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) );
                     m_pToolbar->SetItemCommand( pSupportedFeatures->nId, sCommandURL );
-                    m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId,
-                            vcl::CommandInfoProvider::GetLabelForCommand(sCommandURL, m_sModuleId) );
+                    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommandURL, m_sModuleId);
+                    m_pToolbar->SetQuickHelpText(pSupportedFeatures->nId,
+                            vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
                 }
 
                 if ( pSupportedFeatures->bItemWindow )
diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx
index fa60b2cb302c..8ab6958f39eb 100644
--- a/framework/source/uielement/macrosmenucontroller.cxx
+++ b/framework/source/uielement/macrosmenucontroller.cxx
@@ -72,7 +72,8 @@ void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > cons
 
     // insert basic
     OUString aCommand(".uno:MacroDialog");
-    OUString aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand(aCommand, m_aModuleName);
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, m_aModuleName);
+    OUString aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand(aProperties);
     pPopupMenu->InsertItem( 2, aDisplayName );
     pPopupMenu->SetItemCommand( 2, aCommand );
 
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 55f3b0d3450b..5711fc1d36bc 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -935,12 +935,13 @@ bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< XURLT
 
 OUString MenuBarManager::RetrieveLabelFromCommand(const OUString& rCmdURL)
 {
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rCmdURL, m_aModuleIdentifier);
     if ( !m_bHasMenuBar )
     {
         // This is a context menu, prefer "PopupLabel" over "Label".
-        return vcl::CommandInfoProvider::GetPopupLabelForCommand(rCmdURL, m_aModuleIdentifier);
+        return vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties);
     }
-    return vcl::CommandInfoProvider::GetMenuLabelForCommand(rCmdURL, m_aModuleIdentifier);
+    return vcl::CommandInfoProvider::GetMenuLabelForCommand(aProperties);
 }
 
 bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandler )
@@ -1035,7 +1036,8 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
         }
 
         // Command can be just an alias to another command.
-        OUString aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aItemCommand, m_aModuleIdentifier );
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aItemCommand, m_aModuleIdentifier);
+        OUString aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties);
         if ( !aRealCommand.isEmpty() )
             aItemCommand = aRealCommand;
 
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 161fce30402d..f232abfcb30c 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -358,7 +358,8 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
     {
         removeStatusListener( m_aCommandURL );
 
-        OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand( rCommand, m_sModuleName ) );
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rCommand, m_sModuleName);
+        OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties) );
         m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand;
         addStatusListener( m_aCommandURL );
 
@@ -368,8 +369,8 @@ 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::GetLabelForCommand( rCommand, m_sModuleName ) );
-            pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand( rCommand, m_xFrame ) );
+            pToolBox->SetItemText(nId, vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
+            pToolBox->SetQuickHelpText(nId, vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, aProperties, m_xFrame));
 
             Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, pToolBox->GetImageSize());
             if ( !!aImage )
@@ -519,8 +520,11 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent&
     m_bReadOnly = m_xStorable.is() && m_xStorable->isReadonly();
     if ( bLastReadOnly != m_bReadOnly )
     {
+        OUString sCommand = m_bReadOnly ? OUString( ".uno:SaveAs" ) : m_aCommandURL;
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommand,
+            vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame));
         pToolBox->SetQuickHelpText( nId,
-            vcl::CommandInfoProvider::GetTooltipForCommand( m_bReadOnly ? OUString( ".uno:SaveAs" ) : m_aCommandURL, m_xFrame ) );
+            vcl::CommandInfoProvider::GetTooltipForCommand(sCommand, aProperties, 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.cxx
index 46736f51e126..b20abfd2ed99 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -439,7 +439,8 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
 
                 if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
                 {
-                    OUString aString( vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, ""));
+                    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, "");
+                    OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
                     StatusBarItemBits nItemBits( impl_convertItemStyleToItemBits( nStyle ));
 
                     m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset );
diff --git a/framework/source/uielement/thesaurusmenucontroller.cxx b/framework/source/uielement/thesaurusmenucontroller.cxx
index 6cae0457f61d..8cc84c1bdf3b 100644
--- a/framework/source/uielement/thesaurusmenucontroller.cxx
+++ b/framework/source/uielement/thesaurusmenucontroller.cxx
@@ -107,7 +107,8 @@ void ThesaurusMenuController::fillPopupMenu()
 
         pVCLMenu->InsertSeparator();
         OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );
-        pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aThesaurusDialogCmd, m_aModuleName ) );
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aThesaurusDialogCmd, m_aModuleName);
+        pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties) );
         pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
     }
 }
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index aa3498c2723c..56d12dddb0fb 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -681,7 +681,8 @@ void ToolBarManager::CreateControllers()
 
         OUString aCommandURL( m_pToolBar->GetItemCommand( nId ) );
         // Command can be just an alias to another command.
-        OUString aRealCommandURL( vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, m_aModuleIdentifier ) );
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, m_aModuleIdentifier);
+        OUString aRealCommandURL( vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties) );
         if ( !aRealCommandURL.isEmpty() )
             aCommandURL = aRealCommandURL;
 
@@ -1018,15 +1019,16 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
 
                 if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
                 {
-                    OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_aModuleIdentifier));
+                    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, m_aModuleIdentifier);
+                    OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
 
                     ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle );
                     m_pToolBar->InsertItem( nId, aString, nItemBits );
                     m_pToolBar->SetItemCommand( nId, aCommandURL );
                     if ( !aTooltip.isEmpty() )
-                        m_pToolBar->SetQuickHelpText( nId, aTooltip );
+                        m_pToolBar->SetQuickHelpText(nId, aTooltip);
                     else
-                        m_pToolBar->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand(aCommandURL, m_xFrame) );
+                        m_pToolBar->SetQuickHelpText(nId, vcl::CommandInfoProvider::GetTooltipForCommand(aCommandURL, aProperties, m_xFrame));
 
                     if ( !aLabel.isEmpty() )
                     {
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 3caf634f32c4..e34e4d4eb8c7 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -153,7 +153,10 @@ void ToolbarsMenuController::addCommand(
 
     OUString aLabel;
     if ( rLabel.isEmpty() )
-        aLabel = vcl::CommandInfoProvider::GetMenuLabelForCommand( rCommandURL, m_aModuleName );
+    {
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rCommandURL, m_aModuleName);
+        aLabel = vcl::CommandInfoProvider::GetMenuLabelForCommand(aProperties);
+    }
     else
         aLabel = rLabel;
 
diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx
index 8b5bac1a5c31..5327434cb168 100644
--- a/include/vcl/commandinfoprovider.hxx
+++ b/include/vcl/commandinfoprovider.hxx
@@ -24,6 +24,10 @@
 
 namespace com { namespace sun { namespace star { namespace frame { class XFrame; } } } }
 
+namespace com { namespace sun { namespace star {
+    namespace beans { struct PropertyValue; }
+} } }
+
 namespace vcl { namespace CommandInfoProvider {
 
     /** Return a label for the given command.
@@ -32,23 +36,27 @@ namespace vcl { namespace CommandInfoProvider {
         @param rsModuleName
             The current application module.
         @return
+            The command properties.
+    */
+    VCL_DLLPUBLIC css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties(const OUString& rsCommandName, const OUString& rsModuleName);
+
+    /** Return a label for the given command.
+        @param rProperties
+            The properties from GetCommandProperties.
+        @return
             The command label.
     */
-    VCL_DLLPUBLIC OUString GetLabelForCommand (
-        const OUString& rsCommandName,
-        const OUString& rsModuleName);
+    VCL_DLLPUBLIC OUString GetLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties);
 
-    VCL_DLLPUBLIC OUString GetMenuLabelForCommand (
-        const OUString& rsCommandName,
-        const OUString& rsModuleName);
+    VCL_DLLPUBLIC OUString GetMenuLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties);
 
-    VCL_DLLPUBLIC OUString GetPopupLabelForCommand (
-        const OUString& rsCommandName,
-        const OUString& rsModuleName);
+    VCL_DLLPUBLIC OUString GetPopupLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties);
 
     /** Return a tooltip for the given command. Falls back to label if command has no tooltip.
         @param rsCommandName
             The command name is expected to start with .uno:
+        @param rProperties
+            The properties from GetCommandProperties.
         @param rxFrame
             The frame is used to identify the module and document.
         @return
@@ -57,14 +65,14 @@ namespace vcl { namespace CommandInfoProvider {
     */
     VCL_DLLPUBLIC OUString GetTooltipForCommand (
         const OUString& rsCommandName,
+        const css::uno::Sequence<css::beans::PropertyValue>& rProperties,
         const css::uno::Reference<css::frame::XFrame>& rxFrame);
 
     /** Returns the shortcut for a command in human-readable form */
     VCL_DLLPUBLIC OUString GetCommandShortcut (const OUString& rCommandName,
                                                const css::uno::Reference<css::frame::XFrame>& rxFrame);
 
-    VCL_DLLPUBLIC OUString GetRealCommandForCommand( const OUString& rCommandName,
-                                                     const OUString& rsModuleName );
+    VCL_DLLPUBLIC OUString GetRealCommandForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties);
 
     VCL_DLLPUBLIC css::uno::Reference<css::graphic::XGraphic> GetXGraphicForCommand(
         const OUString& rsCommandName,
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
index 12d741224787..8e8fa5413a9c 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -230,7 +230,10 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, vcl::W
 
             OUString sSlotTitle;
             if( bInsertPage )
-                sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand( sSlotStr, rController.getModuleName() );
+            {
+                auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sSlotStr, rController.getModuleName());
+                sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
+            }
             else
                 sSlotTitle = SdResId( STR_RESET_LAYOUT );
             appendEntry( 2, sSlotTitle, aSlotImage);
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 89ee4c17138e..5f872e7b8a7b 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -963,7 +963,8 @@ vcl::Window* ViewShellBase::GetViewWindow()
 OUString ViewShellBase::RetrieveLabelFromCommand( const OUString& aCmdURL ) const
 {
     OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface()));
-    return vcl::CommandInfoProvider::GetLabelForCommand( aCmdURL, aModuleName );
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCmdURL, aModuleName);
+    return vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
 }
 
 int ViewShellBase::getPart() const
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 2158acdcc7fd..36cdd776d64f 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -602,7 +602,8 @@ static SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask   ,
 OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* pWindow )
 {
     OUString sModuleName = GetHelpModuleName_Impl(aCommandURL);
-    OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, getCurrentModuleIdentifier_Impl() );
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, getCurrentModuleIdentifier_Impl());
+    OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties);
     OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName );
 
     OString aNewHelpId;
@@ -643,7 +644,8 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* p
 OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* pWidget)
 {
     OUString sModuleName = GetHelpModuleName_Impl(aCommandURL);
-    OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, getCurrentModuleIdentifier_Impl() );
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, getCurrentModuleIdentifier_Impl());
+    OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties);
     OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName );
 
     OString aNewHelpId;
@@ -1058,8 +1060,11 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
             OUString aRealCommand;
 
             if ( nProtocol == INetProtocol::Uno )
+            {
                 // Command can be just an alias to another command.
-                aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( rURL, getCurrentModuleIdentifier_Impl() );
+                auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rURL, getCurrentModuleIdentifier_Impl());
+                aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties);
+            }
 
             // no URL, just a HelpID (maybe empty in case of keyword search)
             aHelpURL = CreateHelpURL_Impl( aRealCommand.isEmpty() ? rURL : aRealCommand, aHelpModuleName );
@@ -1233,8 +1238,11 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt
             OUString aRealCommand;
 
             if ( nProtocol == INetProtocol::Uno )
+            {
                 // Command can be just an alias to another command.
-                aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( rURL, getCurrentModuleIdentifier_Impl() );
+                auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rURL, getCurrentModuleIdentifier_Impl());
+                aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties);
+            }
 
             // 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/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index e1a42b0fcb90..c8fda286ba17 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -2442,17 +2442,20 @@ IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox, void )
     ScopedVclPtrInstance<PopupMenu> pMenu;
     OUString sTextDoc("com.sun.star.text.TextDocument");
 
-    OUString sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:StyleNewByExample", sTextDoc);
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:StyleNewByExample", sTextDoc);
+    OUString sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties);
     pMenu->InsertItem( SID_STYLE_NEW_BY_EXAMPLE, sLabel );
     pMenu->SetHelpId(SID_STYLE_NEW_BY_EXAMPLE, HID_TEMPLDLG_NEWBYEXAMPLE);
 
-    sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:StyleUpdateByExample", sTextDoc);
+    aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:StyleUpdateByExample", sTextDoc);
+    sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties);
     pMenu->InsertItem( SID_STYLE_UPDATE_BY_EXAMPLE, sLabel );
     pMenu->SetHelpId(SID_STYLE_UPDATE_BY_EXAMPLE, HID_TEMPLDLG_UPDATEBYEXAMPLE);
 
     pMenu->InsertSeparator();
 
-    sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:LoadStyles", sTextDoc);
+    aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:LoadStyles", sTextDoc);
+    sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties);
     pMenu->InsertItem( SID_TEMPLATE_LOAD, sLabel );
     pMenu->SetHelpId(SID_TEMPLATE_LOAD, ".uno:LoadStyles");
 
diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx
index b023da87d184..643d364bb266 100644
--- a/sfx2/source/sidebar/ControllerFactory.cxx
+++ b/sfx2/source/sidebar/ControllerFactory.cxx
@@ -124,9 +124,10 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
         // Add tooltip.
         if (xController.is())
         {
+            auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rsCommandName,
+                vcl::CommandInfoProvider::GetModuleIdentifier(rxFrame));
             const OUString sTooltip (vcl::CommandInfoProvider::GetTooltipForCommand(
-                    rsCommandName,
-                    rxFrame));
+                    rsCommandName, aProperties, rxFrame));
             if (pToolBox->GetQuickHelpText(nItemId).isEmpty())
                 pToolBox->SetQuickHelpText(nItemId, sTooltip);
             pToolBox->EnableItem(nItemId);
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index d648b1159b04..0301bd2acd59 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -722,9 +722,9 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
                         uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
 
                         OUStringBuffer aBuffer( 60 );
-                        aBuffer.append( vcl::CommandInfoProvider::GetLabelForCommand(
-                            ".uno:PrintDefault",
-                            vcl::CommandInfoProvider::GetModuleIdentifier( xFrame ) ) );
+                        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:PrintDefault",
+                            vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
+                        aBuffer.append(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
                         aBuffer.append( " (" );
                         aBuffer.append( aPrinterName );
                         aBuffer.append(')');
diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx
index 8701f669b842..73a80f4b6e4a 100644
--- a/svx/source/mnuctrls/smarttagmenu.cxx
+++ b/svx/source/mnuctrls/smarttagmenu.cxx
@@ -186,7 +186,8 @@ void SmartTagMenuController::FillMenu()
     {
         const OUString aCommand = ".uno:AutoCorrectDlg?OpenSmartTag:bool=true";
         pVCLMenu->InsertSeparator();
-        pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aCommand, m_aModuleName ) );
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, m_aModuleName);
+        pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties) );
         pVCLMenu->SetItemCommand( nMenuId, aCommand );
     }
 }
diff --git a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
index 74079228f65e..09685b182251 100644
--- a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
+++ b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
@@ -127,7 +127,9 @@ void DefaultShapesPanel::populateShapes()
         {
             sSlotStr = aSet.second[i];
             aSlotImage = vcl::CommandInfoProvider::GetImageForCommand(sSlotStr, mxFrame);
-            sLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, mxFrame);
+            auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sSlotStr,
+                vcl::CommandInfoProvider::GetModuleIdentifier(mxFrame));
+            sLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, aProperties, mxFrame);
             aSet.first->InsertItem(i, aSlotImage, sLabel);
         }
     }
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index e864878bf6e1..4a14723c23e7 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -3466,7 +3466,8 @@ void SvxColorToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any>
         // Sidebar uses wide buttons for those.
         m_bSplitButton = typeid( *pToolBox ) != typeid( sfx2::sidebar::SidebarToolBox );
 
-    OUString aCommandLabel = vcl::CommandInfoProvider::GetLabelForCommand( getCommandURL(), getModuleName() );
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(getCommandURL(), getModuleName());
+    OUString aCommandLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
 
     m_xBtnUpdater.reset( new svx::ToolboxButtonColorUpdater( m_nSlotId, nId, pToolBox, !m_bSplitButton,  aCommandLabel ) );
     pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( m_bSplitButton ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) );
@@ -3529,7 +3530,8 @@ VclPtr<vcl::Window> SvxColorToolBoxControl::createPopupWindow( vcl::Window* pPar
                             false,
                             m_aColorSelectFunction);
 
-    OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand( m_aCommandURL, m_sModuleName );
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(m_aCommandURL, m_sModuleName);
+    OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
     pColorWin->SetText( aWindowTitle );
     pColorWin->StartSelection();
     if ( m_bSplitButton )
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index f48e3568312b..16e068d20372 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -293,11 +293,16 @@ SwSpellPopup::SwSpellPopup(
     uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
     OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
 
-    OUString aIgnoreSelection( SwResId( STR_IGNORE_SELECTION ) );
-    m_xPopupMenu->SetItemText(m_nSpellDialogId,
-        vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:SpellingAndGrammarDialog", aModuleName));
-    m_xPopupMenu->SetItemText(m_nCorrectDialogId,
-        vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:AutoCorrectDlg", aModuleName));
+    {
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:SpellingAndGrammarDialog", aModuleName);
+        m_xPopupMenu->SetItemText(m_nSpellDialogId,
+            vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties));
+    }
+    {
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AutoCorrectDlg", aModuleName);
+        m_xPopupMenu->SetItemText(m_nCorrectDialogId,
+            vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties));
+    }
 
     if (comphelper::LibreOfficeKit::isActive())
     {
@@ -307,6 +312,7 @@ SwSpellPopup::SwSpellPopup(
         m_xPopupMenu->HideItem(m_nCorrectMenuId);
     }
     sal_uInt16 nItemPos = m_xPopupMenu->GetItemPos(m_nIgnoreWordId);
+    OUString aIgnoreSelection( SwResId( STR_IGNORE_SELECTION ) );
     m_xPopupMenu->InsertItem(MN_IGNORE_SELECTION, aIgnoreSelection, MenuItemBits::NONE, OString(), nItemPos);
     m_xPopupMenu->SetHelpId(MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION);
 
@@ -516,8 +522,9 @@ SwSpellPopup::SwSpellPopup(
     OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
 
     OUString aIgnoreSelection( SwResId( STR_IGNORE_SELECTION ) );
+    auto aCommandProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:SpellingAndGrammarDialog", aModuleName);
     m_xPopupMenu->SetItemText(m_nSpellDialogId,
-        vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:SpellingAndGrammarDialog", aModuleName));
+        vcl::CommandInfoProvider::GetPopupLabelForCommand(aCommandProperties));
     sal_uInt16 nItemPos = m_xPopupMenu->GetItemPos(m_nIgnoreWordId);
     m_xPopupMenu->InsertItem(MN_IGNORE_SELECTION, aIgnoreSelection, MenuItemBits::NONE, OString(), nItemPos);
     m_xPopupMenu->SetHelpId(MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION);
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 14874c78f544..be2997a8a5db 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -880,16 +880,25 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
                             {
                                 case SID_OBJECT_ALIGN_UP :
                                 case FN_FRAME_ALIGN_VERT_TOP:
-                                    sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignTop", aModuleName);
+                                {
+                                    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignTop", aModuleName);
+                                    sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
                                     break;
+                                }
                                 case SID_OBJECT_ALIGN_MIDDLE:
                                 case FN_FRAME_ALIGN_VERT_CENTER:
-                                    sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignVerticalCenter", aModuleName);
+                                {
+                                    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignVerticalCenter", aModuleName);
+                                    sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
                                     break;
+                                }
                                 case SID_OBJECT_ALIGN_DOWN:
                                 case FN_FRAME_ALIGN_VERT_BOTTOM:
-                                    sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignBottom", aModuleName);
+                                {
+                                    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignBottom", aModuleName);
+                                    sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
                                     break;
+                                }
                             }
                         }
                         if ( !sNewLabel.isEmpty() )
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index c55b15367fde..729901d0fc33 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3447,6 +3447,11 @@ private:
     DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
     DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
 
+    bool IsDummyEntry(SvTreeListEntry* pEntry) const
+    {
+        return m_xTreeView->GetEntryText(pEntry).trim() == "<dummy>";
+    }
+
 public:
     SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
         : SalInstanceContainer(pTreeView, pBuilder, bTakeOwnership)
@@ -4215,7 +4220,7 @@ public:
     {
         SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
         rVclIter.iter = m_xTreeView->Next(rVclIter.iter);
-        if (rVclIter.iter && m_xTreeView->GetEntryText(rVclIter.iter) == "<dummy>")
+        if (rVclIter.iter && IsDummyEntry(rVclIter.iter))
             return iter_next(rVclIter);
         return rVclIter.iter != nullptr;
     }
@@ -4228,7 +4233,7 @@ public:
         if (bRet)
         {
             //on-demand dummy entry doesn't count
-            return m_xTreeView->GetEntryText(rVclIter.iter) != "<dummy>";
+            return !IsDummyEntry(rVclIter.iter);
         }
         return bRet;
     }
@@ -4736,7 +4741,7 @@ IMPL_LINK_NOARG(SalInstanceTreeView, ExpandingHdl, SvTreeListBox*, bool)
     {
         auto pChild = m_xTreeView->FirstChild(pEntry);
         assert(pChild);
-        if (m_xTreeView->GetEntryText(pChild) == "<dummy>")
+        if (IsDummyEntry(pChild))
         {
             m_xTreeView->RemoveEntry(pChild);
             bPlaceHolder = true;
diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx
index 9e20d7f69a0d..8fc3a16459cf 100644
--- a/vcl/source/app/weldutils.cxx
+++ b/vcl/source/app/weldutils.cxx
@@ -117,9 +117,11 @@ ToolbarUnoDispatcher::ToolbarUnoDispatcher(Toolbar& rToolbar,
     {
         OUString sCommand = OUString::fromUtf8(rToolbar.get_item_ident(i));
 
-        OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(sCommand, aModuleName));
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommand, aModuleName);
+        OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
         rToolbar.set_item_label(i, aLabel);
-        OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(sCommand, rFrame));
+        OUString aTooltip(
+            vcl::CommandInfoProvider::GetTooltipForCommand(sCommand, aProperties, rFrame));
         rToolbar.set_item_tooltip_text(i, aTooltip);
         auto xImage(vcl::CommandInfoProvider::GetXGraphicForCommand(sCommand, rFrame, eSize));
         rToolbar.set_item_icon(i, xImage);
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index ad6f2457a394..234a73eb2949 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -181,7 +181,7 @@ static bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCom
     return false;
 }
 
-static Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandName, const OUString& rsModuleName)
+Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandName, const OUString& rsModuleName)
 {
     Sequence<beans::PropertyValue> aProperties;
 
@@ -202,12 +202,11 @@ static Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCom
     return aProperties;
 }
 
-static OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const OUString& rsModuleName)
+static OUString GetCommandProperty(const OUString& rsProperty, const Sequence<beans::PropertyValue> &rProperties)
 {
-    const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rsModuleName));
-    auto pProp = std::find_if(aProperties.begin(), aProperties.end(),
+    auto pProp = std::find_if(rProperties.begin(), rProperties.end(),
         [&rsProperty](const beans::PropertyValue& rProp) { return rProp.Name == rsProperty; });
-    if (pProp != aProperties.end())
+    if (pProp != rProperties.end())
     {
         OUString sLabel;
         pProp->Value >>= sLabel;
@@ -216,40 +215,34 @@ static OUString GetCommandProperty(const OUString& rsProperty, const OUString& r
     return OUString();
 }
 
-OUString GetLabelForCommand (
-    const OUString& rsCommandName,
-    const OUString& rsModuleName)
+OUString GetLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties)
 {
-    return GetCommandProperty("Name", rsCommandName, rsModuleName);
+    return GetCommandProperty("Name", rProperties);
 }
 
-OUString GetMenuLabelForCommand (
-    const OUString& rsCommandName,
-    const OUString& rsModuleName)
+OUString GetMenuLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties)
 {
     // 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, rsModuleName);
+    return GetCommandProperty("Label", rProperties);
 }
 
-OUString GetPopupLabelForCommand (
-    const OUString& rsCommandName,
-    const OUString& rsModuleName)
+OUString GetPopupLabelForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties)
 {
-    OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName, rsModuleName));
+    OUString sPopupLabel(GetCommandProperty("PopupLabel", rProperties));
     if (!sPopupLabel.isEmpty())
         return sPopupLabel;
-    return GetCommandProperty("Label", rsCommandName, rsModuleName);
+    return GetCommandProperty("Label", rProperties);
 }
 
-OUString GetTooltipForCommand (
+OUString GetTooltipForCommand(
     const OUString& rsCommandName,
+    const css::uno::Sequence<css::beans::PropertyValue>& rProperties,
     const Reference<frame::XFrame>& rxFrame)
 {
-    OUString sModuleName(GetModuleIdentifier(rxFrame));
-    OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName, sModuleName));
+    OUString sLabel(GetCommandProperty("TooltipLabel", rProperties));
     if (sLabel.isEmpty()) {
-        sLabel = GetPopupLabelForCommand(rsCommandName, sModuleName);
+        sLabel = GetPopupLabelForCommand(rProperties);
         // Remove '...' at the end and mnemonics (we don't want those in tooltips)
         sLabel = comphelper::string::stripEnd(sLabel, '.');
         sLabel = MnemonicGenerator::EraseAllMnemonicChars(sLabel);
@@ -257,7 +250,7 @@ OUString GetTooltipForCommand (
 
     // Command can be just an alias to another command,
     // so need to get the shortcut of the "real" command.
-    const OUString sRealCommand(GetRealCommandForCommand(rsCommandName, sModuleName));
+    const OUString sRealCommand(GetRealCommandForCommand(rProperties));
     const OUString sShortCut(GetCommandShortcut(!sRealCommand.isEmpty() ? sRealCommand : rsCommandName, rxFrame));
     if (!sShortCut.isEmpty())
         return sLabel + " (" + sShortCut + ")";
@@ -285,10 +278,9 @@ OUString GetCommandShortcut (const OUString& rsCommandName,
     return OUString();
 }
 
-OUString GetRealCommandForCommand(const OUString& rCommandName,
-                                  const OUString& rsModuleName)
+OUString GetRealCommandForCommand(const css::uno::Sequence<css::beans::PropertyValue>& rProperties)
 {
-    return GetCommandProperty("TargetURL", rCommandName, rsModuleName);
+    return GetCommandProperty("TargetURL", rProperties);
 }
 
 Reference<graphic::XGraphic> GetXGraphicForCommand(const OUString& rsCommandName,
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index ee6259d4c5d3..e7c4e17d7c65 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1222,11 +1222,12 @@ namespace
             return;
 
         OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
-        OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aCommand, aModuleName));
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aCommand, aModuleName);
+        OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
         if (!aLabel.isEmpty())
             pButton->SetText(aLabel);
 
-        OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(aCommand, rFrame));
+        OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(aCommand, aProperties, rFrame));
         if (!aTooltip.isEmpty())
             pButton->SetQuickHelpText(aTooltip);
 
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 34ceee0069aa..1d25c089e976 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -464,8 +464,9 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::f
     if (rFrame.is())
     {
         OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
-        OUString aLabel(CommandInfoProvider::GetPopupLabelForCommand(rCommand, aModuleName));
-        OUString aTooltip(CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rCommand, aModuleName);
+        OUString aLabel(CommandInfoProvider::GetPopupLabelForCommand(aProperties));
+        OUString aTooltip(CommandInfoProvider::GetTooltipForCommand(rCommand, aProperties, rFrame));
         Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame));
 
         InsertItem(nItemId, aLabel, aImage);
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 3cd3ed85a5ed..2e24c83e7be9 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -422,8 +422,9 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css
                          const Size& rRequestedSize, ImplToolItems::size_type nPos)
 {
     OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
-    OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(rCommand, aModuleName));
-    OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
+    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rCommand, aModuleName);
+    OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
+    OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, aProperties, rFrame));
     Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame, GetImageSize()));
 
     sal_uInt16 nItemId = GetItemCount() + 1;


More information about the Libreoffice-commits mailing list