summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-05-07 19:00:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-07 20:19:32 +0200
commit13ce37a85ac73a88567c2066fac694e4fc02a6f8 (patch)
treeabeb41482ad967af75ea0c156a2ed0267f0fee2e
parenta2729787d9bf29f9c5c05137fe016407ab596b92 (diff)
add utility method to get last pool in chain
Change-Id: If21defdf1b59219e3b81d803423713972412da7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115244 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/view/main/DrawModelWrapper.cxx11
-rw-r--r--include/svl/itempool.hxx2
-rw-r--r--svl/source/items/itempool.cxx9
-rw-r--r--svx/source/xoutdev/xpool.cxx9
4 files changed, 13 insertions, 18 deletions
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx
index 14bd6b55cfcb..916087e6c69a 100644
--- a/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -62,17 +62,8 @@ DrawModelWrapper::DrawModelWrapper()
pMasterPool->SetPoolDefaultItem(SfxBoolItem(EE_PARA_HYPHENATE, true) );
pMasterPool->SetPoolDefaultItem(makeSvx3DPercentDiagonalItem (5));
- SfxItemPool* pPool = pMasterPool;
// append chart pool to end of pool chain
- for (;;)
- {
- SfxItemPool* pSecondary = pPool->GetSecondaryPool();
- if (!pSecondary)
- break;
-
- pPool = pSecondary;
- }
- pPool->SetSecondaryPool(m_pChartItemPool);
+ pMasterPool->GetLastPoolInChain()->SetSecondaryPool(m_pChartItemPool);
pMasterPool->FreezeIdRanges();
SetTextDefaults();
diff --git a/include/svl/itempool.hxx b/include/svl/itempool.hxx
index 12e525722d6a..baab6da1a3d7 100644
--- a/include/svl/itempool.hxx
+++ b/include/svl/itempool.hxx
@@ -184,6 +184,8 @@ public:
bool IsInRange( sal_uInt16 nWhich ) const;
void SetSecondaryPool( SfxItemPool *pPool );
SfxItemPool* GetSecondaryPool() const;
+ /* get the last pool by following the GetSecondaryPool chain */
+ SfxItemPool* GetLastPoolInChain();
SfxItemPool* GetMasterPool() const;
void FreezeIdRanges();
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 1d84ab00a115..24fda80d1bfe 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -773,6 +773,15 @@ SfxItemPool* SfxItemPool::GetSecondaryPool() const
return pImpl->mpSecondary;
}
+/* get the last pool by following the GetSecondaryPool chain */
+SfxItemPool* SfxItemPool::GetLastPoolInChain()
+{
+ SfxItemPool* pLast = this;
+ while(pLast->GetSecondaryPool())
+ pLast = pLast->GetSecondaryPool();
+ return pLast;
+}
+
SfxItemPool* SfxItemPool::GetMasterPool() const
{
return pImpl->mpMaster;
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx
index 997c6b576f36..be56e4fd7a14 100644
--- a/svx/source/xoutdev/xpool.cxx
+++ b/svx/source/xoutdev/xpool.cxx
@@ -88,14 +88,7 @@ XOutdevItemPool::XOutdevItemPool(SfxItemPool* _pMaster)
}
else
{
- SfxItemPool* pParent = _pMaster;
-
- while(pParent->GetSecondaryPool())
- {
- pParent = pParent->GetSecondaryPool();
- }
-
- pParent->SetSecondaryPool(this);
+ _pMaster->GetLastPoolInChain()->SetSecondaryPool(this);
}
// prepare PoolDefaults