summaryrefslogtreecommitdiff
path: root/svx/source/items/grfitem.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-07-08 11:22:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-07-09 10:23:44 +0200
commit36a8f4d1a0754e8eefdaabe4bad771355e5ea3a9 (patch)
treecd1ac354bebe090bdf10b988563efd16e7434f22 /svx/source/items/grfitem.cxx
parent045ebdb369ab21a3be7a32dc1c85ad2243eb9129 (diff)
make SvxGrfCrop hashable
Change-Id: I529b642072becd1171d02598d57a9237e893fa2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170146 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/items/grfitem.cxx')
-rw-r--r--svx/source/items/grfitem.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx
index 62f34094e228..8a8510aad8d4 100644
--- a/svx/source/items/grfitem.cxx
+++ b/svx/source/items/grfitem.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/text/GraphicCrop.hpp>
#include <tools/mapunit.hxx>
#include <tools/UnitConversion.hxx>
+#include <o3tl/hash_combine.hxx>
using namespace ::com::sun::star;
@@ -41,6 +42,21 @@ SvxGrfCrop::~SvxGrfCrop()
{
}
+bool SvxGrfCrop::isHashable() const
+{
+ return true;
+}
+
+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::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
@@ -77,6 +93,7 @@ bool SvxGrfCrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
bool SvxGrfCrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
{
+ ASSERT_CHANGE_REFCOUNTED_ITEM;
bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
text::GraphicCrop aVal;