summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2024-05-22 12:26:46 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-06-18 01:07:42 +0200
commitc39e4f6b8a942680bc7250177c34fd034a0605e0 (patch)
treee7fb5be56a6f3a391ab420bede1d2ea714901777 /svl
parent8ef9573f087b86f93860c8d07d04b60a40512836 (diff)
Add SfxItemType to SfxPoolItem
The SfxPoolItem has a new member SfxItemType m_eItemType to compare types based on enums instead of typeinfo() which consumes a lot of time e.g. while AutoFormat is running Change-Id: I033ce67bc9a28ee4790f162380314de85fb4154e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166452 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/flagitem.cxx4
-rw-r--r--svl/source/items/globalnameitem.cxx5
-rw-r--r--svl/source/items/grabbagitem.cxx7
-rw-r--r--svl/source/items/ilstitem.cxx5
-rw-r--r--svl/source/items/imageitm.cxx2
-rw-r--r--svl/source/items/int64item.cxx2
-rw-r--r--svl/source/items/intitem.cxx4
-rw-r--r--svl/source/items/lckbitem.cxx1
-rw-r--r--svl/source/items/poolitem.cxx22
-rw-r--r--svl/source/items/ptitem.cxx3
-rw-r--r--svl/source/items/rectitem.cxx3
-rw-r--r--svl/source/items/rngitem.cxx2
-rw-r--r--svl/source/items/sitem.cxx10
-rw-r--r--svl/source/items/slstitm.cxx5
-rw-r--r--svl/source/items/srchitem.cxx2
-rw-r--r--svl/source/items/voiditem.cxx4
16 files changed, 46 insertions, 35 deletions
diff --git a/svl/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx
index 270be1e57530..8a873bacbb61 100644
--- a/svl/source/items/flagitem.cxx
+++ b/svl/source/items/flagitem.cxx
@@ -26,8 +26,8 @@
#include <sal/log.hxx>
-SfxFlagItem::SfxFlagItem( sal_uInt16 nW, sal_uInt16 nV ) :
- SfxPoolItem( nW ),
+SfxFlagItem::SfxFlagItem( sal_uInt16 nW, sal_uInt16 nV, SfxItemType eItemType ) :
+ SfxPoolItem( nW, eItemType ),
nVal(nV)
{
}
diff --git a/svl/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx
index 3f8d3265d779..6cd1ece098ee 100644
--- a/svl/source/items/globalnameitem.cxx
+++ b/svl/source/items/globalnameitem.cxx
@@ -30,13 +30,14 @@
SfxPoolItem* SfxGlobalNameItem::CreateDefault() { return new SfxGlobalNameItem; }
-SfxGlobalNameItem::SfxGlobalNameItem()
+SfxGlobalNameItem::SfxGlobalNameItem() :
+ SfxPoolItem(0, SfxItemType::SfxGlobalNameItemType)
{
}
SfxGlobalNameItem::SfxGlobalNameItem( sal_uInt16 nW, const SvGlobalName& rName )
-: SfxPoolItem( nW ),
+: SfxPoolItem( nW, SfxItemType::SfxGlobalNameItemType ),
m_aName( rName )
{
}
diff --git a/svl/source/items/grabbagitem.cxx b/svl/source/items/grabbagitem.cxx
index c78768c53961..89c0c0336903 100644
--- a/svl/source/items/grabbagitem.cxx
+++ b/svl/source/items/grabbagitem.cxx
@@ -16,10 +16,13 @@
using namespace com::sun::star;
-SfxGrabBagItem::SfxGrabBagItem() = default;
+SfxGrabBagItem::SfxGrabBagItem()
+ : SfxPoolItem(0, SfxItemType::SfxGrabBagItemType)
+{
+}
SfxGrabBagItem::SfxGrabBagItem(sal_uInt16 nWhich)
- : SfxPoolItem(nWhich)
+ : SfxPoolItem(nWhich, SfxItemType::SfxGrabBagItemType)
{
}
diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx
index 0cb9ea8e6c49..adbc324c46ee 100644
--- a/svl/source/items/ilstitem.cxx
+++ b/svl/source/items/ilstitem.cxx
@@ -28,17 +28,18 @@
SfxPoolItem* SfxIntegerListItem::CreateDefault() { return new SfxIntegerListItem; }
SfxIntegerListItem::SfxIntegerListItem()
+ : SfxPoolItem(0, SfxItemType::SfxIntegerListItemType)
{
}
SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, ::std::vector < sal_Int32 >&& rList )
- : SfxPoolItem( which )
+ : SfxPoolItem( which, SfxItemType::SfxIntegerListItemType )
, m_aList( std::move(rList) )
{
}
SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const css::uno::Sequence < sal_Int32 >& rList )
- : SfxPoolItem( which )
+ : SfxPoolItem( which, SfxItemType::SfxIntegerListItemType )
{
comphelper::sequenceToContainer(m_aList, rList);
}
diff --git a/svl/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx
index cba4b7103b82..7020054d6889 100644
--- a/svl/source/items/imageitm.cxx
+++ b/svl/source/items/imageitm.cxx
@@ -25,7 +25,7 @@
SfxPoolItem* SfxImageItem::CreateDefault() { return new SfxImageItem; }
SfxImageItem::SfxImageItem( sal_uInt16 which )
- : SfxInt16Item( which, 0 ), mnAngle(0), mbMirrored(false)
+ : SfxInt16Item( which, 0, SfxItemType::SfxImageItemType ), mnAngle(0), mbMirrored(false)
{
}
diff --git a/svl/source/items/int64item.cxx b/svl/source/items/int64item.cxx
index 06efd1fc9aca..644802edf9cc 100644
--- a/svl/source/items/int64item.cxx
+++ b/svl/source/items/int64item.cxx
@@ -10,7 +10,7 @@
#include <svl/int64item.hxx>
SfxInt64Item::SfxInt64Item( sal_uInt16 nWhich, sal_Int64 nVal ) :
- SfxPoolItem(nWhich), mnValue(nVal)
+ SfxPoolItem(nWhich, SfxItemType::SfxInt64ItemType), mnValue(nVal)
{
}
diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx
index 0ced3eb20146..9a56bdda68af 100644
--- a/svl/source/items/intitem.cxx
+++ b/svl/source/items/intitem.cxx
@@ -159,8 +159,8 @@ boost::property_tree::ptree SfxUInt32Item::dumpAsJSON() const
return aTree;
}
-SfxMetricItem::SfxMetricItem(sal_uInt16 which, sal_Int32 nValue):
- SfxInt32Item(which, nValue)
+SfxMetricItem::SfxMetricItem(sal_uInt16 which, sal_Int32 nValue,SfxItemType eItemType):
+ SfxInt32Item(which, nValue, eItemType)
{
}
diff --git a/svl/source/items/lckbitem.cxx b/svl/source/items/lckbitem.cxx
index 425e07fbb734..28aad1efa0b4 100644
--- a/svl/source/items/lckbitem.cxx
+++ b/svl/source/items/lckbitem.cxx
@@ -28,6 +28,7 @@ SfxPoolItem* SfxLockBytesItem::CreateDefault() { return new SfxLockBytesItem; }
SfxLockBytesItem::SfxLockBytesItem()
+ : SfxPoolItem(0, SfxItemType::SfxLockBytesItemType)
{
}
diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx
index bd4b62cb1419..491c30a7f50a 100644
--- a/svl/source/items/poolitem.cxx
+++ b/svl/source/items/poolitem.cxx
@@ -516,9 +516,10 @@ void DefaultItemInstanceManager::remove(const SfxPoolItem& rItem) { maRegistered
ItemInstanceManager* SfxPoolItem::getItemInstanceManager() const { return nullptr; }
-SfxPoolItem::SfxPoolItem(sal_uInt16 const nWhich)
+SfxPoolItem::SfxPoolItem(sal_uInt16 const nWhich, SfxItemType eType)
: m_nRefCount(0)
, m_nWhich(nWhich)
+ , m_eItemType(eType)
#ifdef DBG_UTIL
, m_nSerialNumber(nUsedSfxPoolItemCount)
#endif
@@ -550,11 +551,10 @@ SfxPoolItem::~SfxPoolItem()
bool SfxPoolItem::operator==(const SfxPoolItem& rCmp) const
{
- SAL_WARN_IF(typeid(rCmp) != typeid(*this), "svl",
+ SAL_WARN_IF(rCmp.ItemType() != ItemType(), "svl",
"comparing different pool item subclasses " << typeid(rCmp).name() << " && "
<< typeid(*this).name());
- assert(typeid(rCmp) == typeid(*this) && "comparing different pool item subclasses");
- (void)rCmp;
+ assert(rCmp.ItemType() == ItemType() && "comparing different pool item subclasses");
return true;
}
@@ -682,10 +682,8 @@ bool SfxPoolItem::areSame(const SfxPoolItem* pItem1, const SfxPoolItem* pItem2)
// WhichIDs differ (fast)
return false;
- if (typeid(*pItem1) != typeid(*pItem2))
+ if (pItem1->ItemType() != pItem2->ItemType())
// types differ (fast)
- // NOTE: we can now use typeid since we do not have (-1)
- // anymore for Invalid state -> safe
return false;
// return content compare using operator== at last
@@ -704,10 +702,8 @@ bool SfxPoolItem::areSame(const SfxPoolItem& rItem1, const SfxPoolItem& rItem2)
// WhichIDs differ (fast)
return false;
- if (typeid(rItem1) != typeid(rItem2))
+ if (rItem1.ItemType() != rItem2.ItemType())
// types differ (fast)
- // NOTE: we can now use typeid since we do not have (-1)
- // anymore for Invalid state -> safe
return false;
// return content compare using operator== at last
@@ -724,7 +720,11 @@ class InvalidOrDisabledItem final : public SfxPoolItem
public:
// make it StaticDefaultItem to process similar to these
// which is plausible (never change and are not allowed to)
- InvalidOrDisabledItem() { setStaticDefault(); }
+ InvalidOrDisabledItem()
+ : SfxPoolItem(0, SfxItemType::InvalidOrDisabledItemType)
+ {
+ setStaticDefault();
+ }
};
InvalidOrDisabledItem aInvalidItem;
InvalidOrDisabledItem aDisabledItem;
diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx
index 361cb4f4fc7d..71ac1205b682 100644
--- a/svl/source/items/ptitem.cxx
+++ b/svl/source/items/ptitem.cxx
@@ -35,12 +35,13 @@ SfxPoolItem* SfxPointItem::CreateDefault() { return new SfxPointItem; }
SfxPointItem::SfxPointItem()
+ : SfxPoolItem(0, SfxItemType::SfxPointItemType)
{
}
SfxPointItem::SfxPointItem( sal_uInt16 nW, const Point& rVal ) :
- SfxPoolItem( nW ),
+ SfxPoolItem( nW, SfxItemType::SfxPointItemType ),
aVal( rVal )
{
}
diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx
index f6a5db309d4b..cd9eecdf672a 100644
--- a/svl/source/items/rectitem.cxx
+++ b/svl/source/items/rectitem.cxx
@@ -31,12 +31,13 @@ SfxPoolItem* SfxRectangleItem::CreateDefault() { return new SfxRectangleItem; }
SfxRectangleItem::SfxRectangleItem()
+ : SfxPoolItem( 0, SfxItemType::SfxRectangleItemType )
{
}
SfxRectangleItem::SfxRectangleItem( sal_uInt16 nW, const tools::Rectangle& rVal ) :
- SfxPoolItem( nW ),
+ SfxPoolItem( nW, SfxItemType::SfxRectangleItemType ),
maVal( rVal )
{
}
diff --git a/svl/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx
index 89f7e642ed50..d7e6bff5cbb4 100644
--- a/svl/source/items/rngitem.cxx
+++ b/svl/source/items/rngitem.cxx
@@ -23,7 +23,7 @@
SfxRangeItem::SfxRangeItem( sal_uInt16 which, sal_uInt16 from, sal_uInt16 to ):
- SfxPoolItem( which ),
+ SfxPoolItem( which, SfxItemType::SfxRangeItemType ),
nFrom( from ),
nTo( to )
{
diff --git a/svl/source/items/sitem.cxx b/svl/source/items/sitem.cxx
index 037097f7bc3a..0e4499b55ab4 100644
--- a/svl/source/items/sitem.cxx
+++ b/svl/source/items/sitem.cxx
@@ -24,8 +24,9 @@
#include <svl/setitem.hxx>
#include <svl/poolitem.hxx>
-SfxSetItem::SfxSetItem( sal_uInt16 which, const SfxItemSet &rSet) :
- SfxPoolItem(which),
+SfxSetItem::SfxSetItem( sal_uInt16 which, const SfxItemSet &rSet,
+ SfxItemType eItemType) :
+ SfxPoolItem(which, eItemType),
maSet(rSet)
{
assert(!dynamic_cast<const SfxAllItemSet*>(&rSet) && "cannot handle SfxAllItemSet here");
@@ -33,8 +34,9 @@ SfxSetItem::SfxSetItem( sal_uInt16 which, const SfxItemSet &rSet) :
}
-SfxSetItem::SfxSetItem( sal_uInt16 which, SfxItemSet &&pS) :
- SfxPoolItem(which),
+SfxSetItem::SfxSetItem( sal_uInt16 which, SfxItemSet &&pS,
+ SfxItemType eItemType) :
+ SfxPoolItem(which, eItemType),
maSet(pS)
{
assert(!dynamic_cast<SfxAllItemSet*>(&pS) && "cannot handle SfxAllItemSet here");
diff --git a/svl/source/items/slstitm.cxx b/svl/source/items/slstitm.cxx
index 02784446ca52..1141784397b1 100644
--- a/svl/source/items/slstitm.cxx
+++ b/svl/source/items/slstitm.cxx
@@ -29,13 +29,14 @@
SfxPoolItem* SfxStringListItem::CreateDefault() { return new SfxStringListItem; }
-SfxStringListItem::SfxStringListItem()
+SfxStringListItem::SfxStringListItem() :
+ SfxPoolItem( 0, SfxItemType::SfxStringListItemType )
{
}
SfxStringListItem::SfxStringListItem( sal_uInt16 which, const std::vector<OUString>* pList ) :
- SfxPoolItem( which )
+ SfxPoolItem( which, SfxItemType::SfxStringListItemType )
{
// FIXME: Putting an empty list does not work
// Therefore the query after the count is commented out
diff --git a/svl/source/items/srchitem.cxx b/svl/source/items/srchitem.cxx
index 5f37d07b7674..1300d42b8b19 100644
--- a/svl/source/items/srchitem.cxx
+++ b/svl/source/items/srchitem.cxx
@@ -91,7 +91,7 @@ static Sequence< OUString > lcl_GetNotifyNames()
SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) :
- SfxPoolItem( nId ),
+ SfxPoolItem( nId, SfxItemType::SvxSearchItemType ),
ConfigItem( CFG_ROOT_NODE ),
m_aSearchOpt ( SearchFlags::LEV_RELAXED,
diff --git a/svl/source/items/voiditem.cxx b/svl/source/items/voiditem.cxx
index 2091359e7bb5..f62e693272c8 100644
--- a/svl/source/items/voiditem.cxx
+++ b/svl/source/items/voiditem.cxx
@@ -23,12 +23,12 @@
SfxPoolItem* SfxVoidItem::CreateDefault() { return new SfxVoidItem(0); }
SfxVoidItem::SfxVoidItem(sal_uInt16 which)
- : SfxPoolItem(which)
+ : SfxPoolItem(which, SfxItemType::SfxVoidItemType)
{
}
SfxVoidItem::SfxVoidItem(const SfxVoidItem& rCopy)
- : SfxPoolItem(rCopy.Which())
+ : SfxPoolItem(rCopy.Which(), SfxItemType::SfxVoidItemType)
{
}