summaryrefslogtreecommitdiff
path: root/sd/source/ui
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-04-17 15:19:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-04-20 08:02:25 +0200
commitec7ba61a6164c805f5a71b077715b7e1521a2d62 (patch)
tree4d4f3fb1ad960465897754601b0842c78db564bf /sd/source/ui
parent7d58f26bf4dbeb4e138c2a91f039d8bc7fa00f0c (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 'sd/source/ui')
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 7f61d8bef8ba..ed83fd956bec 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1370,7 +1370,6 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property
EE_CHAR_FONTINFO_CTL };
const SfxItemPool& rPool = mpDoc->GetPool();
- const SfxPoolItem* pItem;
for(sal_uInt16 nWhichId : aWhichIds)
{
@@ -1378,18 +1377,15 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property
aSeq.realloc( aSeq.getLength() + nItems*5 + 5 );
- for( sal_uInt32 j = 0; j < nItems; ++j )
+ for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nWhichId))
{
- if( nullptr != (pItem = rPool.GetItem2( nWhichId, j ) ) )
- {
- const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
+ const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
- aSeq[nSeqIndex++] <<= pFont->GetFamilyName();
- aSeq[nSeqIndex++] <<= pFont->GetStyleName();
- aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetFamily());
- aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetPitch());
- aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetCharSet());
- }
+ aSeq[nSeqIndex++] <<= pFont->GetFamilyName();
+ aSeq[nSeqIndex++] <<= pFont->GetStyleName();
+ aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetFamily());
+ aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetPitch());
+ aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetCharSet());
}
const SvxFontItem& rFont = static_cast<const SvxFontItem&>(rPool.GetDefaultItem( nWhichId ));