diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2024-03-19 18:39:10 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2024-03-21 21:39:57 +0100 |
commit | d053413402956fecbcf65c9319ebbe2cd6c08dfa (patch) | |
tree | 4bafd4584551d8a36431a483fbd6e1161a94c14b /editeng | |
parent | 1f912bdbf7848f8d4073be62ccb589927d60a95f (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 'editeng')
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 2 | ||||
-rw-r--r-- | editeng/source/uno/unofored.cxx | 6 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 12 |
3 files changed, 10 insertions, 10 deletions
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index e4d4dd0bbfe6..f94bc2c7ea14 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -314,7 +314,7 @@ static void DbgOutItemSet(FILE* fp, const SfxItemSet& rSet, bool bSearchInParent fprintf( fp, "\nWhich: %i\t", nWhich ); if ( rSet.GetItemState( nWhich, bSearchInParent ) == SfxItemState::DEFAULT ) fprintf( fp, "ITEM_OFF " ); - else if ( rSet.GetItemState( nWhich, bSearchInParent ) == SfxItemState::DONTCARE ) + else if ( rSet.GetItemState( nWhich, bSearchInParent ) == SfxItemState::INVALID ) fprintf( fp, "ITEM_DC " ); else if ( rSet.GetItemState( nWhich, bSearchInParent ) == SfxItemState::SET ) fprintf( fp, "ITEM_ON *" ); diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index 66f4fde2bf78..fa2fa96118bf 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -228,7 +228,7 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES { // ... and its different to this one than the state is don't care if(*pParaItem != *(attrib.pAttr)) - return SfxItemState::DONTCARE; + return SfxItemState::INVALID; } else pParaItem = attrib.pAttr; @@ -248,7 +248,7 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES if( bEmpty ) eParaState = SfxItemState::DEFAULT; else if( bGaps ) - eParaState = SfxItemState::DONTCARE; + eParaState = SfxItemState::INVALID; else eParaState = SfxItemState::SET; @@ -256,7 +256,7 @@ SfxItemState GetSvxEditEngineItemState( EditEngine const & rEditEngine, const ES if( pLastItem ) { if( (pParaItem == nullptr) || (*pLastItem != *pParaItem) ) - return SfxItemState::DONTCARE; + return SfxItemState::INVALID; } else { diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index e8886bbe12b4..09a117d82123 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -990,8 +990,8 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert switch( eTempItemState ) { case SfxItemState::DISABLED: - case SfxItemState::DONTCARE: - eItemState = SfxItemState::DONTCARE; + case SfxItemState::INVALID: + eItemState = SfxItemState::INVALID; bItemStateSet = true; break; @@ -1043,7 +1043,7 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert { switch( eItemState ) { - case SfxItemState::DONTCARE: + case SfxItemState::INVALID: case SfxItemState::DISABLED: return beans::PropertyState_AMBIGUOUS_VALUE; case SfxItemState::SET: @@ -1123,8 +1123,8 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet& rSet, const Sf switch( eTempItemState ) { case SfxItemState::DISABLED: - case SfxItemState::DONTCARE: - eItemState = SfxItemState::DONTCARE; + case SfxItemState::INVALID: + eItemState = SfxItemState::INVALID; bItemStateSet = true; break; @@ -1237,7 +1237,7 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet& rSet, const Sf case SfxItemState::DEFAULT: rState = beans::PropertyState_DEFAULT_VALUE; break; -// case SfxItemState::DONTCARE: +// case SfxItemState::INVALID: // case SfxItemState::DISABLED: default: rState = beans::PropertyState_AMBIGUOUS_VALUE; |