diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-10-26 16:41:29 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-10-27 09:46:16 +0100 |
commit | 142dc93d9ad793e036baa5573aea31cb6f416f57 (patch) | |
tree | ff4e058b985745e2bf93646da05091114518ae90 | |
parent | 7ae9e8b6ba35dec2c556f6fac4034cd9bb1111a1 (diff) |
(related: tdf#131679) sw: only unmark if this SwFlyFrame is marked
Seems kind of pointless to unmark flys that aren't deleted.
SwFEShell::SelectObj() apparently guarantees that at most 1 SwFlyFrame
is marked.
Change-Id: I061fc640512192e6e0a916020e3ac0b91c75d5c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104818
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r-- | sw/source/core/layout/fly.cxx | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index d44af82f1eac..49f522c42d41 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -409,23 +409,27 @@ void SwFlyFrame::FinitDrawObj() if (rCurrentShell.HasDrawView() && rCurrentShell.Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount()) { - if (SwFEShell *const pFEShell = dynamic_cast<SwFEShell*>(&rCurrentShell)) - { // tdf#131679 move any cursor out of fly - SwFlyFrame const*const pOldSelFly = ::GetFlyFromMarked(nullptr, pFEShell); - rCurrentShell.Imp()->GetDrawView()->UnmarkAll(); - if (pOldSelFly) + SwFlyFrame const*const pOldSelFly = ::GetFlyFromMarked(nullptr, &rCurrentShell); + if (pOldSelFly == this) + { + assert(rCurrentShell.Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1); + if (SwFEShell *const pFEShell = dynamic_cast<SwFEShell*>(&rCurrentShell)) + { // tdf#131679 move any cursor out of fly + rCurrentShell.Imp()->GetDrawView()->UnmarkAll(); + if (pOldSelFly) + { + SwPosition const pos(ResolveFlyAnchor(*pOldSelFly->GetFormat())); + SwPaM const temp(pos); + pFEShell->SetSelection(temp); + // could also call SetCursor() like SwFEShell::SelectObj() + // does, but that would access layout a bit much... + } + } + else { - SwPosition const pos(ResolveFlyAnchor(*pOldSelFly->GetFormat())); - SwPaM const temp(pos); - pFEShell->SetSelection(temp); - // could also call SetCursor() like SwFEShell::SelectObj() - // does, but that would access layout a bit much... + rCurrentShell.Imp()->GetDrawView()->UnmarkAll(); } } - else - { - rCurrentShell.Imp()->GetDrawView()->UnmarkAll(); - } } } } |