diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 90c7566e30d3..2b0ee4166152 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -151,11 +151,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf121561_tocTitleDocx, "tdf121456_tabsOffset.odt") if (!pXmlDoc) return; + // get TOC node uno::Reference<text::XDocumentIndexesSupplier> xIndexSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xIndexes(xIndexSupplier->getDocumentIndexes( ), uno::UNO_QUERY); uno::Reference<text::XDocumentIndex> xTOCIndex(xIndexes->getByIndex(0), uno::UNO_QUERY); + // ensure TOC title was set in TOC properties CPPUNIT_ASSERT_EQUAL(OUString("Inhaltsverzeichnis"), getProperty<OUString>(xTOCIndex, "Title")); + + // ensure TOC end-field mark is placed inside TOC section + assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtContent/w:p[16]/w:r/w:fldChar", "fldCharType", "end"); } DECLARE_OOXMLEXPORT_TEST(testTdf106174_rtlParaAlign, "tdf106174_rtlParaAlign.docx") diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 00e6249d6faa..2f7dd7a5aa49 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1484,6 +1484,21 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, sal_Int32 nPos, bool / m_nFieldsInHyperlink = 0; } + // end ToX fields + for (auto it = m_Fields.rbegin(); it != m_Fields.rend(); ) + { + if (it->bClose && !it->pField) + { + EndField_Impl( pNode, nPos, *it ); + it = decltype(m_Fields)::reverse_iterator(m_Fields.erase(it.base() - 1)); + } + else + { + ++it; + } + } + + DoWriteBookmarksStart(m_rFinalBookmarksStart); DoWriteBookmarksEnd(m_rFinalBookmarksEnd); DoWriteBookmarkEndIfExist(nPos); |