diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-07 17:53:29 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-07 18:04:21 +0200 |
commit | 153af84762f98d6c86c4c060b01402f40b2b0c24 (patch) | |
tree | 91ca9aae4a84feb04823fcd2040243845f3fed14 /sw | |
parent | 73aaa3cf5e18d008268f4b67bbb60070b2cafc6a (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.
Change-Id: I10f259fd9edb8bd719ae5bc8a43ed5ef8c708071
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/multi-page-toc.docx | bin | 0 -> 18321 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 |
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 Binary files differnew file mode 100644 index 000000000000..5b5b5949d645 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/multi-page-toc.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 487728defec1..9b493398767a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -412,6 +412,18 @@ DECLARE_OOXMLEXPORT_TEST(testAnchorPosition, "anchor-position.docx") CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty<OUString>(getRun(getParagraph(1), 3), "TextPortionType")); } +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")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |