diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-31 08:29:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-12 08:24:04 +0200 |
commit | 51c879d8649c7aad7a0c9be0c7ea042d041254d8 (patch) | |
tree | d454d885be767ba7d113547b1fa91ee85cabcf6a /sd/source/ui/func/fuscale.cxx | |
parent | af66cd6e0809982d61b962fbcf2042981084f770 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/func/fuscale.cxx')
-rw-r--r-- | sd/source/ui/func/fuscale.cxx | 85 |
1 files changed, 41 insertions, 44 deletions
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<AbstractSvxZoomDialog> pDlg(pFact ? pFact->CreateSvxZoomDialog(nullptr, aNewAttr) : nullptr); - if (pDlg) + ScopedVclPtr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(nullptr, aNewAttr) ); + pDlg->SetLimits( static_cast<sal_uInt16>(mpWindow->GetMinZoom()), static_cast<sal_uInt16>(mpWindow->GetMaxZoom()) ); + sal_uInt16 nResult = pDlg->Execute(); + switch( nResult ) { - pDlg->SetLimits( static_cast<sal_uInt16>(mpWindow->GetMinZoom()), static_cast<sal_uInt16>(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)) |