From 1a60d388b566754d5fe6cee12adf7252a3206167 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 28 Apr 2020 13:56:58 +0200 Subject: comphelper,sfx2,dbaccess: add ODFVER_013_TEXT constant This is used for Version of package in API. Change-Id: I23d162c4dfff2f56c541a7c6c2e21c87ed7d8213 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93087 Tested-by: Jenkins Reviewed-by: Michael Stahl --- dbaccess/source/core/dataaccess/databasedocument.cxx | 8 +++++++- include/comphelper/documentconstants.hxx | 1 + sfx2/source/doc/objserv.cxx | 4 ++-- sfx2/source/doc/objstor.cxx | 11 +++++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index ac21fa4c809f..29d63ae81353 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -1662,8 +1662,14 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r aSaveOpt.GetODFSaneDefaultVersion(); // older versions can not have this property set, // it exists only starting from ODF1.2 - if (nDefVersion >= SvtSaveOptions::ODFSVER_012) + if (nDefVersion >= SvtSaveOptions::ODFSVER_013) + { + aVersion = ODFVER_013_TEXT; + } + else if (nDefVersion >= SvtSaveOptions::ODFSVER_012) + { aVersion = ODFVER_012_TEXT; + } if (!aVersion.isEmpty()) { diff --git a/include/comphelper/documentconstants.hxx b/include/comphelper/documentconstants.hxx index 3f7f166416e0..87d45852cd70 100644 --- a/include/comphelper/documentconstants.hxx +++ b/include/comphelper/documentconstants.hxx @@ -65,6 +65,7 @@ #define ODFVER_010_TEXT "1.0" #define ODFVER_011_TEXT "1.1" #define ODFVER_012_TEXT "1.2" +#define ODFVER_013_TEXT "1.3" // filter flags // TODO/LATER: The flags should be part of the UNO specification diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 8212bc25241a..e0b6bf5a4a39 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1621,7 +1621,7 @@ bool SfxObjectShell::PrepareForSigning(weld::Window* pDialogParent) OUString aODFVersion(comphelper::OStorageHelper::GetODFVersionFromStorage(GetStorage())); if ( IsModified() || !GetMedium() || GetMedium()->GetName().isEmpty() - || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion != ODFVER_012_TEXT && !bHasSign) ) + || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(ODFVER_012_TEXT) < 0 && !bHasSign)) { // the document might need saving ( new, modified or in ODF1.1 format without signature ) @@ -1803,7 +1803,7 @@ bool SfxObjectShell::SignDocumentContentUsingCertificate(const ReferenceGetName().isEmpty() - || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion != ODFVER_012_TEXT && !bHasSign)) + || (GetMedium()->GetFilter()->IsOwnFormat() && aODFVersion.compareTo(ODFVER_012_TEXT) < 0 && !bHasSign)) { if (nVersion >= SvtSaveOptions::ODFSVER_012) { diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index d86ace8bba4b..8e04639905ef 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -335,7 +335,14 @@ void SfxObjectShell::SetupStorage( const uno::Reference< embed::XStorage >& xSto try { // older versions can not have this property set, it exists only starting from ODF1.2 - xProps->setPropertyValue("Version", uno::makeAny( ODFVER_012_TEXT ) ); + if (SvtSaveOptions::ODFSVER_013 <= nDefVersion) + { + xProps->setPropertyValue("Version", uno::makeAny(ODFVER_013_TEXT)); + } + else + { + xProps->setPropertyValue("Version", uno::makeAny(ODFVER_012_TEXT)); + } } catch( uno::Exception& ) { @@ -1163,7 +1170,7 @@ bool SfxObjectShell::SaveTo_Impl // document, but technically this is not correct, so this prevents old // signatures to be copied over to a version 1.2 document bNoPreserveForOasis = ( - (aODFVersion == ODFVER_012_TEXT && nVersion < SvtSaveOptions::ODFSVER_012) || + (0 <= aODFVersion.compareTo(ODFVER_012_TEXT) && nVersion < SvtSaveOptions::ODFSVER_012) || (aODFVersion.isEmpty() && nVersion >= SvtSaveOptions::ODFSVER_012) ); } -- cgit v1.2.3