Revert "tdf#145030 resync with empty selection if we unselected everything"

This reverts commit ba535d8cbda1026823ce9796c20f97b7367d581f.

Change-Id: I277e640c0f8ed0038e8ea867ddeef999a00b7b87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129242
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129248
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 3fe62f8..496b7ee 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -2446,37 +2446,22 @@ void CustomAnimationPane::onSelect()
    if( maSelectionLock.isLocked() )
        return;

    bool bHadSelection = maViewSelection.hasValue();
    bool bHasSelection = bHadSelection;
    ScopeLockGuard aGuard( maSelectionLock );
    DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
        FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
    DrawView* pView = pViewShell ? pViewShell->GetDrawView() : nullptr;

    if( pView )
    {
        ScopeLockGuard aGuard( maSelectionLock );

        DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
            FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
        DrawView* pView = pViewShell ? pViewShell->GetDrawView() : nullptr;

        if (pView)
        pView->UnmarkAllObj();
        for( const CustomAnimationEffectPtr& pEffect : maListSelection )
        {
            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;
                }
            }
            Reference< XShape > xShape( pEffect->getTargetShape() );
            SdrObject* pObj = SdrObject::getSdrObjectFromXShape(xShape);
            if( pObj )
                pView->MarkObj(pObj, pView->GetSdrPageView());
        }
    }

    // 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