diff options
-rw-r--r-- | cui/source/customize/acccfg.cxx | 5 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 8 | ||||
-rw-r--r-- | cui/source/customize/cfgutil.cxx | 5 | ||||
-rw-r--r-- | cui/source/customize/selector.cxx | 14 | ||||
-rw-r--r-- | dbaccess/source/ui/control/opendoccontrols.cxx | 14 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 74 | ||||
-rw-r--r-- | desktop/source/migration/migration.cxx | 10 | ||||
-rw-r--r-- | forms/source/helper/commanddescriptionprovider.cxx | 4 | ||||
-rw-r--r-- | framework/source/lomenubar/FrameHelper.cxx | 4 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 2 | ||||
-rw-r--r-- | offapi/com/sun/star/ui/UICommandDescription.idl | 25 | ||||
-rw-r--r-- | sd/source/ui/dlg/dlgass.cxx | 22 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellBase.cxx | 21 | ||||
-rw-r--r-- | sfx2/source/dialog/recfloat.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 5 | ||||
-rw-r--r-- | svtools/source/uno/contextmenuhelper.cxx | 22 | ||||
-rw-r--r-- | sw/source/ui/lingu/olmenu.cxx | 32 |
18 files changed, 126 insertions, 164 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index eafc26afacd8..84e0eeaac69d 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -56,7 +56,7 @@ #include <com/sun/star/form/XReset.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/frame/XModuleManager.hpp> - +#include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/awt/KeyModifier.hpp> @@ -94,7 +94,6 @@ static ::rtl::OUString SERVICE_UICONFIGMGR (RTL_CONSTASCII_USTRINGP static ::rtl::OUString SERVICE_DESKTOP (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" )); static ::rtl::OUString SERVICE_MODULEMANAGER (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager" )); static ::rtl::OUString SERVICE_GLOBALACCCFG (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.GlobalAcceleratorConfiguration" )); -static ::rtl::OUString SERVICE_UICMDDESCRIPTION (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription" )); static ::rtl::OUString MODULEPROP_SHORTNAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" )); static ::rtl::OUString MODULEPROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryUIName" )); @@ -854,7 +853,7 @@ void SfxAcceleratorConfigPage::InitAccCfg() // no - initialize this instance m_xSMGR = ::comphelper::getProcessServiceFactory(); - m_xUICmdDescription = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICMDDESCRIPTION), css::uno::UNO_QUERY_THROW); + m_xUICmdDescription = css::ui::UICommandDescription::create(comphelper::ComponentContext(m_xSMGR).getUNOContext()); // get the current active frame, which should be our "parent" // for this session diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 325689946a1b..e3b896aec6ee 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -71,6 +71,7 @@ #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> #include <com/sun/star/ui/XUIConfigurationListener.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> @@ -914,12 +915,9 @@ SaveInData::SaveInData( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xNameAccess( - m_xServiceManager->createInstance( - OUString( "com.sun.star.frame.UICommandDescription" ) ), - uno::UNO_QUERY ); + css::ui::UICommandDescription::create(comphelper::ComponentContext(m_xServiceManager).getUNOContext()) ); - if ( xNameAccess.is() ) - xNameAccess->getByName( aModuleId ) >>= m_xCommandToLabelMap; + xNameAccess->getByName( aModuleId ) >>= m_xCommandToLabelMap; if ( !m_xImgMgr.is() ) { diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index e7f95a581b8c..86be792d8a39 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/document/XDocumentInfoSupplier.hpp> #include <com/sun/star/document/XScriptInvocationContext.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include "acccfg.hrc" #include "helpid.hrc" @@ -58,6 +59,7 @@ #include "cuires.hrc" #include <sfx2/app.hxx> #include <sfx2/minfitem.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/documentinfo.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> @@ -76,7 +78,6 @@ using namespace ::com::sun::star::document; namespace css = ::com::sun::star; static ::rtl::OUString SERVICE_UICATEGORYDESCRIPTION (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UICategoryDescription") ); -static ::rtl::OUString SERVICE_UICMDDESCRIPTION (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription") ); SfxStylesInfo_Impl::SfxStylesInfo_Impl() {} @@ -585,7 +586,7 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul m_xGlobalCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICATEGORYDESCRIPTION), css::uno::UNO_QUERY_THROW); m_xModuleCategoryInfo = css::uno::Reference< css::container::XNameAccess >(m_xGlobalCategoryInfo->getByName(m_sModuleLongName) , css::uno::UNO_QUERY_THROW); - m_xUICmdDescription = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICMDDESCRIPTION) , css::uno::UNO_QUERY_THROW); + m_xUICmdDescription = css::ui::UICommandDescription::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext()); InitModule(); InitBasic(); diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index f58aa45d3352..1da7e337b0bf 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -62,6 +62,7 @@ #include <com/sun/star/frame/XDispatchInformationProvider.hpp> #include <com/sun/star/frame/DispatchInformation.hpp> #include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> using ::rtl::OUString; using namespace ::com::sun::star; @@ -429,17 +430,8 @@ void SvxConfigGroupListBox_Impl::Init() }catch(const uno::Exception&) { aModuleId = ::rtl::OUString(); } - Reference< container::XNameAccess > xNameAccess( - xMCF->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.UICommandDescription" )), - xContext ), - UNO_QUERY ); - - if ( xNameAccess.is() ) - { - xNameAccess->getByName( aModuleId ) >>= m_xModuleCommands; - } + Reference< container::XNameAccess > xNameAccess( ui::UICommandDescription::create(xContext) ); + xNameAccess->getByName( aModuleId ) >>= m_xModuleCommands; Reference< container::XNameAccess > xAllCategories( xMCF->createInstanceWithContext( diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx index 750289b5a4d7..693c02b19e67 100644 --- a/dbaccess/source/ui/control/opendoccontrols.cxx +++ b/dbaccess/source/ui/control/opendoccontrols.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/ui/XImageManager.hpp> @@ -49,6 +50,7 @@ namespace dbaui using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::container::XNameAccess; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::beans::PropertyValue; @@ -56,6 +58,7 @@ namespace dbaui using ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier; using ::com::sun::star::ui::XUIConfigurationManager; using ::com::sun::star::ui::XImageManager; + using ::com::sun::star::ui::UICommandDescription; using ::com::sun::star::graphic::XGraphic; String GetCommandText( const sal_Char* _pCommandURL, const ::rtl::OUString& _rModuleName ) @@ -72,16 +75,11 @@ namespace dbaui do { // Retrieve popup menu labels - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if ( !xFactory.is() ) + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + if ( !xContext.is() ) break; - Reference< XNameAccess> xNameAccess; - xNameAccess = xNameAccess.query( xFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.UICommandDescription" ) ) - ) ); - if ( !xNameAccess.is() ) - break; + Reference< XNameAccess> xNameAccess( UICommandDescription::create(xContext) ); xNameAccess->getByName( _rModuleName ) >>= xUICommandLabels; if ( !xUICommandLabels.is() ) diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index e107c48b1efe..1ed400fd236b 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -67,6 +67,7 @@ #include <com/sun/star/task/XJobExecutor.hpp> #include <com/sun/star/task/XRestartManager.hpp> #include <com/sun/star/document/XEventListener.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/ui/XUIElementFactoryRegistration.hpp> #include <com/sun/star/frame/XUIControllerRegistration.hpp> @@ -2090,8 +2091,8 @@ void Desktop::PreloadModuleData( const CommandLineArgs& rArgs ) void Desktop::PreloadConfigurationData() { Reference< XMultiServiceFactory > rFactory = ::comphelper::getProcessServiceFactory(); - Reference< XNameAccess > xNameAccess( rFactory->createInstance( - rtl::OUString( "com.sun.star.frame.UICommandDescription" )), UNO_QUERY ); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference< XNameAccess > xNameAccess( css::ui::UICommandDescription::create(xContext) ); rtl::OUString aWriterDoc( "com.sun.star.text.TextDocument" ); rtl::OUString aCalcDoc( "com.sun.star.sheet.SpreadsheetDocument" ); @@ -2099,47 +2100,44 @@ void Desktop::PreloadConfigurationData() rtl::OUString aImpressDoc( "com.sun.star.presentation.PresentationDocument" ); // preload commands configuration - if ( xNameAccess.is() ) - { - Any a; - Reference< XNameAccess > xCmdAccess; + Any a; + Reference< XNameAccess > xCmdAccess; - try - { - a = xNameAccess->getByName( aWriterDoc ); - a >>= xCmdAccess; - if ( xCmdAccess.is() ) - { - xCmdAccess->getByName( rtl::OUString( ".uno:BasicShapes" )); - xCmdAccess->getByName( rtl::OUString( ".uno:EditGlossary" )); - } - } - catch ( const ::com::sun::star::uno::Exception& ) + try + { + a = xNameAccess->getByName( aWriterDoc ); + a >>= xCmdAccess; + if ( xCmdAccess.is() ) { + xCmdAccess->getByName( rtl::OUString( ".uno:BasicShapes" )); + xCmdAccess->getByName( rtl::OUString( ".uno:EditGlossary" )); } + } + catch ( const ::com::sun::star::uno::Exception& ) + { + } - try - { - a = xNameAccess->getByName( aCalcDoc ); - a >>= xCmdAccess; - if ( xCmdAccess.is() ) - xCmdAccess->getByName( rtl::OUString( ".uno:InsertObjectStarMath" )); - } - catch ( const ::com::sun::star::uno::Exception& ) - { - } + try + { + a = xNameAccess->getByName( aCalcDoc ); + a >>= xCmdAccess; + if ( xCmdAccess.is() ) + xCmdAccess->getByName( rtl::OUString( ".uno:InsertObjectStarMath" )); + } + catch ( const ::com::sun::star::uno::Exception& ) + { + } - try - { - // draw and impress share the same configuration file (DrawImpressCommands.xcu) - a = xNameAccess->getByName( aDrawDoc ); - a >>= xCmdAccess; - if ( xCmdAccess.is() ) - xCmdAccess->getByName( rtl::OUString( ".uno:Polygon" )); - } - catch ( const ::com::sun::star::uno::Exception& ) - { - } + try + { + // draw and impress share the same configuration file (DrawImpressCommands.xcu) + a = xNameAccess->getByName( aDrawDoc ); + a >>= xCmdAccess; + if ( xCmdAccess.is() ) + xCmdAccess->getByName( rtl::OUString( ".uno:Polygon" )); + } + catch ( const ::com::sun::star::uno::Exception& ) + { } // preload window state configuration diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 87702bade412..8424f0975400 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/embed/FileSystemStorageFactory.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> #include <com/sun/star/ui/XUIConfigurationStorage.hpp> #include <com/sun/star/ui/XUIConfigurationPersistence.hpp> @@ -91,12 +92,9 @@ static const char XDG_CONFIG_PART[] = "/.config"; ::rtl::OUString sLabel; uno::Reference< container::XNameAccess > xUICommands; - uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription")) ), uno::UNO_QUERY ); - if ( xNameAccess.is() ) - { - uno::Any a = xNameAccess->getByName( sModuleIdentifier ); - a >>= xUICommands; - } + uno::Reference< container::XNameAccess > xNameAccess( ui::UICommandDescription::create(::comphelper::getProcessComponentContext()) ); + uno::Any a = xNameAccess->getByName( sModuleIdentifier ); + a >>= xUICommands; if (xUICommands.is()) { if ( !sCommand.isEmpty() ) diff --git a/forms/source/helper/commanddescriptionprovider.cxx b/forms/source/helper/commanddescriptionprovider.cxx index 9adff2b7f00f..b0c1b4e32384 100644 --- a/forms/source/helper/commanddescriptionprovider.cxx +++ b/forms/source/helper/commanddescriptionprovider.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <comphelper/namedvaluecollection.hxx> #include <tools/diagnose_ex.h> @@ -48,6 +49,7 @@ namespace frm using ::com::sun::star::container::XNameAccess; using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::beans::PropertyValue; + using ::com::sun::star::ui::UICommandDescription; /** === end UNO using === **/ //==================================================================== @@ -88,7 +90,7 @@ namespace frm Reference< XModuleManager > xModuleManager( _rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument ); - Reference< XNameAccess > xUICommandDescriptions( _rContext.createComponent( "com.sun.star.frame.UICommandDescription" ), UNO_QUERY_THROW ); + Reference< XNameAccess > xUICommandDescriptions( UICommandDescription::create(_rContext.getUNOContext()) ); m_xCommandAccess.set( xUICommandDescriptions->getByName( sModuleID ), UNO_QUERY_THROW ); } catch( const Exception& ) diff --git a/framework/source/lomenubar/FrameHelper.cxx b/framework/source/lomenubar/FrameHelper.cxx index 4193b2e280f7..40631cec92d2 100644 --- a/framework/source/lomenubar/FrameHelper.cxx +++ b/framework/source/lomenubar/FrameHelper.cxx @@ -58,6 +58,7 @@ #include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/ui/XUIElement.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> @@ -276,8 +277,7 @@ FrameHelper::FrameHelper(const Reference< XMultiServiceFactory >& rServiceManag { //Get xUICommands database (to retrieve labels, see FrameJob::getLabelFromCommandURL ()) - Reference < XNameAccess > xNameAccess (m_xMSF->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription"))), - UNO_QUERY); + Reference < XNameAccess > xNameAccess (UICommandDescription::create(comphelper::ComponentContext(m_xMSF).getUNOContext())); xNameAccess->getByName(m_xMM->identify(xFrame)) >>= m_xUICommands; diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index a3fe86f5aa6e..3e76a42ad0c3 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -277,6 +277,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ucb,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\ GlobalAcceleratorConfiguration \ ModuleUIConfigurationManagerSupplier \ + UICommandDescription \ WindowContentFactory \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui/dialogs,\ @@ -1459,7 +1460,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui,\ ModuleUIConfigurationManager \ ModuleWindowStateConfiguration \ UICategoryDescription \ - UICommandDescription \ UIConfigurationManager \ UIElement \ UIElementFactory \ diff --git a/offapi/com/sun/star/ui/UICommandDescription.idl b/offapi/com/sun/star/ui/UICommandDescription.idl index 3be413fa1cbe..c5b8b76f554d 100644 --- a/offapi/com/sun/star/ui/UICommandDescription.idl +++ b/offapi/com/sun/star/ui/UICommandDescription.idl @@ -35,24 +35,19 @@ module com { module sun { module star { module ui { </p> @since OOo 2.0 -*/ - -service UICommandDescription -{ - /** provides access to user interface commands of the installed modules. - <p> - To access the user interface command description of a module, a unique module specifier - must be provided to <member scope="com::sun::star::container">XNameAccess::getByName()</member> function. - The module specifier can be retrieved from the <type scope="com::sun::star::frame">ModuleManager</type> - service. The interface provides references to <type scope="com::sun:star::ui">ModuleUICommandDescription</type>. - </p> + Provides access to user interface commands of the installed modules. - @see com::sun::star::frame::ModuleManager - */ + <p> + To access the user interface command description of a module, a unique module specifier + must be provided to <member scope="com::sun::star::container">XNameAccess::getByName()</member> function. + The module specifier can be retrieved from the <type scope="com::sun::star::frame">ModuleManager</type> + service. The interface provides references to <type scope="com::sun:star::ui">ModuleUICommandDescription</type>. + </p> - interface com::sun::star::container::XNameAccess; -}; + @see com::sun::star::frame::ModuleManager +*/ +service UICommandDescription : com::sun::star::container::XNameAccess; }; }; }; }; diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx index 75f1217c00a0..84da6cadd5ae 100644 --- a/sd/source/ui/dlg/dlgass.cxx +++ b/sd/source/ui/dlg/dlgass.cxx @@ -64,6 +64,7 @@ #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XImageManager.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <unotools/historyoptions.hxx> #include <osl/file.hxx> #include <sfx2/filedlghelper.hxx> @@ -1752,18 +1753,12 @@ String AssistentDlgImpl::GetUiTextForCommand (const ::rtl::OUString& sCommandURL break; // Retrieve popup menu labels - Reference<lang::XMultiServiceFactory> xFactory ( - ::comphelper::getProcessServiceFactory ()); - if ( ! xFactory.is()) + Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); + if ( ! xContext.is()) break; - ::rtl::OUString sModuleIdentifier ("com.sun.star.presentation.PresentationDocument"); - Reference<container::XNameAccess> xNameAccess ( - xFactory->createInstance("com.sun.star.frame.UICommandDescription"), - UNO_QUERY); - if ( ! xNameAccess.is()) - break; - Any a = xNameAccess->getByName(sModuleIdentifier); + Reference<container::XNameAccess> xNameAccess ( ui::UICommandDescription::create(xContext) ); + Any a = xNameAccess->getByName( rtl::OUString("com.sun.star.presentation.PresentationDocument") ); a >>= xUICommandLabels; if ( ! xUICommandLabels.is()) break; @@ -1811,18 +1806,15 @@ Image AssistentDlgImpl::GetUiIconForCommand (const ::rtl::OUString& sCommandURL) break; // Retrieve popup menu labels - Reference<uno::XComponentContext> xContext ( - ::comphelper::getProcessComponentContext()); + Reference<uno::XComponentContext> xContext ( ::comphelper::getProcessComponentContext() ); if ( ! xContext.is()) break; - ::rtl::OUString sModuleIdentifier ("com.sun.star.presentation.PresentationDocument"); - Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier ( ui::ModuleUIConfigurationManagerSupplier::create(xContext)); Reference<com::sun::star::ui::XUIConfigurationManager> xManager ( - xSupplier->getUIConfigurationManager(sModuleIdentifier)); + xSupplier->getUIConfigurationManager( rtl::OUString("com.sun.star.presentation.PresentationDocument") )); if ( ! xManager.is()) break; diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 6898081f5e55..748d2a6460db 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include "ViewShellBase.hxx" #include <algorithm> @@ -1139,6 +1140,7 @@ void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabB if ( !aCmdURL.isEmpty() ) try { Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext(), UNO_QUERY_THROW ); Reference< XModuleManager > xModuleManager( xServiceManager->createInstance( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW ); @@ -1147,20 +1149,17 @@ void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabB if( !aModuleIdentifier.isEmpty() ) { - Reference< XNameAccess > xNameAccess( xServiceManager->createInstance( "com.sun.star.frame.UICommandDescription" ), UNO_QUERY ); - if( xNameAccess.is() ) + Reference< XNameAccess > xNameAccess( ui::UICommandDescription::create(xContext) ); + Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels( xNameAccess->getByName( aModuleIdentifier ), UNO_QUERY_THROW ); + Sequence< PropertyValue > aPropSeq; + if( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq ) { - Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels( xNameAccess->getByName( aModuleIdentifier ), UNO_QUERY_THROW ); - Sequence< PropertyValue > aPropSeq; - if( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq ) + for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) { - for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) + if ( aPropSeq[i].Name == "Name" ) { - if ( aPropSeq[i].Name == "Name" ) - { - aPropSeq[i].Value >>= aLabel; - break; - } + aPropSeq[i].Value >>= aLabel; + break; } } } diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index 49690dab556d..a43b9fba17db 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -21,10 +21,12 @@ #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <svl/eitem.hxx> #include <svtools/generictoolboxcontroller.hxx> #include <vcl/msgbox.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include "recfloat.hxx" @@ -63,10 +65,7 @@ static rtl::OUString GetLabelFromCommandURL( const rtl::OUString& rCommandURL, c if ( !xUICommandDescription.is() ) { xUICommandDescription = uno::Reference< container::XNameAccess >( - xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.UICommandDescription" ))), - uno::UNO_QUERY ); + ui::UICommandDescription::create(comphelper::ComponentContext(xServiceManager).getUNOContext()) ); xTmpNameAccess = xUICommandDescription; } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 3982e2e3f24b..307bcb464071 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include "sfx2/sfxhelp.hxx" #include <sfx2/app.hxx> @@ -2542,18 +2543,13 @@ IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox ) //create a popup menu in Writer boost::scoped_ptr<PopupMenu> pMenu(new PopupMenu); uno::Reference< container::XNameAccess > xNameAccess( - ::comphelper::getProcessServiceFactory()-> - createInstance( ::rtl::OUString( - "com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY ); + ui::UICommandDescription::create(::comphelper::getProcessComponentContext()) ); uno::Reference< container::XNameAccess > xUICommands; - if ( xNameAccess.is() ) + rtl::OUString sTextDoc("com.sun.star.text.TextDocument"); + if(xNameAccess->hasByName(sTextDoc)) { - rtl::OUString sTextDoc("com.sun.star.text.TextDocument"); - if(xNameAccess->hasByName(sTextDoc)) - { - uno::Any a = xNameAccess->getByName( sTextDoc ); - a >>= xUICommands; - } + uno::Any a = xNameAccess->getByName( sTextDoc ); + a >>= xUICommands; } if(!xUICommands.is()) return 0; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index e1d0210c70e5..e33d59c168d4 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -33,6 +33,8 @@ #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/ui/UICommandDescription.hpp> +#include <comphelper/componentcontext.hxx> #include <cppuhelper/implbase1.hxx> #include <osl/file.hxx> @@ -247,8 +249,7 @@ static ::rtl::OUString RetrieveLabelFromCommand( if ( !xNameAccess.is() ) { xNameAccess = css::uno::Reference< css::container::XNameAccess >( - xSMGR->createInstance( - ::rtl::OUString( "com.sun.star.frame.UICommandDescription" )), + css::ui::UICommandDescription::create(comphelper::ComponentContext(xSMGR).getUNOContext()), css::uno::UNO_QUERY_THROW ); s_xNameAccess = xNameAccess; } diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx index 3942760e5a4c..8e28720798ef 100644 --- a/svtools/source/uno/contextmenuhelper.cxx +++ b/svtools/source/uno/contextmenuhelper.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/ImageType.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -442,20 +443,15 @@ ContextMenuHelper::associateUIConfigurationManagers() } uno::Reference< container::XNameAccess > xNameAccess( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.UICommandDescription" ))), - uno::UNO_QUERY ); - if ( xNameAccess.is() ) + ui::UICommandDescription::create(::comphelper::getProcessComponentContext()), + uno::UNO_QUERY_THROW ); + try + { + uno::Any a = xNameAccess->getByName( aModuleId ); + a >>= m_xUICommandLabels; + } + catch ( container::NoSuchElementException& ) { - try - { - uno::Any a = xNameAccess->getByName( aModuleId ); - a >>= m_xUICommandLabels; - } - catch ( container::NoSuchElementException& ) - { - } } } catch ( uno::RuntimeException& ) diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 0539d19e4a0d..7a4cdb95518b 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -89,6 +89,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/ui/UICommandDescription.hpp> using namespace ::com::sun::star; @@ -332,29 +333,26 @@ OUString RetrieveLabelFromCommand( const OUString& aCmdURL ) { try { - uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.frame.UICommandDescription" ), uno::UNO_QUERY ); - if ( xNameAccess.is() ) + uno::Reference< container::XNameAccess > xNameAccess( ui::UICommandDescription::create(::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 ) { - 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++ ) { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) + if ( aPropSeq[i].Name == "Name" ) { - if ( aPropSeq[i].Name == "Name" ) - { - aPropSeq[i].Value >>= aStr; - break; - } + aPropSeq[i].Value >>= aStr; + break; } } - aLabel = aStr; } + aLabel = aStr; } catch (const uno::Exception&) { |