diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-05-28 16:53:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-28 17:37:07 +0200 |
commit | 51f46ddaccd9a2c16b6a4a80b7627af7b13850f4 (patch) | |
tree | 18dfa4fd6de107332d847c8b0092f0b7a03479cf | |
parent | bcd27039eec660fce2abd7604cdb8cd36ae4cdba (diff) |
add GetItemState to SfxItemIter, the same way I did to SfxWhichIter
to speed up GetItemState while iterating
Change-Id: Ibe092e7581a5be0160eed52472122afe7e0ef377
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135076
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/controller/itemsetwrapper/ItemConverter.cxx | 2 | ||||
-rw-r--r-- | include/svl/itemiter.hxx | 3 | ||||
-rw-r--r-- | svl/source/items/itemiter.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 2 |
4 files changed, 11 insertions, 2 deletions
diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx index 9ca38f4919e6..d79079b77142 100644 --- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx @@ -157,7 +157,7 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem()) { - if( rItemSet.GetItemState( pItem->Which(), false ) == SfxItemState::SET ) + if( aIter.GetItemState( false ) == SfxItemState::SET ) { if( GetItemProperty( pItem->Which(), aProperty )) { diff --git a/include/svl/itemiter.hxx b/include/svl/itemiter.hxx index be2bf2e4360d..dfe3c9dc6e22 100644 --- a/include/svl/itemiter.hxx +++ b/include/svl/itemiter.hxx @@ -47,6 +47,9 @@ public: sal_uInt16 GetFirstPos() const { return m_nStart; } sal_uInt16 GetLastPos() const { return m_nEnd; } + SfxItemState GetItemState(bool bSrchInParent = true, + const SfxPoolItem** ppItem = nullptr) const; + private: const SfxPoolItem* ImplNextItem(); }; diff --git a/svl/source/items/itemiter.cxx b/svl/source/items/itemiter.cxx index bd5890e07c4a..b1bdedf416e0 100644 --- a/svl/source/items/itemiter.cxx +++ b/svl/source/items/itemiter.cxx @@ -56,4 +56,10 @@ const SfxPoolItem* SfxItemIter::ImplNextItem() return *(ppFnd + m_nCurrent); } +SfxItemState SfxItemIter::GetItemState(bool bSrchInParent, const SfxPoolItem** ppItem) const +{ + sal_uInt16 nWhich = (*(m_rSet.m_ppItems + m_nCurrent))->Which(); + return m_rSet.GetItemStateImpl(nWhich, bSrchInParent, ppItem, m_nCurrent); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 3bc0b76872a2..8fef09eac5e8 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -1877,7 +1877,7 @@ void SwWrtShell::AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyl if(!IsInvalidItem(pParaItem)) { sal_uInt16 nWhich = pParaItem->Which(); - if(SfxItemState::SET == aCoreSet.GetItemState(nWhich) && + if(SfxItemState::SET == aParaIter.GetItemState() && SfxItemState::SET == rStyleSet.GetItemState(nWhich)) { aCoreSet.ClearItem(nWhich); |