From d4b20337f69340abd5cc9bc3e72c617876cc15d6 Mon Sep 17 00:00:00 2001 From: sj Date: Thu, 8 Jul 2010 16:46:28 +0200 Subject: impress194: #i112166# always removing tempfile (now removing file via osl_removeFile instead of ucb::content - delete) --- vcl/inc/vcl/gfxlink.hxx | 7 ++--- vcl/source/gdi/gfxlink.cxx | 59 ++++++--------------------------------- vcl/source/gdi/pdfwriter_impl.cxx | 1 + 3 files changed, 11 insertions(+), 56 deletions(-) diff --git a/vcl/inc/vcl/gfxlink.hxx b/vcl/inc/vcl/gfxlink.hxx index 3b3938ec848b..dced5a19c461 100644 --- a/vcl/inc/vcl/gfxlink.hxx +++ b/vcl/inc/vcl/gfxlink.hxx @@ -33,9 +33,6 @@ #include #include -//#if 0 // _SOLAR__PRIVATE -#include - // ------------- // - ImpBuffer - // ------------- @@ -62,7 +59,7 @@ struct ImpBuffer struct ImpSwap { - INetURLObject maURL; + rtl::OUString maURL; ULONG mnDataSize; ULONG mnRefCount; @@ -71,7 +68,7 @@ struct ImpSwap BYTE* GetData() const; - BOOL IsSwapped() const { return maURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() > 0; } + BOOL IsSwapped() const { return maURL.getLength() > 0; } void WriteTo( SvStream& rOStm ) const; }; diff --git a/vcl/source/gdi/gfxlink.cxx b/vcl/source/gdi/gfxlink.cxx index 4d32990f9335..60ad94a63273 100644 --- a/vcl/source/gdi/gfxlink.cxx +++ b/vcl/source/gdi/gfxlink.cxx @@ -28,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" +#include #include #include #include @@ -398,12 +399,10 @@ ImpSwap::ImpSwap( BYTE* pData, ULONG nDataSize ) : { ::utl::TempFile aTempFile; - maURL = INetURLObject(aTempFile.GetURL()); - - if( maURL.GetMainURL( INetURLObject::NO_DECODE ).getLength() ) + maURL = aTempFile.GetURL(); + if( maURL.getLength() ) { - SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( maURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); - + SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( maURL, STREAM_READWRITE | STREAM_SHARE_DENYWRITE ); if( pOStm ) { pOStm->Write( pData, mnDataSize ); @@ -412,28 +411,8 @@ ImpSwap::ImpSwap( BYTE* pData, ULONG nDataSize ) : if( bError ) { - try - { - ::ucbhelper::Content aCnt( maURL.GetMainURL( INetURLObject::NO_DECODE ), - ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), - ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); - } - catch( const ::com::sun::star::ucb::ContentCreationException& ) - { - } - catch( const ::com::sun::star::uno::RuntimeException& ) - { - } - catch( const ::com::sun::star::ucb::CommandAbortedException& ) - { - } - catch( const ::com::sun::star::uno::Exception& ) - { - } - - maURL = INetURLObject(); + osl_removeFile( maURL.pData ); + maURL = String(); } } } @@ -445,28 +424,7 @@ ImpSwap::ImpSwap( BYTE* pData, ULONG nDataSize ) : ImpSwap::~ImpSwap() { if( IsSwapped() ) - { - try - { - ::ucbhelper::Content aCnt( maURL.GetMainURL( INetURLObject::NO_DECODE ), - ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >() ); - - aCnt.executeCommand( ::rtl::OUString::createFromAscii( "delete" ), - ::com::sun::star::uno::makeAny( sal_Bool( sal_True ) ) ); - } - catch( const ::com::sun::star::ucb::ContentCreationException& ) - { - } - catch( const ::com::sun::star::uno::RuntimeException& ) - { - } - catch( const ::com::sun::star::ucb::CommandAbortedException& ) - { - } - catch( const ::com::sun::star::uno::Exception& ) - { - } - } + osl_removeFile( maURL.pData ); } // ------------------------------------------------------------------------ @@ -477,8 +435,7 @@ BYTE* ImpSwap::GetData() const if( IsSwapped() ) { - SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( maURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READWRITE ); - + SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( maURL, STREAM_READWRITE ); if( pIStm ) { pData = new BYTE[ mnDataSize ]; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6cb0a7d07697..7b7f3bbcb4d3 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include #include -- cgit v1.2.3