tdf#149029 Scroll to the selected object in the Animation panel on selecting

Change-Id: I2c14f9c6df74d4534c936b392f0e066dabebea9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134172
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 9dcde6d..db8bcf1 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -931,6 +931,8 @@ static void selectShape(weld::TreeView* pTreeList, const Reference< XShape >& xS
    if (!pTreeList->get_iter_first(*xEntry))
        return;

    bool bFirstEntry = true;

    do
    {
        CustomAnimationListEntryItem* pEntry = weld::fromId<CustomAnimationListEntryItem*>(pTreeList->get_id(*xEntry));
@@ -938,7 +940,14 @@ static void selectShape(weld::TreeView* pTreeList, const Reference< XShape >& xS
        if (pEffect)
        {
            if (pEffect->getTarget() == xShape)
            {
                pTreeList->select(*xEntry);
                if (bFirstEntry)
                {
                    pTreeList->scroll_to_row(*xEntry);
                    bFirstEntry = false;
                }
            }
        }
    } while (pTreeList->iter_next(*xEntry));
}