summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-05-14 09:30:43 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-05-14 09:30:43 +0000
commit0f94cdc61d9a4876a82d351f857bc102b0ad0b79 (patch)
tree883563cdcf9ef606140fd3b76f11ec5742c33651 /sfx2
parent8b7274cf1e659a859864ce9a9d3191184fc33dd9 (diff)
INTEGRATION: CWS jl93 (1.205.30); FILE MERGED
2008/05/06 09:44:30 jl 1.205.30.5: #i86651# Removed warning because of a variable hiding the function parameter 2008/05/05 13:24:37 jl 1.205.30.4: RESYNC: (1.205-1.209); FILE MERGED 2008/05/02 18:45:56 mav 1.205.30.3: #i86651# the new handling of document signatures 2008/04/15 09:01:38 mav 1.205.30.2: #i86651# the Version property should not be stored for ODF1.1 and ODF1.0 2008/04/09 08:16:56 mav 1.205.30.1: #i86651# add Version property
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/objstor.cxx48
1 files changed, 47 insertions, 1 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index ead5214a30..943e89a091 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: objstor.cxx,v $
- * $Revision: 1.209 $
+ * $Revision: 1.210 $
*
* This file is part of OpenOffice.org.
*
@@ -370,6 +370,25 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto
{
// TODO/LATER: ErrorHandling
}
+
+ ::rtl::OUString aVersion;
+ SvtSaveOptions aSaveOpt;
+ SvtSaveOptions::ODFDefaultVersion nDefVersion = aSaveOpt.GetODFDefaultVersion();
+
+ // older versions can not have this property set, it exists only starting from ODF1.2
+ if ( nDefVersion == SvtSaveOptions::ODFVER_012 )
+ aVersion = ODFVER_012_TEXT;
+
+ if ( aVersion.getLength() )
+ {
+ try
+ {
+ xProps->setPropertyValue( ::rtl::OUString::createFromAscii( "Version" ), uno::makeAny( aVersion ) );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
}
}
}
@@ -1159,6 +1178,8 @@ sal_Bool SfxObjectShell::SaveTo_Impl
// the detection whether the script is changed should be done before saving
sal_Bool bTryToPreservScriptSignature = sal_False;
+ // no way to detect whether a filter is oasis format, have to wait for saving process
+ sal_Bool bNoPreserveForOasis = sal_False;
if ( bOwnSource && bOwnTarget
&& ( pImp->nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_OK
|| pImp->nScriptingSignatureState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED
@@ -1166,6 +1187,27 @@ sal_Bool SfxObjectShell::SaveTo_Impl
{
// the checking of the library modified state iterates over the libraries, should be done only when required
bTryToPreservScriptSignature = !pImp->pBasicManager->isAnyContainerModified();
+ if ( bTryToPreservScriptSignature )
+ {
+ // check that the storage format stays the same
+ SvtSaveOptions aSaveOpt;
+ SvtSaveOptions::ODFDefaultVersion nVersion = aSaveOpt.GetODFDefaultVersion();
+
+ ::rtl::OUString aODFVersion;
+ try
+ {
+ uno::Reference < beans::XPropertySet > xPropSet( GetStorage(), uno::UNO_QUERY_THROW );
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= aODFVersion;
+ }
+ catch( uno::Exception& )
+ {}
+
+ // preserve only if the same filter has been used
+ bTryToPreservScriptSignature = pMedium->GetFilter() && pFilter && pMedium->GetFilter()->GetFilterName() == pFilter->GetFilterName();
+
+ bNoPreserveForOasis = ( aODFVersion.equals( ODFVER_012_TEXT ) && nVersion == SvtSaveOptions::ODFVER_011
+ || !aODFVersion.getLength() && nVersion == SvtSaveOptions::ODFVER_012 );
+ }
}
sal_Bool bCopyTo = sal_False;
@@ -1509,6 +1551,10 @@ sal_Bool SfxObjectShell::SaveTo_Impl
bOk = SaveChildren( TRUE );
}
+ // if ODF version of oasis format changes on saving the signature should not be preserved
+ if ( bOk && bTryToPreservScriptSignature && bNoPreserveForOasis )
+ bTryToPreservScriptSignature = ( SotStorage::GetVersion( rMedium.GetStorage() ) == SOFFICE_FILEFORMAT_60 );
+
uno::Reference< security::XDocumentDigitalSignatures > xDDSigns;
sal_Bool bScriptSignatureIsCopied = sal_False;
if ( bOk && bTryToPreservScriptSignature )