[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 27 08:46:53 UTC 2020
sw/source/core/layout/fly.cxx | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
New commits:
commit 142dc93d9ad793e036baa5573aea31cb6f416f57
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Oct 26 16:41:29 2020 +0100
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue Oct 27 09:46:16 2020 +0100
(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 at cib.de>
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();
- }
}
}
}
More information about the Libreoffice-commits
mailing list