[Libreoffice-bugs] [Bug 139514] Delete one of both paragraph below a table deletes the table

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat Jan 9 16:11:56 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=139514

--- Comment #3 from Telesto <telesto at surfxs.nl> ---
Created attachment 168794
  --> https://bugs.documentfoundation.org/attachment.cgi?id=168794&action=edit
Bibisect log

Bisected to:
author  Michael Stahl <Michael.Stahl at cib.de>    2019-12-05 16:49:33 +0100
committer       Michael Stahl <michael.stahl at cib.de>    2019-12-06 13:26:32
+0100
commit  91b2325808a75174f284c48c8b8afc118fad74e4 (patch)
tree    d456e57e6d0d0532592030cb0d3d20585b8fe7a4
parent  6ed12ab2d0742f86ce25defec3c776562dbfad9a (diff)
tdf#121300 sw: consistent fly at-pargraph selection
As a follow-up to commit 28b77c89dfcafae82cf2a6d85731b643ff9290e5, add
IsSelectFrameAnchoredAtPara() function and use it to harmonize at-para
fly selection across all relevant operations:

* CopyImpl:
  - it had a pre-existing bugs that would lose a fly anchored to the
    2nd (1st fully selected) node of a redline
  - remove a bunch of code for finding the last node of the body content,
    which doesn't matter for the remaining at-fly checks
  - flys that already existed at the insert position need to have their
    anchors corrected

* DeleteRange:
  - get rid of the bDelFwrd checks

* MoveRange:
  - the ALLFLYS flag would be obsoleted by the new selection, were it
    not for the writerfiler "special hack", see below

* also adapt A11y and UI selection, SwRootFrame::CalcFrameRects()

The selection behavior is changed:

* the bDelFwrd case is quite odd, some code was checking whether a
  deletion was "forward" or "backward" and removing only the flys at the
  point node while retaining the flys at the mark node; this worked in a
  very non-obvious way relying on sw_GetJoinFlags actually calling
  Exchange() on the cursor, and then SwUndoDelete stored it in
  m_bJoinNext, but it turns out that only SwUndoMove also has a
  m_bJoinNext and it's dead, and no other Undo has such a flag, so this
  only worked for "delete". It's not obvious what the value of this is,
  let's just ignore the "direction".

* Selections exclude the start and end position except if it's a fully
  selected node or at the start or end of a section (i.e. Ctrl+A should
  also select every at-para fly).

* An exception is made in case the selection looks like it's a
  backspace/delete joining 2 paragraphs; flys are not deleted in that
  case because it seemed annoying (and as it happens, Word does not
  appear to delete flys in that case), particularly if both of the nodes
  are already empty. This is done with a heuristic, it's conceivable to
  pass down some flag from DelLeft()/DelRight() but probably this is
  good enough.

A special hack is needed to keep writerfilter happy for now; it likes to
anchor flys at nodes which it then deletes in RemoveLastParagraph(),
which likely could be improved there.  The ALLFLYS usage in
SwRangeRedline::MoveFromSection() could be removed (because the
end-of-section check already handles the case) except for this, because
it turns out that the ODF import runs SetRedlineFlags with a temporarily
reset IsInXMLImport() flag because of its effect in thints.cxx, so
during the move IsSelectFrameAnchoredAtPara() can't check it.

tdf#108124 scenario works better, now everything that's selected is both
copied and deleted.

Fixes the problem where an at-para fly at the 2nd node of a redline
where the 1st node is partially deleted was lost on ODF export.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=91b2325808a75174f284c48c8b8afc118fad74e4

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210109/7b23e920/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list