diff options
40 files changed, 233 insertions, 256 deletions
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index 4b8b1e47f096..725b721de4e4 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -37,7 +37,7 @@ #include <svtools/imagemgr.hxx> #include <com/sun/star/script/XLibraryContainer.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/componentcontext.hxx> #include <sfx2/dispatch.hxx> @@ -765,34 +765,31 @@ void TreeListBox::GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& r if ( rDocument.isDocument() ) { ::rtl::OUString sFactoryURL; - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - Reference< ::com::sun::star::frame::XModuleManager > xModuleManager; - if ( aContext.createComponent( "com.sun.star.frame.ModuleManager", xModuleManager ) ) + Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); + Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xContext) ); + try { - try + ::rtl::OUString sModule( xModuleManager->identify( rDocument.getDocument() ) ); + Reference< container::XNameAccess > xModuleConfig( xModuleManager, UNO_QUERY ); + if ( xModuleConfig.is() ) { - ::rtl::OUString sModule( xModuleManager->identify( rDocument.getDocument() ) ); - Reference< container::XNameAccess > xModuleConfig( xModuleManager, UNO_QUERY ); - if ( xModuleConfig.is() ) + Sequence< beans::PropertyValue > aModuleDescr; + xModuleConfig->getByName( sModule ) >>= aModuleDescr; + sal_Int32 nCount = aModuleDescr.getLength(); + const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray(); + for ( sal_Int32 i = 0; i < nCount; ++i ) { - Sequence< beans::PropertyValue > aModuleDescr; - xModuleConfig->getByName( sModule ) >>= aModuleDescr; - sal_Int32 nCount = aModuleDescr.getLength(); - const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray(); - for ( sal_Int32 i = 0; i < nCount; ++i ) + if ( pModuleDescr[ i ].Name == "ooSetupFactoryEmptyDocumentURL" ) { - if ( pModuleDescr[ i ].Name == "ooSetupFactoryEmptyDocumentURL" ) - { - pModuleDescr[ i ].Value >>= sFactoryURL; - break; - } + pModuleDescr[ i ].Value >>= sFactoryURL; + break; } } } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); } if ( !sFactoryURL.isEmpty() ) diff --git a/basic/source/basmgr/vbahelper.cxx b/basic/source/basmgr/vbahelper.cxx index 57796db0afc8..6b07178bf5a0 100644 --- a/basic/source/basmgr/vbahelper.cxx +++ b/basic/source/basmgr/vbahelper.cxx @@ -25,7 +25,7 @@ #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/frame/XDesktop.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/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> #include <cppuhelper/implbase1.hxx> @@ -47,8 +47,8 @@ uno::Reference< frame::XModuleManager > lclCreateModuleManager() uno::Reference< frame::XModuleManager > xModuleManager; try { - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - xModuleManager.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ), uno::UNO_QUERY ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext(), uno::UNO_QUERY_THROW ); + xModuleManager.set( frame::ModuleManager::create(xContext), uno::UNO_QUERY ); } catch(const uno::Exception& ) { diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 84e0eeaac69d..c12a91a21ae5 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -55,7 +55,7 @@ #include <com/sun/star/frame/XModel.hpp> #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/frame/ModuleManager.hpp> #include <com/sun/star/ui/UICommandDescription.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> @@ -92,7 +92,6 @@ using namespace com::sun::star; static ::rtl::OUString SERVICE_STORAGEFACTORY (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory" )); static ::rtl::OUString SERVICE_UICONFIGMGR (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager" )); 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 MODULEPROP_SHORTNAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" )); @@ -865,7 +864,9 @@ void SfxAcceleratorConfigPage::InitAccCfg() } // identify module - css::uno::Reference< css::frame::XModuleManager > xModuleManager (m_xSMGR->createInstance(SERVICE_MODULEMANAGER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager > xModuleManager( + css::frame::ModuleManager::create(comphelper::ComponentContext(m_xSMGR).getUNOContext()), + css::uno::UNO_QUERY_THROW); css::uno::Reference< css::container::XNameAccess > xModuleManagerCont(xModuleManager , css::uno::UNO_QUERY_THROW); m_sModuleLongName = xModuleManager->identify(m_xFrame); ::comphelper::SequenceAsHashMap lModuleProps(xModuleManagerCont->getByName(m_sModuleLongName)); diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index e3b896aec6ee..4340091b642c 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -69,6 +69,7 @@ #include <com/sun/star/ui/ItemType.hpp> #include <com/sun/star/ui/ItemStyle.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/ui/UICommandDescription.hpp> @@ -768,17 +769,17 @@ SfxTabPage *CreateSvxEventConfigPage( Window *pParent, const SfxItemSet& rSet ) sal_Bool impl_showKeyConfigTabPage( const css::uno::Reference< css::frame::XFrame >& xFrame ) { - static ::rtl::OUString SERVICENAME_MODULEMANAGER ("com.sun.star.frame.ModuleManager" ); static ::rtl::OUString SERVICENAME_DESKTOP ("com.sun.star.frame.Desktop" ); static ::rtl::OUString MODULEID_STARTMODULE ("com.sun.star.frame.StartModule" ); try { css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XModuleManager > xMM (xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager > xMM (css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW); - if (xMM.is() && xFrame.is()) + if (xFrame.is()) { ::rtl::OUString sModuleId = xMM->identify(xFrame); if ( @@ -1664,15 +1665,15 @@ void SvxConfigPage::Reset( const SfxItemSet& ) uno::Reference< lang::XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( + ::comphelper::getProcessComponentContext(), uno::UNO_QUERY_THROW ); m_xFrame = GetFrame(); OUString aModuleId = GetFrameWithDefaultAndIdentify( m_xFrame ); // replace %MODULENAME in the label with the correct module name uno::Reference< css::frame::XModuleManager > xModuleManager( - xServiceManager->createInstance( - OUString( "com.sun.star.frame.ModuleManager" ) ), - uno::UNO_QUERY_THROW ); + css::frame::ModuleManager::create( xContext ), uno::UNO_QUERY_THROW); OUString aModuleName = GetUIModuleName( aModuleId, xModuleManager ); OUString title = aTopLevelSeparator.GetText(); @@ -1687,7 +1688,7 @@ void SvxConfigPage::Reset( const SfxItemSet& ) } uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > - xModuleCfgSupplier( css::ui::ModuleUIConfigurationManagerSupplier::create(comphelper::ComponentContext(xServiceManager).getUNOContext()) ); + xModuleCfgSupplier( css::ui::ModuleUIConfigurationManagerSupplier::create(xContext) ); // Set up data for module specific menus SaveInData* pModuleData = NULL; @@ -1914,10 +1915,8 @@ void SvxConfigPage::Reset( const SfxItemSet& ) return sModuleID; } - uno::Reference< css::frame::XModuleManager > xModuleManager( - xServiceManager->createInstance( - OUString( "com.sun.star.frame.ModuleManager" ) ), - uno::UNO_QUERY_THROW ); + uno::Reference< css::frame::XModuleManager2 > xModuleManager( + css::frame::ModuleManager::create( comphelper::ComponentContext(xServiceManager).getUNOContext() ) ); try { diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 86be792d8a39..4b12b50b30eb 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/script/browse/XBrowseNodeFactory.hpp> #include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumeration.hpp> @@ -766,14 +766,7 @@ Image SfxConfigGroupListBox_Impl::GetImage( Reference<XInterface> xDocumentModel = getDocumentModel(xCtx, nodeName ); if ( xDocumentModel.is() ) { - Reference< ::com::sun::star::frame::XModuleManager > - xModuleManager( - xCtx->getServiceManager() - ->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("" // xxx todo - "com.sun.star.frame.ModuleManager") ), - xCtx ), - UNO_QUERY_THROW ); + Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) ); Reference<container::XNameAccess> xModuleConfig( xModuleManager, UNO_QUERY_THROW ); // get the long name of the document: diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index 1da7e337b0bf..67bc1bfaa947 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -53,7 +53,7 @@ #include <com/sun/star/script/browse/BrowseNodeTypes.hpp> #include <com/sun/star/script/browse/XBrowseNodeFactory.hpp> #include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XEnumeration.hpp> @@ -417,12 +417,7 @@ void SvxConfigGroupListBox_Impl::Init() Reference< frame::XDispatchInformationProvider > xDIP( m_xFrame, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager > - xModuleManager( xMCF->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.ModuleManager" )), - xContext ), - UNO_QUERY ); + Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xContext) ); OUString aModuleId; try{ @@ -571,13 +566,7 @@ Image SvxConfigGroupListBox_Impl::GetImage( Reference<XInterface> xDocumentModel = getDocumentModel(xCtx, nodeName ); if ( xDocumentModel.is() ) { - Reference< ::com::sun::star::frame::XModuleManager > - xModuleManager( - xCtx->getServiceManager() - ->createInstanceWithContext( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")), - xCtx ), - UNO_QUERY_THROW ); + Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) ); Reference<container::XNameAccess> xModuleConfig( xModuleManager, UNO_QUERY_THROW ); // get the long name of the document: diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 3a71808b7254..ebd3676a4f7d 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -49,7 +49,7 @@ #include <com/sun/star/script/provider/ScriptErrorRaisedException.hpp> #include <com/sun/star/script/provider/ScriptExceptionRaisedException.hpp> #include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/script/XInvocation.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> @@ -224,10 +224,7 @@ void SFTreeListBox::Init( const ::rtl::OUString& language ) if ( xDocumentModel.is() ) { - Reference< ::com::sun::star::frame::XModuleManager > - xModuleManager( xCtx->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager") ), xCtx ), - UNO_QUERY_THROW ); + Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) ); Reference<container::XNameAccess> xModuleConfig( xModuleManager, UNO_QUERY_THROW ); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 9100312ce566..16bfa7f434d2 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -64,9 +64,10 @@ #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/loader/CannotActivateFactoryException.hpp> #include <com/sun/star/util/XMacroExpander.hpp> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <editeng/optitems.hxx> #include <editeng/unolingu.hxx> @@ -1492,8 +1493,7 @@ rtl::OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame ) { rtl::OUString sIdentifier; Reference < XFrame > xCurrentFrame( _xFrame ); - Reference < XModuleManager > xModuleManager( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY ); + Reference < XModuleManager2 > xModuleManager( ModuleManager::create(::comphelper::getProcessComponentContext()) ); if ( !xCurrentFrame.is() ) { Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( @@ -1502,7 +1502,7 @@ rtl::OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame ) xCurrentFrame = xDesktop->getCurrentFrame(); } - if ( xCurrentFrame.is() && xModuleManager.is() ) + if ( xCurrentFrame.is() ) { try { @@ -1945,8 +1945,7 @@ rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier( { rtl::OUString sModule; Reference < XFrame > xCurrentFrame( rFrame ); - Reference < XModuleManager > xModuleManager( xMFac->createInstance( - C2U("com.sun.star.frame.ModuleManager") ), UNO_QUERY ); + Reference < XModuleManager2 > xModuleManager( ModuleManager::create(comphelper::ComponentContext(xMFac).getUNOContext()) ); if ( !xCurrentFrame.is() ) { diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 305379cb3e45..e54299448a49 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/embed/XEmbedPersist.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/XTransactionBroadcaster.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XSeekable.hpp> #include <com/sun/star/io/XOutputStream.hpp> @@ -2078,7 +2079,7 @@ Reference< XTitle > ODatabaseDocument::impl_getTitleHelper_throw() uno::Reference< frame::XUntitledNumbers > ODatabaseDocument::impl_getUntitledHelper_throw(const uno::Reference< uno::XInterface >& _xComponent) { if ( !m_xModuleManager.is() ) - m_xModuleManager.set( m_pImpl->m_aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + m_xModuleManager.set( ModuleManager::create(m_pImpl->m_aContext.getUNOContext()), UNO_QUERY_THROW ); ::rtl::OUString sModuleId; try diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx index 0c962b62b8e1..d9129d18644b 100644 --- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx +++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx @@ -26,7 +26,7 @@ #include "settingsimport.hxx" #include <com/sun/star/embed/ElementModes.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/document/XStorageBasedDocument.hpp> #include <com/sun/star/ucb/XCommandProcessor.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> @@ -61,7 +61,8 @@ namespace dbaccess using ::com::sun::star::embed::XStorage; using ::com::sun::star::sdb::application::XDatabaseDocumentUI; using ::com::sun::star::beans::Pair; - using ::com::sun::star::frame::XModuleManager; + using ::com::sun::star::frame::ModuleManager; + using ::com::sun::star::frame::XModuleManager2; using ::com::sun::star::lang::XComponent; using ::com::sun::star::frame::XModel; using ::com::sun::star::frame::XController; @@ -480,7 +481,7 @@ namespace dbaccess m_aCompDesc.sName = aComponentIdentity.Second; // what the controller didn't give us is the information whether this is in edit mode or not ... - Reference< XModuleManager > xModuleManager( m_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager( ModuleManager::create(m_rContext.getUNOContext()) ); const ::rtl::OUString sModuleIdentifier = xModuleManager->identify( m_xComponent ); switch ( m_eType ) diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 337b01beb12d..06ad663ee351 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -42,10 +42,11 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XDispatchProviderInterception.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/embed/EmbedMisc.hpp> +#include <comphelper/componentcontext.hxx> #include <rtl/logfile.hxx> @@ -322,10 +323,7 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState ) uno::Reference< embed::XComponentSupplier > xCompSupl( m_xClientSite, uno::UNO_QUERY_THROW ); uno::Reference< uno::XInterface > xContDoc( xCompSupl->getComponent(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XModuleManager > xManager( - m_xFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ), - uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModuleManager2 > xManager( frame::ModuleManager::create(comphelper::ComponentContext(m_xFactory).getUNOContext()) ); aModuleName = xManager->identify( xContDoc ); } diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 05314398b6fa..fd073eda383d 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -60,7 +60,7 @@ #include <com/sun/star/embed/XInplaceClient.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/frame/XMenuBarMergingAcceptor.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/ui/XDockingAreaAcceptor.hpp> #include <com/sun/star/ui/XUIElementSettings.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> @@ -576,10 +576,7 @@ uno::Reference< container::XIndexAccess > DocumentHolder::RetrieveOwnMenu_Impl() if ( !xResult.is() ) { // no internal document configuration, use the one from the module - uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleMan( - m_xFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ), - uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModuleManager2 > xModuleMan( frame::ModuleManager::create(comphelper::ComponentContext(m_xFactory).getUNOContext()) ); ::rtl::OUString aModuleIdent = xModuleMan->identify( uno::Reference< uno::XInterface >( m_xComponent, uno::UNO_QUERY ) ); diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 58e026ff5979..5b493ec43397 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -64,7 +64,7 @@ #include "com/sun/star/awt/XDevice.hpp" #include "com/sun/star/util/MeasureUnit.hpp" #include "com/sun/star/frame/XModel.hpp" -#include "com/sun/star/frame/XModuleManager.hpp" +#include "com/sun/star/frame/ModuleManager.hpp" #include "com/sun/star/frame/XStorable.hpp" #include "com/sun/star/frame/XController.hpp" #include "com/sun/star/document/XDocumentProperties.hpp" @@ -317,10 +317,8 @@ static OUString getMimetypeForDocument( const Reference< XMultiServiceFactory >& OUString aDocMimetype; // get document service name Reference< com::sun::star::frame::XStorable > xStore( xDoc, UNO_QUERY ); - Reference< frame::XModuleManager > xModuleManager( - xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ), - uno::UNO_QUERY ); - if( xModuleManager.is() && xStore.is() ) + Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(comphelper::getComponentContext( xFactory )) ); + if( xStore.is() ) { OUString aDocServiceName = xModuleManager->identify( Reference< XInterface >( xStore, uno::UNO_QUERY ) ); if ( !aDocServiceName.isEmpty() ) diff --git a/forms/source/helper/commanddescriptionprovider.cxx b/forms/source/helper/commanddescriptionprovider.cxx index b0c1b4e32384..2cfe8e7d2687 100644 --- a/forms/source/helper/commanddescriptionprovider.cxx +++ b/forms/source/helper/commanddescriptionprovider.cxx @@ -21,7 +21,7 @@ #include "commanddescriptionprovider.hxx" #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/beans/PropertyValue.hpp> #include <com/sun/star/ui/UICommandDescription.hpp> @@ -45,8 +45,10 @@ namespace frm using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::frame::XModel; using ::com::sun::star::container::XNameAccess; + using ::com::sun::star::frame::ModuleManager; using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::ui::UICommandDescription; @@ -58,9 +60,9 @@ namespace frm class DefaultCommandDescriptionProvider : public ICommandDescriptionProvider { public: - DefaultCommandDescriptionProvider( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument ) + DefaultCommandDescriptionProvider( const Reference<XComponentContext>& _rxContext, const Reference< XModel >& _rxDocument ) { - impl_init_nothrow( _rContext, _rxDocument ); + impl_init_nothrow( _rxContext, _rxDocument ); } ~DefaultCommandDescriptionProvider() @@ -71,7 +73,7 @@ namespace frm virtual ::rtl::OUString getCommandDescription( const ::rtl::OUString& _rCommandURL ) const; private: - void impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument ); + void impl_init_nothrow( const Reference<XComponentContext>& _rxContext, const Reference< XModel >& _rxDocument ); private: Reference< XNameAccess > m_xCommandAccess; @@ -79,7 +81,7 @@ namespace frm //-------------------------------------------------------------------- - void DefaultCommandDescriptionProvider::impl_init_nothrow( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument ) + void DefaultCommandDescriptionProvider::impl_init_nothrow( const Reference<XComponentContext>& _rxContext, const Reference< XModel >& _rxDocument ) { OSL_ENSURE( _rxDocument.is(), "DefaultCommandDescriptionProvider::impl_init_nothrow: no document => no command descriptions!" ); if ( !_rxDocument.is() ) @@ -87,10 +89,10 @@ namespace frm try { - Reference< XModuleManager > xModuleManager( _rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + Reference< XModuleManager > xModuleManager( ModuleManager::create(_rxContext), UNO_QUERY_THROW ); ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument ); - Reference< XNameAccess > xUICommandDescriptions( UICommandDescription::create(_rContext.getUNOContext()) ); + Reference< XNameAccess > xUICommandDescriptions( UICommandDescription::create(_rxContext) ); m_xCommandAccess.set( xUICommandDescriptions->getByName( sModuleID ), UNO_QUERY_THROW ); } catch( const Exception& ) @@ -120,9 +122,9 @@ namespace frm //-------------------------------------------------------------------- PCommandDescriptionProvider createDocumentCommandDescriptionProvider( - const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument ) + const Reference<XComponentContext>& _rxContext, const Reference< XModel >& _rxDocument ) { - PCommandDescriptionProvider pDescriptionProvider( new DefaultCommandDescriptionProvider( _rContext, _rxDocument ) ); + PCommandDescriptionProvider pDescriptionProvider( new DefaultCommandDescriptionProvider( _rxContext, _rxDocument ) ); return pDescriptionProvider; } diff --git a/forms/source/helper/commandimageprovider.cxx b/forms/source/helper/commandimageprovider.cxx index 23d2023c18c3..7925985c9393 100644 --- a/forms/source/helper/commandimageprovider.cxx +++ b/forms/source/helper/commandimageprovider.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/ui/XImageManager.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/ui/ImageType.hpp> #include <tools/diagnose_ex.h> @@ -59,6 +59,7 @@ namespace frm using ::com::sun::star::ui::XUIConfigurationManager; using ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier; using ::com::sun::star::ui::ModuleUIConfigurationManagerSupplier; + using ::com::sun::star::frame::ModuleManager; using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::graphic::XGraphic; /** === end UNO using === **/ @@ -111,7 +112,7 @@ namespace frm // obtain the image manager or the module try { - Reference< XModuleManager > xModuleManager( _rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + Reference< XModuleManager > xModuleManager( ModuleManager::create(_rContext.getUNOContext()), UNO_QUERY_THROW ); ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument ); Reference< XModuleUIConfigurationManagerSupplier > xSuppUIConfig( diff --git a/forms/source/inc/commanddescriptionprovider.hxx b/forms/source/inc/commanddescriptionprovider.hxx index f319c5edc6e0..fa8d014f965a 100644 --- a/forms/source/inc/commanddescriptionprovider.hxx +++ b/forms/source/inc/commanddescriptionprovider.hxx @@ -21,8 +21,7 @@ #define COMMANDDESCRIPTIONPROVIDER_HXX #include <com/sun/star/frame/XModel.hpp> - -#include <comphelper/componentcontext.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> #include <boost/shared_ptr.hpp> @@ -49,7 +48,7 @@ namespace frm //===================================================================== PCommandDescriptionProvider createDocumentCommandDescriptionProvider( - const ::comphelper::ComponentContext& _rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument ); diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx index fca8e7b8f0a9..b2ad7ff45c45 100644 --- a/forms/source/solar/component/navbarcontrol.cxx +++ b/forms/source/solar/component/navbarcontrol.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/awt/XControlModel.hpp> #include <com/sun/star/graphic/XGraphic.hpp> +#include <comphelper/componentcontext.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <vcl/svapp.hxx> @@ -284,7 +285,7 @@ namespace frm _pParentWindow, lcl_getWinBits_nothrow( _rxModel ), createDocumentCommandImageProvider( _rxORB, xContextDocument ), - createDocumentCommandDescriptionProvider( _rxORB, xContextDocument ) + createDocumentCommandDescriptionProvider( comphelper::ComponentContext(_rxORB).getUNOContext(), xContextDocument ) ); // some knittings diff --git a/framework/inc/services/modulemanager.hxx b/framework/inc/services/modulemanager.hxx index d50b0da116df..eb1b9f456f54 100644 --- a/framework/inc/services/modulemanager.hxx +++ b/framework/inc/services/modulemanager.hxx @@ -27,10 +27,10 @@ #include <boost/noncopyable.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/container/XNameReplace.hpp> #include <com/sun/star/container/XContainerQuery.hpp> -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase3.hxx> namespace com { namespace sun { namespace star { namespace lang { class XSingleServiceFactory; @@ -49,9 +49,10 @@ namespace framework implements the service com.sun.star.frame.ModuleManager */ class ModuleManager: - public cppu::WeakImplHelper4< - css::lang::XServiceInfo, css::frame::XModuleManager, - css::container::XNameReplace, css::container::XContainerQuery >, + public cppu::WeakImplHelper3< + css::lang::XServiceInfo, + css::frame::XModuleManager2, + css::container::XContainerQuery >, private ThreadHelpBase, private boost::noncopyable { //___________________________________________ diff --git a/framework/source/lomenubar/FrameHelper.cxx b/framework/source/lomenubar/FrameHelper.cxx index b617404446af..e8fd68fb24ea 100644 --- a/framework/source/lomenubar/FrameHelper.cxx +++ b/framework/source/lomenubar/FrameHelper.cxx @@ -49,7 +49,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp> #include <com/sun/star/frame/FrameAction.hpp> #include <com/sun/star/frame/FrameActionEvent.hpp> @@ -268,7 +268,7 @@ FrameHelper::FrameHelper(const Reference< XMultiServiceFactory >& rServiceManag , m_pDispatchRegistry(new framework::lomenubar::DispatchRegistry(m_xStatusListener)) , m_xMSF(rServiceManager) , m_xTrans(util::URLTransformer::create(comphelper::ComponentContext(m_xMSF).getUNOContext())) - , m_xMM(m_xMSF->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager"))),UNO_QUERY) + , m_xMM(frame::ModuleManager(comphelper::ComponentContext(m_xMSF).getUNOContext()),UNO_QUERY) , m_xPCF(m_xMSF->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.PopupMenuControllerFactory"))), UNO_QUERY) , m_xFrame(xFrame) , m_xdp(xFrame, UNO_QUERY) diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx index d5d4522eba90..04158c0532e9 100644 --- a/framework/source/services/modulemanager.cxx +++ b/framework/source/services/modulemanager.cxx @@ -180,7 +180,7 @@ void SAL_CALL ModuleManager::replaceByName(const ::rtl::OUString& sName , { throw css::lang::IllegalArgumentException( ::rtl::OUString("No properties given to replace part of module."), - static_cast< css::container::XNameAccess* >(this), + static_cast< cppu::OWeakObject * >(this), 2); } @@ -207,7 +207,7 @@ void SAL_CALL ModuleManager::replaceByName(const ::rtl::OUString& sName , { throw css::uno::RuntimeException( ::rtl::OUString("Was not able to get write access to the requested module entry inside configuration."), - static_cast< css::container::XNameAccess* >(this)); + static_cast< cppu::OWeakObject * >(this)); } ::comphelper::SequenceAsHashMap::const_iterator pProp; @@ -239,7 +239,7 @@ css::uno::Any SAL_CALL ModuleManager::getByName(const ::rtl::OUString& sName) { throw css::uno::RuntimeException( ::rtl::OUString("Was not able to get write access to the requested module entry inside configuration."), - static_cast< css::container::XNameAccess* >(this)); + static_cast< cppu::OWeakObject * >(this)); } // convert it to seq< PropertyValue > diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 291699a24c33..8a56c3b87939 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -134,6 +134,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\ DispatchRecorderSupplier \ DocumentTemplates \ MediaTypeDetectionHelper \ + ModuleManager \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/graphic,\ GraphicObject \ @@ -811,7 +812,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\ FramesContainer \ GlobalEventBroadcaster \ LayoutManager \ - ModuleManager \ PopupMenuController \ PopupMenuControllerFactory \ ProtocolHandler \ @@ -2538,6 +2538,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\ XModel2 \ XModule \ XModuleManager \ + XModuleManager2 \ XNotifyingDispatch \ XPopupMenuController \ XRecordableDispatch \ diff --git a/offapi/com/sun/star/frame/ModuleManager.idl b/offapi/com/sun/star/frame/ModuleManager.idl index 53ccdc675516..b2db408830ce 100644 --- a/offapi/com/sun/star/frame/ModuleManager.idl +++ b/offapi/com/sun/star/frame/ModuleManager.idl @@ -29,8 +29,7 @@ #ifndef __com_sun_star_frame_ModuleManager_idl__ #define __com_sun_star_frame_ModuleManager_idl__ -#include <com/sun/star/frame/XModuleManager.idl> -#include <com/sun/star/container/XNameAccess.idl> +#include <com/sun/star/frame/XModuleManager2.idl> module com { module sun { module star { module frame { @@ -45,25 +44,7 @@ module com { module sun { module star { module frame { @since OOo 2.0 */ -service ModuleManager -{ - /** provides functions to identify office modules. - */ - interface XModuleManager; - - /** provides read access to the configuration of office modules. - - <p> - Every module is referenced by an unique service name - (which is used inside configuration as set node name too) - and is further represented by a sequence of elements of type - <type scope="com::sun::star::beans">PropertyValue</type>. - A list of properties can be gotten from the configuration template - org.openoffice.Setup/Factory. - </p> - */ - interface ::com::sun::star::container::XNameAccess; -}; +service ModuleManager : XModuleManager2; }; }; }; }; diff --git a/offapi/com/sun/star/frame/XModuleManager2.idl b/offapi/com/sun/star/frame/XModuleManager2.idl new file mode 100644 index 000000000000..277c0e688d23 --- /dev/null +++ b/offapi/com/sun/star/frame/XModuleManager2.idl @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_frame_XModuleManager2_idl__ +#define __com_sun_star_frame_XModuleManager2_idl__ + +#include <com/sun/star/frame/XModuleManager.idl> +#include <com/sun/star/container/XNameReplace.idl> + + +module com { module sun { module star { module frame { + +/** + This interface provides a merged single interface for the ModuleManager + service to implement +*/ +interface XModuleManager2 +{ + /** provides functions to identify office modules. + */ + interface XModuleManager; + + /** provides read access to the configuration of office modules. + + <p> + Every module is referenced by an unique service name + (which is used inside configuration as set node name too) + and is further represented by a sequence of elements of type + <type scope="com::sun::star::beans">PropertyValue</type>. + A list of properties can be gotten from the configuration template + org.openoffice.Setup/Factory. + </p> + */ + interface ::com::sun::star::container::XNameReplace; +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 748d2a6460db..708a182e20b1 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -29,7 +29,7 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/frame/UnknownModuleException.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/PropertyValue.hpp> #include <com/sun/star/ui/UICommandDescription.hpp> @@ -1142,7 +1142,7 @@ void ViewShellBase::SetViewTabBar (const ::rtl::Reference<ViewTabBar>& rViewTabB 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< XModuleManager > xModuleManager( ModuleManager::create(xContext), UNO_QUERY_THROW ); Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW ); ::rtl::OUString aModuleIdentifier( xModuleManager->identify( xIfac ) ); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index c99fe7abe552..4d9d216dc027 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -75,7 +75,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <com/sun/star/script/provider/XScriptProviderFactory.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include "frmload.hxx" @@ -935,7 +935,7 @@ namespace Reference < XFramesSupplier > xSupplier( i_rContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); Reference < XIndexAccess > xContainer( xSupplier->getFrames(), UNO_QUERY_THROW ); - Reference< XModuleManager > xCheck( i_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + Reference< XModuleManager > xCheck( ModuleManager::create(i_rContext.getUNOContext()), UNO_QUERY_THROW ); sal_Int32 nCount = xContainer->getCount(); for ( sal_Int32 i=0; i<nCount; ++i ) diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx index 216e81bf829e..032e6355bd13 100644 --- a/sfx2/source/appl/imagemgr.cxx +++ b/sfx2/source/appl/imagemgr.cxx @@ -20,7 +20,7 @@ #include "sfx2/imagemgr.hxx" #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/ui/XImageManager.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/ImageType.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> @@ -149,9 +149,7 @@ Image SAL_CALL GetImage( if ( !xModuleManager.is() ) { xModuleManager = Reference< XModuleManager >( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.ModuleManager" ))), + ModuleManager::create(::comphelper::getProcessComponentContext()), UNO_QUERY ); m_xModuleManager = xModuleManager; } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 8f728c55349e..217538300969 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <toolkit/helper/vclunohelper.hxx> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <unotools/configmgr.hxx> @@ -415,8 +415,7 @@ SfxHelp::~SfxHelp() { ::rtl::OUString sIdentifier; Reference < XFrame > xCurrentFrame; - Reference < XModuleManager > xModuleManager( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY ); + Reference < XModuleManager > xModuleManager( ModuleManager::create(::comphelper::getProcessComponentContext()), UNO_QUERY ); Reference < XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); if ( xDesktop.is() ) @@ -452,8 +451,7 @@ String SfxHelp::GetHelpModuleName_Impl() try { Reference < XModuleManager > xModuleManager( - ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY ); + ModuleManager::create(::comphelper::getProcessComponentContext()), UNO_QUERY ); Sequence< PropertyValue > lProps; Reference< ::com::sun::star::container::XNameAccess > xCont( xModuleManager, UNO_QUERY); if ( xCont.is() ) diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 6d77417dfd14..1bcf9866fba3 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -25,6 +25,7 @@ #include <vcl/timer.hxx> #include <rtl/instance.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <sfx2/dockwin.hxx> @@ -43,7 +44,7 @@ #include <com/sun/star/lang/XSingleComponentFactory.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #define MAX_TOGGLEAREA_WIDTH 20 @@ -181,8 +182,7 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd , if ( !xModuleManager.is() ) { xModuleManager = uno::Reference< frame::XModuleManager >( - xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))), + frame::ModuleManager::create(comphelper::ComponentContext(xServiceManager).getUNOContext()), uno::UNO_QUERY ); m_xModuleManager = xModuleManager; } diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index b66cf8fa6578..9465fa0a4d6a 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -33,7 +33,7 @@ #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/util/XModifiable.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/security/CertificateValidity.hpp> @@ -303,13 +303,11 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( bool bSendAsPDF = (rType.equalsAsciiL( PDF_DOCUMENT_TYPE, PDF_DOCUMENT_TYPE_LEN )); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - if (!xSMGR.is()) + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + if (!xContext.is()) return eRet; - const rtl::OUString aModuleManager( "com.sun.star.frame.ModuleManager" ); - css::uno::Reference< css::frame::XModuleManager > xModuleManager( xSMGR->createInstance( aModuleManager ), css::uno::UNO_QUERY_THROW ); - if ( !xModuleManager.is() ) - return eRet; + css::uno::Reference< css::frame::XModuleManager > xModuleManager( css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW ); rtl::OUString aModule; try diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index a43b9fba17db..fb30ecc42f1b 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -18,7 +18,7 @@ */ #include <com/sun/star/frame/XDispatchRecorderSupplier.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/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ui/UICommandDescription.hpp> @@ -26,7 +26,6 @@ #include <svl/eitem.hxx> #include <svtools/generictoolboxcontroller.hxx> #include <vcl/msgbox.hxx> -#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include "recfloat.hxx" @@ -46,37 +45,32 @@ static rtl::OUString GetLabelFromCommandURL( const rtl::OUString& rCommandURL, c rtl::OUString aLabel; rtl::OUString aModuleIdentifier; uno::Reference< container::XNameAccess > xUICommandLabels; - uno::Reference< lang::XMultiServiceFactory > xServiceManager; + uno::Reference< uno::XComponentContext > xContext; uno::Reference< container::XNameAccess > xUICommandDescription; uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleManager; - static uno::WeakReference< lang::XMultiServiceFactory > xTmpServiceManager; - static uno::WeakReference< container::XNameAccess > xTmpNameAccess; + static uno::WeakReference< uno::XComponentContext > xTmpContext; + static uno::WeakReference< container::XNameAccess > xTmpNameAccess; static uno::WeakReference< ::com::sun::star::frame::XModuleManager > xTmpModuleMgr; - xServiceManager = xTmpServiceManager; - if ( !xServiceManager.is() ) + xContext = xTmpContext; + if ( !xContext.is() ) { - xServiceManager = ::comphelper::getProcessServiceFactory(); - xTmpServiceManager = xServiceManager; + xContext = ::comphelper::getProcessComponentContext(); + xTmpContext = xContext; } xUICommandDescription = xTmpNameAccess; if ( !xUICommandDescription.is() ) { - xUICommandDescription = uno::Reference< container::XNameAccess >( - ui::UICommandDescription::create(comphelper::ComponentContext(xServiceManager).getUNOContext()) ); + xUICommandDescription = uno::Reference< container::XNameAccess >( ui::UICommandDescription::create(xContext) ); xTmpNameAccess = xUICommandDescription; } xModuleManager = xTmpModuleMgr; if ( !xModuleManager.is() ) { - xModuleManager = uno::Reference< ::com::sun::star::frame::XModuleManager >( - xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.ModuleManager" ))), - uno::UNO_QUERY_THROW ); + xModuleManager = uno::Reference< frame::XModuleManager >( frame::ModuleManager::create(xContext), uno::UNO_QUERY_THROW ); xTmpModuleMgr = xModuleManager; } diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index a33e5a47201b..2f8e90476c3c 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -27,7 +27,7 @@ #include "sfxlocal.hrc" #include "helpid.hrc" -#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/ui/XToolPanel.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> @@ -71,6 +71,7 @@ namespace sfx2 using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Type; + using ::com::sun::star::frame::ModuleManager; using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::container::XNameAccess; using ::com::sun::star::ui::XToolPanel; @@ -100,7 +101,7 @@ namespace sfx2 ::rtl::OUStringBuffer aPathComposer; try { - const Reference< XNameAccess > xModuleAccess( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const Reference< XNameAccess > xModuleAccess( ModuleManager::create(aContext.getUNOContext()), UNO_QUERY_THROW ); const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) ); @@ -127,8 +128,8 @@ namespace sfx2 ::rtl::OUString sModuleName; try { - const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - const Reference< XModuleManager > xModuleManager( aContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + const Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + const Reference< XModuleManager > xModuleManager( ModuleManager::create(xContext), UNO_QUERY_THROW ); sModuleName = xModuleManager->identify( i_rDocumentFrame ); } catch( const Exception& ) diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 307bcb464071..64a242cfbee8 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #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/frame/ModuleManager.hpp> #include <com/sun/star/ui/UICommandDescription.hpp> #include "sfx2/sfxhelp.hxx" @@ -745,8 +745,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Sfx pStyleSheetPool ( NULL ), pTreeBox ( NULL ), pCurObjShell ( NULL ), - xModuleManager ( ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY ), + xModuleManager ( frame::ModuleManager::create(::comphelper::getProcessComponentContext()), UNO_QUERY ), m_pDeletionWatcher ( NULL ), aFmtLb ( this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH ), diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 7ae8930a474e..135ef0bc7920 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include <com/sun/star/document/XTypeDetection.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <comphelper/processfactory.hxx> @@ -383,10 +384,10 @@ String SfxObjectFactory::GetModuleName() const { try { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::uno::Reference< css::container::XNameAccess > xModuleManager( - xSMGR->createInstance("com.sun.star.frame.ModuleManager"), + css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW); ::rtl::OUString sDocService(GetDocumentServiceName()); diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 0e8ca95d142a..1ea6af05ced6 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -50,7 +50,7 @@ #include <com/sun/star/ucb/TransferInfo.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/uno/Exception.hpp> #include <svtools/templatefoldercache.hxx> @@ -1845,8 +1845,7 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, // get document service name uno::Reference< frame::XModuleManager > xModuleManager( - xFactory->createInstance( - ::rtl::OUString("com.sun.star.frame.ModuleManager") ), + frame::ModuleManager::create(comphelper::ComponentContext(xFactory).getUNOContext()), uno::UNO_QUERY_THROW ); sDocServiceName = xModuleManager->identify( uno::Reference< uno::XInterface >( rStorable, uno::UNO_QUERY ) ); if ( sDocServiceName.isEmpty() ) diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 78a12cf716dc..3af0dd378252 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XStorable2.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -45,7 +46,6 @@ #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/util/XCloneable.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/io/IOException.hpp> #include "guisaveas.hxx" @@ -1280,12 +1280,8 @@ uno::Reference< ::com::sun::star::frame::XModuleManager > SfxStoringHelper::GetM if ( !m_xModuleManager.is() ) { m_xModuleManager = uno::Reference< ::com::sun::star::frame::XModuleManager >( - GetServiceFactory()->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")) ), - uno::UNO_QUERY ); - - if ( !m_xModuleManager.is() ) - throw uno::RuntimeException(); + frame::ModuleManager::create(comphelper::ComponentContext(GetServiceFactory()).getUNOContext()), + uno::UNO_QUERY_THROW ); } return m_xModuleManager; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index e33d59c168d4..8ea9415164c3 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -26,7 +26,7 @@ #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> #include <com/sun/star/frame/XLayoutManager.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/EmbedStates.hpp> #include <com/sun/star/embed/EmbedMisc.hpp> @@ -232,15 +232,15 @@ static ::rtl::OUString RetrieveLabelFromCommand( css::uno::Reference< css::container::XNameAccess > xNameAccess( s_xNameAccess ); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( ::comphelper::getProcessServiceFactory(), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::uno::XComponentContext > xContext( + ::comphelper::getProcessComponentContext(), css::uno::UNO_QUERY_THROW); try { if ( !xModuleManager.is() ) { xModuleManager = css::uno::Reference< css::frame::XModuleManager >( - xSMGR->createInstance( - ::rtl::OUString( "com.sun.star.frame.ModuleManager" )), - css::uno::UNO_QUERY_THROW ); + css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW); s_xModuleManager = xModuleManager; } @@ -362,12 +362,11 @@ enum ETypeFamily ::rtl::OUString impl_searchFormatTypeForApp(const css::uno::Reference< css::frame::XFrame >& xFrame , ETypeFamily eTypeFamily) { - static ::rtl::OUString SERVICENAME_MODULEMANAGER("com.sun.star.frame.ModuleManager"); - try { css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR (::comphelper::getProcessServiceFactory() , css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::frame::XModuleManager > xModuleManager(xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::uno::XComponentContext > xContext (::comphelper::getProcessComponentContext() , css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager > xModuleManager(css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW); ::rtl::OUString sModule = xModuleManager->identify(xFrame); ::rtl::OUString sType ; @@ -625,16 +624,11 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) const sal_Int32 FILTERFLAG_EXPORT = 0x00000002; css::uno::Reference< lang::XMultiServiceFactory > xSMGR(::comphelper::getProcessServiceFactory(), css::uno::UNO_QUERY_THROW); - css::uno::Reference < css::frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); + css::uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext(), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); css::uno::Reference< css::frame::XModel > xModel; - const rtl::OUString aModuleManager( "com.sun.star.frame.ModuleManager" ); - css::uno::Reference< css::frame::XModuleManager > xModuleManager( xSMGR->createInstance( aModuleManager ), css::uno::UNO_QUERY_THROW ); - if ( !xModuleManager.is() ) - { - rReq.Done(sal_False); - return; - } + css::uno::Reference< css::frame::XModuleManager > xModuleManager( css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW ); rtl::OUString aModule; try diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index bb07a8917fa8..881383d42045 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -28,7 +28,7 @@ #include <svtools/acceleratorexecute.hxx> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> @@ -389,7 +389,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st const css::uno::Reference< css::frame::XFrame >& xFrame) { css::uno::Reference< css::frame::XModuleManager > xModuleDetection( - xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))), + css::frame::ModuleManager::create(comphelper::ComponentContext(xSMGR).getUNOContext()), css::uno::UNO_QUERY_THROW); ::rtl::OUString sModule; diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx index 8e28720798ef..a452e6b95b30 100644 --- a/svtools/source/uno/contextmenuhelper.cxx +++ b/svtools/source/uno/contextmenuhelper.cxx @@ -33,7 +33,7 @@ #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XStatusListener.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> @@ -417,29 +417,23 @@ ContextMenuHelper::associateUIConfigurationManagers() } } - uno::Reference< frame::XModuleManager > xModuleManager( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.ModuleManager" ))), - uno::UNO_QUERY ); + uno::Reference< frame::XModuleManager2 > xModuleManager( + frame::ModuleManager::create( ::comphelper::getProcessComponentContext() ) ); uno::Reference< ui::XImageManager > xModuleImageManager; rtl::OUString aModuleId; - if ( xModuleManager.is() ) + // retrieve module image manager + aModuleId = xModuleManager->identify( xFrame ); + + uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( + ui::ModuleUIConfigurationManagerSupplier::create( + ::comphelper::getProcessComponentContext() ) ); + uno::Reference< ui::XUIConfigurationManager > xUICfgMgr( + xModuleCfgMgrSupplier->getUIConfigurationManager( aModuleId )); + if ( xUICfgMgr.is() ) { - // retrieve module image manager - aModuleId = xModuleManager->identify( xFrame ); - - uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier( - ui::ModuleUIConfigurationManagerSupplier::create( - ::comphelper::getProcessComponentContext() ) ); - uno::Reference< ui::XUIConfigurationManager > xUICfgMgr( - xModuleCfgMgrSupplier->getUIConfigurationManager( aModuleId )); - if ( xUICfgMgr.is() ) - { - m_xModuleImageMgr = uno::Reference< ui::XImageManager >( - xUICfgMgr->getImageManager(), uno::UNO_QUERY ); - } + m_xModuleImageMgr = uno::Reference< ui::XImageManager >( + xUICfgMgr->getImageManager(), uno::UNO_QUERY ); } uno::Reference< container::XNameAccess > xNameAccess( diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 8dd903e8d5eb..24bbe33a3947 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -46,7 +46,7 @@ #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <comphelper/processfactory.hxx> #include <svl/itempool.hxx> #include <svl/intitem.hxx> @@ -711,22 +711,17 @@ void SvxSearchDialog::CalculateDelta_Impl() bool bWriterApp = false; bool bImpressApp = false; const uno::Reference< frame::XFrame > xFrame = rBindings.GetActiveFrame(); - uno::Reference< frame::XModuleManager > xModuleManager( - ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), uno::UNO_QUERY ); - if ( xModuleManager.is() ) + uno::Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(::comphelper::getProcessComponentContext()) ); + try + { + ::rtl::OUString aModuleIdentifier = xModuleManager->identify( xFrame ); + bCalcApp = aModuleIdentifier == "com.sun.star.sheet.SpreadsheetDocument"; + bDrawApp = aModuleIdentifier == "com.sun.star.drawing.DrawingDocument"; + bImpressApp = aModuleIdentifier == "com.sun.star.presentation.PresentationDocument"; + bWriterApp = aModuleIdentifier == "com.sun.star.text.TextDocument"; + } + catch ( uno::Exception& ) { - try - { - ::rtl::OUString aModuleIdentifier = xModuleManager->identify( xFrame ); - bCalcApp = aModuleIdentifier == "com.sun.star.sheet.SpreadsheetDocument"; - bDrawApp = aModuleIdentifier == "com.sun.star.drawing.DrawingDocument"; - bImpressApp = aModuleIdentifier == "com.sun.star.presentation.PresentationDocument"; - bWriterApp = aModuleIdentifier == "com.sun.star.text.TextDocument"; - } - catch ( uno::Exception& ) - { - } } if ( pImpl->bDeltaCalculated ) diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx index 6bd7063b178c..c0040cd98693 100644 --- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx +++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx @@ -37,6 +37,7 @@ #include "rtl/ref.hxx" #include "cppuhelper/weak.hxx" +#include "comphelper/componentcontext.hxx" #include "comphelper/namedvaluecollection.hxx" #include "comphelper/documentinfo.hxx" @@ -45,6 +46,7 @@ #include "com/sun/star/container/XEnumerationAccess.hpp" #include "com/sun/star/document/XStorageBasedDocument.hpp" #include "com/sun/star/frame/XStorable.hpp" +#include "com/sun/star/frame/ModuleManager.hpp" #include "com/sun/star/lang/DisposedException.hpp" #include "com/sun/star/util/XCloseBroadcaster.hpp" @@ -700,13 +702,8 @@ bool OfficeDocumentsManager::isBasicIDE( { try { - m_xModuleMgr - = uno::Reference< - frame::XModuleManager >( - m_xSMgr->createInstance( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.frame.ModuleManager" ) ) ), + m_xModuleMgr = uno::Reference< frame::XModuleManager >( + frame::ModuleManager::create(comphelper::ComponentContext(m_xSMgr).getUNOContext()), uno::UNO_QUERY ); } catch ( uno::Exception const & ) |