summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2019-03-27 14:02:51 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2019-03-29 11:24:49 +0100
commitbc5d04dfe4e53880bab21eff5a2071b368d918c1 (patch)
treeadc1bc72c5fabb2b505d7f54f3bd35b3fed2896a
parent57e6e1e1cec5465b81450bcbabac43beaee7ea74 (diff)
tdf#121456 sw: DOCX: fix loading of empty TOC title
Change-Id: Ib241edd07e4c6781d80db274f73146bda310d8c0 Reviewed-on: https://gerrit.libreoffice.org/69827 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit e47a5543f4b8c9e317d1e43af8c0e5a732e461fd) Reviewed-on: https://gerrit.libreoffice.org/69903
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf121456.docxbin0 -> 5277 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx10
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx3
3 files changed, 13 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf121456.docx b/sw/qa/extras/ooxmlexport/data/tdf121456.docx
new file mode 100644
index 000000000000..a65870a9b719
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf121456.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index bcc136d31ef2..961d14eab848 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -93,6 +93,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121561_tocTitle, "tdf121456_tabsOffset.odt")
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:docPartObj/w:docPartUnique", 1);
}
+// Related issue tdf#121561: w:sdt/w:sdtContent around TOC
+DECLARE_OOXMLEXPORT_TEST(testTdf124106, "tdf121456.docx")
+{
+ uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XText> text(textDocument->getText(), uno::UNO_QUERY);
+ // -1 if the 'Y' character does not occur
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), text->getString().indexOf('Y'));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), text->getString().indexOf('y'));
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf121561_tocTitleDocx, "tdf121456_tabsOffset.odt")
{
xmlDocPtr pXmlDoc = parseExport();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1ee7cc8600de..ecb73bb038f4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3663,6 +3663,9 @@ void DomainMapper_Impl::handleToc
{
if (aTocTitle.isEmpty() || bTableOfFigures)
{
+ // reset marker of the TOC title
+ m_xStdEntryStart = uno::Reference< text::XTextRange >();
+
xTOC.set(
m_xTextFactory->createInstance
( bTableOfFigures ?