summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-08-11 17:44:03 +0200
committerLászló Németh <nemeth@numbertext.org>2021-08-12 15:39:19 +0200
commit5af699be26fc959aa7d807e59d3873cc5b2fb230 (patch)
treeb6f4f8468df77c547bf22378c5c99a262f4e6c9f /sw
parent9bbc9e75f20937913b5d6f4f09b1d5b54e26bf20 (diff)
tdf#143318 DOCX import: fix missing redlines in flying tables
makeRedline() exceptions (in the case of already existing redlines) skip the creation of the next (not existing yet) redlines in tables inside fly frames. Here: a tracked table moving revealed the problem, with the missing rejection of the new position, i.e. the "new" (second) table of the document. Note: fix also collecting redlines within tables: IsInTable() isn't true in the first cell of the table, losing the redline here, so it's replaced with m_nTableDepth > 0. Follow-up to commit 7f3c0bbc174b9b0316991c174ca3b407c0e3d141 "tdf#143510 DOCX import: fix tracked table drag & drop". Change-Id: Icf6dd62eb950e5af6a75353dffabb9e9433c1b44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120333 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit afc0c718ec9ca6a4fbe1324f68eb292d9a67b058) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120356
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data/TC-table-DnD-move.docxbin0 -> 12977 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx29
2 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/TC-table-DnD-move.docx b/sw/qa/extras/uiwriter/data/TC-table-DnD-move.docx
new file mode 100644
index 000000000000..f231d6f84240
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/TC-table-DnD-move.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 97e14b77cabd..c6c205a1d759 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -4251,6 +4251,35 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineDOCXTableInsertion)
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineDOCXTableMoveToFrame)
+{
+ // load a table with tracked drag & drop: Table1 is the moveFrom,
+ // Table2 is the moveTo - and framed - table
+ SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "TC-table-DnD-move.docx");
+
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xTableNames = xTextTablesSupplier->getTextTables();
+ // check table count (2)
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount());
+
+ // accept tracked table moving, remaining table is Table2
+ IDocumentRedlineAccess& rIDRA(pDoc->getIDocumentRedlineAccess());
+ rIDRA.AcceptAllRedline(true);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT(xTableNames->hasByName("Table2"));
+ CPPUNIT_ASSERT(!xTableNames->hasByName("Table1"));
+
+ // Undo and reject tracked table moving, remaining table is Table1
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ rIDRA.AcceptAllRedline(false);
+ // This was 2 (not deleted Table2 – framed)
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT(xTableNames->hasByName("Table1"));
+ CPPUNIT_ASSERT(!xTableNames->hasByName("Table2"));
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf128335)
{
// Load the bugdoc, which has 3 textboxes.