diff --git a/framework/inc/services.h b/framework/inc/services.h index 08f406f5c350..7ad58c5bfac9 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -59,7 +59,6 @@ namespace framework{ #define SERVICENAME_UICOMMANDDESCRIPTION DECLARE_ASCII("com.sun.star.frame.UICommandDescription" ) #define SERVICENAME_UIELEMENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.UIElementFactoryManager" ) #define SERVICENAME_UICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.UIConfigurationManager" ) -#define SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) #define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" ) #define SERVICENAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.ui.UIElementFactory" ) #define SERVICENAME_WINDOWSTATECONFIGURATION DECLARE_ASCII("com.sun.star.ui.WindowStateConfiguration" ) diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx index d34025eb99fe..0ce2e71e6060 100644 --- a/framework/inc/uifactory/menubarfactory.hxx +++ b/framework/inc/uifactory/menubarfactory.hxx @@ -60,7 +60,7 @@ namespace framework ,const char* _pAsciiName ,const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager); + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); protected: MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index ce7150ab4f24..1c20dd3faebe 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include @@ -288,8 +288,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) { Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier; if ( xServiceManager.is() ) - xModuleCfgSupplier = Reference< XModuleUIConfigurationManagerSupplier >( - xServiceManager->createInstance( SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), UNO_QUERY ); + xModuleCfgSupplier = ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(xServiceManager) ); if ( xModuleCfgMgr.is() ) { diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx index 047c99d9e744..f18f6f2d2664 100644 --- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx +++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx @@ -89,7 +89,7 @@ DEFINE_XTYPEPROVIDER_4 ( ModuleUIConfigurationManagerSupplier DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( ModuleUIConfigurationManagerSupplier , ::cppu::OWeakObject , - SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER , + DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ), IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ) diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index bb83d226f751..846d2cebf57d 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #include @@ -1576,9 +1576,8 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh if ( !xModuleAccelCfg.is() ) { - Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( getServiceFactory()->createInstance( - SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), - UNO_QUERY ); + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = + ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(getServiceFactory()) ); try { Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); @@ -1662,9 +1661,8 @@ void MenuBarManager::RetrieveImageManagers() if ( !m_xModuleImageManager.is() ) { - Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( getServiceFactory()->createInstance( - SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), - UNO_QUERY ); + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = + ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(getServiceFactory()) ); Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); m_xModuleImageManager.set( xUICfgMgr->getImageManager(), UNO_QUERY ); m_xModuleImageManager->addConfigurationListener( Reference< XUIConfigurationListener >( diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 317b16a54e67..867a890a5e29 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -203,9 +203,8 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) if ( !xModuleAccelCfg.is() ) { - Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( m_xServiceManager->createInstance( - SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), - UNO_QUERY ); + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = + ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(m_xServiceManager) ); Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); if ( xUICfgMgr.is() ) { diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index cc1bac78414c..af16d7308079 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include @@ -1220,9 +1220,8 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine if ( !m_xModuleImageManager.is() ) { - Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( m_xServiceManager->createInstance( - SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), - UNO_QUERY ); + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = + ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext( m_xServiceManager ) ); m_xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); m_xModuleImageManager = Reference< XImageManager >( m_xUICfgMgr->getImageManager(), UNO_QUERY ); m_xModuleImageManager->addConfigurationListener( Reference< XUIConfigurationListener >( @@ -2245,9 +2244,8 @@ bool ToolBarManager::RetrieveShortcut( const rtl::OUString& rCommandURL, rtl::OU if ( !xModuleAccelCfg.is() ) { - Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( m_xServiceManager->createInstance( - SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), - UNO_QUERY ); + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = + ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(m_xServiceManager) ); try { Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 43a4517f6f97..34520aa830ec 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include @@ -837,10 +837,8 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume aModuleIdentifier = xModuleManager->identify( m_xFrame ); xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= m_xPersistentWindowState; - Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier; - if ( m_xServiceManager.is() ) - xModuleCfgSupplier = Reference< XModuleUIConfigurationManagerSupplier >( - m_xServiceManager->createInstance( SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), UNO_QUERY ); + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = + ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(m_xServiceManager) ); m_xModuleCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier ); Reference< XController > xController = m_xFrame->getController(); diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index 8cdc6bf756a7..53670710d475 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include @@ -91,7 +91,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pMenuBarWrapper, UNO_QUERY ); Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); - CreateUIElement(ResourceURL,Args,"MenuOnly","private:resource/menubar/",xMenuBar,xModuleManager,m_xServiceManager); + CreateUIElement(ResourceURL,Args,"MenuOnly","private:resource/menubar/",xMenuBar,xModuleManager, comphelper::getComponentContext(m_xServiceManager)); return xMenuBar; } void MenuBarFactory::CreateUIElement(const ::rtl::OUString& ResourceURL @@ -100,7 +100,7 @@ void MenuBarFactory::CreateUIElement(const ::rtl::OUString& ResourceURL ,const char* _pAsciiName ,const Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager - ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) { Reference< XUIConfigurationManager > xCfgMgr; Reference< XUIConfigurationManager > xConfigSource; @@ -150,8 +150,8 @@ void MenuBarFactory::CreateUIElement(const ::rtl::OUString& ResourceURL rtl::OUString aModuleIdentifier = _xModuleManager->identify( Reference< XInterface >( xFrame, UNO_QUERY )); if ( !aModuleIdentifier.isEmpty() ) { - Reference< ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier( - _xServiceManager->createInstance( SERVICENAME_MODULEUICONFIGURATIONMANAGERSUPPLIER ), UNO_QUERY ); + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = + ModuleUIConfigurationManagerSupplier::create( _rxContext ); xCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier ); bHasSettings = xCfgMgr->hasSettings( aResourceURL ); } diff --git a/framework/source/uifactory/statusbarfactory.cxx b/framework/source/uifactory/statusbarfactory.cxx index df64bc16f899..dd5448915b75 100644 --- a/framework/source/uifactory/statusbarfactory.cxx +++ b/framework/source/uifactory/statusbarfactory.cxx @@ -78,7 +78,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY ); Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); - MenuBarFactory::CreateUIElement(ResourceURL,Args,NULL,"private:resource/statusbar/",xMenuBar,xModuleManager,m_xServiceManager); + MenuBarFactory::CreateUIElement(ResourceURL,Args,NULL,"private:resource/statusbar/",xMenuBar,xModuleManager, comphelper::getComponentContext(m_xServiceManager)); return xMenuBar; } diff --git a/framework/source/uifactory/toolboxfactory.cxx b/framework/source/uifactory/toolboxfactory.cxx index 69a037c7a934..2a2f790ed2fc 100644 --- a/framework/source/uifactory/toolboxfactory.cxx +++ b/framework/source/uifactory/toolboxfactory.cxx @@ -74,7 +74,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY ); Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); - CreateUIElement(ResourceURL,Args,"PopupMode","private:resource/toolbar/",xMenuBar,xModuleManager,m_xServiceManager); + CreateUIElement(ResourceURL,Args,"PopupMode","private:resource/toolbar/",xMenuBar,xModuleManager,comphelper::getComponentContext(m_xServiceManager)); return xMenuBar; }