summaryrefslogtreecommitdiff
path: root/chart2/source/view/main/ChartItemPool.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-05 10:54:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-07 21:51:32 +0200
commit2ed8c34bca56c1a30d727b21d9096cb77e88197a (patch)
tree4eb83db9bd66a6719ed88df70a123993ce246306 /chart2/source/view/main/ChartItemPool.cxx
parentea67083cf5b8bceeab7d521663c768b59dd49d1d (diff)
use a single global item pool for chart2 draw model
which exposed a bug in SvxUnoNameItemTable::replaceByName Change-Id: If3207df6d46a2185b78ea5c3e1c145527b42d7cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115126 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/view/main/ChartItemPool.cxx')
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx35
1 files changed, 33 insertions, 2 deletions
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index 8b5bade3ebc3..2b3e59dc3c31 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -21,8 +21,13 @@
#include <chartview/ChartSfxItemIds.hxx>
#include <svx/chrtitem.hxx>
#include <svx/sdangitm.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdpool.hxx>
+#include <svx/svx3ditems.hxx>
#include <svl/intitem.hxx>
+#include <editeng/editeng.hxx>
#include <editeng/brushitem.hxx>
+#include <editeng/eeitem.hxx>
#include <editeng/sizeitem.hxx>
#include <svl/stritem.hxx>
#include <svl/ilstitem.hxx>
@@ -209,9 +214,35 @@ MapUnit ChartItemPool::GetMetric(sal_uInt16 /* nWhich */) const
return MapUnit::Map100thMM;
}
-SfxItemPool* ChartItemPool::CreateChartItemPool()
+namespace {
+struct PoolDeleter
{
- return new ChartItemPool();
+ void operator()(SfxItemPool* pPool)
+ {
+ SfxItemPool::Free(pPool);
+ }
+};
+}
+static std::unique_ptr<SfxItemPool, PoolDeleter> g_Pool1, g_Pool2, g_Pool3;
+
+SfxItemPool& ChartItemPool::GetGlobalChartItemPool()
+{
+ if (!g_Pool1)
+ {
+ // similar logic to SdrModel's pool, but with our chart pool tagged on the end
+ g_Pool1.reset(new SdrItemPool(nullptr));
+ g_Pool2.reset(EditEngine::CreatePool());
+ g_Pool3.reset(new ChartItemPool());
+ g_Pool1->SetSecondaryPool(g_Pool2.get());
+
+ g_Pool1->SetDefaultMetric(MapUnit::Map100thMM);
+ g_Pool1->SetPoolDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, true) );
+ g_Pool1->SetPoolDefaultItem(makeSvx3DPercentDiagonalItem (5));
+
+ g_Pool2->SetSecondaryPool(g_Pool3.get());
+ g_Pool1->FreezeIdRanges();
+ }
+ return *g_Pool1;
}
} // namespace chart