sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 9 +++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-)
New commits: commit 6a0163d967ce0482598eeebbcc5a4f413f190533 Author: László Németh <nem...@numbertext.org> AuthorDate: Wed Aug 3 16:09:14 2022 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Thu Aug 4 10:44:13 2022 +0200 tdf#150166 DOCX export: revert ToC w:move* to fix broken file Export w:moveFrom/w:moveTo of tracked ToC moving as w:del/w:ins (and w:delText for runs in w:del) again to avoid of interoperability problems. Partial revert of commit 9e1e88ad5cf2dc0e9b188c60930445652a6c7519 "tdf#145720 DOCX export: fix loss of tracked moving". Follow-up to commit 64ac089ad5464c832592e050f5d51a136f533f21 "tdf#150166 DOCX export: fix broken file with tracked ToC moving". Note: Commit 64ac089ad5464c832592e050f5d51a136f533f21 was only part of the fix for the broken export with interoperability problems. Change-Id: I520f3a7e08eca0ccd6aa221a2406b41925f70fa7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137752 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index fe4b830b5680..31d625b815ae 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1247,6 +1247,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf150166, "tdf150166.docx") assertXPath(pXmlDoc, "//w:moveFromRangeStart", 0); // This was 2 (missing RangeStart elements, but bad unpaired RangeEnds) assertXPath(pXmlDoc, "//w:moveFromRangeEnd", 0); + + // These were 0 (moveFrom, moveTo and t) + assertXPath(pXmlDoc, "//w:del", 11); + assertXPath(pXmlDoc, "//w:ins", 12); + assertXPath(pXmlDoc, "//w:delText", 7); + + // no more moveFrom/moveTo to avoid of problems with ToC + assertXPath(pXmlDoc, "//w:moveFrom", 0); + assertXPath(pXmlDoc, "//w:moveTo", 0); } } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index ce2d8d27f4e9..019087e9142a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3404,8 +3404,12 @@ 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; - if ( m_pRedlineData && !m_pRedlineData->IsMoved() && - m_pRedlineData->GetType() == RedlineType::Delete ) + + 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; + + if ( m_pRedlineData && m_pRedlineData->GetType() == RedlineType::Delete && !bMoved ) { nTextToken = XML_delText; } @@ -3809,7 +3813,9 @@ void DocxAttributeOutput::StartRedline( const SwRedlineData * pRedlineData ) const DateTime aDateTime = pRedlineData->GetTimeStamp(); bool bNoDate = bRemovePersonalInfo || ( aDateTime.GetYear() == 1970 && aDateTime.GetMonth() == 1 && aDateTime.GetDay() == 1 ); - bool bMoved = pRedlineData->IsMoved(); + bool bMoved = pRedlineData->IsMoved() && + // tdf#150166 save tracked moving around TOC as w:ins, w:del + SwDoc::GetCurTOX(*m_rExport.m_pCurPam->GetPoint()) == nullptr; switch ( pRedlineData->GetType() ) { case RedlineType::Insert: @@ -3842,7 +3848,9 @@ void DocxAttributeOutput::EndRedline( const SwRedlineData * pRedlineData ) if ( !pRedlineData || m_bWritingField ) return; - bool bMoved = pRedlineData->IsMoved(); + bool bMoved = pRedlineData->IsMoved() && + // tdf#150166 save tracked moving around TOC as w:ins, w:del + SwDoc::GetCurTOX(*m_rExport.m_pCurPam->GetPoint()) == nullptr; switch ( pRedlineData->GetType() ) { case RedlineType::Insert: