diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-11-25 11:21:28 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-11-26 16:46:55 +0100 |
commit | b509d72a79a8c64d03ea8f91c69c58a24e0b2dc7 (patch) | |
tree | 97770ab005aac451b4c34a1fae562a3d579adb1f /sfx2 | |
parent | ea31d3cc8566eeb9d3dbf55b385d8c619daaddf9 (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 'sfx2')
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/sidebar/ControllerFactory.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 6 |
4 files changed, 24 insertions, 12 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index c4c1735f6418..6e8c4b20151b 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -594,7 +594,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; @@ -635,7 +636,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; @@ -1046,8 +1048,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 ); @@ -1221,8 +1226,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 2bda9d438466..55d8a0f7d515 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -2434,17 +2434,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 a0598191f3f7..80cd8a122d07 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -720,9 +720,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(')'); |