summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/uitest/table/sheetToTable.py36
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx19
2 files changed, 54 insertions, 1 deletions
diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py
index 11b9fe89b490..4a40b6966935 100644
--- a/sw/qa/uitest/table/sheetToTable.py
+++ b/sw/qa/uitest/table/sheetToTable.py
@@ -114,4 +114,38 @@ class sheetToTable(UITestCase):
self.assertEqual(table.getCellByName("A3").getString(), "Test 3")
self.assertEqual(table.getCellByName("A4").getString(), "Test 4")
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+ def test_tdf152245(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ enter_text_to_cell(gridwin, "A1", "Test 1")
+ enter_text_to_cell(gridwin, "A2", "Test 2")
+ enter_text_to_cell(gridwin, "A3", "Test 3")
+ enter_text_to_cell(gridwin, "A4", "Test 4")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+
+ self.xUITest.executeCommand(".uno:Copy")
+
+
+ with self.ui_test.load_empty_file("writer") as writer_doc:
+
+ self.xUITest.executeCommand(".uno:InsertTable?Columns:short=1&Rows:short=4")
+
+ # redlining should be on
+ self.xUITest.executeCommand(".uno:TrackChanges")
+
+ # This was freezing
+ self.xUITest.executeCommand(".uno:Paste")
+
+ self.assertEqual(writer_doc.TextTables.getCount(), 1)
+ table = writer_doc.getTextTables()[0]
+ self.assertEqual(len(table.getRows()), 4)
+ self.assertEqual(table.getCellByName("A1").getString(), "Test 1")
+ self.assertEqual(table.getCellByName("A2").getString(), "Test 2")
+ self.assertEqual(table.getCellByName("A3").getString(), "Test 3")
+ self.assertEqual(table.getCellByName("A4").getString(), "Test 4")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 8c6d6bda92eb..d9a6db5c1bb5 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1519,16 +1519,35 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt
{
SfxDispatcher* pDispatch = rSh.GetView().GetViewFrame()->GetDispatcher();
sal_uInt32 nLevel = 0;
+
// within Writer table cells, inserting worksheets using HTML format results only plain text, not a native table,
// so remove all outer nested tables temporary to get a working insertion point
// (RTF format has no such problem, but that inserts the hidden rows of the original Calc worksheet, too)
+
+ // For this, switch off change tracking temporarily, if needed
+ RedlineFlags eOld = rSh.GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags();
+ if ( eOld & RedlineFlags::On )
+ rSh.GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOld & ~RedlineFlags::On );
+
+ OUString sPreviousTableName;
do
{
+ // tdf#152245 add a limit to the loop, if it's not possible to delete the table
+ const SwTableNode* pNode = rSh.GetCursor()->GetPointNode().FindTableNode();
+ const OUString sTableName = pNode->GetTable().GetFrameFormat()->GetName();
+ if ( sTableName == sPreviousTableName )
+ break;
+ sPreviousTableName = sTableName;
// insert a random character to redo the place of the insertion at the end
pDispatch->Execute(FN_INSERT_NNBSP, SfxCallMode::SYNCHRON);
pDispatch->Execute(FN_TABLE_DELETE_TABLE, SfxCallMode::SYNCHRON);
nLevel++;
} while (SwDoc::IsInTable(rSh.GetCursor()->GetPointNode()) != nullptr);
+
+ // restore change tracking settings
+ if ( eOld & RedlineFlags::On )
+ rSh.GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags( eOld );
+
if ( SwTransferable::PasteData( rData, rSh, EXCHG_OUT_ACTION_INSERT_STRING, nActionFlags, SotClipboardFormatId::HTML,
nDestination, false, false, nullptr, 0, false, nAnchorType, bIgnoreComments, &aPasteContext, ePasteTable) )
{