use more string_view in SfxItemPropertyMap

Change-Id: I053dedcbf0b110a61752722d247d6ee5e9ba481d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107977
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel
2020-12-18 20:23:40 +02:00
committed by Noel Grandin
parent dfd69eb0ce
commit 27d585cd2d
15 changed files with 32 additions and 32 deletions

View File

@@ -246,7 +246,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa
}
const SfxItemPropertySimpleEntry* SvxItemPropertySet::getPropertyMapEntry(const OUString &rName) const
const SfxItemPropertySimpleEntry* SvxItemPropertySet::getPropertyMapEntry(std::u16string_view rName) const
{
return m_aPropertyMap.getByName( rName );
}

View File

@@ -1017,7 +1017,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;

View File

@@ -59,7 +59,7 @@ public:
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const;
const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;}
const SfxItemPropertySimpleEntry* getPropertyMapEntry(const OUString &rName) const;
const SfxItemPropertySimpleEntry* getPropertyMapEntry(std::u16string_view rName) const;
};
/** converts the given any with a metric to 100th/mm if needed */

View File

@@ -274,7 +274,7 @@ protected:
css::beans::PropertyState _getPropertyState( const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara = -1 );
/// @throws css::beans::UnknownPropertyException
/// @throws css::uno::RuntimeException
css::beans::PropertyState _getPropertyState( const OUString& PropertyName, sal_Int32 nPara = -1 );
css::beans::PropertyState _getPropertyState( std::u16string_view PropertyName, sal_Int32 nPara = -1 );
/// @throws css::beans::UnknownPropertyException
/// @throws css::uno::RuntimeException
css::uno::Sequence< css::beans::PropertyState > _getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1 );

View File

@@ -124,11 +124,11 @@ public:
SfxItemPropertyMap( const SfxItemPropertyMap& rSource );
~SfxItemPropertyMap();
const SfxItemPropertySimpleEntry* getByName( const OUString &rName ) const;
const SfxItemPropertySimpleEntry* 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;
void mergeProperties( const css::uno::Sequence< css::beans::Property >& rPropSeq );
PropertyEntryVector_t getPropertyEntries() const;

View File

@@ -44,12 +44,12 @@ public:
static bool setPropertyValue( ScDocOptions& rOptions,
const SfxItemPropertyMap& rPropMap,
const OUString& aPropertyName,
std::u16string_view aPropertyName,
const css::uno::Any& aValue );
static css::uno::Any getPropertyValue(
const ScDocOptions& rOptions,
const SfxItemPropertyMap& rPropMap,
const OUString& PropertyName );
std::u16string_view PropertyName );
};
// empty doc object to supply only doc options

View File

@@ -174,21 +174,21 @@ private:
SfxStyleSheetBase* pStyle_cached;
SfxStyleSheetBase* GetStyle_Impl( bool bUseCachedValue = false );
const SfxItemSet* GetStyleItemSet_Impl( const OUString& rPropName, const SfxItemPropertySimpleEntry*& rpEntry );
const SfxItemSet* GetStyleItemSet_Impl( std::u16string_view rPropName, const SfxItemPropertySimpleEntry*& 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 SfxItemPropertySimpleEntry* pEntry,
const css::uno::Any* pValue );

View File

@@ -53,7 +53,7 @@ const SfxItemPropertyMapEntry* ScDocOptionsHelper::GetPropertyMap()
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)
@@ -129,7 +129,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 SfxItemPropertySimpleEntry* pEntry = rPropMap.getByName( aPropertyName );

View File

@@ -1121,7 +1121,7 @@ uno::Reference<container::XIndexReplace> ScStyleObj::CreateEmptyNumberingRules()
// beans::XPropertyState
const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName,
const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( std::u16string_view rPropName,
const SfxItemPropertySimpleEntry*& rpResultEntry )
{
SfxStyleSheetBase* pStyle = GetStyle_Impl( true );
@@ -1155,7 +1155,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;
@@ -1224,7 +1224,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;
@@ -1273,7 +1273,7 @@ uno::Any ScStyleObj::getPropertyDefault_Impl( const OUString& aPropertyName )
case ATTR_PAGE_SCALETO:
{
const ScPageScaleToItem aItem(static_cast<const ScPageScaleToItem&>(pItemSet->Get(nWhich)));
if ( aPropertyName == SC_UNO_PAGE_SCALETOX )
if ( aPropertyName == u"" SC_UNO_PAGE_SCALETOX )
aAny <<= static_cast<sal_Int16>(aItem.GetWidth());
else
aAny <<= static_cast<sal_Int16>(aItem.GetHeight());
@@ -1461,7 +1461,7 @@ void SAL_CALL ScStyleObj::setPropertyValue( const OUString& aPropertyName, const
setPropertyValue_Impl( aPropertyName, pEntry, &aValue );
}
void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const SfxItemPropertySimpleEntry* pEntry, const uno::Any* pValue )
void ScStyleObj::setPropertyValue_Impl( std::u16string_view rPropertyName, const SfxItemPropertySimpleEntry* pEntry, const uno::Any* pValue )
{
SfxStyleSheetBase* pStyle = GetStyle_Impl( true );
if ( !(pStyle && pEntry) )
@@ -1652,7 +1652,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx
if (*pValue >>= nPages)
{
ScPageScaleToItem aItem = rSet.Get(ATTR_PAGE_SCALETO);
if (rPropertyName == SC_UNO_PAGE_SCALETOX)
if (rPropertyName == u"" SC_UNO_PAGE_SCALETOX)
aItem.SetWidth(static_cast<sal_uInt16>(nPages));
else
aItem.SetHeight(static_cast<sal_uInt16>(nPages));
@@ -1769,12 +1769,12 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx
}
}
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 );
if ( aPropertyName == SC_UNONAME_DISPNAME ) // read-only
if ( aPropertyName == u"" SC_UNONAME_DISPNAME ) // read-only
{
// core always has the display name
if ( pStyle )
@@ -1847,7 +1847,7 @@ uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName )
case ATTR_PAGE_SCALETO:
{
const ScPageScaleToItem& aItem(pItemSet->Get(ATTR_PAGE_SCALETO));
if ( aPropertyName == SC_UNO_PAGE_SCALETOX )
if ( aPropertyName == u"" SC_UNO_PAGE_SCALETOX )
aAny <<= static_cast<sal_Int16>(aItem.GetWidth());
else
aAny <<= static_cast<sal_Int16>(aItem.GetHeight());

View File

@@ -129,7 +129,7 @@ public:
private:
/// @throws css::uno::RuntimeException
static const SfxItemPropertySimpleEntry* getPropertyMapEntry( const OUString& rPropertyName );
static const SfxItemPropertySimpleEntry* getPropertyMapEntry( std::u16string_view rPropertyName );
virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
virtual ~SdStyleSheet() override;

View File

@@ -1303,7 +1303,7 @@ Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName )
}
/** this is used because our property map is not sorted yet */
const SfxItemPropertySimpleEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName )
const SfxItemPropertySimpleEntry* SdStyleSheet::getPropertyMapEntry( std::u16string_view rPropertyName )
{
return GetStylePropertySet().getPropertyMapEntry(rPropertyName);
}

View File

@@ -405,7 +405,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( const OUString& rPropertyName ) const throw()
const SfxItemPropertySimpleEntry* SdUnoPageBackground::getPropertyMapEntry( std::u16string_view rPropertyName ) const throw()
{
return mpPropSet->getPropertyMap().getByName(rPropertyName);
}

View File

@@ -52,7 +52,7 @@ class SdUnoPageBackground final : public ::cppu::WeakImplHelper<
std::unique_ptr<SfxItemSet> mpSet;
SdrModel* mpDoc;
const SfxItemPropertySimpleEntry* getPropertyMapEntry( const OUString& rPropertyName ) const throw();
const SfxItemPropertySimpleEntry* getPropertyMapEntry( std::u16string_view rPropertyName ) const throw();
public:
SdUnoPageBackground( SdDrawDocument* pDoc = nullptr, const SfxItemSet* pSet = nullptr);
virtual ~SdUnoPageBackground() throw() override;

View File

@@ -35,7 +35,7 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
using namespace com::sun::star::uno;
typedef std::unordered_map< OUString,
typedef std::unordered_map< std::u16string_view,
SfxItemPropertySimpleEntry > SfxItemPropertyHashMap_t;
class SfxItemPropertyMap_Impl : public SfxItemPropertyHashMap_t
@@ -72,7 +72,7 @@ SfxItemPropertyMap::~SfxItemPropertyMap()
{
}
const SfxItemPropertySimpleEntry* SfxItemPropertyMap::getByName( const OUString &rName ) const
const SfxItemPropertySimpleEntry* SfxItemPropertyMap::getByName( std::u16string_view rName ) const
{
SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName);
if( aIter == m_pImpl->end() )
@@ -117,7 +117,7 @@ beans::Property SfxItemPropertyMap::getPropertyByName( const OUString & rName )
return aProp;
}
bool SfxItemPropertyMap::hasPropertyByName( const OUString& rName ) const
bool SfxItemPropertyMap::hasPropertyByName( std::u16string_view rName ) const
{
SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName);
return aIter != m_pImpl->end();

View File

@@ -306,7 +306,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 );