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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 10758d0..7576d07 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 2ff9df4..d3a04ba 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 b96ec45..87381b2 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 77638fa..9e3f522 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 85bba32..1a86e46 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 f72cc31..5acd113 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 fa60b2c..8ab6958 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 55f3b0d..5711fc1 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 161fce3..f232abf 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 46736f5..b20abfd 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 6cae045..8cc84c1 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 aa3498c..56d12dd 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 3caf634..e34e4d4 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 8b5bac1..5327434 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 12d7412..8e8fa54 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 89ee4c1..5f872e7 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 2158acd..36cdd77 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 e1a42b0..c8fda28 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 b023da8..643d364 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 d648b11..0301bd2 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 8701f66..73a80f4 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 7407922..09685b1 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 e864878..4a14723 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 f48e356..16e068d 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 14874c7..be2997a 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 c55b153..729901d 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 9e20d7f..8fc3a16 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 ad6f245..234a73e 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 ee6259d..e7c4e17 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 34ceee00..1d25c08 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 3cd3ed8..2e24c83 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;