diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-10-07 17:53:29 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-01-08 15:09:17 +0100 |
commit | 1fe7949ab681015f0e30def0b636049d8db35e35 (patch) | |
tree | 84673f3b66ce51fa0be19619cf0bda2f146c0280 /sw | |
parent | a21c8df40d8d0567423372a2c535a50b5c8f724e (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>
(cherry picked from commit 99b3e159726b51537563790e8f73b43a88970e13)
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 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(); |