summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-31 17:08:44 +0200
committerNoel Grandin <noel@peralex.com>2013-02-11 08:02:17 +0200
commit834dcf3acde06389d57bec64c2cd6cca8189c079 (patch)
tree6c58716fa151198b9c96e17b8f0dd18ab4df4aaa /package
parent5bef4dc30c3dc70bc4d4b2cfbd2d1f729d714dfe (diff)
fdo#46808, Convert package module to XComponentContext
Change-Id: I1b322e57d27e16d177ffa87d3cd42a7d06f3dfab
Diffstat (limited to 'package')
-rw-r--r--package/inc/ZipPackage.hxx5
-rw-r--r--package/inc/ZipPackageFolder.hxx6
-rw-r--r--package/inc/ZipPackageStream.hxx7
-rw-r--r--package/source/manifest/ManifestReader.cxx8
-rw-r--r--package/source/manifest/ManifestReader.hxx9
-rw-r--r--package/source/manifest/ManifestWriter.cxx8
-rw-r--r--package/source/manifest/ManifestWriter.hxx9
-rw-r--r--package/source/xstor/owriteablestream.cxx48
-rw-r--r--package/source/xstor/owriteablestream.hxx6
-rw-r--r--package/source/xstor/selfterminatefilestream.cxx11
-rw-r--r--package/source/xstor/selfterminatefilestream.hxx2
-rw-r--r--package/source/xstor/switchpersistencestream.cxx22
-rw-r--r--package/source/xstor/switchpersistencestream.hxx6
-rw-r--r--package/source/xstor/xfactory.cxx12
-rw-r--r--package/source/xstor/xfactory.hxx8
-rw-r--r--package/source/xstor/xstorage.cxx87
-rw-r--r--package/source/xstor/xstorage.hxx15
-rw-r--r--package/source/zippackage/ZipPackage.cxx46
-rw-r--r--package/source/zippackage/ZipPackageFolder.cxx8
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx25
20 files changed, 161 insertions, 187 deletions
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index c22976ec3e19..7aeb32f159cd 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -44,6 +44,7 @@ namespace com { namespace sun { namespace star {
namespace container { class XNameContainer; }
namespace io { class XStream; class XOutputStream; class XInputStream; class XSeekable; class XActiveDataStreamer; }
namespace lang { class XMultiServiceFactory; }
+ namespace uno { class XComponentContext; }
namespace task { class XInteractionHandler; }
} } }
enum SegmentEnum
@@ -101,7 +102,7 @@ protected:
::com::sun::star::uno::Reference < com::sun::star::io::XStream > m_xStream;
::com::sun::star::uno::Reference < com::sun::star::io::XInputStream > m_xContentStream;
::com::sun::star::uno::Reference < com::sun::star::io::XSeekable > m_xContentSeek;
- const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ const ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
ZipPackageFolder *m_pRootFolder;
ZipFile *m_pZipFile;
@@ -122,7 +123,7 @@ protected:
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xTempStream );
public:
- ZipPackage( const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > &xNewFactory );
+ ZipPackage( const ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > &xContext );
virtual ~ZipPackage( void );
ZipFile& getZipFile() { return *m_pZipFile;}
sal_Int32 getFormat() const { return m_nFormat; }
diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx
index 92ad93554f6c..a99813c15b58 100644
--- a/package/inc/ZipPackageFolder.hxx
+++ b/package/inc/ZipPackageFolder.hxx
@@ -49,16 +49,14 @@ class ZipPackageFolder : public cppu::ImplInheritanceHelper2
::com::sun::star::container::XEnumerationAccess
>
{
-protected:
+private:
ContentHash maContents;
- const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
sal_Int32 m_nFormat;
::rtl::OUString m_sVersion;
public:
- ZipPackageFolder( const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xFactory,
- sal_Int32 nFormat,
+ ZipPackageFolder( sal_Int32 nFormat,
sal_Bool bAllowRemoveOnInsert );
virtual ~ZipPackageFolder();
diff --git a/package/inc/ZipPackageStream.hxx b/package/inc/ZipPackageStream.hxx
index a9943c19a7e0..70e8e13c03f8 100644
--- a/package/inc/ZipPackageStream.hxx
+++ b/package/inc/ZipPackageStream.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/packages/XDataSinkEncrSupport.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <ZipPackageEntry.hxx>
#include <rtl/ref.hxx>
#include <cppuhelper/implbase2.hxx>
@@ -45,9 +46,9 @@ class ZipPackageStream : public cppu::ImplInheritanceHelper2
::com::sun::star::packages::XDataSinkEncrSupport
>
{
-protected:
+private:
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
- const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ const ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
ZipPackage &rZipPackage;
sal_Bool bToBeCompressed, bToBeEncrypted, bHaveOwnKey, bIsEncrypted;
@@ -140,7 +141,7 @@ public:
void CloseOwnStreamIfAny();
ZipPackageStream ( ZipPackage & rNewPackage,
- const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& xContext,
sal_Bool bAllowRemoveOnInsert );
virtual ~ZipPackageStream( void );
diff --git a/package/source/manifest/ManifestReader.cxx b/package/source/manifest/ManifestReader.cxx
index 8631058aebbd..bba764a47147 100644
--- a/package/source/manifest/ManifestReader.cxx
+++ b/package/source/manifest/ManifestReader.cxx
@@ -39,8 +39,8 @@ using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::packages::manifest;
using ::rtl::OUString;
-ManifestReader::ManifestReader( const Reference < XMultiServiceFactory > & xNewFactory )
-: xFactory ( xNewFactory )
+ManifestReader::ManifestReader( const Reference < XComponentContext > & xContext )
+: m_xContext ( xContext )
{
}
ManifestReader::~ManifestReader()
@@ -50,7 +50,7 @@ Sequence< Sequence< PropertyValue > > SAL_CALL ManifestReader::readManifestSeque
throw (::com::sun::star::uno::RuntimeException)
{
Sequence < Sequence < PropertyValue > > aManifestSequence;
- Reference < XParser > xParser = Parser::create(comphelper::getComponentContext(xFactory));
+ Reference < XParser > xParser = Parser::create(m_xContext);
try
{
vector < Sequence < PropertyValue > > aManVector;
@@ -83,7 +83,7 @@ Sequence< Sequence< PropertyValue > > SAL_CALL ManifestReader::readManifestSeque
Reference < XInterface > SAL_CALL ManifestReader_createInstance( Reference< XMultiServiceFactory > const & rServiceFactory )
{
- return *new ManifestReader( rServiceFactory );
+ return *new ManifestReader( comphelper::getComponentContext(rServiceFactory) );
}
OUString ManifestReader::static_getImplementationName()
{
diff --git a/package/source/manifest/ManifestReader.hxx b/package/source/manifest/ManifestReader.hxx
index 702079156fb5..d422f9a7c29e 100644
--- a/package/source/manifest/ManifestReader.hxx
+++ b/package/source/manifest/ManifestReader.hxx
@@ -25,7 +25,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; class XSingleServiceFactory; }
+ namespace lang { class XSingleServiceFactory; }
+ namespace uno { class XComponentContext; }
} } }
class ManifestReader: public ::cppu::WeakImplHelper2
@@ -34,10 +35,10 @@ class ManifestReader: public ::cppu::WeakImplHelper2
::com::sun::star::lang::XServiceInfo
>
{
-protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory;
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
public:
- ManifestReader( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xNewFactory );
+ ManifestReader( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext );
virtual ~ManifestReader();
// XManifestReader
diff --git a/package/source/manifest/ManifestWriter.cxx b/package/source/manifest/ManifestWriter.cxx
index 72ea5aa91858..f6a0c0b65925 100644
--- a/package/source/manifest/ManifestWriter.cxx
+++ b/package/source/manifest/ManifestWriter.cxx
@@ -40,8 +40,8 @@ using namespace ::com::sun::star::packages;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::packages::manifest;
-ManifestWriter::ManifestWriter( const Reference < XMultiServiceFactory > & xNewFactory )
-: xFactory ( xNewFactory )
+ManifestWriter::ManifestWriter( const Reference < XComponentContext > & xContext )
+: m_xContext ( xContext )
{
}
ManifestWriter::~ManifestWriter()
@@ -52,7 +52,7 @@ ManifestWriter::~ManifestWriter()
void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStream >& rStream, const Sequence< Sequence< PropertyValue > >& rSequence )
throw (RuntimeException)
{
- Reference < XWriter > xSource = Writer::create( comphelper::getComponentContext(xFactory) );
+ Reference < XWriter > xSource = Writer::create( m_xContext );
xSource->setOutputStream ( rStream );
try {
Reference < XDocumentHandler > xHandler ( xSource, UNO_QUERY );
@@ -67,7 +67,7 @@ void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStr
// Component methods
Reference < XInterface > SAL_CALL ManifestWriter_createInstance( Reference< XMultiServiceFactory > const & rServiceFactory )
{
- return *new ManifestWriter( rServiceFactory );
+ return *new ManifestWriter( comphelper::getComponentContext(rServiceFactory) );
}
OUString ManifestWriter::static_getImplementationName()
diff --git a/package/source/manifest/ManifestWriter.hxx b/package/source/manifest/ManifestWriter.hxx
index 7c915319eb49..8453d928cfc6 100644
--- a/package/source/manifest/ManifestWriter.hxx
+++ b/package/source/manifest/ManifestWriter.hxx
@@ -25,7 +25,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; class XSingleServiceFactory; }
+ namespace lang { class XSingleServiceFactory; }
+ namespace uno { class XComponentContext; }
} } }
class ManifestWriter: public ::cppu::WeakImplHelper2
@@ -34,10 +35,10 @@ class ManifestWriter: public ::cppu::WeakImplHelper2
::com::sun::star::lang::XServiceInfo
>
{
-protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory;
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
public:
- ManifestWriter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xNewFactory );
+ ManifestWriter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext );
virtual ~ManifestWriter();
// XManifestWriter
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 73a7198bd89c..fc9a5f306385 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -229,12 +229,12 @@ sal_Bool KillFile( const ::rtl::OUString& aURL, const uno::Reference< uno::XComp
const sal_Int32 n_ConstBufferSize = 32000;
//-----------------------------------------------
-::rtl::OUString GetNewTempFileURL( const uno::Reference< lang::XMultiServiceFactory > xFactory )
+::rtl::OUString GetNewTempFileURL( const uno::Reference< uno::XComponentContext > xContext )
{
::rtl::OUString aTempURL;
uno::Reference < beans::XPropertySet > xTempFile(
- io::TempFile::create(comphelper::getComponentContext(xFactory)),
+ io::TempFile::create(xContext),
uno::UNO_QUERY_THROW );
try {
@@ -255,12 +255,11 @@ const sal_Int32 n_ConstBufferSize = 32000;
}
//-----------------------------------------------
-uno::Reference< io::XStream > CreateMemoryStream( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+uno::Reference< io::XStream > CreateMemoryStream( const uno::Reference< uno::XComponentContext >& xContext )
{
- if ( !xFactory.is() )
- throw uno::RuntimeException();
-
- return uno::Reference< io::XStream >( xFactory->createInstance ("com.sun.star.comp.MemoryStream"), uno::UNO_QUERY_THROW);
+ return uno::Reference< io::XStream >(
+ xContext->getServiceManager()->createInstanceWithContext("com.sun.star.comp.MemoryStream", xContext),
+ uno::UNO_QUERY_THROW);
}
} // anonymous namespace
@@ -270,7 +269,7 @@ uno::Reference< io::XStream > CreateMemoryStream( const uno::Reference< lang::XM
OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent,
const uno::Reference< packages::XDataSinkEncrSupport >& xPackageStream,
const uno::Reference< lang::XSingleServiceFactory >& xPackage,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference< uno::XComponentContext >& xContext,
sal_Bool bForceEncrypted,
sal_Int32 nStorageType,
sal_Bool bDefaultCompress,
@@ -279,7 +278,7 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent,
, m_bHasDataToFlush( sal_False )
, m_bFlushed( sal_False )
, m_xPackageStream( xPackageStream )
-, m_xFactory( xFactory )
+, m_xContext( xContext )
, m_pParent( pParent )
, m_bForceEncrypted( bForceEncrypted )
, m_bUseCommonEncryption( !bForceEncrypted && nStorageType == embed::StorageFormats::PACKAGE )
@@ -295,7 +294,7 @@ OWriteStream_Impl::OWriteStream_Impl( OStorage_Impl* pParent,
{
OSL_ENSURE( xPackageStream.is(), "No package stream is provided!\n" );
OSL_ENSURE( xPackage.is(), "No package component is provided!\n" );
- OSL_ENSURE( m_xFactory.is(), "No package stream is provided!\n" );
+ OSL_ENSURE( m_xContext.is(), "No package stream is provided!\n" );
OSL_ENSURE( pParent, "No parent storage is provided!\n" );
OSL_ENSURE( m_nStorageType == embed::StorageFormats::OFOPXML || !m_xOrigRelInfoStream.is(), "The Relations info makes sence only for OFOPXML format!\n" );
}
@@ -533,20 +532,11 @@ void OWriteStream_Impl::DisposeWrappers()
}
//-----------------------------------------------
-uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactory()
-{
- if ( m_xFactory.is() )
- return m_xFactory;
-
- return ::comphelper::getProcessServiceFactory();
-}
-
-//-----------------------------------------------
::rtl::OUString OWriteStream_Impl::GetFilledTempFileIfNo( const uno::Reference< io::XInputStream >& xStream )
{
if ( !m_aTempURL.getLength() )
{
- ::rtl::OUString aTempURL = GetNewTempFileURL( GetServiceFactory() );
+ ::rtl::OUString aTempURL = GetNewTempFileURL( m_xContext );
try {
if ( !aTempURL.isEmpty() && xStream.is() )
@@ -601,7 +591,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
if ( !xOrigStream.is() )
{
// in case of new inserted package stream it is possible that input stream still was not set
- uno::Reference< io::XStream > xCacheStream = CreateMemoryStream( GetServiceFactory() );
+ uno::Reference< io::XStream > xCacheStream = CreateMemoryStream( m_xContext );
OSL_ENSURE( xCacheStream.is(), "If the stream can not be created an exception must be thrown!\n" );
m_xCacheSeek.set( xCacheStream, uno::UNO_QUERY_THROW );
m_xCacheStream = xCacheStream;
@@ -616,7 +606,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
if ( nRead <= MAX_STORCACHE_SIZE )
{
- uno::Reference< io::XStream > xCacheStream = CreateMemoryStream( GetServiceFactory() );
+ uno::Reference< io::XStream > xCacheStream = CreateMemoryStream( m_xContext );
OSL_ENSURE( xCacheStream.is(), "If the stream can not be created an exception must be thrown!\n" );
if ( nRead )
@@ -630,7 +620,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
}
else if ( m_aTempURL.isEmpty() )
{
- m_aTempURL = GetNewTempFileURL( GetServiceFactory() );
+ m_aTempURL = GetNewTempFileURL( m_xContext );
try {
if ( !m_aTempURL.isEmpty() )
@@ -875,7 +865,7 @@ void OWriteStream_Impl::Commit()
uno::Reference< io::XInputStream > xInStream;
try
{
- xInStream.set( static_cast< io::XInputStream* >( new OSelfTerminateFileStream( GetServiceFactory(), m_aTempURL ) ), uno::UNO_QUERY );
+ xInStream.set( static_cast< io::XInputStream* >( new OSelfTerminateFileStream( m_xContext, m_aTempURL ) ), uno::UNO_QUERY );
}
catch( const uno::Exception& )
{
@@ -1077,7 +1067,7 @@ void OWriteStream_Impl::ReadRelInfoIfNecessary()
m_aOrigRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
m_xOrigRelInfoStream,
"_rels/*.rels",
- comphelper::getComponentContext(m_xFactory) );
+ m_xContext );
// in case of success the stream must be thrown away, that means that the OrigRelInfo is initialized
// the reason for this is that the original stream might not be seekable ( at the same time the new
@@ -1103,7 +1093,7 @@ void OWriteStream_Impl::ReadRelInfoIfNecessary()
m_aNewRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
m_xNewRelInfoStream,
"_rels/*.rels",
- comphelper::getComponentContext(m_xFactory) );
+ m_xContext );
m_nRelInfoStatus = RELINFO_CHANGED_STREAM_READ;
}
@@ -1411,7 +1401,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
if ( m_pParent )
m_pParent->m_bIsModified = sal_True;
- xStream = CreateMemoryStream( GetServiceFactory() );
+ xStream = CreateMemoryStream( m_xContext );
m_xCacheSeek.set( xStream, uno::UNO_QUERY_THROW );
m_xCacheStream = xStream;
}
@@ -1505,7 +1495,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io:
uno::Reference < io::XStream > xTempFile;
if ( !xTargetStream.is() )
xTempFile = uno::Reference < io::XStream >(
- io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
+ io::TempFile::create(m_xContext),
uno::UNO_QUERY );
else
xTempFile = xTargetStream;
@@ -1687,7 +1677,7 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora
if ( !xOutStream.is() )
throw uno::RuntimeException();
- ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aNewRelInfo, comphelper::getComponentContext(m_xFactory) );
+ ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aNewRelInfo, m_xContext );
// set the mediatype
uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW );
diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx
index a1bc7d14d7e2..896739a8c45e 100644
--- a/package/source/xstor/owriteablestream.hxx
+++ b/package/source/xstor/owriteablestream.hxx
@@ -113,7 +113,7 @@ struct OWriteStream_Impl : public PreCreationStruct
::com::sun::star::uno::Reference< ::com::sun::star::packages::XDataSinkEncrSupport > m_xPackageStream;
::com::sun::star::uno::Reference< ::com::sun::star::logging::XSimpleLogRing > m_xLogRing;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
OStorage_Impl* m_pParent;
@@ -145,8 +145,6 @@ struct OWriteStream_Impl : public PreCreationStruct
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceFactory();
-
::rtl::OUString GetFilledTempFileIfNo( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream );
::rtl::OUString FillTempGetFileName();
::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetTempFileAsStream();
@@ -167,7 +165,7 @@ public:
OStorage_Impl* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::packages::XDataSinkEncrSupport >& xPackageStream,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >& xPackage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
sal_Bool bForceEncrypted,
sal_Int32 nStorageType,
sal_Bool bDefaultCompress,
diff --git a/package/source/xstor/selfterminatefilestream.cxx b/package/source/xstor/selfterminatefilestream.cxx
index f47e95b5a6f1..7f3cb233bec1 100644
--- a/package/source/xstor/selfterminatefilestream.cxx
+++ b/package/source/xstor/selfterminatefilestream.cxx
@@ -26,18 +26,17 @@
using namespace ::com::sun::star;
//-----------------------------------------------
-OSelfTerminateFileStream::OSelfTerminateFileStream( const uno::Reference< lang::XMultiServiceFactory > xFactory, const ::rtl::OUString& aURL )
+OSelfTerminateFileStream::OSelfTerminateFileStream( const uno::Reference< uno::XComponentContext > xContext, const ::rtl::OUString& aURL )
: m_aURL( aURL )
{
- uno::Reference< lang::XMultiServiceFactory > xOwnFactory = xFactory;
- if ( !xOwnFactory.is() )
- xOwnFactory.set( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XComponentContext > xOwnContext = xContext;
+ if ( !xOwnContext.is() )
+ xOwnContext.set( ::comphelper::getProcessComponentContext(), uno::UNO_SET_THROW );
// IMPORTANT: The implementation is based on idea that m_xFileAccess, m_xInputStream and m_xSeekable are always set
// otherwise an exception is thrown in constructor
- m_xFileAccess.set( ucb::SimpleFileAccess::create(
- comphelper::getComponentContext(xOwnFactory) ) );
+ m_xFileAccess.set( ucb::SimpleFileAccess::create(xOwnContext) );
m_xInputStream.set( m_xFileAccess->openFileRead( aURL ), uno::UNO_SET_THROW );
m_xSeekable.set( m_xInputStream, uno::UNO_QUERY_THROW );
diff --git a/package/source/xstor/selfterminatefilestream.hxx b/package/source/xstor/selfterminatefilestream.hxx
index 85da3585b00f..ab4248bccff0 100644
--- a/package/source/xstor/selfterminatefilestream.hxx
+++ b/package/source/xstor/selfterminatefilestream.hxx
@@ -39,7 +39,7 @@ protected:
::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeekable;
public:
- OSelfTerminateFileStream( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory, const ::rtl::OUString& aURL );
+ OSelfTerminateFileStream( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const ::rtl::OUString& aURL );
virtual ~OSelfTerminateFileStream();
diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx
index 16581fa73ecf..b4700ddcfc4e 100644
--- a/package/source/xstor/switchpersistencestream.cxx
+++ b/package/source/xstor/switchpersistencestream.cxx
@@ -29,8 +29,6 @@ using namespace ::com::sun::star;
// ========================================================================
struct SPStreamData_Impl
{
- uno::Reference< lang::XMultiServiceFactory > m_xFactory;
-
sal_Bool m_bInStreamBased;
// the streams below are not visible from outside so there is no need to remember position
@@ -47,7 +45,6 @@ struct SPStreamData_Impl
SPStreamData_Impl(
- const uno::Reference< lang::XMultiServiceFactory >& xFactory,
sal_Bool bInStreamBased,
const uno::Reference< io::XStream >& xOrigStream,
const uno::Reference< io::XTruncate >& xOrigTruncate,
@@ -56,8 +53,7 @@ struct SPStreamData_Impl
const uno::Reference< io::XOutputStream >& xOrigOutStream,
sal_Bool bInOpen,
sal_Bool bOutOpen )
- : m_xFactory( xFactory )
- , m_bInStreamBased( bInStreamBased )
+ : m_bInStreamBased( bInStreamBased )
, m_xOrigStream( xOrigStream )
, m_xOrigTruncate( xOrigTruncate )
, m_xOrigSeekable( xOrigSeekable )
@@ -72,9 +68,9 @@ struct SPStreamData_Impl
// ========================================================================
// ------------------------------------------------------------------------
SwitchablePersistenceStream::SwitchablePersistenceStream(
- const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< io::XStream >& xStream )
-: m_xFactory( xFactory )
+: m_xContext( xContext )
, m_pStreamData( NULL )
{
SwitchPersistenceTo( xStream );
@@ -82,9 +78,9 @@ SwitchablePersistenceStream::SwitchablePersistenceStream(
// ------------------------------------------------------------------------
SwitchablePersistenceStream::SwitchablePersistenceStream(
- const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< io::XInputStream >& xInputStream )
-: m_xFactory( xFactory )
+: m_xContext( xContext )
, m_pStreamData( NULL )
{
SwitchPersistenceTo( xInputStream );
@@ -126,7 +122,7 @@ void SwitchablePersistenceStream::SwitchPersistenceTo( const uno::Reference< io:
CloseAll_Impl();
- m_pStreamData = new SPStreamData_Impl( m_xFactory, sal_False,
+ m_pStreamData = new SPStreamData_Impl( sal_False,
xStream, xNewTruncate, xNewSeekable, xNewInStream, xNewOutStream,
bInOpen, bOutOpen );
}
@@ -161,7 +157,7 @@ void SwitchablePersistenceStream::SwitchPersistenceTo( const uno::Reference< io:
CloseAll_Impl();
- m_pStreamData = new SPStreamData_Impl( m_xFactory, sal_True,
+ m_pStreamData = new SPStreamData_Impl( sal_True,
xNewStream, xNewTruncate, xNewSeekable, xInputStream, xNewOutStream,
bInOpen, bOutOpen );
@@ -176,7 +172,7 @@ void SwitchablePersistenceStream::CopyAndSwitchPersistenceTo( const uno::Referen
if ( !xTargetStream.is() )
{
xTargetStream = uno::Reference < io::XStream >(
- io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
+ io::TempFile::create(m_xContext),
uno::UNO_QUERY_THROW );
xTargetSeek = uno::Reference< io::XSeekable >( xTargetStream, uno::UNO_QUERY_THROW );
@@ -209,7 +205,7 @@ void SwitchablePersistenceStream::CopyAndSwitchPersistenceTo( const uno::Referen
CloseAll_Impl();
- m_pStreamData = new SPStreamData_Impl( m_xFactory, sal_False,
+ m_pStreamData = new SPStreamData_Impl( sal_False,
xTargetStream, xTargetTruncate, xTargetSeek, xTargetInStream, xTargetOutStream,
bInOpen, bOutOpen );
}
diff --git a/package/source/xstor/switchpersistencestream.hxx b/package/source/xstor/switchpersistencestream.hxx
index 92d5a1b4901d..82d591e33f4a 100644
--- a/package/source/xstor/switchpersistencestream.hxx
+++ b/package/source/xstor/switchpersistencestream.hxx
@@ -54,7 +54,7 @@ class SwitchablePersistenceStream
{
::osl::Mutex m_aMutex;
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
SPStreamData_Impl* m_pStreamData;
@@ -63,11 +63,11 @@ class SwitchablePersistenceStream
public:
SwitchablePersistenceStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream );
SwitchablePersistenceStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream );
~SwitchablePersistenceStream();
diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx
index c34155d031aa..29a17902a101 100644
--- a/package/source/xstor/xfactory.cxx
+++ b/package/source/xstor/xfactory.cxx
@@ -74,7 +74,7 @@ OUString SAL_CALL OStorageFactory::impl_staticGetImplementationName()
uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::impl_staticCreateSelfInstance(
const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
{
- return uno::Reference< uno::XInterface >( *new OStorageFactory( xServiceManager ) );
+ return uno::Reference< uno::XInterface >( *new OStorageFactory( comphelper::getComponentContext(xServiceManager) ) );
}
//-------------------------------------------------------------------------
@@ -84,14 +84,14 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstance()
{
// TODO: reimplement TempStream service to support XStream interface
uno::Reference < io::XStream > xTempStream(
- io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
+ io::TempFile::create(m_xContext),
uno::UNO_QUERY_THROW );
return uno::Reference< uno::XInterface >(
static_cast< OWeakObject* >( new OStorage( xTempStream,
embed::ElementModes::READWRITE,
uno::Sequence< beans::PropertyValue >(),
- m_xFactory,
+ m_xContext,
embed::StorageFormats::PACKAGE ) ),
uno::UNO_QUERY );
}
@@ -154,7 +154,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
uno::Reference < ucb::XSimpleFileAccess3 > xTempAccess(
ucb::SimpleFileAccess::create(
- comphelper::getComponentContext(m_xFactory) ) );
+ m_xContext ) );
if ( nStorageMode & embed::ElementModes::WRITE )
xStream = xTempAccess->openFileReadWrite( aURL );
@@ -253,7 +253,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
throw io::IOException(); // TODO: this is not a package file
return uno::Reference< uno::XInterface >(
- static_cast< OWeakObject* >( new OStorage( xInputStream, nStorageMode, aPropsToSet, m_xFactory, nStorageType ) ),
+ static_cast< OWeakObject* >( new OStorage( xInputStream, nStorageMode, aPropsToSet, m_xContext, nStorageType ) ),
uno::UNO_QUERY );
}
else if ( xStream.is() )
@@ -273,7 +273,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
throw io::IOException(); // TODO: this is not a package file
return uno::Reference< uno::XInterface >(
- static_cast< OWeakObject* >( new OStorage( xStream, nStorageMode, aPropsToSet, m_xFactory, nStorageType ) ),
+ static_cast< OWeakObject* >( new OStorage( xStream, nStorageMode, aPropsToSet, m_xContext, nStorageType ) ),
uno::UNO_QUERY );
}
diff --git a/package/source/xstor/xfactory.hxx b/package/source/xstor/xfactory.hxx
index 7d845b28d881..457c37bffa32 100644
--- a/package/source/xstor/xfactory.hxx
+++ b/package/source/xstor/xfactory.hxx
@@ -30,13 +30,13 @@
class OStorageFactory : 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:
- OStorageFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
- : m_xFactory( xFactory )
+ OStorageFactory( 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< ::rtl::OUString > SAL_CALL
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 8c98b87bab72..aa65875671d4 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -92,7 +92,7 @@ struct StorInternalData_Impl
};
//=========================================================
-::rtl::OUString GetNewTempFileURL( const uno::Reference< lang::XMultiServiceFactory > xFactory );
+::rtl::OUString GetNewTempFileURL( const uno::Reference< uno::XComponentContext > xContext );
// static
void OStorage_Impl::completeStorageStreamCopy_Impl(
@@ -142,12 +142,11 @@ void OStorage_Impl::completeStorageStreamCopy_Impl(
}
uno::Reference< io::XInputStream > GetSeekableTempCopy( uno::Reference< io::XInputStream > xInStream,
- uno::Reference< lang::XMultiServiceFactory > xFactory )
+ uno::Reference< uno::XComponentContext > xContext )
{
- uno::Reference < io::XOutputStream > xTempOut(
- io::TempFile::create(comphelper::getComponentContext(xFactory)),
- uno::UNO_QUERY );
- uno::Reference < io::XInputStream > xTempIn( xTempOut, uno::UNO_QUERY );
+ uno::Reference < io::XTempFile > xTempFile = io::TempFile::create(xContext);
+ uno::Reference < io::XOutputStream > xTempOut = xTempFile->getOutputStream();
+ uno::Reference < io::XInputStream > xTempIn = xTempFile->getInputStream();
if ( !xTempOut.is() || !xTempIn.is() )
throw io::IOException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
@@ -190,7 +189,7 @@ SotElement_Impl::~SotElement_Impl()
OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream,
sal_Int32 nMode,
uno::Sequence< beans::PropertyValue > xProperties,
- uno::Reference< lang::XMultiServiceFactory > xFactory,
+ uno::Reference< uno::XComponentContext > xContext,
sal_Int32 nStorageType )
: m_rMutexRef( new SotMutexHolder )
, m_pAntiImpl( NULL )
@@ -200,7 +199,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream,
, m_bCommited( sal_False )
, m_bIsRoot( sal_True )
, m_bListCreated( sal_False )
-, m_xFactory( xFactory )
+, m_xContext( xContext )
, m_xProperties( xProperties )
, m_bHasCommonEncryptionData( sal_False )
, m_pParent( NULL )
@@ -215,7 +214,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream,
// all the checks done below by assertion statements must be done by factory
OSL_ENSURE( xInputStream.is(), "No input stream is provided!\n" );
- m_pSwitchStream = (SwitchablePersistenceStream*) new SwitchablePersistenceStream( xFactory, xInputStream );
+ m_pSwitchStream = (SwitchablePersistenceStream*) new SwitchablePersistenceStream( xContext, xInputStream );
m_xInputStream = m_pSwitchStream->getInputStream();
if ( m_nStorageMode & embed::ElementModes::WRITE )
@@ -230,7 +229,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream,
OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream,
sal_Int32 nMode,
uno::Sequence< beans::PropertyValue > xProperties,
- uno::Reference< lang::XMultiServiceFactory > xFactory,
+ uno::Reference< uno::XComponentContext > xContext,
sal_Int32 nStorageType )
: m_rMutexRef( new SotMutexHolder )
, m_pAntiImpl( NULL )
@@ -240,7 +239,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream,
, m_bCommited( sal_False )
, m_bIsRoot( sal_True )
, m_bListCreated( sal_False )
-, m_xFactory( xFactory )
+, m_xContext( xContext )
, m_xProperties( xProperties )
, m_bHasCommonEncryptionData( sal_False )
, m_pParent( NULL )
@@ -257,12 +256,12 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream,
if ( m_nStorageMode & embed::ElementModes::WRITE )
{
- m_pSwitchStream = (SwitchablePersistenceStream*) new SwitchablePersistenceStream( xFactory, xStream );
+ m_pSwitchStream = (SwitchablePersistenceStream*) new SwitchablePersistenceStream( xContext, xStream );
m_xStream = static_cast< io::XStream* >( m_pSwitchStream );
}
else
{
- m_pSwitchStream = (SwitchablePersistenceStream*) new SwitchablePersistenceStream( xFactory,
+ m_pSwitchStream = (SwitchablePersistenceStream*) new SwitchablePersistenceStream( xContext,
xStream->getInputStream() );
m_xInputStream = m_pSwitchStream->getInputStream();
}
@@ -273,7 +272,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent,
sal_Int32 nMode,
uno::Reference< container::XNameContainer > xPackageFolder,
uno::Reference< lang::XSingleServiceFactory > xPackage,
- uno::Reference< lang::XMultiServiceFactory > xFactory,
+ uno::Reference< uno::XComponentContext > xContext,
sal_Int32 nStorageType )
: m_rMutexRef( new SotMutexHolder )
, m_pAntiImpl( NULL )
@@ -285,7 +284,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent,
, m_bListCreated( sal_False )
, m_xPackageFolder( xPackageFolder )
, m_xPackage( xPackage )
-, m_xFactory( xFactory )
+, m_xContext( xContext )
, m_bHasCommonEncryptionData( sal_False )
, m_pParent( pParent ) // can be empty in case of temporary readonly substorages and relation storage
, m_bControlMediaType( sal_False )
@@ -515,9 +514,8 @@ void OStorage_Impl::OpenOwnPackage()
}
m_xPackage = uno::Reference< lang::XSingleServiceFactory > (
- GetServiceFactory()->createInstanceWithArguments(
- "com.sun.star.packages.comp.ZipPackage",
- aArguments ),
+ GetComponentContext()->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.packages.comp.ZipPackage", aArguments, GetComponentContext()),
uno::UNO_QUERY );
}
@@ -537,12 +535,12 @@ void OStorage_Impl::OpenOwnPackage()
}
//-----------------------------------------------
-uno::Reference< lang::XMultiServiceFactory > OStorage_Impl::GetServiceFactory()
+uno::Reference< uno::XComponentContext > OStorage_Impl::GetComponentContext()
{
- if ( m_xFactory.is() )
- return m_xFactory;
+ if ( m_xContext.is() )
+ return m_xContext;
- return ::comphelper::getProcessServiceFactory();
+ return ::comphelper::getProcessComponentContext();
}
//-----------------------------------------------
@@ -594,7 +592,7 @@ void OStorage_Impl::ReadRelInfoIfNecessary()
m_aRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
xRelInfoStream,
"_rels/.rels",
- comphelper::getComponentContext(m_xFactory) );
+ m_xContext );
m_nRelInfoStatus = RELINFO_READ;
}
@@ -607,7 +605,7 @@ void OStorage_Impl::ReadRelInfoIfNecessary()
m_aRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
m_xNewRelInfoStream,
"_rels/.rels",
- comphelper::getComponentContext(m_xFactory) );
+ m_xContext );
m_nRelInfoStatus = RELINFO_CHANGED_STREAM_READ;
}
@@ -1024,7 +1022,7 @@ void OStorage_Impl::CopyLastCommitTo( const uno::Reference< embed::XStorage >& x
embed::ElementModes::READ,
m_xPackageFolder,
m_xPackage,
- m_xFactory,
+ m_xContext,
m_nStorageType);
// TODO/LATER: could use direct copying
@@ -1432,7 +1430,7 @@ SotElement_Impl* OStorage_Impl::InsertStream( ::rtl::OUString aName, sal_Bool bE
// the mode is not needed for storage stream internal implementation
SotElement_Impl* pNewElement = InsertElement( aName, sal_False );
- pNewElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, bEncr, m_nStorageType, sal_True );
+ pNewElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xContext, bEncr, m_nStorageType, sal_True );
m_aChildrenList.push_back( pNewElement );
m_bIsModified = sal_True;
@@ -1454,7 +1452,7 @@ SotElement_Impl* OStorage_Impl::InsertRawStream( ::rtl::OUString aName, const un
uno::Reference< io::XSeekable > xSeek( xInStream, uno::UNO_QUERY );
uno::Reference< io::XInputStream > xInStrToInsert = xSeek.is() ? xInStream :
- GetSeekableTempCopy( xInStream, GetServiceFactory() );
+ GetSeekableTempCopy( xInStream, GetComponentContext() );
uno::Sequence< uno::Any > aSeq( 1 );
aSeq[0] <<= sal_False;
@@ -1473,7 +1471,7 @@ SotElement_Impl* OStorage_Impl::InsertRawStream( ::rtl::OUString aName, const un
// the mode is not needed for storage stream internal implementation
SotElement_Impl* pNewElement = InsertElement( aName, sal_False );
- pNewElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, sal_True, m_nStorageType, sal_False );
+ pNewElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xContext, sal_True, m_nStorageType, sal_False );
// the stream is inserted and must be treated as a commited one
pNewElement->m_pStream->SetToBeCommited();
@@ -1505,7 +1503,7 @@ OStorage_Impl* OStorage_Impl::CreateNewStorageImpl( sal_Int32 nStorageMode )
throw uno::RuntimeException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
OStorage_Impl* pResult =
- new OStorage_Impl( this, nStorageMode, xPackageSubFolder, m_xPackage, m_xFactory, m_nStorageType );
+ new OStorage_Impl( this, nStorageMode, xPackageSubFolder, m_xPackage, m_xContext, m_nStorageType );
pResult->m_bIsModified = sal_True;
return pResult;
@@ -1586,7 +1584,7 @@ void OStorage_Impl::OpenSubStorage( SotElement_Impl* pElement, sal_Int32 nStorag
if ( !xPackageSubFolder.is() )
throw uno::RuntimeException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
- pElement->m_pStorage = new OStorage_Impl( this, nStorageMode, xPackageSubFolder, m_xPackage, m_xFactory, m_nStorageType );
+ pElement->m_pStorage = new OStorage_Impl( this, nStorageMode, xPackageSubFolder, m_xPackage, m_xContext, m_nStorageType );
}
}
@@ -1612,7 +1610,7 @@ void OStorage_Impl::OpenSubStream( SotElement_Impl* pElement )
throw uno::RuntimeException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
// the stream can never be inserted here, because inserted stream element holds the stream till commit or destruction
- pElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xFactory, sal_False, m_nStorageType, sal_False, GetRelInfoStreamForName( pElement->m_aOriginalName ) );
+ pElement->m_pStream = new OWriteStream_Impl( this, xPackageSubStream, m_xPackage, m_xContext, sal_False, m_nStorageType, sal_False, GetRelInfoStreamForName( pElement->m_aOriginalName ) );
}
}
@@ -1844,7 +1842,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain
if ( !xOutStream.is() )
throw uno::RuntimeException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
- ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aRelInfo, comphelper::getComponentContext(m_xFactory) );
+ ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence( xOutStream, m_aRelInfo, m_xContext );
// set the mediatype
uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW );
@@ -1924,9 +1922,9 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain
OStorage::OStorage( uno::Reference< io::XInputStream > xInputStream,
sal_Int32 nMode,
uno::Sequence< beans::PropertyValue > xProperties,
- uno::Reference< lang::XMultiServiceFactory > xFactory,
+ uno::Reference< uno::XComponentContext > xContext,
sal_Int32 nStorageType )
-: m_pImpl( new OStorage_Impl( xInputStream, nMode, xProperties, xFactory, nStorageType ) )
+: m_pImpl( new OStorage_Impl( xInputStream, nMode, xProperties, xContext, nStorageType ) )
{
m_pImpl->m_pAntiImpl = this;
m_pData = new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, sal_False );
@@ -1936,9 +1934,9 @@ OStorage::OStorage( uno::Reference< io::XInputStream > xInputStream,
OStorage::OStorage( uno::Reference< io::XStream > xStream,
sal_Int32 nMode,
uno::Sequence< beans::PropertyValue > xProperties,
- uno::Reference< lang::XMultiServiceFactory > xFactory,
+ uno::Reference< uno::XComponentContext > xContext,
sal_Int32 nStorageType )
-: m_pImpl( new OStorage_Impl( xStream, nMode, xProperties, xFactory, nStorageType ) )
+: m_pImpl( new OStorage_Impl( xStream, nMode, xProperties, xContext, nStorageType ) )
{
m_pImpl->m_pAntiImpl = this;
m_pData = new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, sal_False );
@@ -3797,10 +3795,9 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement(
if ( !xRawInStream.is() )
throw io::IOException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
- uno::Reference < io::XOutputStream > xTempOut(
- io::TempFile::create(comphelper::getComponentContext(m_pImpl->GetServiceFactory())),
- uno::UNO_QUERY );
- xTempIn = uno::Reference < io::XInputStream >( xTempOut, uno::UNO_QUERY );
+ uno::Reference < io::XTempFile > xTempFile = io::TempFile::create( m_pImpl->GetComponentContext() );
+ uno::Reference < io::XOutputStream > xTempOut = xTempFile->getOutputStream();
+ xTempIn = xTempFile->getInputStream();
uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY );
if ( !xTempOut.is() || !xTempIn.is() || !xSeek.is() )
@@ -3909,10 +3906,9 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement(
if ( !xRawInStream.is() )
throw io::IOException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
- uno::Reference < io::XOutputStream > xTempOut(
- io::TempFile::create(comphelper::getComponentContext(m_pImpl->GetServiceFactory())),
- uno::UNO_QUERY );
- xTempIn = uno::Reference < io::XInputStream >( xTempOut, uno::UNO_QUERY );
+ uno::Reference < io::XTempFile > xTempFile = io::TempFile::create(m_pImpl->GetComponentContext());
+ uno::Reference < io::XOutputStream > xTempOut = xTempFile->getOutputStream();
+ xTempIn = xTempFile->getInputStream();
uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY );
if ( !xTempOut.is() || !xTempIn.is() || !xSeek.is() )
@@ -5936,8 +5932,7 @@ void SAL_CALL OStorage::attachToURL( const ::rtl::OUString& sURL,
throw uno::RuntimeException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
uno::Reference < ucb::XSimpleFileAccess3 > xAccess(
- ucb::SimpleFileAccess::create(
- comphelper::getComponentContext(m_pImpl->m_xFactory) ) );
+ ucb::SimpleFileAccess::create( m_pImpl->m_xContext ) );
try
{
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index e1839daf1b39..83c997ca3544 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -39,7 +39,6 @@
#include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/packages/NoEncryptionException.hpp>
@@ -140,7 +139,7 @@ struct OStorage_Impl
::com::sun::star::uno::Reference< ::com::sun::star::logging::XSimpleLogRing > m_xLogRing;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > m_xPackage;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
// valid only for root storage
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; // ??? may be stored in properties
@@ -176,13 +175,13 @@ struct OStorage_Impl
OStorage_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
sal_Int32 nMode,
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
sal_Int32 nStorageType );
OStorage_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xStream,
sal_Int32 nMode,
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
sal_Int32 nStorageType );
// constructor for a substorage
@@ -190,7 +189,7 @@ struct OStorage_Impl
sal_Int32 nMode,
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xPackageFolder,
::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xPackage,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
sal_Int32 nStorageType );
~OStorage_Impl();
@@ -204,7 +203,7 @@ struct OStorage_Impl
void ReadContents();
void ReadRelInfoIfNecessary();
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceFactory();
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > GetComponentContext();
SotElementList_Impl& GetChildrenList();
void GetStorageProperties();
@@ -311,13 +310,13 @@ public:
OStorage( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
sal_Int32 nMode,
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
sal_Int32 nStorageType );
OStorage( ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xStream,
sal_Int32 nMode,
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
sal_Int32 nStorageType );
OStorage( OStorage_Impl* pImpl, sal_Bool bReadOnlyWrap );
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 89b3f2f4e8dc..da90248277ec 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -140,7 +140,7 @@ class DummyInputStream : public ::cppu::WeakImplHelper1< XInputStream >
//===========================================================================
-ZipPackage::ZipPackage ( const uno::Reference < XMultiServiceFactory > &xNewFactory )
+ZipPackage::ZipPackage ( const uno::Reference < XComponentContext > &xContext )
: m_aMutexHolder( new SotMutexHolder )
, m_nStartKeyGenerationID( xml::crypto::DigestID::SHA1 )
, m_nChecksumDigestID( xml::crypto::DigestID::SHA1_1K )
@@ -153,11 +153,11 @@ ZipPackage::ZipPackage ( const uno::Reference < XMultiServiceFactory > &xNewFact
, m_nFormat( embed::StorageFormats::PACKAGE ) // package is the default format
, m_bAllowRemoveOnInsert( sal_True )
, m_eMode ( e_IMode_None )
-, m_xFactory( xNewFactory )
+, m_xContext( xContext )
, m_pRootFolder( NULL )
, m_pZipFile( NULL )
{
- m_xRootFolder = m_pRootFolder = new ZipPackageFolder( m_xFactory, m_nFormat, m_bAllowRemoveOnInsert );
+ m_xRootFolder = m_pRootFolder = new ZipPackageFolder( m_nFormat, m_bAllowRemoveOnInsert );
}
ZipPackage::~ZipPackage( void )
@@ -176,7 +176,7 @@ sal_Bool ZipPackage::isLocalFile() const
OUString aSystemPath;
uno::Reference< XUniversalContentBroker > xUcb(
UniversalContentBroker::create(
- comphelper::getComponentContext( m_xFactory ) ) );
+ m_xContext ) );
try
{
aSystemPath = getSystemPathFromFileURL( xUcb, m_aURL );
@@ -211,7 +211,7 @@ void ZipPackage::parseManifest()
uno::Reference < XActiveDataSink > xSink ( xTunnel, UNO_QUERY );
if ( xSink.is() )
{
- uno::Reference < XManifestReader > xReader = ManifestReader::create( comphelper::getComponentContext( m_xFactory ) );
+ uno::Reference < XManifestReader > xReader = ManifestReader::create( m_xContext );
const OUString sPropFullPath ("FullPath");
const OUString sPropVersion ("Version");
@@ -458,7 +458,7 @@ void ZipPackage::parseContentType()
sal_Int32 nInd = 0;
// here aContentTypeInfo[0] - Defaults, and aContentTypeInfo[1] - Overrides
uno::Sequence< uno::Sequence< beans::StringPair > > aContentTypeInfo =
- ::comphelper::OFOPXMLHelper::ReadContentTypeSequence( xInStream, comphelper::getComponentContext(m_xFactory) );
+ ::comphelper::OFOPXMLHelper::ReadContentTypeSequence( xInStream, m_xContext );
if ( aContentTypeInfo.getLength() != 2 )
throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
@@ -545,7 +545,7 @@ void ZipPackage::getZipFileContents()
break;
if ( !pCurrent->hasByName( sTemp ) )
{
- pPkgFolder = new ZipPackageFolder( m_xFactory, m_nFormat, m_bAllowRemoveOnInsert );
+ pPkgFolder = new ZipPackageFolder( m_nFormat, m_bAllowRemoveOnInsert );
pPkgFolder->setName( sTemp );
pPkgFolder->doSetParent( pCurrent, sal_True );
pCurrent = pPkgFolder;
@@ -561,7 +561,7 @@ void ZipPackage::getZipFileContents()
{
nStreamIndex++;
sTemp = rName.copy( nStreamIndex, rName.getLength() - nStreamIndex );
- pPkgStream = new ZipPackageStream( *this, m_xFactory, m_bAllowRemoveOnInsert );
+ pPkgStream = new ZipPackageStream( *this, m_xContext, m_bAllowRemoveOnInsert );
pPkgStream->SetPackageMember( sal_True );
pPkgStream->setZipEntryOnLoading( rEntry );
pPkgStream->setName( sTemp );
@@ -629,7 +629,7 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
Content aContent(
m_aURL, uno::Reference< XCommandEnvironment >(),
- comphelper::getComponentContext( m_xFactory ) );
+ m_xContext );
Any aAny = aContent.getPropertyValue("Size");
sal_uInt64 aSize = 0;
// kind of optimisation: treat empty files as nonexistent files
@@ -729,7 +729,7 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
if ( m_xContentStream.is() )
{
// the stream must be seekable, if it is not it will be wrapped
- m_xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( m_xContentStream, comphelper::getComponentContext( m_xFactory ) );
+ m_xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( m_xContentStream, m_xContext );
m_xContentSeek = uno::Reference < XSeekable > ( m_xContentStream, UNO_QUERY );
if ( ! m_xContentSeek.is() )
throw com::sun::star::uno::Exception (OSL_LOG_PREFIX "The package component _requires_ an XSeekable interface!",
@@ -752,7 +752,7 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
{
try
{
- m_pZipFile = new ZipFile ( m_xContentStream, comphelper::getComponentContext(m_xFactory), sal_True, m_bForceRecovery, xProgressHandler );
+ m_pZipFile = new ZipFile ( m_xContentStream, m_xContext, sal_True, m_bForceRecovery, xProgressHandler );
getZipFileContents();
}
catch ( IOException & )
@@ -950,7 +950,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
uno::Reference< XInterface > SAL_CALL ZipPackage::createInstance()
throw( Exception, RuntimeException )
{
- uno::Reference < XInterface > xRef = *( new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert ) );
+ uno::Reference < XInterface > xRef = *( new ZipPackageStream ( *this, m_xContext, m_bAllowRemoveOnInsert ) );
return xRef;
}
//--------------------------------------------------------
@@ -962,9 +962,9 @@ uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( c
if ( aArguments.getLength() )
aArguments[0] >>= bArg;
if ( bArg )
- xRef = *new ZipPackageFolder ( m_xFactory, m_nFormat, m_bAllowRemoveOnInsert );
+ xRef = *new ZipPackageFolder ( m_nFormat, m_bAllowRemoveOnInsert );
else
- xRef = *new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert );
+ xRef = *new ZipPackageStream ( *this, m_xContext, m_bAllowRemoveOnInsert );
return xRef;
}
@@ -1011,7 +1011,7 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Sequence < PropertyValue > >& aManList )
{
// Write the manifest
- uno::Reference < XManifestWriter > xWriter = ManifestWriter::create( comphelper::getComponentContext(m_xFactory) );
+ uno::Reference < XManifestWriter > xWriter = ManifestWriter::create( m_xContext );
ZipEntry * pEntry = new ZipEntry;
ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
uno::Reference < XOutputStream > xManOutStream( *pBuffer, UNO_QUERY );
@@ -1085,7 +1085,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno:
aOverridesSequence.realloc( nSeqLength );
::comphelper::OFOPXMLHelper::WriteContentSequence(
- xConTypeOutStream, aDefaultsSequence, aOverridesSequence, comphelper::getComponentContext(m_xFactory) );
+ xConTypeOutStream, aDefaultsSequence, aOverridesSequence, m_xContext );
sal_Int32 nBufferLength = static_cast < sal_Int32 > ( pBuffer->getPosition() );
pBuffer->realloc( nBufferLength );
@@ -1107,7 +1107,7 @@ void ZipPackage::ConnectTo( const uno::Reference< io::XInputStream >& xInStream
if ( m_pZipFile )
m_pZipFile->setInputStream( m_xContentStream );
else
- m_pZipFile = new ZipFile ( m_xContentStream, comphelper::getComponentContext(m_xFactory), sal_False );
+ m_pZipFile = new ZipFile ( m_xContentStream, m_xContext, sal_False );
}
//--------------------------------------------------------
@@ -1150,13 +1150,13 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
if( bUseTemp )
{
// create temporary file
- uno::Reference < io::XStream > xTempFile( io::TempFile::create(comphelper::getComponentContext(m_xFactory)), UNO_QUERY_THROW );
+ uno::Reference < io::XTempFile > xTempFile( io::TempFile::create(m_xContext) );
xTempOut.set( xTempFile->getOutputStream(), UNO_SET_THROW );
xTempIn.set( xTempFile->getInputStream(), UNO_SET_THROW );
}
// Hand it to the ZipOutputStream:
- ZipOutputStream aZipOut( comphelper::getComponentContext(m_xFactory), xTempOut );
+ ZipOutputStream aZipOut( m_xContext, xTempOut );
aZipOut.setMethod( DEFLATED );
aZipOut.setLevel( DEFAULT_COMPRESSION );
@@ -1305,7 +1305,7 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
// open and truncate the original file
Content aOriginalContent(
m_aURL, uno::Reference< XCommandEnvironment >(),
- comphelper::getComponentContext( m_xFactory ) );
+ m_xContext );
uno::Reference< XActiveDataStreamer > xSink = new ActiveDataStreamer;
if ( m_eMode == e_IMode_URL )
@@ -1440,7 +1440,7 @@ void SAL_CALL ZipPackage::commitChanges()
{
// write directly in case of local file
uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 > xSimpleAccess(
- SimpleFileAccess::create( comphelper::getComponentContext(m_xFactory) ) );
+ SimpleFileAccess::create( m_xContext ) );
OSL_ENSURE( xSimpleAccess.is(), "Can't instatiate SimpleFileAccess service!\n" );
uno::Reference< io::XTruncate > xOrigTruncate;
if ( xSimpleAccess.is() )
@@ -1488,7 +1488,7 @@ void SAL_CALL ZipPackage::commitChanges()
OUString sTargetFolder = m_aURL.copy ( 0, m_aURL.lastIndexOf ( static_cast < sal_Unicode > ( '/' ) ) );
Content aContent(
sTargetFolder, uno::Reference< XCommandEnvironment >(),
- comphelper::getComponentContext( m_xFactory ) );
+ m_xContext );
OUString sTempURL;
Any aAny = xPropSet->getPropertyValue ("Uri");
@@ -1605,7 +1605,7 @@ Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges()
uno::Reference < XInterface >SAL_CALL ZipPackage_createInstance(
const uno::Reference< XMultiServiceFactory > & xMgr )
{
- return uno::Reference< XInterface >( *new ZipPackage( xMgr ) );
+ return uno::Reference< XInterface >( *new ZipPackage( comphelper::getComponentContext(xMgr) ) );
}
//--------------------------------------------------------
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index 31421585add4..2f9365556576 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -52,14 +52,10 @@ using namespace ::com::sun::star;
namespace { struct lcl_CachedImplId : public rtl::Static< uno::Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
-ZipPackageFolder::ZipPackageFolder ( const uno::Reference< XMultiServiceFactory >& xFactory,
- sal_Int32 nFormat,
+ZipPackageFolder::ZipPackageFolder ( sal_Int32 nFormat,
sal_Bool bAllowRemoveOnInsert )
-: m_xFactory( xFactory )
-, m_nFormat( nFormat )
+: m_nFormat( nFormat )
{
- OSL_ENSURE( m_xFactory.is(), "No factory is provided to the package folder!" );
-
this->mbAllowRemoveOnInsert = bAllowRemoveOnInsert;
SetFolder ( sal_True );
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 88afb2a3366a..0937e4a37d80 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -61,9 +61,9 @@ const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageStream::static_get
}
ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
- const uno::Reference< XMultiServiceFactory >& xFactory,
+ const uno::Reference< XComponentContext >& xContext,
sal_Bool bAllowRemoveOnInsert )
-: m_xFactory( xFactory )
+: m_xContext( xContext )
, rZipPackage( rNewPackage )
, bToBeCompressed ( sal_True )
, bToBeEncrypted ( sal_False )
@@ -81,7 +81,7 @@ ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
, m_bFromManifest( sal_False )
, m_bUseWinEncoding( false )
{
- OSL_ENSURE( m_xFactory.is(), "No factory is provided to ZipPackageStream!\n" );
+ OSL_ENSURE( m_xContext.is(), "No factory is provided to ZipPackageStream!\n" );
this->mbAllowRemoveOnInsert = bAllowRemoveOnInsert;
@@ -144,7 +144,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetOwnSeekStream()
// The only exception is a nonseekable stream that is provided only for storing, if such a stream
// is accessed before commit it MUST be wrapped.
// Wrap the stream in case it is not seekable
- xStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xStream, comphelper::getComponentContext( m_xFactory ) );
+ xStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xStream, m_xContext );
uno::Reference< io::XSeekable > xSeek( xStream, UNO_QUERY );
if ( !xSeek.is() )
throw RuntimeException( OSL_LOG_PREFIX "The stream must support XSeekable!",
@@ -176,10 +176,9 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop
getSalt().getLength() + getDigest().getLength() );
// create temporary stream
- uno::Reference < io::XOutputStream > xTempOut(
- io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
- uno::UNO_QUERY_THROW );
- uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY_THROW );
+ uno::Reference < io::XTempFile > xTempFile = io::TempFile::create(m_xContext);
+ uno::Reference < io::XOutputStream > xTempOut = xTempFile->getOutputStream();
+ uno::Reference < io::XInputStream > xTempIn = xTempFile->getInputStream();;
uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY_THROW );
// copy the raw stream to the temporary file starting from the current position
@@ -282,11 +281,11 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream(
{
// create temporary file
uno::Reference < io::XStream > xTempStream(
- io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
+ io::TempFile::create(m_xContext),
uno::UNO_QUERY_THROW );
// create a package based on it
- ZipPackage* pPackage = new ZipPackage( m_xFactory );
+ ZipPackage* pPackage = new ZipPackage( m_xContext );
uno::Reference< XSingleServiceFactory > xPackageAsFactory( static_cast< XSingleServiceFactory* >( pPackage ) );
if ( !xPackageAsFactory.is() )
throw RuntimeException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
@@ -339,7 +338,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream(
// create another temporary file
uno::Reference < io::XOutputStream > xTempOut(
- io::TempFile::create(comphelper::getComponentContext(m_xFactory)),
+ io::TempFile::create(m_xContext),
uno::UNO_QUERY_THROW );
uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY_THROW );
uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY_THROW );
@@ -564,7 +563,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
return xResult;
}
else if ( m_nStreamMode == PACKAGE_STREAM_RAW )
- return ZipFile::StaticGetDataFromRawStream( comphelper::getComponentContext(m_xFactory), GetOwnSeekStream(), GetEncryptionData() );
+ return ZipFile::StaticGetDataFromRawStream( m_xContext, GetOwnSeekStream(), GetEncryptionData() );
else if ( GetOwnSeekStream().is() )
{
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
@@ -625,7 +624,7 @@ void SAL_CALL ZipPackageStream::setRawStream( const uno::Reference< io::XInputSt
RuntimeException )
{
// wrap the stream in case it is not seekable
- uno::Reference< io::XInputStream > xNewStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( aStream, comphelper::getComponentContext( m_xFactory ) );
+ uno::Reference< io::XInputStream > xNewStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( aStream, m_xContext );
uno::Reference< io::XSeekable > xSeek( xNewStream, UNO_QUERY );
if ( !xSeek.is() )
throw RuntimeException(OSL_LOG_PREFIX "The stream must support XSeekable!",