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 /chart2/source | |
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 'chart2/source')
6 files changed, 19 insertions, 19 deletions
diff --git a/chart2/source/controller/dialogs/res_DataTableProperties.cxx b/chart2/source/controller/dialogs/res_DataTableProperties.cxx index bf87b3e6b9e3..327298e312d9 100644 --- a/chart2/source/controller/dialogs/res_DataTableProperties.cxx +++ b/chart2/source/controller/dialogs/res_DataTableProperties.cxx @@ -38,7 +38,7 @@ void DataTablePropertiesResources::initFromItemSet(const SfxItemSet& rInAttrs) SfxItemState aState; aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false, &pPoolItem); - if (aState == SfxItemState::DONTCARE) + if (aState == SfxItemState::INVALID) { m_xCbHorizontalBorder->set_state(TRISTATE_INDET); } @@ -50,7 +50,7 @@ void DataTablePropertiesResources::initFromItemSet(const SfxItemSet& rInAttrs) } aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false, &pPoolItem); - if (aState == SfxItemState::DONTCARE) + if (aState == SfxItemState::INVALID) { m_xCbVerticalBorder->set_state(TRISTATE_INDET); } @@ -61,7 +61,7 @@ void DataTablePropertiesResources::initFromItemSet(const SfxItemSet& rInAttrs) } aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_OUTLINE, false, &pPoolItem); - if (aState == SfxItemState::DONTCARE) + if (aState == SfxItemState::INVALID) { m_xCbOutilne->set_state(TRISTATE_INDET); } @@ -72,7 +72,7 @@ void DataTablePropertiesResources::initFromItemSet(const SfxItemSet& rInAttrs) } aState = rInAttrs.GetItemState(SCHATTR_DATA_TABLE_KEYS, false, &pPoolItem); - if (aState == SfxItemState::DONTCARE) + if (aState == SfxItemState::INVALID) { m_xCbKeys->set_state(TRISTATE_INDET); } diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx index 3eb875098b46..ae8e7cd28e2e 100644 --- a/chart2/source/controller/dialogs/res_ErrorBar.cxx +++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx @@ -475,7 +475,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) // category m_eErrorKind = SvxChartKindError::NONE; SfxItemState aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, true, &pPoolItem ); - m_bErrorKindUnique = ( aState != SfxItemState::DONTCARE ); + m_bErrorKindUnique = ( aState != SfxItemState::INVALID ); if( aState == SfxItemState::SET ) m_eErrorKind = static_cast<const SvxChartKindErrorItem*>(pPoolItem)->GetValue(); @@ -531,7 +531,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) // indicator aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, true, &pPoolItem ); - m_bIndicatorUnique = ( aState != SfxItemState::DONTCARE ); + m_bIndicatorUnique = ( aState != SfxItemState::INVALID ); if( aState == SfxItemState::SET) m_eIndicate = static_cast<const SvxChartIndicateItem *>(pPoolItem)->GetValue(); @@ -560,7 +560,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) // ranges aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, true, &pPoolItem ); - m_bRangePosUnique = ( aState != SfxItemState::DONTCARE ); + m_bRangePosUnique = ( aState != SfxItemState::INVALID ); if( aState == SfxItemState::SET ) { OUString sRangePositive = static_cast< const SfxStringItem * >( pPoolItem )->GetValue(); @@ -568,7 +568,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) } aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, true, &pPoolItem ); - m_bRangeNegUnique = ( aState != SfxItemState::DONTCARE ); + m_bRangeNegUnique = ( aState != SfxItemState::INVALID ); if( aState == SfxItemState::SET ) { OUString sRangeNegative = static_cast< const SfxStringItem * >( pPoolItem )->GetValue(); diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx index 58ef6497a538..3cbba1e59a28 100644 --- a/chart2/source/controller/dialogs/res_Trendline.cxx +++ b/chart2/source/controller/dialogs/res_Trendline.cxx @@ -156,7 +156,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs ) const SfxPoolItem* pPoolItem = nullptr; SfxItemState aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_TYPE, true, &pPoolItem ); - m_bTrendLineUnique = ( aState != SfxItemState::DONTCARE ); + m_bTrendLineUnique = ( aState != SfxItemState::INVALID ); if( aState == SfxItemState::SET ) { const SvxChartRegressItem * pItem = dynamic_cast< const SvxChartRegressItem * >( pPoolItem ); @@ -212,7 +212,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs ) lcl_setValue(*m_xFmtFld_InterceptValue, nValue); aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SET_INTERCEPT, true, &pPoolItem ); - if( aState == SfxItemState::DONTCARE ) + if( aState == SfxItemState::INVALID ) { m_xCB_SetIntercept->set_state(TRISTATE_INDET); } @@ -223,7 +223,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs ) } aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_EQUATION, true, &pPoolItem ); - if( aState == SfxItemState::DONTCARE ) + if( aState == SfxItemState::INVALID ) { m_xCB_ShowEquation->set_state(TRISTATE_INDET); } @@ -234,7 +234,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs ) } aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_COEFF, true, &pPoolItem ); - if( aState == SfxItemState::DONTCARE ) + if( aState == SfxItemState::INVALID ) { m_xCB_ShowCorrelationCoeff->set_state(TRISTATE_INDET); } diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx index 33faff6c5335..79976618341c 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx @@ -134,7 +134,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) // show description SfxItemState aState = rInAttrs->GetItemState( SCHATTR_AXIS_SHOWDESCR, false, &pPoolItem ); - if( aState == SfxItemState::DONTCARE ) + if( aState == SfxItemState::INVALID ) { m_xCbShowDescription->set_state( TRISTATE_INDET ); } @@ -157,7 +157,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) if( aState == SfxItemState::SET ) m_nInitialDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue(); - m_bHasInitialDegrees = aState != SfxItemState::DONTCARE; + m_bHasInitialDegrees = aState != SfxItemState::INVALID; if( m_bHasInitialDegrees ) m_xCtrlDial->SetRotation( m_nInitialDegrees ); else @@ -169,7 +169,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) if( aState == SfxItemState::SET ) m_bInitialStacking = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); - m_bHasInitialStacking = aState != SfxItemState::DONTCARE; + m_bHasInitialStacking = aState != SfxItemState::INVALID; if( m_bHasInitialDegrees ) m_xCbStacked->set_state(m_bInitialStacking ? TRISTATE_TRUE : TRISTATE_FALSE); else @@ -181,7 +181,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) // Text overlap ---------- aState = rInAttrs->GetItemState( SCHATTR_AXIS_LABEL_OVERLAP, false, &pPoolItem ); - if( aState == SfxItemState::DONTCARE ) + if( aState == SfxItemState::INVALID ) { m_xCbTextOverlap->set_state( TRISTATE_INDET ); } @@ -198,7 +198,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) // text break ---------- aState = rInAttrs->GetItemState( SCHATTR_AXIS_LABEL_BREAK, false, &pPoolItem ); - if( aState == SfxItemState::DONTCARE ) + if( aState == SfxItemState::INVALID ) { m_xCbTextBreak->set_state( TRISTATE_INDET ); } diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx index 4ef74c80a83b..3d4cf2abc309 100644 --- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx @@ -211,7 +211,7 @@ void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItem } } } - else if( nSourceItemState == SfxItemState::DONTCARE ) + else if( nSourceItemState == SfxItemState::INVALID ) rDestSet.InvalidateItem(nWhich); nWhich = aIter.NextWhich (); diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index 5a678ad7e594..0ecbf737994b 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -185,7 +185,7 @@ void DrawCommandDispatch::setLineEnds( SfxItemSet& rAttr ) pDrawViewWrapper->GetAttributes( aSet ); tools::Long nWidth = 300; // (1/100th mm) - if ( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE ) + if ( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::INVALID ) { tools::Long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue(); if ( nValue > 0 ) |