From 6c934d0feb6a391fda0939e8db5d12aafeb93cc6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 12 Apr 2021 09:21:42 +0200 Subject: store ptr to the original entries in SfxItemPropertyMap instead of copying them to a new data structure that is practically identical. Helps startup time since we build a ton of these when loading documents. And use o3tl::sorted_vector as a dense map data structure to reduce allocations and improve cache friendliness, since this is a build-once thing. Change-Id: I950be03b1a21c0c81c40f2677d4215f5e8e256cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114015 Tested-by: Jenkins Reviewed-by: Noel Grandin --- reportdesign/source/ui/misc/UITools.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'reportdesign/source') diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 14262558618c..1981b229e567 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -276,15 +276,15 @@ namespace uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); SvxUnoPropertyMapProvider aMap; const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - for (const auto& rProp : rPropertyMap.getPropertyEntries()) + for (const auto pProp : rPropertyMap.getPropertyEntries()) { - if ( xInfo->hasPropertyByName(OUString(rProp.first)) ) + if ( xInfo->hasPropertyByName(pProp->aName) ) { - const SfxPoolItem* pItem = _rItemSet.GetItem(rProp.second.nWID); + const SfxPoolItem* pItem = _rItemSet.GetItem(pProp->nWID); if ( pItem ) { - ::std::unique_ptr pClone(pItem->CloneSetWhich(rProp.second.nWID)); - pClone->PutValue(_xShape->getPropertyValue(OUString(rProp.first)), rProp.second.nMemberId); + ::std::unique_ptr pClone(pItem->CloneSetWhich(pProp->nWID)); + pClone->PutValue(_xShape->getPropertyValue(pProp->aName), pProp->nMemberId); _rItemSet.Put(std::move(pClone)); } } @@ -296,20 +296,20 @@ namespace const uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); SvxUnoPropertyMapProvider aMap; const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - for (const auto& rProp : rPropertyMap.getPropertyEntries()) + for (const auto pProp : rPropertyMap.getPropertyEntries()) { - if ( SfxItemState::SET == _rItemSet.GetItemState(rProp.second.nWID) && xInfo->hasPropertyByName(OUString(rProp.first)) ) + if ( SfxItemState::SET == _rItemSet.GetItemState(pProp->nWID) && xInfo->hasPropertyByName(pProp->aName) ) { - if ( ( rProp.second.nFlags & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY ) + if ( ( pProp->nFlags & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY ) { - const SfxPoolItem* pItem = _rItemSet.GetItem(rProp.second.nWID); + const SfxPoolItem* pItem = _rItemSet.GetItem(pProp->nWID); if ( pItem ) { uno::Any aValue; - pItem->QueryValue(aValue,rProp.second.nMemberId); + pItem->QueryValue(aValue, pProp->nMemberId); try { - _xShape->setPropertyValue(OUString(rProp.first), aValue); + _xShape->setPropertyValue(pProp->aName, aValue); } catch(uno::Exception&) { // shapes have a bug so we ignore this one. -- cgit