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>
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 0ba193f..85b9867 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1563,10 +1563,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!
@@ -1574,7 +1579,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 a7713bc..2a4b489 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -169,7 +169,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