From 3c1fee94e007a4c985572ec708bb60afa60f565d Mon Sep 17 00:00:00 2001 From: László Németh Date: Tue, 13 Jun 2023 13:04:28 +0200 Subject: tdf#155187 sw track changes: color tables in single changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Show Changes mode, whole tables within a single redline, i.e. in a single text change get similar coloring, as in separately tracked table rows or columns. Follow-up to commit 48898a72066ff9982feafebb26708c4e779fd460 "tdf#60382 sw xmloff: import/export tracked table/row deletion" and commit f348440e17debacbcba9153e238e010e8c020bdc "tdf#146120 sw: show tracked table changes with different color". Change-Id: I0154a20146cd6689750fa33edfe960eb22d7610a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152959 Tested-by: Jenkins Reviewed-by: László Németh --- sw/qa/extras/layout/data/table_in_text_change.fodt | 66 ++++++++++++++++++++++ sw/qa/extras/layout/layout2.cxx | 18 ++++++ sw/source/core/table/swtable.cxx | 5 ++ 3 files changed, 89 insertions(+) create mode 100644 sw/qa/extras/layout/data/table_in_text_change.fodt (limited to 'sw') diff --git a/sw/qa/extras/layout/data/table_in_text_change.fodt b/sw/qa/extras/layout/data/table_in_text_change.fodt new file mode 100644 index 000000000000..6d1ccaf2c2cd --- /dev/null +++ b/sw/qa/extras/layout/data/table_in_text_change.fodt @@ -0,0 +1,66 @@ + + + + + + + + + x + 2023-06-13T12:47:02 + + + + + + + x + 2023-06-13T12:43:39 + + + + + Whole tables in tracked text deletion + + + + + 1 + + + 2 + + + + + 3 + + + 4 + + + + Whole tables in tracked text insertion + + + + + I + + + II + + + + + III + + + IV + + + + + + + diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 9daa260c21c4..e9654dc7c9b6 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -973,6 +973,24 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testChangedTableRows) assertXPath(pXmlDoc, "/metafile/push/push/push/push/push/fillcolor[@color='#3faf46']", 1); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf155187_TableInTextChange) +{ + createSwDoc("table_in_text_change.fodt"); + SwDoc* pDoc = getSwDoc(); + SwDocShell* pShell = pDoc->GetDocShell(); + + // Dump the rendering of the first page as an XML file. + std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile(); + MetafileXmlDump dumper; + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + + // This was 0 (other color, not COL_AUTHOR_TABLE_DEL, color of the tracked row deletion) + assertXPath(pXmlDoc, "/metafile/push/push/push/push/push/fillcolor[@color='#fce6f4']", 2); + // This was 0 (other color, not COL_AUTHOR_TABLE_INS, color of the tracked row insertion) + assertXPath(pXmlDoc, "/metafile/push/push/push/push/push/fillcolor[@color='#e1f2fa']", 2); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf145225_RedlineMovingWithBadInsertion) { createSwDoc("tdf42748.fodt"); diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index ee4753b96d67..04d58363b97d 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1975,6 +1975,11 @@ RedlineType SwTableLine::GetRedlineType() const // empty the cache const_cast(this)->SetRedlineType( RedlineType::None ); + // is the whole table part of a changed text + SwRedlineTable::size_type nTableRedline = GetTableRedline(); + if ( nTableRedline != SwRedlineTable::npos ) + return aRedlineTable[nTableRedline]->GetType(); + return RedlineType::None; } -- cgit