[Libreoffice-commits] core.git: 2 commits - sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Feb 15 12:48:16 UTC 2019


 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx  |  144 ++---
 sd/source/ui/accessibility/AccessibleOutlineView.cxx       |   30 -
 sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx |   54 -
 sd/source/ui/accessibility/AccessibleSlideSorterView.cxx   |  108 +--
 sd/source/ui/animations/CustomAnimationDialog.cxx          |  310 +++++------
 sd/source/ui/animations/CustomAnimationList.cxx            |   33 -
 sd/source/ui/animations/CustomAnimationPane.cxx            |  365 ++++++-------
 sd/source/ui/animations/SlideTransitionPane.cxx            |   60 +-
 sd/source/ui/animations/motionpathtag.cxx                  |  312 +++++------
 sd/source/ui/annotations/annotationmanager.cxx             |  318 +++++------
 sd/source/ui/annotations/annotationtag.cxx                 |  224 +++----
 sd/source/ui/annotations/annotationwindow.cxx              |  148 ++---
 sd/source/ui/app/optsitem.cxx                              |  212 +++----
 sd/source/ui/app/sdmod1.cxx                                |  150 ++---
 sd/source/ui/app/tmplctrl.cxx                              |   62 +-
 sd/source/ui/controller/displaymodecontroller.cxx          |   25 
 sd/source/ui/dlg/LayerTabBar.cxx                           |   78 +-
 sd/source/ui/dlg/PaneDockingWindow.cxx                     |   32 -
 sd/source/ui/dlg/SpellDialogChildWindow.cxx                |   78 +-
 sd/source/ui/dlg/animobjs.cxx                              |  254 ++++-----
 sd/source/ui/dlg/filedlg.cxx                               |   42 -
 sd/source/ui/dlg/headerfooterdlg.cxx                       |  118 ++--
 sd/source/ui/dlg/navigatr.cxx                              |  136 ++--
 sd/source/ui/dlg/sdpreslt.cxx                              |  100 +--
 sd/source/ui/dlg/sdtreelb.cxx                              |  232 ++++----
 sd/source/ui/dlg/tpaction.cxx                              |   72 +-
 sd/source/ui/dlg/tpoption.cxx                              |   52 -
 sd/source/ui/docshell/docshel2.cxx                         |   36 -
 sd/source/ui/docshell/docshel4.cxx                         |  325 +++++------
 sd/source/ui/docshell/sdclient.cxx                         |  148 ++---
 30 files changed, 2136 insertions(+), 2122 deletions(-)

New commits:
commit 6d2c720dccc3a9d2d0dcaeaa7d6014b7acc5708f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Feb 14 09:12:41 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Feb 15 13:47:49 2019 +0100

    loplugin:flatten in sd/source/ui/[a-c]*
    
    Change-Id: I7e568e563d2097c7052dfd406396335f5ae36170
    Reviewed-on: https://gerrit.libreoffice.org/67836
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
index f86604ca3775..d7852eb6cda6 100644
--- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -620,78 +620,78 @@ void
     const SolarMutexGuard aSolarGuard;
     uno::Reference< view::XSelectionSupplier >  xSel( mxController, uno::UNO_QUERY );
 
-    if( xSel.is() )
+    if( !xSel.is() )
+        return;
+
+    uno::Any aAny;
+
+    if( ACCESSIBLE_SELECTION_CHILD_ALL == nAccessibleChildIndex )
     {
-        uno::Any aAny;
+        // Select or deselect all children.
 
-        if( ACCESSIBLE_SELECTION_CHILD_ALL == nAccessibleChildIndex )
+        if( !bSelect )
+            xSel->select( aAny );
+        else
         {
-            // Select or deselect all children.
+            uno::Reference< drawing::XShapes > xShapes = drawing::ShapeCollection::create(
+                    comphelper::getProcessComponentContext());
 
-            if( !bSelect )
-                xSel->select( aAny );
-            else
+            for(sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
             {
-                uno::Reference< drawing::XShapes > xShapes = drawing::ShapeCollection::create(
-                        comphelper::getProcessComponentContext());
+                AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( i ) );
 
-                for(sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
-                {
-                    AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( i ) );
-
-                    if( pAcc && pAcc->GetXShape().is() )
-                        xShapes->add( pAcc->GetXShape() );
-                }
+                if( pAcc && pAcc->GetXShape().is() )
+                    xShapes->add( pAcc->GetXShape() );
+            }
 
-                if( xShapes->getCount() )
-                {
-                    xSel->select( Any(xShapes) );
-                }
+            if( xShapes->getCount() )
+            {
+                xSel->select( Any(xShapes) );
             }
         }
-        else if( nAccessibleChildIndex >= 0 )
-        {
-            // Select or deselect only the child with index
-            // nAccessibleChildIndex.
+    }
+    else if( nAccessibleChildIndex >= 0 )
+    {
+        // Select or deselect only the child with index
+        // nAccessibleChildIndex.
 
-            AccessibleShape* pAcc = AccessibleShape::getImplementation(
-                getAccessibleChild( nAccessibleChildIndex ));
+        AccessibleShape* pAcc = AccessibleShape::getImplementation(
+            getAccessibleChild( nAccessibleChildIndex ));
 
-            // Add or remove the shape that is made accessible from the
-            // selection of the controller.
-            if( pAcc )
-            {
-                uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() );
+        // Add or remove the shape that is made accessible from the
+        // selection of the controller.
+        if( pAcc )
+        {
+            uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() );
 
-                if( xShape.is() )
-                {
-                    uno::Reference< drawing::XShapes >  xShapes;
-                    bool                            bFound = false;
+            if( xShape.is() )
+            {
+                uno::Reference< drawing::XShapes >  xShapes;
+                bool                            bFound = false;
 
-                    aAny = xSel->getSelection();
-                    aAny >>= xShapes;
+                aAny = xSel->getSelection();
+                aAny >>= xShapes;
 
-                    // Search shape to be selected in current selection.
-                    if (xShapes.is())
-                    {
-                        sal_Int32 nCount = xShapes->getCount();
-                        for (sal_Int32 i=0; ( i < nCount ) && !bFound; ++i )
-                            if( xShapes->getByIndex( i ) == xShape )
-                                bFound = true;
-                    }
-                    else
-                        // Create an empty selection to add the shape to.
-                        xShapes = drawing::ShapeCollection::create(
-                                comphelper::getProcessComponentContext());
-
-                    // Update the selection.
-                    if( !bFound && bSelect )
-                        xShapes->add( xShape );
-                    else if( bFound && !bSelect )
-                        xShapes->remove( xShape );
-
-                    xSel->select( Any(xShapes) );
+                // Search shape to be selected in current selection.
+                if (xShapes.is())
+                {
+                    sal_Int32 nCount = xShapes->getCount();
+                    for (sal_Int32 i=0; ( i < nCount ) && !bFound; ++i )
+                        if( xShapes->getByIndex( i ) == xShape )
+                            bFound = true;
                 }
+                else
+                    // Create an empty selection to add the shape to.
+                    xShapes = drawing::ShapeCollection::create(
+                            comphelper::getProcessComponentContext());
+
+                // Update the selection.
+                if( !bFound && bSelect )
+                    xShapes->add( xShape );
+                else if( bFound && !bSelect )
+                    xShapes->remove( xShape );
+
+                xSel->select( Any(xShapes) );
             }
         }
     }
@@ -699,23 +699,23 @@ void
 
 void AccessibleDrawDocumentView::Activated()
 {
-    if (mpChildrenManager != nullptr)
+    if (mpChildrenManager == nullptr)
+        return;
+
+    bool bChange = false;
+    // When none of the children has the focus then claim it for the
+    // view.
+    if ( ! mpChildrenManager->HasFocus())
     {
-        bool bChange = false;
-        // When none of the children has the focus then claim it for the
-        // view.
-        if ( ! mpChildrenManager->HasFocus())
-        {
-            SetState (AccessibleStateType::FOCUSED);
-            bChange = true;
-        }
-        else
-            ResetState (AccessibleStateType::FOCUSED);
-        mpChildrenManager->UpdateSelection();
-        // if the child gets focus in UpdateSelection(), needs to reset the focus on document.
-        if (mpChildrenManager->HasFocus() && bChange)
-            ResetState (AccessibleStateType::FOCUSED);
+        SetState (AccessibleStateType::FOCUSED);
+        bChange = true;
     }
+    else
+        ResetState (AccessibleStateType::FOCUSED);
+    mpChildrenManager->UpdateSelection();
+    // if the child gets focus in UpdateSelection(), needs to reset the focus on document.
+    if (mpChildrenManager->HasFocus() && bChange)
+        ResetState (AccessibleStateType::FOCUSED);
 }
 
 void AccessibleDrawDocumentView::Deactivated()
diff --git a/sd/source/ui/accessibility/AccessibleOutlineView.cxx b/sd/source/ui/accessibility/AccessibleOutlineView.cxx
index 1e71a03cc8ae..9e165b4c2686 100644
--- a/sd/source/ui/accessibility/AccessibleOutlineView.cxx
+++ b/sd/source/ui/accessibility/AccessibleOutlineView.cxx
@@ -70,23 +70,23 @@ AccessibleOutlineView::AccessibleOutlineView (
 
     // Beware! Here we leave the paths of the UNO API and descend into the
     // depths of the core.  Necessary for making the edit engine accessible.
-    if (pSdWindow)
-    {
-        ::sd::View* pView = pViewShell->GetView();
+    if (!pSdWindow)
+        return;
 
-        if (dynamic_cast<const ::sd::OutlineView* >( pView ) !=  nullptr)
-        {
-            OutlinerView* pOutlineView = static_cast< ::sd::OutlineView*>(
-                pView)->GetViewByWindow( pSdWindow );
-            SdrOutliner& rOutliner =
-                static_cast< ::sd::OutlineView*>(pView)->GetOutliner();
+    ::sd::View* pView = pViewShell->GetView();
 
-            if( pOutlineView )
-            {
-                maTextHelper.SetEditSource( ::std::unique_ptr< SvxEditSource >( new AccessibleOutlineEditSource(
-                                                                                  rOutliner, *pView, *pOutlineView, *pSdWindow ) ) );
-            }
-        }
+    if (dynamic_cast<const ::sd::OutlineView* >( pView ) ==  nullptr)
+        return;
+
+    OutlinerView* pOutlineView = static_cast< ::sd::OutlineView*>(
+        pView)->GetViewByWindow( pSdWindow );
+    SdrOutliner& rOutliner =
+        static_cast< ::sd::OutlineView*>(pView)->GetOutliner();
+
+    if( pOutlineView )
+    {
+        maTextHelper.SetEditSource( ::std::unique_ptr< SvxEditSource >( new AccessibleOutlineEditSource(
+                                                                          rOutliner, *pView, *pOutlineView, *pSdWindow ) ) );
     }
 }
 
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
index 50358ef51b90..63ab93880137 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
@@ -233,21 +233,21 @@ lang::Locale SAL_CALL AccessibleSlideSorterObject::getLocale()
 void SAL_CALL AccessibleSlideSorterObject::addAccessibleEventListener(
     const Reference<XAccessibleEventListener>& rxListener)
 {
-    if (rxListener.is())
-    {
-        const osl::MutexGuard aGuard(maMutex);
+    if (!rxListener.is())
+        return;
 
-        if (IsDisposed())
-        {
-            uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
-            rxListener->disposing (lang::EventObject (x));
-        }
-        else
-        {
-            if (mnClientId == 0)
-                mnClientId = comphelper::AccessibleEventNotifier::registerClient();
-            comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
-        }
+    const osl::MutexGuard aGuard(maMutex);
+
+    if (IsDisposed())
+    {
+        uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
+        rxListener->disposing (lang::EventObject (x));
+    }
+    else
+    {
+        if (mnClientId == 0)
+            mnClientId = comphelper::AccessibleEventNotifier::registerClient();
+        comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
     }
 }
 
@@ -255,20 +255,20 @@ void SAL_CALL AccessibleSlideSorterObject::removeAccessibleEventListener(
     const Reference<XAccessibleEventListener>& rxListener)
 {
     ThrowIfDisposed();
-    if (rxListener.is() && mnClientId)
-    {
-        const osl::MutexGuard aGuard(maMutex);
+    if (!(rxListener.is() && mnClientId))
+        return;
 
-        sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
-        if ( !nListenerCount )
-        {
-            // no listeners anymore
-            // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
-            // and at least to us not firing any events anymore, in case somebody calls
-            // NotifyAccessibleEvent, again
-            comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
-            mnClientId = 0;
-        }
+    const osl::MutexGuard aGuard(maMutex);
+
+    sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
+    if ( !nListenerCount )
+    {
+        // no listeners anymore
+        // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+        // and at least to us not firing any events anymore, in case somebody calls
+        // NotifyAccessibleEvent, again
+        comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+        mnClientId = 0;
     }
 }
 
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index ef6b37566a0c..401faab3cebf 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -320,21 +320,21 @@ lang::Locale SAL_CALL AccessibleSlideSorterView::getLocale()
 void SAL_CALL AccessibleSlideSorterView::addAccessibleEventListener(
     const Reference<XAccessibleEventListener >& rxListener)
 {
-    if (rxListener.is())
-    {
-        const osl::MutexGuard aGuard(maMutex);
+    if (!rxListener.is())
+        return;
 
-        if (rBHelper.bDisposed || rBHelper.bInDispose)
-        {
-            uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
-            rxListener->disposing (lang::EventObject (x));
-        }
-        else
-        {
-            if ( ! mnClientId)
-                mnClientId = comphelper::AccessibleEventNotifier::registerClient();
-            comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
-        }
+    const osl::MutexGuard aGuard(maMutex);
+
+    if (rBHelper.bDisposed || rBHelper.bInDispose)
+    {
+        uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
+        rxListener->disposing (lang::EventObject (x));
+    }
+    else
+    {
+        if ( ! mnClientId)
+            mnClientId = comphelper::AccessibleEventNotifier::registerClient();
+        comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
     }
 }
 
@@ -342,24 +342,24 @@ void SAL_CALL AccessibleSlideSorterView::removeAccessibleEventListener(
     const Reference<XAccessibleEventListener >& rxListener)
 {
     ThrowIfDisposed();
-    if (rxListener.is())
-    {
-        const osl::MutexGuard aGuard(maMutex);
+    if (!rxListener.is())
+        return;
 
-        if (mnClientId != 0)
-        {
-            sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener(
-                mnClientId, rxListener );
-            if ( !nListenerCount )
-            {
-                // no listeners anymore -> revoke ourself. This may lead to
-                // the notifier thread dying (if we were the last client),
-                // and at least to us not firing any events anymore, in case
-                // somebody calls NotifyAccessibleEvent, again
-                comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
-                mnClientId = 0;
-            }
-        }
+    const osl::MutexGuard aGuard(maMutex);
+
+    if (mnClientId == 0)
+        return;
+
+    sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener(
+        mnClientId, rxListener );
+    if ( !nListenerCount )
+    {
+        // no listeners anymore -> revoke ourself. This may lead to
+        // the notifier thread dying (if we were the last client),
+        // and at least to us not firing any events anymore, in case
+        // somebody calls NotifyAccessibleEvent, again
+        comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+        mnClientId = 0;
     }
 }
 
@@ -903,35 +903,35 @@ IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, FocusChangeListener,
 
     // add a checker whether the focus event is sent out. Only after sent, the mnFocusedIndex should be updated.
     bool bSentFocus = false;
-    if (nNewFocusedIndex != mnFocusedIndex)
+    if (nNewFocusedIndex == mnFocusedIndex)
+        return;
+
+    if (mnFocusedIndex >= 0)
     {
-        if (mnFocusedIndex >= 0)
+        AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex);
+        if (pObject != nullptr)
         {
-            AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex);
-            if (pObject != nullptr)
-            {
-                pObject->FireAccessibleEvent(
-                    AccessibleEventId::STATE_CHANGED,
-                    Any(AccessibleStateType::FOCUSED),
-                    Any());
-                bSentFocus = true;
-            }
+            pObject->FireAccessibleEvent(
+                AccessibleEventId::STATE_CHANGED,
+                Any(AccessibleStateType::FOCUSED),
+                Any());
+            bSentFocus = true;
         }
-        if (nNewFocusedIndex >= 0)
+    }
+    if (nNewFocusedIndex >= 0)
+    {
+        AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex);
+        if (pObject != nullptr)
         {
-            AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex);
-            if (pObject != nullptr)
-            {
-                pObject->FireAccessibleEvent(
-                    AccessibleEventId::STATE_CHANGED,
-                    Any(),
-                    Any(AccessibleStateType::FOCUSED));
-                bSentFocus = true;
-            }
+            pObject->FireAccessibleEvent(
+                AccessibleEventId::STATE_CHANGED,
+                Any(),
+                Any(AccessibleStateType::FOCUSED));
+            bSentFocus = true;
         }
-        if (bSentFocus)
-            mnFocusedIndex = nNewFocusedIndex;
     }
+    if (bSentFocus)
+        mnFocusedIndex = nNewFocusedIndex;
 }
 
 IMPL_LINK_NOARG(AccessibleSlideSorterView::Implementation, UpdateChildrenCallback, void*, void)
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index cc62a28e169c..6581de2a0f05 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -129,35 +129,35 @@ IMPL_LINK_NOARG(PresetPropertyBox, OnSelect, ListBox&, void)
 
 void PresetPropertyBox::setValue( const Any& rValue, const OUString& rPresetId )
 {
-    if( mpControl )
-    {
-        mpControl->Clear();
+    if( !mpControl )
+        return;
 
-        const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
-        CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( rPresetId );
-        if( pDescriptor.get() )
-        {
+    mpControl->Clear();
 
-            OUString aPropertyValue;
-            rValue >>= aPropertyValue;
+    const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
+    CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( rPresetId );
+    if( pDescriptor.get() )
+    {
 
-            std::vector<OUString> aSubTypes( pDescriptor->getSubTypes() );
+        OUString aPropertyValue;
+        rValue >>= aPropertyValue;
 
-            mpControl->Enable( !aSubTypes.empty() );
+        std::vector<OUString> aSubTypes( pDescriptor->getSubTypes() );
 
-            for( auto& aSubType : aSubTypes )
-            {
-                sal_Int32 nPos = mpControl->InsertEntry( rPresets.getUINameForProperty( aSubType ) );
-                if( aSubType == aPropertyValue )
-                    mpControl->SelectEntryPos( nPos );
-                maPropertyValues[nPos] = aSubType;
-            }
-        }
-        else
+        mpControl->Enable( !aSubTypes.empty() );
+
+        for( auto& aSubType : aSubTypes )
         {
-            mpControl->Enable( false );
+            sal_Int32 nPos = mpControl->InsertEntry( rPresets.getUINameForProperty( aSubType ) );
+            if( aSubType == aPropertyValue )
+                mpControl->SelectEntryPos( nPos );
+            maPropertyValues[nPos] = aSubType;
         }
     }
+    else
+    {
+        mpControl->Enable( false );
+    }
 }
 
 PresetPropertyBox::~PresetPropertyBox()
@@ -214,40 +214,40 @@ IMPL_LINK_NOARG(SdPresetPropertyBox, OnSelect, weld::ComboBox&, void)
 
 void SdPresetPropertyBox::setValue( const Any& rValue, const OUString& rPresetId )
 {
-    if (mxControl)
-    {
-        mxControl->freeze();
-        mxControl->clear();
-        int nPos = -1;
+    if (!mxControl)
+        return;
 
-        const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
-        CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( rPresetId );
-        if( pDescriptor.get() )
-        {
+    mxControl->freeze();
+    mxControl->clear();
+    int nPos = -1;
 
-            OUString aPropertyValue;
-            rValue >>= aPropertyValue;
+    const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();
+    CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( rPresetId );
+    if( pDescriptor.get() )
+    {
 
-            std::vector<OUString> aSubTypes( pDescriptor->getSubTypes() );
+        OUString aPropertyValue;
+        rValue >>= aPropertyValue;
 
-            mxControl->set_sensitive(!aSubTypes.empty());
+        std::vector<OUString> aSubTypes( pDescriptor->getSubTypes() );
 
-            for( auto& aSubType : aSubTypes )
-            {
-                mxControl->append_text(rPresets.getUINameForProperty(aSubType));
-                maPropertyValues.push_back(aSubType);
-                if (aSubType == aPropertyValue)
-                    nPos = maPropertyValues.size() - 1;
-            }
-        }
-        else
+        mxControl->set_sensitive(!aSubTypes.empty());
+
+        for( auto& aSubType : aSubTypes )
         {
-            mxControl->set_sensitive(false);
+            mxControl->append_text(rPresets.getUINameForProperty(aSubType));
+            maPropertyValues.push_back(aSubType);
+            if (aSubType == aPropertyValue)
+                nPos = maPropertyValues.size() - 1;
         }
-        mxControl->thaw();
-        if (nPos != -1)
-            mxControl->set_active(nPos);
     }
+    else
+    {
+        mxControl->set_sensitive(false);
+    }
+    mxControl->thaw();
+    if (nPos != -1)
+        mxControl->set_active(nPos);
 }
 
 Any SdPresetPropertyBox::getValue()
@@ -1266,41 +1266,41 @@ IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb, void )
 
 void ScalePropertyBox::setValue( const Any& rValue, const OUString& )
 {
-    if( mpMetric.get() )
-    {
-        ValuePair aValues;
-        rValue >>= aValues;
+    if( !mpMetric.get() )
+        return;
 
-        double fValue1 = 0.0;
-        double fValue2 = 0.0;
+    ValuePair aValues;
+    rValue >>= aValues;
 
-        aValues.First >>= fValue1;
-        aValues.Second >>= fValue2;
+    double fValue1 = 0.0;
+    double fValue2 = 0.0;
 
-        if( fValue2 == 0.0 )
-            mnDirection = 1;
-        else if( fValue1 == 0.0 )
-            mnDirection = 2;
-        else
-            mnDirection = 3;
-
-        // Shrink animation is represented by negative value
-        // Shrink factor is calculated as (1 + $fValue)
-        // e.g 1 + (-0.75) = 0.25 => shrink to 25% of the size
-        // 0.25 = -0.75 + 1
-        if ( fValue1 < 0.0 )
-            fValue1 += 1;
-        if ( fValue2 < 0.0 )
-            fValue2 += 1;
-
-        long nValue;
-        if( fValue1 )
-            nValue = static_cast<long>(fValue1 * 100.0);
-        else
-            nValue = static_cast<long>(fValue2 * 100.0);
-        mpMetric->SetValue( nValue );
-        updateMenu();
-    }
+    aValues.First >>= fValue1;
+    aValues.Second >>= fValue2;
+
+    if( fValue2 == 0.0 )
+        mnDirection = 1;
+    else if( fValue1 == 0.0 )
+        mnDirection = 2;
+    else
+        mnDirection = 3;
+
+    // Shrink animation is represented by negative value
+    // Shrink factor is calculated as (1 + $fValue)
+    // e.g 1 + (-0.75) = 0.25 => shrink to 25% of the size
+    // 0.25 = -0.75 + 1
+    if ( fValue1 < 0.0 )
+        fValue1 += 1;
+    if ( fValue2 < 0.0 )
+        fValue2 += 1;
+
+    long nValue;
+    if( fValue1 )
+        nValue = static_cast<long>(fValue1 * 100.0);
+    else
+        nValue = static_cast<long>(fValue2 * 100.0);
+    mpMetric->SetValue( nValue );
+    updateMenu();
 }
 
 Any ScalePropertyBox::getValue()
@@ -1430,41 +1430,41 @@ IMPL_LINK(SdScalePropertyBox, implMenuSelectHdl, const OString&, rIdent, void)
 
 void SdScalePropertyBox::setValue(const Any& rValue, const OUString&)
 {
-    if (mxMetric)
-    {
-        ValuePair aValues;
-        rValue >>= aValues;
+    if (!mxMetric)
+        return;
 
-        double fValue1 = 0.0;
-        double fValue2 = 0.0;
+    ValuePair aValues;
+    rValue >>= aValues;
 
-        aValues.First >>= fValue1;
-        aValues.Second >>= fValue2;
+    double fValue1 = 0.0;
+    double fValue2 = 0.0;
 
-        if( fValue2 == 0.0 )
-            mnDirection = 1;
-        else if( fValue1 == 0.0 )
-            mnDirection = 2;
-        else
-            mnDirection = 3;
-
-        // Shrink animation is represented by negative value
-        // Shrink factor is calculated as (1 + $fValue)
-        // e.g 1 + (-0.75) = 0.25 => shrink to 25% of the size
-        // 0.25 = -0.75 + 1
-        if ( fValue1 < 0.0 )
-            fValue1 += 1;
-        if ( fValue2 < 0.0 )
-            fValue2 += 1;
-
-        long nValue;
-        if( fValue1 )
-            nValue = static_cast<long>(fValue1 * 100.0);
-        else
-            nValue = static_cast<long>(fValue2 * 100.0);
-        mxMetric->set_value(nValue, FieldUnit::PERCENT);
-        updateMenu();
-    }
+    aValues.First >>= fValue1;
+    aValues.Second >>= fValue2;
+
+    if( fValue2 == 0.0 )
+        mnDirection = 1;
+    else if( fValue1 == 0.0 )
+        mnDirection = 2;
+    else
+        mnDirection = 3;
+
+    // Shrink animation is represented by negative value
+    // Shrink factor is calculated as (1 + $fValue)
+    // e.g 1 + (-0.75) = 0.25 => shrink to 25% of the size
+    // 0.25 = -0.75 + 1
+    if ( fValue1 < 0.0 )
+        fValue1 += 1;
+    if ( fValue2 < 0.0 )
+        fValue2 += 1;
+
+    long nValue;
+    if( fValue1 )
+        nValue = static_cast<long>(fValue1 * 100.0);
+    else
+        nValue = static_cast<long>(fValue2 * 100.0);
+    mxMetric->set_value(nValue, FieldUnit::PERCENT);
+    updateMenu();
 }
 
 Any SdScalePropertyBox::getValue()
@@ -2126,31 +2126,31 @@ void CustomAnimationEffectTabPage::update( STLPropertySet* pSet )
     }
 
     nPos = mxLBSound->get_active();
-    if (nPos != -1)
-    {
-        Any aNewSoundURL, aOldSoundURL( makeAny( sal_Int32(0) ) );
+    if (nPos == -1)
+        return;
 
-        if( nPos == 0 )
-        {
-            // 0 means no sound, so leave any empty
-        }
-        else if( nPos == 1 )
-        {
-            // this means stop sound
-            aNewSoundURL <<= true;
-        }
-        else
-        {
-            OUString aSoundURL( maSoundList[ nPos-2 ] );
-            aNewSoundURL <<= aSoundURL;
-        }
+    Any aNewSoundURL, aOldSoundURL( makeAny( sal_Int32(0) ) );
 
-        if( mpSet->getPropertyState( nHandleSoundURL ) != STLPropertyState::Ambiguous )
-            aOldSoundURL = mpSet->getPropertyValue( nHandleSoundURL  );
-
-        if( aNewSoundURL != aOldSoundURL )
-            pSet->setPropertyValue( nHandleSoundURL, aNewSoundURL );
+    if( nPos == 0 )
+    {
+        // 0 means no sound, so leave any empty
     }
+    else if( nPos == 1 )
+    {
+        // this means stop sound
+        aNewSoundURL <<= true;
+    }
+    else
+    {
+        OUString aSoundURL( maSoundList[ nPos-2 ] );
+        aNewSoundURL <<= aSoundURL;
+    }
+
+    if( mpSet->getPropertyState( nHandleSoundURL ) != STLPropertyState::Ambiguous )
+        aOldSoundURL = mpSet->getPropertyValue( nHandleSoundURL  );
+
+    if( aNewSoundURL != aOldSoundURL )
+        pSet->setPropertyValue( nHandleSoundURL, aNewSoundURL );
 }
 
 void CustomAnimationEffectTabPage::fillSoundListBox()
@@ -2416,33 +2416,33 @@ CustomAnimationDurationTabPage::CustomAnimationDurationTabPage(weld::Container*
 
     Reference< XDrawPage > xCurrentPage;
     pSet->getPropertyValue( nHandleCurrentPage ) >>= xCurrentPage;
-    if( xCurrentPage.is() )
-    {
-        const OUString aStrIsEmptyPresObj( "IsEmptyPresentationObject" );
+    if( !xCurrentPage.is() )
+        return;
 
-        sal_Int32 nShape, nCount = xCurrentPage->getCount();
-        for( nShape = 0; nShape < nCount; nShape++ )
-        {
-            Reference< XShape > xShape( xCurrentPage->getByIndex( nShape ), UNO_QUERY );
+    const OUString aStrIsEmptyPresObj( "IsEmptyPresentationObject" );
 
-            if( !xShape.is() )
-                continue;
+    sal_Int32 nShape, nCount = xCurrentPage->getCount();
+    for( nShape = 0; nShape < nCount; nShape++ )
+    {
+        Reference< XShape > xShape( xCurrentPage->getByIndex( nShape ), UNO_QUERY );
 
-            Reference< XPropertySet > xSet( xShape, UNO_QUERY );
-            if( xSet.is() && xSet->getPropertySetInfo()->hasPropertyByName( aStrIsEmptyPresObj ) )
-            {
-                bool bIsEmpty = false;
-                xSet->getPropertyValue( aStrIsEmptyPresObj ) >>= bIsEmpty;
-                if( bIsEmpty )
-                    continue;
-            }
+        if( !xShape.is() )
+            continue;
 
-            OUString aDescription( getShapeDescription( xShape, true ) );
-            mxLBTrigger->append(OUString::number(nShape), aDescription);
-            auto nPos = mxLBTrigger->get_count() - 1;
-            if (xShape == xTrigger)
-                mxLBTrigger->set_active(nPos);
+        Reference< XPropertySet > xSet( xShape, UNO_QUERY );
+        if( xSet.is() && xSet->getPropertySetInfo()->hasPropertyByName( aStrIsEmptyPresObj ) )
+        {
+            bool bIsEmpty = false;
+            xSet->getPropertyValue( aStrIsEmptyPresObj ) >>= bIsEmpty;
+            if( bIsEmpty )
+                continue;
         }
+
+        OUString aDescription( getShapeDescription( xShape, true ) );
+        mxLBTrigger->append(OUString::number(nShape), aDescription);
+        auto nPos = mxLBTrigger->get_count() - 1;
+        if (xShape == xTrigger)
+            mxLBTrigger->set_active(nPos);
     }
 }
 
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 306aaecfd15b..659d622a3ffe 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -1002,7 +1002,10 @@ void CustomAnimationList::append( CustomAnimationEffectPtr pEffect )
     OUString aDescription;
 
     Any aTarget( pEffect->getTarget() );
-    if( aTarget.hasValue() ) try
+    if( !aTarget.hasValue() )
+        return;
+
+    try
     {
         aDescription = getDescription( aTarget, pEffect->getTargetSubItem() != ShapeAnimationSubType::ONLY_BACKGROUND );
 
@@ -1239,24 +1242,24 @@ void CustomAnimationList::Paint(vcl::RenderContext& rRenderContext, const ::tool
     SvTreeListBox::Paint(rRenderContext, rRect);
 
     // draw help text if list box is still empty
-    if( First() == nullptr )
-    {
-        Color aOldColor(rRenderContext.GetTextColor());
-        rRenderContext.SetTextColor(rRenderContext.GetSettings().GetStyleSettings().GetDisableColor());
-        ::Point aOffset(rRenderContext.LogicToPixel(Point(6, 6), MapMode(MapUnit::MapAppFont)));
+    if( First() != nullptr )
+        return;
 
-        ::tools::Rectangle aRect(Point(0,0), GetOutputSizePixel());
+    Color aOldColor(rRenderContext.GetTextColor());
+    rRenderContext.SetTextColor(rRenderContext.GetSettings().GetStyleSettings().GetDisableColor());
+    ::Point aOffset(rRenderContext.LogicToPixel(Point(6, 6), MapMode(MapUnit::MapAppFont)));
 
-        aRect.AdjustLeft(aOffset.X() );
-        aRect.AdjustTop(aOffset.Y() );
-        aRect.AdjustRight( -(aOffset.X()) );
-        aRect.AdjustBottom( -(aOffset.Y()) );
+    ::tools::Rectangle aRect(Point(0,0), GetOutputSizePixel());
 
-        rRenderContext.DrawText(aRect, SdResId(STR_CUSTOMANIMATION_LIST_HELPTEXT),
-                                DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | DrawTextFlags::Center | DrawTextFlags::VCenter );
+    aRect.AdjustLeft(aOffset.X() );
+    aRect.AdjustTop(aOffset.Y() );
+    aRect.AdjustRight( -(aOffset.X()) );
+    aRect.AdjustBottom( -(aOffset.Y()) );
 
-        rRenderContext.SetTextColor(aOldColor);
-    }
+    rRenderContext.DrawText(aRect, SdResId(STR_CUSTOMANIMATION_LIST_HELPTEXT),
+                            DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | DrawTextFlags::Center | DrawTextFlags::VCenter );
+
+    rRenderContext.SetTextColor(aOldColor);
 }
 
 }
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index dad65336ab45..a7e55e344648 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -842,21 +842,21 @@ void CustomAnimationPane::updateMotionPathTags()
 
 void CustomAnimationPane::onSelectionChanged()
 {
-    if( !maSelectionLock.isLocked() )
-    {
-        ScopeLockGuard aGuard( maSelectionLock );
+    if( maSelectionLock.isLocked() )
+        return;
 
-        if( mxView.is() ) try
-        {
-            Reference< XSelectionSupplier >  xSel( mxView, UNO_QUERY_THROW );
-            maViewSelection = xSel->getSelection();
-            mpCustomAnimationList->onSelectionChanged( maViewSelection );
-            updateControls();
-        }
-        catch( Exception& )
-        {
-            OSL_FAIL( "sd::CustomAnimationPane::onSelectionChanged(), Exception caught!" );
-        }
+    ScopeLockGuard aGuard( maSelectionLock );
+
+    if( mxView.is() ) try
+    {
+        Reference< XSelectionSupplier >  xSel( mxView, UNO_QUERY_THROW );
+        maViewSelection = xSel->getSelection();
+        mpCustomAnimationList->onSelectionChanged( maViewSelection );
+        updateControls();
+    }
+    catch( Exception& )
+    {
+        OSL_FAIL( "sd::CustomAnimationPane::onSelectionChanged(), Exception caught!" );
     }
 }
 
@@ -891,19 +891,19 @@ void CustomAnimationPane::DataChanged (const DataChangedEvent&)
 
 void CustomAnimationPane::UpdateLook()
 {
-    if( !mbHorizontal )
-    {
-        Wallpaper aBackground (
-            ::sfx2::sidebar::Theme::GetWallpaper(
-                ::sfx2::sidebar::Theme::Paint_PanelBackground));
-        SetBackground(aBackground);
-        if (mpFTStart != nullptr)
-            mpFTStart->SetBackground(aBackground);
-        if (mpFTProperty != nullptr)
-            mpFTProperty->SetBackground(aBackground);
-        if (mpFTDuration != nullptr)
-            mpFTDuration->SetBackground(aBackground);
-    }
+    if( mbHorizontal )
+        return;
+
+    Wallpaper aBackground (
+        ::sfx2::sidebar::Theme::GetWallpaper(
+            ::sfx2::sidebar::Theme::Paint_PanelBackground));
+    SetBackground(aBackground);
+    if (mpFTStart != nullptr)
+        mpFTStart->SetBackground(aBackground);
+    if (mpFTProperty != nullptr)
+        mpFTProperty->SetBackground(aBackground);
+    if (mpFTDuration != nullptr)
+        mpFTDuration->SetBackground(aBackground);
 }
 
 static void addValue( const std::unique_ptr<STLPropertySet>& pSet, sal_Int32 nHandle, const Any& rValue )
@@ -1659,7 +1659,10 @@ void CustomAnimationPane::showOptions(const OString& rPage)
 
 void CustomAnimationPane::onChangeCurrentPage()
 {
-    if( mxView.is() ) try
+    if( !mxView.is() )
+        return;
+
+    try
     {
         Reference< XDrawPage > xNewPage( mxView->getCurrentPage() );
         if( xNewPage != mxCurrentPage )
@@ -1863,23 +1866,23 @@ void CustomAnimationPane::onAdd()
 
 void CustomAnimationPane::onRemove()
 {
-   if( !maListSelection.empty() )
-    {
-        addUndo();
+    if( maListSelection.empty() )
+        return;
 
-        MainSequenceRebuildGuard aGuard( mpMainSequence );
+    addUndo();
 
-        EffectSequence aList( maListSelection );
+    MainSequenceRebuildGuard aGuard( mpMainSequence );
 
-        for( CustomAnimationEffectPtr& pEffect : aList )
-        {
-            if( pEffect->getEffectSequence() )
-                pEffect->getEffectSequence()->remove( pEffect );
-        }
+    EffectSequence aList( maListSelection );
 
-        maListSelection.clear();
-        mrBase.GetDocShell()->SetModified();
+    for( CustomAnimationEffectPtr& pEffect : aList )
+    {
+        if( pEffect->getEffectSequence() )
+            pEffect->getEffectSequence()->remove( pEffect );
     }
+
+    maListSelection.clear();
+    mrBase.GetDocShell()->SetModified();
 }
 
 void CustomAnimationPane::remove( CustomAnimationEffectPtr const & pEffect )
@@ -1894,20 +1897,20 @@ void CustomAnimationPane::remove( CustomAnimationEffectPtr const & pEffect )
 
 void CustomAnimationPane::onChangeStart()
 {
-    if( mpLBStart->GetSelectedEntryCount() == 1 )
-    {
-        sal_Int16 nNodeType;
-        switch( mpLBStart->GetSelectedEntryPos() )
-        {
-        case 0: nNodeType = EffectNodeType::ON_CLICK; break;
-        case 1: nNodeType = EffectNodeType::WITH_PREVIOUS; break;
-        case 2: nNodeType = EffectNodeType::AFTER_PREVIOUS; break;
-        default:
-            return;
-        }
+    if( mpLBStart->GetSelectedEntryCount() != 1 )
+        return;
 
-        onChangeStart( nNodeType );
+    sal_Int16 nNodeType;
+    switch( mpLBStart->GetSelectedEntryPos() )
+    {
+    case 0: nNodeType = EffectNodeType::ON_CLICK; break;
+    case 1: nNodeType = EffectNodeType::WITH_PREVIOUS; break;
+    case 2: nNodeType = EffectNodeType::AFTER_PREVIOUS; break;
+    default:
+        return;
     }
+
+    onChangeStart( nNodeType );
 }
 
 void CustomAnimationPane::onChangeStart( sal_Int16 nNodeType )
@@ -2007,23 +2010,23 @@ void CustomAnimationPane::createPath( PathKind eKind, std::vector< Any >& rTarge
     default: break;
     }
 
-    if( nSID )
-    {
-        DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
-            FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
+    if( !nSID )
+        return;
 
-        if( pViewShell )
-        {
-            DrawView* pView = pViewShell->GetDrawView();
-            if( pView )
-                pView->UnmarkAllObj();
+    DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
+        FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
 
-            std::vector< Any > aTargets( 1, Any( fDuration ) );
-            aTargets.insert( aTargets.end(), rTargets.begin(), rTargets.end() );
-            Sequence< Any > aTargetSequence( comphelper::containerToSequence( aTargets ) );
-            const SfxUnoAnyItem aItem( SID_ADD_MOTION_PATH, Any( aTargetSequence ) );
-            pViewShell->GetViewFrame()->GetDispatcher()->ExecuteList( nSID, SfxCallMode::ASYNCHRON, {&aItem} );
-        }
+    if( pViewShell )
+    {
+        DrawView* pView = pViewShell->GetDrawView();
+        if( pView )
+            pView->UnmarkAllObj();
+
+        std::vector< Any > aTargets( 1, Any( fDuration ) );
+        aTargets.insert( aTargets.end(), rTargets.begin(), rTargets.end() );
+        Sequence< Any > aTargetSequence( comphelper::containerToSequence( aTargets ) );
+        const SfxUnoAnyItem aItem( SID_ADD_MOTION_PATH, Any( aTargetSequence ) );
+        pViewShell->GetViewFrame()->GetDispatcher()->ExecuteList( nSID, SfxCallMode::ASYNCHRON, {&aItem} );
     }
 }
 
@@ -2031,32 +2034,32 @@ void CustomAnimationPane::createPath( PathKind eKind, std::vector< Any >& rTarge
 /// this link is called when the property box is modified by the user
 IMPL_LINK_NOARG(CustomAnimationPane, implPropertyHdl, LinkParamNone*, void)
 {
-    if( mpLBProperty->getSubControl() )
-    {
-        addUndo();
+    if( !mpLBProperty->getSubControl() )
+        return;
 
-        MainSequenceRebuildGuard aGuard( mpMainSequence );
+    addUndo();
 
-        const Any aValue( mpLBProperty->getSubControl()->getValue() );
+    MainSequenceRebuildGuard aGuard( mpMainSequence );
 
-        bool bNeedUpdate = false;
+    const Any aValue( mpLBProperty->getSubControl()->getValue() );
 
-        // change selected effect
-        for( CustomAnimationEffectPtr& pEffect : maListSelection )
-        {
-            if( setProperty1Value( mnPropertyType, pEffect, aValue ) )
-                bNeedUpdate = true;
-        }
+    bool bNeedUpdate = false;
 
-        if( bNeedUpdate )
-        {
-            mpMainSequence->rebuild();
-            updateControls();
-            mrBase.GetDocShell()->SetModified();
-        }
+    // change selected effect
+    for( CustomAnimationEffectPtr& pEffect : maListSelection )
+    {
+        if( setProperty1Value( mnPropertyType, pEffect, aValue ) )
+            bNeedUpdate = true;
+    }
 
-        onPreview( false );
+    if( bNeedUpdate )
+    {
+        mpMainSequence->rebuild();
+        updateControls();
+        mrBase.GetDocShell()->SetModified();
     }
+
+    onPreview( false );
 }
 
 IMPL_LINK_NOARG(CustomAnimationPane, DelayModifiedHdl, Edit&, void)
@@ -2084,65 +2087,65 @@ IMPL_LINK_NOARG(CustomAnimationPane, DelayLoseFocusHdl, Control&, void)
 
 IMPL_LINK_NOARG(CustomAnimationPane, AnimationSelectHdl, ListBox&, void)
 {
-    if( maListSelection.size() == 1 )
-    {
-        CustomAnimationPresetPtr* pPreset = static_cast< CustomAnimationPresetPtr* >(mpLBAnimation->GetSelectedEntryData());
-        PathKind ePathKind = getCreatePathKind();
-
-        // tdf#99137, the selected entry may also be a subcategory title, so not an effect
-        // just leave in this case
-        if ( !pPreset && ( ePathKind == PathKind::NONE ) )
-            return;
-
-        if ( ePathKind != PathKind::NONE )
-        {
-            std::vector< Any > aTargets;
-            MainSequenceRebuildGuard aGuard( mpMainSequence );
-
-            for( CustomAnimationEffectPtr& pEffect : maListSelection )
-            {
-                aTargets.push_back( pEffect->getTarget() );
-
-                EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
-                if( !pEffectSequence )
-                    pEffectSequence = mpMainSequence.get();
+    if( maListSelection.size() != 1 )
+        return;
 
-                // delete the old animation, new one will be appended
-                // by createPath and SID_ADD_MOTION_PATH therein
-                pEffectSequence->remove( pEffect );
-            }
+    CustomAnimationPresetPtr* pPreset = static_cast< CustomAnimationPresetPtr* >(mpLBAnimation->GetSelectedEntryData());
+    PathKind ePathKind = getCreatePathKind();
 
-            createPath( ePathKind, aTargets, 0.0 );
-            updateMotionPathTags();
-            return;
-        }
+    // tdf#99137, the selected entry may also be a subcategory title, so not an effect
+    // just leave in this case
+    if ( !pPreset && ( ePathKind == PathKind::NONE ) )
+        return;
 
-        CustomAnimationPresetPtr pDescriptor(*pPreset);
-        const double fDuration = (*pPreset)->getDuration();
+    if ( ePathKind != PathKind::NONE )
+    {
+        std::vector< Any > aTargets;
         MainSequenceRebuildGuard aGuard( mpMainSequence );
 
-        // get selected effect
         for( CustomAnimationEffectPtr& pEffect : maListSelection )
         {
-            // Dispose the deprecated motion path tag. It will be rebuilt later.
-            if (pEffect->getPresetClass() == css::presentation::EffectPresetClass::MOTIONPATH)
-            {
-                for (auto const& xTag: maMotionPathTags)
-                {
-                    if(xTag->getEffect() == pEffect && !xTag->isDisposed())
-                        xTag->Dispose();
-                }
-            }
+            aTargets.push_back( pEffect->getTarget() );
 
             EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
             if( !pEffectSequence )
                 pEffectSequence = mpMainSequence.get();
 
-            pEffectSequence->replace( pEffect, pDescriptor, fDuration );
+            // delete the old animation, new one will be appended
+            // by createPath and SID_ADD_MOTION_PATH therein
+            pEffectSequence->remove( pEffect );
         }
 
-        onPreview(false);
+        createPath( ePathKind, aTargets, 0.0 );
+        updateMotionPathTags();
+        return;
     }
+
+    CustomAnimationPresetPtr pDescriptor(*pPreset);
+    const double fDuration = (*pPreset)->getDuration();
+    MainSequenceRebuildGuard aGuard( mpMainSequence );
+
+    // get selected effect
+    for( CustomAnimationEffectPtr& pEffect : maListSelection )
+    {
+        // Dispose the deprecated motion path tag. It will be rebuilt later.
+        if (pEffect->getPresetClass() == css::presentation::EffectPresetClass::MOTIONPATH)
+        {
+            for (auto const& xTag: maMotionPathTags)
+            {
+                if(xTag->getEffect() == pEffect && !xTag->isDisposed())
+                    xTag->Dispose();
+            }
+        }
+
+        EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
+        if( !pEffectSequence )
+            pEffectSequence = mpMainSequence.get();
+
+        pEffectSequence->replace( pEffect, pDescriptor, fDuration );
+    }
+
+    onPreview(false);
 }
 
 IMPL_LINK_NOARG(CustomAnimationPane, UpdateAnimationLB, ListBox&, void)
@@ -2415,23 +2418,23 @@ void CustomAnimationPane::onSelect()
     updateControls();
 
     // mark shapes from selected effects
-    if( !maSelectionLock.isLocked() )
-    {
-        ScopeLockGuard aGuard( maSelectionLock );
-        DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
-            FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
-        DrawView* pView = pViewShell ? pViewShell->GetDrawView() : nullptr;
+    if( maSelectionLock.isLocked() )
+        return;
 
-        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();
-            for( const CustomAnimationEffectPtr& pEffect : maListSelection )
-            {
-                Reference< XShape > xShape( pEffect->getTargetShape() );
-                SdrObject* pObj = GetSdrObjectFromXShape( xShape );
-                if( pObj )
-                    pView->MarkObj(pObj, pView->GetSdrPageView());
-            }
+            Reference< XShape > xShape( pEffect->getTargetShape() );
+            SdrObject* pObj = GetSdrObjectFromXShape( xShape );
+            if( pObj )
+                pView->MarkObj(pObj, pView->GetSdrPageView());
         }
     }
 }
@@ -2440,60 +2443,60 @@ void CustomAnimationPane::onSelect()
 // pEffectInsertBefore may be null if moving to end of list.
 void CustomAnimationPane::onDragNDropComplete(std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore)
 {
-    if ( mpMainSequence.get() )
-    {
-        addUndo();
+    if ( !mpMainSequence.get() )
+        return;
 
-        MainSequenceRebuildGuard aGuard( mpMainSequence );
+    addUndo();
 
-        // Move all selected effects
-        for( auto const& pEffectDragged : pEffectsDragged )
-        {
-            // Move this dragged effect and any hidden sub-effects
-            EffectSequence::iterator aIter = mpMainSequence->find( pEffectDragged );
-            const EffectSequence::iterator aEnd( mpMainSequence->getEnd() );
+    MainSequenceRebuildGuard aGuard( mpMainSequence );
 
-            while( aIter != aEnd )
-            {
-                CustomAnimationEffectPtr pEffect = *aIter++;
+    // Move all selected effects
+    for( auto const& pEffectDragged : pEffectsDragged )
+    {
+        // Move this dragged effect and any hidden sub-effects
+        EffectSequence::iterator aIter = mpMainSequence->find( pEffectDragged );
+        const EffectSequence::iterator aEnd( mpMainSequence->getEnd() );
 
-                // Update model with new location (function triggers a rebuild)
-                // target may be null, which will insert at the end.
-                mpMainSequence->moveToBeforeEffect( pEffect, pEffectInsertBefore );
+        while( aIter != aEnd )
+        {
+            CustomAnimationEffectPtr pEffect = *aIter++;
 
-                // Done moving effect and its hidden sub-effects when *next* effect is visible.
-                if ( mpCustomAnimationList->isVisible( *aIter ) )
-                    break;
-            }
+            // Update model with new location (function triggers a rebuild)
+            // target may be null, which will insert at the end.
+            mpMainSequence->moveToBeforeEffect( pEffect, pEffectInsertBefore );
 
+            // Done moving effect and its hidden sub-effects when *next* effect is visible.
+            if ( mpCustomAnimationList->isVisible( *aIter ) )
+                break;
         }
 
-
-        updateControls();
-        mrBase.GetDocShell()->SetModified();
     }
+
+
+    updateControls();
+    mrBase.GetDocShell()->SetModified();
 }
 
 
 void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag )
 {
     MainSequenceRebuildGuard aGuard( mpMainSequence );
-    if( xTag.is() )
+    if( !xTag.is() )
+        return;
+
+    SdrPathObj* pPathObj = xTag->getPathObj();
+    CustomAnimationEffectPtr pEffect = xTag->getEffect();
+    if( (pPathObj != nullptr) && pEffect.get() != nullptr )
     {
-        SdrPathObj* pPathObj = xTag->getPathObj();
-        CustomAnimationEffectPtr pEffect = xTag->getEffect();
-        if( (pPathObj != nullptr) && pEffect.get() != nullptr )
+        SfxUndoManager* pManager = mrBase.GetDocShell()->GetUndoManager();
+        if( pManager )
         {
-            SfxUndoManager* pManager = mrBase.GetDocShell()->GetUndoManager();
-            if( pManager )
-            {
-                SdPage* pPage = SdPage::getImplementation( mxCurrentPage );
-                if( pPage )
-                    pManager->AddUndoAction( std::make_unique<UndoAnimationPath>( mrBase.GetDocShell()->GetDoc(), pPage, pEffect->getNode() ) );
-            }
-
-            pEffect->updatePathFromSdrPathObj( *pPathObj );
+            SdPage* pPage = SdPage::getImplementation( mxCurrentPage );
+            if( pPage )
+                pManager->AddUndoAction( std::make_unique<UndoAnimationPath>( mrBase.GetDocShell()->GetDoc(), pPage, pEffect->getNode() ) );
         }
+
+        pEffect->updatePathFromSdrPathObj( *pPathObj );
     }
 }
 
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index 715337180111..4883b1a72287 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -779,19 +779,19 @@ void SlideTransitionPane::openSoundFileDialog()
             mpLB_SOUND->SelectEntryPos( nPos + 3 );
     }
 
-    if( ! bValidSoundFile )
+    if(  bValidSoundFile )
+        return;
+
+    if( !maCurrentSoundFile.isEmpty() )
     {
-        if( !maCurrentSoundFile.isEmpty() )
-        {
-            std::vector<OUString>::size_type nPos = 0;
-            if( lcl_findSoundInList( maSoundList, maCurrentSoundFile, nPos ))
-                mpLB_SOUND->SelectEntryPos( nPos + 3 );
-            else
-                mpLB_SOUND->SelectEntryPos( 0 );  // NONE
-        }
+        std::vector<OUString>::size_type nPos = 0;
+        if( lcl_findSoundInList( maSoundList, maCurrentSoundFile, nPos ))
+            mpLB_SOUND->SelectEntryPos( nPos + 3 );
         else
             mpLB_SOUND->SelectEntryPos( 0 );  // NONE
     }
+    else
+        mpLB_SOUND->SelectEntryPos( 0 );  // NONE
 }
 
 impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() const
@@ -909,30 +909,30 @@ impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() co
 
 void SlideTransitionPane::applyToSelectedPages(bool bPreview = true)
 {
-    if( ! mbUpdatingControls )
-    {
-        Window *pFocusWindow = Application::GetFocusWindow();
+    if(  mbUpdatingControls )
+        return;
 
-        ::sd::slidesorter::SharedPageSelection pSelectedPages( getSelectedPages());
-        impl::TransitionEffect aEffect = getTransitionEffectFromControls();
-        if( ! pSelectedPages->empty())
-        {
-            lcl_CreateUndoForPages( pSelectedPages, mrBase );
-            lcl_ApplyToPages( pSelectedPages, aEffect );
-            mrBase.GetDocShell()->SetModified();
-        }
-        if( mpCB_AUTO_PREVIEW->IsEnabled() &&
-            mpCB_AUTO_PREVIEW->IsChecked() && bPreview)
-        {
-            if (aEffect.mnType) // mnType = 0 denotes no transition
-                playCurrentEffect();
-            else if( mxView.is() )
-                SlideShow::Stop( mrBase );
-        }
+    Window *pFocusWindow = Application::GetFocusWindow();
 
-        if (pFocusWindow)
-            pFocusWindow->GrabFocus();
+    ::sd::slidesorter::SharedPageSelection pSelectedPages( getSelectedPages());
+    impl::TransitionEffect aEffect = getTransitionEffectFromControls();
+    if( ! pSelectedPages->empty())
+    {
+        lcl_CreateUndoForPages( pSelectedPages, mrBase );
+        lcl_ApplyToPages( pSelectedPages, aEffect );
+        mrBase.GetDocShell()->SetModified();
     }
+    if( mpCB_AUTO_PREVIEW->IsEnabled() &&
+        mpCB_AUTO_PREVIEW->IsChecked() && bPreview)
+    {
+        if (aEffect.mnType) // mnType = 0 denotes no transition
+            playCurrentEffect();
+        else if( mxView.is() )
+            SlideShow::Stop( mrBase );
+    }
+
+    if (pFocusWindow)
+        pFocusWindow->GrabFocus();
 }
 
 void SlideTransitionPane::playCurrentEffect()
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index e08f3f4cb328..1996aec0a02d 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -267,37 +267,37 @@ void SdPathHdl::CreateB2dIAObject()
     // first throw away old one
     GetRidOfIAObject();
 
-    if(pHdlList)
+    if(!pHdlList)
+        return;
+
+    SdrMarkView* pView = pHdlList->GetView();
+
+    if(!(pView && !pView->areMarkHandlesHidden()))
+        return;
+
+    SdrPageView* pPageView = pView->GetSdrPageView();
+
+    if(!pPageView)
+        return;
+
+    for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
     {
-        SdrMarkView* pView = pHdlList->GetView();
+        const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
 
-        if(pView && !pView->areMarkHandlesHidden())
+        if(rPageWindow.GetPaintWindow().OutputToWindow())
         {
-            SdrPageView* pPageView = pView->GetSdrPageView();
-
-            if(pPageView)
+            const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+            if (xManager.is() && mpPathObj)
             {
-                for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
-                {
-                    const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
-
-                    if(rPageWindow.GetPaintWindow().OutputToWindow())
-                    {
-                        const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
-                        if (xManager.is() && mpPathObj)
-                        {
-                            const sdr::contact::ViewContact& rVC = mpPathObj->GetViewContact();
-                            const drawinglayer::primitive2d::Primitive2DContainer& aSequence = rVC.getViewIndependentPrimitive2DContainer();
-                            std::unique_ptr<sdr::overlay::OverlayObject> pNew(new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence));
-
-                            // OVERLAYMANAGER
-                            insertNewlyCreatedOverlayObjectForSdrHdl(
-                                std::move(pNew),
-                                rPageWindow.GetObjectContact(),
-                                *xManager);
-                        }
-                    }
-                }
+                const sdr::contact::ViewContact& rVC = mpPathObj->GetViewContact();
+                const drawinglayer::primitive2d::Primitive2DContainer& aSequence = rVC.getViewIndependentPrimitive2DContainer();
+                std::unique_ptr<sdr::overlay::OverlayObject> pNew(new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence));
+
+                // OVERLAYMANAGER
+                insertNewlyCreatedOverlayObjectForSdrHdl(
+                    std::move(pNew),
+                    rPageWindow.GetObjectContact(),
+                    *xManager);
             }
         }
     }
@@ -391,18 +391,18 @@ void MotionPathTag::updatePathAttributes()
 
 void MotionPathTag::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
 {
-    if( mpPathObj && !mbInUpdatePath && dynamic_cast< const SdrHint* >( &rHint ) && (mpEffect.get() != nullptr) )
+    if( !(mpPathObj && !mbInUpdatePath && dynamic_cast< const SdrHint* >( &rHint ) && (mpEffect.get() != nullptr)) )
+        return;
+
+    if( mxPolyPoly != mpPathObj->GetPathPoly() )
     {
-        if( mxPolyPoly != mpPathObj->GetPathPoly() )
-        {
-            mbInUpdatePath = true;
-            mxPolyPoly = mpPathObj->GetPathPoly();
-            rtl::Reference< MotionPathTag > xTag( this );
-            mrPane.updatePathFromMotionPathTag( xTag );
-            msLastPath = mpEffect->getPath();
-            updatePathAttributes();
-            mbInUpdatePath = false;
-        }
+        mbInUpdatePath = true;
+        mxPolyPoly = mpPathObj->GetPathPoly();
+        rtl::Reference< MotionPathTag > xTag( this );
+        mrPane.updatePathFromMotionPathTag( xTag );
+        msLastPath = mpEffect->getPath();
+        updatePathAttributes();
+        mbInUpdatePath = false;
     }
 }
 
@@ -840,130 +840,130 @@ bool MotionPathTag::getContext( SdrViewContext& rContext )
 
 void MotionPathTag::CheckPossibilities()
 {
-    if( mpPathObj && isSelected() )
-    {
-        mrView.SetMoveAllowed( true );
-        mrView.SetMoveProtected( false );
-        mrView.SetResizeFreeAllowed( true );
-        mrView.SetResizePropAllowed( true );
-        mrView.SetResizeProtected( false );
+    if( !(mpPathObj && isSelected()) )
+        return;
 
-        if( !mrView.IsFrameDragSingles() )
-        {
-            bool b1stSmooth(true);
-            bool b1stSegm(true);
-            bool bCurve(false);
-            bool bSmoothFuz(false);
-            bool bSegmFuz(false);
-            basegfx::B2VectorContinuity eSmooth = basegfx::B2VectorContinuity::NONE;
-
-            mrView.CheckPolyPossibilitiesHelper( mpMark.get(), b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
-        }
+    mrView.SetMoveAllowed( true );
+    mrView.SetMoveProtected( false );
+    mrView.SetResizeFreeAllowed( true );
+    mrView.SetResizePropAllowed( true );
+    mrView.SetResizeProtected( false );
+
+    if( !mrView.IsFrameDragSingles() )
+    {
+        bool b1stSmooth(true);
+        bool b1stSegm(true);
+        bool bCurve(false);
+        bool bSmoothFuz(false);
+        bool bSegmFuz(false);
+        basegfx::B2VectorContinuity eSmooth = basegfx::B2VectorContinuity::NONE;
+
+        mrView.CheckPolyPossibilitiesHelper( mpMark.get(), b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth );
     }
 }
 
 void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList )
 {
-    if( mpPathObj )
+    if( !mpPathObj )
+        return;
+
+    css::awt::Point aPos;
+    if (mxOrigin.is())
+        aPos = mxOrigin->getPosition();
+    if( (aPos.X != maOriginPos.X) || (aPos.Y != maOriginPos.Y) )
     {
-        css::awt::Point aPos;
-        if (mxOrigin.is())
-            aPos = mxOrigin->getPosition();
-        if( (aPos.X != maOriginPos.X) || (aPos.Y != maOriginPos.Y) )
-        {
-            const basegfx::B2DHomMatrix aTransform(basegfx::utils::createTranslateB2DHomMatrix(
-                aPos.X - maOriginPos.X, aPos.Y - maOriginPos.Y));
-            mxPolyPoly.transform( aTransform );
-            mpPathObj->SetPathPoly( mxPolyPoly );
-            maOriginPos = aPos;
-        }
+        const basegfx::B2DHomMatrix aTransform(basegfx::utils::createTranslateB2DHomMatrix(
+            aPos.X - maOriginPos.X, aPos.Y - maOriginPos.Y));
+        mxPolyPoly.transform( aTransform );
+        mpPathObj->SetPathPoly( mxPolyPoly );
+        maOriginPos = aPos;
+    }
 
-        SmartTagReference xThis( this );
-        std::unique_ptr<SdPathHdl> pHdl(new SdPathHdl( xThis, mpPathObj ));
-        pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM );
-        pHdl->SetPageView( mrView.GetSdrPageView() );
-        pHdl->SetObj(mpPathObj);
-        rHandlerList.AddHdl( std::move(pHdl) );
+    SmartTagReference xThis( this );
+    std::unique_ptr<SdPathHdl> pHdl(new SdPathHdl( xThis, mpPathObj ));
+    pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM );
+    pHdl->SetPageView( mrView.GetSdrPageView() );
+    pHdl->SetObj(mpPathObj);
+    rHandlerList.AddHdl( std::move(pHdl) );
 
-        if( isSelected() )
-        {
-            mrView.GetSdrPageView()->SetHasMarkedObj(true);
+    if( !isSelected() )
+        return;
 
-            if( !mrView.IsFrameDragSingles() )
-            {
-                SdrHdlList aTemp( rHandlerList.GetView() );
-                mpPathObj->AddToHdlList( aTemp );
-                const SdrUShortCont& rMrkPnts = mpMark->GetMarkedPoints();
+    mrView.GetSdrPageView()->SetHasMarkedObj(true);
 
-                for( size_t nHandle = 0; nHandle < aTemp.GetHdlCount(); ++nHandle )
-                {
-                    SdrHdl* pTempHdl = aTemp.GetHdl( nHandle );
+    if( !mrView.IsFrameDragSingles() )
+    {
+        SdrHdlList aTemp( rHandlerList.GetView() );
+        mpPathObj->AddToHdlList( aTemp );
+        const SdrUShortCont& rMrkPnts = mpMark->GetMarkedPoints();
 
-                    SmartHdl* pSmartHdl = new SmartHdl( xThis, mpPathObj, pTempHdl->GetPos(), pTempHdl->GetKind() );
-                    pSmartHdl->SetObjHdlNum( static_cast<sal_uInt32>(nHandle) );
-                    pSmartHdl->SetPolyNum( pTempHdl->GetPolyNum() );
-                    pSmartHdl->SetPointNum( pTempHdl->GetPointNum() );
-                    pSmartHdl->SetPlusHdl(  pTempHdl->IsPlusHdl() );
-                    pSmartHdl->SetSourceHdlNum( pTempHdl->GetSourceHdlNum() );
-                    pSmartHdl->SetPageView( mrView.GetSdrPageView() );
+        for( size_t nHandle = 0; nHandle < aTemp.GetHdlCount(); ++nHandle )
+        {
+            SdrHdl* pTempHdl = aTemp.GetHdl( nHandle );
 
-                    rHandlerList.AddHdl( std::unique_ptr<SmartHdl>(pSmartHdl) );
+            SmartHdl* pSmartHdl = new SmartHdl( xThis, mpPathObj, pTempHdl->GetPos(), pTempHdl->GetKind() );
+            pSmartHdl->SetObjHdlNum( static_cast<sal_uInt32>(nHandle) );
+            pSmartHdl->SetPolyNum( pTempHdl->GetPolyNum() );
+            pSmartHdl->SetPointNum( pTempHdl->GetPointNum() );
+            pSmartHdl->SetPlusHdl(  pTempHdl->IsPlusHdl() );
+            pSmartHdl->SetSourceHdlNum( pTempHdl->GetSourceHdlNum() );
+            pSmartHdl->SetPageView( mrView.GetSdrPageView() );
 
-                    const bool bSelected = rMrkPnts.find( sal_uInt16(nHandle) ) != rMrkPnts.end();
-                    pSmartHdl->SetSelected(bSelected);
+            rHandlerList.AddHdl( std::unique_ptr<SmartHdl>(pSmartHdl) );
 
-                    if( mrView.IsPlusHandlesAlwaysVisible() || bSelected )
-                    {
-                        SdrHdlList plusList(nullptr);
-                        mpPathObj->AddToPlusHdlList(plusList, *pSmartHdl);
-                        sal_uInt32 nPlusHdlCnt=plusList.GetHdlCount();
-                        for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusHdlCnt; nPlusNum++)
-                        {
-                            SdrHdl* pPlusHdl = plusList.GetHdl(nPlusNum);
-                            pPlusHdl->SetObj(mpPathObj);
-                            pPlusHdl->SetPageView(mrView.GetSdrPageView());
-                            pPlusHdl->SetPlusHdl(true);
-                        }
-                        plusList.MoveTo(rHandlerList);
-                    }
+            const bool bSelected = rMrkPnts.find( sal_uInt16(nHandle) ) != rMrkPnts.end();
+            pSmartHdl->SetSelected(bSelected);
+
+            if( mrView.IsPlusHandlesAlwaysVisible() || bSelected )
+            {
+                SdrHdlList plusList(nullptr);
+                mpPathObj->AddToPlusHdlList(plusList, *pSmartHdl);
+                sal_uInt32 nPlusHdlCnt=plusList.GetHdlCount();
+                for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusHdlCnt; nPlusNum++)
+                {
+                    SdrHdl* pPlusHdl = plusList.GetHdl(nPlusNum);
+                    pPlusHdl->SetObj(mpPathObj);
+                    pPlusHdl->SetPageView(mrView.GetSdrPageView());
+                    pPlusHdl->SetPlusHdl(true);
                 }
+                plusList.MoveTo(rHandlerList);
             }
-            else
-            {
-                ::tools::Rectangle aRect(mpPathObj->GetCurrentBoundRect());
+        }
+    }
+    else
+    {
+        ::tools::Rectangle aRect(mpPathObj->GetCurrentBoundRect());
 
-                if(!aRect.IsEmpty())
-                {
-                    size_t nCount = rHandlerList.GetHdlCount();
+        if(!aRect.IsEmpty())
+        {
+            size_t nCount = rHandlerList.GetHdlCount();
 
-                    bool bWdt0=aRect.Left()==aRect.Right();
-                    bool bHgt0=aRect.Top()==aRect.Bottom();
-                    if (bWdt0 && bHgt0)
-                    {
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft(),SdrHdlKind::UpperLeft));
-                    }
-                    else if (bWdt0 || bHgt0)
-                    {
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft()    ,SdrHdlKind::UpperLeft));
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomRight(),SdrHdlKind::LowerRight));
-                    }
-                    else // !bWdt0 && !bHgt0
-                    {
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft()     ,SdrHdlKind::UpperLeft));
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopCenter()   ,SdrHdlKind::Upper));
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopRight()    ,SdrHdlKind::UpperRight));
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.LeftCenter()  ,SdrHdlKind::Left ));
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.RightCenter() ,SdrHdlKind::Right));
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomLeft()  ,SdrHdlKind::LowerLeft));
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomCenter(),SdrHdlKind::Lower));
-                        rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomRight() ,SdrHdlKind::LowerRight));
-                    }
+            bool bWdt0=aRect.Left()==aRect.Right();
+            bool bHgt0=aRect.Top()==aRect.Bottom();
+            if (bWdt0 && bHgt0)
+            {
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft(),SdrHdlKind::UpperLeft));
+            }
+            else if (bWdt0 || bHgt0)
+            {
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft()    ,SdrHdlKind::UpperLeft));
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomRight(),SdrHdlKind::LowerRight));
+            }
+            else // !bWdt0 && !bHgt0
+            {
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopLeft()     ,SdrHdlKind::UpperLeft));
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopCenter()   ,SdrHdlKind::Upper));
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.TopRight()    ,SdrHdlKind::UpperRight));
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.LeftCenter()  ,SdrHdlKind::Left ));
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.RightCenter() ,SdrHdlKind::Right));
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomLeft()  ,SdrHdlKind::LowerLeft));
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomCenter(),SdrHdlKind::Lower));
+                rHandlerList.AddHdl(std::make_unique<SmartHdl>( xThis, mpPathObj, aRect.BottomRight() ,SdrHdlKind::LowerRight));
+            }
 
-                    while( nCount < rHandlerList.GetHdlCount() )
-                    {
-                        rHandlerList.GetHdl(nCount++)->SetPageView( mrView.GetSdrPageView() );
-                    }
-                }
+            while( nCount < rHandlerList.GetHdlCount() )
+            {
+                rHandlerList.GetHdl(nCount++)->SetPageView( mrView.GetSdrPageView() );
             }
         }
     }
@@ -1018,23 +1018,23 @@ void MotionPathTag::selectionChanged()
 
 void MotionPathTag::DeleteMarkedPoints()
 {
-    if( mpPathObj && IsDeleteMarkedPointsPossible() )
-    {
-        mrView.BrkAction();
+    if( !(mpPathObj && IsDeleteMarkedPointsPossible()) )
+        return;
 
-        SdrUShortCont& rPts = mpMark->GetMarkedPoints();
-        PolyPolygonEditor aEditor( mpPathObj->GetPathPoly());
-        if (aEditor.DeletePoints(rPts))
-        {
-            if( aEditor.GetPolyPolygon().count() )
-            {
-                mpPathObj->SetPathPoly( aEditor.GetPolyPolygon() );
-            }
+    mrView.BrkAction();
 
-            mrView.UnmarkAllPoints();
-            mrView.MarkListHasChanged();
-            mrView.updateHandles();
+    SdrUShortCont& rPts = mpMark->GetMarkedPoints();
+    PolyPolygonEditor aEditor( mpPathObj->GetPathPoly());
+    if (aEditor.DeletePoints(rPts))
+    {
+        if( aEditor.GetPolyPolygon().count() )
+        {
+            mpPathObj->SetPathPoly( aEditor.GetPolyPolygon() );
         }
+
+        mrView.UnmarkAllPoints();
+        mrView.MarkListHasChanged();
+        mrView.updateHandles();
     }
 }
 
diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx
index f98c4c4d313f..fab298c33de0 100644
--- a/sd/source/ui/annotations/annotationmanager.cxx
+++ b/sd/source/ui/annotations/annotationmanager.cxx
@@ -238,25 +238,25 @@ void SAL_CALL AnnotationManagerImpl::disposing ()
 // XEventListener
 void SAL_CALL AnnotationManagerImpl::notifyEvent( const css::document::EventObject& aEvent )
 {
-    if( aEvent.EventName == "OnAnnotationInserted" || aEvent.EventName == "OnAnnotationRemoved" || aEvent.EventName == "OnAnnotationChanged" )
+    if( !(aEvent.EventName == "OnAnnotationInserted" || aEvent.EventName == "OnAnnotationRemoved" || aEvent.EventName == "OnAnnotationChanged") )
+        return;
+
+    // AnnotationInsertion and modification is not handled here because when
+    // a new annotation is inserted, it consists of OnAnnotationInserted
+    // followed by a chain of OnAnnotationChanged (called for setting each
+    // of the annotation attributes - author, text etc.). This is not what a
+    // LOK client wants. So only handle removal here as annotation removal
+    // consists of only one event - 'OnAnnotationRemoved'
+    if ( aEvent.EventName == "OnAnnotationRemoved" )
     {
-        // AnnotationInsertion and modification is not handled here because when
-        // a new annotation is inserted, it consists of OnAnnotationInserted
-        // followed by a chain of OnAnnotationChanged (called for setting each
-        // of the annotation attributes - author, text etc.). This is not what a
-        // LOK client wants. So only handle removal here as annotation removal
-        // consists of only one event - 'OnAnnotationRemoved'
-        if ( aEvent.EventName == "OnAnnotationRemoved" )
+        Reference< XAnnotation > xAnnotation( aEvent.Source, uno::UNO_QUERY );
+        if ( xAnnotation.is() )
         {
-            Reference< XAnnotation > xAnnotation( aEvent.Source, uno::UNO_QUERY );
-            if ( xAnnotation.is() )
-            {
-                LOKCommentNotify(CommentNotificationType::Remove, &mrBase, xAnnotation);
-            }
+            LOKCommentNotify(CommentNotificationType::Remove, &mrBase, xAnnotation);
         }
-
-        UpdateTags();
     }
+
+    UpdateTags();
 }
 
 void SAL_CALL AnnotationManagerImpl::disposing( const css::lang::EventObject& /*Source*/ )
@@ -401,130 +401,130 @@ void AnnotationManagerImpl::ExecuteEditAnnotation(SfxRequest const & rReq)
     Reference< XAnnotation > xAnnotation;
     sal_uInt32 nId = 0;
     OUString sText;
-    if (pArgs)
-    {
-        if (mpDoc->IsUndoEnabled())
-            mpDoc->BegUndo(SdResId(STR_ANNOTATION_UNDO_EDIT));
-
-        const SfxPoolItem* pPoolItem = nullptr;
-        if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_ID, true, &pPoolItem))
-        {
-            nId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32();
-            xAnnotation = GetAnnotationById(nId);
-        }
-        if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_TEXT, true, &pPoolItem))
-            sText = static_cast<const SfxStringItem*>(pPoolItem)->GetValue();
+    if (!pArgs)
+        return;
 
-        if (xAnnotation.is() && !sText.isEmpty())
-        {
-            CreateChangeUndo(xAnnotation);
+    if (mpDoc->IsUndoEnabled())
+        mpDoc->BegUndo(SdResId(STR_ANNOTATION_UNDO_EDIT));
 
-            // TODO: Not allow other authors to change others' comments ?
-            Reference<XText> xText(xAnnotation->getTextRange());
-            xText->setString(sText);
+    const SfxPoolItem* pPoolItem = nullptr;
+    if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_ID, true, &pPoolItem))
+    {
+        nId = static_cast<const SvxPostItIdItem*>(pPoolItem)->GetValue().toUInt32();
+        xAnnotation = GetAnnotationById(nId);
+    }
+    if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_POSTIT_TEXT, true, &pPoolItem))
+        sText = static_cast<const SfxStringItem*>(pPoolItem)->GetValue();
 
-            LOKCommentNotifyAll(CommentNotificationType::Modify, xAnnotation);
-        }
+    if (xAnnotation.is() && !sText.isEmpty())
+    {
+        CreateChangeUndo(xAnnotation);
 
-        if (mpDoc->IsUndoEnabled())
-            mpDoc->EndUndo();
+        // TODO: Not allow other authors to change others' comments ?
+        Reference<XText> xText(xAnnotation->getTextRange());
+        xText->setString(sText);
 
-        UpdateTags(true);
+        LOKCommentNotifyAll(CommentNotificationType::Modify, xAnnotation);
     }
+
+    if (mpDoc->IsUndoEnabled())
+        mpDoc->EndUndo();
+
+    UpdateTags(true);
 }
 
 void AnnotationManagerImpl::InsertAnnotation(const OUString& rText)
 {
     SdPage* pPage = GetCurrentPage();
-    if( pPage )
-    {
-        if( mpDoc->IsUndoEnabled() )
-            mpDoc->BegUndo( SdResId( STR_ANNOTATION_UNDO_INSERT ) );
+    if( !pPage )
+        return;
 
-        // find free space for new annotation
-        int y = 0, x = 0;
+    if( mpDoc->IsUndoEnabled() )
+        mpDoc->BegUndo( SdResId( STR_ANNOTATION_UNDO_INSERT ) );
 
-        AnnotationVector aAnnotations( pPage->getAnnotations() );
-        if( !aAnnotations.empty() )
+    // find free space for new annotation
+    int y = 0, x = 0;
+
+    AnnotationVector aAnnotations( pPage->getAnnotations() );
+    if( !aAnnotations.empty() )
+    {
+        const int page_width = pPage->GetSize().Width();
+        const int width = 1000;
+        const int height = 800;
+        ::tools::Rectangle aTagRect;
+
+        while( true )
         {
-            const int page_width = pPage->GetSize().Width();
-            const int width = 1000;
-            const int height = 800;
-            ::tools::Rectangle aTagRect;
+            ::tools::Rectangle aNewRect( x, y, x + width - 1, y + height - 1 );
+            bool bFree = true;
 
-            while( true )
+            for( const auto& rxAnnotation : aAnnotations )
             {
-                ::tools::Rectangle aNewRect( x, y, x + width - 1, y + height - 1 );
-                bool bFree = true;
+                RealPoint2D aPoint( rxAnnotation->getPosition() );
+                aTagRect.SetLeft( sal::static_int_cast< long >( aPoint.X * 100.0 ) );
+                aTagRect.SetTop( sal::static_int_cast< long >( aPoint.Y * 100.0 ) );
+                aTagRect.SetRight( aTagRect.Left() + width - 1 );
+                aTagRect.SetBottom( aTagRect.Top() + height - 1 );
 
-                for( const auto& rxAnnotation : aAnnotations )
+                if( aNewRect.IsOver( aTagRect ) )
                 {
-                    RealPoint2D aPoint( rxAnnotation->getPosition() );
-                    aTagRect.SetLeft( sal::static_int_cast< long >( aPoint.X * 100.0 ) );
-                    aTagRect.SetTop( sal::static_int_cast< long >( aPoint.Y * 100.0 ) );
-                    aTagRect.SetRight( aTagRect.Left() + width - 1 );
-                    aTagRect.SetBottom( aTagRect.Top() + height - 1 );
-
-                    if( aNewRect.IsOver( aTagRect ) )
-                    {
-                        bFree = false;
-                        break;
-                    }
+                    bFree = false;
+                    break;
                 }
+            }
 
-                if( !bFree )
-                {
-                    x += width;
-                    if( x > page_width )
-                    {
-                        x = 0;
-                        y += height;
-                    }
-                }
-                else
+            if( !bFree )
+            {
+                x += width;
+                if( x > page_width )
                 {
-                    break;
+                    x = 0;
+                    y += height;
                 }
             }
+            else
+            {
+                break;
+            }
         }
+    }
 
-        Reference< XAnnotation > xAnnotation;
-        pPage->createAnnotation( xAnnotation );
+    Reference< XAnnotation > xAnnotation;
+    pPage->createAnnotation( xAnnotation );
 
-        OUString sAuthor;
-        if (comphelper::LibreOfficeKit::isActive())
-            sAuthor = mrBase.GetMainViewShell()->GetView()->GetAuthor();
-        else
-        {
-            SvtUserOptions aUserOptions;
-            sAuthor = aUserOptions.GetFullName();
-            xAnnotation->setInitials( aUserOptions.GetID() );
-        }
+    OUString sAuthor;
+    if (comphelper::LibreOfficeKit::isActive())
+        sAuthor = mrBase.GetMainViewShell()->GetView()->GetAuthor();
+    else
+    {
+        SvtUserOptions aUserOptions;
+        sAuthor = aUserOptions.GetFullName();
+        xAnnotation->setInitials( aUserOptions.GetID() );
+    }
 
-        if (!rText.isEmpty())
-        {
-            Reference<XText> xText(xAnnotation->getTextRange());
-            xText->setString(rText);
-        }
+    if (!rText.isEmpty())
+    {
+        Reference<XText> xText(xAnnotation->getTextRange());
+        xText->setString(rText);
+    }
 
-        // set current author to new annotation
-        xAnnotation->setAuthor( sAuthor );
-        // set current time to new annotation
-        xAnnotation->setDateTime( getCurrentDateTime() );
+    // set current author to new annotation
+    xAnnotation->setAuthor( sAuthor );
+    // set current time to new annotation
+    xAnnotation->setDateTime( getCurrentDateTime() );
 
-        // set position
-        RealPoint2D aPos( static_cast<double>(x) / 100.0, static_cast<double>(y) / 100.0 );
-        xAnnotation->setPosition( aPos );
+    // set position
+    RealPoint2D aPos( static_cast<double>(x) / 100.0, static_cast<double>(y) / 100.0 );
+    xAnnotation->setPosition( aPos );
 
-        if( mpDoc->IsUndoEnabled() )
-            mpDoc->EndUndo();
+    if( mpDoc->IsUndoEnabled() )
+        mpDoc->EndUndo();
 
-        // Tell our LOK clients about new comment added
-        LOKCommentNotifyAll(CommentNotificationType::Add, xAnnotation);
+    // Tell our LOK clients about new comment added
+    LOKCommentNotifyAll(CommentNotificationType::Add, xAnnotation);
 
-        UpdateTags(true);
-        SelectAnnotation( xAnnotation, true );
-    }
+    UpdateTags(true);
+    SelectAnnotation( xAnnotation, true );
 }
 
 void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq )
@@ -549,69 +549,69 @@ void AnnotationManagerImpl::ExecuteReplyToAnnotation( SfxRequest const & rReq )
     }
 
     TextApiObject* pTextApi = getTextApiObject( xAnnotation );
-    if( pTextApi )
-    {
-        std::unique_ptr< ::Outliner > pOutliner( new ::Outliner(GetAnnotationPool(),OutlinerMode::TextObject) );
+    if( !pTextApi )
+        return;
 
-        SdDrawDocument::SetCalcFieldValueHdl( pOutliner.get() );
-        pOutliner->SetUpdateMode( true );
+    std::unique_ptr< ::Outliner > pOutliner( new ::Outliner(GetAnnotationPool(),OutlinerMode::TextObject) );
 
-        OUString aStr(SdResId(STR_ANNOTATION_REPLY));
-        OUString sAuthor( xAnnotation->getAuthor() );
-        if( sAuthor.isEmpty() )
-            sAuthor = SdResId( STR_ANNOTATION_NOAUTHOR );
+    SdDrawDocument::SetCalcFieldValueHdl( pOutliner.get() );
+    pOutliner->SetUpdateMode( true );
 
-        aStr = aStr.replaceFirst("%1", sAuthor);
+    OUString aStr(SdResId(STR_ANNOTATION_REPLY));
+    OUString sAuthor( xAnnotation->getAuthor() );
+    if( sAuthor.isEmpty() )
+        sAuthor = SdResId( STR_ANNOTATION_NOAUTHOR );
 
-        aStr += " (" + getAnnotationDateTimeString( xAnnotation ) + "): \"";
+    aStr = aStr.replaceFirst("%1", sAuthor);
 
-        OUString sQuote( pTextApi->GetText() );
+    aStr += " (" + getAnnotationDateTimeString( xAnnotation ) + "): \"";
 
-        if( sQuote.isEmpty() )
-            sQuote = "...";
-        aStr += sQuote + "\"\n";
+    OUString sQuote( pTextApi->GetText() );
 
-        for( sal_Int32 nIdx = 0; nIdx >= 0; )
-            pOutliner->Insert( aStr.getToken( 0, '\n', nIdx ), EE_PARA_APPEND, -1 );
+    if( sQuote.isEmpty() )
+        sQuote = "...";
+    aStr += sQuote + "\"\n";
 
-        if( pOutliner->GetParagraphCount() > 1 )
-        {
-            SfxItemSet aAnswerSet( pOutliner->GetEmptyItemSet() );
-            aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC));
+    for( sal_Int32 nIdx = 0; nIdx >= 0; )
+        pOutliner->Insert( aStr.getToken( 0, '\n', nIdx ), EE_PARA_APPEND, -1 );
 
-            ESelection aSel;
-            aSel.nEndPara = pOutliner->GetParagraphCount()-2;
-            aSel.nEndPos = pOutliner->GetText( pOutliner->GetParagraph( aSel.nEndPara ) ).getLength();
+    if( pOutliner->GetParagraphCount() > 1 )
+    {
+        SfxItemSet aAnswerSet( pOutliner->GetEmptyItemSet() );
+        aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC));
 
-            pOutliner->QuickSetAttribs( aAnswerSet, aSel );
-        }
+        ESelection aSel;
+        aSel.nEndPara = pOutliner->GetParagraphCount()-2;
+        aSel.nEndPos = pOutliner->GetText( pOutliner->GetParagraph( aSel.nEndPara ) ).getLength();
 
-        if (!sReplyText.isEmpty())
-            pOutliner->Insert(sReplyText);
+        pOutliner->QuickSetAttribs( aAnswerSet, aSel );
+    }
 
-        std::unique_ptr< OutlinerParaObject > pOPO( pOutliner->CreateParaObject() );
-        pTextApi->SetText(*pOPO);
+    if (!sReplyText.isEmpty())
+        pOutliner->Insert(sReplyText);
 
-        OUString sReplyAuthor;
-        if (comphelper::LibreOfficeKit::isActive())
-            sReplyAuthor = mrBase.GetMainViewShell()->GetView()->GetAuthor();
-        else
-        {
-            SvtUserOptions aUserOptions;
-            sReplyAuthor = aUserOptions.GetFullName();
-            xAnnotation->setInitials( aUserOptions.GetID() );
-        }
+    std::unique_ptr< OutlinerParaObject > pOPO( pOutliner->CreateParaObject() );
+    pTextApi->SetText(*pOPO);
 
-        xAnnotation->setAuthor( sReplyAuthor );
-        // set current time to reply
-        xAnnotation->setDateTime( getCurrentDateTime() );
+    OUString sReplyAuthor;
+    if (comphelper::LibreOfficeKit::isActive())
+        sReplyAuthor = mrBase.GetMainViewShell()->GetView()->GetAuthor();
+    else
+    {
+        SvtUserOptions aUserOptions;
+        sReplyAuthor = aUserOptions.GetFullName();
+        xAnnotation->setInitials( aUserOptions.GetID() );
+    }
 
-        // Tell our LOK clients about this (comment modification)
-        LOKCommentNotifyAll(CommentNotificationType::Modify, xAnnotation);
+    xAnnotation->setAuthor( sReplyAuthor );
+    // set current time to reply
+    xAnnotation->setDateTime( getCurrentDateTime() );
 
-        UpdateTags(true);
-        SelectAnnotation( xAnnotation, true );
-    }
+    // Tell our LOK clients about this (comment modification)
+    LOKCommentNotifyAll(CommentNotificationType::Modify, xAnnotation);
+
+    UpdateTags(true);
+    SelectAnnotation( xAnnotation, true );
 }
 
 void AnnotationManagerImpl::DeleteAnnotation( const Reference< XAnnotation >& xAnnotation )
@@ -888,7 +888,10 @@ void AnnotationManagerImpl::invalidateSlots()
 
 void AnnotationManagerImpl::onSelectionChanged()
 {
-    if( mxView.is() && mrBase.GetDrawView() ) try
+    if( !(mxView.is() && mrBase.GetDrawView()) )
+        return;
+
+    try
     {
         Reference< XAnnotationAccess > xPage( mxView->getCurrentPage(), UNO_QUERY );
 
@@ -938,7 +941,10 @@ IMPL_LINK_NOARG(AnnotationManagerImpl, UpdateTagsHdl, void*, void)
 void AnnotationManagerImpl::CreateTags()
 {
 
-    if( mxCurrentPage.is() && mpDoc ) try
+    if( !(mxCurrentPage.is() && mpDoc) )
+        return;
+
+    try
     {
         int nIndex = 1;
         maFont = Application::GetSettings().GetStyleSettings().GetAppFont();
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index fe32441114af..f0a0c196fcca 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -178,62 +178,62 @@ void AnnotationHdl::CreateB2dIAObject()
     // first throw away old one
     GetRidOfIAObject();
 
-    if( mxAnnotation.is() )
-    {
-        const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+    if( !mxAnnotation.is() )
+        return;
+
+    const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
 
-        const Point aTagPos( GetPos() );
-        basegfx::B2DPoint aPosition( aTagPos.X(), aTagPos.Y() );
+    const Point aTagPos( GetPos() );
+    basegfx::B2DPoint aPosition( aTagPos.X(), aTagPos.Y() );
 
-        const bool bFocused = IsFocusHdl() && pHdlList && (pHdlList->GetFocusHdl() == this);
+    const bool bFocused = IsFocusHdl() && pHdlList && (pHdlList->GetFocusHdl() == this);
+
+    BitmapEx aBitmapEx( mxTag->CreateAnnotationBitmap(mxTag->isSelected()) );
+    BitmapEx aBitmapEx2;
+    if( bFocused )
+        aBitmapEx2 = mxTag->CreateAnnotationBitmap(!mxTag->isSelected() );
+
+    if(!pHdlList)
+        return;
 
-        BitmapEx aBitmapEx( mxTag->CreateAnnotationBitmap(mxTag->isSelected()) );
-        BitmapEx aBitmapEx2;
-        if( bFocused )
-            aBitmapEx2 = mxTag->CreateAnnotationBitmap(!mxTag->isSelected() );
+    SdrMarkView* pView = pHdlList->GetView();
 
-        if(pHdlList)
+    if(!(pView && !pView->areMarkHandlesHidden()))
+        return;
+
+    SdrPageView* pPageView = pView->GetSdrPageView();
+
+    if(!pPageView)
+        return;
+
+    for(sal_uInt32 b = 0; b < pPageView->PageWindowCount(); b++)
+    {
+        // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
+        const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+        SdrPaintWindow& rPaintWindow = rPageWindow.GetPaintWindow();
+        const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
+        if(rPaintWindow.OutputToWindow() && xManager.is() )
         {
-            SdrMarkView* pView = pHdlList->GetView();
+            std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject;
 
-            if(pView && !pView->areMarkHandlesHidden())
+            // animate focused handles
+            if(bFocused)
             {
-                SdrPageView* pPageView = pView->GetSdrPageView();
+                const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime();
 
-                if(pPageView)
-                {
-                    for(sal_uInt32 b = 0; b < pPageView->PageWindowCount(); b++)
-                    {
-                        // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
-                        const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
-
-                        SdrPaintWindow& rPaintWindow = rPageWindow.GetPaintWindow();
-                        const rtl::Reference< sdr::overlay::OverlayManager >& xManager = rPageWindow.GetOverlayManager();
-                        if(rPaintWindow.OutputToWindow() && xManager.is() )
-                        {
-                            std::unique_ptr<sdr::overlay::OverlayObject> pOverlayObject;
-
-                            // animate focused handles
-                            if(bFocused)
-                            {
-                                const sal_uInt64 nBlinkTime = rStyleSettings.GetCursorBlinkTime();
-
-                                pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBitmapEx, aBitmapEx2, nBlinkTime, 0, 0, 0, 0 ));
-                            }
-                            else
-                            {
-                                pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 ));
-                            }
-
-                            // OVERLAYMANAGER
-                            insertNewlyCreatedOverlayObjectForSdrHdl(
-                                std::move(pOverlayObject),
-                                rPageWindow.GetObjectContact(),
-                                *xManager);
-                        }
-                    }
-                }
+                pOverlayObject.reset(new sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBitmapEx, aBitmapEx2, nBlinkTime, 0, 0, 0, 0 ));
+            }
+            else
+            {
+                pOverlayObject.reset(new sdr::overlay::OverlayBitmapEx( aPosition, aBitmapEx, 0, 0 ));
             }
+
+            // OVERLAYMANAGER
+            insertNewlyCreatedOverlayObjectForSdrHdl(
+                std::move(pOverlayObject),
+                rPageWindow.GetObjectContact(),
+                *xManager);
         }
     }
 }
@@ -366,21 +366,21 @@ bool AnnotationTag::Command( const CommandEvent& rCEvt )
 
 void AnnotationTag::Move( int nDX, int nDY )
 {
-    if( mxAnnotation.is() )
-    {
-        if( mrManager.GetDoc()->IsUndoEnabled() )
-            mrManager.GetDoc()->BegUndo( SdResId( STR_ANNOTATION_UNDO_MOVE ) );
+    if( !mxAnnotation.is() )
+        return;
 
-        RealPoint2D aPosition( mxAnnotation->getPosition() );
-        aPosition.X += static_cast<double>(nDX) / 100.0;
-        aPosition.Y += static_cast<double>(nDY) / 100.0;
-        mxAnnotation->setPosition( aPosition );
+    if( mrManager.GetDoc()->IsUndoEnabled() )
+        mrManager.GetDoc()->BegUndo( SdResId( STR_ANNOTATION_UNDO_MOVE ) );
 
-        if( mrManager.GetDoc()->IsUndoEnabled() )
-            mrManager.GetDoc()->EndUndo();
+    RealPoint2D aPosition( mxAnnotation->getPosition() );
+    aPosition.X += static_cast<double>(nDX) / 100.0;
+    aPosition.Y += static_cast<double>(nDY) / 100.0;
+    mxAnnotation->setPosition( aPosition );
 
-        mrView.updateHandles();
-    }
+    if( mrManager.GetDoc()->IsUndoEnabled() )
+        mrManager.GetDoc()->EndUndo();
+
+    mrView.updateHandles();
 }
 
 bool AnnotationTag::OnMove( const KeyEvent& rKEvt )
@@ -451,19 +451,19 @@ bool AnnotationTag::getContext( SdrViewContext& /*rContext*/ )
 
 void AnnotationTag::addCustomHandles( SdrHdlList& rHandlerList )
 {
-    if( mxAnnotation.is() )
-    {
-        SmartTagReference xThis( this );
-        std::unique_ptr<AnnotationHdl> pHdl(new AnnotationHdl( xThis, mxAnnotation, Point() ));
-        pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM );
-        pHdl->SetPageView( mrView.GetSdrPageView() );
+    if( !mxAnnotation.is() )
+        return;
 
-        RealPoint2D aPosition( mxAnnotation->getPosition() );
-        Point aBasePos( static_cast<long>(aPosition.X * 100.0), static_cast<long>(aPosition.Y * 100.0) );
-        pHdl->SetPos( aBasePos );
+    SmartTagReference xThis( this );
+    std::unique_ptr<AnnotationHdl> pHdl(new AnnotationHdl( xThis, mxAnnotation, Point() ));
+    pHdl->SetObjHdlNum( SMART_TAG_HDL_NUM );
+    pHdl->SetPageView( mrView.GetSdrPageView() );
 
-        rHandlerList.AddHdl( std::move(pHdl) );
-    }
+    RealPoint2D aPosition( mxAnnotation->getPosition() );
+    Point aBasePos( static_cast<long>(aPosition.X * 100.0), static_cast<long>(aPosition.Y * 100.0) );
+    pHdl->SetPos( aBasePos );
+
+    rHandlerList.AddHdl( std::move(pHdl) );
 }
 
 void AnnotationTag::disposing()
@@ -611,61 +611,61 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent&, rEvent, void)
 {
         vcl::Window* pWindow = rEvent.GetWindow();
 
-        if( pWindow )
+        if( !pWindow )
+            return;
+
+        if( pWindow == mpAnnotationWindow.get() )
         {
-            if( pWindow == mpAnnotationWindow.get() )
+            if( rEvent.GetId() == VclEventId::WindowDeactivate )
             {
-                if( rEvent.GetId() == VclEventId::WindowDeactivate )
+                // tdf#99388 and tdf#99712 if PopupMenu is active, suppress
+                // deletion of the AnnotationWindow which is triggered by
+                // it losing focus
+                if (!mrManager.getPopupMenuActive())
                 {
-                    // tdf#99388 and tdf#99712 if PopupMenu is active, suppress
-                    // deletion of the AnnotationWindow which is triggered by
-                    // it losing focus
-                    if (!mrManager.getPopupMenuActive())
-                    {
-                        if( mnClosePopupEvent )
-                            Application::RemoveUserEvent( mnClosePopupEvent );
+                    if( mnClosePopupEvent )
+                        Application::RemoveUserEvent( mnClosePopupEvent );
 
-                        mnClosePopupEvent = Application::PostUserEvent( LINK( this, AnnotationTag, ClosePopupHdl ) );
-                    }
+                    mnClosePopupEvent = Application::PostUserEvent( LINK( this, AnnotationTag, ClosePopupHdl ) );
                 }
             }
-            else if( pWindow == mpListenWindow )
+        }
+        else if( pWindow == mpListenWindow )
+        {
+            switch( rEvent.GetId() )
             {
-                switch( rEvent.GetId() )
+            case VclEventId::WindowMouseButtonUp:
                 {
-                case VclEventId::WindowMouseButtonUp:
-                    {
-                        // if we stop pressing the button without a mouse move we open the popup
-                        mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
-                        mpListenWindow = nullptr;
-                        if( mpAnnotationWindow.get() == nullptr )
-                            OpenPopup(false);
-                    }
-                    break;
-                case VclEventId::WindowMouseMove:
-                    {
-                        // if we move the mouse after a button down we want to start dragging
-                        mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
-                        mpListenWindow = nullptr;
+                    // if we stop pressing the button without a mouse move we open the popup
+                    mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+                    mpListenWindow = nullptr;
+                    if( mpAnnotationWindow.get() == nullptr )
+                        OpenPopup(false);
+                }
+                break;
+            case VclEventId::WindowMouseMove:
+                {
+                    // if we move the mouse after a button down we want to start dragging
+                    mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+                    mpListenWindow = nullptr;
 
-                        SdrHdl* pHdl = mrView.PickHandle(maMouseDownPos);
-                        if( pHdl )
-                        {
-                            mrView.BrkAction();
-                            const sal_uInt16 nDrgLog = static_cast<sal_uInt16>(pWindow->PixelToLogic(Size(DRGPIX,0)).Width());
+                    SdrHdl* pHdl = mrView.PickHandle(maMouseDownPos);
+                    if( pHdl )
+                    {
+                        mrView.BrkAction();
+                        const sal_uInt16 nDrgLog = static_cast<sal_uInt16>(pWindow->PixelToLogic(Size(DRGPIX,0)).Width());
 
-                            rtl::Reference< AnnotationTag > xTag( this );
+                        rtl::Reference< AnnotationTag > xTag( this );
 
-                            SdrDragMethod* pDragMethod = new AnnotationDragMove( mrView, xTag );
-                            mrView.BegDragObj(maMouseDownPos, nullptr, pHdl, nDrgLog, pDragMethod );
-                        }
+                        SdrDragMethod* pDragMethod = new AnnotationDragMove( mrView, xTag );
+                        mrView.BegDragObj(maMouseDownPos, nullptr, pHdl, nDrgLog, pDragMethod );
                     }
-                    break;
-                case VclEventId::ObjectDying:
-                    mpListenWindow = nullptr;
-                    break;
-                default: break;
                 }
+                break;
+            case VclEventId::ObjectDying:
+                mpListenWindow = nullptr;
+                break;
+            default: break;
             }
         }
 }
diff --git a/sd/source/ui/annotations/annotationwindow.cxx b/sd/source/ui/annotations/annotationwindow.cxx
index 621ea1d45502..76a37f8017e9 100644
--- a/sd/source/ui/annotations/annotationwindow.cxx
+++ b/sd/source/ui/annotations/annotationwindow.cxx
@@ -505,41 +505,41 @@ TextApiObject* getTextApiObject( const Reference< XAnnotation >& xAnnotation )
 
 void AnnotationWindow::setAnnotation( const Reference< XAnnotation >& xAnnotation )
 {
-    if( (xAnnotation != mxAnnotation) && xAnnotation.is() )
-    {
-        mxAnnotation = xAnnotation;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list