summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-02-19 22:37:58 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-02-21 21:32:59 +0100
commit055aae14063773bdac9ea43b3207f1d7d6ca6b4c (patch)
treed7e6f555caca7942f62041d1e989f95cd1db17bc /sw
parent292e9861adba78303eb43bbb84fae57f2bb5d15b (diff)
tdf#112694 DOCX import: handle <w:titlePg> when turning on follow style header
Commit 17e51f427b3f0cec74ac8e0a1b3f51189006ae6f (DOCX import: first page header should always set default headers as well, 2014-11-21) turned on header/footer of follow page styles of first page styles when the first page style had the header/footer turned on, but failed to consider if <w:titlePg> is present or not. When it's not present, the first page header/footer should be ignored. An additional problem is that by the time DomainMapper_Impl::PushPageHeaderFooter() is called, <w:titlePg> is not parsed yet, so we can't act accordingly. Fix the problem by moving the check to SectionPropertyMap::PrepareHeaderFooterProperties(), which runs at the end of the section properties, where all required info is available, there we can just check for m_bTitlePage. This allows reverting the two changes to existing testcases in CppunitTest_sw_ooxmlexport6 from the original commit as a side-effect. (cherry picked from commit a16275a3647a2fba9913ed23e8329e45b02123b4) Change-Id: Ic628adab99a4b148fcfd66ca39d0cf81eb7dd9f1 Reviewed-on: https://gerrit.libreoffice.org/50027 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf112694.docxbin0 -> 14741 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx8
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport6.cxx4
3 files changed, 10 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf112694.docx b/sw/qa/extras/ooxmlexport/data/tdf112694.docx
new file mode 100644
index 000000000000..f629a388e3cb
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf112694.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 91697a80f920..0fd64733e700 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -73,6 +73,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82065_Ind_start_strict, "tdf82065_Ind_start_stri
CPPUNIT_ASSERT_EQUAL_MESSAGE("IndentAt defined", true, bFoundIndentAt);
}
+DECLARE_OOXMLEXPORT_TEST(testTdf112694, "tdf112694.docx")
+{
+ uno::Any aPageStyle = getStyles("PageStyles")->getByName("Standard");
+ // Header was on when header for file was for explicit first pages only
+ // (marked via <w:titlePg>).
+ CPPUNIT_ASSERT(!getProperty<bool>(aPageStyle, "HeaderIsOn"));
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf67207_MERGEFIELD, "mailmerge.docx")
{
uno::Reference<beans::XPropertySet> xTextField = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 880d05aafbb6..dbed9fc22384 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -454,7 +454,7 @@ DECLARE_OOXMLEXPORT_TEST(testVMLData, "TestVMLData.docx")
{
// The problem was exporter was exporting vml data for shape in w:rPr element.
// vml data should not come under w:rPr element.
- xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
+ xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
if (!pXmlDoc)
return;
CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "stroked").match("f"));
@@ -464,7 +464,7 @@ DECLARE_OOXMLEXPORT_TEST(testImageData, "image_data.docx")
{
// The problem was exporter was exporting v:imagedata data for shape in w:pict as v:fill w element.
- xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
+ xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
if (!pXmlDoc)
return;
CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape/v:imagedata", "detectmouseclick").match("t"));