From a8aa8d76dba4a32b1d082a87a188c3f0b1f666b4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 29 Jan 2025 15:26:07 +0200 Subject: [PATCH] tdf#164900 table text in different columns no longer lined up Revert "tdf#161846 use unordered_map in SfxItemPropertyMap" This reverts commit c39978f41dccbeb2e973c919a67d9b1d974f8f3c. Change-Id: I26cadb32b426fd3b48179b67c677213a78b4999c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180903 Tested-by: Jenkins Reviewed-by: Noel Grandin --- editeng/source/uno/unoipset.cxx | 2 +- editeng/source/uno/unotext.cxx | 6 +++--- include/editeng/unoipset.hxx | 2 +- include/editeng/unotext.hxx | 2 +- include/svl/itemprop.hxx | 18 ++++++++++------ linguistic/source/lngopt.cxx | 2 +- reportdesign/source/ui/misc/UITools.cxx | 6 ++---- sc/inc/optuno.hxx | 4 ++-- sc/inc/styleuno.hxx | 10 ++++----- sc/source/ui/unoobj/optuno.cxx | 4 ++-- sc/source/ui/unoobj/styleuno.cxx | 10 ++++----- sc/source/ui/view/viewfunc.cxx | 3 +-- sd/inc/stlsheet.hxx | 2 +- sd/source/core/stlsheet.cxx | 2 +- sd/source/ui/unoidl/unopage.cxx | 3 +-- sd/source/ui/unoidl/unopback.cxx | 5 ++--- sd/source/ui/unoidl/unopback.hxx | 2 +- svl/source/items/itemprop.cxx | 26 ++++++++++++++++-------- svx/source/unodraw/unoshape.cxx | 6 ++---- sw/inc/unocrsrhelper.hxx | 6 +++--- sw/source/core/access/accpara.cxx | 6 ++---- sw/source/core/unocore/unocrsrhelper.cxx | 3 +-- sw/source/core/unocore/unofield.cxx | 2 +- sw/source/core/unocore/unoobj.cxx | 6 +++--- sw/source/core/unocore/unostyle.cxx | 5 ++--- 25 files changed, 74 insertions(+), 69 deletions(-) diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 43cb71aa0a86..60d73b7653fb 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -209,7 +209,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertyMapEntry* pMap, } -const SfxItemPropertyMapEntry* SvxItemPropertySet::getPropertyMapEntry(const OUString& rName) const +const SfxItemPropertyMapEntry* SvxItemPropertySet::getPropertyMapEntry(std::u16string_view rName) const { return m_aPropertyMap.getByName( rName ); } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index c80399609572..4b64daeefa7a 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -1058,7 +1058,7 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert throw beans::UnknownPropertyException(); } -beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */) +beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(std::u16string_view PropertyName, sal_Int32 nPara /* = -1 */) { SolarMutexGuard aGuard; @@ -1364,9 +1364,9 @@ void SAL_CALL SvxUnoTextRangeBase::setAllPropertiesToDefault() if( pForwarder ) { - for (auto const & rPair : mpPropSet->getPropertyMap().getPropertyEntries()) + for (const SfxItemPropertyMapEntry* entry : mpPropSet->getPropertyMap().getPropertyEntries()) { - _setPropertyToDefault( pForwarder, rPair.second, -1 ); + _setPropertyToDefault( pForwarder, entry, -1 ); } } } diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx index 9c7f88985d47..f0fb2883cbbb 100644 --- a/include/editeng/unoipset.hxx +++ b/include/editeng/unoipset.hxx @@ -51,7 +51,7 @@ public: rtl::Reference< SfxItemPropertySetInfo > const & getPropertySetInfo() const; const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;} - const SfxItemPropertyMapEntry* getPropertyMapEntry(const OUString& rName) const; + const SfxItemPropertyMapEntry* getPropertyMapEntry(std::u16string_view rName) const; }; struct SvxIDPropertyCombine diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index 8605e36219f0..20ace0ae976b 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -290,7 +290,7 @@ protected: SAL_DLLPRIVATE css::beans::PropertyState _getPropertyState( const SfxItemPropertyMapEntry* pMap, sal_Int32 nPara = -1 ); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException - SAL_DLLPRIVATE css::beans::PropertyState _getPropertyState( const OUString& PropertyName, sal_Int32 nPara = -1 ); + SAL_DLLPRIVATE css::beans::PropertyState _getPropertyState( std::u16string_view PropertyName, sal_Int32 nPara = -1 ); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException SAL_DLLPRIVATE css::uno::Sequence< css::beans::PropertyState > _getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1 ); diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx index ff12f4060551..af48da4ed696 100644 --- a/include/svl/itemprop.hxx +++ b/include/svl/itemprop.hxx @@ -70,23 +70,29 @@ struct SfxItemPropertyMapEntry } }; +struct SfxItemPropertyMapCompare +{ + bool operator() ( const SfxItemPropertyMapEntry * lhs, const SfxItemPropertyMapEntry * rhs ) const + { + return lhs->aName < rhs->aName; + } +}; class SVL_DLLPUBLIC SfxItemPropertyMap { + o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare > m_aMap; + mutable css::uno::Sequence< css::beans::Property > m_aPropSeq; public: SfxItemPropertyMap( std::span pEntries ); SfxItemPropertyMap( const SfxItemPropertyMap& rSource ); ~SfxItemPropertyMap(); - const SfxItemPropertyMapEntry* getByName( const OUString & rName ) const; + const SfxItemPropertyMapEntry* getByName( std::u16string_view rName ) const; css::uno::Sequence< css::beans::Property > const & getProperties() const; /// @throws css::beans::UnknownPropertyException css::beans::Property getPropertyByName( const OUString & rName ) const; - bool hasPropertyByName( const OUString & rName ) const; + bool hasPropertyByName( std::u16string_view rName ) const; - const std::unordered_map< OUString, const SfxItemPropertyMapEntry* >& getPropertyEntries() const { return m_aMap; } -private: - std::unordered_map< OUString, const SfxItemPropertyMapEntry* > m_aMap; - mutable css::uno::Sequence< css::beans::Property > m_aPropSeq; + const o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare >& getPropertyEntries() const { return m_aMap; } }; class SfxItemPropertySetInfo; diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index 6cee920595ab..6f70aae74724 100644 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -308,7 +308,7 @@ Sequence< PropertyValue > SAL_CALL std::vector aProps; aProps.reserve(aPropertyMap.getPropertyEntries().size()); - for(auto const & [aName, pEntry] : aPropertyMap.getPropertyEntries()) + for(auto pEntry : aPropertyMap.getPropertyEntries()) aProps.push_back(PropertyValue(pEntry->aName, pEntry->nWID, aConfig.GetProperty(pEntry->nWID), css::beans::PropertyState_DIRECT_VALUE)); diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index ba51cb2ccc6a..d63a50e3ddb7 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -280,9 +280,8 @@ namespace uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); SvxUnoPropertyMapProvider aMap; const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - for (const auto & rPair : rPropertyMap.getPropertyEntries()) + for (const auto pProp : rPropertyMap.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pProp = rPair.second; if ( xInfo->hasPropertyByName(pProp->aName) ) { const SfxPoolItem* pItem = _rItemSet.GetItem(pProp->nWID); @@ -301,9 +300,8 @@ namespace const uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); SvxUnoPropertyMapProvider aMap; const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - for (const auto & rPair : rPropertyMap.getPropertyEntries()) + for (const auto pProp : rPropertyMap.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pProp = rPair.second; const SfxPoolItem* pItem = nullptr; if ( SfxItemState::SET == _rItemSet.GetItemState(pProp->nWID, true, &pItem) && xInfo->hasPropertyByName(pProp->aName) ) { diff --git a/sc/inc/optuno.hxx b/sc/inc/optuno.hxx index 6e28c6dad6cb..27b0c3d6dc56 100644 --- a/sc/inc/optuno.hxx +++ b/sc/inc/optuno.hxx @@ -40,12 +40,12 @@ class ScDocOptionsHelper public: static bool setPropertyValue( ScDocOptions& rOptions, const SfxItemPropertyMap& rPropMap, - const OUString& rPropertyName, + std::u16string_view aPropertyName, const css::uno::Any& aValue ); static css::uno::Any getPropertyValue( const ScDocOptions& rOptions, const SfxItemPropertyMap& rPropMap, - const OUString& rPropertyName ); + std::u16string_view PropertyName ); }; // empty doc object to supply only doc options diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx index 550e712fe9fa..f524cf8bc615 100644 --- a/sc/inc/styleuno.hxx +++ b/sc/inc/styleuno.hxx @@ -169,21 +169,21 @@ private: OUString aStyleName; SfxStyleSheetBase* pStyle_cached; - const SfxItemSet* GetStyleItemSet_Impl( const OUString& rPropName, const SfxItemPropertyMapEntry*& rpEntry ); + const SfxItemSet* GetStyleItemSet_Impl( std::u16string_view rPropName, const SfxItemPropertyMapEntry*& rpEntry ); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException - css::beans::PropertyState getPropertyState_Impl( const OUString& PropertyName ); + css::beans::PropertyState getPropertyState_Impl( std::u16string_view PropertyName ); /// @throws css::beans::UnknownPropertyException /// @throws css::lang::WrappedTargetException /// @throws css::uno::RuntimeException - css::uno::Any getPropertyDefault_Impl( const OUString& aPropertyName ); + css::uno::Any getPropertyDefault_Impl( std::u16string_view aPropertyName ); /// @throws css::beans::UnknownPropertyException /// @throws css::lang::WrappedTargetException /// @throws css::uno::RuntimeException - css::uno::Any getPropertyValue_Impl( const OUString& aPropertyName ); + css::uno::Any getPropertyValue_Impl( std::u16string_view aPropertyName ); /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException - void setPropertyValue_Impl( const OUString& rPropertyName, + void setPropertyValue_Impl( std::u16string_view rPropertyName, const SfxItemPropertyMapEntry* pEntry, const css::uno::Any* pValue ); diff --git a/sc/source/ui/unoobj/optuno.cxx b/sc/source/ui/unoobj/optuno.cxx index 3d475f74ef8c..ce885684a254 100644 --- a/sc/source/ui/unoobj/optuno.cxx +++ b/sc/source/ui/unoobj/optuno.cxx @@ -30,7 +30,7 @@ using namespace com::sun::star; bool ScDocOptionsHelper::setPropertyValue( ScDocOptions& rOptions, const SfxItemPropertyMap& rPropMap, - const OUString& aPropertyName, const uno::Any& aValue ) + std::u16string_view aPropertyName, const uno::Any& aValue ) { //! use map (with new identifiers) @@ -103,7 +103,7 @@ bool ScDocOptionsHelper::setPropertyValue( ScDocOptions& rOptions, uno::Any ScDocOptionsHelper::getPropertyValue( const ScDocOptions& rOptions, const SfxItemPropertyMap& rPropMap, - const OUString& aPropertyName ) + std::u16string_view aPropertyName ) { uno::Any aRet; const SfxItemPropertyMapEntry* pEntry = rPropMap.getByName( aPropertyName ); diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 659a271a05e0..417fded19368 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -1161,7 +1161,7 @@ uno::Reference ScStyleObj::CreateEmptyNumberingRules() // beans::XPropertyState -const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName, +const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( std::u16string_view rPropName, const SfxItemPropertyMapEntry*& rpResultEntry ) { SfxStyleSheetBase* pStyle = GetStyle_Impl( true ); @@ -1195,7 +1195,7 @@ const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName, return nullptr; } -beans::PropertyState ScStyleObj::getPropertyState_Impl( const OUString& aPropertyName ) +beans::PropertyState ScStyleObj::getPropertyState_Impl( std::u16string_view aPropertyName ) { beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE; @@ -1279,7 +1279,7 @@ void SAL_CALL ScStyleObj::setPropertyToDefault( const OUString& aPropertyName ) setPropertyValue_Impl( aPropertyName, pEntry, nullptr ); } -uno::Any ScStyleObj::getPropertyDefault_Impl( const OUString& aPropertyName ) +uno::Any ScStyleObj::getPropertyDefault_Impl( std::u16string_view aPropertyName ) { uno::Any aAny; @@ -1531,7 +1531,7 @@ void SAL_CALL ScStyleObj::setPropertyValue( const OUString& aPropertyName, const setPropertyValue_Impl( aPropertyName, pEntry, &aValue ); } -void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const SfxItemPropertyMapEntry* pEntry, const uno::Any* pValue ) +void ScStyleObj::setPropertyValue_Impl( std::u16string_view rPropertyName, const SfxItemPropertyMapEntry* pEntry, const uno::Any* pValue ) { SfxStyleSheetBase* pStyle = GetStyle_Impl( true ); if ( !(pStyle && pEntry) ) @@ -1872,7 +1872,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx static_cast(GetStyle_Impl())->Broadcast(SfxHint(SfxHintId::DataChanged)); } -uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName ) +uno::Any ScStyleObj::getPropertyValue_Impl( std::u16string_view aPropertyName ) { uno::Any aAny; SfxStyleSheetBase* pStyle = GetStyle_Impl( true ); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index fff197680f86..1d766741cd99 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1485,9 +1485,8 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor const SfxPoolItem* pItem = nullptr; if ( rNewSet.GetItemState( nWhich, true, &pItem ) == SfxItemState::SET && pItem ) { - for ( const auto & rPair : rMap.getPropertyEntries()) + for ( const auto pEntry : rMap.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; if ( pEntry->nWID == nWhich ) { css::uno::Any aVal; diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx index f11500b620f7..89646915f24b 100644 --- a/sd/inc/stlsheet.hxx +++ b/sd/inc/stlsheet.hxx @@ -138,7 +138,7 @@ public: private: /// @throws css::uno::RuntimeException - static const SfxItemPropertyMapEntry* getPropertyMapEntry( const OUString& rPropertyName ); + static const SfxItemPropertyMapEntry* getPropertyMapEntry( std::u16string_view rPropertyName ); void setPropertyValue_Impl(const OUString& aPropertyName, const css::uno::Any& aValue); css::uno::Any getPropertyValue_Impl(const OUString& PropertyName); diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index c4b5dfe92046..ea944df631b0 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -1492,7 +1492,7 @@ Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) } /** this is used because our property map is not sorted yet */ -const SfxItemPropertyMapEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName ) +const SfxItemPropertyMapEntry* SdStyleSheet::getPropertyMapEntry( std::u16string_view rPropertyName ) { return GetStylePropertySet().getPropertyMapEntry(rPropertyName); } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 64ae86dbe4ae..8279858b20df 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2831,9 +2831,8 @@ 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 & rPair : ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries() ) + for( const auto pProp : 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 c4fc95421dc4..769582e82347 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -97,9 +97,8 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) if( maUsrAnys.AreThereOwnUsrAnys() ) { - for( const auto & rPair : mpPropSet->getPropertyMap().getPropertyEntries() ) + for( const auto pProp : mpPropSet->getPropertyMap().getPropertyEntries() ) { - const SfxItemPropertyMapEntry* pProp = rPair.second; uno::Any* pAny = maUsrAnys.GetUsrAnyForID( *pProp ); if( pAny ) { @@ -399,7 +398,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( const OUString& rPropertyName ) const noexcept +const SfxItemPropertyMapEntry* SdUnoPageBackground::getPropertyMapEntry( std::u16string_view 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 59b4b73bba67..c2834d9298ee 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 mpSet; SdrModel* mpDoc; - const SfxItemPropertyMapEntry* getPropertyMapEntry( const OUString& rPropertyName ) const noexcept; + const SfxItemPropertyMapEntry* getPropertyMapEntry( std::u16string_view rPropertyName ) const noexcept; public: SdUnoPageBackground( SdDrawDocument* pDoc = nullptr, const SfxItemSet* pSet = nullptr); virtual ~SdUnoPageBackground() noexcept override; diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx index 329f84df722e..128bc190c390 100644 --- a/svl/source/items/itemprop.cxx +++ b/svl/source/items/itemprop.cxx @@ -41,7 +41,7 @@ SfxItemPropertyMap::SfxItemPropertyMap( std::span for (const auto & pEntry : pEntries) { assert(!pEntry.aName.isEmpty() && "empty name? might be something left an empty entry at the end of this array"); - m_aMap.insert( { pEntry.aName, &pEntry } ); + m_aMap.insert( &pEntry ); } } @@ -51,12 +51,23 @@ SfxItemPropertyMap::~SfxItemPropertyMap() { } -const SfxItemPropertyMapEntry* SfxItemPropertyMap::getByName( const OUString & rName ) const +const SfxItemPropertyMapEntry* SfxItemPropertyMap::getByName( std::u16string_view rName ) const { - auto it = m_aMap.find(rName); - if (it == m_aMap.end()) + struct Compare + { + bool operator() ( const SfxItemPropertyMapEntry* lhs, std::u16string_view rhs ) const + { + return lhs->aName < rhs; + } + bool operator() ( std::u16string_view lhs, const SfxItemPropertyMapEntry* rhs ) const + { + return lhs < rhs->aName; + } + }; + auto it = std::lower_bound(m_aMap.begin(), m_aMap.end(), rName, Compare()); + if (it == m_aMap.end() || Compare()(rName, *it)) return nullptr; - return it->second; + return *it; } uno::Sequence const & SfxItemPropertyMap::getProperties() const @@ -66,9 +77,8 @@ uno::Sequence const & SfxItemPropertyMap::getProperties() const m_aPropSeq.realloc( m_aMap.size() ); beans::Property* pPropArray = m_aPropSeq.getArray(); sal_uInt32 n = 0; - for( const auto & rPair : m_aMap ) + for( const SfxItemPropertyMapEntry* pEntry : m_aMap ) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; pPropArray[n].Name = pEntry->aName; pPropArray[n].Handle = pEntry->nWID; pPropArray[n].Type = pEntry->aType; @@ -94,7 +104,7 @@ beans::Property SfxItemPropertyMap::getPropertyByName( const OUString& rName ) c return aProp; } -bool SfxItemPropertyMap::hasPropertyByName( const OUString & rName ) const +bool SfxItemPropertyMap::hasPropertyByName( std::u16string_view rName ) const { return getByName(rName) != nullptr; } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 9ae9b9d69e09..abe48784d1e1 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -523,9 +523,8 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper const SfxItemPropertyMap& rSrc = rPropSet.getPropertyMap(); - for(const auto & rPair : rSrc.getPropertyEntries()) + for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pSrcProp = rPair.second; const sal_uInt16 nWID = pSrcProp->nWID; if(SfxItemPool::IsWhich(nWID) && (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END) @@ -533,9 +532,8 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper rSet.Put(rSet.GetPool()->GetUserOrPoolDefaultItem(nWID)); } - for(const auto & rPair : rSrc.getPropertyEntries()) + for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pSrcProp = rPair.second; if(pSrcProp->nWID) { uno::Any* pUsrAny = rAnys.GetUsrAnyForID(*pSrcProp); diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx index e9fea3d32c9c..5ec7d6636536 100644 --- a/sw/inc/unocrsrhelper.hxx +++ b/sw/inc/unocrsrhelper.hxx @@ -184,7 +184,7 @@ namespace SwUnoCursorHelper css::uno::Any GetPropertyValue( SwPaM& rPaM, const SfxItemPropertySet & rPropSet, - const OUString& rPropertyName); + std::u16string_view rPropertyName); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException css::uno::Sequence< css::beans::PropertyState > GetPropertyStates( @@ -205,14 +205,14 @@ namespace SwUnoCursorHelper void SetPropertyToDefault( SwPaM & rPaM, const SfxItemPropertySet & rPropSet, - const OUString& rPropertyName); + std::u16string_view rPropertyName); /// @throws css::beans::UnknownPropertyException /// @throws css::lang::WrappedTargetException /// @throws css::uno::RuntimeException css::uno::Any GetPropertyDefault( SwPaM const & rPaM, const SfxItemPropertySet & rPropSet, - const OUString& rPropertyName); + std::u16string_view rPropertyName); bool SetPageDesc( const css::uno::Any& rValue, diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 48e2ff5eac98..36c7fff36ac4 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1419,9 +1419,8 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl( { const SfxItemPropertyMap& rPropMap = aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_CURSOR )->getPropertyMap(); - for ( const auto & rPair : rPropMap.getPropertyEntries() ) + for ( const auto pEntry : rPropMap.getPropertyEntries() ) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; const SfxPoolItem* pItem = pSet->GetItem( pEntry->nWID ); if ( pItem ) { @@ -1609,9 +1608,8 @@ void SwAccessibleParagraph::_getRunAttributesImpl( const SfxItemPropertyMap& rPropMap = aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_CURSOR )->getPropertyMap(); - for ( const auto & rPair : rPropMap.getPropertyEntries() ) + for ( const auto pEntry : rPropMap.getPropertyEntries() ) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; const SfxPoolItem* pItem( nullptr ); // #i82637# - Found character attributes, whose value equals the value of // the corresponding default character attributes, are excluded. diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 10d391b5ee99..55cd70f2d92f 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -304,9 +304,8 @@ static uno::Any GetParaListAutoFormat(SwTextNode const& rNode) SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap()); std::vector props; // have to iterate the map, not the item set? - for (auto const & rPair : rMap.getPropertyEntries()) + for (auto const pEntry : rMap.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; if (SfxItemPropertySet::getPropertyState(*pEntry, *pSet) == PropertyState_DIRECT_VALUE) { Any value; diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 235f96d792c2..047da46c30d3 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -309,7 +309,7 @@ static sal_Int32 lcl_PropName2TokenPos(std::u16string_view rPropertyName) return SAL_MAX_INT32; } -static sal_uInt16 GetFieldTypeMId( const OUString& rProperty, const SwFieldType& rTyp ) +static sal_uInt16 GetFieldTypeMId( std::u16string_view rProperty, const SwFieldType& rTyp ) { sal_uInt16 nId = lcl_GetPropMapIdForFieldType( rTyp.Which() ); const SfxItemPropertySet* pSet = aSwMapProvider.GetPropertySet( nId ); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index ba1efe36124b..5047a2ddab86 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1871,7 +1871,7 @@ SwXTextCursor::setString(const OUString& aString) uno::Any SwUnoCursorHelper::GetPropertyValue( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, - const OUString& rPropertyName) + std::u16string_view rPropertyName) { uno::Any aAny; SfxItemPropertyMapEntry const*const pEntry = @@ -2163,7 +2163,7 @@ lcl_SelectParaAndReset( SwPaM &rPaM, SwDoc & rDoc, void SwUnoCursorHelper::SetPropertyToDefault( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, - const OUString& rPropertyName) + std::u16string_view rPropertyName) { SwDoc& rDoc = rPaM.GetDoc(); SfxItemPropertyMapEntry const*const pEntry = @@ -2201,7 +2201,7 @@ void SwUnoCursorHelper::SetPropertyToDefault( uno::Any SwUnoCursorHelper::GetPropertyDefault( SwPaM const & rPaM, const SfxItemPropertySet& rPropSet, - const OUString& rPropertyName) + std::u16string_view rPropertyName) { SfxItemPropertyMapEntry const*const pEntry = rPropSet.getPropertyMap().getByName(rPropertyName); diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 791b5ef41050..1870c0b80d4a 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -527,7 +527,7 @@ public: : mrMap(rMap) { } - bool AllowsKey(const OUString& rName) + bool AllowsKey(std::u16string_view rName) { return mrMap.hasPropertyByName(rName); } @@ -4397,9 +4397,8 @@ 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 & rPair : rMap.getPropertyEntries() ) + for( const auto pEntry : rMap.getPropertyEntries() ) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; if ( pEntry->nWID == nWID ) { beans::PropertyValue aPropertyValue;