summaryrefslogtreecommitdiff
path: root/svl/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-06-20 14:11:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-06-20 16:20:35 +0200
commit1be12e6d298a1e22871cdb9eecb7b6440b0d1d88 (patch)
tree0f2c7edeba7093e8e01ca1aa236a3293f5571497 /svl/source
parent2ab4c442a57686eae47a9d9f06d3662544aa591b (diff)
tdf#144208 speedup doc with lots of redline(13)
Add a custom method to SfxItemSet, to avoid some of the function calling overhead in a hot loop Change-Id: I525c9a696af941c6e39aa1677eb2a85f69c621bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169271 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'svl/source')
-rw-r--r--svl/source/items/itemset.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 251194194d11..b3a6dd8f68cf 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -929,6 +929,31 @@ bool SfxItemSet::HasItem(sal_uInt16 nWhich, const SfxPoolItem** ppItem) const
return bRet;
}
+void SfxItemSet::CollectHasItems(std::vector<sal_uInt16>& rItemWhichs) const
+{
+ for(auto const & rPair : m_aWhichRanges)
+ {
+ const sal_uInt16 nBeg = rPair.first;
+ const sal_uInt16 nEnd = rPair.second;
+ for( sal_uInt16 nWhich = nBeg; nWhich <= nEnd; ++nWhich )
+ {
+ bool bHasItem = false;
+ auto aHit(m_aPoolItemMap.find(nWhich));
+ if (aHit != m_aPoolItemMap.end())
+ {
+ bHasItem = !IsInvalidItem(aHit->second) && !IsDisabledItem(aHit->second);
+ }
+ else
+ {
+ if (m_pParent)
+ bHasItem = SfxItemState::SET == m_pParent->GetItemState_ForWhichID( SfxItemState::DEFAULT, nWhich, true, nullptr);
+ }
+ if (bHasItem)
+ rItemWhichs.push_back( nWhich );
+ }
+ }
+}
+
const SfxPoolItem* SfxItemSet::PutImplAsTargetWhich(const SfxPoolItem& rItem, sal_uInt16 nTargetWhich, bool bPassingOwnership)
{
if (0 == nTargetWhich || nTargetWhich == rItem.Which())