sw/qa/extras/layout/data/tdf149711.docx |binary sw/qa/extras/layout/layout2.cxx | 17 +++++++++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 19 ++++++++++--------- writerfilter/source/dmapper/DomainMapper_Impl.hxx | 4 ++-- 4 files changed, 29 insertions(+), 11 deletions(-)
New commits: commit 626be09128b9bd360ab05aa6eea02c826ff6ec77 Author: László Németh <[email protected]> AuthorDate: Thu Jul 7 13:04:45 2022 +0200 Commit: László Németh <[email protected]> CommitDate: Fri Jul 8 12:07:18 2022 +0200 tdf#149711 sw_redlinenum DOCX: import moveTo paragraph mark It was imported as an old paragraph with new content, resulting that e.g. rejecting a moved list item left an empty list item instead of removing the moved list item completely. Follow-up to commit 80694a8fcfeb86ed69425ab6954b353b9a0ae854 "tdf#149708 sw_redlinenum DOCX export: track inserted list items" and commit d32d9a2b3c5e3963f4a18f6c7bbf50fab2e9b2be "tdf#123460 DOCX track changes: moveFrom completely". Change-Id: Ia1997aeffeb45f89bb738c6faa95fb2efc54fd7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136886 Tested-by: Jenkins Reviewed-by: László Németh <[email protected]> (cherry picked from commit ccd0cb2265c337c70c565f0e04cdf4019361d18c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136867 Tested-by: László Németh <[email protected]> diff --git a/sw/qa/extras/layout/data/tdf149711.docx b/sw/qa/extras/layout/data/tdf149711.docx new file mode 100644 index 000000000000..d90efa7c1f88 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf149711.docx differ diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 9a366b00a15d..0d9aa5058f50 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -452,6 +452,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149709_RedlineNumberingLevel) assertXPathContent(pXmlDoc, "/metafile/push/push/push/textarray[8]/text", "2."); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf149711_importDOCXMoveToParagraphMark) +{ + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf149711.docx"); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 6); + + // reject tracked insertion (moveTo) + SwEditShell* const pEditShell(pDoc->GetEditShell()); + CPPUNIT_ASSERT_EQUAL(static_cast<SwRedlineTable::size_type>(2), pEditShell->GetRedlineCount()); + pEditShell->RejectRedline(1); + + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + // This was 6 (not tracked paragraph mark of the moveTo list item) + assertXPath(pXmlDoc, "/root/page[1]/body/txt", 5); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testRedlineNumberInFootnote) { SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf85610.fodt"); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index fd1c79f66667..9543b916b9a6 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2734,10 +2734,10 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper } } - // reset moveFrom data of non-terminating runs of the paragraph - if ( m_pParaMarkerRedlineMoveFrom ) + // reset moveFrom/moveTo data of non-terminating runs of the paragraph + if ( m_pParaMarkerRedlineMove ) { - m_pParaMarkerRedlineMoveFrom.clear(); + m_pParaMarkerRedlineMove.clear(); } CheckRedline( xTextRange ); m_bParaChanged = true; @@ -3297,13 +3297,14 @@ void DomainMapper_Impl::CreateRedline(uno::Reference<text::XTextRange> const& xR break; case XML_moveTo: bRedlineMoved = true; + m_pParaMarkerRedlineMove = pRedline.get(); [[fallthrough]]; case XML_ins: sType = getPropertyName( PROP_INSERT ); break; case XML_moveFrom: bRedlineMoved = true; - m_pParaMarkerRedlineMoveFrom = pRedline.get(); + m_pParaMarkerRedlineMove = pRedline.get(); [[fallthrough]]; case XML_del: sType = getPropertyName( PROP_DELETE ); @@ -3372,14 +3373,14 @@ void DomainMapper_Impl::CheckParaMarkerRedline( uno::Reference< text::XTextRange m_currentRedline.clear(); } } - else if ( m_pParaMarkerRedlineMoveFrom ) + else if ( m_pParaMarkerRedlineMove ) { - // terminating moveFrom redline removes also the paragraph mark - CreateRedline( xRange, m_pParaMarkerRedlineMoveFrom ); + // terminating moveFrom/moveTo redline removes also the paragraph mark + CreateRedline( xRange, m_pParaMarkerRedlineMove ); } - if ( m_pParaMarkerRedlineMoveFrom ) + if ( m_pParaMarkerRedlineMove ) { - m_pParaMarkerRedlineMoveFrom.clear(); + m_pParaMarkerRedlineMove.clear(); } } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index c0a41b0328cf..4072a646840b 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -576,8 +576,8 @@ private: RedlineParamsPtr m_previousRedline; RedlineParamsPtr m_pParaMarkerRedline; bool m_bIsParaMarkerChange; - // redline data of the terminating run, if it's a moveFrom deletion - RedlineParamsPtr m_pParaMarkerRedlineMoveFrom; + // redline data of the terminating run, if it's a moveFrom deletion or a moveTo insertion + RedlineParamsPtr m_pParaMarkerRedlineMove; // This is for removing workaround (double ZWSPs around the anchoring point) for track // changed images anchored *to* character, if it's followed by a redline text run immediately. // (In that case, the image is part of a tracked text range, no need for the dummy
