Kaydet (Commit) 546fa9f3 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, Convert XMultiServiceFactory in svl module

Change-Id: Ia51d748af3b29a6021e6f5307a60d87f17917f24
üst 8c799984
...@@ -55,7 +55,7 @@ OUString SAL_CALL FSStorageFactory::impl_staticGetImplementationName() ...@@ -55,7 +55,7 @@ OUString SAL_CALL FSStorageFactory::impl_staticGetImplementationName()
uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::impl_staticCreateSelfInstance( uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::impl_staticCreateSelfInstance(
const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) 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() ...@@ -78,7 +78,7 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstance()
static_cast< OWeakObject* >( static_cast< OWeakObject* >(
new FSStorage( aResultContent, new FSStorage( aResultContent,
embed::ElementModes::READWRITE, embed::ElementModes::READWRITE,
m_xFactory ) ), m_xContext ) ),
uno::UNO_QUERY ); uno::UNO_QUERY );
} }
...@@ -160,7 +160,7 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA ...@@ -160,7 +160,7 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA
return uno::Reference< uno::XInterface >( return uno::Reference< uno::XInterface >(
static_cast< OWeakObject* >( new FSStorage( aResultContent, static_cast< OWeakObject* >( new FSStorage( aResultContent,
nStorageMode, nStorageMode,
m_xFactory ) ), m_xContext ) ),
uno::UNO_QUERY ); uno::UNO_QUERY );
} }
......
...@@ -96,27 +96,27 @@ struct FSStorage_Impl ...@@ -96,27 +96,27 @@ struct FSStorage_Impl
::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners
::cppu::OTypeCollection* m_pTypeCollection; ::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_aURL( aURL )
, m_pContent( NULL ) , m_pContent( NULL )
, m_nMode( nMode ) , m_nMode( nMode )
, m_pListenersContainer( NULL ) , m_pListenersContainer( NULL )
, m_pTypeCollection( NULL ) , m_pTypeCollection( NULL )
, m_xFactory( xFactory ) , m_xContext( xContext )
{ {
OSL_ENSURE( !m_aURL.isEmpty(), "The URL must not be empty" ); 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_aURL( aContent.getURL() )
, m_pContent( new ::ucbhelper::Content( aContent ) ) , m_pContent( new ::ucbhelper::Content( aContent ) )
, m_nMode( nMode ) , m_nMode( nMode )
, m_pListenersContainer( NULL ) , m_pListenersContainer( NULL )
, m_pTypeCollection( NULL ) , m_pTypeCollection( NULL )
, m_xFactory( xFactory ) , m_xContext( xContext )
{ {
OSL_ENSURE( !m_aURL.isEmpty(), "The URL must not be empty" ); OSL_ENSURE( !m_aURL.isEmpty(), "The URL must not be empty" );
} }
...@@ -143,11 +143,11 @@ FSStorage_Impl::~FSStorage_Impl() ...@@ -143,11 +143,11 @@ FSStorage_Impl::~FSStorage_Impl()
//----------------------------------------------- //-----------------------------------------------
FSStorage::FSStorage( const ::ucbhelper::Content& aContent, FSStorage::FSStorage( const ::ucbhelper::Content& aContent,
sal_Int32 nMode, sal_Int32 nMode,
uno::Reference< lang::XMultiServiceFactory > xFactory ) uno::Reference< uno::XComponentContext > xContext )
: m_pImpl( new FSStorage_Impl( aContent, nMode, xFactory ) ) : m_pImpl( new FSStorage_Impl( aContent, nMode, xContext ) )
{ {
// TODO: use properties // TODO: use properties
if ( !xFactory.is() ) if ( !xContext.is() )
throw uno::RuntimeException(); throw uno::RuntimeException();
GetContent(); GetContent();
...@@ -473,8 +473,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement( ...@@ -473,8 +473,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement(
if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
{ {
uno::Reference<ucb::XSimpleFileAccess3> xSimpleFileAccess( uno::Reference<ucb::XSimpleFileAccess3> xSimpleFileAccess(
ucb::SimpleFileAccess::create( ucb::SimpleFileAccess::create( m_pImpl->m_xContext ) );
comphelper::getComponentContext(m_pImpl->m_xFactory) ) );
xResult = xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ); xResult = xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) );
} }
else else
...@@ -620,7 +619,7 @@ uno::Reference< embed::XStorage > SAL_CALL FSStorage::openStorageElement( ...@@ -620,7 +619,7 @@ uno::Reference< embed::XStorage > SAL_CALL FSStorage::openStorageElement(
xResult = uno::Reference< embed::XStorage >( xResult = uno::Reference< embed::XStorage >(
static_cast< OWeakObject* >( new FSStorage( aResultContent, static_cast< OWeakObject* >( new FSStorage( aResultContent,
nStorageMode, nStorageMode,
m_pImpl->m_xFactory ) ), m_pImpl->m_xContext ) ),
uno::UNO_QUERY ); uno::UNO_QUERY );
} }
catch( embed::InvalidStorageException& ) catch( embed::InvalidStorageException& )
...@@ -682,9 +681,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::cloneStreamElement( const OUSt ...@@ -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() ); ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xTempResult = uno::Reference < io::XStream >( xTempResult = io::TempFile::create(m_pImpl->m_xContext);
io::TempFile::create(comphelper::getComponentContext(m_pImpl->m_xFactory)),
uno::UNO_QUERY_THROW );
uno::Reference < io::XOutputStream > xTempOut = xTempResult->getOutputStream(); uno::Reference < io::XOutputStream > xTempOut = xTempResult->getOutputStream();
uno::Reference < io::XInputStream > xTempIn = xTempResult->getInputStream(); uno::Reference < io::XInputStream > xTempIn = xTempResult->getInputStream();
...@@ -1463,8 +1460,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl ...@@ -1463,8 +1460,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) ) if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
{ {
uno::Reference<ucb::XSimpleFileAccess3> xSimpleFileAccess( uno::Reference<ucb::XSimpleFileAccess3> xSimpleFileAccess(
ucb::SimpleFileAccess::create( ucb::SimpleFileAccess::create( m_pImpl->m_xContext ) );
comphelper::getComponentContext(m_pImpl->m_xFactory) ) );
uno::Reference< io::XStream > xStream = uno::Reference< io::XStream > xStream =
xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ); xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) );
......
...@@ -51,7 +51,7 @@ public: ...@@ -51,7 +51,7 @@ public:
FSStorage( const ::ucbhelper::Content& aContent, FSStorage( const ::ucbhelper::Content& aContent,
sal_Int32 nMode, 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(); virtual ~FSStorage();
......
...@@ -22,18 +22,19 @@ ...@@ -22,18 +22,19 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase2.hxx>
class FSStorageFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory, class FSStorageFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory,
::com::sun::star::lang::XServiceInfo > ::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: public:
FSStorageFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ) FSStorageFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext )
: m_xFactory( xFactory ) : 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 static ::com::sun::star::uno::Sequence< OUString > SAL_CALL
......
...@@ -39,11 +39,11 @@ using namespace ::utl; ...@@ -39,11 +39,11 @@ using namespace ::utl;
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
Reference< XInterface > SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory) 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_pOwnFormatter(NULL)
,m_xORB(_rxORB) ,m_xORB(_rxORB)
{ {
...@@ -111,7 +111,7 @@ void SAL_CALL SvNumberFormatsSupplierServiceObject::initialize( const Sequence< ...@@ -111,7 +111,7 @@ void SAL_CALL SvNumberFormatsSupplierServiceObject::initialize( const Sequence<
#endif #endif
} }
m_pOwnFormatter = new SvNumberFormatter( comphelper::getComponentContext(m_xORB), eNewFormatterLanguage); m_pOwnFormatter = new SvNumberFormatter( m_xORB, eNewFormatterLanguage);
m_pOwnFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL ); m_pOwnFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL );
SetNumberFormatter(m_pOwnFormatter); SetNumberFormatter(m_pOwnFormatter);
} }
......
...@@ -47,11 +47,11 @@ class SvNumberFormatsSupplierServiceObject ...@@ -47,11 +47,11 @@ class SvNumberFormatsSupplierServiceObject
protected: protected:
SvNumberFormatter* m_pOwnFormatter; 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; m_xORB;
public: 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(); ~SvNumberFormatsSupplierServiceObject();
// XInterface // XInterface
......
...@@ -444,7 +444,7 @@ PasswordContainer::~PasswordContainer() ...@@ -444,7 +444,7 @@ PasswordContainer::~PasswordContainer()
if( mComponent.is() ) if( mComponent.is() )
{ {
mComponent->removeEventListener(this); mComponent->removeEventListener(this);
mComponent = Reference< XComponent >(); mComponent.clear();
} }
} }
...@@ -463,7 +463,7 @@ void SAL_CALL PasswordContainer::disposing( const EventObject& ) throw(RuntimeEx ...@@ -463,7 +463,7 @@ void SAL_CALL PasswordContainer::disposing( const EventObject& ) throw(RuntimeEx
if( mComponent.is() ) if( mComponent.is() )
{ {
//mComponent->removeEventListener(this); //mComponent->removeEventListener(this);
mComponent = Reference< XComponent >(); mComponent.clear();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment