[Libreoffice-commits] .: sd/source

Caolán McNamara caolan at kemper.freedesktop.org
Tue Jan 18 06:56:31 PST 2011


 sd/source/ui/func/fusnapln.cxx |   81 ++++++++++++++++++++---------------------
 1 file changed, 41 insertions(+), 40 deletions(-)

New commits:
commit 1f5cdbb1413c6babb8527d5ffe46778bda109b73
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 18 14:56:26 2011 +0000

    early return on failed AbstractDialog

diff --git a/sd/source/ui/func/fusnapln.cxx b/sd/source/ui/func/fusnapln.cxx
index ad957c1..cef5fba 100644
--- a/sd/source/ui/func/fusnapln.cxx
+++ b/sd/source/ui/func/fusnapln.cxx
@@ -88,7 +88,7 @@ void FuSnapLine::DoExecute( SfxRequest& rReq )
     
     SdrPageView* pPV = mpView->GetSdrPageView();
 
-    if ( !pArgs )
+    if (!pArgs)
     {
         SfxItemSet aNewAttr(mpViewShell->GetPool(), ATTR_SNAPLINE_START, ATTR_SNAPLINE_END);
         bool bLineExist (false);
@@ -130,53 +130,54 @@ void FuSnapLine::DoExecute( SfxRequest& rReq )
 
         SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
         AbstractSdSnapLineDlg* pDlg = pFact ? pFact->CreateSdSnapLineDlg( NULL, aNewAttr, mpView ) : 0;
-        if( pDlg )
+        OSL_ASSERT(pDlg);
+        if (!pDlg)
+            return;
+
+        if ( bLineExist )
         {
-            if ( bLineExist )
-            {
-                pDlg->HideRadioGroup();
+            pDlg->HideRadioGroup();
 
-                const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
+            const SdrHelpLine& rHelpLine = (pPV->GetHelpLines())[nHelpLine];
 
-                if ( rHelpLine.GetKind() == SDRHELPLINE_POINT )
-                {
-                    pDlg->SetText(String(SdResId(STR_SNAPDLG_SETPOINT)));
-                    pDlg->SetInputFields(TRUE, TRUE);
-                }
-                else
-                {
-                    pDlg->SetText(String(SdResId(STR_SNAPDLG_SETLINE)));
-
-                    if ( rHelpLine.GetKind() == SDRHELPLINE_VERTICAL )
-                        pDlg->SetInputFields(TRUE, FALSE);
-                    else
-                        pDlg->SetInputFields(FALSE, TRUE);
-                }
-                bCreateNew = FALSE;
+            if ( rHelpLine.GetKind() == SDRHELPLINE_POINT )
+            {
+                pDlg->SetText(String(SdResId(STR_SNAPDLG_SETPOINT)));
+                pDlg->SetInputFields(TRUE, TRUE);
             }
             else
-                pDlg->HideDeleteBtn();
+            {
+                pDlg->SetText(String(SdResId(STR_SNAPDLG_SETLINE)));
 
-            USHORT nResult = pDlg->Execute();
+                if ( rHelpLine.GetKind() == SDRHELPLINE_VERTICAL )
+                    pDlg->SetInputFields(TRUE, FALSE);
+                else
+                    pDlg->SetInputFields(FALSE, TRUE);
+            }
+            bCreateNew = FALSE;
+        }
+        else
+            pDlg->HideDeleteBtn();
 
-            pDlg->GetAttr(aNewAttr);
-            delete pDlg;
+        USHORT nResult = pDlg->Execute();
 
-            switch( nResult )
-            {
-                case RET_OK:
-                    rReq.Done(aNewAttr);
-                    pArgs = rReq.GetArgs();
-                    break;
-
-                case RET_SNAP_DELETE:
-                    // Fangobjekt loeschen
-                    if ( !bCreateNew )
-                        pPV->DeleteHelpLine(nHelpLine);
-                    /*fall-through*/
-                default:
-                    return;
-            }
+        pDlg->GetAttr(aNewAttr);
+        delete pDlg;
+
+        switch( nResult )
+        {
+            case RET_OK:
+                rReq.Done(aNewAttr);
+                pArgs = rReq.GetArgs();
+                break;
+
+            case RET_SNAP_DELETE:
+                // Fangobjekt loeschen
+                if ( !bCreateNew )
+                    pPV->DeleteHelpLine(nHelpLine);
+                /*fall-through*/
+            default:
+                return;
         }
     }
     Point aHlpPos;


More information about the Libreoffice-commits mailing list