[ooo-build-commit] patches/dev300

Tor Lillqvist tml at kemper.freedesktop.org
Wed Oct 14 06:33:25 PDT 2009


 patches/dev300/webdav-locking.diff |  134 -------------------------------------
 1 file changed, 1 insertion(+), 133 deletions(-)

New commits:
commit 9c9d39b32b71d4d0f9eb8d3e40edead7df3ab187
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Wed Oct 14 16:29:43 2009 +0300

    Not really knowing what I am doing

diff --git a/patches/dev300/webdav-locking.diff b/patches/dev300/webdav-locking.diff
index af233d9..69f2e9f 100644
--- a/patches/dev300/webdav-locking.diff
+++ b/patches/dev300/webdav-locking.diff
@@ -71,7 +71,7 @@
  }
  
  //------------------------------------------------------------------
-@@ -749,10 +749,13 @@ sal_Bool SfxMedium::CloseOutStream_Impl(
+@@ -749,10 +749,13 @@
  }
  
  //------------------------------------------------------------------
@@ -87,15 +87,6 @@
  
      // return the name then
      return aName;
-@@ -796,8 +799,6 @@ sal_Bool SfxMedium::Commit()
-     if ( bResult && DocNeedsFileDateCheck() )
-         GetInitFileDate( sal_True );
- 
--    // remove truncation mode from the flags
--    nStorOpenMode &= (~STREAM_TRUNC);
-     return bResult;
- }
- 
 @@ -928,6 +929,26 @@
      return bPreview;
  }
@@ -132,129 +123,6 @@
          && ::utl::UCBContentHelper::IsDocument( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) );
  
      if ( bBasedOnOriginalFile && !pImp->m_aBackupURL.getLength()
-@@ -996,10 +1017,119 @@ uno::Reference < embed::XStorage > SfxMe
- 
-     DBG_ASSERT( !pOutStream, "OutStream in a readonly Medium?!" );
- 
--    // TODO/LATER: The current solution is to store the document temporary and then copy it to the target location;
--    // in future it should be stored directly and then copied to the temporary location, since in this case no
--    // file attributes have to be preserved and system copying mechanics could be used instead of streaming.
-+    // medium based on OutputStream: must work with TempFile
-+    if( aLogicName.CompareToAscii( "private:stream", 14 ) == COMPARE_EQUAL
-+	  || !::utl::LocalFileHelper::IsLocalFile( aLogicName ) )
-     CreateTempFileNoCopy();
-+	// if Medium already contains a stream - TODO/LATER: store stream/outputstream in ImplData, not in Medium
-+	else if ( GetItemSet()->GetItemState( SID_STREAM ) < SFX_ITEM_SET )
-+	{
-+		// check whether the backup should be created
-+		StorageBackup_Impl();
-+
-+		if ( GetError() )
-+			return uno::Reference< embed::XStorage >();
-+
-+        String aOutputURL;
-+        if ( aName.Len() )
-+        {
-+            if ( !::utl::LocalFileHelper::ConvertPhysicalNameToURL( aName, aOutputURL ) )
-+            {
-+                DBG_ERROR( "Physical name not convertible!" );
-+            }
-+        }
-+        else
-+        {
-+            aOutputURL = GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
-+        }
-+
-+        SFX_ITEMSET_ARG( GetItemSet(), pOverWrite, SfxBoolItem, SID_OVERWRITE, sal_False );
-+        SFX_ITEMSET_ARG( GetItemSet(), pRename, SfxBoolItem, SID_RENAME, sal_False );
-+        sal_Bool bRename = pRename ? pRename->GetValue() : FALSE;
-+        sal_Bool bOverWrite = pOverWrite ? pOverWrite->GetValue() : !bRename;
-+
-+        // the target file must be truncated before a storage based on it is created
-+        try
-+        {
-+            uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
-+            uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess(
-+                    xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ),
-+                    uno::UNO_QUERY_THROW );
-+
-+            uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
-+            ::ucbhelper::Content aContent = ::ucbhelper::Content( aOutputURL, xDummyEnv );
-+
-+            uno::Reference< io::XStream > xStream;
-+            sal_Bool bDeleteOnFailure = sal_False;
-+
-+            try
-+            {
-+                xStream = aContent.openWriteableStreamNoLock();
-+
-+                if ( !bOverWrite )
-+                {
-+                    // the stream should not exist, it should not be possible to open it
-+                    if ( xStream->getOutputStream().is() )
-+                        xStream->getOutputStream()->closeOutput();
-+                    if ( xStream->getInputStream().is() )
-+                        xStream->getInputStream()->closeInput();
-+
-+                    xStream = uno::Reference< io::XStream >();
-+                    SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
-+                }
-+            }
-+            catch ( ucb::InteractiveIOException const & e )
-+            {
-+                if ( e.Code == ucb::IOErrorCode_NOT_EXISTING )
-+                {
-+                    // Create file...
-+                    SvMemoryStream aStream(0,0);
-+                    uno::Reference< io::XInputStream > xInput( new ::utl::OInputStreamWrapper( aStream ) );
-+                    ucb::InsertCommandArgument aInsertArg;
-+                    aInsertArg.Data = xInput;
-+                    aInsertArg.ReplaceExisting = sal_False;
-+                    aContent.executeCommand( rtl::OUString::createFromAscii( "insert" ), uno::makeAny( aInsertArg ) );
-+
-+                    // Try to open one more time
-+                    xStream = aContent.openWriteableStreamNoLock();
-+                    bDeleteOnFailure = sal_True;
-+                }
-+                else
-+                    throw;
-+            }
-+
-+            if ( xStream.is() )
-+            {
-+                if ( !pImp->pTempFile && !( aLogicName.Len() && pImp->m_bSalvageMode )
-+                      && GetURLObject().GetMainURL( INetURLObject::NO_DECODE ).getLength()
-+                      && SupportsActiveStreaming( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
-+                      && ::utl::UCBContentHelper::IsDocument( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
-+                {
-+                    // the storage will be based on original file, the wrapper should be used
-+                    xStream = new OPostponedTruncationFileStream( aOutputURL, xFactory, xSimpleFileAccess, xStream, bDeleteOnFailure );
-+                }
-+                else
-+                {
-+                    // the storage will be based on the temporary file, the stream can be truncated directly
-+                    uno::Reference< io::XOutputStream > xOutStream = xStream->getOutputStream();
-+                    uno::Reference< io::XTruncate > xTruncate( xOutStream, uno::UNO_QUERY );
-+                    if ( !xTruncate.is() )
-+                        throw uno::RuntimeException();
-+
-+                    xTruncate->truncate();
-+                    xOutStream->flush();
-+                }
-+
-+                pImp->xStream = xStream;
-+                GetItemSet()->Put( SfxUsrAnyItem( SID_STREAM, makeAny( xStream ) ) );
-+            }
-+        }
-+        catch( uno::Exception& )
-+        {
-+            // TODO/LATER: try to use the temporary file in case the target content can not be opened, it might happen in case of some FS, the copy functionality might work in this case
-+            SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
-+        }
-+    }
- 
-     return GetStorage();
- }
 @@ -2210,7 +2326,7 @@ void SfxMedium::Transfer_Impl()
              xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler,
                                                        Reference< ::com::sun::star::ucb::XProgressHandler >() );


More information about the ooo-build-commit mailing list