diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-06-28 15:12:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-07-03 09:28:11 +0200 |
commit | 85fd526fc681a994415bb422090d1d23aa7d54f6 (patch) | |
tree | 5eb25eb47b22c82a649e1f4c5fcfb8e3fdfeaa25 /editeng/source | |
parent | 6c3318d7597956314feac7c61a7ef2da6d3f41a1 (diff) |
fix and simplify the ItemInstanceManager mechanism
The mechanism is currently broken because it uses hash values as keys,
in two different places. But hash values are not required to be unique,
and as soon as there are enough items of a given type, a collision is
inevitable.
So just simplify this whole mechanism. There is no reason we need
type-specific item managers. Stuff everything into a single global pool,
that uses hashing correctly.
Notes
(*) Performance, as far as I can tell, is the same or slightly better.
(*) I removed the NUMBER_OF_UNSHARED_INSTANCES thing, in favour
of just having a simpler mechanism
Change-Id: I9068baf9bf6fae2500ae5748c6d1aabe6c3a18a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169709
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/items/frmitems.cxx | 184 | ||||
-rw-r--r-- | editeng/source/items/paraitem.cxx | 7 | ||||
-rw-r--r-- | editeng/source/items/textitem.cxx | 147 |
3 files changed, 189 insertions, 149 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 0d39a8c4d9ad..c6470a8f120e 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -173,6 +173,7 @@ bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -228,6 +229,19 @@ SvxSizeItem::SvxSizeItem( const sal_uInt16 nId ) : } +bool SvxSizeItem::isHashable() const +{ + return true; +} + +size_t SvxSizeItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_aSize.Width()); + o3tl::hash_combine(seed, m_aSize.Height()); + return seed; +} + bool SvxSizeItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -607,6 +621,7 @@ bool SvxLeftMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) const bool SvxLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -643,6 +658,19 @@ bool SvxLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) return true; } +bool SvxLeftMarginItem::isHashable() const +{ + return true; +} + +size_t SvxLeftMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nLeftMargin); + o3tl::hash_combine(seed, m_nPropLeftMargin); + return seed; +} + bool SvxLeftMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -784,6 +812,7 @@ bool SvxTextLeftMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) cons bool SvxTextLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -820,6 +849,19 @@ bool SvxTextLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) return true; } +bool SvxTextLeftMarginItem::isHashable() const +{ + return true; +} + +size_t SvxTextLeftMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nTextLeftMargin); + o3tl::hash_combine(seed, m_nPropLeftMargin); + return seed; +} + bool SvxTextLeftMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -955,6 +997,7 @@ bool SvxFirstLineIndentItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) con bool SvxFirstLineIndentItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -995,6 +1038,20 @@ bool SvxFirstLineIndentItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) return true; } +bool SvxFirstLineIndentItem::isHashable() const +{ + return true; +} + +size_t SvxFirstLineIndentItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nFirstLineOffset); + o3tl::hash_combine(seed, m_nPropFirstLineOffset); + o3tl::hash_combine(seed, m_bAutoFirst); + return seed; +} + bool SvxFirstLineIndentItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1139,6 +1196,7 @@ bool SvxRightMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) const bool SvxRightMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1175,6 +1233,19 @@ bool SvxRightMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) return true; } +bool SvxRightMarginItem::isHashable() const +{ + return true; +} + +size_t SvxRightMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nRightMargin); + o3tl::hash_combine(seed, m_nPropRightMargin); + return seed; +} + bool SvxRightMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1300,6 +1371,7 @@ bool SvxGutterLeftMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) co bool SvxGutterLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1323,6 +1395,18 @@ bool SvxGutterLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId return true; } +bool SvxGutterLeftMarginItem::isHashable() const +{ + return true; +} + +size_t SvxGutterLeftMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nGutterMargin); + return seed; +} + bool SvxGutterLeftMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1410,6 +1494,7 @@ bool SvxGutterRightMarginItem::QueryValue(uno::Any& /*rVal*/, sal_uInt8 nMemberI bool SvxGutterRightMarginItem::PutValue(const uno::Any& /*rVal*/, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; //bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1429,6 +1514,18 @@ bool SvxGutterRightMarginItem::PutValue(const uno::Any& /*rVal*/, sal_uInt8 nMem } +bool SvxGutterRightMarginItem::isHashable() const +{ + return true; +} + +size_t SvxGutterRightMarginItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, m_nRightGutterMargin); + return seed; +} + bool SvxGutterRightMarginItem::operator==(const SfxPoolItem& rAttr) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1489,6 +1586,28 @@ boost::property_tree::ptree SvxGutterRightMarginItem::dumpAsJSON() const } +bool SvxLRSpaceItem::isHashable() const +{ + return true; +} + +size_t SvxLRSpaceItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, nFirstLineOffset); + o3tl::hash_combine(seed, m_nGutterMargin); + o3tl::hash_combine(seed, m_nRightGutterMargin); + o3tl::hash_combine(seed, nLeftMargin); + o3tl::hash_combine(seed, nRightMargin); + o3tl::hash_combine(seed, nPropFirstLineOffset); + o3tl::hash_combine(seed, nPropLeftMargin); + o3tl::hash_combine(seed, nPropRightMargin); + o3tl::hash_combine(seed, bAutoFirst); + o3tl::hash_combine(seed, bExplicitZeroMarginValRight); + o3tl::hash_combine(seed, bExplicitZeroMarginValLeft); + return seed; +} + bool SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1713,6 +1832,7 @@ bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Int32 nVal = 0; @@ -1773,6 +1893,22 @@ bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } +bool SvxULSpaceItem::isHashable() const +{ + return true; +} + +size_t SvxULSpaceItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, nUpper); + o3tl::hash_combine(seed, nLower); + o3tl::hash_combine(seed, bContext); + o3tl::hash_combine(seed, nPropUpper); + o3tl::hash_combine(seed, nPropLower); + return seed; +} + bool SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1943,6 +2079,20 @@ bool SvxOpaqueItem::GetPresentation } +bool SvxProtectItem::isHashable() const +{ + return true; +} + +size_t SvxProtectItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, bCntnt); + o3tl::hash_combine(seed, bSize); + o3tl::hash_combine(seed, bPos); + return seed; +} + bool SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -1975,6 +2125,7 @@ bool SvxProtectItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxProtectItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; bool bVal( Any2Bool(rVal) ); switch(nMemberId) @@ -2143,6 +2294,20 @@ bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } +bool SvxShadowItem::isHashable() const +{ + return true; +} + +size_t SvxShadowItem::hashCode() const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, static_cast<sal_Int32>(aShadowColor)); + o3tl::hash_combine(seed, nWidth); + o3tl::hash_combine(seed, eLocation); + return seed; +} + bool SvxShadowItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -2358,7 +2523,6 @@ static bool CompareBorderLine(const std::unique_ptr<SvxBorderLine> & pBrd1, cons return *pBrd1 == *pBrd2; } - bool SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); @@ -3263,12 +3427,6 @@ SvxBoxInfoItem::SvxBoxInfoItem(const sal_uInt16 nId) ResetFlags(); } -ItemInstanceManager* SvxBoxItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxBoxItem).hash_code()); - return &aInstanceManager; -} - SvxBoxInfoItem::SvxBoxInfoItem( const SvxBoxInfoItem& rCopy ) : SfxPoolItem(rCopy) , mpHorizontalLine(rCopy.mpHorizontalLine ? new SvxBorderLine(*rCopy.mpHorizontalLine) : nullptr) @@ -3983,12 +4141,6 @@ void SvxLineItem::SetLine( const SvxBorderLine* pNew ) pLine.reset( pNew ? new SvxBorderLine( *pNew ) : nullptr ); } -ItemInstanceManager* SvxBrushItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxBrushItem).hash_code()); - return &aInstanceManager; -} - SvxBrushItem::SvxBrushItem(sal_uInt16 _nWhich) : SfxPoolItem(_nWhich, SfxItemType::SvxBrushItemType) , aColor(COL_TRANSPARENT) @@ -4600,12 +4752,6 @@ void SvxBrushItem::dumpAsXml(xmlTextWriterPtr pWriter) const (void)xmlTextWriterEndElement(pWriter); } -ItemInstanceManager* SvxFrameDirectionItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxFrameDirectionItem).hash_code()); - return &aInstanceManager; -} - SvxFrameDirectionItem::SvxFrameDirectionItem( SvxFrameDirection nValue , sal_uInt16 _nWhich ) : SfxEnumItem<SvxFrameDirection>( _nWhich, SfxItemType::SvxFrameDirectionItemType, nValue ) diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index a63f73c25335..5cfedf113620 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -50,6 +50,7 @@ #include <editeng/memberids.h> #include <editeng/itemtype.hxx> #include <editeng/eerdll.hxx> +#include <o3tl/hash_combine.hxx> using namespace ::com::sun::star; @@ -339,12 +340,6 @@ void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal ) // class SvxAdjustItem --------------------------------------------------- -ItemInstanceManager* SvxAdjustItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxAdjustItem).hash_code()); - return &aInstanceManager; -} - SvxAdjustItem::SvxAdjustItem(const SvxAdjust eAdjst, const sal_uInt16 nId ) : SfxEnumItemInterface( nId, SfxItemType::SvxAdjustItemType ), bOneBlock( false ), bLastCenter( false ), bLastBlock( false ) diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 638948e747de..9801f594d519 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -159,30 +159,21 @@ bool SvxFontListItem::GetPresentation // class SvxFontItem ----------------------------------------------------- -namespace +bool SvxFontItem::isHashable() const { - class SvxFontItemInstanceManager : public TypeSpecificItemInstanceManager<SvxFontItem> - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - const SvxFontItem& rFontItem(static_cast<const SvxFontItem&>(rItem)); - std::size_t seed(0); - o3tl::hash_combine(seed, rItem.Which()); - o3tl::hash_combine(seed, rFontItem.GetFamilyName().hashCode()); - o3tl::hash_combine(seed, rFontItem.GetStyleName().hashCode()); - o3tl::hash_combine(seed, rFontItem.GetFamily()); - o3tl::hash_combine(seed, rFontItem.GetPitch()); - o3tl::hash_combine(seed, rFontItem.GetCharSet()); - return seed; - } - }; + return true; } -ItemInstanceManager* SvxFontItem::getItemInstanceManager() const +size_t SvxFontItem::hashCode() const { - static SvxFontItemInstanceManager aInstanceManager; - return &aInstanceManager; + std::size_t seed(0); + o3tl::hash_combine(seed, Which()); + o3tl::hash_combine(seed, GetFamilyName().hashCode()); + o3tl::hash_combine(seed, GetStyleName().hashCode()); + o3tl::hash_combine(seed, GetFamily()); + o3tl::hash_combine(seed, GetPitch()); + o3tl::hash_combine(seed, GetCharSet()); + return seed; } SvxFontItem::SvxFontItem( @@ -243,6 +234,7 @@ bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxFontItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch(nMemberId) { @@ -409,28 +401,6 @@ void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxPostureItem -------------------------------------------------- -namespace -{ - class SvxPostureItemInstanceManager : public TypeSpecificItemInstanceManager<SvxPostureItem> - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - auto const & rPostureItem = static_cast<const SvxPostureItem&>(rItem); - std::size_t seed(0); - o3tl::hash_combine(seed, rPostureItem.Which()); - o3tl::hash_combine(seed, rPostureItem. GetEnumValue()); - return seed; - } - }; -} - -ItemInstanceManager* SvxPostureItem::getItemInstanceManager() const -{ - static SvxPostureItemInstanceManager aInstanceManager; - return &aInstanceManager; -} - SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) : SfxEnumItem( nId, SfxItemType::SvxPostureItemType, ePosture ) { @@ -495,6 +465,7 @@ bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) { @@ -547,12 +518,6 @@ void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxWeightItem --------------------------------------------------- -ItemInstanceManager* SvxWeightItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxWeightItem).hash_code()); - return &aInstanceManager; -} - SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) : SfxEnumItem( nId, SfxItemType::SvxWeightItemType, eWght ) { @@ -677,28 +642,18 @@ void SvxWeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const // class SvxFontHeightItem ----------------------------------------------- -namespace +bool SvxFontHeightItem::isHashable() const { - class SvxFontHeightItemInstanceManager : public TypeSpecificItemInstanceManager<SvxFontHeightItem> - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - auto const & rFontHeightItem = static_cast<const SvxFontHeightItem&>(rItem); - std::size_t seed(0); - o3tl::hash_combine(seed, rFontHeightItem.Which()); - o3tl::hash_combine(seed, rFontHeightItem.GetHeight()); - o3tl::hash_combine(seed, rFontHeightItem.GetProp()); - o3tl::hash_combine(seed, rFontHeightItem.GetPropUnit()); - return seed; - } - }; + return true; } -ItemInstanceManager* SvxFontHeightItem::getItemInstanceManager() const +size_t SvxFontHeightItem::hashCode() const { - static SvxFontHeightItemInstanceManager aInstanceManager; - return &aInstanceManager; + std::size_t seed(0); + o3tl::hash_combine(seed, GetHeight()); + o3tl::hash_combine(seed, GetProp()); + o3tl::hash_combine(seed, GetPropUnit()); + return seed; } SvxFontHeightItem::SvxFontHeightItem( const sal_uInt32 nSz, @@ -862,6 +817,7 @@ static sal_uInt32 lcl_GetRealHeight_Impl(sal_uInt32 nHeight, sal_uInt16 nProp, M bool SvxFontHeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; switch( nMemberId ) @@ -1194,12 +1150,6 @@ bool SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const // class SvxUnderlineItem ------------------------------------------------ -ItemInstanceManager* SvxUnderlineItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxUnderlineItem).hash_code()); - return &aInstanceManager; -} - SvxUnderlineItem::SvxUnderlineItem( const FontLineStyle eSt, const sal_uInt16 nId ) : SvxTextLineItem( eSt, nId ) { @@ -1241,12 +1191,6 @@ OUString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const // class SvxOverlineItem ------------------------------------------------ -ItemInstanceManager* SvxOverlineItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxOverlineItem).hash_code()); - return &aInstanceManager; -} - SvxOverlineItem::SvxOverlineItem( const FontLineStyle eSt, const sal_uInt16 nId ) : SvxTextLineItem( eSt, nId ) { @@ -1288,12 +1232,6 @@ OUString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const // class SvxCrossedOutItem ----------------------------------------------- -ItemInstanceManager* SvxCrossedOutItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxCrossedOutItem).hash_code()); - return &aInstanceManager; -} - SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId ) : SfxEnumItem( nId, SfxItemType::SvxCrossedOutItemType, eSt ) { @@ -2090,12 +2028,6 @@ bool SvxEscapementItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) // class SvxLanguageItem ------------------------------------------------- -ItemInstanceManager* SvxLanguageItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxLanguageItem).hash_code()); - return &aInstanceManager; -} - SvxLanguageItem::SvxLanguageItem( const LanguageType eLang, const sal_uInt16 nId ) : SvxLanguageItem_Base( nId , SfxItemType::SvxLanguageItemType, eLang ) { @@ -2238,12 +2170,6 @@ bool SvxBlinkItem::GetPresentation // class SvxEmphaisMarkItem --------------------------------------------------- -ItemInstanceManager* SvxEmphasisMarkItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxEmphasisMarkItem).hash_code()); - return &aInstanceManager; -} - SvxEmphasisMarkItem::SvxEmphasisMarkItem( const FontEmphasisMark nValue, TypedWhichId<SvxEmphasisMarkItem> nId ) : SfxUInt16Item( nId, static_cast<sal_uInt16>(nValue), SfxItemType::SvxEmphasisMarkItemType ) @@ -2678,12 +2604,6 @@ bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ |* class SvxCharReliefItem *************************************************************************/ -ItemInstanceManager* SvxCharReliefItem::getItemInstanceManager() const -{ - static DefaultItemInstanceManager aInstanceManager(typeid(SvxCharReliefItem).hash_code()); - return &aInstanceManager; -} - SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue, const sal_uInt16 nId ) : SfxEnumItem( nId, SfxItemType::SvxCharReliefItemType, eValue ) @@ -2967,28 +2887,6 @@ void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rCo // class SvxRsidItem ----------------------------------------------------- -namespace -{ - class SvxRsidItemInstanceManager : public TypeSpecificItemInstanceManager<SvxRsidItem> - { - protected: - virtual size_t hashCode(const SfxPoolItem& rItem) const override - { - auto const & rRsidItem = static_cast<const SvxRsidItem&>(rItem); - std::size_t seed(0); - o3tl::hash_combine(seed, rRsidItem.Which()); - o3tl::hash_combine(seed, rRsidItem.GetValue()); - return seed; - } - }; -} - -ItemInstanceManager* SvxRsidItem::getItemInstanceManager() const -{ - static SvxRsidItemInstanceManager aInstanceManager; - return &aInstanceManager; -} - bool SvxRsidItem::QueryValue( uno::Any& rVal, sal_uInt8 ) const { rVal <<= GetValue(); @@ -2997,6 +2895,7 @@ bool SvxRsidItem::QueryValue( uno::Any& rVal, sal_uInt8 ) const bool SvxRsidItem::PutValue( const uno::Any& rVal, sal_uInt8 ) { + ASSERT_CHANGE_REFCOUNTED_ITEM; sal_uInt32 nRsid = 0; if( !( rVal >>= nRsid ) ) return false; |