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 /reportdesign | |
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 'reportdesign')
-rw-r--r-- | reportdesign/source/ui/report/ReportController.cxx | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index fba084130f4c..7f19e49543a7 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -4172,56 +4172,54 @@ OSectionWindow* OReportController::getSectionWindow(const css::uno::Reference< c void OReportController::openZoomDialog() { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - if ( pFact ) - { - static SfxItemInfo aItemInfos[] = - { - { SID_ATTR_ZOOM, true } - }; - std::vector<SfxPoolItem*> pDefaults - { - new SvxZoomItem() - }; - static const sal_uInt16 pRanges[] = - { - SID_ATTR_ZOOM,SID_ATTR_ZOOM, - 0 - }; - SfxItemPool* pPool( new SfxItemPool("ZoomProperties", SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, &pDefaults) ); - pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why - pPool->FreezeIdRanges(); // the same - try - { - ::std::unique_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges)); - // fill it - SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM ); - aZoomItem.SetValueSet(SvxZoomEnableFlags::N100|SvxZoomEnableFlags::WHOLEPAGE|SvxZoomEnableFlags::PAGEWIDTH); - pDescriptor->Put(aZoomItem); - ScopedVclPtr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(nullptr, *pDescriptor.get()) ); - pDlg->SetLimits( 20, 400 ); - bool bCancel = ( RET_CANCEL == pDlg->Execute() ); + static SfxItemInfo aItemInfos[] = + { + { SID_ATTR_ZOOM, true } + }; + std::vector<SfxPoolItem*> pDefaults + { + new SvxZoomItem() + }; + static const sal_uInt16 pRanges[] = + { + SID_ATTR_ZOOM,SID_ATTR_ZOOM, + 0 + }; + SfxItemPool* pPool( new SfxItemPool("ZoomProperties", SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, &pDefaults) ); + pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why + pPool->FreezeIdRanges(); // the same + try + { + ::std::unique_ptr<SfxItemSet> pDescriptor(new SfxItemSet(*pPool, pRanges)); + // fill it + SvxZoomItem aZoomItem( m_eZoomType, m_nZoomValue, SID_ATTR_ZOOM ); + aZoomItem.SetValueSet(SvxZoomEnableFlags::N100|SvxZoomEnableFlags::WHOLEPAGE|SvxZoomEnableFlags::PAGEWIDTH); + pDescriptor->Put(aZoomItem); - if ( !bCancel ) - { - const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->Get( SID_ATTR_ZOOM ); - m_eZoomType = rZoomItem.GetType(); - m_nZoomValue = rZoomItem.GetValue(); - if ( m_eZoomType != SvxZoomType::PERCENT ) - m_nZoomValue = getDesignView()->getZoomFactor( m_eZoomType ); + ScopedVclPtr<AbstractSvxZoomDialog> pDlg( pFact->CreateSvxZoomDialog(nullptr, *pDescriptor.get()) ); + pDlg->SetLimits( 20, 400 ); + bool bCancel = ( RET_CANCEL == pDlg->Execute() ); - impl_zoom_nothrow(); - } - } - catch(const uno::Exception&) + if ( !bCancel ) { - DBG_UNHANDLED_EXCEPTION("reportdesign"); - } - SfxItemPool::Free(pPool); + const SvxZoomItem& rZoomItem = pDlg->GetOutputItemSet()->Get( SID_ATTR_ZOOM ); + m_eZoomType = rZoomItem.GetType(); + m_nZoomValue = rZoomItem.GetValue(); + if ( m_eZoomType != SvxZoomType::PERCENT ) + m_nZoomValue = getDesignView()->getZoomFactor( m_eZoomType ); - for (SfxPoolItem* pDefault : pDefaults) - delete pDefault; + impl_zoom_nothrow(); + } + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); } + SfxItemPool::Free(pPool); + + for (SfxPoolItem* pDefault : pDefaults) + delete pDefault; } |