make SvxEscapementItem hashable
Change-Id: Ic03c78f6dde68f5557d474147336fa62be6f3aaa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169967 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
890916578f
commit
6e1a55dfbd
3 changed files with 20 additions and 7 deletions
|
@ -2488,13 +2488,13 @@ void SvxCharPositionPage::SetEscapement_Impl( SvxEscapement nEsc )
|
|||
|
||||
if ( SvxEscapement::Superscript == nEsc )
|
||||
{
|
||||
aEscItm.GetEsc() = m_nSuperEsc;
|
||||
aEscItm.GetProportionalHeight() = m_nSuperProp;
|
||||
aEscItm.SetEsc( m_nSuperEsc );
|
||||
aEscItm.SetProportionalHeight(m_nSuperProp);
|
||||
}
|
||||
else if ( SvxEscapement::Subscript == nEsc )
|
||||
{
|
||||
aEscItm.GetEsc() = m_nSubEsc;
|
||||
aEscItm.GetProportionalHeight() = m_nSubProp;
|
||||
aEscItm.SetEsc( m_nSubEsc );
|
||||
aEscItm.SetProportionalHeight( m_nSubProp );
|
||||
}
|
||||
|
||||
short nFac = aEscItm.GetEsc() < 0 ? -1 : 1;
|
||||
|
|
|
@ -1895,6 +1895,15 @@ SvxEscapementItem::SvxEscapementItem( const short _nEsc,
|
|||
{
|
||||
}
|
||||
|
||||
bool SvxEscapementItem::isHashable() const { return true; }
|
||||
|
||||
size_t SvxEscapementItem::hashCode() const
|
||||
{
|
||||
std::size_t seed(0);
|
||||
o3tl::hash_combine(seed, nEsc);
|
||||
o3tl::hash_combine(seed, nProp);
|
||||
return seed;
|
||||
}
|
||||
|
||||
bool SvxEscapementItem::operator==( const SfxPoolItem& rAttr ) const
|
||||
{
|
||||
|
@ -1984,6 +1993,7 @@ bool SvxEscapementItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
|
|||
|
||||
bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
|
||||
{
|
||||
ASSERT_CHANGE_REFCOUNTED_ITEM;
|
||||
nMemberId &= ~CONVERT_TWIPS;
|
||||
switch(nMemberId)
|
||||
{
|
||||
|
|
|
@ -51,6 +51,8 @@ public:
|
|||
const sal_uInt16 nId );
|
||||
|
||||
// "pure virtual Methods" from SfxPoolItem
|
||||
virtual bool isHashable() const override;
|
||||
virtual size_t hashCode() const override;
|
||||
virtual bool operator==( const SfxPoolItem& ) const override;
|
||||
virtual bool GetPresentation( SfxItemPresentation ePres,
|
||||
MapUnit eCoreMetric,
|
||||
|
@ -64,6 +66,7 @@ public:
|
|||
|
||||
void SetEscapement( const SvxEscapement eNew )
|
||||
{
|
||||
ASSERT_CHANGE_REFCOUNTED_ITEM;
|
||||
if( SvxEscapement::Off == eNew )
|
||||
{
|
||||
nEsc = 0;
|
||||
|
@ -80,11 +83,11 @@ public:
|
|||
}
|
||||
SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
|
||||
|
||||
short &GetEsc() { return nEsc; }
|
||||
short GetEsc() const { return nEsc; }
|
||||
void SetEsc(short nNewEsc) { ASSERT_CHANGE_REFCOUNTED_ITEM; nEsc = nNewEsc; }
|
||||
|
||||
sal_uInt8 &GetProportionalHeight() { return nProp; }
|
||||
sal_uInt8 GetProportionalHeight() const { return nProp; }
|
||||
sal_uInt8 GetProportionalHeight() const { return nProp; }
|
||||
void SetProportionalHeight(sal_uInt8 n) { ASSERT_CHANGE_REFCOUNTED_ITEM; nProp = n; }
|
||||
|
||||
virtual sal_uInt16 GetValueCount() const override;
|
||||
static OUString GetValueTextByPos( sal_uInt16 nPos );
|
||||
|
|
Loading…
Reference in a new issue