tdf#132597 sw: fix inconsistent handling of ExcludeFlyAtStartEnd
IsDestroyFrameAnchoredAtChar() checks the position but the only caller,
SwUndoInserts::UndoImpl(), really wants to exclude the entire nodes,
see IsCreateUndoForNewFly().
(regression from 28b77c89dfcafae82cf2a6d85731b643ff9290e5)
Change-Id: I763ad3b7d82af03f6910dcf34315f793d090c62e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95952
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
(cherry picked from commit f9fb86408e6e06c262332be26674305ae5c05bb7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95982
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index a73ceeb..e6a6d5a 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1560,10 +1560,15 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
return (rStart < rAnchorPos) && (rAnchorPos < rEnd);
}
if (nDelContentType & DelContentType::ExcludeFlyAtStartEnd)
{ // exclude selection start and end node
return (rAnchorPos.nNode < rEnd.nNode)
&& (rStart.nNode < rAnchorPos.nNode);
}
// in general, exclude the start and end position
return ((rStart < rAnchorPos)
|| (rStart == rAnchorPos
&& !(nDelContentType & DelContentType::ExcludeFlyAtStartEnd)
// special case: fully deleted node
&& ((rStart.nNode != rEnd.nNode && rStart.nContent == 0
// but not if the selection is backspace/delete!
@@ -1571,7 +1576,6 @@ bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
|| (IsAtStartOfSection(rAnchorPos) && IsAtEndOfSection(rEnd)))))
&& ((rAnchorPos < rEnd)
|| (rAnchorPos == rEnd
&& !(nDelContentType & DelContentType::ExcludeFlyAtStartEnd)
// special case: fully deleted node
&& ((rEnd.nNode != rStart.nNode && rEnd.nContent == rEnd.nNode.GetNode().GetTextNode()->Len()
&& IsNotBackspaceHeuristic(rStart, rEnd))
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index db586c6..134db46 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -170,7 +170,7 @@ bool SwUndoInserts::IsCreateUndoForNewFly(SwFormatAnchor const& rAnchor,
assert(nStartNode <= nEndNode);
// check all at-char flys at the start/end nodes:
// ExcludeAtCharFlyAtStartEnd will exclude them!
// ExcludeFlyAtStartEnd will exclude them!
SwPosition const*const pAnchorPos = rAnchor.GetContentAnchor();
return pAnchorPos != nullptr
&& ( rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA