diff options
author | Dirk Völzke <dv@openoffice.org> | 2001-02-21 12:04:29 +0000 |
---|---|---|
committer | Dirk Völzke <dv@openoffice.org> | 2001-02-21 12:04:29 +0000 |
commit | 322c7db278680a518cb44077d026aa78c71f845e (patch) | |
tree | 63ec0f433e8bca9af7b2b4bc0b46cf783b937f1e /sfx2 | |
parent | 3cbbebeb00cfc487d55bc050e5b6e448c8e30e75 (diff) |
Save the version info in XML for 6.0 file format
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 32 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 20 |
2 files changed, 37 insertions, 15 deletions
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 4bb437f5d16a..c888e41b4512 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2,9 +2,9 @@ * * $RCSfile: docfile.cxx,v $ * - * $Revision: 1.41 $ + * $Revision: 1.42 $ * - * last change: $Author: mba $ $Date: 2001-02-19 11:51:14 $ + * last change: $Author: dv $ $Date: 2001-02-21 13:04:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -182,6 +182,8 @@ using namespace ::com::sun::star::ucb; #include "inimgr.hxx" // Backup Path #endif +#include "xmlversion.hxx" + #define MAX_REDIRECT 5 class SfxLockBytesHandler_Impl : public ::utl::UcbLockBytesHandler @@ -2320,6 +2322,14 @@ const SfxVersionTableDtor* SfxMedium::GetVersionList() pImp->pVersions = new SfxVersionTableDtor; pImp->pVersions->Read( *aStream ); } + else + { + SfxVersionTableDtor *pList = new SfxVersionTableDtor; + if ( SfxXMLVersList_Impl::ReadInfo( GetStorage(), pList ) ) + pImp->pVersions = pList; + else + delete pList; + } } return pImp->pVersions; @@ -2395,20 +2405,28 @@ sal_Bool SfxMedium::TransferVersionList_Impl( SfxMedium& rMedium ) return sal_False; } -sal_Bool SfxMedium::SaveVersionList_Impl() +sal_Bool SfxMedium::SaveVersionList_Impl( sal_Bool bUseXML ) { if ( GetStorage() ) { if ( !pImp->pVersions ) return sal_True; - SvStorageStreamRef aStream = - GetStorage()->OpenStream( DEFINE_CONST_UNICODE( "VersionList" ), SFX_STREAM_READWRITE ); - if ( aStream.Is() && aStream->GetError() == SVSTREAM_OK ) + if ( bUseXML ) { - pImp->pVersions->Write( *aStream ); + SfxXMLVersList_Impl::WriteInfo( aStorage, pImp->pVersions ); return sal_True; } + else + { + SvStorageStreamRef aStream = + GetStorage()->OpenStream( DEFINE_CONST_UNICODE( "VersionList" ), SFX_STREAM_READWRITE ); + if ( aStream.Is() && aStream->GetError() == SVSTREAM_OK ) + { + pImp->pVersions->Write( *aStream ); + return sal_True; + } + } } return sal_False; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 88fd945f8046..af9f3a9f5f7a 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2,9 +2,9 @@ * * $RCSfile: objstor.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: dv $ $Date: 2001-02-15 14:01:15 $ + * last change: $Author: dv $ $Date: 2001-02-21 13:00:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -157,6 +157,7 @@ #include "openflag.hxx" #include "helper.hxx" + #define S2BS(s) ByteString( s, RTL_TEXTENCODING_MS_1252 ) class DataTransferEventListener_Impl : public ::com::sun::star::io::XDataTransferEventListener , @@ -772,11 +773,12 @@ sal_Bool SfxObjectShell::SaveTo_Impl // Version in die Liste aufnehmen; diese mu\s vorher schon vom // "alten" Medium "ubertragen worden sein + sal_Bool bUseXML = SOFFICE_FILEFORMAT_60 <= pFilter->GetVersion(); rMedium.AddVersion_Impl( aInfo ); - rMedium.SaveVersionList_Impl(); + rMedium.SaveVersionList_Impl( bUseXML ); // Den Storage f"ur die Versionen "offnen - SvStorageRef xVersion = SOFFICE_FILEFORMAT_60 <= pFilter->GetVersion() ? + SvStorageRef xVersion = bUseXML ? aMedRef->OpenUCBStorage( DEFINE_CONST_UNICODE( "Versions" ) ) : aMedRef->OpenStorage( DEFINE_CONST_UNICODE( "Versions" ) ); @@ -790,7 +792,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl while( pInfo ) { const String& rName = pInfo->aName; - if ( xOldVersions->IsStream( rName ) ) + if ( xOldVersions->IsContained( rName ) ) xOldVersions->CopyTo( rName, xVersion, rName ); pInfo = pList->GetObject(n++); } @@ -844,11 +846,13 @@ sal_Bool SfxObjectShell::SaveTo_Impl } else if ( pImp->bIsSaving ) { - rMedium.SaveVersionList_Impl(); + sal_Bool bUseXML = SOFFICE_FILEFORMAT_60 <= pFilter->GetVersion(); + + rMedium.SaveVersionList_Impl( bUseXML ); const SfxVersionTableDtor *pList = rMedium.GetVersionList(); if ( pList && pList->Count() ) { - SvStorageRef xVersion = SOFFICE_FILEFORMAT_60 <= pFilter->GetVersion() ? + SvStorageRef xVersion = bUseXML ? aMedRef->OpenUCBStorage( DEFINE_CONST_UNICODE( "Versions" ) ) : aMedRef->OpenStorage( DEFINE_CONST_UNICODE( "Versions" ) ); SvStorageRef xOldVersions = GetStorage()->OpenStorage( DEFINE_CONST_UNICODE( "Versions" ), SFX_STREAM_READONLY | STREAM_NOCREATE ); @@ -859,7 +863,7 @@ sal_Bool SfxObjectShell::SaveTo_Impl while( pInfo ) { const String& rName = pInfo->aName; - if ( xOldVersions->IsStream( rName ) ) + if ( xOldVersions->IsContained( rName ) ) xOldVersions->CopyTo( rName, xVersion, rName ); pInfo = pList->GetObject(n++); } |