diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-04-28 15:02:08 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2021-01-07 16:32:53 +0100 |
commit | 0fcd5ab37df6df662f080e23978e383d54521091 (patch) | |
tree | 04b20c772fff7a61470113fb9d8fd05a45ea287f /xmloff | |
parent | cc7a06930e4b51f02f5a5728ef6d1f267e23edf8 (diff) |
xmloff: ODF export: produce office:version="1.3"
Change-Id: I422743c6eacf112046141e017d42d78165c36cf2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93089
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 34 | ||||
-rw-r--r-- | xmloff/source/meta/MetaExportComponent.cxx | 13 |
2 files changed, 21 insertions, 26 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 608c043f6117..19a3c4014d3b 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -106,8 +106,6 @@ using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::io; using namespace ::xmloff::token; -sal_Char const sXML_1_2[] = "1.2"; - #define XML_MODEL_SERVICE_WRITER "com.sun.star.text.TextDocument" #define XML_MODEL_SERVICE_CALC "com.sun.star.sheet.SpreadsheetDocument" #define XML_MODEL_SERVICE_DRAW "com.sun.star.drawing.DrawingDocument" @@ -1220,6 +1218,25 @@ void SvXMLExport::addChaffWhenEncryptedStorage() } } +auto SvXMLExport::GetODFVersionAttributeValue() const -> char const* +{ + char const* pVersion(nullptr); + switch (getSaneDefaultVersion()) + { + case SvtSaveOptions::ODFSVER_013_EXTENDED: [[fallthrough]]; + case SvtSaveOptions::ODFSVER_013: pVersion = "1.3"; break; + case SvtSaveOptions::ODFSVER_012_EXTENDED: [[fallthrough]]; + case SvtSaveOptions::ODFSVER_012_EXT_COMPAT: [[fallthrough]]; + case SvtSaveOptions::ODFSVER_012: pVersion = "1.2"; break; + case SvtSaveOptions::ODFSVER_011: pVersion = "1.1"; break; + case SvtSaveOptions::ODFSVER_010: break; + + default: + assert(!"xmloff::SvXMLExport::exportDoc(), unexpected odf default version!"); + } + return pVersion; +} + ErrCode SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) { bool bOwnGraphicResolver = false; @@ -1314,18 +1331,7 @@ ErrCode SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) } // office:version = ... - const sal_Char* pVersion = nullptr; - switch (getDefaultVersion()) - { - case SvtSaveOptions::ODFVER_LATEST: pVersion = sXML_1_2; break; - case SvtSaveOptions::ODFVER_012_EXT_COMPAT: pVersion = sXML_1_2; break; - case SvtSaveOptions::ODFVER_012: pVersion = sXML_1_2; break; - case SvtSaveOptions::ODFVER_011: pVersion = "1.1"; break; - case SvtSaveOptions::ODFVER_010: break; - - default: - SAL_WARN("xmloff.core", "xmloff::SvXMLExport::exportDoc(), unexpected odf default version!"); - } + const char*const pVersion = GetODFVersionAttributeValue(); if (pVersion) { diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx index eeb9a97882d7..61b6e9a85629 100644 --- a/xmloff/source/meta/MetaExportComponent.cxx +++ b/xmloff/source/meta/MetaExportComponent.cxx @@ -134,18 +134,7 @@ ErrCode XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) nPos = GetNamespaceMap().GetNextKey( nPos ); } - const sal_Char* pVersion = nullptr; - switch( getDefaultVersion() ) - { - case SvtSaveOptions::ODFVER_LATEST: pVersion = "1.2"; break; - case SvtSaveOptions::ODFVER_012_EXT_COMPAT: pVersion = "1.2"; break; - case SvtSaveOptions::ODFVER_012: pVersion = "1.2"; break; - case SvtSaveOptions::ODFVER_011: pVersion = "1.1"; break; - case SvtSaveOptions::ODFVER_010: break; - - default: - OSL_FAIL("xmloff::XMLMetaExportComponent::exportDoc(), unexpected odf default version!"); - } + const char*const pVersion = GetODFVersionAttributeValue(); if( pVersion ) AddAttribute( XML_NAMESPACE_OFFICE, XML_VERSION, |