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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 6 12:41:53 UTC 2020


 svx/source/tbxctrls/PaletteManager.cxx         |   34 -
 svx/source/tbxctrls/StylesPreviewWindow.cxx    |  144 +++---
 svx/source/tbxctrls/extrusioncontrols.cxx      |   22 -
 svx/source/tbxctrls/fillctrl.cxx               |  550 ++++++++++++-------------
 svx/source/tbxctrls/fontworkgallery.cxx        |  156 +++----
 svx/source/tbxctrls/grafctrl.cxx               |   22 -
 svx/source/tbxctrls/itemwin.cxx                |   70 +--
 svx/source/tbxctrls/layctrl.cxx                |   40 -
 svx/source/tbxctrls/lboxctrl.cxx               |   30 -
 svx/source/tbxctrls/linectrl.cxx               |   96 ++--
 svx/source/tbxctrls/tbcontrl.cxx               |  478 ++++++++++-----------
 svx/source/tbxctrls/tbunocontroller.cxx        |   56 +-
 svx/source/tbxctrls/tbunosearchcontrollers.cxx |   32 -
 svx/source/tbxctrls/tbxcolor.cxx               |   24 -
 svx/source/tbxctrls/tbxdrctl.cxx               |   30 -
 15 files changed, 892 insertions(+), 892 deletions(-)

New commits:
commit 16fc591ddd8c4cd4d59fe85abc767b961edcf61f
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Aug 6 12:58:30 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Aug 6 14:41:15 2020 +0200

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

diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index 642a5ea18bcd..13fb1799f36e 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -327,26 +327,26 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedC
     Reference<XDesktop2> xDesktop = Desktop::create(xContext);
     Reference<XFrame> xFrame(xDesktop->getCurrentFrame());
     Reference<XDispatchProvider> xDispatchProvider(xFrame, UNO_QUERY);
-    if (xDispatchProvider.is())
-    {
-        INetURLObject aObj( aCommand );
+    if (!xDispatchProvider.is())
+        return;
 
-        Sequence<PropertyValue> aArgs(1);
-        aArgs[0].Name = aObj.GetURLPath();
-        aArgs[0].Value <<= sal_Int32(rColor.first);
+    INetURLObject aObj( aCommand );
 
-        URL aTargetURL;
-        aTargetURL.Complete = aCommand;
-        Reference<XURLTransformer> xURLTransformer(URLTransformer::create(comphelper::getProcessComponentContext()));
-        xURLTransformer->parseStrict(aTargetURL);
+    Sequence<PropertyValue> aArgs(1);
+    aArgs[0].Name = aObj.GetURLPath();
+    aArgs[0].Value <<= sal_Int32(rColor.first);
 
-        Reference<XDispatch> xDispatch = xDispatchProvider->queryDispatch(aTargetURL, OUString(), 0);
-        if (xDispatch.is())
-        {
-            xDispatch->dispatch(aTargetURL, aArgs);
-            if (xFrame->getContainerWindow().is())
-                xFrame->getContainerWindow()->setFocus();
-        }
+    URL aTargetURL;
+    aTargetURL.Complete = aCommand;
+    Reference<XURLTransformer> xURLTransformer(URLTransformer::create(comphelper::getProcessComponentContext()));
+    xURLTransformer->parseStrict(aTargetURL);
+
+    Reference<XDispatch> xDispatch = xDispatchProvider->queryDispatch(aTargetURL, OUString(), 0);
+    if (xDispatch.is())
+    {
+        xDispatch->dispatch(aTargetURL, aArgs);
+        if (xFrame->getContainerWindow().is())
+            xFrame->getContainerWindow()->setFocus();
     }
 }
 
diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index ce09f25cefc3..992c601601a4 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -213,86 +213,86 @@ void StyleItemController::DrawEntry(vcl::RenderContext& rRenderContext)
     SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool();
     SfxStyleSheetBase* pStyle = nullptr;
 
-    if (pPool)
-    {
-        pStyle = pPool->First(m_eStyleFamily);
-        while (pStyle && pStyle->GetName() != m_aStyleName)
-            pStyle = pPool->Next();
+    if (!pPool)
+        return;
 
-        if (!pStyle)
-            return;
+    pStyle = pPool->First(m_eStyleFamily);
+    while (pStyle && pStyle->GetName() != m_aStyleName)
+        pStyle = pPool->Next();
 
-        Size aSize(rRenderContext.GetOutputSizePixel());
-        tools::Rectangle aFullRect(Point(0, 0), aSize);
-        aSize = Size(aSize.getWidth() - 6, aSize.getHeight() - 6);
-        tools::Rectangle aContentRect(aFullRect);
+    if (!pStyle)
+        return;
 
-        Color aOriginalColor = rRenderContext.GetFillColor();
-        Color aOriginalLineColor = rRenderContext.GetLineColor();
-        vcl::Region aOriginalClipRegion(aFullRect);
+    Size aSize(rRenderContext.GetOutputSizePixel());
+    tools::Rectangle aFullRect(Point(0, 0), aSize);
+    aSize = Size(aSize.getWidth() - 6, aSize.getHeight() - 6);
+    tools::Rectangle aContentRect(aFullRect);
 
-        if (m_bSelected)
-        {
-            aContentRect = tools::Rectangle(Point(3, 3), aSize);
-            DrawSelection(rRenderContext);
-        }
+    Color aOriginalColor = rRenderContext.GetFillColor();
+    Color aOriginalLineColor = rRenderContext.GetLineColor();
+    vcl::Region aOriginalClipRegion(aFullRect);
 
-        DrawContentBackground(rRenderContext, aContentRect, aOriginalColor);
+    if (m_bSelected)
+    {
+        aContentRect = tools::Rectangle(Point(3, 3), aSize);
+        DrawSelection(rRenderContext);
+    }
 
-        vcl::Region aClipRegion(aContentRect);
-        rRenderContext.SetClipRegion(aClipRegion);
+    DrawContentBackground(rRenderContext, aContentRect, aOriginalColor);
 
-        std::unique_ptr<const SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
-        if (!pItemSet)
-            return;
+    vcl::Region aClipRegion(aContentRect);
+    rRenderContext.SetClipRegion(aClipRegion);
 
-        Color aFontHighlight = COL_AUTO;
+    std::unique_ptr<const SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
+    if (!pItemSet)
+        return;
 
-        const SvxFontItem* const pFontItem = pItemSet->GetItem<SvxFontItem>(SID_ATTR_CHAR_FONT);
-        const SvxFontHeightItem* const pFontHeightItem
-            = pItemSet->GetItem<SvxFontHeightItem>(SID_ATTR_CHAR_FONTHEIGHT);
+    Color aFontHighlight = COL_AUTO;
 
-        if (pFontItem && pFontHeightItem)
-        {
-            Size aFontSize(0, pFontHeightItem->GetHeight());
-            Size aPixelSize(rRenderContext.LogicToPixel(aFontSize, MapMode(pShell->GetMapUnit())));
+    const SvxFontItem* const pFontItem = pItemSet->GetItem<SvxFontItem>(SID_ATTR_CHAR_FONT);
+    const SvxFontHeightItem* const pFontHeightItem
+        = pItemSet->GetItem<SvxFontHeightItem>(SID_ATTR_CHAR_FONTHEIGHT);
 
-            SvxFont aFont = GetFontFromItems(pFontItem, aPixelSize, pItemSet);
-            rRenderContext.SetFont(aFont);
+    if (pFontItem && pFontHeightItem)
+    {
+        Size aFontSize(0, pFontHeightItem->GetHeight());
+        Size aPixelSize(rRenderContext.LogicToPixel(aFontSize, MapMode(pShell->GetMapUnit())));
 
-            Color aFontCol = GetTextColorFromItemSet(pItemSet);
-            if (aFontCol != COL_AUTO)
-                rRenderContext.SetTextColor(aFontCol);
+        SvxFont aFont = GetFontFromItems(pFontItem, aPixelSize, pItemSet);
+        rRenderContext.SetFont(aFont);
 
-            aFontHighlight = GetHighlightColorFromItemSet(pItemSet);
+        Color aFontCol = GetTextColorFromItemSet(pItemSet);
+        if (aFontCol != COL_AUTO)
+            rRenderContext.SetTextColor(aFontCol);
 
-            css::drawing::FillStyle style = GetFillStyleFromItemSet(pItemSet);
+        aFontHighlight = GetHighlightColorFromItemSet(pItemSet);
 
-            switch (style)
-            {
-                case css::drawing::FillStyle_SOLID:
-                {
-                    Color aBackCol = GetBackgroundColorFromItemSet(pItemSet);
-                    if (aBackCol != COL_AUTO)
-                        DrawContentBackground(rRenderContext, aContentRect, aBackCol);
-                }
-                break;
+        css::drawing::FillStyle style = GetFillStyleFromItemSet(pItemSet);
 
-                default:
-                    break;
-                    //TODO Draw the other background styles: gradient, hatching and bitmap
+        switch (style)
+        {
+            case css::drawing::FillStyle_SOLID:
+            {
+                Color aBackCol = GetBackgroundColorFromItemSet(pItemSet);
+                if (aBackCol != COL_AUTO)
+                    DrawContentBackground(rRenderContext, aContentRect, aBackCol);
             }
+            break;
+
+            default:
+                break;
+                //TODO Draw the other background styles: gradient, hatching and bitmap
         }
+    }
 
-        if (aFontHighlight != COL_AUTO)
-            DrawHighlight(rRenderContext, aFontHighlight);
+    if (aFontHighlight != COL_AUTO)
+        DrawHighlight(rRenderContext, aFontHighlight);
 
-        DrawText(rRenderContext);
+    DrawText(rRenderContext);
 
-        rRenderContext.SetFillColor(aOriginalColor);
-        rRenderContext.SetLineColor(aOriginalLineColor);
-        rRenderContext.SetClipRegion(aOriginalClipRegion);
-    }
+    rRenderContext.SetFillColor(aOriginalColor);
+    rRenderContext.SetLineColor(aOriginalLineColor);
+    rRenderContext.SetClipRegion(aOriginalClipRegion);
 }
 
 void StyleItemController::DrawContentBackground(vcl::RenderContext& rRenderContext,
@@ -409,19 +409,19 @@ void StylesPreviewWindow_Base::Select(const OUString& rStyleName)
 
 void StylesPreviewWindow_Base::MakeCurrentStyleVisible()
 {
-    if (m_aAllStyles.size())
-    {
-        unsigned nNewIterator = m_nStyleIterator;
-        auto aFound = std::find(m_aAllStyles.begin(), m_aAllStyles.end(), m_sSelectedStyle);
-        if (aFound != m_aAllStyles.end())
-            nNewIterator = aFound - m_aAllStyles.begin();
-
-        bool bIsAlreadyVisible
-            = nNewIterator >= m_nStyleIterator % m_aAllStyles.size()
-              && nNewIterator < m_nStyleIterator % m_aAllStyles.size() + STYLES_COUNT;
-        if (!bIsAlreadyVisible)
-            m_nStyleIterator = nNewIterator;
-    }
+    if (!m_aAllStyles.size())
+        return;
+
+    unsigned nNewIterator = m_nStyleIterator;
+    auto aFound = std::find(m_aAllStyles.begin(), m_aAllStyles.end(), m_sSelectedStyle);
+    if (aFound != m_aAllStyles.end())
+        nNewIterator = aFound - m_aAllStyles.begin();
+
+    bool bIsAlreadyVisible
+        = nNewIterator >= m_nStyleIterator % m_aAllStyles.size()
+          && nNewIterator < m_nStyleIterator % m_aAllStyles.size() + STYLES_COUNT;
+    if (!bIsAlreadyVisible)
+        m_nStyleIterator = nNewIterator;
 }
 
 void StylesPreviewWindow_Base::Update()
diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx
index 592da2fa5809..767fb9a99497 100644
--- a/svx/source/tbxctrls/extrusioncontrols.cxx
+++ b/svx/source/tbxctrls/extrusioncontrols.cxx
@@ -831,18 +831,18 @@ void ExtrusionSurfaceWindow::statusChanged(
     const css::frame::FeatureStateEvent& Event
 )
 {
-    if( Event.FeatureURL.Main == g_sExtrusionSurface )
+    if( Event.FeatureURL.Main != g_sExtrusionSurface )
+        return;
+
+    if( !Event.IsEnabled )
     {
-        if( !Event.IsEnabled )
-        {
-            implSetSurface( 0, false );
-        }
-        else
-        {
-            sal_Int32 nValue = 0;
-            if( Event.State >>= nValue )
-                implSetSurface( nValue, true );
-        }
+        implSetSurface( 0, false );
+    }
+    else
+    {
+        sal_Int32 nValue = 0;
+        if( Event.State >>= nValue )
+            implSetSurface( nValue, true );
     }
 }
 
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 37454acf0f9a..d0301b5d3b8c 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -325,216 +325,216 @@ void SvxFillToolBoxControl::StateChanged(
 
 void SvxFillToolBoxControl::Update()
 {
-    if(mpStyleItem)
-    {
-        const drawing::FillStyle eXFS = mpStyleItem->GetValue();
-        SfxObjectShell* pSh = SfxObjectShell::Current();
+    if(!mpStyleItem)
+        return;
+
+    const drawing::FillStyle eXFS = mpStyleItem->GetValue();
+    SfxObjectShell* pSh = SfxObjectShell::Current();
 
-        switch( eXFS )
+    switch( eXFS )
+    {
+        case drawing::FillStyle_NONE:
+        {
+            mpLbFillAttr->show();
+            mpToolBoxColor->hide();
+            mxFillControl->Resize();
+            break;
+        }
+        case drawing::FillStyle_SOLID:
         {
-            case drawing::FillStyle_NONE:
+            if(mpColorItem)
             {
-                mpLbFillAttr->show();
-                mpToolBoxColor->hide();
+                mpLbFillAttr->hide();
+                mpToolBoxColor->show();
                 mxFillControl->Resize();
-                break;
             }
-            case drawing::FillStyle_SOLID:
-            {
-                if(mpColorItem)
-                {
-                    mpLbFillAttr->hide();
-                    mpToolBoxColor->show();
-                    mxFillControl->Resize();
-                }
-                break;
-            }
-            case drawing::FillStyle_GRADIENT:
+            break;
+        }
+        case drawing::FillStyle_GRADIENT:
+        {
+            mpLbFillAttr->show();
+            mpToolBoxColor->hide();
+            mxFillControl->Resize();
+
+            if(pSh && pSh->GetItem(SID_GRADIENT_LIST))
             {
-                mpLbFillAttr->show();
-                mpToolBoxColor->hide();
-                mxFillControl->Resize();
+                mpLbFillAttr->set_sensitive(true);
+                mpLbFillAttr->clear();
+                SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList());
 
-                if(pSh && pSh->GetItem(SID_GRADIENT_LIST))
+                if(mpFillGradientItem)
                 {
-                    mpLbFillAttr->set_sensitive(true);
-                    mpLbFillAttr->clear();
-                    SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList());
-
-                    if(mpFillGradientItem)
-                    {
-                        const OUString aString(mpFillGradientItem->GetName());
+                    const OUString aString(mpFillGradientItem->GetName());
 
-                        mpLbFillAttr->set_active_text(aString);
+                    mpLbFillAttr->set_active_text(aString);
 
-                        // Check if the entry is not in the list
-                        if (mpLbFillAttr->get_active_text() != aString)
+                    // Check if the entry is not in the list
+                    if (mpLbFillAttr->get_active_text() != aString)
+                    {
+                        sal_Int32 nCount = mpLbFillAttr->get_count();
+                        OUString aTmpStr;
+                        if( nCount > 0 )
                         {
-                            sal_Int32 nCount = mpLbFillAttr->get_count();
-                            OUString aTmpStr;
-                            if( nCount > 0 )
+                            // Last entry gets tested against temporary entry
+                            aTmpStr = mpLbFillAttr->get_text( nCount - 1 );
+                            if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+                                aTmpStr.endsWith(TMP_STR_END) )
                             {
-                                // Last entry gets tested against temporary entry
-                                aTmpStr = mpLbFillAttr->get_text( nCount - 1 );
-                                if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
-                                    aTmpStr.endsWith(TMP_STR_END) )
-                                {
-                                    mpLbFillAttr->remove(nCount - 1);
-                                }
+                                mpLbFillAttr->remove(nCount - 1);
                             }
-                            aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
+                        }
+                        aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
 
-                            XGradientList aGradientList( "", ""/*TODO?*/ );
-                            aGradientList.Insert(std::make_unique<XGradientEntry>(mpFillGradientItem->GetGradientValue(), aTmpStr));
-                            aGradientList.SetDirty( false );
-                            const BitmapEx aBmp = aGradientList.GetUiBitmap( 0 );
+                        XGradientList aGradientList( "", ""/*TODO?*/ );
+                        aGradientList.Insert(std::make_unique<XGradientEntry>(mpFillGradientItem->GetGradientValue(), aTmpStr));
+                        aGradientList.SetDirty( false );
+                        const BitmapEx aBmp = aGradientList.GetUiBitmap( 0 );
 
-                            if (!aBmp.IsEmpty())
-                            {
-                                ScopedVclPtrInstance< VirtualDevice > pVD;
-                                const Size aBmpSize(aBmp.GetSizePixel());
-                                pVD->SetOutputSizePixel(aBmpSize, false);
-                                pVD->DrawBitmapEx(Point(), aBmp);
-                                mpLbFillAttr->append("", aGradientList.Get(0)->GetName(), *pVD);
-                                mpLbFillAttr->set_active(mpLbFillAttr->get_count() - 1);
-                            }
+                        if (!aBmp.IsEmpty())
+                        {
+                            ScopedVclPtrInstance< VirtualDevice > pVD;
+                            const Size aBmpSize(aBmp.GetSizePixel());
+                            pVD->SetOutputSizePixel(aBmpSize, false);
+                            pVD->DrawBitmapEx(Point(), aBmp);
+                            mpLbFillAttr->append("", aGradientList.Get(0)->GetName(), *pVD);
+                            mpLbFillAttr->set_active(mpLbFillAttr->get_count() - 1);
                         }
-
-                    }
-                    else
-                    {
-                        mpLbFillAttr->set_active(-1);
                     }
+
                 }
                 else
                 {
                     mpLbFillAttr->set_active(-1);
                 }
-                break;
             }
-            case drawing::FillStyle_HATCH:
+            else
             {
-                mpLbFillAttr->show();
-                mpToolBoxColor->hide();
-                mxFillControl->Resize();
+                mpLbFillAttr->set_active(-1);
+            }
+            break;
+        }
+        case drawing::FillStyle_HATCH:
+        {
+            mpLbFillAttr->show();
+            mpToolBoxColor->hide();
+            mxFillControl->Resize();
 
-                if(pSh && pSh->GetItem(SID_HATCH_LIST))
-                {
-                    mpLbFillAttr->set_sensitive(true);
-                    mpLbFillAttr->clear();
-                    SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_HATCH_LIST)->GetHatchList());
+            if(pSh && pSh->GetItem(SID_HATCH_LIST))
+            {
+                mpLbFillAttr->set_sensitive(true);
+                mpLbFillAttr->clear();
+                SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_HATCH_LIST)->GetHatchList());
 
-                    if(mpHatchItem)
-                    {
-                        const OUString aString(mpHatchItem->GetName());
+                if(mpHatchItem)
+                {
+                    const OUString aString(mpHatchItem->GetName());
 
-                        mpLbFillAttr->set_active_text( aString );
+                    mpLbFillAttr->set_active_text( aString );
 
-                        // Check if the entry is not in the list
-                        if( mpLbFillAttr->get_active_text() != aString )
+                    // Check if the entry is not in the list
+                    if( mpLbFillAttr->get_active_text() != aString )
+                    {
+                        const sal_Int32 nCount = mpLbFillAttr->get_count();
+                        OUString aTmpStr;
+                        if( nCount > 0 )
                         {
-                            const sal_Int32 nCount = mpLbFillAttr->get_count();
-                            OUString aTmpStr;
-                            if( nCount > 0 )
+                            // Last entry gets tested against temporary entry
+                            aTmpStr = mpLbFillAttr->get_text( nCount - 1 );
+                            if(  aTmpStr.startsWith(TMP_STR_BEGIN) &&
+                                 aTmpStr.endsWith(TMP_STR_END) )
                             {
-                                // Last entry gets tested against temporary entry
-                                aTmpStr = mpLbFillAttr->get_text( nCount - 1 );
-                                if(  aTmpStr.startsWith(TMP_STR_BEGIN) &&
-                                     aTmpStr.endsWith(TMP_STR_END) )
-                                {
-                                    mpLbFillAttr->remove( nCount - 1 );
-                                }
+                                mpLbFillAttr->remove( nCount - 1 );
                             }
-                            aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
+                        }
+                        aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
 
-                            XHatchList aHatchList( "", ""/*TODO?*/ );
-                            aHatchList.Insert(std::make_unique<XHatchEntry>(mpHatchItem->GetHatchValue(), aTmpStr));
-                            aHatchList.SetDirty( false );
-                            const BitmapEx & aBmp = aHatchList.GetUiBitmap( 0 );
+                        XHatchList aHatchList( "", ""/*TODO?*/ );
+                        aHatchList.Insert(std::make_unique<XHatchEntry>(mpHatchItem->GetHatchValue(), aTmpStr));
+                        aHatchList.SetDirty( false );
+                        const BitmapEx & aBmp = aHatchList.GetUiBitmap( 0 );
 
-                            if( !aBmp.IsEmpty() )
-                            {
-                                ScopedVclPtrInstance< VirtualDevice > pVD;
-                                const Size aBmpSize(aBmp.GetSizePixel());
-                                pVD->SetOutputSizePixel(aBmpSize, false);
-                                pVD->DrawBitmapEx(Point(), aBmp);
-                                mpLbFillAttr->append("", aHatchList.GetHatch(0)->GetName(), *pVD);
-                                mpLbFillAttr->set_active(mpLbFillAttr->get_count() - 1);
-                            }
+                        if( !aBmp.IsEmpty() )
+                        {
+                            ScopedVclPtrInstance< VirtualDevice > pVD;
+                            const Size aBmpSize(aBmp.GetSizePixel());
+                            pVD->SetOutputSizePixel(aBmpSize, false);
+                            pVD->DrawBitmapEx(Point(), aBmp);
+                            mpLbFillAttr->append("", aHatchList.GetHatch(0)->GetName(), *pVD);
+                            mpLbFillAttr->set_active(mpLbFillAttr->get_count() - 1);
                         }
                     }
-                    else
-                    {
-                        mpLbFillAttr->set_active(-1);
-                    }
                 }
                 else
                 {
                     mpLbFillAttr->set_active(-1);
                 }
-                break;
             }
-            case drawing::FillStyle_BITMAP:
+            else
             {
-                mpLbFillAttr->show();
-                mpToolBoxColor->hide();
-                mxFillControl->Resize();
+                mpLbFillAttr->set_active(-1);
+            }
+            break;
+        }
+        case drawing::FillStyle_BITMAP:
+        {
+            mpLbFillAttr->show();
+            mpToolBoxColor->hide();
+            mxFillControl->Resize();
 
-                if(pSh && pSh->GetItem(SID_BITMAP_LIST))
-                {
-                    mpLbFillAttr->set_sensitive(true);
-                    mpLbFillAttr->clear();
-                    SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList());
+            if(pSh && pSh->GetItem(SID_BITMAP_LIST))
+            {
+                mpLbFillAttr->set_sensitive(true);
+                mpLbFillAttr->clear();
+                SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList());
 
-                    if(mpBitmapItem)
-                    {
-                        const OUString aString(mpBitmapItem->GetName());
+                if(mpBitmapItem)
+                {
+                    const OUString aString(mpBitmapItem->GetName());
 
-                        mpLbFillAttr->set_active_text(aString);
+                    mpLbFillAttr->set_active_text(aString);
 
-                        // Check if the entry is not in the list
-                        if (mpLbFillAttr->get_active_text() != aString)
+                    // Check if the entry is not in the list
+                    if (mpLbFillAttr->get_active_text() != aString)
+                    {
+                        sal_Int32 nCount = mpLbFillAttr->get_count();
+                        OUString aTmpStr;
+                        if( nCount > 0 )
                         {
-                            sal_Int32 nCount = mpLbFillAttr->get_count();
-                            OUString aTmpStr;
-                            if( nCount > 0 )
+                            // Last entry gets tested against temporary entry
+                            aTmpStr = mpLbFillAttr->get_text(nCount - 1);
+                            if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+                                aTmpStr.endsWith(TMP_STR_END) )
                             {
-                                // Last entry gets tested against temporary entry
-                                aTmpStr = mpLbFillAttr->get_text(nCount - 1);
-                                if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
-                                    aTmpStr.endsWith(TMP_STR_END) )
-                                {
-                                    mpLbFillAttr->remove(nCount - 1);
-                                }
+                                mpLbFillAttr->remove(nCount - 1);
                             }
-                            aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
-
-                            XBitmapListRef xBitmapList =
-                                XPropertyList::AsBitmapList(
-                                    XPropertyList::CreatePropertyList(
-                                        XPropertyListType::Bitmap, "TmpList", ""/*TODO?*/));
-                            xBitmapList->Insert(std::make_unique<XBitmapEntry>(mpBitmapItem->GetGraphicObject(), aTmpStr));
-                            xBitmapList->SetDirty( false );
-                            SvxFillAttrBox::Fill(*mpLbFillAttr, xBitmapList);
-                            mpLbFillAttr->set_active(mpLbFillAttr->get_count() - 1);
                         }
-
-                    }
-                    else
-                    {
-                        mpLbFillAttr->set_active(-1);
+                        aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
+
+                        XBitmapListRef xBitmapList =
+                            XPropertyList::AsBitmapList(
+                                XPropertyList::CreatePropertyList(
+                                    XPropertyListType::Bitmap, "TmpList", ""/*TODO?*/));
+                        xBitmapList->Insert(std::make_unique<XBitmapEntry>(mpBitmapItem->GetGraphicObject(), aTmpStr));
+                        xBitmapList->SetDirty( false );
+                        SvxFillAttrBox::Fill(*mpLbFillAttr, xBitmapList);
+                        mpLbFillAttr->set_active(mpLbFillAttr->get_count() - 1);
                     }
+
                 }
                 else
                 {
                     mpLbFillAttr->set_active(-1);
                 }
-                break;
             }
-            default:
-                OSL_ENSURE(false, "Non supported FillType (!)");
+            else
+            {
+                mpLbFillAttr->set_active(-1);
+            }
             break;
         }
+        default:
+            OSL_ENSURE(false, "Non supported FillType (!)");
+        break;
     }
 
 }
@@ -668,161 +668,161 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillTypeHdl, weld::ComboBox&, void)
 {
     const drawing::FillStyle eXFS = static_cast<drawing::FillStyle>(mpLbFillType->get_active());
 
-    if(meLastXFS != eXFS)
+    if(meLastXFS == eXFS)
+        return;
+
+    mpLbFillAttr->clear();
+    SfxObjectShell* pSh = SfxObjectShell::Current();
+    const XFillStyleItem aXFillStyleItem(eXFS);
+
+    // #i122676# Do no longer trigger two Execute calls, one for SID_ATTR_FILL_STYLE
+    // and one for setting the fill attribute itself, but add two SfxPoolItems to the
+    // call to get just one action at the SdrObject and to create only one Undo action, too.
+    // Checked that this works in all apps.
+    switch( eXFS )
     {
-        mpLbFillAttr->clear();
-        SfxObjectShell* pSh = SfxObjectShell::Current();
-        const XFillStyleItem aXFillStyleItem(eXFS);
-
-        // #i122676# Do no longer trigger two Execute calls, one for SID_ATTR_FILL_STYLE
-        // and one for setting the fill attribute itself, but add two SfxPoolItems to the
-        // call to get just one action at the SdrObject and to create only one Undo action, too.
-        // Checked that this works in all apps.
-        switch( eXFS )
+        default:
+        case drawing::FillStyle_NONE:
         {
-            default:
-            case drawing::FillStyle_NONE:
-            {
-                mpLbFillAttr->show();
-                mpToolBoxColor->hide();
-                mpLbFillAttr->set_sensitive(false);
+            mpLbFillAttr->show();
+            mpToolBoxColor->hide();
+            mpLbFillAttr->set_sensitive(false);
 
-                // #i122676# need to call a single SID_ATTR_FILL_STYLE change
-                SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
-                    SID_ATTR_FILL_STYLE, SfxCallMode::RECORD,
-                    { &aXFillStyleItem });
-                break;
-            }
-            case drawing::FillStyle_SOLID:
-            {
-                mpLbFillAttr->hide();
-                mpToolBoxColor->show();
-                const ::Color aColor = mpColorItem->GetColorValue();
-                const XFillColorItem aXFillColorItem( "", aColor );
+            // #i122676# need to call a single SID_ATTR_FILL_STYLE change
+            SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+                SID_ATTR_FILL_STYLE, SfxCallMode::RECORD,
+                { &aXFillStyleItem });
+            break;
+        }
+        case drawing::FillStyle_SOLID:
+        {
+            mpLbFillAttr->hide();
+            mpToolBoxColor->show();
+            const ::Color aColor = mpColorItem->GetColorValue();
+            const XFillColorItem aXFillColorItem( "", aColor );
+
+            // #i122676# change FillStyle and Color in one call
+            SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+                SID_ATTR_FILL_COLOR, SfxCallMode::RECORD,
+                { &aXFillColorItem, &aXFillStyleItem });
+            break;
+        }
+        case drawing::FillStyle_GRADIENT:
+        {
+            mpLbFillAttr->show();
+            mpToolBoxColor->hide();
 
-                // #i122676# change FillStyle and Color in one call
-                SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
-                    SID_ATTR_FILL_COLOR, SfxCallMode::RECORD,
-                    { &aXFillColorItem, &aXFillStyleItem });
-                break;
-            }
-            case drawing::FillStyle_GRADIENT:
+            if(pSh && pSh->GetItem(SID_GRADIENT_LIST))
             {
-                mpLbFillAttr->show();
-                mpToolBoxColor->hide();
+                if(!mpLbFillAttr->get_count())
+                {
+                    mpLbFillAttr->set_sensitive(true);
+                    mpLbFillAttr->clear();
+                    SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList());
+                }
 
-                if(pSh && pSh->GetItem(SID_GRADIENT_LIST))
+                if (mnLastPosGradient != -1)
                 {
-                    if(!mpLbFillAttr->get_count())
-                    {
-                        mpLbFillAttr->set_sensitive(true);
-                        mpLbFillAttr->clear();
-                        SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_GRADIENT_LIST)->GetGradientList());
-                    }
+                    const SvxGradientListItem * pItem = pSh->GetItem(SID_GRADIENT_LIST);
 
-                    if (mnLastPosGradient != -1)
+                    if(mnLastPosGradient < pItem->GetGradientList()->Count())
                     {
-                        const SvxGradientListItem * pItem = pSh->GetItem(SID_GRADIENT_LIST);
-
-                        if(mnLastPosGradient < pItem->GetGradientList()->Count())
-                        {
-                            const XGradient aGradient = pItem->GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient();
-                            const XFillGradientItem aXFillGradientItem(mpLbFillAttr->get_text(mnLastPosGradient), aGradient);
-
-                            // #i122676# change FillStyle and Gradient in one call
-                            SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
-                                SID_ATTR_FILL_GRADIENT, SfxCallMode::RECORD,
-                                { &aXFillGradientItem, &aXFillStyleItem });
-                            mpLbFillAttr->set_active(mnLastPosGradient);
-                        }
+                        const XGradient aGradient = pItem->GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient();
+                        const XFillGradientItem aXFillGradientItem(mpLbFillAttr->get_text(mnLastPosGradient), aGradient);
+
+                        // #i122676# change FillStyle and Gradient in one call
+                        SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+                            SID_ATTR_FILL_GRADIENT, SfxCallMode::RECORD,
+                            { &aXFillGradientItem, &aXFillStyleItem });
+                        mpLbFillAttr->set_active(mnLastPosGradient);
                     }
                 }
-                else
-                {
-                    mpLbFillAttr->set_sensitive(false);
-                }
-                break;
             }
-            case drawing::FillStyle_HATCH:
+            else
             {
-                mpLbFillAttr->show();
-                mpToolBoxColor->hide();
+                mpLbFillAttr->set_sensitive(false);
+            }
+            break;
+        }
+        case drawing::FillStyle_HATCH:
+        {
+            mpLbFillAttr->show();
+            mpToolBoxColor->hide();
 
-                if(pSh && pSh->GetItem(SID_HATCH_LIST))
+            if(pSh && pSh->GetItem(SID_HATCH_LIST))
+            {
+                if(!mpLbFillAttr->get_count())
                 {
-                    if(!mpLbFillAttr->get_count())
-                    {
-                        mpLbFillAttr->set_sensitive(true);
-                        mpLbFillAttr->clear();
-                        SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_HATCH_LIST)->GetHatchList());
-                    }
+                    mpLbFillAttr->set_sensitive(true);
+                    mpLbFillAttr->clear();
+                    SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_HATCH_LIST)->GetHatchList());
+                }
 
-                    if (mnLastPosHatch != -1)
-                    {
-                        const SvxHatchListItem * pItem = pSh->GetItem(SID_HATCH_LIST);
+                if (mnLastPosHatch != -1)
+                {
+                    const SvxHatchListItem * pItem = pSh->GetItem(SID_HATCH_LIST);
 
-                        if(mnLastPosHatch < pItem->GetHatchList()->Count())
-                        {
-                            const XHatch aHatch = pItem->GetHatchList()->GetHatch(mnLastPosHatch)->GetHatch();
-                            const XFillHatchItem aXFillHatchItem(mpLbFillAttr->get_active_text(), aHatch);
-
-                            // #i122676# change FillStyle and Hatch in one call
-                            SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
-                                SID_ATTR_FILL_HATCH, SfxCallMode::RECORD,
-                                { &aXFillHatchItem, &aXFillStyleItem });
-                            mpLbFillAttr->set_active(mnLastPosHatch);
-                        }
+                    if(mnLastPosHatch < pItem->GetHatchList()->Count())
+                    {
+                        const XHatch aHatch = pItem->GetHatchList()->GetHatch(mnLastPosHatch)->GetHatch();
+                        const XFillHatchItem aXFillHatchItem(mpLbFillAttr->get_active_text(), aHatch);
+
+                        // #i122676# change FillStyle and Hatch in one call
+                        SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+                            SID_ATTR_FILL_HATCH, SfxCallMode::RECORD,
+                            { &aXFillHatchItem, &aXFillStyleItem });
+                        mpLbFillAttr->set_active(mnLastPosHatch);
                     }
                 }
-                else
-                {
-                    mpLbFillAttr->set_sensitive(false);
-                }
-                break;
             }
-            case drawing::FillStyle_BITMAP:
+            else
             {
-                mpLbFillAttr->show();
-                mpToolBoxColor->hide();
+                mpLbFillAttr->set_sensitive(false);
+            }
+            break;
+        }
+        case drawing::FillStyle_BITMAP:
+        {
+            mpLbFillAttr->show();
+            mpToolBoxColor->hide();
 
-                if(pSh && pSh->GetItem(SID_BITMAP_LIST))
+            if(pSh && pSh->GetItem(SID_BITMAP_LIST))
+            {
+                if(!mpLbFillAttr->get_count())
                 {
-                    if(!mpLbFillAttr->get_count())
-                    {
-                        mpLbFillAttr->set_sensitive(true);
-                        mpLbFillAttr->clear();
-                        SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList());
-                    }
+                    mpLbFillAttr->set_sensitive(true);
+                    mpLbFillAttr->clear();
+                    SvxFillAttrBox::Fill(*mpLbFillAttr, pSh->GetItem(SID_BITMAP_LIST)->GetBitmapList());
+                }
 
-                    if (mnLastPosBitmap != -1)
-                    {
-                        const SvxBitmapListItem * pItem = pSh->GetItem(SID_BITMAP_LIST);
+                if (mnLastPosBitmap != -1)
+                {
+                    const SvxBitmapListItem * pItem = pSh->GetItem(SID_BITMAP_LIST);
 
-                        if(mnLastPosBitmap < pItem->GetBitmapList()->Count())
-                        {
-                            const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(mnLastPosBitmap);
-                            const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->get_active_text(), pXBitmapEntry->GetGraphicObject());
-
-                            // #i122676# change FillStyle and Bitmap in one call
-                            SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
-                                SID_ATTR_FILL_BITMAP, SfxCallMode::RECORD,
-                                { &aXFillBitmapItem, &aXFillStyleItem });
-                            mpLbFillAttr->set_active(mnLastPosBitmap);
-                        }
+                    if(mnLastPosBitmap < pItem->GetBitmapList()->Count())
+                    {
+                        const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(mnLastPosBitmap);
+                        const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->get_active_text(), pXBitmapEntry->GetGraphicObject());
+
+                        // #i122676# change FillStyle and Bitmap in one call
+                        SfxViewFrame::Current()->GetDispatcher()->ExecuteList(
+                            SID_ATTR_FILL_BITMAP, SfxCallMode::RECORD,
+                            { &aXFillBitmapItem, &aXFillStyleItem });
+                        mpLbFillAttr->set_active(mnLastPosBitmap);
                     }
                 }
-                else
-                {
-                    mpLbFillAttr->set_sensitive(false);
-                }
-                break;
             }
+            else
+            {
+                mpLbFillAttr->set_sensitive(false);
+            }
+            break;
         }
+    }
 
-        meLastXFS = eXFS;
+    meLastXFS = eXFS;
 
-        mxFillControl->Resize();
-    }
+    mxFillControl->Resize();
 }
 
 IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, weld::ComboBox&, void)
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index e1dd0a768e8d..2f52fb965c12 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -164,76 +164,76 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
 {
     sal_uInt16 nItemId = maCtlFavorites.GetSelectedItemId();
 
-    if( nItemId > 0 )
+    if( nItemId <= 0 )
+        return;
+
+    std::unique_ptr<FmFormModel> pModel(new FmFormModel());
+    pModel->GetItemPool().FreezeIdRanges();
+
+    if( !GalleryExplorer::GetSdrObj( mnThemeId, nItemId-1, pModel.get() ) )
+        return;
+
+    SdrPage* pPage = pModel->GetPage(0);
+    if( !(pPage && pPage->GetObjCount()) )
+        return;
+
+    // tdf#116993 Calc uses a 'special' mode for this dialog in being the
+    // only caller of ::SetSdrObjectRef. Only in that case mpDestModel seems
+    // to be the correct target SdrModel.
+    // If this is not used, the correct SdrModel seems to be the one from
+    // the mrSdrView that is used to insert (InsertObjectAtView below) the
+    // cloned SdrObject.
+    const bool bUseSpecialCalcMode(nullptr != mppSdrObject && nullptr != mpDestModel);
+
+    // center shape on current view
+    OutputDevice* pOutDev(mrSdrView.GetFirstOutputDevice());
+
+    if (!pOutDev)
+        return;
+
+    // Clone directly to target SdrModel (may be different due to user/caller (!))
+    SdrObject* pNewObject(
+        pPage->GetObj(0)->CloneSdrObject(
+            bUseSpecialCalcMode ? *mpDestModel : mrSdrView.getSdrModelFromSdrView()));
+
+    pNewObject->MakeNameUnique();
+
+    // tdf#117629
+    // Since the 'old' ::CloneSdrObject also copies the SdrPage* the
+    // SdrObject::getUnoShape() *will* create the wrong UNO API object
+    // early. This IS one of the reasons I do change these things - this
+    // error does not happen with my next change I am working on already
+    // ARGH! For now, reset the SdrPage* to nullptr.
+    // What sense does it have to copy the SdrPage* of the original SdrObject ?!?
+    // TTTT: This also *might* be the hidden reason for the strange code at the
+    // end of SdrObject::SetPage that tries to delete the SvxShape under some
+    // circumstances...
+    // pNewObject->SetPage(nullptr);
+
+    tools::Rectangle aObjRect( pNewObject->GetLogicRect() );
+    tools::Rectangle aVisArea = pOutDev->PixelToLogic(tools::Rectangle(Point(0,0), pOutDev->GetOutputSizePixel()));
+    Point aPagePos = aVisArea.Center();
+    aPagePos.AdjustX( -(aObjRect.GetWidth() / 2) );
+    aPagePos.AdjustY( -(aObjRect.GetHeight() / 2) );
+    tools::Rectangle aNewObjectRectangle(aPagePos, aObjRect.GetSize());
+    pNewObject->SetLogicRect(aNewObjectRectangle);
+
+    if (bUseSpecialCalcMode)
     {
-        std::unique_ptr<FmFormModel> pModel(new FmFormModel());
-        pModel->GetItemPool().FreezeIdRanges();
+        *mppSdrObject = pNewObject;
+    }
+    else
+    {
+        SdrPageView* pPV(mrSdrView.GetSdrPageView());
 
-        if( GalleryExplorer::GetSdrObj( mnThemeId, nItemId-1, pModel.get() ) )
+        if (nullptr != pPV)
+        {
+            mrSdrView.InsertObjectAtView( pNewObject, *pPV );
+        }
+        else
         {
-            SdrPage* pPage = pModel->GetPage(0);
-            if( pPage && pPage->GetObjCount() )
-            {
-                // tdf#116993 Calc uses a 'special' mode for this dialog in being the
-                // only caller of ::SetSdrObjectRef. Only in that case mpDestModel seems
-                // to be the correct target SdrModel.
-                // If this is not used, the correct SdrModel seems to be the one from
-                // the mrSdrView that is used to insert (InsertObjectAtView below) the
-                // cloned SdrObject.
-                const bool bUseSpecialCalcMode(nullptr != mppSdrObject && nullptr != mpDestModel);
-
-                // center shape on current view
-                OutputDevice* pOutDev(mrSdrView.GetFirstOutputDevice());
-
-                if (pOutDev)
-                {
-                    // Clone directly to target SdrModel (may be different due to user/caller (!))
-                    SdrObject* pNewObject(
-                        pPage->GetObj(0)->CloneSdrObject(
-                            bUseSpecialCalcMode ? *mpDestModel : mrSdrView.getSdrModelFromSdrView()));
-
-                    pNewObject->MakeNameUnique();
-
-                    // tdf#117629
-                    // Since the 'old' ::CloneSdrObject also copies the SdrPage* the
-                    // SdrObject::getUnoShape() *will* create the wrong UNO API object
-                    // early. This IS one of the reasons I do change these things - this
-                    // error does not happen with my next change I am working on already
-                    // ARGH! For now, reset the SdrPage* to nullptr.
-                    // What sense does it have to copy the SdrPage* of the original SdrObject ?!?
-                    // TTTT: This also *might* be the hidden reason for the strange code at the
-                    // end of SdrObject::SetPage that tries to delete the SvxShape under some
-                    // circumstances...
-                    // pNewObject->SetPage(nullptr);
-
-                    tools::Rectangle aObjRect( pNewObject->GetLogicRect() );
-                    tools::Rectangle aVisArea = pOutDev->PixelToLogic(tools::Rectangle(Point(0,0), pOutDev->GetOutputSizePixel()));
-                    Point aPagePos = aVisArea.Center();
-                    aPagePos.AdjustX( -(aObjRect.GetWidth() / 2) );
-                    aPagePos.AdjustY( -(aObjRect.GetHeight() / 2) );
-                    tools::Rectangle aNewObjectRectangle(aPagePos, aObjRect.GetSize());
-                    pNewObject->SetLogicRect(aNewObjectRectangle);
-
-                    if (bUseSpecialCalcMode)
-                    {
-                        *mppSdrObject = pNewObject;
-                    }
-                    else
-                    {
-                        SdrPageView* pPV(mrSdrView.GetSdrPageView());
-
-                        if (nullptr != pPV)
-                        {
-                            mrSdrView.InsertObjectAtView( pNewObject, *pPV );
-                        }
-                        else
-                        {
-                            // tdf#116993 no target -> delete clone
-                            SdrObject::Free(pNewObject);
-                        }
-                    }
-                }
-            }
+            // tdf#116993 no target -> delete clone
+            SdrObject::Free(pNewObject);
         }
     }
 }
@@ -318,18 +318,18 @@ void FontworkAlignmentWindow::implSetAlignment( int nSurface, bool bEnabled )
 
 void FontworkAlignmentWindow::statusChanged( const css::frame::FeatureStateEvent& Event )
 {
-    if( Event.FeatureURL.Main == gsFontworkAlignment )
+    if( Event.FeatureURL.Main != gsFontworkAlignment )
+        return;
+
+    if( !Event.IsEnabled )
     {
-        if( !Event.IsEnabled )
-        {
-            implSetAlignment( 0, false );
-        }
-        else
-        {
-            sal_Int32 nValue = 0;
-            if( Event.State >>= nValue )
-                implSetAlignment( nValue, true );
-        }
+        implSetAlignment( 0, false );
+    }
+    else
+    {
+        sal_Int32 nValue = 0;
+        if( Event.State >>= nValue )
+            implSetAlignment( nValue, true );
     }
 }
 
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 91a9a2db11cd..72f3c99f5c4d 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -116,19 +116,19 @@ IMPL_LINK_NOARG(ImplGrafControl, ImplModifyHdl, Timer*, void)
               maCommand == ".uno:GrafTransparence" )
         a <<= sal_Int32( nVal );
 
-    if ( a.hasValue() )
-    {
-        INetURLObject aObj( maCommand );
+    if ( !a.hasValue() )
+        return;
 
-        Sequence< PropertyValue > aArgs( 1 );
-        aArgs[0].Name = aObj.GetURLPath();
-        aArgs[0].Value = a;
+    INetURLObject aObj( maCommand );
 
-        SfxToolBoxControl::Dispatch(
-            Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
-            maCommand,
-            aArgs );
-    }
+    Sequence< PropertyValue > aArgs( 1 );
+    aArgs[0].Name = aObj.GetURLPath();
+    aArgs[0].Value = a;
+
+    SfxToolBoxControl::Dispatch(
+        Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
+        maCommand,
+        aArgs );
 }
 
 void ImplGrafControl::Update( const SfxPoolItem* pItem )
diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx
index 3d1c024eb5db..c5a7a479671a 100644
--- a/svx/source/tbxctrls/itemwin.cxx
+++ b/svx/source/tbxctrls/itemwin.cxx
@@ -191,53 +191,53 @@ namespace
 {
     void formatBitmapExToSize(BitmapEx& rBitmapEx, const Size& rSize)
     {
-        if(!rBitmapEx.IsEmpty() && !rSize.IsEmpty())
-        {
-            ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
-            pVirtualDevice->SetOutputSizePixel(rSize);
+        if(rBitmapEx.IsEmpty() || rSize.IsEmpty())
+            return;
 
-            if(rBitmapEx.IsTransparent())
-            {
-                const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+        ScopedVclPtrInstance< VirtualDevice > pVirtualDevice;
+        pVirtualDevice->SetOutputSizePixel(rSize);
 
-                if(rStyleSettings.GetPreviewUsesCheckeredBackground())
-                {
-                    const Point aNull(0, 0);
-                    static const sal_uInt32 nLen(8);
-                    static const Color aW(COL_WHITE);
-                    static const Color aG(0xef, 0xef, 0xef);
-
-                    pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG);
-                }
-                else
-                {
-                    pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
-                    pVirtualDevice->Erase();
-                }
-            }
+        if(rBitmapEx.IsTransparent())
+        {
+            const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
 
-            if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height())
+            if(rStyleSettings.GetPreviewUsesCheckeredBackground())
             {
-                rBitmapEx.Scale(rSize);
-                pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmapEx);
+                const Point aNull(0, 0);
+                static const sal_uInt32 nLen(8);
+                static const Color aW(COL_WHITE);
+                static const Color aG(0xef, 0xef, 0xef);
+
+                pVirtualDevice->DrawCheckered(aNull, rSize, nLen, aW, aG);
             }
             else
             {
-                const Size aBitmapSize(rBitmapEx.GetSizePixel());
+                pVirtualDevice->SetBackground(rStyleSettings.GetFieldColor());
+                pVirtualDevice->Erase();
+            }
+        }
+
+        if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height())
+        {
+            rBitmapEx.Scale(rSize);
+            pVirtualDevice->DrawBitmapEx(Point(0, 0), rBitmapEx);
+        }
+        else
+        {
+            const Size aBitmapSize(rBitmapEx.GetSizePixel());
 
-                for(long y(0); y < rSize.Height(); y += aBitmapSize.Height())
+            for(long y(0); y < rSize.Height(); y += aBitmapSize.Height())
+            {
+                for(long x(0); x < rSize.Width(); x += aBitmapSize.Width())
                 {
-                    for(long x(0); x < rSize.Width(); x += aBitmapSize.Width())
-                    {
-                        pVirtualDevice->DrawBitmapEx(
-                            Point(x, y),
-                            rBitmapEx);
-                    }
+                    pVirtualDevice->DrawBitmapEx(
+                        Point(x, y),
+                        rBitmapEx);
                 }
             }
-
-            rBitmapEx = pVirtualDevice->GetBitmapEx(Point(0, 0), rSize);
         }
+
+        rBitmapEx = pVirtualDevice->GetBitmapEx(Point(0, 0), rSize);
     }
 } // end of anonymous namespace
 
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index a08029b4be88..6439ea573995 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -511,31 +511,31 @@ bool ColumnsWidget::MouseMove(const MouseEvent& rMEvt)
 
 void ColumnsWidget::UpdateSize_Impl( long nNewCol )
 {
-    if ( nNewCol != nCol )
-    {
-        Size aWinSize = GetOutputSizePixel();
+    if ( nNewCol == nCol )
+        return;
 
-        Invalidate( tools::Rectangle( 0, aWinSize.Height() - 2,
-                               aWinSize.Width(), aWinSize.Height() ) );
+    Size aWinSize = GetOutputSizePixel();
 
-        long nMinCol = 0, nMaxCol = 0;
+    Invalidate( tools::Rectangle( 0, aWinSize.Height() - 2,
+                           aWinSize.Width(), aWinSize.Height() ) );
 
-        if ( nNewCol < nCol )
-        {
-            nMinCol = nNewCol;
-            nMaxCol = nCol;
-        }
-        else
-        {
-            nMinCol = nCol;
-            nMaxCol = nNewCol;
-        }
+    long nMinCol = 0, nMaxCol = 0;
 
-        Invalidate( tools::Rectangle( nMinCol*nMX-1, 0,
-                               nMaxCol*nMX+1, aWinSize.Height() - 2 ) );
-        nCol = nNewCol;
-        mrSpinButton.set_value(nCol);
+    if ( nNewCol < nCol )
+    {
+        nMinCol = nNewCol;
+        nMaxCol = nCol;
     }
+    else
+    {
+        nMinCol = nCol;
+        nMaxCol = nNewCol;
+    }
+
+    Invalidate( tools::Rectangle( nMinCol*nMX-1, 0,
+                           nMaxCol*nMX+1, aWinSize.Height() - 2 ) );
+    nCol = nNewCol;
+    mrSpinButton.set_value(nCol);
 }
 
 bool ColumnsWidget::MouseButtonDown(const MouseEvent&)
diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
index 6f7eda4d98a3..ee04adc7da0b 100644
--- a/svx/source/tbxctrls/lboxctrl.cxx
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -208,22 +208,22 @@ IMPL_LINK_NOARG(SvxPopupWindowListBox, ActivateHdl, weld::TreeView&, bool)
 void SvxUndoRedoControl::Do(sal_Int16 nCount)
 {
     Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
-    if ( xDispatchProvider.is() )
-    {
-        css::util::URL aTargetURL;
-        Reference < XURLTransformer > xTrans( URLTransformer::create(::comphelper::getProcessComponentContext()) );
-        aTargetURL.Complete = m_aCommandURL;
-        xTrans->parseStrict( aTargetURL );
+    if ( !xDispatchProvider.is() )
+        return;
 
-        Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
-        if ( xDispatch.is() )
-        {
-            INetURLObject aObj( m_aCommandURL );
-            Sequence< PropertyValue > aArgs( 1 );
-            aArgs[0].Name = aObj.GetURLPath();
-            aArgs[0].Value <<= nCount;
-            xDispatch->dispatch(aTargetURL, aArgs);
-        }
+    css::util::URL aTargetURL;
+    Reference < XURLTransformer > xTrans( URLTransformer::create(::comphelper::getProcessComponentContext()) );
+    aTargetURL.Complete = m_aCommandURL;
+    xTrans->parseStrict( aTargetURL );
+
+    Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
+    if ( xDispatch.is() )
+    {
+        INetURLObject aObj( m_aCommandURL );
+        Sequence< PropertyValue > aArgs( 1 );
+        aArgs[0].Name = aObj.GetURLPath();
+        aArgs[0].Value <<= nCount;
+        xDispatch->dispatch(aTargetURL, aArgs);
     }
 }
 
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 648b4856935a..e612ee2f4298 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -87,49 +87,49 @@ void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureSta
     m_xBtnUpdater->Update(rEvent);
 
     SfxObjectShell* pSh = SfxObjectShell::Current();
-    if (pSh)
+    if (!pSh)
+        return;
+
+    const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
+    if (!pItem)
+        return;
+
+    XDashListRef xList = pItem->GetDashList();
+    int nIndex = m_xBtnUpdater->GetStyleIndex();
+    switch (nIndex)
     {
-        const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
-        if (pItem)
+        case -1:
+        case 0:
         {
-            XDashListRef xList = pItem->GetDashList();
-            int nIndex = m_xBtnUpdater->GetStyleIndex();
-            switch (nIndex)
+            BitmapEx aEmpty(xList->GetBitmapForUISolidLine());
+            aEmpty.Erase(Application::GetSettings().GetStyleSettings().GetFieldColor());
+            if (m_pToolbar)
             {
-                case -1:
-                case 0:
-                {
-                    BitmapEx aEmpty(xList->GetBitmapForUISolidLine());
-                    aEmpty.Erase(Application::GetSettings().GetStyleSettings().GetFieldColor());
-                    if (m_pToolbar)
-                    {
-                        Graphic aGraf(aEmpty);
-                        m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
-                    }
-                    else
-                        pToolBox->SetItemImage(nId, Image(aEmpty));
-                    break;
-                }
-                case 1:
-                    if (m_pToolbar)
-                    {
-                        Graphic aGraf(xList->GetBitmapForUISolidLine());
-                        m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
-                    }
-                    else
-                        pToolBox->SetItemImage(nId, Image(xList->GetBitmapForUISolidLine()));
-                    break;
-                default:
-                    if (m_pToolbar)
-                    {
-                        Graphic aGraf(xList->GetUiBitmap(nIndex - 2));
-                        m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
-                    }
-                    else
-                        pToolBox->SetItemImage(nId, Image(xList->GetUiBitmap(nIndex - 2)));
-                    break;
+                Graphic aGraf(aEmpty);
+                m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
             }
+            else
+                pToolBox->SetItemImage(nId, Image(aEmpty));
+            break;
         }
+        case 1:
+            if (m_pToolbar)
+            {
+                Graphic aGraf(xList->GetBitmapForUISolidLine());
+                m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
+            }
+            else
+                pToolBox->SetItemImage(nId, Image(xList->GetBitmapForUISolidLine()));
+            break;
+        default:
+            if (m_pToolbar)
+            {
+                Graphic aGraf(xList->GetUiBitmap(nIndex - 2));
+                m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
+            }
+            else
+                pToolBox->SetItemImage(nId, Image(xList->GetUiBitmap(nIndex - 2)));
+            break;
     }
 }
 
@@ -395,18 +395,18 @@ void SvxLineEndWindow::FillValueSet()
 
 void SvxLineEndWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent )
 {
-    if ( rEvent.FeatureURL.Complete == ".uno:LineEndListState" )
+    if ( rEvent.FeatureURL.Complete != ".uno:LineEndListState" )
+        return;
+
+    // The list of line ends (LineEndList) has changed
+    css::uno::Reference< css::uno::XWeak > xWeak;
+    if ( rEvent.State >>= xWeak )
     {
-        // The list of line ends (LineEndList) has changed
-        css::uno::Reference< css::uno::XWeak > xWeak;
-        if ( rEvent.State >>= xWeak )
-        {
-            mpLineEndList.set( static_cast< XLineEndList* >( xWeak.get() ) );
-            DBG_ASSERT( mpLineEndList.is(), "LineEndList not found" );
+        mpLineEndList.set( static_cast< XLineEndList* >( xWeak.get() ) );
+        DBG_ASSERT( mpLineEndList.is(), "LineEndList not found" );
 
-            mxLineEndSet->Clear();
-            FillValueSet();
-        }
+        mxLineEndSet->Clear();
+        FillValueSet();
     }
 }
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index ade8b2d10224..e4d6e08dcdb6 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1015,26 +1015,26 @@ void SvxStyleBox_Base::Select(bool bNonTravelSelect)
         while in Dispatch()), accessing members will crash in this case. */
     ReleaseFocus();
 
-    if( bDoIt )
-    {
-        if ( bClear )
-            set_active_or_entry_text(aSearchEntry);
-        m_xWidget->save_value();
+    if( !bDoIt )
+        return;
 
-        Sequence< PropertyValue > aArgs( 2 );
-        aArgs[0].Value  <<= aSearchEntry;
-        aArgs[1].Name   = "Family";
-        aArgs[1].Value  <<= sal_Int16( eStyleFamily );
-        if( bCreateNew )
-        {
-            aArgs[0].Name   = "Param";
-            SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:StyleNewByExample", aArgs);
-        }
-        else
-        {
-            aArgs[0].Name   = "Template";
-            SfxToolBoxControl::Dispatch( m_xDispatchProvider, m_aCommand, aArgs );
-        }
+    if ( bClear )
+        set_active_or_entry_text(aSearchEntry);
+    m_xWidget->save_value();
+
+    Sequence< PropertyValue > aArgs( 2 );
+    aArgs[0].Value  <<= aSearchEntry;
+    aArgs[1].Name   = "Family";
+    aArgs[1].Value  <<= sal_Int16( eStyleFamily );
+    if( bCreateNew )
+    {
+        aArgs[0].Name   = "Param";
+        SfxToolBoxControl::Dispatch( m_xDispatchProvider, ".uno:StyleNewByExample", aArgs);
+    }
+    else
+    {
+        aArgs[0].Name   = "Template";
+        SfxToolBoxControl::Dispatch( m_xDispatchProvider, m_aCommand, aArgs );
     }
 }
 
@@ -1159,128 +1159,128 @@ void SvxStyleBox_Base::SetupEntry(vcl::RenderContext& rRenderContext, sal_Int32
             m_xWidget->set_item_menu(OString::number(nItem), m_xMenu.get());
     }
 
-    if (nItem > 0 && nItem < m_xWidget->get_count() - 1)
-    {
-        SfxObjectShell *pShell = SfxObjectShell::Current();
-        SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool();
-        SfxStyleSheetBase* pStyle = nullptr;
+    if (nItem <= 0 || nItem >= m_xWidget->get_count() - 1)
+        return;
 
-        if ( pPool )
-        {
-            pStyle = pPool->First(eStyleFamily);
-            while (pStyle && pStyle->GetName() != rStyleName)
-                pStyle = pPool->Next();
-        }
+    SfxObjectShell *pShell = SfxObjectShell::Current();
+    SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool();
+    SfxStyleSheetBase* pStyle = nullptr;
 
-        if (pStyle )
-        {
-            std::unique_ptr<const SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
-            if (!pItemSet) return;
+    if ( pPool )
+    {
+        pStyle = pPool->First(eStyleFamily);
+        while (pStyle && pStyle->GetName() != rStyleName)
+            pStyle = pPool->Next();
+    }
 
-            const SvxFontItem * const pFontItem =
-                pItemSet->GetItem<SvxFontItem>(SID_ATTR_CHAR_FONT);
-            const SvxFontHeightItem * const pFontHeightItem =
-                pItemSet->GetItem<SvxFontHeightItem>(SID_ATTR_CHAR_FONTHEIGHT);
+    if (!pStyle )
+        return;
 
-            if ( pFontItem && pFontHeightItem )
-            {
-                Size aFontSize( 0, pFontHeightItem->GetHeight() );
-                Size aPixelSize(rRenderContext.LogicToPixel(aFontSize, MapMode(pShell->GetMapUnit())));
+    std::unique_ptr<const SfxItemSet> const pItemSet(pStyle->GetItemSetForPreview());
+    if (!pItemSet) return;
 
-                // setup the font properties
-                SvxFont aFont;
-                aFont.SetFamilyName(pFontItem->GetFamilyName());
-                aFont.SetStyleName(pFontItem->GetStyleName());
-                aFont.SetFontSize(aPixelSize);
+    const SvxFontItem * const pFontItem =
+        pItemSet->GetItem<SvxFontItem>(SID_ATTR_CHAR_FONT);
+    const SvxFontHeightItem * const pFontHeightItem =
+        pItemSet->GetItem<SvxFontHeightItem>(SID_ATTR_CHAR_FONTHEIGHT);
 
-                const SfxPoolItem *pItem = pItemSet->GetItem( SID_ATTR_CHAR_WEIGHT );
-                if ( pItem )
-                    aFont.SetWeight( static_cast< const SvxWeightItem* >( pItem )->GetWeight() );
+    if ( !(pFontItem && pFontHeightItem) )
+        return;
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_POSTURE );
-                if ( pItem )
-                    aFont.SetItalic( static_cast< const SvxPostureItem* >( pItem )->GetPosture() );
+    Size aFontSize( 0, pFontHeightItem->GetHeight() );
+    Size aPixelSize(rRenderContext.LogicToPixel(aFontSize, MapMode(pShell->GetMapUnit())));
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_CONTOUR );
-                if ( pItem )
-                    aFont.SetOutline( static_cast< const SvxContourItem* >( pItem )->GetValue() );
+    // setup the font properties
+    SvxFont aFont;
+    aFont.SetFamilyName(pFontItem->GetFamilyName());
+    aFont.SetStyleName(pFontItem->GetStyleName());
+    aFont.SetFontSize(aPixelSize);
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_SHADOWED );
-                if ( pItem )
-                    aFont.SetShadow( static_cast< const SvxShadowedItem* >( pItem )->GetValue() );
+    const SfxPoolItem *pItem = pItemSet->GetItem( SID_ATTR_CHAR_WEIGHT );
+    if ( pItem )
+        aFont.SetWeight( static_cast< const SvxWeightItem* >( pItem )->GetWeight() );
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_RELIEF );
-                if ( pItem )
-                    aFont.SetRelief( static_cast< const SvxCharReliefItem* >( pItem )->GetValue() );
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_POSTURE );
+    if ( pItem )
+        aFont.SetItalic( static_cast< const SvxPostureItem* >( pItem )->GetPosture() );
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_UNDERLINE );
-                if ( pItem )
-                    aFont.SetUnderline( static_cast< const SvxUnderlineItem* >( pItem )->GetLineStyle() );
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_CONTOUR );
+    if ( pItem )
+        aFont.SetOutline( static_cast< const SvxContourItem* >( pItem )->GetValue() );
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_OVERLINE );
-                if ( pItem )
-                    aFont.SetOverline( static_cast< const SvxOverlineItem* >( pItem )->GetValue() );
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_SHADOWED );
+    if ( pItem )
+        aFont.SetShadow( static_cast< const SvxShadowedItem* >( pItem )->GetValue() );
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_STRIKEOUT );
-                if ( pItem )
-                    aFont.SetStrikeout( static_cast< const SvxCrossedOutItem* >( pItem )->GetStrikeout() );
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_RELIEF );
+    if ( pItem )
+        aFont.SetRelief( static_cast< const SvxCharReliefItem* >( pItem )->GetValue() );
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_CASEMAP );
-                if ( pItem )
-                    aFont.SetCaseMap(static_cast<const SvxCaseMapItem*>(pItem)->GetCaseMap());
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_UNDERLINE );
+    if ( pItem )
+        aFont.SetUnderline( static_cast< const SvxUnderlineItem* >( pItem )->GetLineStyle() );
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_EMPHASISMARK );
-                if ( pItem )
-                    aFont.SetEmphasisMark( static_cast< const SvxEmphasisMarkItem* >( pItem )->GetEmphasisMark() );
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_OVERLINE );
+    if ( pItem )
+        aFont.SetOverline( static_cast< const SvxOverlineItem* >( pItem )->GetValue() );
 
-                // setup the device & draw
-                Color aFontCol = COL_AUTO, aBackCol = COL_AUTO;
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_STRIKEOUT );
+    if ( pItem )
+        aFont.SetStrikeout( static_cast< const SvxCrossedOutItem* >( pItem )->GetStrikeout() );
 
-                rRenderContext.SetFont(aFont);
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_CASEMAP );
+    if ( pItem )
+        aFont.SetCaseMap(static_cast<const SvxCaseMapItem*>(pItem)->GetCaseMap());
 
-                pItem = pItemSet->GetItem( SID_ATTR_CHAR_COLOR );
-                // text color, when nothing is selected
-                if ( (nullptr != pItem) && bIsNotSelected)
-                    aFontCol = static_cast< const SvxColorItem* >( pItem )->GetValue();
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_EMPHASISMARK );
+    if ( pItem )
+        aFont.SetEmphasisMark( static_cast< const SvxEmphasisMarkItem* >( pItem )->GetEmphasisMark() );
 
-                drawing::FillStyle style = drawing::FillStyle_NONE;
-                // which kind of Fill style is selected
-                pItem = pItemSet->GetItem( XATTR_FILLSTYLE );
-                // only when ok and not selected
-                if ( (nullptr != pItem) && bIsNotSelected)
-                    style = static_cast< const XFillStyleItem* >( pItem )->GetValue();
+    // setup the device & draw
+    Color aFontCol = COL_AUTO, aBackCol = COL_AUTO;
 
-                switch(style)
-                {
-                    case drawing::FillStyle_SOLID:
-                    {
-                        // set background color
-                        pItem = pItemSet->GetItem( XATTR_FILLCOLOR );
-                        if ( nullptr != pItem )
-                            aBackCol = static_cast< const XFillColorItem* >( pItem )->GetColorValue();
+    rRenderContext.SetFont(aFont);
 
-                        if ( aBackCol != COL_AUTO )
-                        {
-                            rRenderContext.SetFillColor(aBackCol);
-                            rRenderContext.DrawRect(rRect);
-                        }
-                    }
-                    break;
+    pItem = pItemSet->GetItem( SID_ATTR_CHAR_COLOR );
+    // text color, when nothing is selected
+    if ( (nullptr != pItem) && bIsNotSelected)
+        aFontCol = static_cast< const SvxColorItem* >( pItem )->GetValue();
 
-                    default: break;
-                    //TODO Draw the other background styles: gradient, hatching and bitmap
-                }
+    drawing::FillStyle style = drawing::FillStyle_NONE;
+    // which kind of Fill style is selected
+    pItem = pItemSet->GetItem( XATTR_FILLSTYLE );
+    // only when ok and not selected
+    if ( (nullptr != pItem) && bIsNotSelected)
+        style = static_cast< const XFillStyleItem* >( pItem )->GetValue();
 
-                // when the font and background color are too similar, adjust the Font-Color
-                if( (aFontCol != COL_AUTO) || (aBackCol != COL_AUTO) )
-                    aFontCol = TestColorsVisible(aFontCol, (aBackCol != COL_AUTO) ? aBackCol : rRenderContext.GetBackground().GetColor());
+    switch(style)
+    {
+        case drawing::FillStyle_SOLID:
+        {
+            // set background color
+            pItem = pItemSet->GetItem( XATTR_FILLCOLOR );
+            if ( nullptr != pItem )
+                aBackCol = static_cast< const XFillColorItem* >( pItem )->GetColorValue();
 
-                // set text color
-                if ( aFontCol != COL_AUTO )
-                    rRenderContext.SetTextColor(aFontCol);
+            if ( aBackCol != COL_AUTO )
+            {
+                rRenderContext.SetFillColor(aBackCol);
+                rRenderContext.DrawRect(rRect);
             }
         }
+        break;
+
+        default: break;
+        //TODO Draw the other background styles: gradient, hatching and bitmap
     }
+
+    // when the font and background color are too similar, adjust the Font-Color
+    if( (aFontCol != COL_AUTO) || (aBackCol != COL_AUTO) )
+        aFontCol = TestColorsVisible(aFontCol, (aBackCol != COL_AUTO) ? aBackCol : rRenderContext.GetBackground().GetColor());
+
+    // set text color
+    if ( aFontCol != COL_AUTO )
+        rRenderContext.SetTextColor(aFontCol);
 }
 
 IMPL_LINK(SvxStyleBox_Base, CustomRenderHdl, weld::ComboBox::render_args, aPayload, void)
@@ -2338,37 +2338,37 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl, ValueSet*, void)
 
 void SvxFrameWindow_Impl::statusChanged( const css::frame::FeatureStateEvent& rEvent )
 {
-    if ( rEvent.FeatureURL.Complete == ".uno:BorderReducedMode" )
-    {
-        bool bValue;
-        if ( rEvent.State >>= bValue )
-        {
-            bParagraphMode = bValue;
-            //initial calls mustn't insert or remove elements
-            if(mxFrameSet->GetItemCount())
-            {
-                bool bTableMode = ( mxFrameSet->GetItemCount() == 12 );
-                bool bResize    = false;
+    if ( rEvent.FeatureURL.Complete != ".uno:BorderReducedMode" )
+        return;
 
-                if ( bTableMode && bParagraphMode )
-                {
-                    for ( sal_uInt16 i = 9; i < 13; i++ )
-                        mxFrameSet->RemoveItem(i);
-                    bResize = true;
-                }
-                else if ( !bTableMode && !bParagraphMode )
-                {
-                    for ( sal_uInt16 i = 9; i < 13; i++ )
-                        mxFrameSet->InsertItem(i, Image(aImgVec[i-1]));
-                    bResize = true;
-                }
+    bool bValue;
+    if ( !(rEvent.State >>= bValue) )
+        return;
 
-                if ( bResize )
-                {
-                    CalcSizeValueSet();
-                }
-            }
-        }
+    bParagraphMode = bValue;
+    //initial calls mustn't insert or remove elements
+    if(!mxFrameSet->GetItemCount())
+        return;
+
+    bool bTableMode = ( mxFrameSet->GetItemCount() == 12 );
+    bool bResize    = false;
+
+    if ( bTableMode && bParagraphMode )
+    {
+        for ( sal_uInt16 i = 9; i < 13; i++ )
+            mxFrameSet->RemoveItem(i);
+        bResize = true;
+    }
+    else if ( !bTableMode && !bParagraphMode )
+    {
+        for ( sal_uInt16 i = 9; i < 13; i++ )
+            mxFrameSet->InsertItem(i, Image(aImgVec[i-1]));
+        bResize = true;
+    }
+
+    if ( bResize )
+    {
+        CalcSizeValueSet();
     }
 }
 
@@ -2666,19 +2666,19 @@ void SAL_CALL SvxStyleToolBoxControl::initialize(const Sequence<Any>& rArguments
 
     // After initialize we should have a valid frame member where we can retrieve our
     // dispatch provider.
-    if ( m_xFrame.is() )
+    if ( !m_xFrame.is() )
+        return;
+
+    pImpl->InitializeStyles(m_xFrame->getController()->getModel());
+    Reference< XDispatchProvider > xDispatchProvider( m_xFrame->getController(), UNO_QUERY );
+    for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
     {
-        pImpl->InitializeStyles(m_xFrame->getController()->getModel());
-        Reference< XDispatchProvider > xDispatchProvider( m_xFrame->getController(), UNO_QUERY );
-        for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
-        {
-            pBoundItems[i]   = new SfxStyleControllerItem_Impl( xDispatchProvider,
-                                                                SID_STYLE_FAMILY_START + i,
-                                                                OUString::createFromAscii( StyleSlotToStyleCommand[i] ),
-                                                                *this );
-            m_xBoundItems[i].set( static_cast< OWeakObject* >( pBoundItems[i] ), UNO_QUERY );
-            pFamilyState[i]  = nullptr;
-        }
+        pBoundItems[i]   = new SfxStyleControllerItem_Impl( xDispatchProvider,
+                                                            SID_STYLE_FAMILY_START + i,
+                                                            OUString::createFromAscii( StyleSlotToStyleCommand[i] ),
+                                                            *this );
+        m_xBoundItems[i].set( static_cast< OWeakObject* >( pBoundItems[i] ), UNO_QUERY );
+        pFamilyState[i]  = nullptr;
     }
 }
 
@@ -2774,99 +2774,99 @@ void SvxStyleToolBoxControl::FillStyleBox()
     DBG_ASSERT( pStyleSheetPool, "StyleSheetPool not found!" );
     DBG_ASSERT( pBox,            "Control not found!" );
 
-    if ( pStyleSheetPool && pBox && nActFamily!=0xffff )
-    {
-        const SfxStyleFamily    eFamily     = GetActFamily();
-        SfxStyleSheetBase*      pStyle      = nullptr;
-        bool                    bDoFill     = false;
+    if ( !(pStyleSheetPool && pBox && nActFamily!=0xffff) )
+        return;
 
-        auto xIter = pStyleSheetPool->CreateIterator(eFamily, SfxStyleSearchBits::Used);
-        sal_uInt16 nCount = xIter->Count();
+    const SfxStyleFamily    eFamily     = GetActFamily();
+    SfxStyleSheetBase*      pStyle      = nullptr;
+    bool                    bDoFill     = false;
 
-        // Check whether fill is necessary
-        pStyle = xIter->First();
-        //!!! TODO: This condition isn't right any longer, because we always show some default entries
-        //!!! so the list doesn't show the count
-        if ( nCount != pBox->get_count() )
-        {
-            bDoFill = true;
-        }
-        else
+    auto xIter = pStyleSheetPool->CreateIterator(eFamily, SfxStyleSearchBits::Used);
+    sal_uInt16 nCount = xIter->Count();
+
+    // Check whether fill is necessary
+    pStyle = xIter->First();
+    //!!! TODO: This condition isn't right any longer, because we always show some default entries
+    //!!! so the list doesn't show the count
+    if ( nCount != pBox->get_count() )
+    {
+        bDoFill = true;
+    }
+    else
+    {
+        sal_uInt16 i= 0;
+        while ( pStyle && !bDoFill )
         {
-            sal_uInt16 i= 0;
-            while ( pStyle && !bDoFill )
-            {
-                bDoFill = ( pBox->get_text(i) != pStyle->GetName() );
-                pStyle = xIter->Next();
-                i++;
-            }
+            bDoFill = ( pBox->get_text(i) != pStyle->GetName() );
+            pStyle = xIter->Next();
+            i++;
         }
+    }
 
-        if ( bDoFill )
-        {
-            OUString aStrSel(pBox->get_active_text());
-            pBox->freeze();
-            pBox->clear();
+    if ( !bDoFill )
+        return;
 
-            std::vector<OUString> aStyles;
+    OUString aStrSel(pBox->get_active_text());
+    pBox->freeze();
+    pBox->clear();
 
-            {
-                pStyle = xIter->Next();
+    std::vector<OUString> aStyles;
 
-                if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
-                {
-                    while ( pStyle )
-                    {
-                        // sort out default styles
-                        bool bInsert = true;
-                        OUString aName( pStyle->GetName() );
-                        for( auto const & _i: pImpl->aDefaultStyles )
-                        {
-                            if( _i == aName )
-                            {
-                                bInsert = false;
-                                break;
-                            }
-                        }
+    {
+        pStyle = xIter->Next();
 
-                        if( bInsert )
-                            aStyles.push_back(aName);
-                        pStyle = xIter->Next();
-                    }
-                }
-                else
+        if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
+        {
+            while ( pStyle )
+            {
+                // sort out default styles
+                bool bInsert = true;
+                OUString aName( pStyle->GetName() );
+                for( auto const & _i: pImpl->aDefaultStyles )
                 {
-                    while ( pStyle )
+                    if( _i == aName )
                     {
-                        aStyles.push_back(pStyle->GetName());
-                        pStyle = xIter->Next();
+                        bInsert = false;
+                        break;
                     }
                 }
-            }
 
-            if (pImpl->bSpecModeWriter || pImpl->bSpecModeCalc)
+                if( bInsert )
+                    aStyles.push_back(aName);
+                pStyle = xIter->Next();
+            }
+        }
+        else
+        {
+            while ( pStyle )
             {
-                pBox->append_text(pImpl->aClearForm);
-                pBox->insert_separator(1, "separator");
-
-                // insert default styles
-                for (const auto &rStyle : pImpl->aDefaultStyles)
-                    pBox->append_text(rStyle);
+                aStyles.push_back(pStyle->GetName());
+                pStyle = xIter->Next();
             }
+        }
+    }
 
-            std::sort(aStyles.begin(), aStyles.end());
+    if (pImpl->bSpecModeWriter || pImpl->bSpecModeCalc)
+    {
+        pBox->append_text(pImpl->aClearForm);
+        pBox->insert_separator(1, "separator");
 
-            for (const auto& rStyle : aStyles)
-                pBox->append_text(rStyle);
+        // insert default styles
+        for (const auto &rStyle : pImpl->aDefaultStyles)
+            pBox->append_text(rStyle);
+    }
 
-            if (pImpl->bSpecModeWriter || pImpl->bSpecModeCalc)
-                pBox->append_text(pImpl->aMore);
+    std::sort(aStyles.begin(), aStyles.end());
 
-            pBox->thaw();
-            pBox->set_active_or_entry_text(aStrSel);
-            pBox->SetFamily( eFamily );
-        }
-    }
+    for (const auto& rStyle : aStyles)
+        pBox->append_text(rStyle);
+
+    if (pImpl->bSpecModeWriter || pImpl->bSpecModeCalc)
+        pBox->append_text(pImpl->aMore);
+
+    pBox->thaw();
+    pBox->set_active_or_entry_text(aStrSel);
+    pBox->SetFamily( eFamily );
 }
 
 void SvxStyleToolBoxControl::SelectStyle( const OUString& rStyleName )
@@ -2874,19 +2874,19 @@ void SvxStyleToolBoxControl::SelectStyle( const OUString& rStyleName )
     SvxStyleBox_Base* pBox = pImpl->m_pBox;
     DBG_ASSERT( pBox, "Control not found!" );
 
-    if ( pBox )
-    {
-        OUString aStrSel(pBox->get_active_text());
+    if ( !pBox )
+        return;
 
-        if ( !rStyleName.isEmpty() )
-        {
-            if ( rStyleName != aStrSel )
-                pBox->set_active_or_entry_text( rStyleName );
-        }
-        else
-            pBox->set_active(-1);
-        pBox->save_value();
+    OUString aStrSel(pBox->get_active_text());
+
+    if ( !rStyleName.isEmpty() )
+    {
+        if ( rStyleName != aStrSel )
+            pBox->set_active_or_entry_text( rStyleName );
     }
+    else
+        pBox->set_active(-1);
+    pBox->save_value();
 }
 
 void SvxStyleToolBoxControl::Update()
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index f1d1db4522ee..ab419bbc7076 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -422,41 +422,41 @@ void SAL_CALL FontHeightToolBoxControl::dispose()
 void SAL_CALL FontHeightToolBoxControl::statusChanged(
     const frame::FeatureStateEvent& rEvent )
 {
-    if ( m_pBox )
+    if ( !m_pBox )
+        return;
+
+    SolarMutexGuard aSolarMutexGuard;
+    if (rEvent.FeatureURL.Path == "FontHeight")
     {
-        SolarMutexGuard aSolarMutexGuard;
-        if (rEvent.FeatureURL.Path == "FontHeight")
+        if ( rEvent.IsEnabled )
         {
-            if ( rEvent.IsEnabled )
-            {
-                m_pBox->set_sensitive(true);
-                frame::status::FontHeight aFontHeight;
-                if ( rEvent.State >>= aFontHeight )
-                    m_pBox->statusChanged_Impl( long( 10. * aFontHeight.Height ), false );
-                else
-                    m_pBox->statusChanged_Impl( long( -1 ), true );
-            }
+            m_pBox->set_sensitive(true);
+            frame::status::FontHeight aFontHeight;
+            if ( rEvent.State >>= aFontHeight )
+                m_pBox->statusChanged_Impl( long( 10. * aFontHeight.Height ), false );
             else
-            {
-                m_pBox->set_sensitive(false);
                 m_pBox->statusChanged_Impl( long( -1 ), true );
-            }
-
-            if (m_pToolbar)
-                m_pToolbar->set_item_sensitive(m_aCommandURL.toUtf8(), rEvent.IsEnabled);
-            else
-            {
-                ToolBox* pToolBox = nullptr;
-                sal_uInt16 nId = 0;
-                if (getToolboxId(nId, &pToolBox))
-                    pToolBox->EnableItem(nId, rEvent.IsEnabled);
-            }
         }
-        else if ( rEvent.FeatureURL.Path == "CharFontName" )
+        else
         {
-            if ( rEvent.State >>= m_aCurrentFont )
-                m_pBox->UpdateFont( m_aCurrentFont );
+            m_pBox->set_sensitive(false);
+            m_pBox->statusChanged_Impl( long( -1 ), true );
         }
+
+        if (m_pToolbar)
+            m_pToolbar->set_item_sensitive(m_aCommandURL.toUtf8(), rEvent.IsEnabled);
+        else
+        {
+            ToolBox* pToolBox = nullptr;
+            sal_uInt16 nId = 0;
+            if (getToolboxId(nId, &pToolBox))
+                pToolBox->EnableItem(nId, rEvent.IsEnabled);
+        }
+    }
+    else if ( rEvent.FeatureURL.Path == "CharFontName" )
+    {
+        if ( rEvent.State >>= m_aCurrentFont )
+            m_pBox->UpdateFont( m_aCurrentFont );
     }
 }
 
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 040aaa34aa16..8372d7876c9b 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -1540,25 +1540,25 @@ void SAL_CALL FindbarDispatcher::dispatch( const css::util::URL& aURL, const css
     VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
     ToolBox* pToolBox = static_cast<ToolBox*>(pWindow.get());
     pToolBox->set_id("FindBar");
-    if ( pToolBox )
+    if ( !pToolBox )
+        return;
+
+    ToolBox::ImplToolItems::size_type nItemCount = pToolBox->GetItemCount();
+    for ( ToolBox::ImplToolItems::size_type i=0; i<nItemCount; ++i )
     {
-        ToolBox::ImplToolItems::size_type nItemCount = pToolBox->GetItemCount();
-        for ( ToolBox::ImplToolItems::size_type i=0; i<nItemCount; ++i )
+        sal_uInt16 id = pToolBox->GetItemId(i);
+        OUString sItemCommand = pToolBox->GetItemCommand(id);
+        if ( sItemCommand == COMMAND_FINDTEXT )
         {
-            sal_uInt16 id = pToolBox->GetItemId(i);
-            OUString sItemCommand = pToolBox->GetItemCommand(id);
-            if ( sItemCommand == COMMAND_FINDTEXT )
+            vcl::Window* pItemWin = pToolBox->GetItemWindow( id );
+            if ( pItemWin )
             {
-                vcl::Window* pItemWin = pToolBox->GetItemWindow( id );
-                if ( pItemWin )
-                {
-                    SolarMutexGuard aSolarMutexGuard;
-                    FindTextFieldControl* pFindTextFieldControl = dynamic_cast<FindTextFieldControl*>(pItemWin);
-                    if ( pFindTextFieldControl )
-                        pFindTextFieldControl->SetTextToSelected_Impl();
-                    pItemWin->GrabFocus();
-                    return;
-                }
+                SolarMutexGuard aSolarMutexGuard;
+                FindTextFieldControl* pFindTextFieldControl = dynamic_cast<FindTextFieldControl*>(pItemWin);
+                if ( pFindTextFieldControl )
+                    pFindTextFieldControl->SetTextToSelected_Impl();
+                pItemWin->GrabFocus();
+                return;
             }
         }
     }
diff --git a/svx/source/tbxctrls/tbxcolor.cxx b/svx/source/tbxctrls/tbxcolor.cxx
index 4aa985bb70a9..e87e1910f58e 100644
--- a/svx/source/tbxctrls/tbxcolor.cxx
+++ b/svx/source/tbxctrls/tbxcolor.cxx
@@ -39,19 +39,19 @@ namespace svx
         m_sToolboxResName += rToolboxName;
 
         // the layout manager
-        if ( SfxViewFrame::Current() )
+        if ( !SfxViewFrame::Current() )
+            return;
+
+        try
         {
-            try
-            {
-                Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
-                Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY );
-                if ( xFrameProps.is() )
-                    xFrameProps->getPropertyValue( "LayoutManager" ) >>= m_xLayouter;
-            }
-            catch ( Exception const & )
-            {
-                TOOLS_WARN_EXCEPTION( "svx.tbxcrtls", "ToolboxAccess::Ctor()" );
-            }
+            Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
+            Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY );
+            if ( xFrameProps.is() )
+                xFrameProps->getPropertyValue( "LayoutManager" ) >>= m_xLayouter;
+        }
+        catch ( Exception const & )
+        {
+            TOOLS_WARN_EXCEPTION( "svx.tbxcrtls", "ToolboxAccess::Ctor()" );
         }
     }
 
diff --git a/svx/source/tbxctrls/tbxdrctl.cxx b/svx/source/tbxctrls/tbxdrctl.cxx
index 782c6a8f0ee0..088488a9e061 100644
--- a/svx/source/tbxctrls/tbxdrctl.cxx
+++ b/svx/source/tbxctrls/tbxdrctl.cxx
@@ -71,23 +71,23 @@ void SvxTbxCtlDraw::StateChanged( sal_uInt16 nSID, SfxItemState eState,
 void SvxTbxCtlDraw::toggleToolbox()
 {
     Reference< XLayoutManager > xLayoutMgr = getLayoutManager();
-    if ( xLayoutMgr.is() )
+    if ( !xLayoutMgr.is() )
+        return;
+
+    bool bCheck = false;
+    if ( xLayoutMgr->isElementVisible( m_sToolboxName ) )
+    {
+        xLayoutMgr->hideElement( m_sToolboxName );
+        xLayoutMgr->destroyElement( m_sToolboxName );
+    }
+    else
     {
-        bool bCheck = false;
-        if ( xLayoutMgr->isElementVisible( m_sToolboxName ) )
-        {
-            xLayoutMgr->hideElement( m_sToolboxName );
-            xLayoutMgr->destroyElement( m_sToolboxName );
-        }
-        else
-        {
-            bCheck = true;
-            xLayoutMgr->createElement( m_sToolboxName );
-            xLayoutMgr->showElement( m_sToolboxName );
-        }
-
-        GetToolBox().CheckItem( GetId(), bCheck );
+        bCheck = true;
+        xLayoutMgr->createElement( m_sToolboxName );
+        xLayoutMgr->showElement( m_sToolboxName );
     }
+
+    GetToolBox().CheckItem( GetId(), bCheck );
 }
 
 


More information about the Libreoffice-commits mailing list