diff options
author | Noel Grandin <noel@peralex.com> | 2013-06-04 08:45:46 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-06-05 08:13:22 +0200 |
commit | c0654ce02272499236f7b43920e288c5fff34d4f (patch) | |
tree | 73dd8b626c0f172e1d9e77a3477ac9f9ac7f72d2 /desktop/source/offacc | |
parent | cee55a2c5463134c3a394bf6eda22998bc6cb2c9 (diff) |
fdo#46808, Convert XMultiServiceFactory in filter module
Change-Id: I9dcddba4f5a8a7adeddc31b5df014b0174b9745d
Diffstat (limited to 'desktop/source/offacc')
-rw-r--r-- | desktop/source/offacc/acceptor.cxx | 28 | ||||
-rw-r--r-- | desktop/source/offacc/acceptor.hxx | 7 |
2 files changed, 16 insertions, 19 deletions
diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx index fd5fbff05ddf..dd06969ae66c 100644 --- a/desktop/source/offacc/acceptor.cxx +++ b/desktop/source/offacc/acceptor.cxx @@ -42,19 +42,17 @@ extern "C" void offacc_workerfunc (void * acc) Mutex Acceptor::m_aMutex; -Acceptor::Acceptor( const Reference< XMultiServiceFactory >& rFactory ) +Acceptor::Acceptor( const Reference< XComponentContext >& rxContext ) : m_thread(NULL) + , m_rContext(rxContext) , m_aAcceptString() , m_aConnectString() , m_aProtocol() , m_bInit(sal_False) , m_bDying(false) { - m_rSMgr = rFactory; - // get component context - m_rContext = comphelper::getComponentContext(m_rSMgr); - m_rAcceptor = Reference< XAcceptor > (m_rSMgr->createInstance( - OUString("com.sun.star.connection.Acceptor" )), + m_rAcceptor.set( + m_rContext->getServiceManager()->createInstanceWithContext("com.sun.star.connection.Acceptor", m_rContext), UNO_QUERY ); m_rBridgeFactory = BridgeFactory::create(m_rContext); } @@ -115,7 +113,7 @@ void SAL_CALL Acceptor::run() // create instanceprovider for this connection Reference< XInstanceProvider > rInstanceProvider( - (XInstanceProvider*)new AccInstanceProvider(m_rSMgr, rConnection)); + (XInstanceProvider*)new AccInstanceProvider(m_rContext, rConnection)); // create the bridge. The remote end will have a reference to this bridge // thus preventing the bridge from being disposed. When the remote end releases // the bridge, it will be destructed. @@ -222,16 +220,16 @@ sal_Bool Acceptor::supportsService(OUString const & ServiceName) Reference< XInterface > Acceptor::impl_getInstance( const Reference< XMultiServiceFactory >& aFactory ) { try { - return (XComponent*) new Acceptor( aFactory ); + return (XComponent*) new Acceptor( comphelper::getComponentContext(aFactory) ); } catch ( const Exception& ) { return (XComponent*) NULL; } } // InstanceProvider -AccInstanceProvider::AccInstanceProvider(const Reference<XMultiServiceFactory>& aFactory, const Reference<XConnection>& rConnection) +AccInstanceProvider::AccInstanceProvider(const Reference<XComponentContext>& rxContext, const Reference<XConnection>& rConnection) { - m_rSMgr = aFactory; + m_rContext = rxContext; m_rConnection = rConnection; } @@ -247,23 +245,23 @@ Reference<XInterface> SAL_CALL AccInstanceProvider::getInstance (const OUString& if ( aName.compareToAscii( "StarOffice.ServiceManager" ) == 0) { - rInstance = Reference< XInterface >( m_rSMgr ); + rInstance = Reference< XInterface >( m_rContext->getServiceManager() ); } else if(aName.compareToAscii( "StarOffice.ComponentContext" ) == 0 ) { - rInstance = comphelper::getComponentContext( m_rSMgr ); + rInstance = m_rContext; } else if ( aName.compareToAscii("StarOffice.NamingService" ) == 0 ) { Reference< XNamingService > rNamingService( - m_rSMgr->createInstance( OUString("com.sun.star.uno.NamingService" )), + m_rContext->getServiceManager()->createInstanceWithContext("com.sun.star.uno.NamingService", m_rContext), UNO_QUERY ); if ( rNamingService.is() ) { rNamingService->registerObject( - OUString("StarOffice.ServiceManager" ), m_rSMgr ); + OUString("StarOffice.ServiceManager" ), m_rContext->getServiceManager() ); rNamingService->registerObject( - OUString("StarOffice.ComponentContext" ), comphelper::getComponentContext( m_rSMgr )); + OUString("StarOffice.ComponentContext" ), m_rContext ); rInstance = rNamingService; } } diff --git a/desktop/source/offacc/acceptor.hxx b/desktop/source/offacc/acceptor.hxx index 76d08a45ed07..a34d310b4beb 100644 --- a/desktop/source/offacc/acceptor.hxx +++ b/desktop/source/offacc/acceptor.hxx @@ -54,7 +54,6 @@ private: ::osl::Condition m_cEnable; - css::uno::Reference< css::lang::XMultiServiceFactory > m_rSMgr; css::uno::Reference< css::uno::XComponentContext > m_rContext; css::uno::Reference< css::connection::XAcceptor > m_rAcceptor; css::uno::Reference< css::bridge::XBridgeFactory2 > m_rBridgeFactory; @@ -67,7 +66,7 @@ private: bool m_bDying; public: - Acceptor( const css::uno::Reference< css::lang::XMultiServiceFactory >& aFactory ); + Acceptor( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); virtual ~Acceptor(); void SAL_CALL run(); @@ -92,11 +91,11 @@ public: class AccInstanceProvider : public ::cppu::WeakImplHelper1<css::bridge::XInstanceProvider> { private: - css::uno::Reference<css::lang::XMultiServiceFactory> m_rSMgr; + css::uno::Reference<css::uno::XComponentContext> m_rContext; css::uno::Reference<css::connection::XConnection> m_rConnection; public: - AccInstanceProvider(const css::uno::Reference< css::lang::XMultiServiceFactory >& aFactory, + AccInstanceProvider(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::connection::XConnection >& rConnection); virtual ~AccInstanceProvider(); |