tdf#141391 sw: don't paste as nested table in first cell paragraph
commitf0254aaea7d4a6a261731f76c99cb06f1b5ab2b1
authorLászló Németh <nemeth@numbertext.org>
Fri, 22 Apr 2022 18:34:32 +0000 (22 20:34 +0200)
committerXisco Fauli <xiscofauli@libreoffice.org>
Tue, 26 Apr 2022 07:25:25 +0000 (26 09:25 +0200)
tree5c28b51c3e1d5acda8447bc97afdb7a60654e02e
parentdfacc8ec3a81f59cd3e6ad45331ebd85d982c51b
tdf#141391 sw: don't paste as nested table in first cell paragraph

Paste table content overwrote cells of the row(s) only if the text
cursor was at the beginning of the table cell, otherwise the table
cells on the clipboard were inserted as a nested table.

This was a UX regression from commit 7600a2942ce2b9dac66836105bed6620d55abec2
"fdo#37156 insert table copy as nested table in non-starting cell position"
especially when the user clicked not exactly at the beginning of a
cell, which containing a 1-line text or data.

Since commit 1e278d1d0cfb1d5375195aa764739f00633f21e8
"tdf#37156 Writer menu: Paste as Nested table" it's possible to
force nesting (but not overwriting yet), this commit revert partially
commit 7600a2942ce2b9dac66836105bed6620d55abec2: if the text cursor
is there in the first paragraph of the cell, Paste table content
overwrites the row, not embedding a nested table in the cell
at the cursor position. This change results also better interoperability
with the existing document editors.

Note: table and text selection were checked with the change, too.

Details:

Heuristics to allow copying table rows or nesting tables
without using Edit -> Paste Special -> Paste as Nested Table:

At "table selection" (i.e. when cell(s) completely selected),
or if the text selection starts in the first paragraph, or if
there is no selection and the text cursor is there in the first
paragraph, overwrite content of the cell(s). Otherwise insert
a nested table, i.e. if nothing selected and the cursor is not
in the first paragraph, or the selected text doesn't contain
the first paragraph of the cell.

Change-Id: I7746c6a464123bef6fb7dbff415ff0414e48365d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133377
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit b97116791047f89b768ab4aa8126e543df826be3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133402
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
sw/qa/extras/uiwriter/uiwriter3.cxx
sw/source/core/frmedt/fecopy.cxx