diff options
Diffstat (limited to 'package/source/zippackage/ZipPackageStream.cxx')
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index a8029ff9ec72..5c7feb7645ca 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/packages/zip/ZipConstants.hpp> #include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/packages/zip/ZipIOException.hpp> +#include <com/sun/star/io/TempFile.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XStream.hpp> @@ -37,6 +38,7 @@ #include <osl/diagnose.h> #include "wrapstreamforshare.hxx" +#include <comphelper/componentcontext.hxx> #include <comphelper/seekableinput.hxx> #include <comphelper/storagehelper.hxx> @@ -175,12 +177,10 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop // create temporary stream uno::Reference < io::XOutputStream > xTempOut( - m_xFactory->createInstance("com.sun.star.io.TempFile"), - uno::UNO_QUERY ); - uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY ); - uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY ); - if ( !xTempOut.is() || !xTempIn.is() || !xTempSeek.is() ) - throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() ); + io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()), + uno::UNO_QUERY_THROW ); + uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY_THROW ); + uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY_THROW ); // copy the raw stream to the temporary file starting from the current position ::comphelper::OStorageHelper::CopyInputToOutput( GetOwnSeekStream(), xTempOut ); @@ -282,10 +282,8 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( { // create temporary file uno::Reference < io::XStream > xTempStream( - m_xFactory->createInstance ("com.sun.star.io.TempFile"), - uno::UNO_QUERY ); - if ( !xTempStream.is() ) - throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() ); + io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()), + uno::UNO_QUERY_THROW ); // create a package based on it ZipPackage* pPackage = new ZipPackage( m_xFactory ); @@ -341,12 +339,10 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( // create another temporary file uno::Reference < io::XOutputStream > xTempOut( - m_xFactory->createInstance ("com.sun.star.io.TempFile"), - uno::UNO_QUERY ); - uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY ); - uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY ); - if ( !xTempOut.is() || !xTempIn.is() || !xTempSeek.is() ) - throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() ); + io::TempFile::create(comphelper::ComponentContext(m_xFactory).getUNOContext()), + uno::UNO_QUERY_THROW ); + uno::Reference < io::XInputStream > xTempIn( xTempOut, UNO_QUERY_THROW ); + uno::Reference < io::XSeekable > xTempSeek( xTempOut, UNO_QUERY_THROW ); // copy the raw stream to the temporary file ::comphelper::OStorageHelper::CopyInputToOutput( xInRaw, xTempOut ); |