diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-29 17:20:22 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-29 18:18:28 +0200 |
commit | c2ca6fabd1afc3fc07001721c2069d3c8db7000a (patch) | |
tree | 350741d6d19564bcaf00506bd7d22b4c644e0fdc /desktop | |
parent | f05d7abf93bbcf443cb0b5759ca19992e2fa85a3 (diff) |
Use comphelper::getComponentContext
...and some further clean up.
Change-Id: Id294c0f38fe0041646fc86cacbd2e19734c746a9
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/Library_offacc.mk | 1 | ||||
-rw-r--r-- | desktop/inc/app.hxx | 2 | ||||
-rw-r--r-- | desktop/source/app/app.cxx | 5 | ||||
-rw-r--r-- | desktop/source/app/appinit.cxx | 19 | ||||
-rw-r--r-- | desktop/source/offacc/acceptor.cxx | 18 |
5 files changed, 8 insertions, 37 deletions
diff --git a/desktop/Library_offacc.mk b/desktop/Library_offacc.mk index 8272b4d49920..6e3c84589d76 100644 --- a/desktop/Library_offacc.mk +++ b/desktop/Library_offacc.mk @@ -34,6 +34,7 @@ $(eval $(call gb_Library_set_include,offacc,\ $(eval $(call gb_Library_use_sdk_api,offacc)) $(eval $(call gb_Library_use_libraries,offacc,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 7b8359d44d15..4f56c32560e7 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -144,8 +144,6 @@ class Desktop : public Application void RegisterServices(); void DeregisterServices(); - void DestroyApplicationServiceManager( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr ); - void CreateTemporaryDirectory(); void RemoveTemporaryDirectory(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 4741ce6833a8..cff9f8ed65e6 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -665,8 +665,9 @@ void Desktop::DeInit() // close splashscreen if it's still open CloseSplashScreen(); - Reference<XMultiServiceFactory> xXMultiServiceFactory(::comphelper::getProcessServiceFactory()); - DestroyApplicationServiceManager( xXMultiServiceFactory ); + Reference< XComponent >( + comphelper::getProcessComponentContext(), UNO_QUERY_THROW )-> + dispose(); // nobody should get a destroyd service factory... ::comphelper::setProcessServiceFactory( NULL ); diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 367b77ab08fd..157621ac92ed 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -128,25 +128,6 @@ void Desktop::InitApplicationServiceManager() comphelper::setProcessServiceFactory(sm); } -void Desktop::DestroyApplicationServiceManager( Reference< XMultiServiceFactory >& xSMgr ) -{ - Reference< XPropertySet > xProps( xSMgr, UNO_QUERY ); - if ( xProps.is() ) - { - try - { - Reference< XComponent > xComp; - if (xProps->getPropertyValue( OUString( "DefaultContext" )) >>= xComp ) - { - xComp->dispose(); - } - } - catch (const UnknownPropertyException&) - { - } - } -} - void Desktop::RegisterServices() { if( !m_bServicesRegistered ) diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx index 2fd0da302885..4510f65dcbc5 100644 --- a/desktop/source/offacc/acceptor.cxx +++ b/desktop/source/offacc/acceptor.cxx @@ -31,10 +31,9 @@ #include <unotools/bootstrap.hxx> #include <tools/stream.hxx> #include <vcl/svapp.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/bridge/BridgeFactory.hpp> #include <com/sun/star/uno/XNamingService.hpp> - +#include <comphelper/processfactory.hxx> #include <cppuhelper/factory.hxx> namespace desktop @@ -45,15 +44,6 @@ extern "C" void workerfunc (void * acc) ((Acceptor*)acc)->run(); } -static Reference<XComponentContext> getComponentContext( const Reference<XMultiServiceFactory>& rFactory) -{ - Reference<XComponentContext> rContext; - Reference< XPropertySet > rPropSet( rFactory, UNO_QUERY ); - Any a = rPropSet->getPropertyValue( ::rtl::OUString( "DefaultContext" ) ); - a >>= rContext; - return rContext; -} - Mutex Acceptor::m_aMutex; Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory ) @@ -66,7 +56,7 @@ Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory ) { m_rSMgr = rFactory; // get component context - m_rContext = getComponentContext(m_rSMgr); + m_rContext = comphelper::getComponentContext(m_rSMgr); m_rAcceptor = Reference< XAcceptor > (m_rSMgr->createInstance( rtl::OUString("com.sun.star.connection.Acceptor" )), UNO_QUERY ); @@ -266,7 +256,7 @@ Reference<XInterface> SAL_CALL AccInstanceProvider::getInstance (const OUString& } else if(aName.compareToAscii( "StarOffice.ComponentContext" ) == 0 ) { - rInstance = getComponentContext( m_rSMgr ); + rInstance = comphelper::getComponentContext( m_rSMgr ); } else if ( aName.compareToAscii("StarOffice.NamingService" ) == 0 ) { @@ -278,7 +268,7 @@ Reference<XInterface> SAL_CALL AccInstanceProvider::getInstance (const OUString& rNamingService->registerObject( OUString("StarOffice.ServiceManager" ), m_rSMgr ); rNamingService->registerObject( - OUString("StarOffice.ComponentContext" ), getComponentContext( m_rSMgr )); + OUString("StarOffice.ComponentContext" ), comphelper::getComponentContext( m_rSMgr )); rInstance = rNamingService; } } |