summaryrefslogtreecommitdiff
path: root/sw
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 13:51:46 +0100
commit3b0d29f1461c97c0c812a500b3414b9a50d694ff (patch)
treef29864f730ebc3d3ea31d0cc19481382e819e04f /sw
parentec5e91d6c123bd52f312f96812c35ef03c91fcc6 (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>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/lingu/olmenu.cxx19
-rw-r--r--sw/source/uibase/shells/frmsh.cxx15
2 files changed, 25 insertions, 9 deletions
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index f48e3568312b..16e068d20372 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 14874c78f544..be2997a8a5db 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() )