diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-05 14:55:34 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-05 14:56:19 +0200 |
commit | 24391f605703bda1bcfa99ef06e5a73c6b52d267 (patch) | |
tree | 3a4cf9732c8a8c82b56cdc038e5dfda857cdc518 | |
parent | 1c7a54e3a14ad932e68b9281420e6c469e5dd2e5 (diff) |
Some clean up of previous commit
Change-Id: I14097acf09e9663af7d7abc5f0c9d481880ecc51
29 files changed, 106 insertions, 166 deletions
diff --git a/basic/source/basmgr/vbahelper.cxx b/basic/source/basmgr/vbahelper.cxx index 6b07178bf5a0..d5c24667f39a 100644 --- a/basic/source/basmgr/vbahelper.cxx +++ b/basic/source/basmgr/vbahelper.cxx @@ -42,18 +42,10 @@ namespace { /** Create an instance of a module manager. */ -uno::Reference< frame::XModuleManager > lclCreateModuleManager() +uno::Reference< frame::XModuleManager2 > lclCreateModuleManager() { - uno::Reference< frame::XModuleManager > xModuleManager; - try - { - uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext(), uno::UNO_QUERY_THROW ); - xModuleManager.set( frame::ModuleManager::create(xContext), uno::UNO_QUERY ); - } - catch(const uno::Exception& ) - { - } - return xModuleManager; + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext(), uno::UNO_QUERY_THROW ); + return frame::ModuleManager::create(xContext); } // ---------------------------------------------------------------------------- @@ -76,7 +68,7 @@ DocumentsEnumeration::DocumentsEnumeration( const uno::Reference< frame::XModel { try { - uno::Reference< frame::XModuleManager > xModuleManager( lclCreateModuleManager(), uno::UNO_SET_THROW ); + uno::Reference< frame::XModuleManager2 > xModuleManager( lclCreateModuleManager() ); ::rtl::OUString aIdentifier = xModuleManager->identify( rxModel ); uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), uno::UNO_QUERY_THROW ); @@ -213,7 +205,7 @@ void registerCurrentDirectory( const uno::Reference< frame::XModel >& rxModel, c ::osl::MutexGuard aGuard( rPool.maMutex ); try { - uno::Reference< frame::XModuleManager > xModuleManager( lclCreateModuleManager(), uno::UNO_SET_THROW ); + uno::Reference< frame::XModuleManager2 > xModuleManager( lclCreateModuleManager() ); ::rtl::OUString aIdentifier = xModuleManager->identify( rxModel ); if( !aIdentifier.isEmpty() ) rPool.maCurrDirs[ aIdentifier ] = rPath; diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index c12a91a21ae5..957eb381670f 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -864,12 +864,10 @@ void SfxAcceleratorConfigPage::InitAccCfg() } // identify module - 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); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( + css::frame::ModuleManager::create(comphelper::ComponentContext(m_xSMGR).getUNOContext())); m_sModuleLongName = xModuleManager->identify(m_xFrame); - ::comphelper::SequenceAsHashMap lModuleProps(xModuleManagerCont->getByName(m_sModuleLongName)); + ::comphelper::SequenceAsHashMap lModuleProps(xModuleManager->getByName(m_sModuleLongName)); m_sModuleShortName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_SHORTNAME, ::rtl::OUString()); m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , ::rtl::OUString()); diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 4340091b642c..0a0e70611516 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -26,6 +26,9 @@ * ************************************************************************/ +#include "sal/config.h" + +#include <cassert> #include <stdlib.h> #include <time.h> @@ -447,41 +450,36 @@ OUString GetModuleName( const OUString& aModuleId ) return ::rtl::OUString(); } -OUString GetUIModuleName( const OUString& aModuleId, const uno::Reference< css::frame::XModuleManager >& rModuleManager ) +OUString GetUIModuleName( const OUString& aModuleId, const uno::Reference< css::frame::XModuleManager2 >& rModuleManager ) { + assert(rModuleManager.is()); + OUString aModuleUIName; - if ( rModuleManager.is() ) + try { - uno::Reference< css::container::XNameAccess > xNameAccess( rModuleManager, uno::UNO_QUERY ); - if ( xNameAccess.is() ) + uno::Any a = rModuleManager->getByName( aModuleId ); + uno::Sequence< beans::PropertyValue > aSeq; + + if ( a >>= aSeq ) { - try + for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i ) { - uno::Any a = xNameAccess->getByName( aModuleId ); - uno::Sequence< beans::PropertyValue > aSeq; - - if ( a >>= aSeq ) + if ( aSeq[i].Name == "ooSetupFactoryUIName" ) { - for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i ) - { - if ( aSeq[i].Name == "ooSetupFactoryUIName" ) - { - aSeq[i].Value >>= aModuleUIName; - break; - } - } + aSeq[i].Value >>= aModuleUIName; + break; } } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& ) - { - } } } + catch ( uno::RuntimeException& ) + { + throw; + } + catch ( uno::Exception& ) + { + } if ( aModuleUIName.isEmpty() ) aModuleUIName = GetModuleName( aModuleId ); @@ -777,7 +775,7 @@ sal_Bool impl_showKeyConfigTabPage( const css::uno::Reference< css::frame::XFram 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 (css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xMM (css::frame::ModuleManager::create(xContext)); if (xFrame.is()) { @@ -1672,8 +1670,8 @@ void SvxConfigPage::Reset( const SfxItemSet& ) OUString aModuleId = GetFrameWithDefaultAndIdentify( m_xFrame ); // replace %MODULENAME in the label with the correct module name - uno::Reference< css::frame::XModuleManager > xModuleManager( - css::frame::ModuleManager::create( xContext ), uno::UNO_QUERY_THROW); + uno::Reference< css::frame::XModuleManager2 > xModuleManager( + css::frame::ModuleManager::create( xContext )); OUString aModuleName = GetUIModuleName( aModuleId, xModuleManager ); OUString title = aTopLevelSeparator.GetText(); diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx index 4b12b50b30eb..44cd36bebcbf 100644 --- a/cui/source/customize/cfgutil.cxx +++ b/cui/source/customize/cfgutil.cxx @@ -767,13 +767,11 @@ Image SfxConfigGroupListBox_Impl::GetImage( if ( xDocumentModel.is() ) { Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) ); - Reference<container::XNameAccess> xModuleConfig( - xModuleManager, UNO_QUERY_THROW ); // get the long name of the document: ::rtl::OUString appModule( xModuleManager->identify( xDocumentModel ) ); Sequence<beans::PropertyValue> moduleDescr; - Any aAny = xModuleConfig->getByName(appModule); + Any aAny = xModuleManager->getByName(appModule); if( sal_True != ( aAny >>= moduleDescr ) ) { throw RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SFTreeListBox::Init: failed to get PropertyValue") ), Reference< XInterface >()); diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx index 67bc1bfaa947..8ccafd287706 100644 --- a/cui/source/customize/selector.cxx +++ b/cui/source/customize/selector.cxx @@ -567,13 +567,11 @@ Image SvxConfigGroupListBox_Impl::GetImage( if ( xDocumentModel.is() ) { Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) ); - Reference<container::XNameAccess> xModuleConfig( - xModuleManager, UNO_QUERY_THROW ); // get the long name of the document: OUString appModule( xModuleManager->identify( xDocumentModel ) ); Sequence<beans::PropertyValue> moduleDescr; - Any aAny = xModuleConfig->getByName(appModule); + Any aAny = xModuleManager->getByName(appModule); if( sal_True != ( aAny >>= moduleDescr ) ) { throw RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("SFTreeListBox::Init: failed to get PropertyValue")), Reference< XInterface >()); diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index ebd3676a4f7d..2c7b1544dd74 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -226,13 +226,11 @@ void SFTreeListBox::Init( const ::rtl::OUString& language ) { Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) ); - Reference<container::XNameAccess> xModuleConfig( - xModuleManager, UNO_QUERY_THROW ); // get the long name of the document: Sequence<beans::PropertyValue> moduleDescr; try{ ::rtl::OUString appModule = xModuleManager->identify( xDocumentModel ); - xModuleConfig->getByName(appModule) >>= moduleDescr; + xModuleManager->getByName(appModule) >>= moduleDescr; } catch(const uno::Exception&) {} diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 16bfa7f434d2..c40bfdae7541 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1955,7 +1955,7 @@ rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier( xCurrentFrame = xDesktop->getCurrentFrame(); } - if ( xCurrentFrame.is() && xModuleManager.is() ) + if ( xCurrentFrame.is() ) { try { diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index e54299448a49..e2c4c03d06aa 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -2079,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( ModuleManager::create(m_pImpl->m_aContext.getUNOContext()), UNO_QUERY_THROW ); + m_xModuleManager.set( ModuleManager::create(m_pImpl->m_aContext.getUNOContext()) ); ::rtl::OUString sModuleId; try diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 5ffbb1876e10..2ff9ec6cc895 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -34,7 +34,7 @@ #include <com/sun/star/sdb/XFormDocumentsSupplier.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/view/XPrintable.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp> @@ -190,7 +190,7 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe ::com::sun::star::uno::WeakReference< ::com::sun::star::script::provider::XScriptProvider > m_xScriptProvider; /** @short such module manager is used to classify new opened documents. */ - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > m_xTitleHelper; TNumberedController m_aNumberedControllers; diff --git a/forms/source/helper/commanddescriptionprovider.cxx b/forms/source/helper/commanddescriptionprovider.cxx index 2cfe8e7d2687..900e3ceed558 100644 --- a/forms/source/helper/commanddescriptionprovider.cxx +++ b/forms/source/helper/commanddescriptionprovider.cxx @@ -49,7 +49,7 @@ namespace frm 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::frame::XModuleManager2; using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::ui::UICommandDescription; /** === end UNO using === **/ @@ -89,7 +89,7 @@ namespace frm try { - Reference< XModuleManager > xModuleManager( ModuleManager::create(_rxContext), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager( ModuleManager::create(_rxContext) ); ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument ); Reference< XNameAccess > xUICommandDescriptions( UICommandDescription::create(_rxContext) ); diff --git a/forms/source/helper/commandimageprovider.cxx b/forms/source/helper/commandimageprovider.cxx index 7925985c9393..049b0fcc0b11 100644 --- a/forms/source/helper/commandimageprovider.cxx +++ b/forms/source/helper/commandimageprovider.cxx @@ -60,7 +60,7 @@ namespace frm 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::frame::XModuleManager2; using ::com::sun::star::graphic::XGraphic; /** === end UNO using === **/ namespace ImageType = ::com::sun::star::ui::ImageType; @@ -112,7 +112,7 @@ namespace frm // obtain the image manager or the module try { - Reference< XModuleManager > xModuleManager( ModuleManager::create(_rContext.getUNOContext()), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager( ModuleManager::create(_rContext.getUNOContext()) ); ::rtl::OUString sModuleID = xModuleManager->identify( _rxDocument ); Reference< XModuleUIConfigurationManagerSupplier > xSuppUIConfig( diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 708a182e20b1..624c25f62410 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -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( ModuleManager::create(xContext), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xModuleManager( ModuleManager::create(xContext) ); Reference< XInterface > xIfac( xFrame, UNO_QUERY_THROW ); ::rtl::OUString aModuleIdentifier( xModuleManager->identify( xIfac ) ); diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx index 6491332a4171..689c237a9b52 100644 --- a/sfx2/inc/guisaveas.hxx +++ b/sfx2/inc/guisaveas.hxx @@ -27,7 +27,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> #include <comphelper/sequenceashashmap.hxx> #include <sfx2/signaturestate.hxx> @@ -50,15 +50,12 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xFilterCFG; ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery > m_xFilterQuery; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xNamedModManager; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceFactory(); ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetFilterConfiguration(); ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery > GetFilterQuery(); - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > GetModuleManager(); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetNamedModuleManager(); - + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > GetModuleManager(); public: SfxStoringHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 4d9d216dc027..6135f7bfa6e3 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -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( ModuleManager::create(i_rContext.getUNOContext()), UNO_QUERY_THROW ); + Reference< XModuleManager2 > xCheck( ModuleManager::create(i_rContext.getUNOContext()) ); 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 032e6355bd13..b8f996662cb2 100644 --- a/sfx2/source/appl/imagemgr.cxx +++ b/sfx2/source/appl/imagemgr.cxx @@ -142,15 +142,13 @@ Image SAL_CALL GetImage( } } - static WeakReference< XModuleManager > m_xModuleManager; + static WeakReference< XModuleManager2 > m_xModuleManager; - Reference< XModuleManager > xModuleManager = m_xModuleManager; + Reference< XModuleManager2 > xModuleManager = m_xModuleManager; if ( !xModuleManager.is() ) { - xModuleManager = Reference< XModuleManager >( - ModuleManager::create(::comphelper::getProcessComponentContext()), - UNO_QUERY ); + xModuleManager = ModuleManager::create(::comphelper::getProcessComponentContext()); m_xModuleManager = xModuleManager; } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 217538300969..f2d86c2520fa 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -34,7 +34,6 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <toolkit/helper/vclunohelper.hxx> @@ -415,13 +414,13 @@ SfxHelp::~SfxHelp() { ::rtl::OUString sIdentifier; Reference < XFrame > xCurrentFrame; - Reference < XModuleManager > xModuleManager( ModuleManager::create(::comphelper::getProcessComponentContext()), UNO_QUERY ); + Reference < XModuleManager2 > xModuleManager( ModuleManager::create(::comphelper::getProcessComponentContext()) ); Reference < XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); if ( xDesktop.is() ) xCurrentFrame = xDesktop->getCurrentFrame(); - if ( xCurrentFrame.is() && xModuleManager.is() ) + if ( xCurrentFrame.is() ) { try { @@ -450,12 +449,10 @@ String SfxHelp::GetHelpModuleName_Impl() { try { - Reference < XModuleManager > xModuleManager( - ModuleManager::create(::comphelper::getProcessComponentContext()), UNO_QUERY ); + Reference < XModuleManager2 > xModuleManager( + ModuleManager::create(::comphelper::getProcessComponentContext()) ); Sequence< PropertyValue > lProps; - Reference< ::com::sun::star::container::XNameAccess > xCont( xModuleManager, UNO_QUERY); - if ( xCont.is() ) - xCont->getByName( aModuleIdentifier ) >>= lProps; + xModuleManager->getByName( aModuleIdentifier ) >>= lProps; for ( sal_Int32 i = 0; i < lProps.getLength(); ++i ) { if ( lProps[i].Name == "ooSetupFactoryShortName" ) diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 1bcf9866fba3..e10da5d97852 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -176,14 +176,12 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd , uno::UNO_QUERY ); } - static uno::WeakReference< frame::XModuleManager > m_xModuleManager; + static uno::WeakReference< frame::XModuleManager2 > m_xModuleManager; - uno::Reference< frame::XModuleManager > xModuleManager( m_xModuleManager ); + uno::Reference< frame::XModuleManager2 > xModuleManager( m_xModuleManager ); if ( !xModuleManager.is() ) { - xModuleManager = uno::Reference< frame::XModuleManager >( - frame::ModuleManager::create(comphelper::ComponentContext(xServiceManager).getUNOContext()), - uno::UNO_QUERY ); + xModuleManager = frame::ModuleManager::create(comphelper::ComponentContext(xServiceManager).getUNOContext()); m_xModuleManager = xModuleManager; } diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 9465fa0a4d6a..813683ba941a 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -307,7 +307,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( if (!xContext.is()) return eRet; - css::uno::Reference< css::frame::XModuleManager > xModuleManager( css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( css::frame::ModuleManager::create(xContext) ); rtl::OUString aModule; try @@ -428,18 +428,17 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( if ( !bHasLocation || aFilterName.isEmpty()) { // Retrieve the user defined default filter - css::uno::Reference< css::container::XNameAccess > xNameAccess( xModuleManager, css::uno::UNO_QUERY ); try { - ::comphelper::SequenceAsHashMap aFilterPropsHM( xNameAccess->getByName( aModule ) ); + ::comphelper::SequenceAsHashMap aFilterPropsHM( xModuleManager->getByName( aModule ) ); aFilterName = aFilterPropsHM.getUnpackedValueOrDefault( ::rtl::OUString("ooSetupFactoryDefaultFilter"), ::rtl::OUString() ); - css::uno::Reference< css::container::XNameAccess > xNameAccess2( + css::uno::Reference< css::container::XNameAccess > xNameAccess( xContainerQuery, css::uno::UNO_QUERY ); - if ( xNameAccess2.is() ) + if ( xNameAccess.is() ) { - ::comphelper::SequenceAsHashMap aFilterPropsHM2( xNameAccess2->getByName( aFilterName ) ); + ::comphelper::SequenceAsHashMap aFilterPropsHM2( xNameAccess->getByName( aFilterName ) ); aTypeName = aFilterPropsHM2.getUnpackedValueOrDefault( ::rtl::OUString("Type"), ::rtl::OUString() ); diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index fb30ecc42f1b..edb28dc22818 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -47,11 +47,11 @@ static rtl::OUString GetLabelFromCommandURL( const rtl::OUString& rCommandURL, c uno::Reference< container::XNameAccess > xUICommandLabels; uno::Reference< uno::XComponentContext > xContext; uno::Reference< container::XNameAccess > xUICommandDescription; - uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleManager; + uno::Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager; static uno::WeakReference< uno::XComponentContext > xTmpContext; static uno::WeakReference< container::XNameAccess > xTmpNameAccess; - static uno::WeakReference< ::com::sun::star::frame::XModuleManager > xTmpModuleMgr; + static uno::WeakReference< ::com::sun::star::frame::XModuleManager2 > xTmpModuleMgr; xContext = xTmpContext; if ( !xContext.is() ) @@ -63,14 +63,14 @@ static rtl::OUString GetLabelFromCommandURL( const rtl::OUString& rCommandURL, c xUICommandDescription = xTmpNameAccess; if ( !xUICommandDescription.is() ) { - xUICommandDescription = uno::Reference< container::XNameAccess >( ui::UICommandDescription::create(xContext) ); + xUICommandDescription = ui::UICommandDescription::create(xContext); xTmpNameAccess = xUICommandDescription; } xModuleManager = xTmpModuleMgr; if ( !xModuleManager.is() ) { - xModuleManager = uno::Reference< frame::XModuleManager >( frame::ModuleManager::create(xContext), uno::UNO_QUERY_THROW ); + xModuleManager = frame::ModuleManager::create(xContext); xTmpModuleMgr = xModuleManager; } @@ -85,12 +85,9 @@ static rtl::OUString GetLabelFromCommandURL( const rtl::OUString& rCommandURL, c { } - if ( xUICommandDescription.is() ) - { - uno::Any a = xUICommandDescription->getByName( aModuleIdentifier ); - uno::Reference< container::XNameAccess > xUICommands; - a >>= xUICommandLabels; - } + uno::Any a = xUICommandDescription->getByName( aModuleIdentifier ); + uno::Reference< container::XNameAccess > xUICommands; + a >>= xUICommandLabels; } catch ( uno::Exception& ) { diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 2f8e90476c3c..fa73b7523b2e 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -72,13 +72,12 @@ namespace sfx2 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::frame::XModuleManager2; using ::com::sun::star::container::XNameAccess; using ::com::sun::star::ui::XToolPanel; using ::com::sun::star::ui::XUIElementFactory; using ::com::sun::star::ui::XUIElement; using ::com::sun::star::awt::XWindow; - using ::com::sun::star::frame::XModuleManager; using ::com::sun::star::frame::XFrame; using ::com::sun::star::lang::XComponent; using ::com::sun::star::graphic::XGraphicProvider; @@ -101,7 +100,7 @@ namespace sfx2 ::rtl::OUStringBuffer aPathComposer; try { - const Reference< XNameAccess > xModuleAccess( ModuleManager::create(aContext.getUNOContext()), UNO_QUERY_THROW ); + const Reference< XModuleManager2 > xModuleAccess( ModuleManager::create(aContext.getUNOContext()) ); const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); const ::rtl::OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", ::rtl::OUString() ) ); @@ -129,7 +128,7 @@ namespace sfx2 try { const Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - const Reference< XModuleManager > xModuleManager( ModuleManager::create(xContext), UNO_QUERY_THROW ); + const Reference< XModuleManager2 > xModuleManager( ModuleManager::create(xContext) ); sModuleName = xModuleManager->identify( i_rDocumentFrame ); } catch( const Exception& ) diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 64a242cfbee8..7e994dcfd9fb 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -745,7 +745,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Sfx pStyleSheetPool ( NULL ), pTreeBox ( NULL ), pCurObjShell ( NULL ), - xModuleManager ( frame::ModuleManager::create(::comphelper::getProcessComponentContext()), UNO_QUERY ), + xModuleManager ( frame::ModuleManager::create(::comphelper::getProcessComponentContext()) ), m_pDeletionWatcher ( NULL ), aFmtLb ( this, WB_BORDER | WB_TABSTOP | WB_SORT | WB_QUICK_SEARCH ), @@ -1876,7 +1876,7 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry) //------------------------------------------------------------------------- -static rtl::OUString getModuleIdentifier( const Reference< XModuleManager >& i_xModMgr, SfxObjectShell* i_pObjSh ) +static rtl::OUString getModuleIdentifier( const Reference< XModuleManager2 >& i_xModMgr, SfxObjectShell* i_pObjSh ) { OSL_ENSURE( i_xModMgr.is(), "getModuleIdentifier(): no XModuleManager" ); OSL_ENSURE( i_pObjSh, "getModuleIdentifier(): no ObjectShell" ); @@ -1907,14 +1907,10 @@ sal_Int32 SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter( SfxObjectShell* sal_Int32 nFilter = -1; Sequence< PropertyValue > lProps; - Reference< ::com::sun::star::container::XNameAccess > xContainer( xModuleManager, UNO_QUERY ); - if ( xContainer.is() ) - { - ::comphelper::SequenceAsHashMap aFactoryProps( - xContainer->getByName( getModuleIdentifier( xModuleManager, i_pObjSh ) ) ); - sal_Int32 nDefault = -1; - nFilter = aFactoryProps.getUnpackedValueOrDefault( DEFINE_CONST_UNICODE("ooSetupFactoryStyleFilter"), nDefault ); - } + ::comphelper::SequenceAsHashMap aFactoryProps( + xModuleManager->getByName( getModuleIdentifier( xModuleManager, i_pObjSh ) ) ); + sal_Int32 nDefault = -1; + nFilter = aFactoryProps.getUnpackedValueOrDefault( DEFINE_CONST_UNICODE("ooSetupFactoryStyleFilter"), nDefault ); return nFilter; } @@ -1924,14 +1920,10 @@ sal_Int32 SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter( SfxObjectShell* void SfxCommonTemplateDialog_Impl::SaveFactoryStyleFilter( SfxObjectShell* i_pObjSh, sal_Int32 i_nFilter ) { OSL_ENSURE( i_pObjSh, "SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter(): no ObjectShell" ); - Reference< ::com::sun::star::container::XNameReplace > xContainer( xModuleManager, UNO_QUERY ); - if ( xContainer.is() ) - { - Sequence< PropertyValue > lProps(1); - lProps[0].Name = DEFINE_CONST_UNICODE("ooSetupFactoryStyleFilter"); - lProps[0].Value = makeAny( i_nFilter );; - xContainer->replaceByName( getModuleIdentifier( xModuleManager, i_pObjSh ), makeAny( lProps ) ); - } + Sequence< PropertyValue > lProps(1); + lProps[0].Name = DEFINE_CONST_UNICODE("ooSetupFactoryStyleFilter"); + lProps[0].Value = makeAny( i_nFilter );; + xModuleManager->replaceByName( getModuleIdentifier( xModuleManager, i_pObjSh ), makeAny( lProps ) ); } //------------------------------------------------------------------------- diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index 135ef0bc7920..94eea2b2b4e4 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -386,9 +386,8 @@ String SfxObjectFactory::GetModuleName() const { css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - css::uno::Reference< css::container::XNameAccess > xModuleManager( - css::frame::ModuleManager::create(xContext), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( + css::frame::ModuleManager::create(xContext)); ::rtl::OUString sDocService(GetDocumentServiceName()); ::comphelper::SequenceAsHashMap aPropSet( xModuleManager->getByName(sDocService) ); diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 1ea6af05ced6..1218562121ec 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -1844,9 +1844,8 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName, throw uno::RuntimeException(); // get document service name - uno::Reference< frame::XModuleManager > xModuleManager( - frame::ModuleManager::create(comphelper::ComponentContext(xFactory).getUNOContext()), - uno::UNO_QUERY_THROW ); + uno::Reference< frame::XModuleManager2 > xModuleManager( + frame::ModuleManager::create(comphelper::ComponentContext(xFactory).getUNOContext()) ); sDocServiceName = xModuleManager->identify( uno::Reference< uno::XInterface >( rStorable, uno::UNO_QUERY ) ); if ( sDocServiceName.isEmpty() ) throw uno::RuntimeException(); diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 3af0dd378252..133cf6c6d61e 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -416,7 +416,7 @@ const ::comphelper::SequenceAsHashMap& ModelData_Impl::GetModuleProps() if ( !m_pModulePropsHM ) { uno::Sequence< beans::PropertyValue > aModuleProps; - m_pOwner->GetNamedModuleManager()->getByName( GetModuleName() ) >>= aModuleProps; + m_pOwner->GetModuleManager()->getByName( GetModuleName() ) >>= aModuleProps; if ( !aModuleProps.getLength() ) throw uno::RuntimeException(); // TODO; m_pModulePropsHM = new ::comphelper::SequenceAsHashMap( aModuleProps ); @@ -1275,32 +1275,18 @@ uno::Reference< container::XContainerQuery > SfxStoringHelper::GetFilterQuery() } //------------------------------------------------------------------------- -uno::Reference< ::com::sun::star::frame::XModuleManager > SfxStoringHelper::GetModuleManager() +uno::Reference< ::com::sun::star::frame::XModuleManager2 > SfxStoringHelper::GetModuleManager() { if ( !m_xModuleManager.is() ) { - m_xModuleManager = uno::Reference< ::com::sun::star::frame::XModuleManager >( - frame::ModuleManager::create(comphelper::ComponentContext(GetServiceFactory()).getUNOContext()), - uno::UNO_QUERY_THROW ); + m_xModuleManager = frame::ModuleManager::create( + comphelper::ComponentContext(GetServiceFactory()).getUNOContext()); } return m_xModuleManager; } //------------------------------------------------------------------------- -uno::Reference< container::XNameAccess > SfxStoringHelper::GetNamedModuleManager() -{ - if ( !m_xNamedModManager.is() ) - { - m_xNamedModManager = uno::Reference< container::XNameAccess >( GetModuleManager(), uno::UNO_QUERY ); - if ( !m_xNamedModManager.is() ) - throw uno::RuntimeException(); - } - - return m_xNamedModManager; -} - -//------------------------------------------------------------------------- sal_Bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xModel, const ::rtl::OUString& aSlotName, uno::Sequence< beans::PropertyValue >& aArgsSequence, diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index a95c19e12104..0cc98f327bf4 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -47,7 +47,7 @@ class SfxCommonTemplateDialog_Impl; class SfxTemplateDialogWrapper; class SfxDockingWindow; -namespace com { namespace sun { namespace star { namespace frame { class XModuleManager; } } } } +namespace com { namespace sun { namespace star { namespace frame { class XModuleManager2; } } } } // class DropListBox_Impl ------------------------------------------------ @@ -138,7 +138,7 @@ protected: SfxStyleSheetBasePool* pStyleSheetPool; SvTreeListBox* pTreeBox; SfxObjectShell* pCurObjShell; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager; DeletionWatcher* m_pDeletionWatcher; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 8ea9415164c3..0a4a0def55e5 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -224,11 +224,11 @@ static ::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& rCommandURL, const css::uno::Reference< css::frame::XFrame >& rFrame ) { - static css::uno::WeakReference< frame::XModuleManager > s_xModuleManager; + static css::uno::WeakReference< frame::XModuleManager2 > s_xModuleManager; static css::uno::WeakReference< container::XNameAccess > s_xNameAccess; ::rtl::OUString aLabel; - css::uno::Reference< css::frame::XModuleManager > xModuleManager( s_xModuleManager ); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( s_xModuleManager ); css::uno::Reference< css::container::XNameAccess > xNameAccess( s_xNameAccess ); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( ::comphelper::getProcessServiceFactory(), css::uno::UNO_QUERY_THROW); @@ -239,8 +239,7 @@ static ::rtl::OUString RetrieveLabelFromCommand( { if ( !xModuleManager.is() ) { - xModuleManager = css::uno::Reference< css::frame::XModuleManager >( - css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW); + xModuleManager = css::frame::ModuleManager::create(xContext); s_xModuleManager = xModuleManager; } @@ -366,7 +365,7 @@ enum ETypeFamily { 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); - css::uno::Reference< css::frame::XModuleManager > xModuleManager(css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager(css::frame::ModuleManager::create(xContext)); ::rtl::OUString sModule = xModuleManager->identify(xFrame); ::rtl::OUString sType ; @@ -628,7 +627,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) css::uno::Reference< css::frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); css::uno::Reference< css::frame::XModel > xModel; - css::uno::Reference< css::frame::XModuleManager > xModuleManager( css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW ); + css::uno::Reference< css::frame::XModuleManager2 > xModuleManager( css::frame::ModuleManager::create(xContext) ); rtl::OUString aModule; try diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index 881383d42045..8351bf147454 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -388,9 +388,8 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openModuleConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , const css::uno::Reference< css::frame::XFrame >& xFrame) { - css::uno::Reference< css::frame::XModuleManager > xModuleDetection( - css::frame::ModuleManager::create(comphelper::ComponentContext(xSMGR).getUNOContext()), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::frame::XModuleManager2 > xModuleDetection( + css::frame::ModuleManager::create(comphelper::ComponentContext(xSMGR).getUNOContext())); ::rtl::OUString sModule; try diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx index c0040cd98693..c3a94836d76a 100644 --- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx +++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx @@ -702,9 +702,8 @@ bool OfficeDocumentsManager::isBasicIDE( { try { - m_xModuleMgr = uno::Reference< frame::XModuleManager >( - frame::ModuleManager::create(comphelper::ComponentContext(m_xSMgr).getUNOContext()), - uno::UNO_QUERY ); + m_xModuleMgr = frame::ModuleManager::create( + comphelper::ComponentContext(m_xSMgr).getUNOContext()); } catch ( uno::Exception const & ) { diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx index 9b40fe323d10..ff1a07e885fe 100644 --- a/ucb/source/ucp/tdoc/tdoc_docmgr.hxx +++ b/ucb/source/ucp/tdoc/tdoc_docmgr.hxx @@ -39,7 +39,7 @@ #include "com/sun/star/document/XEventListener.hpp" #include "com/sun/star/embed/XStorage.hpp" #include "com/sun/star/frame/XModel.hpp" -#include "com/sun/star/frame/XModuleManager.hpp" +#include "com/sun/star/frame/XModuleManager2.hpp" #include "com/sun/star/util/XCloseListener.hpp" namespace tdoc_ucp { @@ -197,7 +197,7 @@ namespace tdoc_ucp { com::sun::star::uno::Reference< com::sun::star::document::XEventBroadcaster > m_xDocEvtNotifier; com::sun::star::uno::Reference< - com::sun::star::frame::XModuleManager > m_xModuleMgr; + com::sun::star::frame::XModuleManager2 > m_xModuleMgr; DocumentList m_aDocs; OfficeDocumentsEventListener * m_pDocEventListener; com::sun::star::uno::Reference< |