summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-25 11:21:28 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-11-26 16:46:55 +0100
commitb509d72a79a8c64d03ea8f91c69c58a24e0b2dc7 (patch)
tree97770ab005aac451b4c34a1fae562a3d579adb1f /framework
parentea31d3cc8566eeb9d3dbf55b385d8c619daaddf9 (diff)
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> Reviewed-on: https://gerrit.libreoffice.org/83763
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/macrosmenucontroller.cxx3
-rw-r--r--framework/source/uielement/menubarmanager.cxx8
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx12
-rw-r--r--framework/source/uielement/statusbarmanager.cxx3
-rw-r--r--framework/source/uielement/thesaurusmenucontroller.cxx3
-rw-r--r--framework/source/uielement/toolbarmanager.cxx10
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx5
7 files changed, 29 insertions, 15 deletions
diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx
index 68932229c692..c9beceba63f7 100644
--- a/framework/source/uielement/macrosmenucontroller.cxx
+++ b/framework/source/uielement/macrosmenucontroller.cxx
@@ -79,7 +79,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 2dbb5f9950ce..f7a41c75f9e3 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -947,12 +947,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 )
@@ -1047,7 +1048,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 63a048604d76..27d95652c217 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -360,7 +360,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 );
@@ -370,8 +371,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 )
@@ -521,8 +522,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 89e237c32d56..79c64dd62bf2 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -446,7 +446,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 bfff4cb778a0..179a611b0b8c 100644
--- a/framework/source/uielement/thesaurusmenucontroller.cxx
+++ b/framework/source/uielement/thesaurusmenucontroller.cxx
@@ -103,7 +103,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 5fdb7b223bc4..89cbbb2e5d3f 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -683,7 +683,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;
@@ -1020,15 +1021,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 91c81511766e..080d833f2134 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -150,7 +150,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;