diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-04-12 09:21:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-15 15:53:25 +0200 |
commit | 6c934d0feb6a391fda0939e8db5d12aafeb93cc6 (patch) | |
tree | 6d256b92dc7913cfd195b199440e90226c772413 /sd/source/ui/unoidl | |
parent | 6c9a86a6392662f1115d3fe6b793a451101429b7 (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/unoidl')
-rw-r--r-- | sd/source/ui/unoidl/unolayer.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unoobj.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 15 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.cxx | 32 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopback.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unosrch.cxx | 4 |
7 files changed, 34 insertions, 33 deletions
diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx index dff010b3722e..dabcd24f0af2 100644 --- a/sd/source/ui/unoidl/unolayer.cxx +++ b/sd/source/ui/unoidl/unolayer.cxx @@ -120,7 +120,7 @@ void SAL_CALL SdLayer::setPropertyValue( const OUString& aPropertyName, const un if(pLayer == nullptr || mxLayerManager == nullptr) throw lang::DisposedException(); - const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMapEntry(aPropertyName); + const SfxItemPropertyMapEntry* pEntry = pPropSet->getPropertyMapEntry(aPropertyName); switch( pEntry ? pEntry->nWID : -1 ) { @@ -188,7 +188,7 @@ uno::Any SAL_CALL SdLayer::getPropertyValue( const OUString& PropertyName ) if(pLayer == nullptr || mxLayerManager == nullptr) throw lang::DisposedException(); - const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMapEntry(PropertyName); + const SfxItemPropertyMapEntry* pEntry = pPropSet->getPropertyMapEntry(PropertyName); uno::Any aValue; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index fcdb050d7843..cb3569a7689d 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1188,7 +1188,7 @@ void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyNam if( nullptr == mpDoc ) throw lang::DisposedException(); - const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); + const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); switch( pEntry ? pEntry->nWID : -1 ) { @@ -1270,7 +1270,7 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property if( nullptr == mpDoc ) throw lang::DisposedException(); - const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName); + const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName); switch( pEntry ? pEntry->nWID : -1 ) { diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index fdedfb6dcc35..e9e017de3f8d 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -415,7 +415,7 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c { SolarMutexGuard aGuard; - const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); + const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); if( pEntry ) { @@ -656,7 +656,7 @@ css::uno::Any SAL_CALL SdXShape::getPropertyValue( const OUString& PropertyName uno::Any aRet; - const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName); + const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName); if( pEntry && mpShape->GetSdrObject() ) { diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 02bd803cdeb9..eed82fceddd8 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -582,7 +582,7 @@ void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName throwIfDisposed(); - const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); + const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); switch( pEntry ? pEntry->nWID : -1 ) { @@ -992,7 +992,7 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName ) uno::Any aAny; - const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName); + const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName); sal_Int16 nEntry = pEntry ? pEntry->nWID : -1; switch (nEntry) @@ -2780,14 +2780,15 @@ 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& rProp : ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries() ) + for( const auto pProp : ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries() ) { - if( xSetInfo->hasPropertyByName( OUString(rProp.first) ) ) + const OUString& rPropName = pProp->aName; + if( xSetInfo->hasPropertyByName( rPropName ) ) { - if( !xSetStates.is() || xSetStates->getPropertyState( OUString(rProp.first) ) == beans::PropertyState_DIRECT_VALUE ) - xStyleSet->setPropertyValue( OUString(rProp.first), xInputSet->getPropertyValue( OUString(rProp.first) ) ); + if( !xSetStates.is() || xSetStates->getPropertyState( rPropName ) == beans::PropertyState_DIRECT_VALUE ) + xStyleSet->setPropertyValue( rPropName, xInputSet->getPropertyValue( rPropName ) ); else - xSetStates->setPropertyToDefault( OUString(rProp.first) ); + xSetStates->setPropertyToDefault( rPropName ); } } } diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index 60a1ac6bbe14..88ff72ef92a8 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -100,24 +100,24 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) if( mpPropSet->AreThereOwnUsrAnys() ) { - for( const auto& rProp : mpPropSet->getPropertyMap().getPropertyEntries() ) + for( const auto pProp : mpPropSet->getPropertyMap().getPropertyEntries() ) { - uno::Any* pAny = mpPropSet->GetUsrAnyForID( rProp.second ); + uno::Any* pAny = mpPropSet->GetUsrAnyForID( *pProp ); if( pAny ) { - OUString aPropertyName( rProp.first ); - switch( rProp.second.nWID ) + const OUString & aPropertyName = pProp->aName; + switch( pProp->nWID ) { case XATTR_FILLFLOATTRANSPARENCE : case XATTR_FILLGRADIENT : { if ( ( pAny->getValueType() == ::cppu::UnoType< css::awt::Gradient>::get() ) - && ( rProp.second.nMemberId == MID_FILLGRADIENT ) ) + && ( pProp->nMemberId == MID_FILLGRADIENT ) ) { setPropertyValue( aPropertyName, *pAny ); } else if ( ( pAny->getValueType() == ::cppu::UnoType<OUString>::get() ) && - ( rProp.second.nMemberId == MID_NAME ) ) + ( pProp->nMemberId == MID_NAME ) ) { setPropertyValue( aPropertyName, *pAny ); } @@ -126,12 +126,12 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) case XATTR_FILLHATCH : { if ( ( pAny->getValueType() == ::cppu::UnoType< css::drawing::Hatch>::get() ) - && ( rProp.second.nMemberId == MID_FILLHATCH ) ) + && ( pProp->nMemberId == MID_FILLHATCH ) ) { setPropertyValue( aPropertyName, *pAny ); } else if ( ( pAny->getValueType() == ::cppu::UnoType<OUString>::get() ) && - ( rProp.second.nMemberId == MID_NAME ) ) + ( pProp->nMemberId == MID_NAME ) ) { setPropertyValue( aPropertyName, *pAny ); } @@ -139,13 +139,13 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) break; case XATTR_FILLBITMAP : { - if (rProp.second.nMemberId == MID_BITMAP && + if (pProp->nMemberId == MID_BITMAP && (pAny->getValueType() == cppu::UnoType<css::awt::XBitmap>::get() || pAny->getValueType() == cppu::UnoType<css::graphic::XGraphic>::get())) { setPropertyValue( aPropertyName, *pAny ); } - else if (pAny->getValueType() == ::cppu::UnoType<OUString>::get() && rProp.second.nMemberId == MID_NAME) + else if (pAny->getValueType() == ::cppu::UnoType<OUString>::get() && pProp->nMemberId == MID_NAME) { setPropertyValue( aPropertyName, *pAny ); } @@ -189,7 +189,7 @@ void SAL_CALL SdUnoPageBackground::setPropertyValue( const OUString& aPropertyNa { SolarMutexGuard aGuard; - const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName ); + const SfxItemPropertyMapEntry* pEntry = getPropertyMapEntry( aPropertyName ); if( pEntry == nullptr ) { @@ -244,7 +244,7 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyValue( const OUString& Propert SolarMutexGuard aGuard; uno::Any aAny; - const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName); + const SfxItemPropertyMapEntry* pEntry = getPropertyMapEntry(PropertyName); if( pEntry == nullptr ) { @@ -299,7 +299,7 @@ beans::PropertyState SAL_CALL SdUnoPageBackground::getPropertyState( const OUStr { SolarMutexGuard aGuard; - const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName); + const SfxItemPropertyMapEntry* pEntry = getPropertyMapEntry(PropertyName); if( pEntry == nullptr ) throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this)); @@ -359,7 +359,7 @@ void SAL_CALL SdUnoPageBackground::setPropertyToDefault( const OUString& Propert { SolarMutexGuard aGuard; - const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(PropertyName); + const SfxItemPropertyMapEntry* pEntry = getPropertyMapEntry(PropertyName); if( pEntry == nullptr ) throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this)); @@ -382,7 +382,7 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aProp { SolarMutexGuard aGuard; - const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry(aPropertyName); + const SfxItemPropertyMapEntry* pEntry = getPropertyMapEntry(aPropertyName); if( pEntry == nullptr || mpSet == nullptr ) throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this)); @@ -403,7 +403,7 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aProp } /** this is used because our property map is not sorted yet */ -const SfxItemPropertySimpleEntry* SdUnoPageBackground::getPropertyMapEntry( std::u16string_view rPropertyName ) const throw() +const SfxItemPropertyMapEntry* SdUnoPageBackground::getPropertyMapEntry( std::u16string_view rPropertyName ) const throw() { return mpPropSet->getPropertyMap().getByName(rPropertyName); } diff --git a/sd/source/ui/unoidl/unopback.hxx b/sd/source/ui/unoidl/unopback.hxx index 3ff00d383c1f..4713de8bffc0 100644 --- a/sd/source/ui/unoidl/unopback.hxx +++ b/sd/source/ui/unoidl/unopback.hxx @@ -36,7 +36,7 @@ class SdDrawDocument; class SdrModel; class SfxItemSet; class SvxItemPropertySet; -struct SfxItemPropertySimpleEntry; +struct SfxItemPropertyMapEntry; const SvxItemPropertySet* ImplGetPageBackgroundPropertySet(); @@ -51,7 +51,7 @@ class SdUnoPageBackground final : public ::cppu::WeakImplHelper< std::unique_ptr<SfxItemSet> mpSet; SdrModel* mpDoc; - const SfxItemPropertySimpleEntry* getPropertyMapEntry( std::u16string_view rPropertyName ) const throw(); + const SfxItemPropertyMapEntry* getPropertyMapEntry( std::u16string_view rPropertyName ) const throw(); public: SdUnoPageBackground( SdDrawDocument* pDoc = nullptr, const SfxItemSet* pSet = nullptr); virtual ~SdUnoPageBackground() throw() override; diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx index 3afda2d5d646..653c7c4e3a02 100644 --- a/sd/source/ui/unoidl/unosrch.cxx +++ b/sd/source/ui/unoidl/unosrch.cxx @@ -689,7 +689,7 @@ void SAL_CALL SdUnoSearchReplaceDescriptor::setPropertyValue( const OUString& aP { SolarMutexGuard aGuard; - const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); + const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); bool bOk = false; @@ -718,7 +718,7 @@ uno::Any SAL_CALL SdUnoSearchReplaceDescriptor::getPropertyValue( const OUString uno::Any aAny; - const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName); + const SfxItemPropertyMapEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName); switch( pEntry ? pEntry->nWID : -1 ) { |