diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-07-27 15:39:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-07-29 15:10:19 +0200 |
commit | c39978f41dccbeb2e973c919a67d9b1d974f8f3c (patch) | |
tree | 1a688fd28ac0f97d3afd742de382bf79937790b4 /sd/source | |
parent | 8f008bf4b968f219d2fe97ef8175ef6be0555943 (diff) |
tdf#161846 use unordered_map in SfxItemPropertyMap
with large property maps, even a binary search starts
showing up, but we can do a O(1) search here by using a map
Change-Id: Ie7916076073e6dd393f0a1fb5a0db1b973999408
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171173
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/core/stlsheet.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.hxx | 2 |
4 files changed, 7 insertions, 5 deletions
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 885ea80c5dce..4c61c8d72b1c 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -1502,7 +1502,7 @@ Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) } /** this is used because our property map is not sorted yet */ -const SfxItemPropertyMapEntry* SdStyleSheet::getPropertyMapEntry( std::u16string_view rPropertyName ) +const SfxItemPropertyMapEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName ) { return GetStylePropertySet().getPropertyMapEntry(rPropertyName); } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 931ed7b5656e..d5a3056b5499 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2831,8 +2831,9 @@ void SdMasterPage::setBackground( const Any& rValue ) Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_SET_THROW ); Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY ); - for( const auto pProp : ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries() ) + for( const auto & rPair : ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries() ) { + const SfxItemPropertyMapEntry* pProp = rPair.second; const OUString& rPropName = pProp->aName; if( xSetInfo->hasPropertyByName( rPropName ) ) { diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index 95e01bbaa984..278ed2abd4ee 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -97,8 +97,9 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) if( maUsrAnys.AreThereOwnUsrAnys() ) { - for( const auto pProp : mpPropSet->getPropertyMap().getPropertyEntries() ) + for( const auto & rPair : mpPropSet->getPropertyMap().getPropertyEntries() ) { + const SfxItemPropertyMapEntry* pProp = rPair.second; uno::Any* pAny = maUsrAnys.GetUsrAnyForID( *pProp ); if( pAny ) { @@ -399,7 +400,7 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aProp } /** this is used because our property map is not sorted yet */ -const SfxItemPropertyMapEntry* SdUnoPageBackground::getPropertyMapEntry( std::u16string_view rPropertyName ) const noexcept +const SfxItemPropertyMapEntry* SdUnoPageBackground::getPropertyMapEntry( const OUString& rPropertyName ) const noexcept { return mpPropSet->getPropertyMap().getByName(rPropertyName); } diff --git a/sd/source/ui/unoidl/unopback.hxx b/sd/source/ui/unoidl/unopback.hxx index c2834d9298ee..59b4b73bba67 100644 --- a/sd/source/ui/unoidl/unopback.hxx +++ b/sd/source/ui/unoidl/unopback.hxx @@ -51,7 +51,7 @@ class SdUnoPageBackground final : public ::cppu::WeakImplHelper< std::unique_ptr<SfxItemSet> mpSet; SdrModel* mpDoc; - const SfxItemPropertyMapEntry* getPropertyMapEntry( std::u16string_view rPropertyName ) const noexcept; + const SfxItemPropertyMapEntry* getPropertyMapEntry( const OUString& rPropertyName ) const noexcept; public: SdUnoPageBackground( SdDrawDocument* pDoc = nullptr, const SfxItemSet* pSet = nullptr); virtual ~SdUnoPageBackground() noexcept override; |