diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2022-07-21 23:56:42 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2022-08-10 08:28:18 +0200 |
commit | c76857fe4e725834e6be9bd5b3273df95bf7fafd (patch) | |
tree | 42ea625d90263c62e0a00cc1935ca8466853cf08 /framework | |
parent | 085abe2b7187f2cfd69a5a1c6e84ef0c9c214f78 (diff) |
Make ToolBox::InsertItem take the command name
For the next patch for tdf#149956 I need the command to be
already set when the VclEventId::ToolboxItemAdded event is emitted.
Change-Id: I3d8ce44b426a3ed5704d4520d6e62bc4efbf8e44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138038
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 9 | ||||
-rw-r--r-- | framework/source/uielement/toolbarmerger.cxx | 3 |
2 files changed, 4 insertions, 8 deletions
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 7dbee84c1072..ef3470a28fb3 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -221,8 +221,7 @@ public: const OUString& rLabel, ToolBoxItemBits nItemBits) override { - m_pToolBar->InsertItem( nId, rLabel, nItemBits ); - m_pToolBar->SetItemCommand( nId, rCommandURL ); + m_pToolBar->InsertItem( nId, rLabel, rCommandURL, nItemBits ); m_pToolBar->SetQuickHelpText(nId, rTooltip); m_pToolBar->EnableItem( nId ); m_pToolBar->SetItemState( nId, TRISTATE_FALSE ); @@ -1525,7 +1524,7 @@ void ToolBarManager::FillAddonToolbar( const Sequence< Sequence< PropertyValue > } else { - m_pToolBar->InsertItem( nId, aTitle ); + m_pToolBar->InsertItem( nId, aTitle, aURL ); OUString aShortcut(vcl::CommandInfoProvider::GetCommandShortcut(aURL, m_xFrame)); if (!aShortcut.isEmpty()) @@ -1536,7 +1535,6 @@ void ToolBarManager::FillAddonToolbar( const Sequence< Sequence< PropertyValue > pRuntimeItemData->aControlType = aControlType; pRuntimeItemData->nWidth = nWidth; m_pToolBar->SetItemData( nId, pRuntimeItemData ); - m_pToolBar->SetItemCommand( nId, aURL ); // 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 @@ -1583,8 +1581,7 @@ void ToolBarManager::FillOverflowToolbar( ToolBox const * pParent ) } const OUString aCommandURL( pParent->GetItemCommand( nId ) ); - m_pToolBar->InsertItem( nId, pParent->GetItemText( nId ) ); - m_pToolBar->SetItemCommand( nId, aCommandURL ); + m_pToolBar->InsertItem( nId, pParent->GetItemText( nId ), aCommandURL ); m_pToolBar->SetQuickHelpText( nId, pParent->GetQuickHelpText( nId ) ); // Handle possible add-on controls. diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx index db9416af66bc..5588ff0522d3 100644 --- a/framework/source/uielement/toolbarmerger.cxx +++ b/framework/source/uielement/toolbarmerger.cxx @@ -630,8 +630,7 @@ void ToolBarMerger::CreateToolbarItem( ToolBox* pToolbar, ToolBox::ImplToolItems { assert(pToolbar->GetItemData(nItemId) == nullptr); // that future would contain a double free - pToolbar->InsertItem( nItemId, rItem.aLabel, ToolBoxItemBits::NONE, nPos ); - pToolbar->SetItemCommand( nItemId, rItem.aCommandURL ); + pToolbar->InsertItem( nItemId, rItem.aLabel, rItem.aCommandURL, ToolBoxItemBits::NONE, nPos ); pToolbar->SetQuickHelpText( nItemId, rItem.aLabel ); pToolbar->SetItemText( nItemId, rItem.aLabel ); pToolbar->EnableItem( nItemId ); |