summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/svl/itempool.hxx13
-rw-r--r--include/svx/unopool.hxx3
2 files changed, 12 insertions, 4 deletions
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
index 10dbd3252c9e..12e525722d6a 100644
--- a/include/svl/itempool.hxx
+++ b/include/svl/itempool.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_SVL_ITEMPOOL_HXX
-#define INCLUDED_SVL_ITEMPOOL_HXX
+#pragma once
#include <svl/poolitem.hxx>
#include <svl/svldllapi.h>
@@ -233,6 +232,14 @@ inline sal_uInt32 SfxItemPool::ReleaseRef(const SfxPoolItem& rItem, sal_uInt32 n
return rItem.ReleaseRef(n);
}
-#endif
+// Utility class for using SfxItemPool with std::unique_ptr
+struct SfxItemPoolDeleter
+{
+ void operator()(SfxItemPool* pPool)
+ {
+ SfxItemPool::Free(pPool);
+ }
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/unopool.hxx b/include/svx/unopool.hxx
index ff6c83472b98..d7736c36f7c2 100644
--- a/include/svx/unopool.hxx
+++ b/include/svx/unopool.hxx
@@ -25,6 +25,7 @@
#include <comphelper/propertysethelper.hxx>
#include <cppuhelper/weakagg.hxx>
#include <svx/svxdllapi.h>
+#include <svl/itempool.hxx>
class SdrModel;
class SfxItemPool;
@@ -89,7 +90,7 @@ protected:
protected:
SdrModel* mpModel;
- SfxItemPool* mpDefaultsPool;
+ std::unique_ptr<SfxItemPool, SfxItemPoolDeleter> mpDefaultsPool;
};
#endif