summaryrefslogtreecommitdiff
path: root/sw/source/filter/ww8/wrtww8.cxx
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 /sw/source/filter/ww8/wrtww8.cxx
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 'sw/source/filter/ww8/wrtww8.cxx')
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 5b66db607afb..07ba40b373fd 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3086,10 +3086,9 @@ void MSWordExportBase::AddLinkTarget(const OUString& rURL)
void MSWordExportBase::CollectOutlineBookmarks(const SwDoc &rDoc)
{
- sal_uInt32 nMaxItems = rDoc.GetAttrPool().GetItemCount2(RES_TXTATR_INETFMT);
- for (sal_uInt32 n = 0; n < nMaxItems; ++n)
+ for (const SfxPoolItem* pItem : rDoc.GetAttrPool().GetItemSurrogates(RES_TXTATR_INETFMT))
{
- const SwFormatINetFormat* pINetFormat = rDoc.GetAttrPool().GetItem2(RES_TXTATR_INETFMT, n);
+ auto pINetFormat = dynamic_cast<const SwFormatINetFormat*>(pItem);
if (!pINetFormat)
continue;
@@ -3107,10 +3106,9 @@ void MSWordExportBase::CollectOutlineBookmarks(const SwDoc &rDoc)
AddLinkTarget( pINetFormat->GetValue() );
}
- nMaxItems = rDoc.GetAttrPool().GetItemCount2( RES_URL );
- for (sal_uInt32 n = 0; n < nMaxItems; ++n)
+ for (const SfxPoolItem* pItem : rDoc.GetAttrPool().GetItemSurrogates(RES_URL))
{
- const SwFormatURL *pURL = rDoc.GetAttrPool().GetItem2(RES_URL, n);
+ auto pURL = dynamic_cast<const SwFormatURL*>(pItem);
if (!pURL)
continue;