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>

Change-Id: I616b6a0acaead9d767ae7d119e539b865f3a6774
Reviewed-on: https://gerrit.libreoffice.org/39863
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Luke Deller 2017-07-12 23:56:50 +10:00 committed by Miklos Vajna
parent ac3c24bec9
commit bff8cd3d52
4 changed files with 33 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View file

@ -807,5 +807,36 @@ DECLARE_ODFIMPORT_TEST(testI61225, "i61225.sxw")
calcLayout();
}
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: */

View file

@ -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 },