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

Kohei Yoshida kohei.yoshida at collabora.com
Thu Aug 14 11:21:54 PDT 2014


 svx/source/svdraw/svddrgmt.cxx |  116 ++++++++++++++++++++---------------------
 1 file changed, 58 insertions(+), 58 deletions(-)

New commits:
commit b732ba336af1d4c9a3d2780ecca7ce3231187f96
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Aug 14 12:42:17 2014 -0400

    Massive scope level reduction by early bail-out.
    
    Change-Id: Ie620208f02bf74844f9b7cb904f9c5abbb10ca07

diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 0952a23..b28c8a9 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -1300,75 +1300,75 @@ void SdrDragObjOwn::MoveSdrDrag(const Point& rNoSnapPnt)
 {
     const SdrObject* pObj = GetDragObj();
 
-    if(pObj)
+    if (!pObj)
+        // No object to drag.  Bail out.
+        return;
+
+    Point aPnt(rNoSnapPnt);
+    SdrPageView* pPV = GetDragPV();
+
+    if (!pPV)
+        // No page view available.  Bail out.
+        return;
+
+    if(!DragStat().IsNoSnap())
     {
-        Point aPnt(rNoSnapPnt);
-        SdrPageView* pPV = GetDragPV();
+        SnapPos(aPnt);
+    }
 
-        if(pPV)
+    if(getSdrDragView().IsOrtho())
+    {
+        if (DragStat().IsOrtho8Possible())
         {
-            if(!DragStat().IsNoSnap())
-            {
-                SnapPos(aPnt);
-            }
+            OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
+        }
+        else if (DragStat().IsOrtho4Possible())
+        {
+            OrthoDistance4(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
+        }
+    }
 
-            if(getSdrDragView().IsOrtho())
-            {
-                if (DragStat().IsOrtho8Possible())
-                {
-                    OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
-                }
-                else if (DragStat().IsOrtho4Possible())
-                {
-                    OrthoDistance4(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
-                }
-            }
+    if (!DragStat().CheckMinMoved(rNoSnapPnt))
+        // Not moved by the minimum threshold.  Nothing to do.
+        return;
 
-            if(DragStat().CheckMinMoved(rNoSnapPnt))
-            {
-                if(aPnt != DragStat().GetNow())
-                {
-                    Hide();
-                    DragStat().NextMove(aPnt);
+    Hide();
+    DragStat().NextMove(aPnt);
 
-                    // since SdrDragObjOwn currently supports no transformation of
-                    // existing SdrDragEntries but only their recreation, a recreation
-                    // after every move is needed in this mode. Delete existing
-                    // SdrDragEntries here  to force their recreation in the following Show().
-                    clearSdrDragEntries();
+    // since SdrDragObjOwn currently supports no transformation of
+    // existing SdrDragEntries but only their recreation, a recreation
+    // after every move is needed in this mode. Delete existing
+    // SdrDragEntries here  to force their recreation in the following Show().
+    clearSdrDragEntries();
 
-                    // delete current clone (after the last reference to it is deleted above)
-                    if(mpClone)
-                    {
-                        SdrObject::Free(mpClone);
-                        mpClone = 0;
-                    }
+    // delete current clone (after the last reference to it is deleted above)
+    if(mpClone)
+    {
+        SdrObject::Free(mpClone);
+        mpClone = 0;
+    }
 
-                    // create a new clone and modify to current drag state
-                    if(!mpClone)
-                    {
-                        mpClone = pObj->getFullDragClone();
-                        mpClone->applySpecialDrag(DragStat());
-
-                        // #120999# AutoGrowWidth may change for SdrTextObj due to the automatism used
-                        // with bDisableAutoWidthOnDragging, so not only geometry changes but
-                        // also this (pretty indirect) property change is possible. If it gets
-                        // changed, it needs to be copied to the original since nothing will
-                        // happen when it only changes in the drag clone
-                        const bool bOldAutoGrowWidth(((SdrOnOffItem&)pObj->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue());
-                        const bool bNewAutoGrowWidth(((SdrOnOffItem&)mpClone->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue());
-
-                        if(bOldAutoGrowWidth != bNewAutoGrowWidth)
-                        {
-                            GetDragObj()->SetMergedItem(makeSdrTextAutoGrowWidthItem(bNewAutoGrowWidth));
-                        }
-                    }
+    // create a new clone and modify to current drag state
+    if(!mpClone)
+    {
+        mpClone = pObj->getFullDragClone();
+        mpClone->applySpecialDrag(DragStat());
 
-                    Show();
-                }
-            }
+        // #120999# AutoGrowWidth may change for SdrTextObj due to the automatism used
+        // with bDisableAutoWidthOnDragging, so not only geometry changes but
+        // also this (pretty indirect) property change is possible. If it gets
+        // changed, it needs to be copied to the original since nothing will
+        // happen when it only changes in the drag clone
+        const bool bOldAutoGrowWidth(((SdrOnOffItem&)pObj->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue());
+        const bool bNewAutoGrowWidth(((SdrOnOffItem&)mpClone->GetMergedItem(SDRATTR_TEXT_AUTOGROWWIDTH)).GetValue());
+
+        if(bOldAutoGrowWidth != bNewAutoGrowWidth)
+        {
+            GetDragObj()->SetMergedItem(makeSdrTextAutoGrowWidthItem(bNewAutoGrowWidth));
         }
     }
+
+    Show();
 }
 
 bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)


More information about the Libreoffice-commits mailing list