sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt |binary
 sw/qa/extras/odfimport/data/tdf109080_style_ns.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx               |   31 +++++++++++++++++++++
 xmloff/source/text/txtimp.cxx                      |    2 +
 4 files changed, 33 insertions(+)

New commits:
commit 44293c426fdeefccf0bf59ccac8f46443793b99c
Author: Luke Deller <l...@deller.id.au>
Date:   Wed Jul 12 23:56:50 2017 +1000

    tdf#109080 First page header/footer ODF (1/2)
    
    The proposal to add <style:header-first> / <style:footer-first>
    to the ODF standard has not yet been accepted, so meanwhile we
    should be using an extension namespace for these elements.
    
    This first commit (intended for backport) adds support for reading
    <loext:header-first> / <loext:footer-first>
    
    (cherry picked from commit bff8cd3d52223002263dcb8c09758c4fc753b6e3)
    Reviewed-on: https://gerrit.libreoffice.org/40227
    Reviewed-by: Michael Stahl <mst...@redhat.com>
    Tested-by: Jenkins <c...@libreoffice.org>
    (cherry picked from commit c027764f94a1fc0a367e03b412d3c11d6c10769c)
    
    Conflicts:
            sw/qa/extras/odfimport/odfimport.cxx
    
    Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774

diff --git a/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt 
b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt
new file mode 100644
index 000000000000..ac7b3e272acc
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt 
differ
diff --git a/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt 
b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt
new file mode 100644
index 000000000000..ada290dc5fe1
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt 
differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 908d17d2fd13..8373486b41bf 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -646,5 +646,36 @@ DECLARE_ODFIMPORT_TEST(testTdf96113, "tdf96113.odt")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00ff00), 
getProperty<sal_Int32>(getShape(1), "BackColor"));
 }
 
+DECLARE_ODFIMPORT_TEST(testTdf109080_loext_ns, "tdf109080_loext_ns.odt")
+{
+    // Test we can import <loext:header-first> and <loext:footer-first>
+
+    CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"),
+        parseDump("/root/page[1]/header/txt/text()"));
+    CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"),
+        parseDump("/root/page[2]/header/txt/text()"));
+
+    CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"),
+        parseDump("/root/page[1]/footer/txt/text()"));
+    CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"),
+        parseDump("/root/page[2]/footer/txt/text()"));
+}
+
+DECLARE_ODFIMPORT_TEST(testTdf109080_style_ns, "tdf109080_style_ns.odt")
+{
+    // Test we can import <style:header-first> and <style:footer-first>
+    // (produced by LibreOffice 4.0 - 5.x)
+
+    CPPUNIT_ASSERT_EQUAL(OUString("This is the first page header"),
+        parseDump("/root/page[1]/header/txt/text()"));
+    CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page header"),
+        parseDump("/root/page[2]/header/txt/text()"));
+
+    CPPUNIT_ASSERT_EQUAL(OUString("This is the first page footer"),
+        parseDump("/root/page[1]/footer/txt/text()"));
+    CPPUNIT_ASSERT_EQUAL(OUString("This is the non-first-page footer"),
+        parseDump("/root/page[2]/footer/txt/text()"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 5b740f1b6717..f08161d4a167 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -409,6 +409,8 @@ static const SvXMLTokenMapEntry 
aTextMasterPageElemTokenMap[] =
     { XML_NAMESPACE_STYLE, XML_FOOTER, XML_TOK_TEXT_MP_FOOTER },
     { XML_NAMESPACE_STYLE, XML_HEADER_LEFT, XML_TOK_TEXT_MP_HEADER_LEFT },
     { XML_NAMESPACE_STYLE, XML_FOOTER_LEFT, XML_TOK_TEXT_MP_FOOTER_LEFT },
+    { XML_NAMESPACE_LO_EXT, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST },
+    { XML_NAMESPACE_LO_EXT, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST },
     { XML_NAMESPACE_STYLE, XML_HEADER_FIRST, XML_TOK_TEXT_MP_HEADER_FIRST },
     { XML_NAMESPACE_STYLE, XML_FOOTER_FIRST, XML_TOK_TEXT_MP_FOOTER_FIRST },
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to