summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-04-28 13:56:58 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-05-15 17:50:56 +0200
commit1a60d388b566754d5fe6cee12adf7252a3206167 (patch)
tree815d43b9c2d2f91b30a5729923f8b76cacf78173
parent23a1b7bad5147ee48d7f920085426d8846559af7 (diff)
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 <michael.stahl@cib.de>
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx8
-rw-r--r--include/comphelper/documentconstants.hxx1
-rw-r--r--sfx2/source/doc/objserv.cxx4
-rw-r--r--sfx2/source/doc/objstor.cxx11
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 Reference<XCertif
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))
{
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<OUString>( ODFVER_012_TEXT ) );
+ if (SvtSaveOptions::ODFSVER_013 <= nDefVersion)
+ {
+ xProps->setPropertyValue("Version", uno::makeAny<OUString>(ODFVER_013_TEXT));
+ }
+ else
+ {
+ xProps->setPropertyValue("Version", uno::makeAny<OUString>(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)
);
}