(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>
This commit is contained in:
Michael Stahl
2020-10-27 09:46:16 +01:00
committed by Michael Stahl
parent 7ae9e8b6ba
commit 142dc93d9a
+19 -15
View File
@@ -409,22 +409,26 @@ 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)
{
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
SwFlyFrame const*const pOldSelFly = ::GetFlyFromMarked(nullptr, &rCurrentShell);
if (pOldSelFly == this)
{
rCurrentShell.Imp()->GetDrawView()->UnmarkAll();
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
{
rCurrentShell.Imp()->GetDrawView()->UnmarkAll();
}
}
}
}