diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-01-12 23:01:34 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-02-02 14:20:23 +0100 |
commit | 9eb74ef80bf5b33e9dfc7725f73bc162612c9c14 (patch) | |
tree | 6a5a218b46a3ccc746e2302fe5d49409fa0d1445 | |
parent | 8b26c71571e92caedc16029ddb03fc39429328cf (diff) |
xmloff: there is no reason why office:version should be omitted
... if a document contains foreign elements or attributes.
In fact since ODF 1.2 the office:version attribute is mandatory and any
document that omits it is therefore invalid, while "extended conforming"
documents are allowed to contain foreign elements and attributes.
This mysterious check was there since CVS initial import, but without
any justification.
(cherry picked from commit d277ac87455a599fbf4acd3c6401f09bc74d3dac)
Change-Id: Ifeafad2b7af41f06356461adb7ae65dbf7bae11d
Reviewed-on: https://gerrit.libreoffice.org/21475
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 32a25a623347c038ec75c3c594d615419c4da7fc)
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 72cc29f77f20..7002fbe9919e 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1422,24 +1422,23 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) } // office:version = ... - if( !mbExtended ) + const sal_Char* pVersion = nullptr; + switch (getDefaultVersion()) { - const sal_Char* pVersion = 0; - 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 = sXML_1_1; break; - case SvtSaveOptions::ODFVER_010: break; + 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 = sXML_1_1; break; + case SvtSaveOptions::ODFVER_010: break; - default: - SAL_WARN("xmloff.core", "xmloff::SvXMLExport::exportDoc(), unexpected odf default version!"); - } + default: + SAL_WARN("xmloff.core", "xmloff::SvXMLExport::exportDoc(), unexpected odf default version!"); + } - if( pVersion ) - AddAttribute( XML_NAMESPACE_OFFICE, XML_VERSION, - OUString::createFromAscii(pVersion) ); + if (pVersion) + { + AddAttribute( XML_NAMESPACE_OFFICE, XML_VERSION, + OUString::createFromAscii(pVersion) ); } { |