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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 3 19:54:53 UTC 2020


 sd/source/ui/animations/CustomAnimationList.cxx   |   22 -
 sd/source/ui/app/sdxfer.cxx                       |  332 +++++++++++-----------
 sd/source/ui/controller/slidelayoutcontroller.cxx |   52 +--
 sd/source/ui/dlg/BulletAndPositionDlg.cxx         |  179 +++++------
 sd/source/ui/dlg/navigatr.cxx                     |   46 +--
 sd/source/ui/func/fuconbez.cxx                    |   44 +-
 sd/source/ui/sidebar/MasterPagesSelector.cxx      |   74 ++--
 sd/source/ui/sidebar/SlideBackground.cxx          |   18 -
 sd/source/ui/view/Outliner.cxx                    |   44 +-
 sd/source/ui/view/drawview.cxx                    |  170 +++++------
 sd/source/ui/view/drtxtob1.cxx                    |   40 +-
 11 files changed, 510 insertions(+), 511 deletions(-)

New commits:
commit 186c34af5d5758b940cf84471b3464af764d8bb7
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 3 15:52:33 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 3 21:54:13 2020 +0200

    loplugin:flatten in sd
    
    Change-Id: I57cf26d800d8d414014b88c250ee1cbd47551bc4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100007
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 66a8f3cad4df..16788bfc9045 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -916,19 +916,19 @@ void CustomAnimationList::append( CustomAnimationEffectPtr pEffect )
 static void selectShape(weld::TreeView* pTreeList, const Reference< XShape >& xShape )
 {
     std::unique_ptr<weld::TreeIter> xEntry = pTreeList->make_iterator();
-    if (pTreeList->get_iter_first(*xEntry))
+    if (!pTreeList->get_iter_first(*xEntry))
+        return;
+
+    do
     {
-        do
+        CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(pTreeList->get_id(*xEntry).toInt64());
+        CustomAnimationEffectPtr pEffect(pEntry->getEffect());
+        if (pEffect)
         {
-            CustomAnimationListEntryItem* pEntry = reinterpret_cast<CustomAnimationListEntryItem*>(pTreeList->get_id(*xEntry).toInt64());
-            CustomAnimationEffectPtr pEffect(pEntry->getEffect());
-            if (pEffect)
-            {
-                if (pEffect->getTarget() == xShape)
-                    pTreeList->select(*xEntry);
-            }
-        } while (pTreeList->iter_next(*xEntry));
-    }
+            if (pEffect->getTarget() == xShape)
+                pTreeList->select(*xEntry);
+        }
+    } while (pTreeList->iter_next(*xEntry));
 }
 
 void CustomAnimationList::onSelectionChanged(const Any& rSelection)
diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 9ce97f817e73..769003d1ded9 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -141,101 +141,101 @@ SdTransferable::~SdTransferable()
 
 void SdTransferable::CreateObjectReplacement( SdrObject* pObj )
 {
-    if( pObj )
-    {
-        mpOLEDataHelper.reset();
-        mpGraphic.reset();
-        mpBookmark.reset();
-        mpImageMap.reset();
+    if( !pObj )
+        return;
+
+    mpOLEDataHelper.reset();
+    mpGraphic.reset();
+    mpBookmark.reset();
+    mpImageMap.reset();
 
-        if( nullptr!= dynamic_cast< const SdrOle2Obj* >( pObj ) )
+    if( nullptr!= dynamic_cast< const SdrOle2Obj* >( pObj ) )
+    {
+        try
         {
-            try
+            uno::Reference < embed::XEmbeddedObject > xObj = static_cast< SdrOle2Obj* >( pObj )->GetObjRef();
+            uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
+            if( xObj.is() && xPersist.is() && xPersist->hasEntry() )
             {
-                uno::Reference < embed::XEmbeddedObject > xObj = static_cast< SdrOle2Obj* >( pObj )->GetObjRef();
-                uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
-                if( xObj.is() && xPersist.is() && xPersist->hasEntry() )
-                {
-                    mpOLEDataHelper.reset( new TransferableDataHelper( new SvEmbedTransferHelper( xObj, static_cast< SdrOle2Obj* >( pObj )->GetGraphic(), static_cast< SdrOle2Obj* >( pObj )->GetAspect() ) ) );
+                mpOLEDataHelper.reset( new TransferableDataHelper( new SvEmbedTransferHelper( xObj, static_cast< SdrOle2Obj* >( pObj )->GetGraphic(), static_cast< SdrOle2Obj* >( pObj )->GetAspect() ) ) );
 
-                    // TODO/LATER: the standalone handling of the graphic should not be used any more in future
-                    // The EmbedDataHelper should bring the graphic in future
-                    const Graphic* pObjGr = static_cast< SdrOle2Obj* >( pObj )->GetGraphic();
-                    if ( pObjGr )
-                        mpGraphic.reset( new Graphic( *pObjGr ) );
-                }
+                // TODO/LATER: the standalone handling of the graphic should not be used any more in future
+                // The EmbedDataHelper should bring the graphic in future
+                const Graphic* pObjGr = static_cast< SdrOle2Obj* >( pObj )->GetGraphic();
+                if ( pObjGr )
+                    mpGraphic.reset( new Graphic( *pObjGr ) );
             }
-            catch( uno::Exception& )
-            {}
         }
-        else if( dynamic_cast< const SdrGrafObj *>( pObj ) !=  nullptr && (mpSourceDoc && !SdDrawDocument::GetAnimationInfo( pObj )) )
-        {
-            mpGraphic.reset( new Graphic( static_cast< SdrGrafObj* >( pObj )->GetTransformedGraphic() ) );
-        }
-        else if( pObj->IsUnoObj() && SdrInventor::FmForm == pObj->GetObjInventor() && ( pObj->GetObjIdentifier() == sal_uInt16(OBJ_FM_BUTTON) ) )
-        {
-            SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pObj );
+        catch( uno::Exception& )
+        {}
+    }
+    else if( dynamic_cast< const SdrGrafObj *>( pObj ) !=  nullptr && (mpSourceDoc && !SdDrawDocument::GetAnimationInfo( pObj )) )
+    {
+        mpGraphic.reset( new Graphic( static_cast< SdrGrafObj* >( pObj )->GetTransformedGraphic() ) );
+    }
+    else if( pObj->IsUnoObj() && SdrInventor::FmForm == pObj->GetObjInventor() && ( pObj->GetObjIdentifier() == sal_uInt16(OBJ_FM_BUTTON) ) )
+    {
+        SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pObj );
 
-            if (SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
-            {
-                const Reference< css::awt::XControlModel >& xControlModel( pUnoCtrl->GetUnoControlModel() );
+        if (SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
+        {
+            const Reference< css::awt::XControlModel >& xControlModel( pUnoCtrl->GetUnoControlModel() );
 
-                if( !xControlModel.is() )
-                    return;
+            if( !xControlModel.is() )
+                return;
 
-                Reference< css::beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY );
+            Reference< css::beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY );
 
-                if( !xPropSet.is() )
-                    return;
+            if( !xPropSet.is() )
+                return;
 
-                css::form::FormButtonType  eButtonType;
-                Any                                     aTmp( xPropSet->getPropertyValue( "ButtonType" ) );
+            css::form::FormButtonType  eButtonType;
+            Any                                     aTmp( xPropSet->getPropertyValue( "ButtonType" ) );
 
-                if( aTmp >>= eButtonType )
-                {
-                    OUString aLabel, aURL;
+            if( aTmp >>= eButtonType )
+            {
+                OUString aLabel, aURL;
 
-                    xPropSet->getPropertyValue( "Label" ) >>= aLabel;
-                    xPropSet->getPropertyValue( "TargetURL" ) >>= aURL;
+                xPropSet->getPropertyValue( "Label" ) >>= aLabel;
+                xPropSet->getPropertyValue( "TargetURL" ) >>= aURL;
 
-                    mpBookmark.reset( new INetBookmark( aURL, aLabel ) );
-                }
+                mpBookmark.reset( new INetBookmark( aURL, aLabel ) );
             }
         }
-        else if( dynamic_cast< const SdrTextObj *>( pObj ) !=  nullptr )
+    }
+    else if( dynamic_cast< const SdrTextObj *>( pObj ) !=  nullptr )
+    {
+        const OutlinerParaObject* pPara;
+
+        if( (pPara = static_cast< SdrTextObj* >( pObj )->GetOutlinerParaObject()) != nullptr )
         {
-            const OutlinerParaObject* pPara;
+            const SvxFieldItem* pField;
 
-            if( (pPara = static_cast< SdrTextObj* >( pObj )->GetOutlinerParaObject()) != nullptr )
+            if( (pField = pPara->GetTextObject().GetField()) != nullptr )
             {
-                const SvxFieldItem* pField;
+                const SvxFieldData* pData = pField->GetField();
 
-                if( (pField = pPara->GetTextObject().GetField()) != nullptr )
+                if( auto pURL = dynamic_cast< const SvxURLField *>( pData ) )
                 {
-                    const SvxFieldData* pData = pField->GetField();
-
-                    if( auto pURL = dynamic_cast< const SvxURLField *>( pData ) )
+                    // #i63399# This special code identifies TextFrames which have just a URL
+                    // as content and directly add this to the clipboard, probably to avoid adding
+                    // an unnecessary DrawObject to the target where paste may take place. This is
+                    // wanted only for SdrObjects with no fill and no line, else it is necessary to
+                    // use the whole SdrObect. Test here for Line/FillStyle and take shortcut only
+                    // when both are unused
+                    if(!pObj->HasFillStyle() && !pObj->HasLineStyle())
                     {
-                        // #i63399# This special code identifies TextFrames which have just a URL
-                        // as content and directly add this to the clipboard, probably to avoid adding
-                        // an unnecessary DrawObject to the target where paste may take place. This is
-                        // wanted only for SdrObjects with no fill and no line, else it is necessary to
-                        // use the whole SdrObect. Test here for Line/FillStyle and take shortcut only
-                        // when both are unused
-                        if(!pObj->HasFillStyle() && !pObj->HasLineStyle())
-                        {
-                            mpBookmark.reset( new INetBookmark( pURL->GetURL(), pURL->GetRepresentation() ) );
-                        }
+                        mpBookmark.reset( new INetBookmark( pURL->GetURL(), pURL->GetRepresentation() ) );
                     }
                 }
             }
         }
+    }
 
-        SvxIMapInfo* pInfo = SvxIMapInfo::GetIMapInfo( pObj );
+    SvxIMapInfo* pInfo = SvxIMapInfo::GetIMapInfo( pObj );
 
-        if( pInfo )
-            mpImageMap.reset( new ImageMap( pInfo->GetImageMap() ) );
-    }
+    if( pInfo )
+        mpImageMap.reset( new ImageMap( pInfo->GetImageMap() ) );
 }
 
 void SdTransferable::CreateData()
@@ -301,32 +301,32 @@ void SdTransferable::CreateData()
     }
 
     // set VisArea and adjust objects if necessary
-    if( maVisArea.IsEmpty() &&
+    if( !(maVisArea.IsEmpty() &&
         mpSdDrawDocumentIntern && mpSdViewIntern &&
-        mpSdDrawDocumentIntern->GetPageCount() )
+        mpSdDrawDocumentIntern->GetPageCount()) )
+        return;
+
+    SdPage* pPage = mpSdDrawDocumentIntern->GetSdPage( 0, PageKind::Standard );
+
+    if( 1 == mpSdDrawDocumentIntern->GetPageCount() )
     {
-        SdPage* pPage = mpSdDrawDocumentIntern->GetSdPage( 0, PageKind::Standard );
+        // #112978# need to use GetAllMarkedBoundRect instead of GetAllMarkedRect to get
+        // fat lines correctly
+        maVisArea = mpSdViewIntern->GetAllMarkedBoundRect();
+        Point   aOrigin( maVisArea.TopLeft() );
+        Size    aVector( -aOrigin.X(), -aOrigin.Y() );
 
-        if( 1 == mpSdDrawDocumentIntern->GetPageCount() )
+        for( size_t nObj = 0, nObjCount = pPage->GetObjCount(); nObj < nObjCount; ++nObj )
         {
-            // #112978# need to use GetAllMarkedBoundRect instead of GetAllMarkedRect to get
-            // fat lines correctly
-            maVisArea = mpSdViewIntern->GetAllMarkedBoundRect();
-            Point   aOrigin( maVisArea.TopLeft() );
-            Size    aVector( -aOrigin.X(), -aOrigin.Y() );
-
-            for( size_t nObj = 0, nObjCount = pPage->GetObjCount(); nObj < nObjCount; ++nObj )
-            {
-                SdrObject* pObj = pPage->GetObj( nObj );
-                pObj->NbcMove( aVector );
-            }
+            SdrObject* pObj = pPage->GetObj( nObj );
+            pObj->NbcMove( aVector );
         }
-        else
-            maVisArea.SetSize( pPage->GetSize() );
-
-        // output is at the zero point
-        maVisArea.SetPos( Point() );
     }
+    else
+        maVisArea.SetSize( pPage->GetSize() );
+
+    // output is at the zero point
+    maVisArea.SetPos( Point() );
 }
 
 static bool lcl_HasOnlyControls( SdrModel* pModel )
@@ -375,68 +375,68 @@ static bool lcl_HasOnlyOneTable( SdrModel* pModel )
 
 void SdTransferable::AddSupportedFormats()
 {
-    if( !mbPageTransferable || mbPageTransferablePersistent )
-    {
-        if( !mbLateInit )
-            CreateData();
+    if( !(!mbPageTransferable || mbPageTransferablePersistent) )
+        return;
 
-        if( mpObjDesc )
-            AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
+    if( !mbLateInit )
+        CreateData();
 
-        if( mpOLEDataHelper )
-        {
-            AddFormat( SotClipboardFormatId::EMBED_SOURCE );
+    if( mpObjDesc )
+        AddFormat( SotClipboardFormatId::OBJECTDESCRIPTOR );
 
-            DataFlavorExVector              aVector( mpOLEDataHelper->GetDataFlavorExVector() );
+    if( mpOLEDataHelper )
+    {
+        AddFormat( SotClipboardFormatId::EMBED_SOURCE );
 
-            for( const auto& rItem : aVector )
-                AddFormat( rItem );
-        }
-        else if( mpGraphic )
-        {
-            // #i25616#
-            AddFormat( SotClipboardFormatId::DRAWING );
+        DataFlavorExVector              aVector( mpOLEDataHelper->GetDataFlavorExVector() );
 
-            AddFormat( SotClipboardFormatId::SVXB );
+        for( const auto& rItem : aVector )
+            AddFormat( rItem );
+    }
+    else if( mpGraphic )
+    {
+        // #i25616#
+        AddFormat( SotClipboardFormatId::DRAWING );
 
-            if( mpGraphic->GetType() == GraphicType::Bitmap )
-            {
-                AddFormat( SotClipboardFormatId::PNG );
-                AddFormat( SotClipboardFormatId::BITMAP );
-                AddFormat( SotClipboardFormatId::GDIMETAFILE );
-            }
-            else
-            {
-                AddFormat( SotClipboardFormatId::GDIMETAFILE );
-                AddFormat( SotClipboardFormatId::PNG );
-                AddFormat( SotClipboardFormatId::BITMAP );
-            }
-        }
-        else if( mpBookmark )
+        AddFormat( SotClipboardFormatId::SVXB );
+
+        if( mpGraphic->GetType() == GraphicType::Bitmap )
         {
-            AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
-            AddFormat( SotClipboardFormatId::STRING );
+            AddFormat( SotClipboardFormatId::PNG );
+            AddFormat( SotClipboardFormatId::BITMAP );
+            AddFormat( SotClipboardFormatId::GDIMETAFILE );
         }
         else
         {
-            AddFormat( SotClipboardFormatId::EMBED_SOURCE );
-            AddFormat( SotClipboardFormatId::DRAWING );
-            if( !mpSdDrawDocument || !lcl_HasOnlyControls( mpSdDrawDocument ) )
-            {
-                AddFormat( SotClipboardFormatId::GDIMETAFILE );
-                AddFormat( SotClipboardFormatId::PNG );
-                AddFormat( SotClipboardFormatId::BITMAP );
-            }
-
-            if( lcl_HasOnlyOneTable( mpSdDrawDocument ) ) {
-                AddFormat( SotClipboardFormatId::RTF );
-                AddFormat( SotClipboardFormatId::RICHTEXT );
-            }
+            AddFormat( SotClipboardFormatId::GDIMETAFILE );
+            AddFormat( SotClipboardFormatId::PNG );
+            AddFormat( SotClipboardFormatId::BITMAP );
+        }
+    }
+    else if( mpBookmark )
+    {
+        AddFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK );
+        AddFormat( SotClipboardFormatId::STRING );
+    }
+    else
+    {
+        AddFormat( SotClipboardFormatId::EMBED_SOURCE );
+        AddFormat( SotClipboardFormatId::DRAWING );
+        if( !mpSdDrawDocument || !lcl_HasOnlyControls( mpSdDrawDocument ) )
+        {
+            AddFormat( SotClipboardFormatId::GDIMETAFILE );
+            AddFormat( SotClipboardFormatId::PNG );
+            AddFormat( SotClipboardFormatId::BITMAP );
         }
 
-        if( mpImageMap )
-            AddFormat( SotClipboardFormatId::SVIM );
+        if( lcl_HasOnlyOneTable( mpSdDrawDocument ) ) {
+            AddFormat( SotClipboardFormatId::RTF );
+            AddFormat( SotClipboardFormatId::RICHTEXT );
+        }
     }
+
+    if( mpImageMap )
+        AddFormat( SotClipboardFormatId::SVIM );
 }
 
 bool SdTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDoc )
@@ -666,44 +666,44 @@ void SdTransferable::SetObjectDescriptor( std::unique_ptr<TransferableObjectDesc
 
 void SdTransferable::SetPageBookmarks( const std::vector<OUString> &rPageBookmarks, bool bPersistent )
 {
-    if( mpSourceDoc )
-    {
-        if( mpSdViewIntern )
-            mpSdViewIntern->HideSdrPage();
+    if( !mpSourceDoc )
+        return;
 
-        mpSdDrawDocument->ClearModel(false);
+    if( mpSdViewIntern )
+        mpSdViewIntern->HideSdrPage();
 
-        mpPageDocShell = nullptr;
+    mpSdDrawDocument->ClearModel(false);
 
-        maPageBookmarks.clear();
+    mpPageDocShell = nullptr;
 
-        if( bPersistent )
-        {
-            mpSdDrawDocument->CreateFirstPages(mpSourceDoc);
-            mpSdDrawDocument->InsertBookmarkAsPage( rPageBookmarks, nullptr, false, true, 1, true,
-                                                    mpSourceDoc->GetDocSh(), true, true, false );
-        }
-        else
-        {
-            mpPageDocShell = mpSourceDoc->GetDocSh();
-            maPageBookmarks = rPageBookmarks;
-        }
+    maPageBookmarks.clear();
 
-        if( mpSdViewIntern )
-        {
-            SdPage* pPage = mpSdDrawDocument->GetSdPage( 0, PageKind::Standard );
+    if( bPersistent )
+    {
+        mpSdDrawDocument->CreateFirstPages(mpSourceDoc);
+        mpSdDrawDocument->InsertBookmarkAsPage( rPageBookmarks, nullptr, false, true, 1, true,
+                                                mpSourceDoc->GetDocSh(), true, true, false );
+    }
+    else
+    {
+        mpPageDocShell = mpSourceDoc->GetDocSh();
+        maPageBookmarks = rPageBookmarks;
+    }
 
-            if( pPage )
-            {
-                mpSdViewIntern->MarkAllObj( mpSdViewIntern->ShowSdrPage( pPage ) );
-            }
-        }
+    if( mpSdViewIntern )
+    {
+        SdPage* pPage = mpSdDrawDocument->GetSdPage( 0, PageKind::Standard );
 
-        // set flags for page transferable; if ( mbPageTransferablePersistent == sal_False ),
-        // don't offer any formats => it's just for internal purposes
-        mbPageTransferable = true;
-        mbPageTransferablePersistent = bPersistent;
+        if( pPage )
+        {
+            mpSdViewIntern->MarkAllObj( mpSdViewIntern->ShowSdrPage( pPage ) );
+        }
     }
+
+    // set flags for page transferable; if ( mbPageTransferablePersistent == sal_False ),
+    // don't offer any formats => it's just for internal purposes
+    mbPageTransferable = true;
+    mbPageTransferablePersistent = bPersistent;
 }
 
 sal_Int64 SAL_CALL SdTransferable::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
index 82a2e9bd21e3..41071def8409 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -217,34 +217,34 @@ LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl, weld::Widg
         mxFrame2->show();
     }
 
-    if( eMode == DrawViewMode_DRAW )
+    if( eMode != DrawViewMode_DRAW )
+        return;
+
+    if( !mxFrame.is() )
+        return;
+
+    OUString sSlotStr;
+
+    if( bInsertPage )
+        sSlotStr = ".uno:DuplicatePage";
+    else
+        sSlotStr = ".uno:Undo";
+
+    css::uno::Reference<css::graphic::XGraphic> xSlotImage = vcl::CommandInfoProvider::GetXGraphicForCommand(sSlotStr, mxFrame);
+
+    OUString sSlotTitle;
+    if( bInsertPage )
     {
-        if( mxFrame.is() )
-        {
-            OUString sSlotStr;
-
-            if( bInsertPage )
-                sSlotStr = ".uno:DuplicatePage";
-            else
-                sSlotStr = ".uno:Undo";
-
-            css::uno::Reference<css::graphic::XGraphic> xSlotImage = vcl::CommandInfoProvider::GetXGraphicForCommand(sSlotStr, mxFrame);
-
-            OUString sSlotTitle;
-            if( bInsertPage )
-            {
-                auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sSlotStr, mxControl->getModuleName());
-                sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
-            }
-            else
-                sSlotTitle = SdResId( STR_RESET_LAYOUT );
-
-            mxMoreButton->set_label(sSlotTitle);
-            mxMoreButton->set_image(xSlotImage);
-            mxMoreButton->connect_clicked(LINK(this, LayoutToolbarMenu, SelectToolbarMenuHdl));
-            mxMoreButton->show();
-        }
+        auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sSlotStr, mxControl->getModuleName());
+        sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
     }
+    else
+        sSlotTitle = SdResId( STR_RESET_LAYOUT );
+
+    mxMoreButton->set_label(sSlotTitle);
+    mxMoreButton->set_image(xSlotImage);
+    mxMoreButton->connect_clicked(LINK(this, LayoutToolbarMenu, SelectToolbarMenuHdl));
+    mxMoreButton->show();
 }
 
 IMPL_LINK(LayoutToolbarMenu, SelectValueSetHdl, ValueSet*, pLayoutSet, void)
diff --git a/sd/source/ui/dlg/BulletAndPositionDlg.cxx b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
index 498ea1befcc5..cfc7db7ed050 100644
--- a/sd/source/ui/dlg/BulletAndPositionDlg.cxx
+++ b/sd/source/ui/dlg/BulletAndPositionDlg.cxx
@@ -821,97 +821,96 @@ IMPL_LINK(SvxBulletAndPositionDlg, GraphicHdl_Impl, const OString&, rIdent, void
             }
         }
     }
-    if (bSucc)
-    {
-        aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(eCoreUnit));
+    if (!bSucc)
+        return;
 
-        sal_uInt16 nMask = 1;
-        for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+    aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(eCoreUnit));
+
+    sal_uInt16 nMask = 1;
+    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+    {
+        if (nActNumLvl & nMask)
         {
-            if (nActNumLvl & nMask)
-            {
-                SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
-                aNumFmt.SetCharFormatName(m_sNumCharFmtName);
-                aNumFmt.SetGraphic(aGrfName);
+            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+            aNumFmt.SetCharFormatName(m_sNumCharFmtName);
+            aNumFmt.SetGraphic(aGrfName);
 
-                // set size for a later comparison
-                const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
-                // initiate asynchronous loading
-                sal_Int16 eOrient = aNumFmt.GetVertOrient();
-                aNumFmt.SetGraphicBrush(pBrushItem, &aSize, &eOrient);
-                aInitSize[i] = aNumFmt.GetGraphicSize();
+            // set size for a later comparison
+            const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
+            // initiate asynchronous loading
+            sal_Int16 eOrient = aNumFmt.GetVertOrient();
+            aNumFmt.SetGraphicBrush(pBrushItem, &aSize, &eOrient);
+            aInitSize[i] = aNumFmt.GetGraphicSize();
 
-                pActNum->SetLevel(i, aNumFmt);
-            }
-            nMask <<= 1;
+            pActNum->SetLevel(i, aNumFmt);
         }
-        m_xRatioCB->set_sensitive(true);
-        m_xWidthFT->set_sensitive(true);
-        m_xHeightFT->set_sensitive(true);
-        m_xWidthMF->set_sensitive(true);
-        m_xHeightMF->set_sensitive(true);
-        SetMetricValue(*m_xWidthMF, aSize.Width(), eCoreUnit);
-        SetMetricValue(*m_xHeightMF, aSize.Height(), eCoreUnit);
-
-        SetModified();
-        //needed due to asynchronous loading of graphics in the SvxBrushItem
-        aInvalidateTimer.Start();
+        nMask <<= 1;
     }
+    m_xRatioCB->set_sensitive(true);
+    m_xWidthFT->set_sensitive(true);
+    m_xHeightFT->set_sensitive(true);
+    m_xWidthMF->set_sensitive(true);
+    m_xHeightMF->set_sensitive(true);
+    SetMetricValue(*m_xWidthMF, aSize.Width(), eCoreUnit);
+    SetMetricValue(*m_xHeightMF, aSize.Height(), eCoreUnit);
+
+    SetModified();
+    //needed due to asynchronous loading of graphics in the SvxBrushItem
+    aInvalidateTimer.Start();
 }
 
 IMPL_LINK_NOARG(SvxBulletAndPositionDlg, PopupActivateHdl_Impl, weld::ToggleButton&, void)
 {
-    if (!m_xGalleryMenu)
-    {
-        m_xGalleryMenu = m_xBuilder->weld_menu("gallerysubmenu");
-        weld::WaitObject aWait(p_Window);
+    if (m_xGalleryMenu)
+        return;
 
-        if (GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames))
-        {
-            GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
+    m_xGalleryMenu = m_xBuilder->weld_menu("gallerysubmenu");
+    weld::WaitObject aWait(p_Window);
 
-            Graphic aGraphic;
-            OUString sGrfName;
-            ScopedVclPtrInstance<VirtualDevice> pVD;
-            size_t i = 0;
-            for (const auto& grfName : aGrfNames)
-            {
-                sGrfName = grfName;
-                OUString sItemId = "gallery" + OUString::number(i);
-                INetURLObject aObj(sGrfName);
-                if (aObj.GetProtocol() == INetProtocol::File)
-                    sGrfName = aObj.PathToFileName();
-                if (GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, i, &aGraphic))
-                {
-                    BitmapEx aBitmap(aGraphic.GetBitmapEx());
-                    Size aSize(aBitmap.GetSizePixel());
-                    if (aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
-                    {
-                        bool bWidth = aSize.Width() > aSize.Height();
-                        double nScale
-                            = bWidth ? double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width())
-                                     : double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height());
-                        aBitmap.Scale(nScale, nScale);
-                    }
-                    pVD->SetOutputSizePixel(aBitmap.GetSizePixel(), false);
-                    pVD->DrawBitmapEx(Point(), aBitmap);
+    if (!GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames))
+        return;
 
-                    // We want to show only icon names not full path.
-                    aObj.removeExtension();
-                    OUString sIconName
-                        = aObj.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
+    GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
 
-                    m_xGalleryMenu->append(sItemId, sIconName, *pVD);
-                }
-                else
-                {
-                    m_xGalleryMenu->append(sItemId, sGrfName);
-                }
-                ++i;
+    Graphic aGraphic;
+    OUString sGrfName;
+    ScopedVclPtrInstance<VirtualDevice> pVD;
+    size_t i = 0;
+    for (const auto& grfName : aGrfNames)
+    {
+        sGrfName = grfName;
+        OUString sItemId = "gallery" + OUString::number(i);
+        INetURLObject aObj(sGrfName);
+        if (aObj.GetProtocol() == INetProtocol::File)
+            sGrfName = aObj.PathToFileName();
+        if (GalleryExplorer::GetGraphicObj(GALLERY_THEME_BULLETS, i, &aGraphic))
+        {
+            BitmapEx aBitmap(aGraphic.GetBitmapEx());
+            Size aSize(aBitmap.GetSizePixel());
+            if (aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
+            {
+                bool bWidth = aSize.Width() > aSize.Height();
+                double nScale = bWidth
+                                    ? double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width())
+                                    : double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height());
+                aBitmap.Scale(nScale, nScale);
             }
-            GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
+            pVD->SetOutputSizePixel(aBitmap.GetSizePixel(), false);
+            pVD->DrawBitmapEx(Point(), aBitmap);
+
+            // We want to show only icon names not full path.
+            aObj.removeExtension();
+            OUString sIconName = aObj.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
+
+            m_xGalleryMenu->append(sItemId, sIconName, *pVD);
+        }
+        else
+        {
+            m_xGalleryMenu->append(sItemId, sGrfName);
         }
+        ++i;
     }
+    GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
 }
 
 IMPL_LINK_NOARG(SvxBulletAndPositionDlg, BulletHdl_Impl, weld::Button&, void)
@@ -950,26 +949,26 @@ IMPL_LINK_NOARG(SvxBulletAndPositionDlg, BulletHdl_Impl, weld::Button&, void)
         aMap.SetCharFont(aActBulletFont);
     if (bSameBullet)
         aMap.SetChar(cBullet);
-    if (aMap.run() == RET_OK)
-    {
-        // change Font Numrules
-        aActBulletFont = aMap.GetCharFont();
+    if (aMap.run() != RET_OK)
+        return;
 
-        sal_uInt16 _nMask = 1;
-        for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+    // change Font Numrules
+    aActBulletFont = aMap.GetCharFont();
+
+    sal_uInt16 _nMask = 1;
+    for (sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
+    {
+        if (nActNumLvl & _nMask)
         {
-            if (nActNumLvl & _nMask)
-            {
-                SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
-                aNumFmt.SetBulletFont(&aActBulletFont);
-                aNumFmt.SetBulletChar(static_cast<sal_Unicode>(aMap.GetChar()));
-                pActNum->SetLevel(i, aNumFmt);
-            }
-            _nMask <<= 1;
+            SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
+            aNumFmt.SetBulletFont(&aActBulletFont);
+            aNumFmt.SetBulletChar(static_cast<sal_Unicode>(aMap.GetChar()));
+            pActNum->SetLevel(i, aNumFmt);
         }
-
-        SetModified();
+        _nMask <<= 1;
     }
+
+    SetModified();
 }
 
 IMPL_LINK(SvxBulletAndPositionDlg, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx
index 7dc5177fc8b2..d3d2e95ca4e0 100644
--- a/sd/source/ui/dlg/navigatr.cxx
+++ b/sd/source/ui/dlg/navigatr.cxx
@@ -358,22 +358,22 @@ IMPL_LINK(SdNavigatorWin, MenuSelectHdl, const OString&, rIdent, void)
     sal_uInt32 nMenuId = rIdent.toUInt32();
 
     NavigatorDragType eDT = static_cast<NavigatorDragType>(nMenuId);
-    if( meDragType != eDT )
-    {
-        meDragType = eDT;
-        SetDragImage();
+    if( meDragType == eDT )
+        return;
 
-        if( meDragType == NAVIGATOR_DRAGTYPE_URL )
-        {
-            // patch, prevents endless loop
-            if (mxTlbObjects->count_selected_rows() > 1)
-                mxTlbObjects->unselect_all();
+    meDragType = eDT;
+    SetDragImage();
 
-            mxTlbObjects->set_selection_mode(SelectionMode::Single);
-        }
-        else
-            mxTlbObjects->set_selection_mode(SelectionMode::Multiple);
+    if( meDragType == NAVIGATOR_DRAGTYPE_URL )
+    {
+        // patch, prevents endless loop
+        if (mxTlbObjects->count_selected_rows() > 1)
+            mxTlbObjects->unselect_all();
+
+        mxTlbObjects->set_selection_mode(SelectionMode::Single);
     }
+    else
+        mxTlbObjects->set_selection_mode(SelectionMode::Multiple);
 }
 
 IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, const OString&, rIdent, void )
@@ -390,19 +390,19 @@ IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, const OString&, rIdent, void )
 
     // Remember the selection in the FrameView.
     NavDocInfo* pInfo = GetDocInfo();
-    if (pInfo != nullptr)
+    if (pInfo == nullptr)
+        return;
+
+    ::sd::DrawDocShell* pDocShell = pInfo->mpDocShell;
+    if (pDocShell != nullptr)
     {
-        ::sd::DrawDocShell* pDocShell = pInfo->mpDocShell;
-        if (pDocShell != nullptr)
+        ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
+        if (pViewShell != nullptr)
         {
-            ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
-            if (pViewShell != nullptr)
+            ::sd::FrameView* pFrameView = pViewShell->GetFrameView();
+            if (pFrameView != nullptr)
             {
-                ::sd::FrameView* pFrameView = pViewShell->GetFrameView();
-                if (pFrameView != nullptr)
-                {
-                    pFrameView->SetIsNavigatorShowingAllShapes(bShowAllShapes);
-                }
+                pFrameView->SetIsNavigatorShowingAllShapes(bShowAllShapes);
             }
         }
     }
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index 526210ae84c9..dffec4d18d99 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -111,29 +111,29 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
     if( SfxItemState::SET == pArgs->GetItemState( SID_ADD_MOTION_PATH, true, &pPoolItem ) )
         maTargets = static_cast<const SfxUnoAnyItem*>( pPoolItem )->GetValue();
 
-    if (nSlotId == SID_DRAW_FREELINE_NOFILL)
-    {
-        const SfxUInt16Item* pTransparence  = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
-        const SfxStringItem* pColor         = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
-        const SfxUInt16Item* pWidth         = rReq.GetArg<SfxUInt16Item>(FN_PARAM_3);
-        const SfxStringItem* pShapeName     = rReq.GetArg<SfxStringItem>(SID_SHAPE_NAME);
+    if (nSlotId != SID_DRAW_FREELINE_NOFILL)
+        return;
 
-        if (pTransparence && pTransparence->GetValue() > 0)
-        {
-            mnTransparence = pTransparence->GetValue();
-        }
-        if (pColor && !pColor->GetValue().isEmpty())
-        {
-            msColor = pColor->GetValue();
-        }
-        if (pWidth && pWidth->GetValue() > 0)
-        {
-            mnWidth = pWidth->GetValue();
-        }
-        if (pShapeName && !pShapeName->GetValue().isEmpty())
-        {
-            msShapeName = pShapeName->GetValue();
-        }
+    const SfxUInt16Item* pTransparence  = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
+    const SfxStringItem* pColor         = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
+    const SfxUInt16Item* pWidth         = rReq.GetArg<SfxUInt16Item>(FN_PARAM_3);
+    const SfxStringItem* pShapeName     = rReq.GetArg<SfxStringItem>(SID_SHAPE_NAME);
+
+    if (pTransparence && pTransparence->GetValue() > 0)
+    {
+        mnTransparence = pTransparence->GetValue();
+    }
+    if (pColor && !pColor->GetValue().isEmpty())
+    {
+        msColor = pColor->GetValue();
+    }
+    if (pWidth && pWidth->GetValue() > 0)
+    {
+        mnWidth = pWidth->GetValue();
+    }
+    if (pShapeName && !pShapeName->GetValue().isEmpty())
+    {
+        msShapeName = pShapeName->GetValue();
     }
 }
 
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx
index 0c34781480b0..169587820579 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx
@@ -172,18 +172,18 @@ IMPL_LINK(MasterPagesSelector, RightClickHandler, const MouseEvent&, rEvent, voi
     mxPreviewValueSet->GrabFocus ();
     mxPreviewValueSet->ReleaseMouse();
     SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
-    if (pViewFrame != nullptr)
+    if (pViewFrame == nullptr)
+        return;
+
+    SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+    if (pDispatcher != nullptr)
     {
-        SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
-        if (pDispatcher != nullptr)
+        sal_uInt16 nIndex = mxPreviewValueSet->GetItemId (rEvent.GetPosPixel());
+        if (nIndex > 0)
         {
-            sal_uInt16 nIndex = mxPreviewValueSet->GetItemId (rEvent.GetPosPixel());
-            if (nIndex > 0)
-            {
-                mxPreviewValueSet->SelectItem (nIndex);
-                // Now do the actual display of the context menu
-                ShowContextMenu(&rEvent.GetPosPixel());
-            }
+            mxPreviewValueSet->SelectItem (nIndex);
+            // Now do the actual display of the context menu
+            ShowContextMenu(&rEvent.GetPosPixel());
         }
     }
 }
@@ -193,35 +193,35 @@ void MasterPagesSelector::ShowContextMenu(const Point* pPos)
     // Use the currently selected item and show the popup menu in its
     // center.
     const sal_uInt16 nIndex = mxPreviewValueSet->GetSelectedItemId();
-    if (nIndex > 0)
+    if (nIndex <= 0)
+        return;
+
+    // The position of the upper left corner of the context menu is
+    // taken either from the mouse position (when the command was sent
+    // as reaction to a right click) or in the center of the selected
+    // item (when the command was sent as reaction to Shift+F10.)
+    Point aPosition;
+    if (!pPos)
     {
-        // The position of the upper left corner of the context menu is
-        // taken either from the mouse position (when the command was sent
-        // as reaction to a right click) or in the center of the selected
-        // item (when the command was sent as reaction to Shift+F10.)
-        Point aPosition;
-        if (!pPos)
-        {
-            ::tools::Rectangle aBBox (mxPreviewValueSet->GetItemRect(nIndex));
-            aPosition = aBBox.Center();
-        }
-        else
-            aPosition = *pPos;
-
-        // Setup the menu.
-        VclBuilder aBuilder(nullptr, AllSettings::GetUIRootDir(), GetContextMenuUIFile(), "");
-        VclPtr<PopupMenu> pMenu(aBuilder.get_menu("menu"));
-        FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
-        if (pMenuWindow != nullptr)
-            pMenuWindow->SetPopupModeFlags(
-                pMenuWindow->GetPopupModeFlags() | FloatWinPopupFlags::NoMouseUpClose);
-        pMenu->SetSelectHdl(LINK(this, MasterPagesSelector, OnMenuItemSelected));
-
-        ProcessPopupMenu(*pMenu);
-
-        // Show the menu.
-        pMenu->Execute(this, ::tools::Rectangle(aPosition,Size(1,1)), PopupMenuFlags::ExecuteDown);
+        ::tools::Rectangle aBBox (mxPreviewValueSet->GetItemRect(nIndex));
+        aPosition = aBBox.Center();
     }
+    else
+        aPosition = *pPos;
+
+    // Setup the menu.
+    VclBuilder aBuilder(nullptr, AllSettings::GetUIRootDir(), GetContextMenuUIFile(), "");
+    VclPtr<PopupMenu> pMenu(aBuilder.get_menu("menu"));
+    FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
+    if (pMenuWindow != nullptr)
+        pMenuWindow->SetPopupModeFlags(
+            pMenuWindow->GetPopupModeFlags() | FloatWinPopupFlags::NoMouseUpClose);
+    pMenu->SetSelectHdl(LINK(this, MasterPagesSelector, OnMenuItemSelected));
+
+    ProcessPopupMenu(*pMenu);
+
+    // Show the menu.
+    pMenu->Execute(this, ::tools::Rectangle(aPosition,Size(1,1)), PopupMenuFlags::ExecuteDown);
 }
 
 void MasterPagesSelector::Command (const CommandEvent& rEvent)
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index cf9191b2c679..493c0eb49f29 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -1080,18 +1080,18 @@ IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, weld::ComboBox&, void)
                                                 { &aSizeItem, mpPageItem.get(), &aFitObjs });
 
     // Notify LOK clients of the page size change.
-    if (comphelper::LibreOfficeKit::isActive())
+    if (!comphelper::LibreOfficeKit::isActive())
+        return;
+
+    SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+    while (pViewShell)
     {
-        SfxViewShell* pViewShell = SfxViewShell::GetFirst();
-        while (pViewShell)
+        if (pViewShell->GetDocId() == mrBase.GetDocId())
         {
-            if (pViewShell->GetDocId() == mrBase.GetDocId())
-            {
-                SdXImpressDocument* pDoc = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(pViewShell->GetCurrentDocument());
-                SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc);
-            }
-            pViewShell = SfxViewShell::GetNext(*pViewShell);
+            SdXImpressDocument* pDoc = comphelper::getUnoTunnelImplementation<SdXImpressDocument>(pViewShell->GetCurrentDocument());
+            SfxLokHelper::notifyDocumentSizeChangedAllViews(pDoc);
         }
+        pViewShell = SfxViewShell::GetNext(*pViewShell);
     }
 }
 
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 9b777d3a1dad..b6fc569b9b61 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1613,33 +1613,33 @@ void SdOutliner::EnterEditMode (bool bGrabFocus)
     // Make FuText the current function.
     SfxUInt16Item aItem (SID_TEXTEDIT, 1);
     std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
-    if (pViewShell && pViewShell->GetDispatcher())
-    {
-        pViewShell->GetDispatcher()->ExecuteList(
-            SID_TEXTEDIT, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, {&aItem});
+    if (!(pViewShell && pViewShell->GetDispatcher()))
+        return;
 
-        if (mpView->IsTextEdit())
-        {
-            // end text edition before starting it again
-            mpView->SdrEndTextEdit();
-        }
+    pViewShell->GetDispatcher()->ExecuteList(
+        SID_TEXTEDIT, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, {&aItem});
 
-        // To be consistent with the usual behaviour in the Office the text
-        // object that is put into edit mode would have also to be selected.
-        // Starting the text edit mode is not enough so we do it here by
-        // hand.
-        mpView->UnmarkAllObj(pPV);
-        mpView->MarkObj(mpSearchSpellTextObj, pPV);
+    if (mpView->IsTextEdit())
+    {
+        // end text edition before starting it again
+        mpView->SdrEndTextEdit();
+    }
 
-        mpSearchSpellTextObj->setActiveText(mnText);
+    // To be consistent with the usual behaviour in the Office the text
+    // object that is put into edit mode would have also to be selected.
+    // Starting the text edit mode is not enough so we do it here by
+    // hand.
+    mpView->UnmarkAllObj(pPV);
+    mpView->MarkObj(mpSearchSpellTextObj, pPV);
 
-        // Turn on the edit mode for the text object.
-        mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this,
-                                pOutlinerView, true, true, bGrabFocus);
+    mpSearchSpellTextObj->setActiveText(mnText);
 
-        SetUpdateMode(true);
-        mbFoundObject = true;
-    }
+    // Turn on the edit mode for the text object.
+    mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, this,
+                            pOutlinerView, true, true, bGrabFocus);
+
+    SetUpdateMode(true);
+    mbFoundObject = true;
 }
 
 ESelection SdOutliner::GetSearchStartPosition() const
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index 48580601dd19..74af5d1223b6 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -294,112 +294,112 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
 
 void DrawView::SetMasterAttributes( SdrObject* pObject, const SdPage& rPage, SfxItemSet rSet, SfxStyleSheetBasePool* pStShPool, bool& bOk, bool bMaster, bool bSlide )
 {
-   SdrInventor nInv    = pObject->GetObjInventor();
+    SdrInventor nInv    = pObject->GetObjInventor();
 
-   if (nInv == SdrInventor::Default)
-   {
-        sal_uInt16 eObjKind = pObject->GetObjIdentifier();
-        PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
-        if (bSlide && eObjKind == OBJ_TEXT)
-        {
-            // Presentation object (except outline)
-            SfxStyleSheet* pSheet = rPage.GetTextStyleSheetForObject(pObject);
-            DBG_ASSERT(pSheet, "StyleSheet not found");
+    if (nInv != SdrInventor::Default)
+        return;
 
-            SfxItemSet aTempSet( pSheet->GetItemSet() );
-            aTempSet.Put( rSet );
-            aTempSet.ClearInvalidItems();
+    sal_uInt16 eObjKind = pObject->GetObjIdentifier();
+    PresObjKind ePresObjKind = rPage.GetPresObjKind(pObject);
+    if (bSlide && eObjKind == OBJ_TEXT)
+    {
+        // Presentation object (except outline)
+        SfxStyleSheet* pSheet = rPage.GetTextStyleSheetForObject(pObject);
+        DBG_ASSERT(pSheet, "StyleSheet not found");
 
-            // Undo-Action
-            mpDocSh->GetUndoManager()->AddUndoAction(
-                std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
+        SfxItemSet aTempSet( pSheet->GetItemSet() );
+        aTempSet.Put( rSet );
+        aTempSet.ClearInvalidItems();
 
-            pSheet->GetItemSet().Put(aTempSet,false);
-            pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
-            bOk = true;
-        }
+        // Undo-Action
+        mpDocSh->GetUndoManager()->AddUndoAction(
+            std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
 
-        if (!bSlide &&
-            (ePresObjKind == PresObjKind::Title ||
-             ePresObjKind == PresObjKind::Notes))
-        {
-            // Presentation object (except outline)
-            SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
-            DBG_ASSERT(pSheet, "StyleSheet not found");
+        pSheet->GetItemSet().Put(aTempSet,false);
+        pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
+        bOk = true;
+    }
 
-            SfxItemSet aTempSet( pSheet->GetItemSet() );
-            aTempSet.Put( rSet );
-            aTempSet.ClearInvalidItems();
+    if (!bSlide &&
+        (ePresObjKind == PresObjKind::Title ||
+         ePresObjKind == PresObjKind::Notes))
+    {
+        // Presentation object (except outline)
+        SfxStyleSheet* pSheet = rPage.GetStyleSheetForPresObj( ePresObjKind );
+        DBG_ASSERT(pSheet, "StyleSheet not found");
 
-            // Undo-Action
-            mpDocSh->GetUndoManager()->AddUndoAction(
-                std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
+        SfxItemSet aTempSet( pSheet->GetItemSet() );
+        aTempSet.Put( rSet );
+        aTempSet.ClearInvalidItems();
 
-            pSheet->GetItemSet().Put(aTempSet,false);
-            pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
-            bOk = true;
-        }
-        else if (eObjKind == OBJ_OUTLINETEXT)
+        // Undo-Action
+        mpDocSh->GetUndoManager()->AddUndoAction(
+            std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
+
+        pSheet->GetItemSet().Put(aTempSet,false);
+        pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
+        bOk = true;
+    }
+    else if (eObjKind == OBJ_OUTLINETEXT)
+    {
+        if (bMaster)
         {
-            if (bMaster)
+            // Presentation object outline
+            for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
             {
-                // Presentation object outline
-                for (sal_uInt16 nLevel = 9; nLevel > 0; nLevel--)
-                {
-                    OUString aName = rPage.GetLayoutName() + " " +
-                        OUString::number(nLevel);
-                    SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pStShPool->
-                                        Find(aName, SfxStyleFamily::Page));
-                    DBG_ASSERT(pSheet, "StyleSheet not found");
+                OUString aName = rPage.GetLayoutName() + " " +
+                    OUString::number(nLevel);
+                SfxStyleSheet* pSheet = static_cast<SfxStyleSheet*>(pStShPool->
+                                    Find(aName, SfxStyleFamily::Page));
+                DBG_ASSERT(pSheet, "StyleSheet not found");
 
-                    SfxItemSet aTempSet( pSheet->GetItemSet() );
+                SfxItemSet aTempSet( pSheet->GetItemSet() );
 
-                    if( nLevel > 1 )
-                    {
-                        // for all levels over 1, clear all items that will be
-                        // hard set to level 1
-                        SfxWhichIter aWhichIter(rSet);
-                        sal_uInt16 nWhich(aWhichIter.FirstWhich());
-                        while( nWhich )
-                        {
-                            if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
-                                aTempSet.ClearItem( nWhich );
-                            nWhich = aWhichIter.NextWhich();
-                        }
-
-                    }
-                    else
+                if( nLevel > 1 )
+                {
+                    // for all levels over 1, clear all items that will be
+                    // hard set to level 1
+                    SfxWhichIter aWhichIter(rSet);
+                    sal_uInt16 nWhich(aWhichIter.FirstWhich());
+                    while( nWhich )
                     {
-                        // put the items hard into level one
-                        aTempSet.Put( rSet );
+                        if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
+                            aTempSet.ClearItem( nWhich );
+                        nWhich = aWhichIter.NextWhich();
                     }
 
-                    aTempSet.ClearInvalidItems();
-
-                    // Undo-Action
-                    mpDocSh->GetUndoManager()->AddUndoAction(
-                        std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
-
-                    pSheet->GetItemSet().Set(aTempSet,false);
-                    pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
                 }
-
-                // remove all hard set items from shape that are now set in style
-                SfxWhichIter aWhichIter(rSet);
-                sal_uInt16 nWhich(aWhichIter.FirstWhich());
-                while( nWhich )
+                else
                 {
-                    if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
-                        pObject->ClearMergedItem( nWhich );
-                    nWhich = aWhichIter.NextWhich();
+                    // put the items hard into level one
+                    aTempSet.Put( rSet );
                 }
+
+                aTempSet.ClearInvalidItems();
+
+                // Undo-Action
+                mpDocSh->GetUndoManager()->AddUndoAction(
+                    std::make_unique<StyleSheetUndoAction>(&mrDoc, pSheet, &aTempSet));
+
+                pSheet->GetItemSet().Set(aTempSet,false);
+                pSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
             }
-            else
-                pObject->SetMergedItemSet(rSet);
 
-            bOk = true;
+            // remove all hard set items from shape that are now set in style
+            SfxWhichIter aWhichIter(rSet);
+            sal_uInt16 nWhich(aWhichIter.FirstWhich());
+            while( nWhich )
+            {
+                if( SfxItemState::SET == rSet.GetItemState( nWhich ) )
+                    pObject->ClearMergedItem( nWhich );
+                nWhich = aWhichIter.NextWhich();
+            }
         }
-   }
+        else
+            pObject->SetMergedItemSet(rSet);
+
+        bOk = true;
+    }
 }
 
 /**
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index b0f2c4f60cb9..1f7148b46fee 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -75,30 +75,30 @@ namespace
         OUString sColor;
         const SfxPoolItem* pColorStringItem = nullptr;
 
-        if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem))
-        {
-            sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
+        if (SfxItemState::SET != pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem))
+            return;
 
-            if (sColor == "transparent")
-                aColor = COL_TRANSPARENT;
-            else
-                aColor = Color(sColor.toInt32(16));
+        sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
+
+        if (sColor == "transparent")
+            aColor = COL_TRANSPARENT;
+        else
+            aColor = Color(sColor.toInt32(16));
 
-            switch (nSlot)
+        switch (nSlot)
+        {
+            case SID_ATTR_CHAR_COLOR:
             {
-                case SID_ATTR_CHAR_COLOR:
-                {
-                    SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
-                    pArgs->Put(aColorItem);
-                    break;
-                }
+                SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
+                pArgs->Put(aColorItem);
+                break;
+            }
 
-                case SID_ATTR_CHAR_BACK_COLOR:
-                {
-                    SvxBackgroundColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR);
-                    pArgs->Put(pBackgroundItem);
-                    break;
-                }
+            case SID_ATTR_CHAR_BACK_COLOR:
+            {
+                SvxBackgroundColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR);
+                pArgs->Put(pBackgroundItem);
+                break;
             }
         }
     }


More information about the Libreoffice-commits mailing list