diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-06 11:22:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-06 18:38:22 +0200 |
commit | a7ff945ca031324f060b0d989f7a89594fcfe9fe (patch) | |
tree | ee502330c3e52c59aa2a4c5d97b6307c5a6babe5 /svx | |
parent | 6668b112b341edd24ca77ba88b834108d67b0602 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/imapwnd.cxx | 5 | ||||
-rw-r--r-- | svx/source/dialog/imapwnd.hxx | 2 | ||||
-rw-r--r-- | svx/source/form/fmtextcontrolshell.cxx | 4 | ||||
-rw-r--r-- | svx/source/unodraw/unopool.cxx | 12 |
4 files changed, 11 insertions, 12 deletions
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 6a2c5ef91048..4d979da20849 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -55,14 +55,13 @@ IMapWindow::IMapWindow(const Reference< XFrame >& rxDocumentFrame, weld::Dialog* : GraphCtrl(pDialog) , mxDocumentFrame(rxDocumentFrame) { - pIMapPool = new SfxItemPool( "IMapItemPool", - SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, maItemInfos ); + pIMapPool.reset(new SfxItemPool( "IMapItemPool", + SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, maItemInfos )); pIMapPool->FreezeIdRanges(); } IMapWindow::~IMapWindow() { - SfxItemPool::Free(pIMapPool); } void IMapWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx index 62a49188e2ad..27fe177a9aca 100644 --- a/svx/source/dialog/imapwnd.hxx +++ b/svx/source/dialog/imapwnd.hxx @@ -83,7 +83,7 @@ class IMapWindow final : public GraphCtrl ImageMap aIMap; TargetList aTargetList; Link<IMapWindow&,void> aInfoLink; - SfxItemPool* pIMapPool; + std::unique_ptr<SfxItemPool, SfxItemPoolDeleter> pIMapPool; SfxItemInfo maItemInfos[1] = {}; css::uno::Reference< css::frame::XFrame > mxDocumentFrame; diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 0818e9c7be8a..5d4080928d1b 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -621,7 +621,7 @@ namespace svx if ( !pFontList ) return; - SfxItemPool* pPool = EditEngine::CreatePool(); + std::unique_ptr<SfxItemPool, SfxItemPoolDeleter> pPool(EditEngine::CreatePool()); pPool->FreezeIdRanges(); std::unique_ptr< SfxItemSet > xPureItems( new SfxItemSet( *pPool ) ); @@ -722,7 +722,7 @@ namespace svx xDialog.reset(); xCurrentItems.reset(); xPureItems.reset(); - SfxItemPool::Free(pPool); + pPool.reset(); } diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index 79ca1c1f951e..90addf6e0732 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -57,18 +57,18 @@ SvxUnoDrawPool::~SvxUnoDrawPool() noexcept if (mpDefaultsPool) { SfxItemPool* pOutlPool = mpDefaultsPool->GetSecondaryPool(); - SfxItemPool::Free(mpDefaultsPool); + mpDefaultsPool.reset(); SfxItemPool::Free(pOutlPool); } } void SvxUnoDrawPool::init() { - mpDefaultsPool = new SdrItemPool(); + mpDefaultsPool.reset(new SdrItemPool()); SfxItemPool* pOutlPool=EditEngine::CreatePool(); mpDefaultsPool->SetSecondaryPool(pOutlPool); - SdrModel::SetTextDefaults( mpDefaultsPool, SdrEngineDefaults::GetFontHeight() ); + SdrModel::SetTextDefaults( mpDefaultsPool.get(), SdrEngineDefaults::GetFontHeight() ); mpDefaultsPool->SetDefaultMetric(SdrEngineDefaults::GetMapUnit()); mpDefaultsPool->FreezeIdRanges(); } @@ -82,7 +82,7 @@ SfxItemPool* SvxUnoDrawPool::getModelPool( bool bReadOnly ) noexcept else { if( bReadOnly ) - return mpDefaultsPool; + return mpDefaultsPool.get(); else return nullptr; } @@ -222,7 +222,7 @@ void SvxUnoDrawPool::_getPropertyStates( const comphelper::PropertyMapEntry** pp SfxItemPool* pPool = getModelPool( true ); - if( pPool && pPool != mpDefaultsPool ) + if( pPool && pPool != mpDefaultsPool.get() ) { while( *ppEntries ) { @@ -286,7 +286,7 @@ void SvxUnoDrawPool::_setPropertyToDefault( const comphelper::PropertyMapEntry* // Assure, that ID is a Which-ID (it could be a Slot-ID.) // Thus, convert handle to Which-ID. const sal_uInt16 nWhich = pPool->GetWhich( static_cast<sal_uInt16>(pEntry->mnHandle) ); - if ( pPool && pPool != mpDefaultsPool ) + if ( pPool && pPool != mpDefaultsPool.get() ) { // use method <ResetPoolDefaultItem(..)> instead of using probably incompatible item pool <mpDefaultsPool>. pPool->ResetPoolDefaultItem( nWhich ); |