sw/qa/extras/ooxmlexport/data/tdf165933.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport22.cxx | 12 ++++++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 9 +++++++++ 3 files changed, 21 insertions(+)
New commits: commit 80d036c0ddfce7025e0d069f54c65b28031a9f7c Author: Jaume Pujantell <[email protected]> AuthorDate: Thu Mar 27 15:21:12 2025 +0100 Commit: Jaume Pujantell <[email protected]> CommitDate: Fri Mar 28 19:40:05 2025 +0100 tdf#165933 avoid w:delText inside w:moveFrom w:delText should only be used inside a w:del, we differentiate if we use w:del or w:moveFrom by looking if the current redline is move and if it is inside a move bookmark. But sometimes the run contents are writen before the surrounding bookmarks, in that case we wrongly used delText. To avoid this we need to check not only the existing bookmarks but also the ones that will be opened in this run. Change-Id: I6653d18545cc5eb5f302c5753cdd7dfb24bee6fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183458 Reviewed-by: Jaume Pujantell <[email protected]> Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf165933.docx b/sw/qa/extras/ooxmlexport/data/tdf165933.docx new file mode 100644 index 000000000000..a5d40269b51c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf165933.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx index 5c191018560c..5e6fde133f10 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx @@ -117,6 +117,18 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf88908) } } +CPPUNIT_TEST_FIXTURE(Test, testTdf165933_noDelTextOnMove) +{ + loadAndSave("tdf165933.docx"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); + CPPUNIT_ASSERT(pXmlDoc); + // Wihtout the fix it fails with + // - Expected: 0 + // - Actual : 1 + // a w:delText is created inside a w:moveFrom, which is invalid + assertXPath(pXmlDoc, "//w:moveFrom/w:r/w:delText", 0); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7fa0692960a3..f9e66565ac4c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3865,6 +3865,15 @@ void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding /*eCh break; } } + // Check also the bookmarks that will be opened just now + for (const OUString& bookmarkName : m_rBookmarksStart) + { + if (bookmarkName.startsWith(u"__RefMove")) + { + isInMoveBookmark = true; + break; + } + } bool bMoved = isInMoveBookmark && m_pRedlineData && m_pRedlineData->IsMoved() && // tdf#150166 save tracked moving around TOC as w:ins, w:del SwDoc::GetCurTOX(*m_rExport.m_pCurPam->GetPoint()) == nullptr;
