editeng/source/items/textitem.cxx | 8 ++++++++ include/editeng/colritem.hxx | 2 ++ 2 files changed, 10 insertions(+)
New commits: commit 1c4b613cda515e678a914a9bde4af3cc557532a6 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Aug 23 13:20:17 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Aug 23 16:44:41 2024 +0200 tdf#158556 make SvxColorItem hashable Change-Id: I39cfd46a8255b6231b0215ff22f4ac5f77fa38e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172312 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index cf4d9e27a8d8..a4ad9f8847f8 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1507,6 +1507,14 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const maComplexColor == rColorItem.maComplexColor; } +size_t SvxColorItem::hashCode() const +{ + std::size_t seed(0); + o3tl::hash_combine(seed, static_cast<sal_Int32>(mColor)); + o3tl::hash_combine(seed, maComplexColor); + return seed; +} + bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { nMemberId &= ~CONVERT_TWIPS; diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index 15c352ebff25..1acb863f6a86 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -44,6 +44,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem& rPoolItem) const override; + virtual bool supportsHashCode() const override { return true; } + virtual size_t hashCode() const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;