diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-17 15:19:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-04-20 08:02:25 +0200 |
commit | ec7ba61a6164c805f5a71b077715b7e1521a2d62 (patch) | |
tree | 4d4f3fb1ad960465897754601b0842c78db564bf /sw/source/filter/writer | |
parent | 7d58f26bf4dbeb4e138c2a91f039d8bc7fa00f0c (diff) |
simplify SfxPoolItemArray_Impl (tdf#81765 related)
Since we want to look up items by pointer, just store them in a
std::unordered_set, which allows fast find().
This dramatically simplifies most operations on this data structure.
Fix a dodgy sd test that was relying on items with the same whichid
being in the pool being in a certain order.
Change-Id: I4d79fc718f95e3083a20788be1050fbe9fca7263
Reviewed-on: https://gerrit.libreoffice.org/70881
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/writer')
-rw-r--r-- | sw/source/filter/writer/writer.cxx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index cd4c1f1e56aa..8b5c2406b181 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -409,10 +409,8 @@ void Writer::AddFontItems_( SfxItemPool& rPool, sal_uInt16 nW ) if( nullptr != ( pFont = static_cast<const SvxFontItem*>(rPool.GetPoolDefaultItem( nW ))) ) AddFontItem( rPool, *pFont ); - sal_uInt32 nMaxItem = rPool.GetItemCount2( nW ); - for( sal_uInt32 nGet = 0; nGet < nMaxItem; ++nGet ) - if( nullptr != (pFont = static_cast<const SvxFontItem*>(rPool.GetItem2( nW, nGet ))) ) - AddFontItem( rPool, *pFont ); + for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nW)) + AddFontItem( rPool, *static_cast<const SvxFontItem*>(pItem) ); } void Writer::AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont ) |