diff options
author | Armin Le Grand (Collabora) <Armin.Le.Grand@me.com> | 2025-03-10 15:20:17 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2025-03-10 17:12:37 +0100 |
commit | ec65a00298ffbb30869dec222887f42f3ca4533e (patch) | |
tree | fdb10dc536d83d747075e20cd652da17badaf681 /chart2/source/controller/itemsetwrapper | |
parent | 3a593bf6bb5e6a2696205e4ef6c712fe828b47cf (diff) |
tdf#165491 ITEM regression: Chart needs order of events
The Item with WhichID SCHATTR_STAT_KIND_ERROR *has* to be
handled 1st since it sets additional information about the
ErrorBarStyle at beans::XPropertySet xErrorBarProp that the
processing of the *other* Items already need access to, see
'case SCHATTR_STAT_KIND_ERROR' in
StatisticsItemConverter::ApplySpecialItem. This worked before
the change of SfxItemSet to use a std::unordered_set since
the order of Items was fix and - since SCHATTR_STAT_KIND_ERROR
had the lowest WhichID - was handled 1st. Not sure if that was
by purpose and it was known that this was necessary - there
are no comments hinting to that, so it might have worked by
coincidence before. In general it is bad style to rely on the
'order' of Items in an ItemSet - there is no order defined in
general.
Change-Id: I93e2c8e30f762e1bb83adb2b43459bbfb263a151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182742
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Tested-by: Jenkins
Diffstat (limited to 'chart2/source/controller/itemsetwrapper')
-rw-r--r-- | chart2/source/controller/itemsetwrapper/ItemConverter.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx index 3d4cf2abc309..1a4eebf91127 100644 --- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx @@ -28,6 +28,7 @@ #include <comphelper/diagnose_ex.hxx> #include <sal/log.hxx> #include <utility> +#include <chartview/ChartSfxItemIds.hxx> using namespace ::com::sun::star; @@ -156,8 +157,30 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) tPropertyNameWithMemberId aProperty; uno::Any aValue; + // tdf#165491 the Item with WhichID SCHATTR_STAT_KIND_ERROR *has* to + // be handled 1st since it sets additional information about the + // ErrorBarStyle at uno::Reference< beans::XPropertySet > xErrorBarProp + // that the processing of the *other* Items already need access to, + // see 'case SCHATTR_STAT_KIND_ERROR' in + // StatisticsItemConverter::ApplySpecialItem. This worked before the + // change of SfxItemSet to use a std::unordered_set since the order + // of Items was fix and - since SCHATTR_STAT_KIND_ERROR had the + // lowest WhichID - was handled 1st. Not sure if that was by purpose + // and it was known that this was necessary - there are no comments + // hinting to that. In general it is bad style to rely on the 'order' + // of Items being processed - there is no order defined in general. + { + const SfxPoolItem* pItem(nullptr); + if (SfxItemState::SET == rItemSet.GetItemState(SCHATTR_STAT_KIND_ERROR, false, &pItem)) + if(!GetItemProperty(pItem->Which(), aProperty)) + bItemsChanged = ApplySpecialItem(pItem->Which(), rItemSet); + } + for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem()) { + if (SCHATTR_STAT_KIND_ERROR == pItem->Which()) + continue; + if( aIter.GetItemState( false ) == SfxItemState::SET ) { if( GetItemProperty( pItem->Which(), aProperty )) |