chart2/source/controller/dialogs/tp_ChartColorPalette.hxx | 2 ++ chart2/source/tools/ChartColorPaletteHelper.cxx | 12 ++++++------ include/svx/ChartColorPaletteType.hxx | 8 ++++---- include/svx/chrtitem.hxx | 5 ++++- svx/source/items/chrtitem.cxx | 4 ++-- 5 files changed, 18 insertions(+), 13 deletions(-)
New commits: commit 4ad60d39b9c57863f2460c4ee4da2b53796b5d39 Author: Marco Cecchetti <marco.cecche...@collabora.com> AuthorDate: Sun May 11 15:20:34 2025 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon May 12 08:56:41 2025 +0200 chart color palette: it fixes some minor issues Change-Id: Idf40fc5360b8551a2e7ac28d193157b7ae69f488 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185171 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/chart2/source/controller/dialogs/tp_ChartColorPalette.hxx b/chart2/source/controller/dialogs/tp_ChartColorPalette.hxx index 02cfe3cd5c94..53ea633585a6 100644 --- a/chart2/source/controller/dialogs/tp_ChartColorPalette.hxx +++ b/chart2/source/controller/dialogs/tp_ChartColorPalette.hxx @@ -27,6 +27,8 @@ namespace chart class ChartModel; class ChartColorPaletteHelper; +// This tab page is used to set up data series colors according to a given color palette +// It is present in the Chart Format Dialog for several chart elements. class ChartColorPaletteTabPage final : public SfxTabPage { public: diff --git a/chart2/source/tools/ChartColorPaletteHelper.cxx b/chart2/source/tools/ChartColorPaletteHelper.cxx index 9373bf242b70..b0a065d998b9 100644 --- a/chart2/source/tools/ChartColorPaletteHelper.cxx +++ b/chart2/source/tools/ChartColorPaletteHelper.cxx @@ -49,12 +49,12 @@ void ChartColorPaletteHelper::createBasePaletteFromTheme( { SAL_WARN("chart2", "ChartColorPaletteHelper::createBasePaletteFromTheme: no valid theme provided"); - mBasePalette[0] = Color::STRtoRGB(u"18A303"); - mBasePalette[1] = Color::STRtoRGB(u"0369A3"); - mBasePalette[2] = Color::STRtoRGB(u"A33E03"); - mBasePalette[3] = Color::STRtoRGB(u"8E03A3"); - mBasePalette[4] = Color::STRtoRGB(u"C99C00"); - mBasePalette[5] = Color::STRtoRGB(u"C9211E"); + mBasePalette[0] = 0x18A303; + mBasePalette[1] = 0x0369A3; + mBasePalette[2] = 0xA33E03; + mBasePalette[3] = 0x8E03A3; + mBasePalette[4] = 0xC99C00; + mBasePalette[5] = 0xC9211E; } } diff --git a/include/svx/ChartColorPaletteType.hxx b/include/svx/ChartColorPaletteType.hxx index 30f6844ee876..f87f395f8a20 100644 --- a/include/svx/ChartColorPaletteType.hxx +++ b/include/svx/ChartColorPaletteType.hxx @@ -20,11 +20,11 @@ constexpr size_t ChartColorPaletteSize = 6; typedef std::array<Color, ChartColorPaletteSize> ChartColorPalette; -enum class ChartColorPaletteType : sal_Int32 +enum class ChartColorPaletteType : sal_uInt8 { - Unknown = -1, - Colorful = 0, - Monochromatic = 1, + Unknown, + Colorful, + Monochromatic, }; struct ChartColorPaletteLayout diff --git a/include/svx/chrtitem.hxx b/include/svx/chrtitem.hxx index f999bd290c20..15a2a157296b 100644 --- a/include/svx/chrtitem.hxx +++ b/include/svx/chrtitem.hxx @@ -26,7 +26,7 @@ #include <svl/poolitem.hxx> #include <svx/svxdllapi.h> -enum class ChartColorPaletteType: sal_Int32; +enum class ChartColorPaletteType: sal_uInt8; class IntlWrapper; class SfxItemPool; @@ -154,6 +154,9 @@ public: double GetValue() const { return fVal; } }; +// This SfxPoolItem is used to represent a chart color palette. +// A chart color palette is uniquely determined by its type and an index. +// Chart color palettes depends on current color theme and are generated by ChartColorPaletteHelper. class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxChartColorPaletteItem final : public SfxPoolItem { ChartColorPaletteType meType; diff --git a/svx/source/items/chrtitem.cxx b/svx/source/items/chrtitem.cxx index 4dcab21c4c58..65ace20de387 100644 --- a/svx/source/items/chrtitem.cxx +++ b/svx/source/items/chrtitem.cxx @@ -207,7 +207,7 @@ bool SvxChartColorPaletteItem::QueryValue(uno::Any& rVal, const sal_uInt8 nMembe { if (nMemberId == MID_CHART_COLOR_PALETTE_TYPE) { - rVal <<= static_cast<sal_Int32>(meType); + rVal <<= static_cast<sal_uInt8>(meType); return true; } if (nMemberId == MID_CHART_COLOR_PALETTE_INDEX) @@ -222,7 +222,7 @@ bool SvxChartColorPaletteItem::PutValue(const uno::Any& rVal, const sal_uInt8 nM { if (nMemberId == MID_CHART_COLOR_PALETTE_TYPE) { - sal_Int32 nType = -1; + sal_uInt8 nType = 0; rVal >>= nType; meType = static_cast<ChartColorPaletteType>(nType); return true;