include/svx/grfcrop.hxx      |    2 ++
 svx/source/items/grfitem.cxx |    9 +++++++++
 2 files changed, 11 insertions(+)

New commits:
commit 0b49ac534a532b00bee69e96c4e9bc352fc82c4e
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Aug 22 15:56:41 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Aug 22 19:23:59 2024 +0200

    tdf#158556 make SvxGrfCrop hashable
    
    Change-Id: I30c8f44156a05519dc2f6db59734013e217c91b1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172261
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svx/grfcrop.hxx b/include/svx/grfcrop.hxx
index 354ee8b16c44..ff17e66e0c03 100644
--- a/include/svx/grfcrop.hxx
+++ b/include/svx/grfcrop.hxx
@@ -44,6 +44,8 @@ public:
 
     // "pure virtual methods" from SfxPoolItem
     virtual bool                operator==( const SfxPoolItem& ) const 
override;
+    virtual bool supportsHashCode() const override { return true; }
+    virtual size_t hashCode() const override;
     virtual bool GetPresentation( SfxItemPresentation ePres,
                                   MapUnit eCoreMetric,
                                   MapUnit ePresMetric,
diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx
index b87f021a6f5f..d65682d28da1 100644
--- a/svx/source/items/grfitem.cxx
+++ b/svx/source/items/grfitem.cxx
@@ -53,6 +53,15 @@ bool SvxGrfCrop::operator==( const SfxPoolItem& rAttr ) const
            m_nBottom  == rCrop.GetBottom();
 }
 
+size_t SvxGrfCrop::hashCode() const
+{
+    std::size_t seed(0);
+    o3tl::hash_combine(seed, m_nLeft);
+    o3tl::hash_combine(seed, m_nRight);
+    o3tl::hash_combine(seed, m_nTop);
+    o3tl::hash_combine(seed, m_nBottom);
+    return seed;
+}
 
 bool SvxGrfCrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
 {

Reply via email to