summaryrefslogtreecommitdiff
path: root/sw/source/uibase/dochdl
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-01-26 13:44:39 +0100
committerLászló Németh <nemeth@numbertext.org>2022-01-26 18:09:53 +0100
commit6ad9a3d74ef6eae3e645df12dedbe059acc180c4 (patch)
tree94044e1972b96783f3b9420e66e4b50c01c4ed2b /sw/source/uibase/dochdl
parentf25d5b11d6151978ad0b7ff3c4161cbc2cc8aded (diff)
tdf#146966 sw: fix inserting empty rows at copying multiple rows
HTML expansion of the clipboard content is used to calculate the row number of the table on the clipboard. Skip its empty <tr></tr> elements here, similar to Paste As HTML in Edit->Paste Special-> Paste Special... to avoid inserting empty rows (e.g. selecting and copying/moving 4 rows inserted 30 extra empty rows). Note: likely this was a regression, related to the new empty rows in the clipboard/expansion code. Change-Id: I58b16c7869c08cda7e2a2c21c3c03bf38446d826 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128986 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source/uibase/dochdl')
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 883ada5147b8..65fefd68804b 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1569,8 +1569,13 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt
while((nIdx = aExpand.indexOf(sSearchRowOrCol, nIdx)) > -1)
{
// skip rows/columns of nested tables, based on HTML indentation
- if (nIdx > 2 && (aExpand[nIdx-1] != '\t' || aExpand[nIdx-2] != '\t' || (bShifted && aExpand[nIdx-3] != '\t')))
+ if ( nIdx > 3 && (aExpand[nIdx-1] != '\t' || aExpand[nIdx-2] != '\t' ||
+ ( bShifted && aExpand[nIdx-3] != '\t') ) &&
+ // skip also strange hidden empty rows <tr></tr>
+ !aExpand.match("<tr></tr>", nIdx - 4) )
+ {
++nSelectedRowsOrCols;
+ }
++nIdx;
}
// are we at the beginning of the cell?