From 896c2199d9f0a28bd405dd2d1068f5e2973cdf06 Mon Sep 17 00:00:00 2001 From: László Németh Date: Thu, 3 Jun 2021 12:13:49 +0200 Subject: tdf#79069 DOCX: support tracked table (row) deletion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only DOCX round-trip was supported for tracked table and table row deletions. Now change tracking of newly deleted tables and table rows is exported in DOCX. Also the DOCX import is handled by Manage Changes now: accepting the deleted ranges of a deleted row removes also the table row, not only its text content. Follow-up to commit 05366b8e6683363688de8708a3d88cf144c7a2bf "tdf#60382 sw offapi: add change tracking of table/row deletion". Change-Id: Ic02e0adbda11032acb9616c262c2fce134f6b07c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116652 Tested-by: Jenkins Reviewed-by: László Németh --- sw/source/core/unocore/unocrsrhelper.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'sw/source/core') diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 32b449b97403..58d5dbf6b11e 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include @@ -1388,7 +1389,8 @@ void makeTableRowRedline( SwTableLine& rTableLine, std::u16string_view rRedlineType, const uno::Sequence< beans::PropertyValue >& rRedlineProperties ) { - IDocumentRedlineAccess* pRedlineAccess = &rTableLine.GetFrameFormat()->GetDoc()->getIDocumentRedlineAccess(); + SwDoc* pDoc = rTableLine.GetFrameFormat()->GetDoc(); + IDocumentRedlineAccess* pRedlineAccess = &pDoc->getIDocumentRedlineAccess(); RedlineType eType; if ( rRedlineType == u"TableRowInsert" ) @@ -1398,6 +1400,18 @@ void makeTableRowRedline( SwTableLine& rTableLine, else if ( rRedlineType == u"TableRowDelete" ) { eType = RedlineType::TableRowDelete; + + // set table row property "HasTextChangesOnly" to false + // to handle tracked deletion of the table row on the UI + const SvxPrintItem *pHasTextChangesOnlyProp = + rTableLine.GetFrameFormat()->GetAttrSet().GetItem(RES_PRINT); + if ( !pHasTextChangesOnlyProp || pHasTextChangesOnlyProp->GetValue() ) + { + SvxPrintItem aSetTracking(RES_PRINT, false); + SwPosition aPos( *rTableLine.GetTabBoxes()[0]->GetSttNd() ); + SwCursor aCursor( aPos, nullptr ); + pDoc->SetRowNotTracked( aCursor, aSetTracking ); + } } else { -- cgit v1.2.3