summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Deller <luke@deller.id.au>2017-07-12 23:56:50 +1000
committerMichael Stahl <mstahl@redhat.com>2017-07-20 15:19:20 +0200
commit63274a5b0528e82faf7eed9cbc50badfdd1d3b55 (patch)
tree99ed079c4f6f888a35a8440905cd654d97e2a48a
parent14f9bb560cc1ebf588683bcf2297ab44cb8993eb (diff)
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) Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774 Reviewed-on: https://gerrit.libreoffice.org/40228 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/qa/extras/odfimport/data/tdf109080_loext_ns.odtbin0 -> 9217 bytes
-rw-r--r--sw/qa/extras/odfimport/data/tdf109080_style_ns.odtbin0 -> 9219 bytes
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx31
-rw-r--r--xmloff/source/text/txtimp.cxx2
4 files changed, 33 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/tdf109080_loext_ns.odt
Binary files 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
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/tdf109080_style_ns.odt
Binary files differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index c262f9cf72e9..8911e8067107 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -777,5 +777,36 @@ DECLARE_ODFIMPORT_TEST(testTdf100033_2, "tdf100033_2.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount());
}
+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 8029ddfd075b..4d1b1333d9d2 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -407,6 +407,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 },