summaryrefslogtreecommitdiff
path: root/sc/source/core/data
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-06 11:22:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-06 18:38:22 +0200
commita7ff945ca031324f060b0d989f7a89594fcfe9fe (patch)
treeee502330c3e52c59aa2a4c5d97b6307c5a6babe5 /sc/source/core/data
parent6668b112b341edd24ca77ba88b834108d67b0602 (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 'sc/source/core/data')
-rw-r--r--sc/source/core/data/poolhelp.cxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx
index 37b64c622d19..2091bf167d9c 100644
--- a/sc/source/core/data/poolhelp.cxx
+++ b/sc/source/core/data/poolhelp.cxx
@@ -27,11 +27,9 @@
#include <stlpool.hxx>
ScPoolHelper::ScPoolHelper( ScDocument& rSourceDoc )
- : pEditPool(nullptr)
- , pEnginePool(nullptr)
+ : pDocPool(new ScDocumentPool)
, m_rSourceDoc(rSourceDoc)
{
- pDocPool = new ScDocumentPool;
pDocPool->FreezeIdRanges();
mxStylePool = new ScStyleSheetPool( *pDocPool, &rSourceDoc );
@@ -39,31 +37,31 @@ ScPoolHelper::ScPoolHelper( ScDocument& rSourceDoc )
ScPoolHelper::~ScPoolHelper()
{
- SfxItemPool::Free(pEnginePool);
- SfxItemPool::Free(pEditPool);
+ pEnginePool.reset();
+ pEditPool.reset();
pFormTable.reset();
mxStylePool.clear();
- SfxItemPool::Free(pDocPool);
+ pDocPool.reset();
}
SfxItemPool* ScPoolHelper::GetEditPool() const
{
if ( !pEditPool )
{
- pEditPool = EditEngine::CreatePool();
+ pEditPool.reset(EditEngine::CreatePool());
pEditPool->SetDefaultMetric( MapUnit::Map100thMM );
pEditPool->FreezeIdRanges();
}
- return pEditPool;
+ return pEditPool.get();
}
SfxItemPool* ScPoolHelper::GetEnginePool() const
{
if ( !pEnginePool )
{
- pEnginePool = EditEngine::CreatePool();
+ pEnginePool.reset(EditEngine::CreatePool());
pEnginePool->SetDefaultMetric( MapUnit::Map100thMM );
pEnginePool->FreezeIdRanges();
} // ifg ( pEnginePool )
- return pEnginePool;
+ return pEnginePool.get();
}
SvNumberFormatter* ScPoolHelper::GetFormTable() const
{