sw/qa/extras/ooxmlexport/data/tdf165059_broken.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport21.cxx | 23 +++++++++----------- sw/source/filter/ww8/docxattributeoutput.cxx | 15 ++++++++++--- 3 files changed, 23 insertions(+), 15 deletions(-)
New commits: commit 023c265e237ff84dead624ec369976ff2f006ffa Author: Jaume Pujantell <jaume.pujant...@collabora.com> AuthorDate: Thu Mar 13 15:01:24 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Mar 13 16:35:00 2025 +0100 tdf#165059 sw use delText inside all del tags Continuation of commit 624de66a2aeee92c0d2cadc8de3740167ec09062 "sw fix not valid moveFrom/moveTo tag". Make sure to us w:delText instead of w:t inside the w:del tags now used because of that change. Change-Id: Ic5bac1865e5c12a71bd15306249c2624eb1149f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182870 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/data/tdf165059_broken.docx b/sw/qa/extras/ooxmlexport/data/tdf165059_broken.docx index 548d4d9c7414..6a81afd69e15 100644 Binary files a/sw/qa/extras/ooxmlexport/data/tdf165059_broken.docx and b/sw/qa/extras/ooxmlexport/data/tdf165059_broken.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx index a97720dc69d4..8fa2e7ef14bc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx @@ -494,19 +494,18 @@ CPPUNIT_TEST_FIXTURE(Test, testMsWordUlTrailSpace) assertXPath(pXmlSettings, "/w:settings/w:compat/w:ulTrailSpace"_ostr); } -DECLARE_OOXMLEXPORT_TEST(testTdf165059_moveFromTo, "tdf165059_broken.docx") +CPPUNIT_TEST_FIXTURE(Test, testTdf165059_moveFromTo) { - if (isExported()) - { - // Without the fix, exported contains w:move* ouside of move ranges - // Outside move range tags ins/del are valid - xmlDocUniquePtr p_XmlDoc = parseExport("word/document.xml"); - CPPUNIT_ASSERT(p_XmlDoc); - assertXPath(p_XmlDoc, "//w:moveTo"_ostr, 0); - assertXPath(p_XmlDoc, "//w:ins"_ostr, 1); - assertXPath(p_XmlDoc, "//w:moveFrom"_ostr, 0); - assertXPath(p_XmlDoc, "//w:del"_ostr, 1); - } + loadAndSave("tdf165059_broken.docx"); + // Without the fix, exported contains w:move* ouside of move ranges + // Outside move range tags ins/del are valid + xmlDocUniquePtr p_XmlDoc = parseExport("word/document.xml"); + CPPUNIT_ASSERT(p_XmlDoc); + assertXPath(p_XmlDoc, "//w:moveTo"_ostr, 0); + assertXPath(p_XmlDoc, "//w:ins"_ostr, 1); + assertXPath(p_XmlDoc, "//w:moveFrom"_ostr, 0); + assertXPath(p_XmlDoc, "//w:del"_ostr, 1); + assertXPath(p_XmlDoc, "//w:delText"_ostr, 1); } } // end of anonymous namespace diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index ed2273925059..770da84aabc3 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3803,9 +3803,18 @@ void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding /*eCh // the text run is usually XML_t, with the exception of the deleted (and not moved) text sal_Int32 nTextToken = XML_t; - bool bMoved = 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; + bool isInMoveBookmark = false; + for (const auto& openedBookmark : m_rOpenedBookmarksIds) + { + if (openedBookmark.first.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; if ( m_pRedlineData && m_pRedlineData->GetType() == RedlineType::Delete && !bMoved ) {