summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore/unostyle.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-04-12 13:07:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-12 17:45:19 +0200
commitfe23e35ba5705d7f51f69c3f4e7ccd6c5b575a6b (patch)
treebace053173689b600f8b6a75145e07cc2b933743 /sw/source/core/unocore/unostyle.cxx
parent27911b0455d8dcc08a0702372492a6ce00250cb7 (diff)
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/unocore/unostyle.cxx')
-rw-r--r--sw/source/core/unocore/unostyle.cxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 9c0e9d5ff968..3c70dc9eaa93 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1138,17 +1138,16 @@ namespace {
class SwStyleProperties_Impl
{
- const PropertyEntryVector_t aPropertyEntries;
+ const SfxItemPropertyMap& mrMap;
std::map<OUString, uno::Any> m_vPropertyValues;
public:
explicit SwStyleProperties_Impl(const SfxItemPropertyMap& rMap)
- : aPropertyEntries(rMap.getPropertyEntries())
+ : mrMap(rMap)
{ }
- bool AllowsKey(const OUString& rName)
+ bool AllowsKey(std::u16string_view rName)
{
- return std::any_of(aPropertyEntries.begin(), aPropertyEntries.end(),
- [rName] (const SfxItemPropertyNamedEntry& rEntry) {return rName == rEntry.sName;} );
+ return mrMap.hasPropertyByName(rName);
}
bool SetProperty(const OUString& rName, const uno::Any& rValue)
{
@@ -4269,7 +4268,6 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties()
const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap();
- PropertyEntryVector_t aPropVector = rMap.getPropertyEntries();
SfxItemSet& rSet = *mpSet;
SfxItemIter aIter(rSet);
@@ -4280,13 +4278,13 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties()
// TODO: Optimize - and fix! the old iteration filled each WhichId
// only once but there are more properties than WhichIds
- for( const auto& rProp : aPropVector )
+ for( const auto& rPair : rMap.getPropertyEntries() )
{
- if ( rProp.nWID == nWID )
+ if ( rPair.second.nWID == nWID )
{
beans::PropertyValue aPropertyValue;
- aPropertyValue.Name = rProp.sName;
- pItem->QueryValue( aPropertyValue.Value, rProp.nMemberId );
+ aPropertyValue.Name = rPair.first;
+ pItem->QueryValue( aPropertyValue.Value, rPair.second.nMemberId );
aPropertyVector.push_back( aPropertyValue );
}
}