diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-06-10 11:59:00 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-06-24 16:14:41 +0200 |
commit | 5eb42c7cdf4111019634347b39c29992b6ff732f (patch) | |
tree | f4adf2bdfa15386348f53ca682f0c9891d036367 | |
parent | ff6911b3afdacc82ed6a42f3a7a1b852931840d0 (diff) |
tdf#132725 sw: SwUndoDelete: don't group if flys are be deleted
The fly would not be deleted by CanGrouping() but would be deleted later
in RedoImpl() via the IsAtStartOfSection() check so just force a new
Undo action in this case.
(regression from 91b2325808a75174f284c48c8b8afc118fad74e4
and 28b77c89dfcafae82cf2a6d85731b643ff9290e5)
Change-Id: I68f9f6b7fd0306bc0853a370b1030463a0024edc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96002
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
(cherry picked from commit 32c162ad1723512763b74d01eaec32c1296f3a55)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96037
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
(cherry picked from commit 5c2c03dde718b2bf627ef9ef8f985fc41454b1ab)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96102
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sw/source/core/undo/undel.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index b66c5ba2e5fc..f8e4fbd63478 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -562,6 +562,33 @@ bool SwUndoDelete::CanGrouping( SwDoc* pDoc, const SwPaM& rDelPam ) rCC.isLetterNumeric( *m_aSttStr, nUChrPos ) ) return false; + // tdf#132725 - if at-char/at-para flys would be deleted, don't group! + // DelContentIndex() would be called at the wrong time here, the indexes + // in the stored SwHistoryTextFlyCnt would be wrong when Undo is invoked + for (SwFrameFormat const*const pFly : *pDoc->GetSpzFrameFormats()) + { + SwFormatAnchor const& rAnchor(pFly->GetAnchor()); + switch (rAnchor.GetAnchorId()) + { + case RndStdIds::FLY_AT_CHAR: + case RndStdIds::FLY_AT_PARA: + { + SwPosition const*const pAnchorPos(rAnchor.GetContentAnchor()); + // can this really be null? + if (pAnchorPos != nullptr + && ((rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR) + ? IsDestroyFrameAnchoredAtChar(*pAnchorPos, *pStt, *pEnd) + : IsSelectFrameAnchoredAtPara(*pAnchorPos, *pStt, *pEnd))) + { + return false; + } + } + break; + default: // other types not relevant + break; + } + } + { SwRedlineSaveDatas aTmpSav; const bool bSaved = FillSaveData( rDelPam, aTmpSav, false ); |