summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2024-03-19 18:39:10 +0100
committerArmin Le Grand <Armin.Le.Grand@me.com>2024-03-21 21:39:57 +0100
commitd053413402956fecbcf65c9319ebbe2cd6c08dfa (patch)
tree4bafd4584551d8a36431a483fbd6e1161a94c14b /svl
parent1f912bdbf7848f8d4073be62ccb589927d60a95f (diff)
ITEM: Remove InvalidateAllItems()
I checked if this is used, but it can be replaced using Clear() -> all. This prevents that the whole array of Items in an ItemSet gets set to INVALID_POOL_ITEM. I also checked if INVALID_POOL_ITEM/IsInvalidItem is needed at all representing SfxItemState::DONTCARE but it is and still will need to be set for individual Items. At last checked if SfxItemState::UNKNOWN and ::DISABLED really need to be separate states, but indeed there are some rare cases that need that. To make things more consistent I also renamed SfxItemState::DONTCARE to SfxItemState::INVALID to better match Set/IsInvalid calls at ItemSet. The build showed a missing UT and led to a problem due to the hand-made ItemSet-like SearchAttrItemList. The state 'invalid' seems to be used as 'unused' marker. It should be changed to use SfxPoolItemHolder and not need that. For now, set by using an own loop to set to that state. Change-Id: Ifc51aad60570569a1e37d3084a5e307eed47d06c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165035 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/itemset.cxx26
1 files changed, 7 insertions, 19 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index a3efb65fe674..c9c7ceec3df1 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -480,7 +480,7 @@ SfxPoolItem const* implCreateItemEntry(SfxItemPool& rPool, SfxPoolItem const* pS
return nullptr;
// if (IsInvalidItem(pSource))
- // // SfxItemState::DONTCARE aka INVALID_POOL_ITEM
+ // // SfxItemState::INVALID aka INVALID_POOL_ITEM
// // just use pSource which equals INVALID_POOL_ITEM
// return pSource;
@@ -675,12 +675,12 @@ void implCleanupItemEntry(SfxPoolItem const* pSource)
return;
// if (IsInvalidItem(pSource))
- // // SfxItemState::DONTCARE aka INVALID_POOL_ITEM
+ // // SfxItemState::INVALID aka INVALID_POOL_ITEM
// // nothing to do for invalid item entries
// return;
// if (IsDisabledItem(pSource))
- // // SfxItemState::DONTCARE aka DISABLED_POOL_ITEM
+ // // SfxItemState::INVALID aka DISABLED_POOL_ITEM
// // nothing to do for disabled item entries
// return;
@@ -1005,18 +1005,6 @@ void SfxItemSet::ClearInvalidItems()
}
}
-void SfxItemSet::InvalidateAllItems()
-{
- // instead of just asserting, do the change. Clear all items
- ClearAllItemsImpl();
-
- // set all to invalid
- std::fill(begin(), begin() + TotalCount(), INVALID_POOL_ITEM);
-
- // ...and correct the count - invalid items get counted
- m_nCount = TotalCount();
-}
-
SfxItemState SfxItemSet::GetItemState_ForWhichID( SfxItemState eState, sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem) const
{
const sal_uInt16 nOffset(GetRanges().getOffsetFromWhich(nWhich));
@@ -1051,7 +1039,7 @@ SfxItemState SfxItemSet::GetItemState_ForOffset( sal_uInt16 nOffset, const SfxPo
if (IsInvalidItem(pCandidate))
// Different ones are present
- return SfxItemState::DONTCARE;
+ return SfxItemState::INVALID;
if (IsDisabledItem(pCandidate))
// Item is Disabled
@@ -1227,7 +1215,7 @@ bool SfxItemSet::Put(const SfxItemSet& rSource, bool bInvalidAsDefault)
*
* SfxItemState::SET: Hard set to the default of the Pool
* SfxItemState::DEFAULT: Deleted (0 pointer)
- * SfxItemState::DONTCARE: Invalid (-1 pointer)
+ * SfxItemState::INVALID: Invalid (-1 pointer)
*
* NB: All other values for 'eDontCareAs' and 'eDefaultAs' are invalid
*/
@@ -1260,7 +1248,7 @@ void SfxItemSet::PutExtended
ClearSingleItem_ForWhichID(nWhich);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
DisableOrInvalidateItem_ForWhichID(false, nWhich);
break;
@@ -1287,7 +1275,7 @@ void SfxItemSet::PutExtended
ClearSingleItem_ForWhichID(nWhich);
break;
- case SfxItemState::DONTCARE:
+ case SfxItemState::INVALID:
DisableOrInvalidateItem_ForWhichID(false, nWhich);
break;