diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-01-18 14:56:26 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-01-18 14:56:26 +0000 |
commit | db58382068e773c913e56ba8dc35543e6c78f129 (patch) | |
tree | b4e19d8e1ea459ac4b7f4b30f1c5f86fa20f7a49 /sd | |
parent | a485dfc5f2103dcf33fba796b6f6681aa95fff5c (diff) |
early return on failed AbstractDialog
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/func/fusnapln.cxx | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/sd/source/ui/func/fusnapln.cxx b/sd/source/ui/func/fusnapln.cxx index b6cbe2cc3bbc..015e72193d7e 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; |