sd/source/ui/animations/CustomAnimationPane.cxx | 37 ++++++++++++++++-------- 1 file changed, 26 insertions(+), 11 deletions(-)
New commits: commit ba535d8cbda1026823ce9796c20f97b7367d581f Author: Caolán McNamara <[email protected]> AuthorDate: Mon Oct 11 15:09:18 2021 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Mon Oct 11 18:22:06 2021 +0200 tdf#145030 resync with empty selection if we unselected everything if we had something selected, but ended up unselecting everything then while the maSelectionLock is unlocked resync with the empty selection (git show -w) Change-Id: Idf3ad1ce93e4dcf94dc79332cbb431dc5d896988 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123420 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index 77850c52b887..a125838a07d5 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -2443,22 +2443,37 @@ void CustomAnimationPane::onSelect() if( maSelectionLock.isLocked() ) return; - ScopeLockGuard aGuard( maSelectionLock ); - DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >( - FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get()); - DrawView* pView = pViewShell ? pViewShell->GetDrawView() : nullptr; + bool bHadSelection = maViewSelection.hasValue(); + bool bHasSelection = bHadSelection; - if( pView ) { - pView->UnmarkAllObj(); - for( const CustomAnimationEffectPtr& pEffect : maListSelection ) + ScopeLockGuard aGuard( maSelectionLock ); + + DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >( + FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get()); + DrawView* pView = pViewShell ? pViewShell->GetDrawView() : nullptr; + + if (pView) { - Reference< XShape > xShape( pEffect->getTargetShape() ); - SdrObject* pObj = SdrObject::getSdrObjectFromXShape(xShape); - if( pObj ) - pView->MarkObj(pObj, pView->GetSdrPageView()); + pView->UnmarkAllObj(); + bHasSelection = false; + for( const CustomAnimationEffectPtr& pEffect : maListSelection ) + { + Reference< XShape > xShape( pEffect->getTargetShape() ); + SdrObject* pObj = SdrObject::getSdrObjectFromXShape(xShape); + if (pObj) + { + pView->MarkObj(pObj, pView->GetSdrPageView()); + bHasSelection = true; + } + } } } + + // tdf#145030 if we had something selected, but ended up unselecting everything + // then now while the maSelectionLock is unlocked resync with the empty selection + if (bHadSelection != bHasSelection) + onSelectionChanged(); } // ICustomAnimationListController
