From 546fa9f365ef1b19abe6739d2f42389f82576437 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 4 Jun 2013 16:08:54 +0200 Subject: fdo#46808, Convert XMultiServiceFactory in svl module Change-Id: Ia51d748af3b29a6021e6f5307a60d87f17917f24 --- svl/source/fsstor/fsfactory.cxx | 6 ++--- svl/source/fsstor/fsstorage.cxx | 28 ++++++++++------------ svl/source/fsstor/fsstorage.hxx | 2 +- svl/source/inc/fsfactory.hxx | 9 +++---- svl/source/numbers/supservs.cxx | 6 ++--- svl/source/numbers/supservs.hxx | 4 ++-- svl/source/passwordcontainer/passwordcontainer.cxx | 4 ++-- 7 files changed, 28 insertions(+), 31 deletions(-) diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx index 06ca47b721a0..2379cf1858f3 100644 --- a/svl/source/fsstor/fsfactory.cxx +++ b/svl/source/fsstor/fsfactory.cxx @@ -55,7 +55,7 @@ OUString SAL_CALL FSStorageFactory::impl_staticGetImplementationName() uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::impl_staticCreateSelfInstance( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) { - return uno::Reference< uno::XInterface >( *new FSStorageFactory( xServiceManager ) ); + return uno::Reference< uno::XInterface >( *new FSStorageFactory( comphelper::getComponentContext(xServiceManager) ) ); } //------------------------------------------------------------------------- @@ -78,7 +78,7 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstance() static_cast< OWeakObject* >( new FSStorage( aResultContent, embed::ElementModes::READWRITE, - m_xFactory ) ), + m_xContext ) ), uno::UNO_QUERY ); } @@ -160,7 +160,7 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA return uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( new FSStorage( aResultContent, nStorageMode, - m_xFactory ) ), + m_xContext ) ), uno::UNO_QUERY ); } diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index 41bf495b4195..bb8c6c86c5a1 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -96,27 +96,27 @@ struct FSStorage_Impl ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners ::cppu::OTypeCollection* m_pTypeCollection; - uno::Reference< lang::XMultiServiceFactory > m_xFactory; + uno::Reference< uno::XComponentContext > m_xContext; - FSStorage_Impl( const OUString& aURL, sal_Int32 nMode, uno::Reference< lang::XMultiServiceFactory > xFactory ) + FSStorage_Impl( const OUString& aURL, sal_Int32 nMode, uno::Reference< uno::XComponentContext > xContext ) : m_aURL( aURL ) , m_pContent( NULL ) , m_nMode( nMode ) , m_pListenersContainer( NULL ) , m_pTypeCollection( NULL ) - , m_xFactory( xFactory ) + , m_xContext( xContext ) { OSL_ENSURE( !m_aURL.isEmpty(), "The URL must not be empty" ); } - FSStorage_Impl( const ::ucbhelper::Content& aContent, sal_Int32 nMode, uno::Reference< lang::XMultiServiceFactory > xFactory ) + FSStorage_Impl( const ::ucbhelper::Content& aContent, sal_Int32 nMode, uno::Reference< uno::XComponentContext > xContext ) : m_aURL( aContent.getURL() ) , m_pContent( new ::ucbhelper::Content( aContent ) ) , m_nMode( nMode ) , m_pListenersContainer( NULL ) , m_pTypeCollection( NULL ) - , m_xFactory( xFactory ) + , m_xContext( xContext ) { OSL_ENSURE( !m_aURL.isEmpty(), "The URL must not be empty" ); } @@ -143,11 +143,11 @@ FSStorage_Impl::~FSStorage_Impl() //----------------------------------------------- FSStorage::FSStorage( const ::ucbhelper::Content& aContent, sal_Int32 nMode, - uno::Reference< lang::XMultiServiceFactory > xFactory ) -: m_pImpl( new FSStorage_Impl( aContent, nMode, xFactory ) ) + uno::Reference< uno::XComponentContext > xContext ) +: m_pImpl( new FSStorage_Impl( aContent, nMode, xContext ) ) { // TODO: use properties - if ( !xFactory.is() ) + if ( !xContext.is() ) throw uno::RuntimeException(); GetContent(); @@ -473,8 +473,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement( if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) { uno::Reference xSimpleFileAccess( - ucb::SimpleFileAccess::create( - comphelper::getComponentContext(m_pImpl->m_xFactory) ) ); + ucb::SimpleFileAccess::create( m_pImpl->m_xContext ) ); xResult = xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ); } else @@ -620,7 +619,7 @@ uno::Reference< embed::XStorage > SAL_CALL FSStorage::openStorageElement( xResult = uno::Reference< embed::XStorage >( static_cast< OWeakObject* >( new FSStorage( aResultContent, nStorageMode, - m_pImpl->m_xFactory ) ), + m_pImpl->m_xContext ) ), uno::UNO_QUERY ); } catch( embed::InvalidStorageException& ) @@ -682,9 +681,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::cloneStreamElement( const OUSt ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() ); uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); - xTempResult = uno::Reference < io::XStream >( - io::TempFile::create(comphelper::getComponentContext(m_pImpl->m_xFactory)), - uno::UNO_QUERY_THROW ); + xTempResult = io::TempFile::create(m_pImpl->m_xContext); uno::Reference < io::XOutputStream > xTempOut = xTempResult->getOutputStream(); uno::Reference < io::XInputStream > xTempIn = xTempResult->getInputStream(); @@ -1463,8 +1460,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) { uno::Reference xSimpleFileAccess( - ucb::SimpleFileAccess::create( - comphelper::getComponentContext(m_pImpl->m_xFactory) ) ); + ucb::SimpleFileAccess::create( m_pImpl->m_xContext ) ); uno::Reference< io::XStream > xStream = xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ); diff --git a/svl/source/fsstor/fsstorage.hxx b/svl/source/fsstor/fsstorage.hxx index 71dcf676e5d6..ef4a1f681de0 100644 --- a/svl/source/fsstor/fsstorage.hxx +++ b/svl/source/fsstor/fsstorage.hxx @@ -51,7 +51,7 @@ public: FSStorage( const ::ucbhelper::Content& aContent, sal_Int32 nMode, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory ); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext ); virtual ~FSStorage(); diff --git a/svl/source/inc/fsfactory.hxx b/svl/source/inc/fsfactory.hxx index 2c08995f61ac..4e5294ad578f 100644 --- a/svl/source/inc/fsfactory.hxx +++ b/svl/source/inc/fsfactory.hxx @@ -22,18 +22,19 @@ #include #include +#include #include class FSStorageFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory, ::com::sun::star::lang::XServiceInfo > { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; public: - FSStorageFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) - : m_xFactory( xFactory ) + FSStorageFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) + : m_xContext( xContext ) { - OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" ); + OSL_ENSURE( xContext.is(), "No service manager is provided!\n" ); } static ::com::sun::star::uno::Sequence< OUString > SAL_CALL diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx index 1114d780ab93..8b4bb41a413a 100644 --- a/svl/source/numbers/supservs.cxx +++ b/svl/source/numbers/supservs.cxx @@ -39,11 +39,11 @@ using namespace ::utl; //------------------------------------------------------------------------- Reference< XInterface > SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory) { - return static_cast< ::cppu::OWeakObject* >(new SvNumberFormatsSupplierServiceObject(_rxFactory)); + return static_cast< ::cppu::OWeakObject* >(new SvNumberFormatsSupplierServiceObject( comphelper::getComponentContext(_rxFactory) )); } //------------------------------------------------------------------------- -SvNumberFormatsSupplierServiceObject::SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) +SvNumberFormatsSupplierServiceObject::SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) :m_pOwnFormatter(NULL) ,m_xORB(_rxORB) { @@ -111,7 +111,7 @@ void SAL_CALL SvNumberFormatsSupplierServiceObject::initialize( const Sequence< #endif } - m_pOwnFormatter = new SvNumberFormatter( comphelper::getComponentContext(m_xORB), eNewFormatterLanguage); + m_pOwnFormatter = new SvNumberFormatter( m_xORB, eNewFormatterLanguage); m_pOwnFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL ); SetNumberFormatter(m_pOwnFormatter); } diff --git a/svl/source/numbers/supservs.hxx b/svl/source/numbers/supservs.hxx index fe6dc2fb9b8c..a3c3b389f2e9 100644 --- a/svl/source/numbers/supservs.hxx +++ b/svl/source/numbers/supservs.hxx @@ -47,11 +47,11 @@ class SvNumberFormatsSupplierServiceObject protected: SvNumberFormatter* m_pOwnFormatter; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xORB; public: - SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB); ~SvNumberFormatsSupplierServiceObject(); // XInterface diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 590c1deed85b..8cf17ee186a8 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -444,7 +444,7 @@ PasswordContainer::~PasswordContainer() if( mComponent.is() ) { mComponent->removeEventListener(this); - mComponent = Reference< XComponent >(); + mComponent.clear(); } } @@ -463,7 +463,7 @@ void SAL_CALL PasswordContainer::disposing( const EventObject& ) throw(RuntimeEx if( mComponent.is() ) { //mComponent->removeEventListener(this); - mComponent = Reference< XComponent >(); + mComponent.clear(); } } -- cgit