summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-12-14 11:14:52 +0000
committerOliver Bolte <obo@openoffice.org>2009-12-14 11:14:52 +0000
commit59c70a59d7a0ad11c00554d00a9c2ec57489b8b0 (patch)
tree7b041a28a50cc92fa194bbbd46c82096fdd73427
parentdcd868172cb0b527415537dc8c8960c1f46ad1a5 (diff)
CWS-TOOLING: integrate CWS fwk132
2009-12-12 22:36:36 +0100 mav r277797 : #i107638# in some case no transfer is expected 2009-12-12 20:38:55 +0100 jsk r277796 : fwk132: <no issue> Found coding error, corrected 2009-12-12 02:22:18 +0100 mav r277795 : #i104974# workaround linux smb-client problem, be ready for errors while using mmap 2009-12-12 01:46:25 +0100 mav r277794 : #i104974# workaround impossibility to copy opened file
-rw-r--r--sfx2/source/doc/docfile.cxx27
-rw-r--r--sfx2/source/doc/objstor.cxx14
2 files changed, 32 insertions, 9 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 5b1e220a02..5ac85abdc8 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3436,13 +3436,14 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
if ( !( nStorOpenMode & STREAM_TRUNC ) )
{
+ sal_Bool bTransferSuccess = sal_False;
+
if ( GetContent().is()
&& ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
&& ::utl::UCBContentHelper::IsDocument( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
{
// if there is already such a document, we should copy it
// if it is a file system use OS copy process
- sal_Bool bTransferSuccess = sal_False;
try
{
uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > xComEnv;
@@ -3463,16 +3464,14 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
catch( uno::Exception& )
{}
- if ( !bTransferSuccess )
+ if ( bTransferSuccess )
{
- SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
- return;
+ CloseOutStream();
+ CloseInStream();
}
-
- CloseOutStream();
- CloseInStream();
}
- else if ( pInStream )
+
+ if ( !bTransferSuccess && pInStream )
{
// the case when there is no URL-access available or this is a remote protocoll
// but there is an input stream
@@ -3492,13 +3491,25 @@ void SfxMedium::CreateTempFile( sal_Bool bReplace )
pOutStream->Write( pBuf, nRead );
}
+ bTransferSuccess = sal_True;
delete[] pBuf;
CloseInStream();
}
CloseOutStream_Impl();
}
else
+ {
+ // Quite strange design, but currently it is expected that in this case no transfer happens
+ // TODO/LATER: get rid of this inconsistent part of the call design
+ bTransferSuccess = sal_True;
CloseInStream();
+ }
+
+ if ( !bTransferSuccess )
+ {
+ SetError( ERRCODE_IO_CANTWRITE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ return;
+ }
}
CloseStorage();
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index e1a8c626b2..972ac57ce6 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -1872,7 +1872,19 @@ sal_Bool SfxObjectShell::DisconnectStorage_Impl( SfxMedium& rSrcMedium, SfxMediu
{
uno::Reference< embed::XOptimizedStorage > xOptStorage( xStorage, uno::UNO_QUERY_THROW );
::rtl::OUString aBackupURL = rTargetMedium.GetBackup_Impl();
- if ( aBackupURL.getLength() )
+ if ( !aBackupURL.getLength() )
+ {
+ // the backup could not be created, try to disconnect the storage and close the source SfxMedium
+ // in this case the optimization is not possible, connect storage to a temporary file
+ rTargetMedium.ResetError();
+ xOptStorage->writeAndAttachToStream( uno::Reference< io::XStream >() );
+ rSrcMedium.CanDisposeStorage_Impl( sal_False );
+ rSrcMedium.Close();
+
+ // now try to create the backup
+ rTargetMedium.GetBackup_Impl();
+ }
+ else
{
// the following call will only compare stream sizes
// TODO/LATER: this is a very risky part, since if the URL contents are different from the storage