From a7ff945ca031324f060b0d989f7a89594fcfe9fe Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 6 May 2021 11:22:05 +0200 Subject: add SfxItemPoolDeleter utility add use so we can hold the pool with std::unique_ptr Change-Id: I685fbc37c0ae145a5b48a66a88eab9fb29a0fc0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115174 Tested-by: Jenkins Reviewed-by: Noel Grandin --- reportdesign/source/ui/misc/UITools.cxx | 4 ++-- reportdesign/source/ui/report/ReportController.cxx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'reportdesign/source/ui') diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 1981b229e567..afa270e60664 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -727,7 +727,7 @@ bool openCharDialog( const uno::Reference& _rxRep 0 }; - SfxItemPool* pPool( new SfxItemPool("ReportCharProperties", XATTR_FILL_FIRST,ITEMID_WEIGHT_COMPLEX, aItemInfos, &pDefaults) ); + std::unique_ptr pPool(new SfxItemPool("ReportCharProperties", XATTR_FILL_FIRST,ITEMID_WEIGHT_COMPLEX, aItemInfos, &pDefaults)); // not needed for font height pPool->SetDefaultMetric( MapUnit::Map100thMM ); // ripped, don't understand why pPool->FreezeIdRanges(); // the same bool bSuccess = false; @@ -755,7 +755,7 @@ bool openCharDialog( const uno::Reference& _rxRep DBG_UNHANDLED_EXCEPTION("reportdesign"); } - SfxItemPool::Free(pPool); + pPool.reset(); for (SfxPoolItem* pDefault : pDefaults) delete pDefault; diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 475bef77a29f..6b7f10c377af 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -2369,7 +2369,7 @@ void OReportController::openPageDialog(const uno::Reference& _ SID_ATTR_METRIC,SID_ATTR_METRIC, 0 }; - SfxItemPool* pPool( new SfxItemPool("ReportPageProperties", RPTUI_ID_LRSPACE, RPTUI_ID_METRIC, aItemInfos ) ); + std::unique_ptr pPool( new SfxItemPool("ReportPageProperties", RPTUI_ID_LRSPACE, RPTUI_ID_METRIC, aItemInfos ) ); const Graphic aNullGraphic; const ::Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color @@ -2513,7 +2513,7 @@ void OReportController::openPageDialog(const uno::Reference& _ { DBG_UNHANDLED_EXCEPTION("reportdesign"); } - SfxItemPool::Free(pPool); + pPool.reset(); for (SfxPoolItem* pDefault : pDefaults) delete pDefault; @@ -4218,7 +4218,7 @@ void OReportController::openZoomDialog() SID_ATTR_ZOOM,SID_ATTR_ZOOM, 0 }; - SfxItemPool* pPool( new SfxItemPool("ZoomProperties", SID_ATTR_ZOOM,SID_ATTR_ZOOM, aItemInfos, &pDefaults) ); + std::unique_ptr 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 @@ -4248,7 +4248,7 @@ void OReportController::openZoomDialog() { DBG_UNHANDLED_EXCEPTION("reportdesign"); } - SfxItemPool::Free(pPool); + pPool.reset(); for (SfxPoolItem* pDefault : pDefaults) delete pDefault; -- cgit