From 51c879d8649c7aad7a0c9be0c7ea042d041254d8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 31 May 2018 08:29:01 +0200 Subject: simplify calls to *DialogFactory::Create methods we don't need to check for nullptr here, it's never null. Change-Id: I3cc5337a8f4dec6747821679e39ccba3cec20f56 Reviewed-on: https://gerrit.libreoffice.org/55114 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sd/source/ui/func/fuscale.cxx | 85 +++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 44 deletions(-) (limited to 'sd/source/ui/func/fuscale.cxx') diff --git a/sd/source/ui/func/fuscale.cxx b/sd/source/ui/func/fuscale.cxx index 5b2505985d27..d693fbdacad6 100644 --- a/sd/source/ui/func/fuscale.cxx +++ b/sd/source/ui/func/fuscale.cxx @@ -108,65 +108,62 @@ void FuScale::DoExecute( SfxRequest& rReq ) aNewAttr.Put( *pZoomItem ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - ScopedVclPtr pDlg(pFact ? pFact->CreateSvxZoomDialog(nullptr, aNewAttr) : nullptr); - if (pDlg) + ScopedVclPtr pDlg( pFact->CreateSvxZoomDialog(nullptr, aNewAttr) ); + pDlg->SetLimits( static_cast(mpWindow->GetMinZoom()), static_cast(mpWindow->GetMaxZoom()) ); + sal_uInt16 nResult = pDlg->Execute(); + switch( nResult ) { - pDlg->SetLimits( static_cast(mpWindow->GetMinZoom()), static_cast(mpWindow->GetMaxZoom()) ); - sal_uInt16 nResult = pDlg->Execute(); - switch( nResult ) + case RET_CANCEL: { - case RET_CANCEL: - { - rReq.Ignore (); - return; // Cancel - } - default: - { - rReq.Ignore (); - } - break; + rReq.Ignore (); + return; // Cancel } + default: + { + rReq.Ignore (); + } + break; + } - const SfxItemSet aArgs (*(pDlg->GetOutputItemSet ())); + const SfxItemSet aArgs (*(pDlg->GetOutputItemSet ())); - pDlg.disposeAndClear(); + pDlg.disposeAndClear(); - if (!mpViewShell) - return; + if (!mpViewShell) + return; - switch ( aArgs.Get (SID_ATTR_ZOOM).GetType ()) + switch ( aArgs.Get (SID_ATTR_ZOOM).GetType ()) + { + case SvxZoomType::PERCENT: { - case SvxZoomType::PERCENT: - { - nValue = aArgs.Get (SID_ATTR_ZOOM).GetValue (); + nValue = aArgs.Get (SID_ATTR_ZOOM).GetValue (); - mpViewShell->SetZoom( nValue ); + mpViewShell->SetZoom( nValue ); - mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom ); - } - break; + mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArrayZoom ); + } + break; - case SvxZoomType::OPTIMAL: + case SvxZoomType::OPTIMAL: + { + if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) { - if( dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr ) - { - // name confusion: SID_SIZE_ALL -> zoom onto all objects - // --> the program offers it as optimal - mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); - } + // name confusion: SID_SIZE_ALL -> zoom onto all objects + // --> the program offers it as optimal + mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); } - break; + } + break; - case SvxZoomType::PAGEWIDTH: - mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); - break; + case SvxZoomType::PAGEWIDTH: + mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); + break; - case SvxZoomType::WHOLEPAGE: - mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); - break; - default: - break; - } + case SvxZoomType::WHOLEPAGE: + mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_SIZE_PAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); + break; + default: + break; } } else if(mpViewShell && (pArgs->Count () == 1)) -- cgit