diff options
Diffstat (limited to 'package/source/xstor/owriteablestream.cxx')
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 8d540a663098..4f3a912b8c0b 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -48,6 +48,7 @@ #include <comphelper/storagehelper.hxx> #include <comphelper/ofopxmlhelper.hxx> +#include "selfterminatefilestream.hxx" #include "owriteablestream.hxx" #include "oseekinstream.hxx" #include "mutexholder.hxx" @@ -850,6 +851,9 @@ void OWriteStream_Impl::Commit() if ( m_xCacheStream.is() ) { + if ( m_pAntiImpl ) + m_pAntiImpl->DeInit(); + uno::Reference< io::XInputStream > xInStream( m_xCacheStream->getInputStream(), uno::UNO_SET_THROW ); xNewPackageStream = uno::Reference< packages::XDataSinkEncrSupport >( @@ -861,23 +865,16 @@ void OWriteStream_Impl::Commit() m_xCacheStream = uno::Reference< io::XStream >(); m_xCacheSeek = uno::Reference< io::XSeekable >(); - if ( m_pAntiImpl ) - m_pAntiImpl->DeInit(); } else if ( m_aTempURL.getLength() ) { - uno::Reference < ucb::XSimpleFileAccess > xTempAccess( - GetServiceFactory()->createInstance ( - ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), - uno::UNO_QUERY ); - - if ( !xTempAccess.is() ) - throw uno::RuntimeException(); // TODO: + if ( m_pAntiImpl ) + m_pAntiImpl->DeInit(); uno::Reference< io::XInputStream > xInStream; try { - xInStream = xTempAccess->openFileRead( m_aTempURL ); + xInStream.set( static_cast< io::XInputStream* >( new OSelfTerminateFileStream( GetServiceFactory(), m_aTempURL ) ), uno::UNO_QUERY ); } catch( uno::Exception& ) { @@ -893,9 +890,6 @@ void OWriteStream_Impl::Commit() // TODO/NEW: Let the temporary file be removed after commit xNewPackageStream->setDataStream( xInStream ); m_aTempURL = ::rtl::OUString(); - - if ( m_pAntiImpl ) - m_pAntiImpl->DeInit(); } else // if ( m_bHasInsertedStreamOptimization ) { @@ -2627,6 +2621,8 @@ void SAL_CALL OWriteStream::dispose() m_xInStream = uno::Reference< io::XInputStream >(); } + m_xSeekable = uno::Reference< io::XSeekable >(); + m_pImpl->m_pAntiImpl = NULL; if ( !m_bInitOnDemand ) |