[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - xmloff/source

Michael Stahl mstahl at redhat.com
Wed Dec 13 08:27:22 UTC 2017


 xmloff/source/text/XMLIndexTemplateContext.cxx |    2 +-
 xmloff/source/text/XMLSectionExport.cxx        |   24 +++++++++++++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 934ae5cd6fc2c676429c14834b929707fec9faa1
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Dec 8 13:47:11 2017 +0100

    tdf#71737 xmloff: ODF 1.2 doesn't allow hyperlinks in ...
    
    ... 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 <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit a26c4448e6e5ffcd285cc691bfc4eb6c7edf76bc)
    Reviewed-on: https://gerrit.libreoffice.org/46109
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit c5b7e99758553d8d4f1a149bcc3d0b2d5835d312)
    Reviewed-on: https://gerrit.libreoffice.org/46219

diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx b/xmloff/source/text/XMLIndexTemplateContext.cxx
index 9487cd539571..e6f01fbc8b45 100644
--- a/xmloff/source/text/XMLIndexTemplateContext.cxx
+++ b/xmloff/source/text/XMLIndexTemplateContext.cxx
@@ -217,7 +217,7 @@ SvXMLImportContext *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 f276db392811..b42dd7562ef1 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)
             ;


More information about the Libreoffice-commits mailing list