diff options
author | Noel Grandin <noel@peralex.com> | 2012-09-04 14:56:48 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-05 14:56:19 +0200 |
commit | 1c7a54e3a14ad932e68b9281420e6c469e5dd2e5 (patch) | |
tree | 8d2d64a9536e738cc6cda4f0690993c98b658bdd /basctl | |
parent | 55aa40bcd6ae3116c63a0eac18056bcfd011f43a (diff) |
fdo#46808, Adapt frame::ModuleManager UNO service to new style
Create a merged XModuleManager2 interface for this service to implement.
Which is backwards-compatible, but does not require creating a new service.
Explicitly document the XNameReplace interface in the IDL, which
is already implemented by the service, since there is code currently using it.
Change-Id: Ib46349174b1ce495c240031e93c9427fc33d9853
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/bastype2.cxx | 41 |
1 files changed, 19 insertions, 22 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() ) |