From 01d183d2290668c310d592bf2e4c298ddcfb10b4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 23 Aug 2024 14:17:01 +0200 Subject: tdf#158556 make SvxBrushItem hashable Change-Id: I82794dbf004781a86c8443b72263528167fe0359 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172316 Reviewed-by: Noel Grandin Tested-by: Jenkins --- editeng/source/items/frmitems.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'editeng') diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 25ac10818176..f457781e39bd 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -4255,6 +4255,7 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch( nMemberId) { @@ -4462,6 +4463,23 @@ bool SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const return bEqual; } +size_t SvxBrushItem::hashCode() const +{ + std::size_t seed(0); + o3tl::hash_combine(seed, static_cast(aColor)); + o3tl::hash_combine(seed, maComplexColor); + o3tl::hash_combine(seed, static_cast(aFilterColor)); + o3tl::hash_combine(seed, eGraphicPos); + o3tl::hash_combine(seed, nGraphicTransparency); + if ( GPOS_NONE != eGraphicPos ) + { + o3tl::hash_combine(seed, maStrLink); + o3tl::hash_combine(seed, maStrFilter); + } + o3tl::hash_combine(seed, nShadingValue); + return seed; +} + SvxBrushItem* SvxBrushItem::Clone( SfxItemPool* ) const { return new SvxBrushItem( *this ); -- cgit v1.2.3