diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-16 11:10:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-23 17:44:16 +0200 |
commit | 432c0f491712870b82dcf5dee7b98fa5440bfa1a (patch) | |
tree | 485da33b0ce3e04d51dec054940317539c12d914 /framework | |
parent | b493b5a284d5a629d16e733197c7840fb33b469c (diff) |
fdo#46808, use service constructor for frame::ModuleManager
Change-Id: Iae2bd22a22213274d4a7697345b879f6573a30f0
Diffstat (limited to 'framework')
40 files changed, 132 insertions, 158 deletions
diff --git a/framework/inc/framework/titlehelper.hxx b/framework/inc/framework/titlehelper.hxx index 959810b1d7c5..79e78077058e 100644 --- a/framework/inc/framework/titlehelper.hxx +++ b/framework/inc/framework/titlehelper.hxx @@ -31,6 +31,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/frame/XUntitledNumbers.hpp> #include <com/sun/star/frame/XTitle.hpp> @@ -75,7 +76,7 @@ class FWE_DLLPUBLIC TitleHelper : private ::cppu::BaseMutex //--------------------------------------- /** @short lightweight constructor. */ - TitleHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext); //--------------------------------------- /** @short free all internaly used resources. @@ -182,7 +183,7 @@ class FWE_DLLPUBLIC TitleHelper : private ::cppu::BaseMutex private: /** points to the global uno service manager. */ - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::uno::XComponentContext> m_xContext; /** reference to the outside UNO class using this helper. */ css::uno::WeakReference< css::uno::XInterface > m_xOwner; diff --git a/framework/inc/helper/persistentwindowstate.hxx b/framework/inc/helper/persistentwindowstate.hxx index 86f63abeb17e..76adf8f4e43c 100644 --- a/framework/inc/helper/persistentwindowstate.hxx +++ b/framework/inc/helper/persistentwindowstate.hxx @@ -117,7 +117,7 @@ class PersistentWindowState : // interfaces /** @short identify the application module, which is used behind the component of our frame. - @param xSMGR + @param rxContext needed to create needed uno resources. @param xFrame @@ -126,7 +126,7 @@ class PersistentWindowState : // interfaces @return [string] a module identifier for the current frame component. */ - static ::rtl::OUString implst_identifyModule(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + static ::rtl::OUString implst_identifyModule(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& xFrame); //____________________________ diff --git a/framework/inc/jobs/helponstartup.hxx b/framework/inc/jobs/helponstartup.hxx index 86967201db69..4111c98bbae0 100644 --- a/framework/inc/jobs/helponstartup.hxx +++ b/framework/inc/jobs/helponstartup.hxx @@ -31,7 +31,7 @@ #include <com/sun/star/task/XJob.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> namespace framework{ @@ -57,7 +57,7 @@ class HelpOnStartup : private ThreadHelpBase //....................................... /** @short such module manager is used to classify new opened documents. */ - css::uno::Reference< css::frame::XModuleManager > m_xModuleManager; + css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager; //....................................... /** @short is needed to locate a might open help frame. */ diff --git a/framework/inc/jobs/jobexecutor.hxx b/framework/inc/jobs/jobexecutor.hxx index a0ab8f387fac..4b0f70f149c1 100644 --- a/framework/inc/jobs/jobexecutor.hxx +++ b/framework/inc/jobs/jobexecutor.hxx @@ -44,7 +44,7 @@ #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/document/XEventListener.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <cppuhelper/weak.hxx> #include <rtl/ustring.hxx> @@ -77,7 +77,7 @@ class JobExecutor : public css::lang::XTypeProvider css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; /** reference to the module info service */ - css::uno::Reference< css::frame::XModuleManager > m_xModuleManager; + css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager; /** cached list of all registered event names of cfg for call optimization. */ OUStringList m_lEvents; diff --git a/framework/inc/services.h b/framework/inc/services.h index 0b7921586f78..993330937a70 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -69,7 +69,6 @@ namespace framework{ #define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" ) #define SERVICENAME_UICOMMANDDESCRIPTION DECLARE_ASCII("com.sun.star.frame.UICommandDescription" ) #define SERVICENAME_UIELEMENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.UIElementFactoryManager" ) -#define SERVICENAME_MODULEMANAGER DECLARE_ASCII("com.sun.star.frame.ModuleManager" ) #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" ) diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index a757f261410c..3ff6ea106a9b 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -56,7 +56,7 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/frame/XFrameActionListener.hpp> #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/util/XURLTransformer.hpp> @@ -325,7 +325,7 @@ namespace framework UIElement m_aStatusBarElement; UIElement m_aProgressBarElement; com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xProgressBarBackup; - css::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + css::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; css::uno::Reference< ::com::sun::star::ui::XUIElementFactory > m_xUIElementFactoryManager; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowStateSupplier; diff --git a/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx b/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx index 208c6308669d..4961ca8ad812 100644 --- a/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx +++ b/framework/inc/uiconfiguration/moduleuicfgsupplier.hxx @@ -49,7 +49,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> @@ -102,7 +102,7 @@ namespace framework com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xDefaultCfgRootStorage; com::sun::star::uno::Reference< com::sun::star::embed::XStorage > m_xUserCfgRootStorage; com::sun::star::uno::Reference< com::sun::star::embed::XTransactedObject > m_xUserRootCommit; - com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleMgr; + com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleMgr; com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener }; diff --git a/framework/inc/uiconfiguration/windowstateconfiguration.hxx b/framework/inc/uiconfiguration/windowstateconfiguration.hxx index fbf1b20e6a75..61cc1c3cf169 100644 --- a/framework/inc/uiconfiguration/windowstateconfiguration.hxx +++ b/framework/inc/uiconfiguration/windowstateconfiguration.hxx @@ -46,7 +46,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <cppuhelper/implbase2.hxx> #include <rtl/ustring.hxx> @@ -113,7 +113,7 @@ class WindowStateConfiguration : private ThreadHelpBase ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; ModuleToWindowStateFileMap m_aModuleToFileHashMap; ModuleToWindowStateConfigHashMap m_aModuleToWindowStateHashMap; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; }; } // namespace framework diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx index 8c5984ecc057..601b1c3e7531 100644 --- a/framework/inc/uielement/uicommanddescription.hxx +++ b/framework/inc/uielement/uicommanddescription.hxx @@ -46,7 +46,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <cppuhelper/implbase2.hxx> #include <rtl/ustring.hxx> @@ -101,7 +101,7 @@ public: ModuleToCommandFileMap m_aModuleToCommandFileMap; UICommandsHashMap m_aUICommandsHashMap; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xGenericUICommands; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; }; } // namespace framework diff --git a/framework/inc/uifactory/addonstoolboxfactory.hxx b/framework/inc/uifactory/addonstoolboxfactory.hxx index 43097aa46119..d05f11c17c5f 100644 --- a/framework/inc/uifactory/addonstoolboxfactory.hxx +++ b/framework/inc/uifactory/addonstoolboxfactory.hxx @@ -33,7 +33,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -62,7 +62,7 @@ class AddonsToolBoxFactory : protected ThreadHelpBase private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; }; } diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx index 135e6bad6c3f..d34025eb99fe 100644 --- a/framework/inc/uifactory/menubarfactory.hxx +++ b/framework/inc/uifactory/menubarfactory.hxx @@ -32,7 +32,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/implbase2.hxx> @@ -59,14 +59,14 @@ namespace framework ,const char* _pExtraMode ,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::XModuleManager >& _xModuleManager + ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager); protected: MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; }; } diff --git a/framework/inc/uifactory/uielementfactorymanager.hxx b/framework/inc/uifactory/uielementfactorymanager.hxx index 99dc12f2a525..16672532b473 100644 --- a/framework/inc/uifactory/uielementfactorymanager.hxx +++ b/framework/inc/uifactory/uielementfactorymanager.hxx @@ -47,7 +47,7 @@ #include <com/sun/star/ui/XUIElementFactoryRegistration.hpp> #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include "com/sun/star/frame/XModuleManager.hpp" +#include "com/sun/star/frame/XModuleManager2.hpp" #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase3.hxx> @@ -134,7 +134,7 @@ class UIElementFactoryManager : private ThreadHelpBase sal_Bool m_bConfigRead; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; ConfigurationAccess_FactoryManager* m_pConfigAccess; }; diff --git a/framework/inc/uifactory/windowcontentfactorymanager.hxx b/framework/inc/uifactory/windowcontentfactorymanager.hxx index 4711c1fa9120..5facbbd73608 100644 --- a/framework/inc/uifactory/windowcontentfactorymanager.hxx +++ b/framework/inc/uifactory/windowcontentfactorymanager.hxx @@ -35,7 +35,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include "com/sun/star/frame/XModuleManager.hpp" +#include "com/sun/star/frame/XModuleManager2.hpp" #include <cppuhelper/implbase2.hxx> #include <rtl/ustring.hxx> @@ -64,7 +64,7 @@ class WindowContentFactoryManager : private ThreadHelpBase sal_Bool m_bConfigRead; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; ConfigurationAccess_FactoryManager* m_pConfigAccess; }; diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx index 5aee045c1de8..e22af2127f5f 100644 --- a/framework/source/fwe/classes/framelistanalyzer.cxx +++ b/framework/source/fwe/classes/framelistanalyzer.cxx @@ -36,7 +36,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <comphelper/processfactory.hxx> #include <vcl/svapp.hxx> @@ -132,10 +132,10 @@ void FrameListAnalyzer::impl_analyze() { try { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::frame::XModuleManager > xModuleMgr(xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext); ::rtl::OUString sModule = xModuleMgr->identify(m_xReferenceFrame); - m_bReferenceIsBacking = (sModule.equals(SERVICENAME_STARTMODULE)); + m_bReferenceIsBacking = sModule.equals(SERVICENAME_STARTMODULE); } catch(const css::frame::UnknownModuleException&) { @@ -207,8 +207,8 @@ void FrameListAnalyzer::impl_analyze() { try { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::frame::XModuleManager > xModuleMgr(xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + css::uno::Reference< css::frame::XModuleManager2 > xModuleMgr = css::frame::ModuleManager::create(xContext); ::rtl::OUString sModule = xModuleMgr->identify(xFrame); if (sModule.equals(SERVICENAME_STARTMODULE)) { diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index 1782d3404a86..03aedbde529e 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -32,7 +32,7 @@ #include <com/sun/star/frame/UntitledNumbersConst.hpp> #include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/document/XEventBroadcaster.hpp> #include <com/sun/star/beans/XMaterialHolder.hpp> @@ -50,9 +50,9 @@ namespace framework{ namespace css = ::com::sun::star; //----------------------------------------------- -TitleHelper::TitleHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) +TitleHelper::TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext) : ::cppu::BaseMutex () - , m_xSMGR (xSMGR) + , m_xContext (rxContext) , m_xOwner () , m_xUntitledNumbers() , m_xSubTitle () @@ -558,24 +558,19 @@ void TitleHelper::impl_appendModuleName (::rtl::OUStringBuffer& sTitle) // SYNCHRONIZED -> ::osl::ResettableMutexGuard aLock(m_aMutex); - css::uno::Reference< css::uno::XInterface > xOwner = m_xOwner.get(); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + css::uno::Reference< css::uno::XInterface > xOwner = m_xOwner.get(); + css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; aLock.clear (); // <- SYNCHRONIZED try { - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::container::XNameAccess > xConfig( - xModuleManager, - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create(xContext); const ::rtl::OUString sID = xModuleManager->identify(xOwner); - ::comphelper::SequenceAsHashMap lProps = xConfig->getByName (sID); + ::comphelper::SequenceAsHashMap lProps = xModuleManager->getByName (sID); const ::rtl::OUString sUIName = lProps.getUnpackedValueOrDefault (OFFICEFACTORY_PROPNAME_UINAME, ::rtl::OUString()); // An UIname property is an optional value ! diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx index 3964826af56c..1706bd1e0863 100644 --- a/framework/source/fwi/helper/mischelper.cxx +++ b/framework/source/fwi/helper/mischelper.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/document/XDocumentLanguages.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <tools/debug.hxx> @@ -94,7 +94,7 @@ uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGues if ( !_rIni ) { _rIni = sal_True; - Reference< XModuleManager > xModuleManager( _xServiceFactory->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(_xServiceFactory) ); try { diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index 206deaa1187b..1733b922f407 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -37,8 +37,9 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> +#include <comphelper/processfactory.hxx> #include <comphelper/configurationhelper.hxx> #include <vcl/window.hxx> #include <vcl/syswin.hxx> @@ -134,7 +135,7 @@ void SAL_CALL PersistentWindowState::frameAction(const css::frame::FrameActionEv return; // unknown module -> no configuration available! - ::rtl::OUString sModuleName = PersistentWindowState::implst_identifyModule(xSMGR, xFrame); + ::rtl::OUString sModuleName = PersistentWindowState::implst_identifyModule(comphelper::getComponentContext(xSMGR), xFrame); if (sModuleName.isEmpty()) return; @@ -181,14 +182,13 @@ void SAL_CALL PersistentWindowState::disposing(const css::lang::EventObject&) } //***************************************************************************************************************** -::rtl::OUString PersistentWindowState::implst_identifyModule(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , +::rtl::OUString PersistentWindowState::implst_identifyModule(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& xFrame) { ::rtl::OUString sModuleName; - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create( rxContext ); try { diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx index 2264a82ed545..9e702b002fb1 100644 --- a/framework/source/helper/titlebarupdate.cxx +++ b/framework/source/helper/titlebarupdate.cxx @@ -38,13 +38,14 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XMaterialHolder.hpp> #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> #include <unotools/configmgr.hxx> #include <unotools/bootstrap.hxx> @@ -175,13 +176,8 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr aReadLock.unlock(); // <- SYNCHRONIZED - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::container::XNameAccess > xConfig( - xModuleManager, - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create( comphelper::getComponentContext(xSMGR) ); rtl::OUString aModuleId = xModuleManager->identify(xFrame); rtl::OUString sDesktopName; @@ -248,16 +244,11 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr try { - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::container::XNameAccess > xConfig( - xModuleManager, - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create( comphelper::getComponentContext(xSMGR) ); - rInfo.sID = xModuleManager->identify(xFrame); - ::comphelper::SequenceAsHashMap lProps = xConfig->getByName (rInfo.sID); + rInfo.sID = xModuleManager->identify(xFrame); + ::comphelper::SequenceAsHashMap lProps = xModuleManager->getByName (rInfo.sID); rInfo.sUIName = lProps.getUnpackedValueOrDefault (OFFICEFACTORY_PROPNAME_UINAME, ::rtl::OUString()); rInfo.nIcon = lProps.getUnpackedValueOrDefault (OFFICEFACTORY_PROPNAME_ICON , INVALID_ICON_ID ); diff --git a/framework/source/jobs/helponstartup.cxx b/framework/source/jobs/helponstartup.cxx index 017cc4a140d9..8c7201d55938 100644 --- a/framework/source/jobs/helponstartup.cxx +++ b/framework/source/jobs/helponstartup.cxx @@ -46,6 +46,7 @@ //_______________________________________________ // include interfaces #include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/XDesktop.hpp> @@ -90,9 +91,7 @@ DEFINE_INIT_SERVICE(HelpOnStartup, see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations! */ // create some needed uno services and cache it - m_xModuleManager = css::uno::Reference< css::frame::XModuleManager >( - m_xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); + m_xModuleManager = css::frame::ModuleManager::create( comphelper::getComponentContext(m_xSMGR) ); m_xDesktop = css::uno::Reference< css::frame::XFrame >( m_xSMGR->createInstance(SERVICENAME_DESKTOP), @@ -252,13 +251,10 @@ void SAL_CALL HelpOnStartup::disposing(const css::lang::EventObject& aEvent) // Classify it. // SAFE -> ResetableGuard aLock(m_aLock); - css::uno::Reference< css::frame::XModuleManager > xModuleManager = m_xModuleManager; + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); // <- SAFE - if (!xModuleManager.is()) - return ::rtl::OUString(); - ::rtl::OUString sModuleId; try { diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx index fd0b5eee53fd..8672062f1cd7 100644 --- a/framework/source/jobs/jobdispatch.cxx +++ b/framework/source/jobs/jobdispatch.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <rtl/ustrbuf.hxx> #include <vcl/svapp.hxx> @@ -129,10 +129,8 @@ void SAL_CALL JobDispatch::initialize( const css::uno::Sequence< css::uno::Any > { lArguments[a] >>= m_xFrame; - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - m_xSMGR->createInstance( - SERVICENAME_MODULEMANAGER ), - css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager = + css::frame::ModuleManager::create(comphelper::getComponentContext(m_xSMGR)); try { m_sModuleIdentifier = xModuleManager->identify( m_xFrame ); diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx index 0963d58c50b7..84fbb277bbad 100644 --- a/framework/source/jobs/jobexecutor.cxx +++ b/framework/source/jobs/jobexecutor.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <unotools/configpaths.hxx> #include <rtl/ustrbuf.hxx> @@ -78,10 +79,7 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE( JobExecutor , DEFINE_INIT_SERVICE( JobExecutor, { - m_xModuleManager = css::uno::Reference< css::frame::XModuleManager >( - m_xSMGR->createInstance( - SERVICENAME_MODULEMANAGER ), - css::uno::UNO_QUERY_THROW ); + m_xModuleManager = css::frame::ModuleManager::create( comphelper::getComponentContext(m_xSMGR) ); /*Attention I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance() diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 10094d988a33..9bb969292b62 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/FrameAction.hpp> #include <com/sun/star/frame/XUIControllerRegistration.hpp> @@ -137,7 +138,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM , m_bPreserveContentSize( false ) , m_bMenuBarCloser( false ) , m_pInplaceMenuBar( NULL ) - , m_xModuleManager( Reference< XModuleManager >( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )) + , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) )) , m_xUIElementFactoryManager( Reference< ui::XUIElementFactory >( xServiceManager->createInstance( SERVICENAME_UIELEMENTFACTORYMANAGER ), UNO_QUERY )) , m_xPersistentWindowStateSupplier( Reference< XNameAccess >( diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index a5efae10751e..6fdb5f3145b2 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -47,7 +47,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XModel2.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -111,6 +111,7 @@ using ::com::sun::star::uno::Any; using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::container::XEnumeration; using ::com::sun::star::document::XDocumentRecovery; +using ::com::sun::star::frame::ModuleManager; using ::com::sun::star::frame::XModel2; using ::com::sun::star::frame::XModel; using ::com::sun::star::frame::XFrame; @@ -1181,8 +1182,8 @@ void AutoRecovery::implts_specifyAppModuleAndFactory(AutoRecovery::TDocumentInfo aReadLock.unlock(); // <- SAFE ---------------------------------- - css::uno::Reference< css::frame::XModuleManager > xManager (xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::container::XNameAccess > xModuleConfig(xManager , css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xManager = ModuleManager::create( comphelper::getComponentContext(xSMGR) ); + css::uno::Reference< css::container::XNameAccess > xModuleConfig(xManager, css::uno::UNO_QUERY_THROW); if (rInfo.AppModule.isEmpty()) rInfo.AppModule = xManager->identify(rInfo.Document); diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index e3bf76b76006..b56b561e34ba 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -599,7 +599,7 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& m_pWindowCommandDispatch = new WindowCommandDispatch(xSMGR, this); // Initialize title functionality - TitleHelper* pTitleHelper = new TitleHelper(xSMGR); + TitleHelper* pTitleHelper = new TitleHelper( comphelper::getComponentContext(xSMGR) ); m_xTitleHelper = css::uno::Reference< css::frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pTitleHelper), css::uno::UNO_QUERY_THROW); pTitleHelper->setOwner(xThis); } diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx index 8860f0d56c23..d376766a63b4 100644 --- a/framework/source/services/modulemanager.cxx +++ b/framework/source/services/modulemanager.cxx @@ -67,7 +67,7 @@ ModuleManager::impl_createFactory( css::uno::Sequence< rtl::OUString > ModuleManager::impl_getSupportedServiceNames() { css::uno::Sequence< rtl::OUString > s(1); - s[0] = SERVICENAME_MODULEMANAGER; + s[0] = DECLARE_ASCII("com.sun.star.frame.ModuleManager"); return s; } diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx index 0753e9d45e96..088271f1287e 100644 --- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx +++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XSeekable.hpp> @@ -109,7 +110,7 @@ ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons ThreadHelpBase( &Application::GetSolarMutex() ) , m_bDisposed( false ) //TODO_AS , m_bInit( false ) - , m_xModuleMgr( Reference< XModuleManager >( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )) + , m_xModuleMgr( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ) , m_xServiceManager( xServiceManager ) , m_aListenerContainer( m_aLock.getShareableOslMutex() ) { diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx index 8a38346e391d..0c831f3e1505 100644 --- a/framework/source/uiconfiguration/windowstateconfiguration.cxx +++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> #include <com/sun/star/ui/DockingArea.hpp> @@ -1363,14 +1364,12 @@ WindowStateConfiguration::WindowStateConfiguration( const Reference< XMultiServi ThreadHelpBase(), m_xServiceManager( xServiceManager ) { - m_xModuleManager = Reference< XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), - UNO_QUERY ); + m_xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); Reference< XNameAccess > xEmptyNameAccess; - Reference< XNameAccess > xNameAccess( m_xModuleManager, UNO_QUERY_THROW ); Sequence< rtl::OUString > aElementNames; try { - aElementNames = xNameAccess->getElementNames(); + aElementNames = m_xModuleManager->getElementNames(); } catch (const ::com::sun::star::uno::RuntimeException &) { @@ -1381,7 +1380,7 @@ WindowStateConfiguration::WindowStateConfiguration( const Reference< XMultiServi for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) { aModuleIdentifier = aElementNames[i]; - if ( xNameAccess->getByName( aModuleIdentifier ) >>= aSeq ) + if ( m_xModuleManager->getByName( aModuleIdentifier ) >>= aSeq ) { ::rtl::OUString aWindowStateFileStr; for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index 1bc24dda35e1..5f6c847a4a48 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -48,6 +48,7 @@ #include <uielement/toolbarmerger.hxx> #include <com/sun/star/ui/ItemType.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XToolbarController.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -225,8 +226,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue ::rtl::OUString aModuleIdentifier; try { - Reference< XModuleManager > xModuleManager( - m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); aModuleIdentifier = xModuleManager->identify( m_xFrame ); } catch ( const Exception& ) diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index b79f1795bce8..2f1f22e09a2c 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -56,7 +56,7 @@ #include <com/sun/star/ui/ItemType.hpp> #include <com/sun/star/ui/ImageType.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/ItemStyle.hpp> @@ -1537,8 +1537,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh if ( !m_bModuleIdentified ) { m_bModuleIdentified = sal_True; - Reference< XModuleManager > xModuleManager; - xModuleManager = Reference< XModuleManager >( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext( getServiceFactory() ) ); try { @@ -1657,9 +1656,9 @@ void MenuBarManager::RetrieveImageManagers() } } - Reference< XModuleManager > xModuleManager; + Reference< XModuleManager2 > xModuleManager; if ( m_aModuleIdentifier.isEmpty() ) - xModuleManager.set( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + xModuleManager.set( ModuleManager::create( comphelper::getComponentContext( getServiceFactory() ) ) ); try { @@ -1895,8 +1894,7 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon if ( !m_bModuleIdentified ) { m_bModuleIdentified = sal_True; - Reference< XModuleManager > xModuleManager; - xModuleManager = Reference< XModuleManager >( getServiceFactory()->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(getServiceFactory()) ); try { diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index 48b93d5fd754..cc7032a37bec 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/UIElementType.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <comphelper/processfactory.hxx> @@ -147,10 +147,7 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th pVCLMenuBar = new MenuBar(); } - Reference< XModuleManager > xModuleManager; - xModuleManager = Reference< XModuleManager >( - m_xServiceFactory->createInstance( - SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceFactory) ); try { diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 38595629a595..4bb82691d522 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -41,7 +41,7 @@ #include <com/sun/star/awt/MenuItemStyle.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <vcl/svapp.hxx> @@ -487,39 +487,36 @@ void NewMenuController::impl_setPopupMenu() fillPopupMenu( m_xPopupMenu ); // Identify module that we are attach to. It's our context that we need to know. - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),UNO_QUERY ); - if ( xModuleManager.is() ) + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); + try { - try + m_aModuleIdentifier = xModuleManager->identify( m_xFrame ); + m_bModuleIdentified = sal_True; + + Reference< XNameAccess > xNameAccess( xModuleManager, UNO_QUERY ); + if ( !m_aModuleIdentifier.isEmpty() && xNameAccess.is() ) { - m_aModuleIdentifier = xModuleManager->identify( m_xFrame ); - m_bModuleIdentified = sal_True; + Sequence< PropertyValue > aSeq; - Reference< XNameAccess > xNameAccess( xModuleManager, UNO_QUERY ); - if ( !m_aModuleIdentifier.isEmpty() && xNameAccess.is() ) + if ( xNameAccess->getByName( m_aModuleIdentifier ) >>= aSeq ) { - Sequence< PropertyValue > aSeq; - - if ( xNameAccess->getByName( m_aModuleIdentifier ) >>= aSeq ) + for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) { - for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) + if ( aSeq[y].Name == "ooSetupFactoryEmptyDocumentURL" ) { - if ( aSeq[y].Name == "ooSetupFactoryEmptyDocumentURL" ) - { - aSeq[y].Value >>= m_aEmptyDocURL; - break; - } + aSeq[y].Value >>= m_aEmptyDocURL; + break; } } } } - catch ( const RuntimeException& ) - { - throw; - } - catch ( const Exception& ) - { - } + } + catch ( const RuntimeException& ) + { + throw; + } + catch ( const Exception& ) + { } } diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 208fe1dc81af..21d23bdd46dc 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -49,7 +49,7 @@ #include <com/sun/star/ui/DockingArea.hpp> #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/ui/XUIElementSettings.hpp> #include <com/sun/star/ui/XUIConfigurationPersistence.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> @@ -829,7 +829,7 @@ uno::Sequence< beans::PropertyValue > ToolBarManager::GetPropsForCommand( const { if ( !m_bModuleIdentified ) { - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); Reference< XInterface > xIfac( m_xFrame, UNO_QUERY ); m_bModuleIdentified = sal_True; @@ -1200,8 +1200,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine sal_uInt16 nId( 1 ); - Reference< XModuleManager > xModuleManager( Reference< XModuleManager >( - m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); if ( !m_xDocImageManager.is() ) { Reference< XModel > xModel( GetModelFromFrame() ); @@ -1221,8 +1220,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine try { - if ( xModuleManager.is() ) - m_aModuleIdentifier = xModuleManager->identify( Reference< XInterface >( m_xFrame, UNO_QUERY ) ); + m_aModuleIdentifier = xModuleManager->identify( Reference< XInterface >( m_xFrame, UNO_QUERY ) ); } catch (const Exception&) { diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 5d479a552060..37bf5ecad454 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #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/container/XNameContainer.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -229,7 +230,7 @@ rtl::OUString ToolbarsMenuController::getUINameFromCommand( const rtl::OUString& { try { - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); m_aModuleIdentifier = xModuleManager->identify( m_xFrame ); Reference< XNameAccess > xNameAccess( m_xServiceManager->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), @@ -831,9 +832,7 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume if ( m_bInitialized ) { - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( - SERVICENAME_MODULEMANAGER ), - UNO_QUERY ); + Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); Reference< XNameAccess > xPersistentWindowStateSupplier( m_xServiceManager->createInstance( SERVICENAME_WINDOWSTATECONFIGURATION ), UNO_QUERY ); diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index 4715e1c1a453..102f9217a051 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> @@ -662,7 +663,7 @@ UICommandDescription::~UICommandDescription() } void UICommandDescription::impl_fillElements(const sal_Char* _pName) { - m_xModuleManager.set( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ),UNO_QUERY ); + m_xModuleManager.set( ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ) ); Reference< XNameAccess > xNameAccess( m_xModuleManager, UNO_QUERY_THROW ); Sequence< rtl::OUString > aElementNames = xNameAccess->getElementNames(); Sequence< PropertyValue > aSeq; diff --git a/framework/source/uifactory/addonstoolboxfactory.cxx b/framework/source/uifactory/addonstoolboxfactory.cxx index 21ca8c1a9909..54b84d15fa3b 100644 --- a/framework/source/uifactory/addonstoolboxfactory.cxx +++ b/framework/source/uifactory/addonstoolboxfactory.cxx @@ -32,6 +32,7 @@ #include <threadhelp/resetableguard.hxx> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -71,7 +72,7 @@ AddonsToolBoxFactory::AddonsToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : ThreadHelpBase( &Application::GetSolarMutex() ) , m_xServiceManager( xServiceManager ) - , m_xModuleManager( xServiceManager->createInstance(SERVICENAME_MODULEMANAGER),UNO_QUERY ) + , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ) { } diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index e221e9a5459f..fcb17ccd9496 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -33,6 +33,7 @@ #include <uielement/menubarwrapper.hxx> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -73,13 +74,13 @@ DEFINE_INIT_SERVICE ( MenuBarFactory, {} ) MenuBarFactory::MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : ThreadHelpBase() , m_xServiceManager( xServiceManager ) - , m_xModuleManager( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY ) + , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ) { } MenuBarFactory::MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ) : ThreadHelpBase(&Application::GetSolarMutex()) , m_xServiceManager( xServiceManager ) - , m_xModuleManager( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY ) + , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) ) ) { } @@ -97,7 +98,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l ResetableGuard aLock( m_aLock ); MenuBarWrapper* pMenuBarWrapper = new MenuBarWrapper( m_xServiceManager ); Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pMenuBarWrapper, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager; + Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); CreateUIElement(ResourceURL,Args,"MenuOnly","private:resource/menubar/",xMenuBar,xModuleManager,m_xServiceManager); return xMenuBar; @@ -107,7 +108,7 @@ void MenuBarFactory::CreateUIElement(const ::rtl::OUString& ResourceURL ,const char* _pExtraMode ,const char* _pAsciiName ,const Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar - ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager >& _xModuleManager + ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) { Reference< XUIConfigurationManager > xCfgMgr; diff --git a/framework/source/uifactory/statusbarfactory.cxx b/framework/source/uifactory/statusbarfactory.cxx index 7f2fce4714e0..df64bc16f899 100644 --- a/framework/source/uifactory/statusbarfactory.cxx +++ b/framework/source/uifactory/statusbarfactory.cxx @@ -76,7 +76,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l ResetableGuard aLock( m_aLock ); StatusBarWrapper* pWrapper = new StatusBarWrapper( m_xServiceManager ); Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager; + Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); MenuBarFactory::CreateUIElement(ResourceURL,Args,NULL,"private:resource/statusbar/",xMenuBar,xModuleManager,m_xServiceManager); return xMenuBar; diff --git a/framework/source/uifactory/toolboxfactory.cxx b/framework/source/uifactory/toolboxfactory.cxx index a30a1c3737a2..69a037c7a934 100644 --- a/framework/source/uifactory/toolboxfactory.cxx +++ b/framework/source/uifactory/toolboxfactory.cxx @@ -72,7 +72,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l ResetableGuard aLock( m_aLock ); ToolBarWrapper* pWrapper = new ToolBarWrapper( m_xServiceManager ); Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager > xModuleManager = m_xModuleManager; + Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = m_xModuleManager; aLock.unlock(); CreateUIElement(ResourceURL,Args,"PopupMode","private:resource/toolbar/",xMenuBar,xModuleManager,m_xServiceManager); return xMenuBar; diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index 11ff2a17fdc9..9e0debabe42c 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <rtl/ustrbuf.hxx> @@ -394,7 +395,7 @@ UIElementFactoryManager::UIElementFactoryManager( const Reference< XMultiService RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::UIElementFactoryManager" ); m_pConfigAccess = new ConfigurationAccess_FactoryManager( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Factories/Registered/UIElementFactories" )) ); m_pConfigAccess->acquire(); - m_xModuleManager = Reference< XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY ); + m_xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); } UIElementFactoryManager::~UIElementFactoryManager() @@ -436,7 +437,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::l Args[i].Value >>= xFrame; } - Reference< XModuleManager > xManager( m_xModuleManager ); + Reference< XModuleManager2 > xManager( m_xModuleManager ); aLock.unlock(); // Determine the module identifier diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx index b9691a5c92fd..23c7c97df4e9 100644 --- a/framework/source/uifactory/windowcontentfactorymanager.cxx +++ b/framework/source/uifactory/windowcontentfactorymanager.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/awt/XToolkit.hpp> #include <com/sun/star/awt/XControlModel.hpp> @@ -78,7 +79,7 @@ WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< { m_pConfigAccess = new ConfigurationAccess_FactoryManager( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" )) ); m_pConfigAccess->acquire(); - m_xModuleManager = uno::Reference< frame::XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), uno::UNO_QUERY ); + m_xModuleManager = frame::ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); } WindowContentFactoryManager::~WindowContentFactoryManager() @@ -147,7 +148,7 @@ throw (uno::Exception, uno::RuntimeException) } } - uno::Reference< frame::XModuleManager > xModuleManager; + uno::Reference< frame::XModuleManager2 > xModuleManager; // SAFE { ResetableGuard aLock( m_aLock ); |