summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-10-07 17:53:29 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-12-18 15:34:55 +0000
commit99b3e159726b51537563790e8f73b43a88970e13 (patch)
tree0c98429e0d5d6cf1deddf595eca03c8c4728acd8 /sw/qa
parent6b80793b919520e443024da5499e7ab9f6720d6c (diff)
DOCX import: handle section break right after a ToC field
The symptom was that during the handling of the XE field, we tried to access the top of the text append stack, but the stack was empty. The situation is the following: 1) There is a multi-page TOC field. 2) The page break inside the field is described using a section break, featuring headers, and the header contains a field that we map to a fieldmark. 3) There is an XE field after all this. The root cause was that during parsing of the header, some of the state should be stashed away and restored when we're done. The new HeaderFooterContext does exactly this, and now the number of push/pop calls on the text append context match again. (cherry picked from commit 153af84762f98d6c86c4c060b01402f40b2b0c24) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Change-Id: I10f259fd9edb8bd719ae5bc8a43ed5ef8c708071 Reviewed-on: https://gerrit.libreoffice.org/13524 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/multi-page-toc.docxbin0 -> 18321 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx12
2 files changed, 12 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/multi-page-toc.docx b/sw/qa/extras/ooxmlexport/data/multi-page-toc.docx
new file mode 100644
index 000000000000..5b5b5949d645
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/multi-page-toc.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2fe437b02fc3..a443d586dd8c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3706,6 +3706,18 @@ DECLARE_OOXMLEXPORT_TEST(testMsoPosition, "bnc884615-mso-position.docx")
}
}
+DECLARE_OOXMLEXPORT_TEST(testMultiPageToc, "multi-page-toc.docx")
+{
+ // Import of this document triggered an STL assertion.
+
+ // Document has a ToC from its second paragraph.
+ uno::Reference<container::XNamed> xTextSection = getProperty< uno::Reference<container::XNamed> >(getParagraph(2), "TextSection");
+ CPPUNIT_ASSERT_EQUAL(OUString("Table of Contents1"), xTextSection->getName());
+ // There should be a field in the header as well.
+ uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
+ CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty<OUString>(getRun(getParagraphOfText(1, xHeaderText), 1), "TextPortionType"));
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();