summaryrefslogtreecommitdiff
path: root/sw/inc/undobj.hxx
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-12-05 16:49:33 +0100
committerMichael Stahl <michael.stahl@cib.de>2019-12-06 13:26:32 +0100
commit91b2325808a75174f284c48c8b8afc118fad74e4 (patch)
treed456e57e6d0d0532592030cb0d3d20585b8fe7a4 /sw/inc/undobj.hxx
parent6ed12ab2d0742f86ce25defec3c776562dbfad9a (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. Change-Id: I168013665e70ff0a5f198e09f3fa3afc06ba0449 Reviewed-on: https://gerrit.libreoffice.org/84576 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/inc/undobj.hxx')
-rw-r--r--sw/inc/undobj.hxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index dc271d0cf94d..cde1e3a0ff35 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -135,7 +135,7 @@ enum class DelContentType : sal_uInt16
Fly = 0x02,
Bkm = 0x08,
AllMask = 0x0b,
- ExcludeAtCharFlyAtStartEnd = 0x40,
+ ExcludeFlyAtStartEnd = 0x40,
CheckNoCntnt = 0x80,
};
namespace o3tl {
@@ -146,6 +146,10 @@ namespace o3tl {
bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
SwPosition const & rStart, SwPosition const & rEnd,
DelContentType const nDelContentType = DelContentType::AllMask);
+/// is a fly anchored at paragraph at rAnchorPos selected?
+bool IsSelectFrameAnchoredAtPara(SwPosition const & rAnchorPos,
+ SwPosition const & rStart, SwPosition const & rEnd,
+ DelContentType const nDelContentType = DelContentType::AllMask);
// This class has to be inherited into an Undo-object if it saves content
// for Redo/Undo...