diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-21 14:45:48 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-21 14:45:48 +0200 |
commit | 884217479de20e2ff5217a0829d678f416fb8505 (patch) | |
tree | 162c9577f81dfa0897dc733750d652187fbb299b /framework | |
parent | dbcc5bc9d936533794c194d7d33c59c840e76b68 (diff) |
fdo#46808, Convert more XMultiServiceFactory to XComponentContext
Change-Id: Ia9fe1a95aab5f466ce212e442eba791f265488b5
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/uielement/menubarmanager.hxx | 10 | ||||
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/generictoolbarcontroller.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 67 | ||||
-rw-r--r-- | framework/source/uielement/menubarwrapper.cxx | 2 |
5 files changed, 38 insertions, 45 deletions
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index 6198f71182ed..37d689382ab8 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -81,7 +81,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener { protected: MenuBarManager( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, const ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer, AddonMenu* pAddonMenu, @@ -89,7 +89,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener sal_Bool bDeleteChildren ); MenuBarManager( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, const ::com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer, AddonPopupMenu* pAddonMenu, @@ -98,7 +98,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener public: MenuBarManager( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer >& _xURLTransformer, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, @@ -107,7 +107,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener sal_Bool bDelete, sal_Bool bDeleteChildren ); - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getServiceFactory(); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getComponentContext(); virtual ~MenuBarManager(); @@ -245,7 +245,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xDocAcceleratorManager; ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > m_xGlobalAcceleratorManager; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > m_xDeferedItemContainer; sal_Int16 m_nSymbolsStyle; diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 278492747357..173a0fe730df 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -1169,7 +1169,7 @@ throw (uno::RuntimeException) Reference< XDispatchProvider > xDispatchProvider; MenuBar* pMenuBar = new MenuBar; - m_pInplaceMenuBar = new MenuBarManager( m_xSMGR, m_xFrame, m_xURLTransformer,xDispatchProvider, aModuleIdentifier, pMenuBar, sal_True, sal_True ); + m_pInplaceMenuBar = new MenuBarManager( comphelper::getComponentContext(m_xSMGR), m_xFrame, m_xURLTransformer, xDispatchProvider, aModuleIdentifier, pMenuBar, sal_True, sal_True ); m_pInplaceMenuBar->SetItemContainer( xMergedMenuBar ); SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow ); diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index a76686066fe5..6ed76510a5b3 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -354,7 +354,7 @@ MenuToolbarController::createPopupWindow() throw (::com::sun::star::uno::Runtime Reference< XDispatchProvider > xDispatch; Reference< XURLTransformer > xURLTransformer = URLTransformer::create( m_xContext ); pMenu = new Toolbarmenu(); - m_xMenuManager.set( new MenuBarManager( Reference<XMultiServiceFactory>(m_xContext->getServiceManager(), UNO_QUERY_THROW), m_xFrame, xURLTransformer, xDispatch, m_aModuleIdentifier, pMenu, sal_True, sal_True ) ); + m_xMenuManager.set( new MenuBarManager( m_xContext, m_xFrame, xURLTransformer, xDispatch, m_aModuleIdentifier, pMenu, sal_True, sal_True ) ); if ( m_xMenuManager.is() ) { MenuBarManager* pMgr = dynamic_cast< MenuBarManager* >( m_xMenuManager.get() ); diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 60f9f27ff9dd..b846039f6aca 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -166,7 +166,7 @@ static sal_Int16 getImageTypeFromBools( sal_Bool bBig ) } MenuBarManager::MenuBarManager( - const Reference< XMultiServiceFactory >& xServiceFactory, + const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, const Reference< XURLTransformer >& _xURLTransformer, const Reference< XDispatchProvider >& rDispatchProvider, @@ -178,17 +178,17 @@ MenuBarManager::MenuBarManager( , m_bAcceleratorCfg( sal_False ) , m_bModuleIdentified( sal_False ) , m_aListenerContainer( m_aLock.getShareableOslMutex() ) - , mxServiceFactory(xServiceFactory) + , m_xContext(rxContext) , m_xURLTransformer(_xURLTransformer) , m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MenuBarManager" ); - m_xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( comphelper::getComponentContext(getServiceFactory()) ); + m_xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext ); FillMenuManager( pMenu, rFrame, rDispatchProvider, rModuleIdentifier, bDelete, bDeleteChildren ); } MenuBarManager::MenuBarManager( - const Reference< XMultiServiceFactory >& xServiceFactory, + const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, const Reference< XURLTransformer >& _xURLTransformer, AddonMenu* pAddonMenu, @@ -201,7 +201,7 @@ MenuBarManager::MenuBarManager( , m_bAcceleratorCfg( sal_False ) , m_bModuleIdentified( sal_False ) , m_aListenerContainer( m_aLock.getShareableOslMutex() ) - , mxServiceFactory(xServiceFactory) + , m_xContext(rxContext) , m_xURLTransformer(_xURLTransformer) , m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() ) { @@ -210,7 +210,7 @@ MenuBarManager::MenuBarManager( } MenuBarManager::MenuBarManager( - const Reference< XMultiServiceFactory >& xServiceFactory, + const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, const Reference< XURLTransformer >& _xURLTransformer, AddonPopupMenu* pAddonPopupMenu, @@ -223,7 +223,7 @@ MenuBarManager::MenuBarManager( , m_bAcceleratorCfg( sal_False ) , m_bModuleIdentified( sal_False ) , m_aListenerContainer( m_aLock.getShareableOslMutex() ) - , mxServiceFactory(xServiceFactory) + , m_xContext(rxContext) , m_xURLTransformer(_xURLTransformer) , m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() ) { @@ -387,7 +387,7 @@ void SAL_CALL MenuBarManager::dispose() throw( RuntimeException ) m_xDocAcceleratorManager.clear(); m_xUICommandLabels.clear(); m_xPopupMenuControllerRegistration.clear(); - mxServiceFactory.clear(); + m_xContext.clear(); } } @@ -606,8 +606,7 @@ void MenuBarManager::RemoveListener() // Check service manager reference. Remove listener can be called due // to a disposing call from the frame and therefore we already removed // our listeners and release the service manager reference! - Reference< XMultiServiceFactory > xServiceManager = getServiceFactory(); - if ( xServiceManager.is() ) + if ( m_xContext.is() ) { std::vector< MenuItemHandler* >::iterator p; for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); ++p ) @@ -709,8 +708,7 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& Source ) throw ( Run // Check reference of service manager before we use it. Reference could // be cleared due to RemoveListener call! - Reference< XMultiServiceFactory > xServiceManager( getServiceFactory() ); - if ( xServiceManager.is() ) + if ( m_xContext.is() ) { m_xURLTransformer->parseStrict( aTargetURL ); @@ -850,7 +848,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu ) OUString aMenuCommand( m_aMenuItemCommand ); if ( m_aMenuItemCommand == aSpecialWindowMenu || m_aMenuItemCommand == aSlotSpecialWindowMenu || aMenuCommand == aSpecialWindowCommand ) - MenuManager::UpdateSpecialWindowMenu( pMenu, comphelper::getComponentContext(getServiceFactory()), m_aLock ); + MenuManager::UpdateSpecialWindowMenu( pMenu, m_xContext, m_aLock ); // Check if some modes have changed so we have to update our menu images sal_Int16 nSymbolsStyle = SvtMiscOptions().GetCurrentSymbolsStyle(); @@ -1075,7 +1073,7 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu ) { // window list menu item selected - Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getServiceFactory()) ); + Reference< XDesktop2 > xDesktop = Desktop::create( m_xContext ); sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; Reference< XIndexAccess > xList( xDesktop->getFrames(), UNO_QUERY ); @@ -1176,13 +1174,13 @@ sal_Bool MenuBarManager::MustBeHidden( PopupMenu* pPopupMenu, const Reference< X return sal_True; } + String MenuBarManager::RetrieveLabelFromCommand( const String& aCmdURL ) { - return framework::RetrieveLabelFromCommand(aCmdURL, comphelper::getComponentContext(mxServiceFactory), m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Label"); + return framework::RetrieveLabelFromCommand(aCmdURL, m_xContext, m_xUICommandLabels,m_xFrame,m_aModuleIdentifier,m_bModuleIdentified,"Label"); } - sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandler ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::CreatePopupMenuController" ); @@ -1199,14 +1197,11 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa aPropValue.Value <<= m_xFrame; aSeq[1] <<= aPropValue; - Reference< XComponentContext > xComponentContext( - comphelper::getComponentContext( getServiceFactory() ) ); - Reference< XPopupMenuController > xPopupMenuController( m_xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( aItemCommand, aSeq, - xComponentContext ), + m_xContext ), UNO_QUERY ); if ( xPopupMenuController.is() ) @@ -1336,7 +1331,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF ( aItemCommand.indexOf( ADDONSPOPUPMENU_URL_PREFIX ) == 0 )) { // A special addon popup menu, must be created with a different ctor - MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), m_xFrame, m_xURLTransformer,(AddonPopupMenu *)pPopup, bDeleteChildren, bDeleteChildren ); + MenuBarManager* pSubMenuManager = new MenuBarManager( m_xContext, m_xFrame, m_xURLTransformer,(AddonPopupMenu *)pPopup, bDeleteChildren, bDeleteChildren ); AddMenu(pSubMenuManager,aItemCommand,nItemId); } else @@ -1385,7 +1380,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF AddonMenu* pSubMenu = dynamic_cast< AddonMenu* >( pPopup ); if ( pSubMenu ) { - MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), m_xFrame, m_xURLTransformer,pSubMenu, sal_True, sal_False ); + MenuBarManager* pSubMenuManager = new MenuBarManager( m_xContext, m_xFrame, m_xURLTransformer,pSubMenu, sal_True, sal_False ); AddMenu(pSubMenuManager,aItemCommand,nItemId); pSubMenuManager->m_aMenuItemCommand = OUString(); @@ -1401,7 +1396,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF } else { - MenuBarManager* pSubMenuMgr = new MenuBarManager( getServiceFactory(), rFrame, m_xURLTransformer,rDispatchProvider, aModuleIdentifier, pPopup, bDeleteChildren, bDeleteChildren ); + MenuBarManager* pSubMenuMgr = new MenuBarManager( m_xContext, rFrame, m_xURLTransformer,rDispatchProvider, aModuleIdentifier, pPopup, bDeleteChildren, bDeleteChildren ); AddMenu(pSubMenuMgr,aItemCommand,nItemId); } } @@ -1519,7 +1514,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh if ( !m_bModuleIdentified ) { m_bModuleIdentified = sal_True; - Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext( getServiceFactory() ) ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext ); try { @@ -1566,7 +1561,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh if ( !xModuleAccelCfg.is() ) { Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = - ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(getServiceFactory()) ); + ModuleUIConfigurationManagerSupplier::create( m_xContext ); try { Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); @@ -1587,7 +1582,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh if ( !xGlobalAccelCfg.is() ) { - xGlobalAccelCfg = GlobalAcceleratorConfiguration::create( comphelper::getComponentContext(getServiceFactory()) ); + xGlobalAccelCfg = GlobalAcceleratorConfiguration::create( m_xContext ); m_xGlobalAcceleratorManager = xGlobalAccelCfg; } } @@ -1637,7 +1632,7 @@ void MenuBarManager::RetrieveImageManagers() Reference< XModuleManager2 > xModuleManager; if ( m_aModuleIdentifier.isEmpty() ) - xModuleManager.set( ModuleManager::create( comphelper::getComponentContext( getServiceFactory() ) ) ); + xModuleManager.set( ModuleManager::create( m_xContext ) ); try { @@ -1651,7 +1646,7 @@ void MenuBarManager::RetrieveImageManagers() if ( !m_xModuleImageManager.is() ) { Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier = - ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(getServiceFactory()) ); + ModuleUIConfigurationManagerSupplier::create( m_xContext ); Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); m_xModuleImageManager.set( xUICfgMgr->getImageManager(), UNO_QUERY ); m_xModuleImageManager->addConfigurationListener( Reference< XUIConfigurationListener >( @@ -1872,7 +1867,7 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon if ( !m_bModuleIdentified ) { m_bModuleIdentified = sal_True; - Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(getServiceFactory()) ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext ); try { @@ -1968,9 +1963,9 @@ void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController } } -const Reference< XMultiServiceFactory >& MenuBarManager::getServiceFactory() +const Reference< XComponentContext >& MenuBarManager::getComponentContext() { - return mxServiceFactory; + return m_xContext; } void MenuBarManager::AddMenu(MenuBarManager* pSubMenuManager,const OUString& _sItemCommand,sal_uInt16 _nItemId) @@ -2017,7 +2012,7 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen m_bIsBookmarkMenu = sal_True; OUString aModuleIdentifier; - m_xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( comphelper::getComponentContext(getServiceFactory()) ); + m_xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext ); Reference< XStatusListener > xStatusListener; Reference< XDispatch > xDispatch; @@ -2032,7 +2027,7 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen if ( pPopupMenu ) { Reference< XDispatchProvider > xDispatchProvider; - MenuBarManager* pSubMenuManager = new MenuBarManager( getServiceFactory(), rFrame, m_xURLTransformer,xDispatchProvider, aModuleIdentifier, pPopupMenu, _bHandlePopUp ? sal_False : bDeleteChildren, _bHandlePopUp ? sal_False : bDeleteChildren ); + MenuBarManager* pSubMenuManager = new MenuBarManager( m_xContext, rFrame, m_xURLTransformer,xDispatchProvider, aModuleIdentifier, pPopupMenu, _bHandlePopUp ? sal_False : bDeleteChildren, _bHandlePopUp ? sal_False : bDeleteChildren ); Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY ); @@ -2089,10 +2084,8 @@ void MenuBarManager::SetHdl() m_pVCLMenu->SetDeactivateHdl( LINK( this, MenuBarManager, Deactivate )); m_pVCLMenu->SetSelectHdl( LINK( this, MenuBarManager, Select )); - if ( !m_xURLTransformer.is() && mxServiceFactory.is() ) - m_xURLTransformer.set( - URLTransformer::create( - ::comphelper::getComponentContext(mxServiceFactory)) ); + if ( !m_xURLTransformer.is() && m_xContext.is() ) + m_xURLTransformer.set( URLTransformer::create( m_xContext) ); } } diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index d41acc182b0d..18bcfbe49f51 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -183,7 +183,7 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th // support. This feature is currently used for "Inplace editing"! Reference< XDispatchProvider > xDispatchProvider; - MenuBarManager* pMenuBarManager = new MenuBarManager( m_xServiceFactory, + MenuBarManager* pMenuBarManager = new MenuBarManager( comphelper::getComponentContext(m_xServiceFactory), xFrame, xTrans, xDispatchProvider, |