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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Feb 24 12:00:09 UTC 2019


 sd/source/ui/func/fuconbez.cxx |   48 ++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 26 deletions(-)

New commits:
commit 6dd6a1ac350e4be903917e4095d391b6744f047f
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Sun Feb 24 12:33:49 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Sun Feb 24 12:59:48 2019 +0100

    Unflatten the if block of SID_DRAW_FREELINE_NOFILL
    
    Flattening makes it harder to see the logic here.
    More cases might be added, and the whole decision
    block might be turned into a bunch of switch cases
    in the future.
    
    Change-Id: Ibfe507685f0a71a2d65a4a6e26fadba47675a8a6
    Reviewed-on: https://gerrit.libreoffice.org/68282
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index 31f0ea0b7feb..12c680cbaf57 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -112,34 +112,30 @@ void FuConstructBezierPolygon::DoExecute( SfxRequest& rReq )
     if( SfxItemState::SET == pArgs->GetItemState( SID_ADD_MOTION_PATH, true, &pPoolItem ) )
         maTargets = static_cast<const SfxUnoAnyItem*>( pPoolItem )->GetValue();
 
-    if (nSlotId != SID_DRAW_FREELINE_NOFILL)
-        return;
-
-    // This piece is only relevant for SID_DRAW_FREELINE_NOFILL
-    // Adding this note for the future because the if-block gets auto-flattened
-    // by loplugins
-    const SfxUInt16Item* pTransparence  = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
-    const SfxStringItem* pColor         = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
-    const SfxUInt16Item* pWidth         = rReq.GetArg<SfxUInt16Item>(FN_PARAM_3);
-    const SfxStringItem* pShapeName     = rReq.GetArg<SfxStringItem>(SID_SHAPE_NAME);
-
-    if (pTransparence && pTransparence->GetValue() > 0)
-    {
-        mnTransparence = pTransparence->GetValue();
-    }
-    if (pColor && !pColor->GetValue().isEmpty())
-    {
-        msColor = pColor->GetValue();
-    }
-    if (pWidth && pWidth->GetValue() > 0)
-    {
-        mnWidth = pWidth->GetValue();
-    }
-    if (pShapeName && !pShapeName->GetValue().isEmpty())
+    if (nSlotId == SID_DRAW_FREELINE_NOFILL)
     {
-        msShapeName = pShapeName->GetValue();
+        const SfxUInt16Item* pTransparence  = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
+        const SfxStringItem* pColor         = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
+        const SfxUInt16Item* pWidth         = rReq.GetArg<SfxUInt16Item>(FN_PARAM_3);
+        const SfxStringItem* pShapeName     = rReq.GetArg<SfxStringItem>(SID_SHAPE_NAME);
+
+        if (pTransparence && pTransparence->GetValue() > 0)
+        {
+            mnTransparence = pTransparence->GetValue();
+        }
+        if (pColor && !pColor->GetValue().isEmpty())
+        {
+            msColor = pColor->GetValue();
+        }
+        if (pWidth && pWidth->GetValue() > 0)
+        {
+            mnWidth = pWidth->GetValue();
+        }
+        if (pShapeName && !pShapeName->GetValue().isEmpty())
+        {
+            msShapeName = pShapeName->GetValue();
+        }
     }
-    // End of the SID_DRAW_FREELINE_NOFILL block
 }
 
 bool FuConstructBezierPolygon::MouseButtonDown(const MouseEvent& rMEvt)


More information about the Libreoffice-commits mailing list