summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-05-28 17:05:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-28 19:31:20 +0200
commit1cfa3f8694d4b585549e6dae7396d408184106cb (patch)
treef92eaaec1edf86f8f4b673884f022af7d74c844f /svl
parentcaf862fc843c89cceae2121f743a3822e09bbd46 (diff)
simplify SfxItemSet::Differentiate and SfxItemSet::Intersect
using SfxWhichIter instead of SfxItemIter Change-Id: I046ae2cec9246b1dea9c484f94b88d64825f952c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135077 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/itemset.cxx29
1 files changed, 11 insertions, 18 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 842bc2d16623..e0e1ee8823a3 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -887,17 +887,14 @@ void SfxItemSet::Intersect( const SfxItemSet& rSet )
}
else
{
- SfxItemIter aIter( *this );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- do
+ SfxWhichIter aIter( *this );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while ( nWhich )
{
- sal_uInt16 nWhich = IsInvalidItem( pItem )
- ? GetWhichByPos( aIter.GetCurPos() )
- : pItem->Which();
if( SfxItemState::UNKNOWN == rSet.GetItemState( nWhich, false ) )
- ClearItem( nWhich ); // Delete
- pItem = aIter.NextItem();
- } while (pItem);
+ ClearItem( nWhich ); // Delete
+ nWhich = aIter.NextWhich();
+ }
}
}
@@ -936,18 +933,14 @@ void SfxItemSet::Differentiate( const SfxItemSet& rSet )
}
else
{
- SfxItemIter aIter( *this );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- do
+ SfxWhichIter aIter( *this );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while ( nWhich )
{
- sal_uInt16 nWhich = IsInvalidItem( pItem )
- ? GetWhichByPos( aIter.GetCurPos() )
- : pItem->Which();
if( SfxItemState::SET == rSet.GetItemState( nWhich, false ) )
ClearItem( nWhich ); // Delete
- pItem = aIter.NextItem();
- } while (pItem);
-
+ nWhich = aIter.NextWhich();
+ }
}
}