diff options
-rw-r--r-- | desktop/source/app/app.cxx | 1 | ||||
-rw-r--r-- | framework/source/fwi/helper/mischelper.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/toolbarsmenucontroller.cxx | 1 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 76 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/lingu/olmenu.cxx | 74 |
7 files changed, 36 insertions, 125 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 10c3d916f886..4de87894332e 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -70,7 +70,6 @@ #include <com/sun/star/task/OfficeRestartManager.hpp> #include <com/sun/star/task/XRestartManager.hpp> #include <com/sun/star/document/XDocumentEventListener.hpp> -#include <com/sun/star/frame/theUICommandDescription.hpp> #include <com/sun/star/ui/theUIElementFactoryManager.hpp> #include <com/sun/star/ui/theWindowStateConfiguration.hpp> #include <com/sun/star/frame/thePopupMenuControllerFactory.hpp> diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx index 7ce88b29c5fc..21a1b5512c47 100644 --- a/framework/source/fwi/helper/mischelper.cxx +++ b/framework/source/fwi/helper/mischelper.cxx @@ -19,8 +19,6 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/document/XDocumentLanguages.hpp> -#include <com/sun/star/frame/ModuleManager.hpp> -#include <com/sun/star/frame/theUICommandDescription.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/linguistic2/LanguageGuessing.hpp> diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 4fb7f5f45ff0..88c527669710 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -32,7 +32,6 @@ #include <com/sun/star/awt/MenuItemStyle.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/theUICommandDescription.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 6c55b8c8a9e3..073735c1dad1 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -19,12 +19,6 @@ #include <comphelper/processfactory.hxx> -#include <com/sun/star/frame/UnknownModuleException.hpp> -#include <com/sun/star/frame/ModuleManager.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/frame/theUICommandDescription.hpp> - #include "ViewShellBase.hxx" #include <algorithm> #include "EventMultiplexer.hxx" diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index af4ee87f3c6f..bd5684b947a2 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -19,6 +19,7 @@ #include <memory> +#include <vcl/commandinfoprovider.hxx> #include <vcl/menu.hxx> #include <vcl/settings.hxx> #include <svl/intitem.hxx> @@ -32,7 +33,6 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/UnknownModuleException.hpp> -#include <com/sun/star/frame/theUICommandDescription.hpp> #include <officecfg/Office/Common.hxx> #include <sfx2/sfxhelp.hxx> @@ -2154,24 +2154,6 @@ VclPtr<PopupMenu> SfxCommonTemplateDialog_Impl::CreateContextMenu() return mxMenu; } -static OUString lcl_GetLabel(uno::Any& rAny) -{ - OUString sRet; - uno::Sequence< beans::PropertyValue >aPropSeq; - if ( rAny >>= aPropSeq ) - { - for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) - { - if ( aPropSeq[i].Name == "Label" ) - { - aPropSeq[i].Value >>= sRet; - break; - } - } - } - return sRet; -} - SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanelControl* pDlgWindow) : SfxCommonTemplateDialog_Impl(pB, pDlgWindow) , m_pFloat(pDlgWindow) @@ -2414,45 +2396,25 @@ IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox, void ) { //create a popup menu in Writer ScopedVclPtrInstance<PopupMenu> pMenu; - uno::Reference< container::XNameAccess > xNameAccess( - frame::theUICommandDescription::get( - ::comphelper::getProcessComponentContext()) ); - uno::Reference< container::XNameAccess > xUICommands; OUString sTextDoc("com.sun.star.text.TextDocument"); - if(xNameAccess->hasByName(sTextDoc)) - { - uno::Any a = xNameAccess->getByName( sTextDoc ); - a >>= xUICommands; - } - if(!xUICommands.is()) - return; - try - { - uno::Any aCommand = xUICommands->getByName(".uno:StyleNewByExample"); - OUString sLabel = lcl_GetLabel( aCommand ); - pMenu->InsertItem( SID_STYLE_NEW_BY_EXAMPLE, sLabel ); - pMenu->SetHelpId(SID_STYLE_NEW_BY_EXAMPLE, HID_TEMPLDLG_NEWBYEXAMPLE); - - aCommand = xUICommands->getByName(".uno:StyleUpdateByExample"); - sLabel = lcl_GetLabel( aCommand ); - - pMenu->InsertItem( SID_STYLE_UPDATE_BY_EXAMPLE, sLabel ); - pMenu->SetHelpId(SID_STYLE_UPDATE_BY_EXAMPLE, HID_TEMPLDLG_UPDATEBYEXAMPLE); - - aCommand = xUICommands->getByName(".uno:LoadStyles"); - sLabel = lcl_GetLabel( aCommand ); - pMenu->InsertItem( SID_TEMPLATE_LOAD, sLabel ); - pMenu->SetHelpId(SID_TEMPLATE_LOAD, ".uno:LoadStyles"); - - pMenu->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, MenuSelectHdl)); - pMenu->Execute( pBox, - pBox->GetItemRect(nEntry), - PopupMenuFlags::ExecuteDown ); - pBox->EndSelection(); - } - catch (const uno::Exception&) - { - } + + OUString sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:StyleNewByExample", sTextDoc); + 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); + pMenu->InsertItem( SID_STYLE_UPDATE_BY_EXAMPLE, sLabel ); + pMenu->SetHelpId(SID_STYLE_UPDATE_BY_EXAMPLE, HID_TEMPLDLG_UPDATEBYEXAMPLE); + + sLabel = vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:LoadStyles", sTextDoc); + pMenu->InsertItem( SID_TEMPLATE_LOAD, sLabel ); + pMenu->SetHelpId(SID_TEMPLATE_LOAD, ".uno:LoadStyles"); + + pMenu->SetSelectHdl(LINK(this, SfxTemplateDialog_Impl, MenuSelectHdl)); + pMenu->Execute( pBox, + pBox->GetItemRect(nEntry), + PopupMenuFlags::ExecuteDown ); + pBox->EndSelection(); pBox->Invalidate(); } } diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index a8ba5f70adc3..57408af1eb10 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -37,7 +37,6 @@ #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> -#include <com/sun/star/frame/theUICommandDescription.hpp> #include <cppuhelper/implbase.hxx> #include <osl/file.hxx> diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index 86aa66d8cc46..ef30e272192a 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -58,9 +58,9 @@ #include <linguistic/misc.hxx> #include <osl/file.hxx> #include <rtl/string.hxx> +#include <vcl/commandinfoprovider.hxx> #include <vcl/graphicfilter.hxx> #include <sfx2/dispatch.hxx> -#include <sfx2/imagemgr.hxx> #include <sfx2/request.hxx> #include <sfx2/sfxdlg.hxx> #include <svl/itemset.hxx> @@ -77,7 +77,6 @@ #include <map> -#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/document/XDocumentLanguages.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/i18n/ScriptType.hpp> @@ -86,7 +85,6 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/system/SystemShellExecute.hpp> -#include <com/sun/star/frame/theUICommandDescription.hpp> using namespace ::com::sun::star; @@ -216,45 +214,6 @@ void SwSpellPopup::fillLangPopupMenu( pPopupMenu->InsertItem( nLangItemIdStart + MN_MORE_OFFSET, OUString(SW_RES( STR_LANGSTATUS_MORE )) ); } -OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) -{ - OUString aLabel; - if ( !aCmdURL.isEmpty() ) - { - try - { - uno::Reference< container::XNameAccess > const xNameAccess( - frame::theUICommandDescription::get( - ::comphelper::getProcessComponentContext() ), - uno::UNO_QUERY_THROW ); - uno::Reference< container::XNameAccess > xUICommandLabels; - uno::Any a = xNameAccess->getByName( "com.sun.star.text.TextDocument" ); - uno::Reference< container::XNameAccess > xUICommands; - a >>= xUICommandLabels; - OUString aStr; - uno::Sequence< beans::PropertyValue > aPropSeq; - a = xUICommandLabels->getByName( aCmdURL ); - if ( a >>= aPropSeq ) - { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) - { - if ( aPropSeq[i].Name == "Label" ) - { - aPropSeq[i].Value >>= aStr; - break; - } - } - } - aLabel = aStr; - } - catch (const uno::Exception&) - { - } - } - - return aLabel; -} - SwSpellPopup::SwSpellPopup( SwWrtShell* pWrtSh, const uno::Reference< linguistic2::XSpellAlternatives > &xAlt, @@ -331,10 +290,14 @@ SwSpellPopup::SwSpellPopup( } } + uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); + OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame)); + OUString aIgnoreSelection( SW_RES( STR_IGNORE_SELECTION ) ); - OUString aSpellingAndGrammar = RetrieveLabelFromCommand( ".uno:SpellingAndGrammarDialog" ); - m_xPopupMenu->SetItemText(m_nSpellDialogId, aSpellingAndGrammar); - m_xPopupMenu->SetItemText(m_nCorrectDialogId, RetrieveLabelFromCommand(".uno:AutoCorrectDlg")); + m_xPopupMenu->SetItemText(m_nSpellDialogId, + vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:SpellingAndGrammarDialog", aModuleName)); + m_xPopupMenu->SetItemText(m_nCorrectDialogId, + vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:AutoCorrectDlg", aModuleName)); 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); @@ -448,11 +411,8 @@ SwSpellPopup::SwSpellPopup( m_xPopupMenu->EnableItem(m_nLangParaMenuId); if (bUseImagesInMenus) - { - uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); - Image rImg = ::GetImage( xFrame, ".uno:SpellingAndGrammarDialog", false ); - m_xPopupMenu->SetItemImage(m_nSpellDialogId, rImg); - } + m_xPopupMenu->SetItemImage(m_nSpellDialogId, + vcl::CommandInfoProvider::GetImageForCommand(".uno:SpellingAndGrammarDialog", xFrame)); checkRedline(); m_xPopupMenu->RemoveDisabledEntries( true, true ); @@ -548,9 +508,12 @@ SwSpellPopup::SwSpellPopup( m_xPopupMenu->InsertSeparator(OString(), nPos++); } + uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); + OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame)); + OUString aIgnoreSelection( SW_RES( STR_IGNORE_SELECTION ) ); - OUString aSpellingAndGrammar = RetrieveLabelFromCommand( ".uno:SpellingAndGrammarDialog" ); - m_xPopupMenu->SetItemText(m_nSpellDialogId, aSpellingAndGrammar); + m_xPopupMenu->SetItemText(m_nSpellDialogId, + vcl::CommandInfoProvider::GetPopupLabelForCommand(".uno:SpellingAndGrammarDialog", aModuleName)); 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); @@ -610,11 +573,8 @@ SwSpellPopup::SwSpellPopup( m_xPopupMenu->EnableItem(m_nLangParaMenuId); if (bUseImagesInMenus) - { - uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(); - Image rImg = ::GetImage( xFrame, ".uno:SpellingAndGrammarDialog", false ); - m_xPopupMenu->SetItemImage(m_nSpellDialogId, rImg); - } + m_xPopupMenu->SetItemImage(m_nSpellDialogId, + vcl::CommandInfoProvider::GetImageForCommand(".uno:SpellingAndGrammarDialog", xFrame)); checkRedline(); m_xPopupMenu->RemoveDisabledEntries(true, true); |