From fe23e35ba5705d7f51f69c3f4e7ccd6c5b575a6b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 12 Apr 2021 13:07:56 +0200 Subject: less copying in SfxItemPropertyMap::getPropertyEntries we can just expose the map now, and avoid copying all the properties Change-Id: Icb22975508582268dfa96e41eb98ac01e7f51317 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113982 Tested-by: Jenkins Reviewed-by: Noel Grandin --- reportdesign/source/ui/misc/UITools.cxx | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'reportdesign/source') diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 92785547d4d3..14262558618c 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -276,16 +276,15 @@ namespace uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); SvxUnoPropertyMapProvider aMap; const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - PropertyEntryVector_t aPropVector = rPropertyMap.getPropertyEntries(); - for (const auto& rProp : aPropVector) + for (const auto& rProp : rPropertyMap.getPropertyEntries()) { - if ( xInfo->hasPropertyByName(rProp.sName) ) + if ( xInfo->hasPropertyByName(OUString(rProp.first)) ) { - const SfxPoolItem* pItem = _rItemSet.GetItem(rProp.nWID); + const SfxPoolItem* pItem = _rItemSet.GetItem(rProp.second.nWID); if ( pItem ) { - ::std::unique_ptr pClone(pItem->CloneSetWhich(rProp.nWID)); - pClone->PutValue(_xShape->getPropertyValue(rProp.sName), rProp.nMemberId); + ::std::unique_ptr pClone(pItem->CloneSetWhich(rProp.second.nWID)); + pClone->PutValue(_xShape->getPropertyValue(OUString(rProp.first)), rProp.second.nMemberId); _rItemSet.Put(std::move(pClone)); } } @@ -297,21 +296,20 @@ namespace const uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); SvxUnoPropertyMapProvider aMap; const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - PropertyEntryVector_t aPropVector = rPropertyMap.getPropertyEntries(); - for (const auto& rProp : aPropVector) + for (const auto& rProp : rPropertyMap.getPropertyEntries()) { - if ( SfxItemState::SET == _rItemSet.GetItemState(rProp.nWID) && xInfo->hasPropertyByName(rProp.sName) ) + if ( SfxItemState::SET == _rItemSet.GetItemState(rProp.second.nWID) && xInfo->hasPropertyByName(OUString(rProp.first)) ) { - if ( ( rProp.nFlags & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY ) + if ( ( rProp.second.nFlags & beans::PropertyAttribute::READONLY ) != beans::PropertyAttribute::READONLY ) { - const SfxPoolItem* pItem = _rItemSet.GetItem(rProp.nWID); + const SfxPoolItem* pItem = _rItemSet.GetItem(rProp.second.nWID); if ( pItem ) { uno::Any aValue; - pItem->QueryValue(aValue,rProp.nMemberId); + pItem->QueryValue(aValue,rProp.second.nMemberId); try { - _xShape->setPropertyValue(rProp.sName, aValue); + _xShape->setPropertyValue(OUString(rProp.first), aValue); } catch(uno::Exception&) { // shapes have a bug so we ignore this one. -- cgit