framework/inc/uielement/toolbarmanager.hxx    |    1 -
 framework/source/uielement/toolbarmanager.cxx |   10 +++-------
 2 files changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 085abe2b7187f2cfd69a5a1c6e84ef0c9c214f78
Author:     Maxim Monastirsky <momonas...@gmail.com>
AuthorDate: Thu Jul 28 01:08:31 2022 +0300
Commit:     Maxim Monastirsky <momonas...@gmail.com>
CommitDate: Wed Aug 10 08:24:27 2022 +0200

    Unnecessary ToolBox::SetItemText call
    
    Change-Id: I8d15e9657b3a6d01de9d07130ae3aa8284fbd178
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138037
    Tested-by: Jenkins
    Reviewed-by: Maxim Monastirsky <momonas...@gmail.com>

diff --git a/framework/inc/uielement/toolbarmanager.hxx 
b/framework/inc/uielement/toolbarmanager.hxx
index 2e7cd1c01a9a..162e14aca4e3 100644
--- a/framework/inc/uielement/toolbarmanager.hxx
+++ b/framework/inc/uielement/toolbarmanager.hxx
@@ -65,7 +65,6 @@ public:
     virtual void Destroy() = 0;
     virtual css::uno::Reference<css::awt::XWindow> GetInterface() = 0;
     virtual void InsertItem(ToolBoxItemId nId,
-                            const OUString& rString,
                             const OUString& rCommandURL,
                             const OUString& rTooltip,
                             const OUString& rLabel,
diff --git a/framework/source/uielement/toolbarmanager.cxx 
b/framework/source/uielement/toolbarmanager.cxx
index b2efe27c2f0a..7dbee84c1072 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -216,16 +216,14 @@ public:
     }
 
     virtual void InsertItem(ToolBoxItemId nId,
-                            const OUString& rString,
                             const OUString& rCommandURL,
                             const OUString& rTooltip,
                             const OUString& rLabel,
                             ToolBoxItemBits nItemBits) override
     {
-        m_pToolBar->InsertItem( nId, rString, nItemBits );
+        m_pToolBar->InsertItem( nId, rLabel, nItemBits );
         m_pToolBar->SetItemCommand( nId, rCommandURL );
         m_pToolBar->SetQuickHelpText(nId, rTooltip);
-        m_pToolBar->SetItemText( nId, rLabel );
         m_pToolBar->EnableItem( nId );
         m_pToolBar->SetItemState( nId, TRISTATE_FALSE );
     }
@@ -420,7 +418,6 @@ public:
     }
 
     virtual void InsertItem(ToolBoxItemId nId,
-                            const OUString& /*rString*/,
                             const OUString& rCommandURL,
                             const OUString& rTooltip,
                             const OUString& rLabel,
@@ -1410,7 +1407,6 @@ void ToolBarManager::FillToolbarFromContainer( const 
Reference< XIndexAccess >&
                     auto aProperties = 
vcl::CommandInfoProvider::GetCommandProperties(aCommandURL, 
m_aModuleIdentifier);
                     if (!aProperties.hasElements()) // E.g., user-provided 
macro command?
                         aProperties = aProps; // Use existing info, including 
user-provided Label
-                    OUString 
aString(vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
 
                     ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( 
nStyle );
 
@@ -1418,9 +1414,9 @@ void ToolBarManager::FillToolbarFromContainer( const 
Reference< XIndexAccess >&
                         aTooltip = 
vcl::CommandInfoProvider::GetTooltipForCommand(aCommandURL, aProperties, 
m_xFrame);
 
                     if ( aLabel.isEmpty() )
-                        aLabel = aString;
+                        aLabel = 
vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
 
-                    m_pImpl->InsertItem(nId, aString, aCommandURL, aTooltip, 
aLabel, nItemBits);
+                    m_pImpl->InsertItem(nId, aCommandURL, aTooltip, aLabel, 
nItemBits);
 
                     // Fill command map. It stores all our commands and from 
what
                     // image manager we got our image. So we can decide if we 
have to use an

Reply via email to