From e49917352ed2a53cd9025a65560bc3ea2808f4e5 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 15 Apr 2021 17:59:55 +0200 Subject: sw: DOCX export: DocxAttributeOutput::EndField_Impl() omits bookmark end (regression from f5c266695a4a88da7db971a21915e2bbf758d48e) Change-Id: I00c871c096e8370e3ba4fccd1d02d350142d6b28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114166 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/filter/ww8/docxattributeoutput.cxx | 18 ++++++------------ sw/source/filter/ww8/docxattributeoutput.hxx | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7573ede5f0ff..d0fd48ffb15f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1681,16 +1681,10 @@ void DocxAttributeOutput::DoWriteBookmarkTagStart(const OUString & bookmarkName) FSNS(XML_w, XML_name), BookmarkToWord(bookmarkName)); } -void DocxAttributeOutput::DoWriteBookmarkTagEnd(const OUString & bookmarkName) +void DocxAttributeOutput::DoWriteBookmarkTagEnd(sal_Int32 const nId) { - const auto nameToIdIter = m_rOpenedBookmarksIds.find(bookmarkName); - if (nameToIdIter != m_rOpenedBookmarksIds.end()) - { - const sal_Int32 nId = nameToIdIter->second; - - m_pSerializer->singleElementNS(XML_w, XML_bookmarkEnd, - FSNS(XML_w, XML_id), OString::number(nId)); - } + m_pSerializer->singleElementNS(XML_w, XML_bookmarkEnd, + FSNS(XML_w, XML_id), OString::number(nId)); } void DocxAttributeOutput::DoWriteBookmarkStartIfExist(sal_Int32 nRunPos) @@ -1715,7 +1709,7 @@ void DocxAttributeOutput::DoWriteBookmarkEndIfExist(sal_Int32 nRunPos) if (pPos != m_rOpenedBookmarksIds.end()) { // Output the bookmark - DoWriteBookmarkTagEnd(aIter->second); + DoWriteBookmarkTagEnd(pPos->second); m_rOpenedBookmarksIds.erase(aIter->second); } } @@ -1746,7 +1740,7 @@ void DocxAttributeOutput::DoWriteBookmarksEnd(std::vector& rEnds) if (pPos != m_rOpenedBookmarksIds.end()) { // Output the bookmark - DoWriteBookmarkTagEnd(bookmarkName); + DoWriteBookmarkTagEnd(pPos->second); m_rOpenedBookmarksIds.erase(bookmarkName); } @@ -2359,7 +2353,7 @@ void DocxAttributeOutput::EndField_Impl( const SwTextNode* pNode, sal_Int32 nPos // Write the bookmark end if any if ( !m_sFieldBkm.isEmpty() ) { - DoWriteBookmarkTagEnd(m_sFieldBkm); + DoWriteBookmarkTagEnd(m_nNextBookmarkId); m_nNextBookmarkId++; } diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 977c57f0d9f8..4b7e807c1927 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -694,7 +694,7 @@ protected: private: void DoWriteBookmarkTagStart(const OUString & bookmarkName); - void DoWriteBookmarkTagEnd(const OUString & bookmarkName); + void DoWriteBookmarkTagEnd(sal_Int32 nId); void DoWriteBookmarksStart(std::vector& rStarts); void DoWriteBookmarksEnd(std::vector& rEnds); void DoWriteBookmarkStartIfExist(sal_Int32 nRunPos); -- cgit