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()
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 );
}
......
......@@ -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<ucb::XSimpleFileAccess3> 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<ucb::XSimpleFileAccess3> 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 ) );
......
......@@ -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();
......
......@@ -22,18 +22,19 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase2.hxx>
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
......
......@@ -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);
}
......
......@@ -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
......
......@@ -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();
}
}
......
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