From c5b7e99758553d8d4f1a149bcc3d0b2d5835d312 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 8 Dec 2017 13:47:11 +0100 Subject: tdf#71737 xmloff: ODF 1.2 doesn't allow hyperlinks in ... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... text:illustration-index-entry-template, so store these elements only in ODF 1.2 extended, and in loext namespace. Change-Id: Icf919e91114f5c9aed2adc3f5359b9df61eb3433 Reviewed-on: https://gerrit.libreoffice.org/46088 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit a26c4448e6e5ffcd285cc691bfc4eb6c7edf76bc) Reviewed-on: https://gerrit.libreoffice.org/46109 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- xmloff/source/text/XMLIndexTemplateContext.cxx | 2 +- xmloff/source/text/XMLSectionExport.cxx | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx b/xmloff/source/text/XMLIndexTemplateContext.cxx index 87295c1afd73..b538860afeeb 100644 --- a/xmloff/source/text/XMLIndexTemplateContext.cxx +++ b/xmloff/source/text/XMLIndexTemplateContext.cxx @@ -217,7 +217,7 @@ SvXMLImportContextRef XMLIndexTemplateContext::CreateChildContext( { SvXMLImportContext* pContext = nullptr; - if (XML_NAMESPACE_TEXT == nPrefix) + if (XML_NAMESPACE_TEXT == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix) { TemplateTokenType nToken; if (SvXMLUnitConverter::convertEnum(nToken, rLocalName, diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index 1eac782d0875..899cb51bc068 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -1256,6 +1256,7 @@ void XMLSectionExport::ExportIndexTemplateElement( // convert type to token (and check validity) ... XMLTokenEnum eElement(XML_TOKEN_INVALID); + sal_uInt16 nNamespace(XML_NAMESPACE_TEXT); switch(nTokenType) { case TOK_TTYPE_ENTRY_TEXT: @@ -1301,6 +1302,27 @@ void XMLSectionExport::ExportIndexTemplateElement( break; } + if (eType != TEXT_SECTION_TYPE_TOC) + { + switch (nTokenType) + { + case TOK_TTYPE_HYPERLINK_START: + case TOK_TTYPE_HYPERLINK_END: + if (SvtSaveOptions::ODFVER_012 < aODFVersion) + { + assert(eType == TEXT_SECTION_TYPE_ILLUSTRATION); + nNamespace = XML_NAMESPACE_LO_EXT; + } + else + { + eElement = XML_TOKEN_INVALID; // not allowed in ODF <= 1.2 + } + break; + default: + break; + } + } + //--->i90246 //check the ODF version being exported if( aODFVersion == SvtSaveOptions::ODFVER_011 @@ -1455,7 +1477,7 @@ void XMLSectionExport::ExportIndexTemplateElement( OUString::number(nLevel)); } // export template - SvXMLElementExport aTemplateElement(GetExport(), XML_NAMESPACE_TEXT, + SvXMLElementExport aTemplateElement(GetExport(), nNamespace, GetXMLToken(eElement), true, false) ; -- cgit