summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-07-30 08:52:44 +0200
committerTomaž Vajngerl <quikee@gmail.com>2023-08-02 21:22:43 +0200
commitc8d8bf4282cbd04abacfa69ba2cc0fa4300e35e1 (patch)
tree270fcf114ac38a4d1b374b6837fa4cc6c9c5d649
parent2d96d69322ac18f53668b75397c8587f94cd043b (diff)
sc: theme color support for sparklines + ODF & OOXML import/export
This changes Sparkline colors to use complex colors instead and adds Sparkline theme color import and export support for ODF and OOXML. Change-Id: I58edd525d50f95199bd4fe7825afb51aaa7fc091 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155113 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--include/docmodel/color/ComplexColor.hxx7
-rw-r--r--include/oox/export/ColorExportUtils.hxx44
-rw-r--r--include/xmloff/XMLComplexColorContext.hxx45
-rw-r--r--include/xmloff/XMLComplexColorExport.hxx11
-rw-r--r--include/xmloff/xmltoken.hxx14
-rw-r--r--oox/Library_oox.mk1
-rw-r--r--oox/source/drawingml/color.cxx7
-rw-r--r--oox/source/export/ColorExportUtils.cxx55
-rw-r--r--sc/CppunitTest_sc_sparkline_test.mk1
-rw-r--r--sc/CppunitTest_sc_ucalc_sparkline.mk3
-rw-r--r--sc/Library_scfilt.mk1
-rw-r--r--sc/inc/SparklineAttributes.hxx35
-rw-r--r--sc/qa/unit/SparklineImportExportTest.cxx92
-rw-r--r--sc/qa/unit/data/fods/Sparklines.fods590
-rw-r--r--sc/qa/unit/ucalc_sparkline.cxx120
-rw-r--r--sc/source/filter/excel/export/ExportTools.cxx45
-rw-r--r--sc/source/filter/excel/export/SparklineExt.cxx60
-rw-r--r--sc/source/filter/excel/xestyle.cxx1
-rw-r--r--sc/source/filter/inc/export/ExportTools.hxx21
-rw-r--r--sc/source/filter/oox/SparklineFragment.cxx35
-rw-r--r--sc/source/filter/xml/SparklineGroupsExport.cxx32
-rw-r--r--sc/source/filter/xml/SparklineGroupsExport.hxx9
-rw-r--r--sc/source/filter/xml/SparklineGroupsImportContext.cxx126
-rw-r--r--sc/source/filter/xml/SparklineGroupsImportContext.hxx19
-rw-r--r--sc/source/filter/xml/xmlstyli.cxx2
-rw-r--r--sc/source/ui/dialogs/SparklineDialog.cxx28
-rw-r--r--sc/source/ui/inc/SparklineRenderer.hxx42
-rw-r--r--sc/source/ui/sparklines/SparklineAttributes.cxx126
-rw-r--r--sc/source/ui/theme/ThemeColorChanger.cxx50
-rw-r--r--schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng87
-rw-r--r--xmloff/source/core/xmltoken.cxx14
-rw-r--r--xmloff/source/draw/XMLShapePropertySetContext.cxx2
-rw-r--r--xmloff/source/style/StylePropertiesContext.cxx3
-rw-r--r--xmloff/source/text/XMLComplexColorContext.cxx69
-rw-r--r--xmloff/source/text/XMLComplexColorExport.cxx35
-rw-r--r--xmloff/source/text/XMLTextPropertySetContext.cxx2
-rw-r--r--xmloff/source/text/XMLTextShapeStyleContext.cxx2
-rw-r--r--xmloff/source/token/tokens.txt14
38 files changed, 1515 insertions, 335 deletions
diff --git a/include/docmodel/color/ComplexColor.hxx b/include/docmodel/color/ComplexColor.hxx
index e9597b15186b..88ff7a42a478 100644
--- a/include/docmodel/color/ComplexColor.hxx
+++ b/include/docmodel/color/ComplexColor.hxx
@@ -246,6 +246,13 @@ public:
o3tl::hash_combine(seed, sal_uInt32(maFinalColor));
return seed;
}
+
+ static model::ComplexColor RGB(Color const& rColor)
+ {
+ model::ComplexColor aComplexColor;
+ aComplexColor.setColor(rColor);
+ return aComplexColor;
+ }
};
} // end of namespace svx
diff --git a/include/oox/export/ColorExportUtils.hxx b/include/oox/export/ColorExportUtils.hxx
index 63716a10839d..f9dafe260b46 100644
--- a/include/oox/export/ColorExportUtils.hxx
+++ b/include/oox/export/ColorExportUtils.hxx
@@ -9,47 +9,21 @@
#pragma once
-#include <sal/config.h>
+#include <oox/dllapi.h>
-#include <docmodel/color/ComplexColor.hxx>
-
-namespace oox
+namespace model
{
-static double convertColorTransformsToTintOrShade(model::ComplexColor const& rComplexColor)
+class ComplexColor;
+}
+namespace model
{
- sal_Int16 nLumMod = 10'000;
- sal_Int16 nLumOff = 0;
-
- for (auto const& rTransform : rComplexColor.getTransformations())
- {
- if (rTransform.meType == model::TransformationType::LumMod)
- nLumMod = rTransform.mnValue;
- if (rTransform.meType == model::TransformationType::LumOff)
- nLumOff = rTransform.mnValue;
- }
-
- if (nLumMod == 10'000 && nLumOff == 0)
- return 0.0;
-
- double fTint = 0.0;
-
- if (nLumOff > 0) // tint
- fTint = double(nLumOff) / 10'000.0;
- else
- fTint = -double(10'000 - nLumMod) / 10'000.0;
-
- return fTint;
+enum class ThemeColorType : sal_Int32;
}
-static sal_Int32 convertThemeColorTypeToExcelThemeNumber(model::ThemeColorType eType)
+namespace oox
{
- if (eType == model::ThemeColorType::Unknown)
- return -1;
-
- constexpr std::array<sal_Int32, 12> constMap = { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11 };
-
- return constMap[sal_Int32(eType)];
-}
+OOX_DLLPUBLIC double convertColorTransformsToTintOrShade(model::ComplexColor const& rComplexColor);
+OOX_DLLPUBLIC sal_Int32 convertThemeColorTypeToExcelThemeNumber(model::ThemeColorType eType);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLComplexColorContext.hxx b/include/xmloff/XMLComplexColorContext.hxx
index cbb785994169..5654cc204206 100644
--- a/include/xmloff/XMLComplexColorContext.hxx
+++ b/include/xmloff/XMLComplexColorContext.hxx
@@ -10,25 +10,60 @@
#pragma once
#include <xmloff/dllapi.h>
+
#include <memory>
#include <xmloff/XMLElementPropertyContext.hxx>
-#include <docmodel/uno/UnoComplexColor.hxx>
+#include <xmloff/xmlictxt.hxx>
+#include <docmodel/color/ComplexColor.hxx>
-class XMLOFF_DLLPUBLIC XMLComplexColorContext final : public XMLElementPropertyContext
+class XMLOFF_DLLPUBLIC XMLComplexColorImport
{
+private:
+ model::ComplexColor& mrComplexColor;
+
+public:
+ XMLComplexColorImport(model::ComplexColor& rComplexColor);
+ void fillAttributes(const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList);
+ bool
+ handleTransformContext(sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList);
+};
+
+class XMLOFF_DLLPUBLIC XMLPropertyComplexColorContext final : public XMLElementPropertyContext
+{
+private:
model::ComplexColor maComplexColor;
sal_Int32 mnRootElement;
+ XMLComplexColorImport maComplexColorImport;
+
public:
- XMLComplexColorContext(SvXMLImport& rImport, sal_Int32 nElement,
- const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
- const XMLPropertyState& rProp, std::vector<XMLPropertyState>& rProps);
+ XMLPropertyComplexColorContext(
+ SvXMLImport& rImport, sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList,
+ const XMLPropertyState& rProp, std::vector<XMLPropertyState>& rProps);
css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
sal_Int32 nElement,
const css::uno::Reference<css::xml::sax::XFastAttributeList>& AttrList) override;
void SAL_CALL endFastElement(sal_Int32 nElement) override;
+
+ model::ComplexColor getComplexColor() { return maComplexColor; }
+};
+
+class XMLOFF_DLLPUBLIC XMLComplexColorContext final : public SvXMLImportContext
+{
+private:
+ XMLComplexColorImport maComplexColorImport;
+
+public:
+ XMLComplexColorContext(SvXMLImport& rImport, model::ComplexColor& rComplexColor,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList);
+
+ css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext(
+ sal_Int32 nElement,
+ const css::uno::Reference<css::xml::sax::XFastAttributeList>& AttrList) override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/xmloff/XMLComplexColorExport.hxx b/include/xmloff/XMLComplexColorExport.hxx
index 28911737ff89..51425f52ab55 100644
--- a/include/xmloff/XMLComplexColorExport.hxx
+++ b/include/xmloff/XMLComplexColorExport.hxx
@@ -11,20 +11,31 @@
#include <xmloff/dllapi.h>
#include <sal/types.h>
#include <rtl/ustring.hxx>
+#include <xmloff/xmltoken.hxx>
namespace com::sun::star::uno
{
class Any;
}
+namespace model
+{
+class ComplexColor;
+}
+
class SvXMLExport;
class XMLOFF_DLLPUBLIC XMLComplexColorExport
{
SvXMLExport& mrExport;
+ void doExport(model::ComplexColor const& rComplexColor, sal_uInt16 nPrefix,
+ const OUString& rLocalName);
+
public:
XMLComplexColorExport(SvXMLExport& rExport);
+ void exportComplexColor(model::ComplexColor const& rComplexColor, sal_uInt16 nPrefix,
+ xmloff::token::XMLTokenEnum nToken);
void exportXML(const css::uno::Any& rAny, sal_uInt16 nPrefix, const OUString& rLocalName);
};
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 5c929137cad6..1806178b12d6 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1800,10 +1800,18 @@ namespace xmloff::token {
XML_SOURCE_RANGE_ADDRESS,
XML_SOURCE_SERVICE,
XML_SPACE_BEFORE,
- XML_SPARKLINE_GROUPS,
- XML_SPARKLINE_GROUP,
- XML_SPARKLINES,
XML_SPARKLINE,
+ XML_SPARKLINES,
+ XML_SPARKLINE_AXIS_COMPLEX_COLOR,
+ XML_SPARKLINE_FIRST_COMPLEX_COLOR,
+ XML_SPARKLINE_GROUP,
+ XML_SPARKLINE_GROUPS,
+ XML_SPARKLINE_HIGH_COMPLEX_COLOR,
+ XML_SPARKLINE_LAST_COMPLEX_COLOR,
+ XML_SPARKLINE_LOW_COMPLEX_COLOR,
+ XML_SPARKLINE_MARKERS_COMPLEX_COLOR,
+ XML_SPARKLINE_NEGATIVE_COMPLEX_COLOR,
+ XML_SPARKLINE_SERIES_COMPLEX_COLOR,
XML_SPAN,
XML_SPECULAR,
XML_SPECULAR_COLOR,
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index 3bf2d607918c..e37df6a393b9 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -228,6 +228,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
oox/source/dump/oledumper \
oox/source/dump/pptxdumper \
oox/source/export/ColorPropertySet \
+ oox/source/export/ColorExportUtils \
oox/source/export/drawingml \
oox/source/export/DMLPresetShapeExport \
oox/source/export/shapes \
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 1ed2e57b6242..e582d4e53c77 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -825,9 +825,14 @@ model::ComplexColor Color::createComplexColor(const GraphicHelper& /*rGraphicHel
auto eTheme = getThemeColorType();
aNewComplexColor.setSchemeColor(eTheme);
}
+ else if (meMode == COLOR_RGB)
+ {
+ ::Color aColor(ColorTransparency, lclRgbComponentsToRgb(mnC1, mnC2, mnC3));
+ aNewComplexColor = model::ComplexColor::RGB(aColor);
+ }
else
{
- // TODO
+ // TODO - Add other options
return aNewComplexColor;
}
diff --git a/oox/source/export/ColorExportUtils.cxx b/oox/source/export/ColorExportUtils.cxx
new file mode 100644
index 000000000000..2b9f7baabc53
--- /dev/null
+++ b/oox/source/export/ColorExportUtils.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+#include <array>
+#include <oox/export/ColorExportUtils.hxx>
+#include <docmodel/color/ComplexColor.hxx>
+
+namespace oox
+{
+double convertColorTransformsToTintOrShade(model::ComplexColor const& rComplexColor)
+{
+ sal_Int16 nLumMod = 10'000;
+ sal_Int16 nLumOff = 0;
+
+ for (auto const& rTransform : rComplexColor.getTransformations())
+ {
+ if (rTransform.meType == model::TransformationType::LumMod)
+ nLumMod = rTransform.mnValue;
+ if (rTransform.meType == model::TransformationType::LumOff)
+ nLumOff = rTransform.mnValue;
+ }
+
+ if (nLumMod == 10'000 && nLumOff == 0)
+ return 0.0;
+
+ double fTint = 0.0;
+
+ if (nLumOff > 0) // tint
+ fTint = double(nLumOff) / 10'000.0;
+ else
+ fTint = -double(10'000 - nLumMod) / 10'000.0;
+
+ return fTint;
+}
+
+sal_Int32 convertThemeColorTypeToExcelThemeNumber(model::ThemeColorType eType)
+{
+ if (eType == model::ThemeColorType::Unknown)
+ return -1;
+
+ static constexpr std::array<sal_Int32, 12> constThemeColorMapToXmlMap
+ = { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11 };
+
+ return constThemeColorMapToXmlMap[sal_Int32(eType)];
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/CppunitTest_sc_sparkline_test.mk b/sc/CppunitTest_sc_sparkline_test.mk
index ca678f4829d8..c1f06f65e3d2 100644
--- a/sc/CppunitTest_sc_sparkline_test.mk
+++ b/sc/CppunitTest_sc_sparkline_test.mk
@@ -28,6 +28,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_sparkline_test, \
comphelper \
cppu \
cppuhelper \
+ docmodel \
sal \
salhelper \
sax \
diff --git a/sc/CppunitTest_sc_ucalc_sparkline.mk b/sc/CppunitTest_sc_ucalc_sparkline.mk
index 99f75e086fc0..24d24b99ee4e 100644
--- a/sc/CppunitTest_sc_ucalc_sparkline.mk
+++ b/sc/CppunitTest_sc_ucalc_sparkline.mk
@@ -28,12 +28,15 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_ucalc_sparkline, \
comphelper \
cppu \
cppuhelper \
+ docmodel \
+ editeng \
sal \
salhelper \
sax \
sc \
scqahelper \
sfx \
+ svxcore \
subsequenttest \
test \
tl \
diff --git a/sc/Library_scfilt.mk b/sc/Library_scfilt.mk
index 5837f1ec3492..7b345b85e0f5 100644
--- a/sc/Library_scfilt.mk
+++ b/sc/Library_scfilt.mk
@@ -133,6 +133,7 @@ $(eval $(call gb_Library_add_exception_objects,scfilt,\
sc/source/filter/excel/xltracer \
sc/source/filter/excel/xlview \
sc/source/filter/excel/export/SparklineExt \
+ sc/source/filter/excel/export/ExportTools \
sc/source/filter/ftools/fapihelper \
sc/source/filter/ftools/fprogressbar \
sc/source/filter/ftools/ftools \
diff --git a/sc/inc/SparklineAttributes.hxx b/sc/inc/SparklineAttributes.hxx
index d1baf732ced3..04a6c0abb696 100644
--- a/sc/inc/SparklineAttributes.hxx
+++ b/sc/inc/SparklineAttributes.hxx
@@ -13,6 +13,7 @@
#include "scdllapi.h"
#include <sal/types.h>
#include <tools/color.hxx>
+#include <docmodel/color/ComplexColor.hxx>
#include <optional>
#include <o3tl/cow_wrapper.hxx>
@@ -63,29 +64,31 @@ public:
return !(SparklineAttributes::operator==(rOther));
}
- Color getColorSeries() const;
- void setColorSeries(Color aColorSeries);
+ void resetColors();
- Color getColorNegative() const;
- void setColorNegative(Color aColorSeries);
+ model::ComplexColor getColorSeries() const;
+ void setColorSeries(model::ComplexColor const& rColorSeries);
- Color getColorAxis() const;
- void setColorAxis(Color aColorSeries);
+ model::ComplexColor getColorNegative() const;
+ void setColorNegative(model::ComplexColor const& rColorSeries);
- Color getColorMarkers() const;
- void setColorMarkers(Color aColorSeries);
+ model::ComplexColor getColorAxis() const;
+ void setColorAxis(model::ComplexColor const& rColorSeries);
- Color getColorFirst() const;
- void setColorFirst(Color aColorSeries);
+ model::ComplexColor getColorMarkers() const;
+ void setColorMarkers(model::ComplexColor const& rColorSeries);
- Color getColorLast() const;
- void setColorLast(Color aColorSeries);
+ model::ComplexColor getColorFirst() const;
+ void setColorFirst(model::ComplexColor const& rColorSeries);
- Color getColorHigh() const;
- void setColorHigh(Color aColorSeries);
+ model::ComplexColor getColorLast() const;
+ void setColorLast(model::ComplexColor const& rColorSeries);
- Color getColorLow() const;
- void setColorLow(Color aColorSeries);
+ model::ComplexColor getColorHigh() const;
+ void setColorHigh(model::ComplexColor const& rColorSeries);
+
+ model::ComplexColor getColorLow() const;
+ void setColorLow(model::ComplexColor const& rColorSeries);
AxisType getMinAxisType() const;
void setMinAxisType(AxisType eAxisType);
diff --git a/sc/qa/unit/SparklineImportExportTest.cxx b/sc/qa/unit/SparklineImportExportTest.cxx
index 46e5bda43377..7462a6df0e11 100644
--- a/sc/qa/unit/SparklineImportExportTest.cxx
+++ b/sc/qa/unit/SparklineImportExportTest.cxx
@@ -30,12 +30,16 @@ public:
void testSparklinesExportODS();
void testSparklinesRoundtripODS();
void testNoSparklinesInDocumentXLSX();
+ void testSparklinesRoundtripThemeColorsODS();
+ void testSparklinesRoundtripThemeColorsOOXML();
CPPUNIT_TEST_SUITE(SparklineImportExportTest);
CPPUNIT_TEST(testSparklinesRoundtripXLSX);
CPPUNIT_TEST(testSparklinesExportODS);
CPPUNIT_TEST(testSparklinesRoundtripODS);
CPPUNIT_TEST(testNoSparklinesInDocumentXLSX);
+ CPPUNIT_TEST(testSparklinesRoundtripThemeColorsODS);
+ CPPUNIT_TEST(testSparklinesRoundtripThemeColorsOOXML);
CPPUNIT_TEST_SUITE_END();
};
@@ -53,14 +57,14 @@ void checkSparklines(ScDocument& rDocument)
auto& rAttributes = pSparkline->getSparklineGroup()->getAttributes();
CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Line, rAttributes.getType());
- CPPUNIT_ASSERT_EQUAL(Color(0x376092), rAttributes.getColorSeries());
- CPPUNIT_ASSERT_EQUAL(Color(0x00b050), rAttributes.getColorNegative());
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, rAttributes.getColorAxis());
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, rAttributes.getColorMarkers());
- CPPUNIT_ASSERT_EQUAL(Color(0x7030a0), rAttributes.getColorFirst());
- CPPUNIT_ASSERT_EQUAL(Color(0xff0000), rAttributes.getColorLast());
- CPPUNIT_ASSERT_EQUAL(Color(0x92d050), rAttributes.getColorHigh());
- CPPUNIT_ASSERT_EQUAL(Color(0x00b0f0), rAttributes.getColorLow());
+ CPPUNIT_ASSERT_EQUAL(Color(0x376092), rAttributes.getColorSeries().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x00b050), rAttributes.getColorNegative().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, rAttributes.getColorAxis().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, rAttributes.getColorMarkers().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x7030a0), rAttributes.getColorFirst().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0xff0000), rAttributes.getColorLast().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x92d050), rAttributes.getColorHigh().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x00b0f0), rAttributes.getColorLow().getFinalColor());
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.0, rAttributes.getLineWeight(), 1E-2);
CPPUNIT_ASSERT_EQUAL(false, rAttributes.isDateAxis());
@@ -86,14 +90,14 @@ void checkSparklines(ScDocument& rDocument)
auto& rAttributes = pSparkline->getSparklineGroup()->getAttributes();
CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Column, rAttributes.getType());
- CPPUNIT_ASSERT_EQUAL(Color(0x376092), rAttributes.getColorSeries());
- CPPUNIT_ASSERT_EQUAL(Color(0xff0000), rAttributes.getColorNegative());
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, rAttributes.getColorAxis());
- CPPUNIT_ASSERT_EQUAL(Color(0xd00000), rAttributes.getColorMarkers());
- CPPUNIT_ASSERT_EQUAL(Color(0x92d050), rAttributes.getColorFirst());
- CPPUNIT_ASSERT_EQUAL(Color(0x00b0f0), rAttributes.getColorLast());
- CPPUNIT_ASSERT_EQUAL(Color(0x7030a0), rAttributes.getColorHigh());
- CPPUNIT_ASSERT_EQUAL(Color(0xffc000), rAttributes.getColorLow());
+ CPPUNIT_ASSERT_EQUAL(Color(0x376092), rAttributes.getColorSeries().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0xff0000), rAttributes.getColorNegative().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK, rAttributes.getColorAxis().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0xd00000), rAttributes.getColorMarkers().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x92d050), rAttributes.getColorFirst().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x00b0f0), rAttributes.getColorLast().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x7030a0), rAttributes.getColorHigh().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0xffc000), rAttributes.getColorLow().getFinalColor());
CPPUNIT_ASSERT_EQUAL(0.75, rAttributes.getLineWeight());
CPPUNIT_ASSERT_EQUAL(false, rAttributes.isDateAxis());
@@ -223,7 +227,7 @@ void SparklineImportExportTest::testSparklinesRoundtripODS()
void SparklineImportExportTest::testNoSparklinesInDocumentXLSX()
{
// tdf#148835
- // Check no sparkline elements are written when there is none in the document
+ // Check no sparkline elements are written when there are none in the document
// Load the document containing NO sparklines
loadFromURL(u"xlsx/empty.xlsx");
@@ -238,6 +242,60 @@ void SparklineImportExportTest::testNoSparklinesInDocumentXLSX()
assertXPath(pXmlDoc, "/x:worksheet/x:extLst", 0);
}
+namespace
+{
+void checkSparklineThemeColors(ScDocument& rDocument)
+{
+ auto pSparkline = rDocument.GetSparkline(ScAddress(0, 1, 0)); // A2
+ CPPUNIT_ASSERT(pSparkline);
+ CPPUNIT_ASSERT_EQUAL(OString("{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}"),
+ pSparkline->getSparklineGroup()->getID().getString());
+
+ auto& rAttributes = pSparkline->getSparklineGroup()->getAttributes();
+ CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Column, rAttributes.getType());
+
+ CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3,
+ rAttributes.getColorSeries().getSchemeType());
+ CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent6,
+ rAttributes.getColorNegative().getSchemeType());
+ CPPUNIT_ASSERT_EQUAL(model::ColorType::Unused, rAttributes.getColorAxis().getType());
+ CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Light1,
+ rAttributes.getColorMarkers().getSchemeType());
+ CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent5,
+ rAttributes.getColorFirst().getSchemeType());
+ CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2,
+ rAttributes.getColorLast().getSchemeType());
+ CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1,
+ rAttributes.getColorHigh().getSchemeType());
+ CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent4, rAttributes.getColorLow().getSchemeType());
+}
+} // end anonymous namespace
+
+void SparklineImportExportTest::testSparklinesRoundtripThemeColorsODS()
+{
+ loadFromURL(u"fods/Sparklines.fods");
+
+ ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent);
+ CPPUNIT_ASSERT(pModelObj);
+ checkSparklineThemeColors(*pModelObj->GetDocument());
+
+ saveAndReload("calc8");
+
+ pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent);
+ CPPUNIT_ASSERT(pModelObj);
+ checkSparklineThemeColors(*pModelObj->GetDocument());
+}
+
+void SparklineImportExportTest::testSparklinesRoundtripThemeColorsOOXML()
+{
+ loadFromURL(u"fods/Sparklines.fods");
+ saveAndReload("Calc Office Open XML");
+
+ ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent);
+ CPPUNIT_ASSERT(pModelObj);
+ checkSparklineThemeColors(*pModelObj->GetDocument());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SparklineImportExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/qa/unit/data/fods/Sparklines.fods b/sc/qa/unit/data/fods/Sparklines.fods
new file mode 100644
index 000000000000..b952471b5550
--- /dev/null
+++ b/sc/qa/unit/data/fods/Sparklines.fods
@@ -0,0 +1,590 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
+ <office:meta><meta:initial-creator>quikee</meta:initial-creator><meta:creation-date>2022-02-23T12:01:27</meta:creation-date><dc:date>2023-07-30T09:09:00.836498837</dc:date><meta:generator>LibreOfficeDev/24.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/392723e6d33455e375b469a6eabfc843cc311599</meta:generator><meta:editing-duration>PT3M20S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="1" meta:cell-count="12" meta:object-count="0"/><meta:user-defined meta:name="AppVersion">16.0300</meta:user-defined></office:meta>
+ <office:settings>
+ <config:config-item-set config:name="ooo:view-settings">
+ <config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="VisibleAreaWidth" config:type="int">27824</config:config-item>
+ <config:config-item config:name="VisibleAreaHeight" config:type="int">4445</config:config-item>
+ <config:config-item-map-indexed config:name="Views">
+ <config:config-item-map-entry>
+ <config:config-item config:name="ViewId" config:type="string">view1</config:config-item>
+ <config:config-item-map-named config:name="Tables">
+ <config:config-item-map-entry config:name="Sheet1">
+ <config:config-item config:name="CursorPositionX" config:type="int">0</config:config-item>
+ <config:config-item config:name="CursorPositionY" config:type="int">1</config:config-item>
+ <config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item>
+ <config:config-item config:name="PositionLeft" config:type="int">0</config:config-item>
+ <config:config-item config:name="PositionRight" config:type="int">0</config:config-item>
+ <config:config-item config:name="PositionTop" config:type="int">0</config:config-item>
+ <config:config-item config:name="PositionBottom" config:type="int">0</config:config-item>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ <config:config-item config:name="ZoomValue" config:type="int">100</config:config-item>
+ <config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item>
+ <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-named>
+ <config:config-item config:name="ActiveTable" config:type="string">Sheet1</config:config-item>
+ <config:config-item config:name="HorizontalScrollbarWidth" config:type="int">1744</config:config-item>
+ <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+ <config:config-item config:name="ZoomValue" config:type="int">100</config:config-item>
+ <config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item>
+ <config:config-item config:name="ShowPageBreakPreview" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ShowFormulasMarks" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="GridColor" config:type="int">-1</config:config-item>
+ <config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="FormulaBarHeight" config:type="short">1</config:config-item>
+ <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsValueHighlightingEnabled" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="RasterResolutionX" config:type="int">1000</config:config-item>
+ <config:config-item config:name="RasterResolutionY" config:type="int">1000</config:config-item>
+ <config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item>
+ <config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item>
+ <config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item>
+ </config:config-item-map-entry>
+ </config:config-item-map-indexed>
+ </config:config-item-set>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="AutoCalculate" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
+ <config:config-item config:name="EmbedAsianScriptFonts" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="EmbedComplexScriptFonts" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="EmbedLatinScriptFonts" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="EmbedOnlyUsedFonts" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="GridColor" config:type="int">-1</config:config-item>
+ <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ImagePreferredDPI" config:type="int">0</config:config-item>
+ <config:config-item config:name="IsDocumentShared" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="LinkUpdateMode" config:type="short">3</config:config-item>
+ <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrinterName" config:type="string"/>
+ <config:config-item config:name="PrinterPaperFromSetup" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
+ <config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="RasterResolutionX" config:type="int">1000</config:config-item>
+ <config:config-item config:name="RasterResolutionY" config:type="int">1000</config:config-item>
+ <config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item>
+ <config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item>
+ <config:config-item config:name="SaveThumbnail" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowFormulasMarks" config:type="boolean">false</config:config-item>
+ <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="SyntaxStringRef" config:type="short">2</config:config-item>
+ <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
+ </config:config-item-set>
+ </office:settings>
+ <office:scripts>
+ <office:script script:language="ooo:Basic">
+ <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/>
+ </office:script>
+ </office:scripts>
+ <office:font-face-decls>
+ <style:font-face style:name="Calibri" svg:font-family="Calibri" style:font-family-generic="swiss"/>
+ <style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ <style:font-face style:name="Lohit Devanagari" svg:font-family="&apos;Lohit Devanagari&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Source Han Sans CN" svg:font-family="&apos;Source Han Sans CN&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="table-cell">
+ <style:paragraph-properties style:tab-stop-distance="1.25cm"/>
+ <style:text-properties style:font-name="Liberation Sans" fo:font-size="10pt" fo:language="en" fo:country="GB" style:font-name-asian="Source Han Sans CN" style:font-size-asian="10pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="10pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" style:writing-mode="page"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:punctuation-wrap="simple" style:line-break="strict" style:writing-mode="page" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" fo:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="12pt" fo:language="en" fo:country="GB" style:letter-kerning="true" style:font-family-asian="&apos;DejaVu Sans&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="12pt" style:language-asian="zh" style:country-asian="CN" style:font-family-complex="&apos;Bitstream Vera Sans&apos;" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:style style:name="Default" style:family="graphic"/>
+ <style:style style:name="Note" style:family="graphic" style:parent-style-name="Default">
+ <style:graphic-properties draw:stroke="solid" draw:marker-start="Arrowheads_20_1" draw:marker-start-width="0.2cm" draw:marker-start-center="false" draw:fill="solid" draw:fill-color="#ffffc0" draw:auto-grow-height="true" draw:auto-grow-width="false" fo:padding-top="0.1cm" fo:padding-bottom="0.1cm" fo:padding-left="0.1cm" fo:padding-right="0.1cm" draw:shadow="visible" draw:shadow-offset-x="0.1cm" draw:shadow-offset-y="0.1cm"/>
+ <style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="10pt" style:font-name-asian="Source Han Sans CN" style:font-family-asian="&apos;Source Han Sans CN&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="10pt" style:font-name-complex="Lohit Devanagari" style:font-family-complex="&apos;Lohit Devanagari&apos;" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="10pt"/>
+ </style:style>
+ <number:number-style style:name="N0">
+ <number:number number:min-integer-digits="1"/>
+ </number:number-style>
+ <number:date-style style:name="N119">
+ <number:day number:style="long"/>
+ <number:text>-</number:text>
+ <number:month number:textual="true"/>
+ <number:text>-</number:text>
+ <number:year/>
+ </number:date-style>
+ <number:date-style style:name="N120">
+ <number:day number:style="long"/>
+ <number:text>-</number:text>
+ <number:month number:textual="true"/>
+ </number:date-style>
+ <number:date-style style:name="N121">
+ <number:month number:textual="true"/>
+ <number:text>-</number:text>
+ <number:year/>
+ </number:date-style>
+ <number:time-style style:name="N122">
+ <number:hours/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ <number:text> </number:text>
+ <number:am-pm/>
+ </number:time-style>
+ <number:time-style style:name="N123">
+ <number:hours/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ <number:text>:</number:text>
+ <number:seconds number:style="long"/>
+ <number:text> </number:text>
+ <number:am-pm/>
+ </number:time-style>
+ <number:number-style style:name="N124P0" style:volatile="true">
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/>
+ </number:number-style>
+ <number:number-style style:name="N124">
+ <number:text>-</number:text>
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/>
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="N124P0"/>
+ </number:number-style>
+ <number:number-style style:name="N125P0" style:volatile="true">
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/>
+ </number:number-style>
+ <number:number-style style:name="N125">
+ <style:text-properties fo:color="#ff0000"/>
+ <number:text>-</number:text>
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/>
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="N125P0"/>
+ </number:number-style>
+ <number:number-style style:name="N126P0" style:volatile="true">
+ <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ </number:number-style>
+ <number:number-style style:name="N126">
+ <number:text>-</number:text>
+ <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="N126P0"/>
+ </number:number-style>
+ <number:number-style style:name="N127P0" style:volatile="true">
+ <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ </number:number-style>
+ <number:number-style style:name="N127">
+ <style:text-properties fo:color="#ff0000"/>
+ <number:text>-</number:text>
+ <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <style:map style:condition="value()&gt;=0" style:apply-style-name="N127P0"/>
+ </number:number-style>
+ <number:number-style style:name="N128P0" style:volatile="true">
+ <number:text> </number:text>
+ <number:fill-character> </number:fill-character>
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:number-style style:name="N128P1" style:volatile="true">
+ <number:text>-</number:text>
+ <number:fill-character> </number:fill-character>
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:number-style style:name="N128P2" style:volatile="true">
+ <number:text> </number:text>
+ <number:fill-character> </number:fill-character>
+ <number:text>- </number:text>
+ </number:number-style>
+ <number:text-style style:name="N128">
+ <number:text> </number:text>
+ <number:text-content/>
+ <number:text> </number:text>
+ <style:map style:condition="value()&gt;0" style:apply-style-name="N128P0"/>
+ <style:map style:condition="value()&lt;0" style:apply-style-name="N128P1"/>
+ <style:map style:condition="value()=0" style:apply-style-name="N128P2"/>
+ </number:text-style>
+ <number:number-style style:name="N129P0" style:volatile="true">
+ <number:text> £</number:text>
+ <number:fill-character> </number:fill-character>
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:number-style style:name="N129P1" style:volatile="true">
+ <number:text>-£</number:text>
+ <number:fill-character> </number:fill-character>
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:number-style style:name="N129P2" style:volatile="true">
+ <number:text> £</number:text>
+ <number:fill-character> </number:fill-character>
+ <number:text>- </number:text>
+ </number:number-style>
+ <number:text-style style:name="N129">
+ <number:text> </number:text>
+ <number:text-content/>
+ <number:text> </number:text>
+ <style:map style:condition="value()&gt;0" style:apply-style-name="N129P0"/>
+ <style:map style:condition="value()&lt;0" style:apply-style-name="N129P1"/>
+ <style:map style:condition="value()=0" style:apply-style-name="N129P2"/>
+ </number:text-style>
+ <number:number-style style:name="N130P0" style:volatile="true">
+ <number:text> </number:text>
+ <number:fill-character> </number:fill-character>
+ <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:number-style style:name="N130P1" style:volatile="true">
+ <number:text>-</number:text>
+ <number:fill-character> </number:fill-character>
+ <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:number-style style:name="N130P2" style:volatile="true">
+ <number:text> </number:text>
+ <number:fill-character> </number:fill-character>
+ <number:text>-</number:text>
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="2" loext:max-blank-integer-digits="2"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:text-style style:name="N130">
+ <number:text> </number:text>
+ <number:text-content/>
+ <number:text> </number:text>
+ <style:map style:condition="value()&gt;0" style:apply-style-name="N130P0"/>
+ <style:map style:condition="value()&lt;0" style:apply-style-name="N130P1"/>
+ <style:map style:condition="value()=0" style:apply-style-name="N130P2"/>
+ </number:text-style>
+ <number:number-style style:name="N131P0" style:volatile="true">
+ <number:text> £</number:text>
+ <number:fill-character> </number:fill-character>
+ <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:number-style style:name="N131P1" style:volatile="true">
+ <number:text>-£</number:text>
+ <number:fill-character> </number:fill-character>
+ <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:number-style style:name="N131P2" style:volatile="true">
+ <number:text> £</number:text>
+ <number:fill-character> </number:fill-character>
+ <number:text>-</number:text>
+ <number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="2" loext:max-blank-integer-digits="2"/>
+ <number:text> </number:text>
+ </number:number-style>
+ <number:text-style style:name="N131">
+ <number:text> </number:text>
+ <number:text-content/>
+ <number:text> </number:text>
+ <style:map style:condition="value()&gt;0" style:apply-style-name="N131P0"/>
+ <style:map style:condition="value()&lt;0" style:apply-style-name="N131P1"/>
+ <style:map style:condition="value()=0" style:apply-style-name="N131P2"/>
+ </number:text-style>
+ <number:time-style style:name="N132">
+ <number:minutes number:style="long"/>
+ <number:text>:</number:text>
+ <number:seconds number:style="long"/>
+ </number:time-style>
+ <number:time-style style:name="N133" number:truncate-on-overflow="false">
+ <number:hours/>
+ <number:text>:</number:text>
+ <number:minutes number:style="long"/>
+ <number:text>:</number:text>
+ <number:seconds number:style="long"/>
+ </number:time-style>
+ <number:time-style style:name="N134">
+ <number:minutes number:style="long"/>
+ <number:text>:</number:text>
+ <number:seconds number:style="long" number:decimal-places="1"/>
+ </number:time-style>
+ <number:number-style style:name="N135">
+ <number:scientific-number number:decimal-places="1" number:min-decimal-places="1" number:min-integer-digits="1" number:min-exponent-digits="1" number:exponent-interval="3" number:forced-exponent-sign="true"/>
+ </number:number-style>
+ <style:style style:name="Default" style:family="table-cell">
+ <style:table-cell-properties style:rotation-align="none" style:vertical-align="bottom"/>
+ <style:text-properties fo:color="#000000" style:font-name="Calibri" fo:font-family="Calibri" style:font-family-generic="swiss" fo:font-size="11pt" style:font-size-asian="11pt" style:font-size-complex="11pt">
+ <loext:char-complex-color loext:theme-type="dark1" loext:color-type="theme"/>
+ </style:text-properties>
+ </style:style>
+ <style:style style:name="Heading" style:family="table-cell" style:parent-style-name="Default">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#000000" fo:font-size="24pt" fo:font-style="normal" fo:font-weight="bold" style:font-size-asian="24pt" style:font-style-asian="normal" style:font-weight-asian="bold" style:font-size-complex="24pt" style:font-style-complex="normal" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="table-cell" style:parent-style-name="Heading">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:font-size="18pt" style:font-size-asian="18pt" style:font-size-complex="18pt"/>
+ </style:style>
+ <style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="table-cell" style:parent-style-name="Heading">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:font-size="12pt" style:font-size-asian="12pt" style:font-size-complex="12pt"/>
+ </style:style>
+ <style:style style:name="Text" style:family="table-cell" style:parent-style-name="Default">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ </style:style>
+ <style:style style:name="Note" style:family="table-cell" style:parent-style-name="Text">
+ <style:table-cell-properties fo:background-color="#ffffcc" style:diagonal-bl-tr="none" style:diagonal-tl-br="none" fo:wrap-option="no-wrap" fo:border="0.74pt solid #808080" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#333333"/>
+ </style:style>
+ <style:style style:name="Footnote" style:family="table-cell" style:parent-style-name="Text">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#808080" fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/>
+ </style:style>
+ <style:style style:name="Hyperlink" style:family="table-cell" style:parent-style-name="Text">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#0000ee" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="#0000ee"/>
+ </style:style>
+ <style:style style:name="Status" style:family="table-cell" style:parent-style-name="Default">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ </style:style>
+ <style:style style:name="Good" style:family="table-cell" style:parent-style-name="Status">
+ <style:table-cell-properties fo:background-color="#ccffcc" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#006600"/>
+ </style:style>
+ <style:style style:name="Neutral" style:family="table-cell" style:parent-style-name="Status">
+ <style:table-cell-properties fo:background-color="#ffffcc" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#996600"/>
+ </style:style>
+ <style:style style:name="Bad" style:family="table-cell" style:parent-style-name="Status">
+ <style:table-cell-properties fo:background-color="#ffcccc" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#cc0000"/>
+ </style:style>
+ <style:style style:name="Warning" style:family="table-cell" style:parent-style-name="Status">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#cc0000"/>
+ </style:style>
+ <style:style style:name="Error" style:family="table-cell" style:parent-style-name="Status">
+ <style:table-cell-properties fo:background-color="#cc0000" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#ffffff" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Accent" style:family="table-cell" style:parent-style-name="Default">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Accent_20_1" style:display-name="Accent 1" style:family="table-cell" style:parent-style-name="Accent">
+ <style:table-cell-properties fo:background-color="#000000" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#ffffff"/>
+ </style:style>
+ <style:style style:name="Accent_20_2" style:display-name="Accent 2" style:family="table-cell" style:parent-style-name="Accent">
+ <style:table-cell-properties fo:background-color="#808080" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:color="#ffffff"/>
+ </style:style>
+ <style:style style:name="Accent_20_3" style:display-name="Accent 3" style:family="table-cell" style:parent-style-name="Accent">
+ <style:table-cell-properties fo:background-color="#dddddd" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ </style:style>
+ <style:style style:name="Result" style:family="table-cell" style:parent-style-name="Default">
+ <style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/>
+ <style:text-properties fo:font-style="italic" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" fo:font-weight="bold" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <draw:marker draw:name="Arrowheads_20_1" draw:display-name="Arrowheads 1" svg:viewBox="0 0 20 30" svg:d="M10 0l-10 30h20z"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="co1" style:family="table-column">
+ <style:table-column-properties fo:break-before="auto" style:column-width="7.44cm"/>
+ </style:style>
+ <style:style style:name="co2" style:family="table-column">
+ <style:table-column-properties fo:break-before="auto" style:column-width="1.699cm"/>
+ </style:style>
+ <style:style style:name="ro1" style:family="table-row">
+ <style:table-row-properties style:row-height="0.503cm" fo:break-before="auto" style:use-optimal-row-height="true"/>
+ </style:style>
+ <style:style style:name="ro2" style:family="table-row">
+ <style:table-row-properties style:row-height="3.942cm" fo:break-before="auto" style:use-optimal-row-height="false"/>
+ </style:style>
+ <style:style style:name="ro3" style:family="table-row">
+ <style:table-row-properties style:row-height="0.452cm" fo:break-before="auto" style:use-optimal-row-height="true"/>
+ </style:style>
+ <style:style style:name="ta1" style:family="table" style:master-page-name="PageStyle_5f_Sheet1">
+ <style:table-properties table:display="true" style:writing-mode="lr-tb"/>
+ </style:style>
+ <number:number-style style:name="N2">
+ <number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1"/>
+ </number:number-style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties style:first-page-number="continue" style:writing-mode="lr-tb"/>
+ <style:header-style>
+ <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.25cm"/>
+ </style:header-style>
+ <style:footer-style>
+ <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.25cm"/>
+ </style:footer-style>
+ </style:page-layout>
+ <style:page-layout style:name="pm2">
+ <style:page-layout-properties style:writing-mode="lr-tb"/>
+ <style:header-style>
+ <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.25cm" fo:border="1.5pt solid #000000" fo:padding="0.018cm" fo:background-color="#c0c0c0">
+ <style:background-image/>
+ </style:header-footer-properties>
+ </style:header-style>
+ <style:footer-style>
+ <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.25cm" fo:border="1.5pt solid #000000" fo:padding="0.018cm" fo:background-color="#c0c0c0">
+ <style:background-image/>
+ </style:header-footer-properties>
+ </style:footer-style>
+ </style:page-layout>
+ <style:page-layout style:name="pm3">
+ <style:page-layout-properties style:num-format="1" style:print-orientation="portrait" fo:margin-top="1.905cm" fo:margin-bottom="1.905cm" fo:margin-left="1.778cm" fo:margin-right="1.778cm" style:print-page-order="ttb" style:first-page-number="continue" style:scale-to="100%" style:writing-mode="lr-tb" style:print="charts drawings objects zero-values"/>
+ <style:header-style>
+ <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.25cm"/>
+ </style:header-style>
+ <style:footer-style>
+ <style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.25cm"/>
+ </style:footer-style>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Default" style:page-layout-name="pm1">
+ <style:header>
+ <text:p><text:sheet-name>???</text:sheet-name></text:p>
+ </style:header>
+ <style:header-left style:display="false"/>
+ <style:header-first style:display="false"/>
+ <style:footer>
+ <text:p>Page <text:page-number>1</text:page-number></text:p>
+ </style:footer>
+ <style:footer-left style:display="false"/>
+ <style:footer-first style:display="false"/>
+ </style:master-page>
+ <style:master-page style:name="Report" style:page-layout-name="pm2">
+ <style:header>
+ <style:region-left>
+ <text:p><text:sheet-name>???</text:sheet-name><text:s/>(<text:title>???</text:title>)</text:p>
+ </style:region-left>
+ <style:region-right>
+ <text:p><text:date style:data-style-name="N2" text:date-value="2023-07-30">00/00/0000</text:date>, <text:time>00:00:00</text:time></text:p>
+ </style:region-right>
+ </style:header>
+ <style:header-left style:display="false"/>
+ <style:header-first style:display="false"/>
+ <style:footer>
+ <text:p>Page <text:page-number>1</text:page-number><text:s/>/ <text:page-count>99</text:page-count></text:p>
+ </style:footer>
+ <style:footer-left style:display="false"/>
+ <style:footer-first style:display="false"/>
+ </style:master-page>
+ <style:master-page style:name="PageStyle_5f_Sheet1" style:display-name="PageStyle_Sheet1" style:page-layout-name="pm3">
+ <style:header style:display="false"/>
+ <style:header-left style:display="false"/>
+ <style:header-first style:display="false"/>
+ <style:footer style:display="false"/>
+ <style:footer-left style:display="false"/>
+ <style:footer-first style:display="false"/>
+ </style:master-page>
+ <style:master-page style:name="PageStyle_5f_Sheet2" style:display-name="PageStyle_Sheet2" style:page-layout-name="pm3">
+ <style:header style:display="false"/>
+ <style:header-left style:display="false"/>
+ <style:header-first style:display="false"/>
+ <style:footer style:display="false"/>
+ <style:footer-left style:display="false"/>
+ <style:footer-first style:display="false"/>
+ </style:master-page>
+ <style:master-page style:name="PageStyle_5f_Sheet3" style:display-name="PageStyle_Sheet3" style:page-layout-name="pm3">
+ <style:header style:display="false"/>
+ <style:header-left style:display="false"/>
+ <style:header-first style:display="false"/>
+ <style:footer style:display="false"/>
+ <style:footer-left style:display="false"/>
+ <style:footer-first style:display="false"/>
+ </style:master-page>
+ </office:master-styles>
+ <office:body>
+ <office:spreadsheet>
+ <table:calculation-settings table:case-sensitive="false" table:automatic-find-labels="false" table:use-regular-expressions="false" table:use-wildcards="true">
+ <table:iteration table:maximum-difference="0.0001"/>
+ </table:calculation-settings>
+ <table:table table:name="Sheet1" table:style-name="ta1">
+ <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
+ <table:table-column table:style-name="co1" table:default-cell-style-name="Default"/>
+ <table:table-column table:style-name="co2" table:number-columns-repeated="16383" table:default-cell-style-name="Default"/>
+ <table:table-row table:style-name="ro1">
+ <table:table-cell/>
+ <table:table-cell office:value-type="float" office:value="4" calcext:value-type="float">
+ <text:p>4</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="2" calcext:value-type="float">
+ <text:p>2</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="7" calcext:value-type="float">
+ <text:p>7</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="-2" calcext:value-type="float">
+ <text:p>-2</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="-5" calcext:value-type="float">
+ <text:p>-5</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="4" calcext:value-type="float">
+ <text:p>4</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="3" calcext:value-type="float">
+ <text:p>3</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="6" calcext:value-type="float">
+ <text:p>6</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="-2" calcext:value-type="float">
+ <text:p>-2</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="0" calcext:value-type="float">
+ <text:p>0</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="-3" calcext:value-type="float">
+ <text:p>-3</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="float" office:value="1" calcext:value-type="float">
+ <text:p>1</text:p>
+ </table:table-cell>
+ <table:table-cell table:number-columns-repeated="16371"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro2">
+ <table:table-cell table:number-columns-repeated="16384"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro1" table:number-rows-repeated="1048573">
+ <table:table-cell table:number-columns-repeated="16384"/>
+ </table:table-row>
+ <table:table-row table:style-name="ro3">
+ <table:table-cell table:number-columns-repeated="16384"/>
+ </table:table-row>
+ <calcext:sparkline-groups>
+ <calcext:sparkline-group calcext:id="{1C5C5DE0-3C09-4CB3-A3EC-9E763301EC82}" calcext:type="column" calcext:line-width="1pt" calcext:display-empty-cells-as="gap" calcext:markers="true" calcext:high="true" calcext:low="true" calcext:first="true" calcext:last="true" calcext:negative="true" calcext:display-x-axis="true" calcext:min-axis-type="individual" calcext:max-axis-type="individual" calcext:color-series="#0369a3" calcext:color-negative="#c99c00" calcext:color-markers="#000000" calcext:color-first="#8e03a3" calcext:color-last="#34b3fb" calcext:color-high="#18a303" calcext:color-low="#c9211e">
+ <calcext:sparkline-series-complex-color loext:theme-type="accent3" loext:color-type="theme"/>
+ <calcext:sparkline-negative-complex-color loext:theme-type="accent6" loext:color-type="theme"/>
+ <calcext:sparkline-markers-complex-color loext:theme-type="light1" loext:color-type="theme"/>
+ <calcext:sparkline-first-complex-color loext:theme-type="accent5" loext:color-type="theme"/>
+ <calcext:sparkline-last-complex-color loext:theme-type="accent2" loext:color-type="theme">
+ <loext:transformation loext:type="lummod" loext:value="6000"/>
+ <loext:transformation loext:type="lumoff" loext:value="4000"/>
+ </calcext:sparkline-last-complex-color>
+ <calcext:sparkline-high-complex-color loext:theme-type="accent1" loext:color-type="theme"/>
+ <calcext:sparkline-low-complex-color loext:theme-type="accent4" loext:color-type="theme"/>
+ <calcext:sparklines>
+ <calcext:sparkline calcext:cell-address="Sheet1.A2" calcext:data-range="Sheet1.B1:Sheet1.M1"/>
+ </calcext:sparklines>
+ </calcext:sparkline-group>
+ </calcext:sparkline-groups>
+ </table:table>
+ <table:named-expressions/>
+ </office:spreadsheet>
+ </office:body>
+</office:document>
diff --git a/sc/qa/unit/ucalc_sparkline.cxx b/sc/qa/unit/ucalc_sparkline.cxx
index 2d46a81f5807..cb9047267b81 100644
--- a/sc/qa/unit/ucalc_sparkline.cxx
+++ b/sc/qa/unit/ucalc_sparkline.cxx
@@ -17,6 +17,9 @@
#include <Sparkline.hxx>
#include <SparklineGroup.hxx>
#include <SparklineList.hxx>
+#include <SparklineAttributes.hxx>
+#include <ThemeColorChanger.hxx>
+#include <docmodel/theme/Theme.hxx>
using namespace css;
@@ -481,16 +484,16 @@ CPPUNIT_TEST_FIXTURE(SparklineTest, testUndoRedoEditSparklineGroup)
{
sc::SparklineAttributes& rAttibutes = pSparklineGroup->getAttributes();
rAttibutes.setType(sc::SparklineType::Column);
- rAttibutes.setColorSeries(COL_YELLOW);
- rAttibutes.setColorAxis(COL_GREEN);
+ rAttibutes.setColorSeries(model::ComplexColor::RGB(COL_YELLOW));
+ rAttibutes.setColorAxis(model::ComplexColor::RGB(COL_GREEN));
}
m_pDoc->CreateSparkline(ScAddress(0, 6, 0), pSparklineGroup);
sc::SparklineAttributes aNewAttributes;
aNewAttributes.setType(sc::SparklineType::Stacked);
- aNewAttributes.setColorSeries(COL_BLACK);
- aNewAttributes.setColorAxis(COL_BLUE);
+ aNewAttributes.setColorSeries(model::ComplexColor::RGB(COL_BLACK));
+ aNewAttributes.setColorAxis(model::ComplexColor::RGB(COL_BLUE));
sc::SparklineAttributes aInitialAttibutes(pSparklineGroup->getAttributes());
@@ -500,8 +503,10 @@ CPPUNIT_TEST_FIXTURE(SparklineTest, testUndoRedoEditSparklineGroup)
CPPUNIT_ASSERT_EQUAL(false, aNewAttributes == pSparklineGroup->getAttributes());
CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Column, pSparklineGroup->getAttributes().getType());
- CPPUNIT_ASSERT_EQUAL(COL_YELLOW, pSparklineGroup->getAttributes().getColorSeries());
- CPPUNIT_ASSERT_EQUAL(COL_GREEN, pSparklineGroup->getAttributes().getColorAxis());
+ CPPUNIT_ASSERT_EQUAL(COL_YELLOW,
+ pSparklineGroup->getAttributes().getColorSeries().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(COL_GREEN,
+ pSparklineGroup->getAttributes().getColorAxis().getFinalColor());
rDocFunc.ChangeSparklineGroupAttributes(pSparklineGroup, aNewAttributes);
@@ -509,8 +514,9 @@ CPPUNIT_TEST_FIXTURE(SparklineTest, testUndoRedoEditSparklineGroup)
CPPUNIT_ASSERT_EQUAL(true, aNewAttributes == pSparklineGroup->getAttributes());
CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Stacked, pSparklineGroup->getAttributes().getType());
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, pSparklineGroup->getAttributes().getColorSeries());
- CPPUNIT_ASSERT_EQUAL(COL_BLUE, pSparklineGroup->getAttributes().getColorAxis());
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK,
+ pSparklineGroup->getAttributes().getColorSeries().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(COL_BLUE, pSparklineGroup->getAttributes().getColorAxis().getFinalColor());
m_pDoc->GetUndoManager()->Undo();
@@ -518,8 +524,10 @@ CPPUNIT_TEST_FIXTURE(SparklineTest, testUndoRedoEditSparklineGroup)
CPPUNIT_ASSERT_EQUAL(false, aNewAttributes == pSparklineGroup->getAttributes());
CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Column, pSparklineGroup->getAttributes().getType());
- CPPUNIT_ASSERT_EQUAL(COL_YELLOW, pSparklineGroup->getAttributes().getColorSeries());
- CPPUNIT_ASSERT_EQUAL(COL_GREEN, pSparklineGroup->getAttributes().getColorAxis());
+ CPPUNIT_ASSERT_EQUAL(COL_YELLOW,
+ pSparklineGroup->getAttributes().getColorSeries().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(COL_GREEN,
+ pSparklineGroup->getAttributes().getColorAxis().getFinalColor());
m_pDoc->GetUndoManager()->Redo();
@@ -527,8 +535,9 @@ CPPUNIT_TEST_FIXTURE(SparklineTest, testUndoRedoEditSparklineGroup)
CPPUNIT_ASSERT_EQUAL(true, aNewAttributes == pSparklineGroup->getAttributes());
CPPUNIT_ASSERT_EQUAL(sc::SparklineType::Stacked, pSparklineGroup->getAttributes().getType());
- CPPUNIT_ASSERT_EQUAL(COL_BLACK, pSparklineGroup->getAttributes().getColorSeries());
- CPPUNIT_ASSERT_EQUAL(COL_BLUE, pSparklineGroup->getAttributes().getColorAxis());
+ CPPUNIT_ASSERT_EQUAL(COL_BLACK,
+ pSparklineGroup->getAttributes().getColorSeries().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(COL_BLUE, pSparklineGroup->getAttributes().getColorAxis().getFinalColor());
m_pDoc->DeleteTab(0);
}
@@ -867,6 +876,93 @@ CPPUNIT_TEST_FIXTURE(SparklineTest, testSparklineList)
}
}
+CPPUNIT_TEST_FIXTURE(SparklineTest, testSparklineThemeColorChange)
+{
+ m_pDoc->InitDrawLayer();
+ m_pDoc->InsertTab(0, "Test");
+
+ // insert test data - A1:A6
+ insertTestData(*m_pDoc);
+
+ auto& rDocFunc = m_xDocShell->GetDocFunc();
+
+ ScDrawLayer* pDrawLayer = m_pDoc->GetDrawLayer();
+ CPPUNIT_ASSERT(pDrawLayer);
+ const SdrPage* pPage(pDrawLayer->GetPage(0));
+ CPPUNIT_ASSERT(pPage);
+ auto const& pTheme = pPage->getSdrPageProperties().GetTheme();
+ CPPUNIT_ASSERT(pTheme);
+
+ // Sparkline range
+ ScRange aDataRange(0, 0, 0, 3, 5, 0); //A1:D6
+ ScRange aRange(0, 6, 0, 3, 6, 0); // A7:D7
+
+ {
+ auto pSparklineGroup = std::make_shared<sc::SparklineGroup>();
+ sc::SparklineAttributes& rAttibutes = pSparklineGroup->getAttributes();
+
+ model::ComplexColor aSeriesComplexColor;
+ aSeriesComplexColor.setSchemeColor(model::ThemeColorType::Accent3);
+ aSeriesComplexColor.setFinalColor(pTheme->getColorSet()->resolveColor(aSeriesComplexColor));
+ rAttibutes.setColorSeries(aSeriesComplexColor);
+
+ model::ComplexColor aAxisComplexColor;
+ aAxisComplexColor.setSchemeColor(model::ThemeColorType::Accent1);
+ aAxisComplexColor.setFinalColor(pTheme->getColorSet()->resolveColor(aAxisComplexColor));
+ rAttibutes.setColorAxis(aAxisComplexColor);
+
+ CPPUNIT_ASSERT(rDocFunc.InsertSparklines(aDataRange, aRange, pSparklineGroup));
+ }
+
+ {
+ CPPUNIT_ASSERT_EQUAL(true, m_pDoc->HasSparkline(ScAddress(0, 6, 0))); // A7
+ auto pGroup = m_pDoc->GetSparkline(ScAddress(0, 6, 0))->getSparklineGroup();
+ CPPUNIT_ASSERT(pGroup);
+ sc::SparklineAttributes& rAttibutes = pGroup->getAttributes();
+ CPPUNIT_ASSERT_EQUAL(Color(0xa33e03), rAttibutes.getColorSeries().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x18a303), rAttibutes.getColorAxis().getFinalColor());
+ }
+
+ {
+ auto pColorSet = std::make_shared<model::ColorSet>("TestColorScheme");
+ pColorSet->add(model::ThemeColorType::Dark1, 0x000000);
+ pColorSet->add(model::ThemeColorType::Light1, 0x111111);
+ pColorSet->add(model::ThemeColorType::Dark2, 0x222222);
+ pColorSet->add(model::ThemeColorType::Light2, 0x333333);
+ pColorSet->add(model::ThemeColorType::Accent1, 0x444444);
+ pColorSet->add(model::ThemeColorType::Accent2, 0x555555);
+ pColorSet->add(model::ThemeColorType::Accent3, 0x666666);
+ pColorSet->add(model::ThemeColorType::Accent4, 0x777777);
+ pColorSet->add(model::ThemeColorType::Accent5, 0x888888);
+ pColorSet->add(model::ThemeColorType::Accent6, 0x999999);
+ pColorSet->add(model::ThemeColorType::Hyperlink, 0xaaaaaa);
+ pColorSet->add(model::ThemeColorType::FollowedHyperlink, 0xbbbbbb);
+
+ sc::ThemeColorChanger aChanger(*m_xDocShell);
+ aChanger.apply(pColorSet);
+ }
+
+ {
+ CPPUNIT_ASSERT_EQUAL(true, m_pDoc->HasSparkline(ScAddress(0, 6, 0))); // A7
+ auto pGroup = m_pDoc->GetSparkline(ScAddress(0, 6, 0))->getSparklineGroup();
+ CPPUNIT_ASSERT(pGroup);
+ sc::SparklineAttributes& rAttibutes = pGroup->getAttributes();
+ CPPUNIT_ASSERT_EQUAL(Color(0x666666), rAttibutes.getColorSeries().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x444444), rAttibutes.getColorAxis().getFinalColor());
+ }
+
+ m_pDoc->GetUndoManager()->Undo();
+
+ {
+ CPPUNIT_ASSERT_EQUAL(true, m_pDoc->HasSparkline(ScAddress(0, 6, 0))); // A7
+ auto pGroup = m_pDoc->GetSparkline(ScAddress(0, 6, 0))->getSparklineGroup();
+ CPPUNIT_ASSERT(pGroup);
+ sc::SparklineAttributes& rAttibutes = pGroup->getAttributes();
+ CPPUNIT_ASSERT_EQUAL(Color(0xa33e03), rAttibutes.getColorSeries().getFinalColor());
+ CPPUNIT_ASSERT_EQUAL(Color(0x18a303), rAttibutes.getColorAxis().getFinalColor());
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/export/ExportTools.cxx b/sc/source/filter/excel/export/ExportTools.cxx
new file mode 100644
index 000000000000..a132dd148408
--- /dev/null
+++ b/sc/source/filter/excel/export/ExportTools.cxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <export/ExportTools.hxx>
+#include <oox/export/ColorExportUtils.hxx>
+#include <oox/token/tokens.hxx>
+#include <oox/token/namespaces.hxx>
+#include <xestream.hxx>
+
+namespace oox::xls
+{
+void writeComplexColor(sax_fastparser::FSHelperPtr& pFS, sal_Int32 nElement,
+ model::ComplexColor const& rComplexColor, Color const& rColor)
+{
+ if (rComplexColor.isValidSchemeType())
+ {
+ sal_Int32 nTheme
+ = oox::convertThemeColorTypeToExcelThemeNumber(rComplexColor.getSchemeType());
+ double fTintShade = oox::convertColorTransformsToTintOrShade(rComplexColor);
+ pFS->singleElement(nElement, XML_theme, OString::number(nTheme), XML_tint,
+ sax_fastparser::UseIf(OString::number(fTintShade), fTintShade != 0.0));
+ }
+ else if (rColor != COL_TRANSPARENT)
+ {
+ pFS->singleElement(nElement, XML_rgb, XclXmlUtils::ToOString(rColor));
+ }
+}
+
+void writeComplexColor(sax_fastparser::FSHelperPtr& pFS, sal_Int32 nElement,
+ model::ComplexColor const& rComplexColor)
+{
+ if (rComplexColor.isValidSchemeType() || rComplexColor.getType() == model::ColorType::RGB)
+ {
+ writeComplexColor(pFS, nElement, rComplexColor, rComplexColor.getFinalColor());
+ }
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/export/SparklineExt.cxx b/sc/source/filter/excel/export/SparklineExt.cxx
index 487698e19ba1..fb5c98148323 100644
--- a/sc/source/filter/excel/export/SparklineExt.cxx
+++ b/sc/source/filter/excel/export/SparklineExt.cxx
@@ -14,6 +14,7 @@
#include <oox/token/tokens.hxx>
#include <SparklineGroup.hxx>
#include <SparklineList.hxx>
+#include <export/ExportTools.hxx>
using namespace oox;
@@ -126,50 +127,21 @@ void SparklineExt::addSparklineGroupColors(XclExpXmlStream& rStream,
{
sax_fastparser::FSHelperPtr& rWorksheet = rStream.GetCurrentStream();
- rWorksheet->singleElementNS(XML_x14, XML_colorSeries, XML_rgb,
- XclXmlUtils::ToOString(rAttributes.getColorSeries()));
-
- if (rAttributes.getColorNegative() != COL_TRANSPARENT)
- {
- rWorksheet->singleElementNS(XML_x14, XML_colorNegative, XML_rgb,
- XclXmlUtils::ToOString(rAttributes.getColorNegative()));
- }
-
- if (rAttributes.getColorAxis() != COL_TRANSPARENT)
- {
- rWorksheet->singleElementNS(XML_x14, XML_colorAxis, XML_rgb,
- XclXmlUtils::ToOString(rAttributes.getColorAxis()));
- }
-
- if (rAttributes.getColorMarkers() != COL_TRANSPARENT)
- {
- rWorksheet->singleElementNS(XML_x14, XML_colorMarkers, XML_rgb,
- XclXmlUtils::ToOString(rAttributes.getColorMarkers()));
- }
-
- if (rAttributes.getColorFirst() != COL_TRANSPARENT)
- {
- rWorksheet->singleElementNS(XML_x14, XML_colorFirst, XML_rgb,
- XclXmlUtils::ToOString(rAttributes.getColorFirst()));
- }
-
- if (rAttributes.getColorLast() != COL_TRANSPARENT)
- {
- rWorksheet->singleElementNS(XML_x14, XML_colorLast, XML_rgb,
- XclXmlUtils::ToOString(rAttributes.getColorLast()));
- }
-
- if (rAttributes.getColorHigh() != COL_TRANSPARENT)
- {
- rWorksheet->singleElementNS(XML_x14, XML_colorHigh, XML_rgb,
- XclXmlUtils::ToOString(rAttributes.getColorHigh()));
- }
-
- if (rAttributes.getColorLow() != COL_TRANSPARENT)
- {
- rWorksheet->singleElementNS(XML_x14, XML_colorLow, XML_rgb,
- XclXmlUtils::ToOString(rAttributes.getColorLow()));
- }
+ oox::xls::writeComplexColor(rWorksheet, FSNS(XML_x14, XML_colorSeries),
+ rAttributes.getColorSeries());
+ oox::xls::writeComplexColor(rWorksheet, FSNS(XML_x14, XML_colorNegative),
+ rAttributes.getColorNegative());
+ oox::xls::writeComplexColor(rWorksheet, FSNS(XML_x14, XML_colorAxis),
+ rAttributes.getColorAxis());
+ oox::xls::writeComplexColor(rWorksheet, FSNS(XML_x14, XML_colorMarkers),
+ rAttributes.getColorMarkers());
+ oox::xls::writeComplexColor(rWorksheet, FSNS(XML_x14, XML_colorFirst),
+ rAttributes.getColorFirst());
+ oox::xls::writeComplexColor(rWorksheet, FSNS(XML_x14, XML_colorLast),
+ rAttributes.getColorLast());
+ oox::xls::writeComplexColor(rWorksheet, FSNS(XML_x14, XML_colorHigh),
+ rAttributes.getColorHigh());
+ oox::xls::writeComplexColor(rWorksheet, FSNS(XML_x14, XML_colorLow), rAttributes.getColorLow());
}
void SparklineExt::addSparklineGroup(XclExpXmlStream& rStream, sc::SparklineGroup& rSparklineGroup,
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 2937c153fb21..42d3f1944bc7 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -53,7 +53,6 @@
#include <o3tl/safeint.hxx>
#include <oox/export/utils.hxx>
-#include <oox/export/ColorExportUtils.hxx>
#include <oox/token/tokens.hxx>
#include <oox/token/namespaces.hxx>
#include <oox/token/relationship.hxx>
diff --git a/sc/source/filter/inc/export/ExportTools.hxx b/sc/source/filter/inc/export/ExportTools.hxx
index e5ea27561f39..369728f06e10 100644
--- a/sc/source/filter/inc/export/ExportTools.hxx
+++ b/sc/source/filter/inc/export/ExportTools.hxx
@@ -11,28 +11,13 @@
#include <docmodel/color/ComplexColor.hxx>
#include <sax/fshelper.hxx>
-#include <oox/export/ColorExportUtils.hxx>
-#include <oox/token/tokens.hxx>
-#include <oox/token/namespaces.hxx>
namespace oox::xls
{
void writeComplexColor(sax_fastparser::FSHelperPtr& pFS, sal_Int32 nElement,
- model::ComplexColor const& rComplexColor, Color const& rColor)
-{
- if (rComplexColor.isValidSchemeType())
- {
- sal_Int32 nTheme
- = oox::convertThemeColorTypeToExcelThemeNumber(rComplexColor.getSchemeType());
- double fTintShade = oox::convertColorTransformsToTintOrShade(rComplexColor);
- pFS->singleElement(nElement, XML_theme, OString::number(nTheme), XML_tint,
- sax_fastparser::UseIf(OString::number(fTintShade), fTintShade != 0.0));
- }
- else if (rColor != COL_TRANSPARENT)
- {
- pFS->singleElement(nElement, XML_rgb, XclXmlUtils::ToOString(rColor));
- }
-}
+ model::ComplexColor const& rComplexColor, Color const& rColor);
+void writeComplexColor(sax_fastparser::FSHelperPtr& pFS, sal_Int32 nElement,
+ model::ComplexColor const& rComplexColor);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/SparklineFragment.cxx b/sc/source/filter/oox/SparklineFragment.cxx
index 38af462c5b3a..afb3f64285ae 100644
--- a/sc/source/filter/oox/SparklineFragment.cxx
+++ b/sc/source/filter/oox/SparklineFragment.cxx
@@ -17,6 +17,7 @@
#include <rangeutl.hxx>
#include <Sparkline.hxx>
#include <themebuffer.hxx>
+#include <docmodel/color/ComplexColor.hxx>
using ::oox::core::ContextHandlerRef;
@@ -56,34 +57,46 @@ namespace
return ::Color();
}
+model::ComplexColor fillComplexColor(const AttributeList& rAttribs, ThemeBuffer const& rThemeBuffer,
+ const GraphicHelper& rGraphicHelper)
+{
+ XlsColor aColor;
+ aColor.importColor(rAttribs);
+ model::ComplexColor aComplexColor = aColor.createComplexColor(rGraphicHelper, -1);
+ ::Color aFinalColor = getColor(rAttribs, rThemeBuffer);
+ aComplexColor.setFinalColor(aFinalColor);
+ return aComplexColor;
+}
+
void addColorsToSparklineAttributes(sc::SparklineAttributes& rAttributes, sal_Int32 nElement,
- const AttributeList& rAttribs, ThemeBuffer& rThemeBuffer)
+ const AttributeList& rAttribs, ThemeBuffer& rThemeBuffer,
+ const GraphicHelper& rHelper)
{
switch (nElement)
{
case XLS14_TOKEN(colorSeries):
- rAttributes.setColorSeries(getColor(rAttribs, rThemeBuffer));
+ rAttributes.setColorSeries(fillComplexColor(rAttribs, rThemeBuffer, rHelper));
break;
case XLS14_TOKEN(colorNegative):
- rAttributes.setColorNegative(getColor(rAttribs, rThemeBuffer));
+ rAttributes.setColorNegative(fillComplexColor(rAttribs, rThemeBuffer, rHelper));
break;
case XLS14_TOKEN(colorAxis):
- rAttributes.setColorAxis(getColor(rAttribs, rThemeBuffer));
+ rAttributes.setColorAxis(fillComplexColor(rAttribs, rThemeBuffer, rHelper));
break;
case XLS14_TOKEN(colorMarkers):
- rAttributes.setColorMarkers(getColor(rAttribs, rThemeBuffer));
+ rAttributes.setColorMarkers(fillComplexColor(rAttribs, rThemeBuffer, rHelper));
break;
case XLS14_TOKEN(colorFirst):
- rAttributes.setColorFirst(getColor(rAttribs, rThemeBuffer));
+ rAttributes.setColorFirst(fillComplexColor(rAttribs, rThemeBuffer, rHelper));
break;
case XLS14_TOKEN(colorLast):
- rAttributes.setColorLast(getColor(rAttribs, rThemeBuffer));
+ rAttributes.setColorLast(fillComplexColor(rAttribs, rThemeBuffer, rHelper));
break;
case XLS14_TOKEN(colorHigh):
- rAttributes.setColorHigh(getColor(rAttribs, rThemeBuffer));
+ rAttributes.setColorHigh(fillComplexColor(rAttribs, rThemeBuffer, rHelper));
break;
case XLS14_TOKEN(colorLow):
- rAttributes.setColorLow(getColor(rAttribs, rThemeBuffer));
+ rAttributes.setColorLow(fillComplexColor(rAttribs, rThemeBuffer, rHelper));
break;
default:
break;
@@ -172,6 +185,7 @@ ContextHandlerRef SparklineGroupsContext::onCreateContext(sal_Int32 nElement,
{
auto& rLastGroup = m_aSparklineGroups.emplace_back();
auto& rSparklineAttributes = rLastGroup.getSparklineGroup()->getAttributes();
+ rSparklineAttributes.resetColors();
addAttributesToSparklineAttributes(rSparklineAttributes, rAttribs);
OUString sGUID = rAttribs.getString(XR2_TOKEN(uid), OUString());
tools::Guid aGuid(OUStringToOString(sGUID, RTL_TEXTENCODING_ASCII_US));
@@ -189,7 +203,8 @@ ContextHandlerRef SparklineGroupsContext::onCreateContext(sal_Int32 nElement,
{
auto& rLastGroup = m_aSparklineGroups.back();
auto& rSparklineAttributes = rLastGroup.getSparklineGroup()->getAttributes();
- addColorsToSparklineAttributes(rSparklineAttributes, nElement, rAttribs, getTheme());
+ addColorsToSparklineAttributes(rSparklineAttributes, nElement, rAttribs, getTheme(),
+ getBaseFilter().getGraphicHelper());
return this;
}
case XLS14_TOKEN(sparklines):
diff --git a/sc/source/filter/xml/SparklineGroupsExport.cxx b/sc/source/filter/xml/SparklineGroupsExport.cxx
index 077d43beab60..fd577e5c6c10 100644
--- a/sc/source/filter/xml/SparklineGroupsExport.cxx
+++ b/sc/source/filter/xml/SparklineGroupsExport.cxx
@@ -21,6 +21,7 @@
#include <rtl/ustrbuf.hxx>
#include <sax/tools/converter.hxx>
#include <o3tl/unit_conversion.hxx>
+#include <xmloff/XMLComplexColorExport.hxx>
using namespace css;
using namespace xmloff::token;
@@ -33,14 +34,24 @@ SparklineGroupsExport::SparklineGroupsExport(ScXMLExport& rExport, SCTAB nTable)
{
}
-void SparklineGroupsExport::insertColor(Color aColor, XMLTokenEnum eToken)
+void SparklineGroupsExport::insertColor(model::ComplexColor const& rComplexColor,
+ XMLTokenEnum eToken)
{
+ if (rComplexColor.getType() == model::ColorType::Unused)
+ return;
+
OUStringBuffer aStringBuffer;
- if (aColor != COL_TRANSPARENT)
- {
- sax::Converter::convertColor(aStringBuffer, aColor);
- m_rExport.AddAttribute(XML_NAMESPACE_CALC_EXT, eToken, aStringBuffer.makeStringAndClear());
- }
+ sax::Converter::convertColor(aStringBuffer, rComplexColor.getFinalColor());
+ m_rExport.AddAttribute(XML_NAMESPACE_CALC_EXT, eToken, aStringBuffer.makeStringAndClear());
+}
+
+void SparklineGroupsExport::insertComplexColor(model::ComplexColor const& rComplexColor,
+ XMLTokenEnum eToken)
+{
+ if (!rComplexColor.isValidSchemeType())
+ return;
+ XMLComplexColorExport aComplexColorExport(m_rExport);
+ aComplexColorExport.exportComplexColor(rComplexColor, XML_NAMESPACE_CALC_EXT, eToken);
}
void SparklineGroupsExport::insertBool(bool bValue, XMLTokenEnum eToken)
@@ -182,6 +193,15 @@ void SparklineGroupsExport::addSparklineGroup(
SvXMLElementExport aElementSparklineGroup(m_rExport, XML_NAMESPACE_CALC_EXT,
XML_SPARKLINE_GROUP, true, true);
+ insertComplexColor(rAttributes.getColorSeries(), XML_SPARKLINE_SERIES_COMPLEX_COLOR);
+ insertComplexColor(rAttributes.getColorNegative(), XML_SPARKLINE_NEGATIVE_COMPLEX_COLOR);
+ insertComplexColor(rAttributes.getColorAxis(), XML_SPARKLINE_AXIS_COMPLEX_COLOR);
+ insertComplexColor(rAttributes.getColorMarkers(), XML_SPARKLINE_MARKERS_COMPLEX_COLOR);
+ insertComplexColor(rAttributes.getColorFirst(), XML_SPARKLINE_FIRST_COMPLEX_COLOR);
+ insertComplexColor(rAttributes.getColorLast(), XML_SPARKLINE_LAST_COMPLEX_COLOR);
+ insertComplexColor(rAttributes.getColorHigh(), XML_SPARKLINE_HIGH_COMPLEX_COLOR);
+ insertComplexColor(rAttributes.getColorLow(), XML_SPARKLINE_LOW_COMPLEX_COLOR);
+
SvXMLElementExport aElementSparklines(m_rExport, XML_NAMESPACE_CALC_EXT, XML_SPARKLINES, true,
true);
diff --git a/sc/source/filter/xml/SparklineGroupsExport.hxx b/sc/source/filter/xml/SparklineGroupsExport.hxx
index 9359413735dc..a2ed4a8ef853 100644
--- a/sc/source/filter/xml/SparklineGroupsExport.hxx
+++ b/sc/source/filter/xml/SparklineGroupsExport.hxx
@@ -19,6 +19,10 @@
#include <SparklineGroup.hxx>
class ScXMLExport;
+namespace model
+{
+class ComplexColor;
+}
namespace sc
{
@@ -33,7 +37,10 @@ class SparklineGroupsExport
std::vector<std::shared_ptr<Sparkline>> const& rSparklines);
void addSparklineAttributes(Sparkline const& rSparkline);
- void insertColor(Color aColor, xmloff::token::XMLTokenEnum eToken);
+ void insertColor(model::ComplexColor const& rComplexColor, xmloff::token::XMLTokenEnum eToken);
+ void insertComplexColor(model::ComplexColor const& rComplexColor,
+ xmloff::token::XMLTokenEnum eToken);
+
void insertBool(bool bValue, xmloff::token::XMLTokenEnum eToken);
public:
diff --git a/sc/source/filter/xml/SparklineGroupsImportContext.cxx b/sc/source/filter/xml/SparklineGroupsImportContext.cxx
index b1164e3ef993..59c24cdd45a4 100644
--- a/sc/source/filter/xml/SparklineGroupsImportContext.cxx
+++ b/sc/source/filter/xml/SparklineGroupsImportContext.cxx
@@ -13,6 +13,7 @@
#include <xmloff/xmlnamespace.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmluconv.hxx>
+#include <xmloff/XMLComplexColorContext.hxx>
#include <document.hxx>
#include <rangeutl.hxx>
@@ -181,58 +182,50 @@ void SparklineGroupsImportContext::fillSparklineGroupAttributes(
}
case XML_ELEMENT(CALC_EXT, XML_COLOR_SERIES):
{
- Color aColor;
- sax::Converter::convertColor(aColor, rIter.toView());
- rAttributes.setColorSeries(aColor);
+ maSeriesColor = COL_TRANSPARENT;
+ sax::Converter::convertColor(maSeriesColor, rIter.toView());
break;
}
case XML_ELEMENT(CALC_EXT, XML_COLOR_NEGATIVE):
{
- Color aColor;
- sax::Converter::convertColor(aColor, rIter.toView());
- rAttributes.setColorNegative(aColor);
+ maNegativeColor = COL_TRANSPARENT;
+ sax::Converter::convertColor(maNegativeColor, rIter.toView());
break;
}
case XML_ELEMENT(CALC_EXT, XML_COLOR_AXIS):
{
- Color aColor;
- sax::Converter::convertColor(aColor, rIter.toView());
- rAttributes.setColorAxis(aColor);
+ maAxisColor = COL_TRANSPARENT;
+ sax::Converter::convertColor(maAxisColor, rIter.toView());
break;
}
case XML_ELEMENT(CALC_EXT, XML_COLOR_MARKERS):
{
- Color aColor;
- sax::Converter::convertColor(aColor, rIter.toView());
- rAttributes.setColorMarkers(aColor);
+ maMarkersColor = COL_TRANSPARENT;
+ sax::Converter::convertColor(maMarkersColor, rIter.toView());
break;
}
case XML_ELEMENT(CALC_EXT, XML_COLOR_FIRST):
{
- Color aColor;
- sax::Converter::convertColor(aColor, rIter.toView());
- rAttributes.setColorFirst(aColor);
+ maFirstColor = COL_TRANSPARENT;
+ sax::Converter::convertColor(maFirstColor, rIter.toView());
break;
}
case XML_ELEMENT(CALC_EXT, XML_COLOR_LAST):
{
- Color aColor;
- sax::Converter::convertColor(aColor, rIter.toView());
- rAttributes.setColorLast(aColor);
+ maLastColor = COL_TRANSPARENT;
+ sax::Converter::convertColor(maLastColor, rIter.toView());
break;
}
case XML_ELEMENT(CALC_EXT, XML_COLOR_HIGH):
{
- Color aColor;
- sax::Converter::convertColor(aColor, rIter.toView());
- rAttributes.setColorHigh(aColor);
+ maHighColor = COL_TRANSPARENT;
+ sax::Converter::convertColor(maHighColor, rIter.toView());
break;
}
case XML_ELEMENT(CALC_EXT, XML_COLOR_LOW):
{
- Color aColor;
- sax::Converter::convertColor(aColor, rIter.toView());
- rAttributes.setColorLow(aColor);
+ maLowColor = COL_TRANSPARENT;
+ sax::Converter::convertColor(maLowColor, rIter.toView());
break;
}
default:
@@ -281,23 +274,72 @@ uno::Reference<xml::sax::XFastContextHandler>
case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_GROUP):
{
m_pCurrentSparklineGroup = std::make_shared<sc::SparklineGroup>();
+ maAxisComplexColor = model::ComplexColor();
+ maFirstComplexColor = model::ComplexColor();
+ maLastComplexColor = model::ComplexColor();
+ maHighComplexColor = model::ComplexColor();
+ maLowComplexColor = model::ComplexColor();
+ maSeriesComplexColor = model::ComplexColor();
+ maNegativeComplexColor = model::ComplexColor();
+ maMarkersComplexColor = model::ComplexColor();
+
fillSparklineGroupID(xAttrList);
fillSparklineGroupAttributes(xAttrList);
pContext = this;
- break;
}
+ break;
case XML_ELEMENT(CALC_EXT, XML_SPARKLINES):
{
pContext = this;
- break;
}
+ break;
case XML_ELEMENT(CALC_EXT, XML_SPARKLINE):
{
SparklineImportData& rImportData = m_aCurrentSparklineDataList.emplace_back();
fillSparklineAttributes(rImportData, xAttrList);
pContext = this;
- break;
}
+ break;
+ case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_AXIS_COMPLEX_COLOR):
+ {
+ pContext = new XMLComplexColorContext(GetImport(), maAxisComplexColor, xAttrList);
+ }
+ break;
+ case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_FIRST_COMPLEX_COLOR):
+ {
+ pContext = new XMLComplexColorContext(GetImport(), maFirstComplexColor, xAttrList);
+ }
+ break;
+ case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_LAST_COMPLEX_COLOR):
+ {
+ pContext = new XMLComplexColorContext(GetImport(), maLastComplexColor, xAttrList);
+ }
+ break;
+ case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_HIGH_COMPLEX_COLOR):
+ {
+ pContext = new XMLComplexColorContext(GetImport(), maHighComplexColor, xAttrList);
+ }
+ break;
+ case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_LOW_COMPLEX_COLOR):
+ {
+ pContext = new XMLComplexColorContext(GetImport(), maLowComplexColor, xAttrList);
+ }
+ break;
+ case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_SERIES_COMPLEX_COLOR):
+ {
+ pContext = new XMLComplexColorContext(GetImport(), maSeriesComplexColor, xAttrList);
+ }
+ break;
+ case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_NEGATIVE_COMPLEX_COLOR):
+ {
+ pContext = new XMLComplexColorContext(GetImport(), maNegativeComplexColor, xAttrList);
+ }
+ break;
+ case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_MARKERS_COMPLEX_COLOR):
+ {
+ pContext = new XMLComplexColorContext(GetImport(), maMarkersComplexColor, xAttrList);
+ }
+ break;
}
return pContext;
@@ -314,12 +356,42 @@ void SparklineGroupsImportContext::insertSparklines()
}
}
+namespace
+{
+model::ComplexColor combineComplexColorAndColor(model::ComplexColor& rComplexColor, Color aColor)
+{
+ if (rComplexColor.getType() != model::ColorType::Unused)
+ rComplexColor.setFinalColor(aColor);
+ else if (aColor != COL_TRANSPARENT)
+ rComplexColor = model::ComplexColor::RGB(aColor);
+ return rComplexColor;
+}
+} // end anonymous namespace
+
void SAL_CALL SparklineGroupsImportContext::endFastElement(sal_Int32 nElement)
{
switch (nElement)
{
case XML_ELEMENT(CALC_EXT, XML_SPARKLINE_GROUP):
{
+ sc::SparklineAttributes& rAttributes = m_pCurrentSparklineGroup->getAttributes();
+ {
+ rAttributes.setColorAxis(
+ combineComplexColorAndColor(maAxisComplexColor, maAxisColor));
+ rAttributes.setColorFirst(
+ combineComplexColorAndColor(maFirstComplexColor, maFirstColor));
+ rAttributes.setColorLast(
+ combineComplexColorAndColor(maLastComplexColor, maLastColor));
+ rAttributes.setColorHigh(
+ combineComplexColorAndColor(maHighComplexColor, maHighColor));
+ rAttributes.setColorLow(combineComplexColorAndColor(maLowComplexColor, maLowColor));
+ rAttributes.setColorSeries(
+ combineComplexColorAndColor(maSeriesComplexColor, maSeriesColor));
+ rAttributes.setColorNegative(
+ combineComplexColorAndColor(maNegativeComplexColor, maNegativeColor));
+ rAttributes.setColorMarkers(
+ combineComplexColorAndColor(maMarkersComplexColor, maMarkersColor));
+ }
insertSparklines();
m_pCurrentSparklineGroup.reset();
m_aCurrentSparklineDataList.clear();
diff --git a/sc/source/filter/xml/SparklineGroupsImportContext.hxx b/sc/source/filter/xml/SparklineGroupsImportContext.hxx
index b8161c96506d..197eca9ca09a 100644
--- a/sc/source/filter/xml/SparklineGroupsImportContext.hxx
+++ b/sc/source/filter/xml/SparklineGroupsImportContext.hxx
@@ -14,6 +14,7 @@
#include "xmlimprt.hxx"
#include <address.hxx>
#include <rangelst.hxx>
+#include <docmodel/color/ComplexColor.hxx>
namespace sax_fastparser
{
@@ -38,6 +39,24 @@ private:
std::shared_ptr<sc::SparklineGroup> m_pCurrentSparklineGroup;
std::vector<SparklineImportData> m_aCurrentSparklineDataList;
+ model::ComplexColor maAxisComplexColor;
+ model::ComplexColor maFirstComplexColor;
+ model::ComplexColor maLastComplexColor;
+ model::ComplexColor maHighComplexColor;
+ model::ComplexColor maLowComplexColor;
+ model::ComplexColor maSeriesComplexColor;
+ model::ComplexColor maNegativeComplexColor;
+ model::ComplexColor maMarkersComplexColor;
+
+ Color maAxisColor = COL_TRANSPARENT;
+ Color maFirstColor = COL_TRANSPARENT;
+ Color maLastColor = COL_TRANSPARENT;
+ Color maHighColor = COL_TRANSPARENT;
+ Color maLowColor = COL_TRANSPARENT;
+ Color maSeriesColor = COL_TRANSPARENT;
+ Color maNegativeColor = COL_TRANSPARENT;
+ Color maMarkersColor = COL_TRANSPARENT;
+
void
fillSparklineGroupID(css::uno::Reference<css::xml::sax::XFastAttributeList> const& xAttrList);
void fillSparklineGroupAttributes(
diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx
index b938e4e5d174..3d7d86488425 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -307,7 +307,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTableCellPropsConte
{
case CTF_COMPLEX_COLOR:
{
- return new XMLComplexColorContext(GetImport(), nElement, xAttrList, rProperty, rProperties);
+ return new XMLPropertyComplexColorContext(GetImport(), nElement, xAttrList, rProperty, rProperties);
}
break;
case CTF_SC_HYPERLINK:
diff --git a/sc/source/ui/dialogs/SparklineDialog.cxx b/sc/source/ui/dialogs/SparklineDialog.cxx
index f27e0eb4a4a5..2490ae41da2f 100644
--- a/sc/source/ui/dialogs/SparklineDialog.cxx
+++ b/sc/source/ui/dialogs/SparklineDialog.cxx
@@ -192,13 +192,13 @@ void SparklineDialog::setupValues()
break;
}
- mxColorSeries->SelectEntry(maAttributes.getColorSeries());
- mxColorNegative->SelectEntry(maAttributes.getColorNegative());
- mxColorMarker->SelectEntry(maAttributes.getColorMarkers());
- mxColorHigh->SelectEntry(maAttributes.getColorHigh());
- mxColorLow->SelectEntry(maAttributes.getColorLow());
- mxColorFirst->SelectEntry(maAttributes.getColorFirst());
- mxColorLast->SelectEntry(maAttributes.getColorLast());
+ mxColorSeries->SelectEntry(maAttributes.getColorSeries().getFinalColor());
+ mxColorNegative->SelectEntry(maAttributes.getColorNegative().getFinalColor());
+ mxColorMarker->SelectEntry(maAttributes.getColorMarkers().getFinalColor());
+ mxColorHigh->SelectEntry(maAttributes.getColorHigh().getFinalColor());
+ mxColorLow->SelectEntry(maAttributes.getColorLow().getFinalColor());
+ mxColorFirst->SelectEntry(maAttributes.getColorFirst().getFinalColor());
+ mxColorLast->SelectEntry(maAttributes.getColorLast().getFinalColor());
mxCheckButtonNegative->set_active(maAttributes.isNegative());
mxCheckButtonMarker->set_active(maAttributes.isMarkers());
@@ -526,13 +526,13 @@ bool SparklineDialog::checkValidInputOutput()
void SparklineDialog::perform()
{
- maAttributes.setColorSeries(mxColorSeries->GetSelectEntryColor());
- maAttributes.setColorNegative(mxColorNegative->GetSelectEntryColor());
- maAttributes.setColorMarkers(mxColorMarker->GetSelectEntryColor());
- maAttributes.setColorHigh(mxColorHigh->GetSelectEntryColor());
- maAttributes.setColorLow(mxColorLow->GetSelectEntryColor());
- maAttributes.setColorFirst(mxColorFirst->GetSelectEntryColor());
- maAttributes.setColorLast(mxColorLast->GetSelectEntryColor());
+ maAttributes.setColorSeries(mxColorSeries->GetSelectedEntry().getComplexColor());
+ maAttributes.setColorNegative(mxColorNegative->GetSelectedEntry().getComplexColor());
+ maAttributes.setColorMarkers(mxColorMarker->GetSelectedEntry().getComplexColor());
+ maAttributes.setColorHigh(mxColorHigh->GetSelectedEntry().getComplexColor());
+ maAttributes.setColorLow(mxColorLow->GetSelectedEntry().getComplexColor());
+ maAttributes.setColorFirst(mxColorFirst->GetSelectedEntry().getComplexColor());
+ maAttributes.setColorLast(mxColorLast->GetSelectedEntry().getComplexColor());
auto& rDocFunc = mrViewData.GetDocShell()->GetDocFunc();
diff --git a/sc/source/ui/inc/SparklineRenderer.hxx b/sc/source/ui/inc/SparklineRenderer.hxx
index 616d667ecb48..23d62d6d6ae6 100644
--- a/sc/source/ui/inc/SparklineRenderer.hxx
+++ b/sc/source/ui/inc/SparklineRenderer.hxx
@@ -296,27 +296,27 @@ private:
if (rAttributes.isFirst() && nValueIndex == rSparklineValues.mnFirstIndex)
{
- createMarker(aMarkers, x, y, rAttributes.getColorFirst());
+ createMarker(aMarkers, x, y, rAttributes.getColorFirst().getFinalColor());
}
else if (rAttributes.isLast() && nValueIndex == rSparklineValues.mnLastIndex)
{
- createMarker(aMarkers, x, y, rAttributes.getColorLast());
+ createMarker(aMarkers, x, y, rAttributes.getColorLast().getFinalColor());
}
else if (rAttributes.isHigh() && nValue == rSparklineValues.mfMaximum)
{
- createMarker(aMarkers, x, y, rAttributes.getColorHigh());
+ createMarker(aMarkers, x, y, rAttributes.getColorHigh().getFinalColor());
}
else if (rAttributes.isLow() && nValue == rSparklineValues.mfMinimum)
{
- createMarker(aMarkers, x, y, rAttributes.getColorLow());
+ createMarker(aMarkers, x, y, rAttributes.getColorLow().getFinalColor());
}
else if (rAttributes.isNegative() && nValue < 0.0)
{
- createMarker(aMarkers, x, y, rAttributes.getColorNegative());
+ createMarker(aMarkers, x, y, rAttributes.getColorNegative().getFinalColor());
}
else if (rAttributes.isMarkers())
{
- createMarker(aMarkers, x, y, rAttributes.getColorMarkers());
+ createMarker(aMarkers, x, y, rAttributes.getColorMarkers().getFinalColor());
}
}
@@ -341,12 +341,12 @@ private:
aAxisPolygon.append({ x1, y });
aAxisPolygon.append({ x2, y });
- rRenderContext.SetLineColor(rAttributes.getColorAxis());
+ rRenderContext.SetLineColor(rAttributes.getColorAxis().getFinalColor());
rRenderContext.DrawPolyLineDirect(aMatrix, aAxisPolygon, 0.2 * mfScaleX);
}
}
- rRenderContext.SetLineColor(rAttributes.getColorSeries());
+ rRenderContext.SetLineColor(rAttributes.getColorSeries().getFinalColor());
for (auto& rPolygon : aPolygons)
{
@@ -371,33 +371,33 @@ private:
{
if (rAttributes.isFirst() && nValueIndex == rSparklineValues.mnFirstIndex)
{
- rRenderContext.SetLineColor(rAttributes.getColorFirst());
- rRenderContext.SetFillColor(rAttributes.getColorFirst());
+ rRenderContext.SetLineColor(rAttributes.getColorFirst().getFinalColor());
+ rRenderContext.SetFillColor(rAttributes.getColorFirst().getFinalColor());
}
else if (rAttributes.isLast() && nValueIndex == rSparklineValues.mnLastIndex)
{
- rRenderContext.SetLineColor(rAttributes.getColorLast());
- rRenderContext.SetFillColor(rAttributes.getColorLast());
+ rRenderContext.SetLineColor(rAttributes.getColorLast().getFinalColor());
+ rRenderContext.SetFillColor(rAttributes.getColorLast().getFinalColor());
}
else if (rAttributes.isHigh() && nValue == rSparklineValues.mfMaximum)
{
- rRenderContext.SetLineColor(rAttributes.getColorHigh());
- rRenderContext.SetFillColor(rAttributes.getColorHigh());
+ rRenderContext.SetLineColor(rAttributes.getColorHigh().getFinalColor());
+ rRenderContext.SetFillColor(rAttributes.getColorHigh().getFinalColor());
}
else if (rAttributes.isLow() && nValue == rSparklineValues.mfMinimum)
{
- rRenderContext.SetLineColor(rAttributes.getColorLow());
- rRenderContext.SetFillColor(rAttributes.getColorLow());
+ rRenderContext.SetLineColor(rAttributes.getColorLow().getFinalColor());
+ rRenderContext.SetFillColor(rAttributes.getColorLow().getFinalColor());
}
else if (rAttributes.isNegative() && nValue < 0.0)
{
- rRenderContext.SetLineColor(rAttributes.getColorNegative());
- rRenderContext.SetFillColor(rAttributes.getColorNegative());
+ rRenderContext.SetLineColor(rAttributes.getColorNegative().getFinalColor());
+ rRenderContext.SetFillColor(rAttributes.getColorNegative().getFinalColor());
}
else
{
- rRenderContext.SetLineColor(rAttributes.getColorSeries());
- rRenderContext.SetFillColor(rAttributes.getColorSeries());
+ rRenderContext.SetLineColor(rAttributes.getColorSeries().getFinalColor());
+ rRenderContext.SetFillColor(rAttributes.getColorSeries().getFinalColor());
}
}
@@ -441,7 +441,7 @@ private:
aAxisPolygon.append({ x1, nZeroPosition });
aAxisPolygon.append({ x2, nZeroPosition });
- rRenderContext.SetLineColor(rAttributes.getColorAxis());
+ rRenderContext.SetLineColor(rAttributes.getColorAxis().getFinalColor());
rRenderContext.DrawPolyLineDirect(aMatrix, aAxisPolygon, 0.2 * mfScaleX);
}
}
diff --git a/sc/source/ui/sparklines/SparklineAttributes.cxx b/sc/source/ui/sparklines/SparklineAttributes.cxx
index 20b8bf6feee6..080c38f5ee64 100644
--- a/sc/source/ui/sparklines/SparklineAttributes.cxx
+++ b/sc/source/ui/sparklines/SparklineAttributes.cxx
@@ -16,14 +16,14 @@ namespace sc
class SparklineAttributes::Implementation
{
public:
- Color m_aColorSeries;
- Color m_aColorNegative;
- Color m_aColorAxis;
- Color m_aColorMarkers;
- Color m_aColorFirst;
- Color m_aColorLast;
- Color m_aColorHigh;
- Color m_aColorLow;
+ model::ComplexColor m_aColorSeries;
+ model::ComplexColor m_aColorNegative;
+ model::ComplexColor m_aColorAxis;
+ model::ComplexColor m_aColorMarkers;
+ model::ComplexColor m_aColorFirst;
+ model::ComplexColor m_aColorLast;
+ model::ComplexColor m_aColorHigh;
+ model::ComplexColor m_aColorLow;
AxisType m_eMinAxisType;
AxisType m_eMaxAxisType;
@@ -48,19 +48,18 @@ public:
std::optional<double> m_aManualMax;
std::optional<double> m_aManualMin;
-
- static constexpr ::Color COL_STANDARD_RED = 0xff0000;
- static constexpr ::Color COL_STANDARD_BLUE = 0x2a6099;
+ static constexpr Color COL_STANDARD_RED = 0xff0000;
+ static constexpr Color COL_STANDARD_BLUE = 0x2a6099;
Implementation()
- : m_aColorSeries(COL_STANDARD_BLUE)
- , m_aColorNegative(COL_STANDARD_RED)
- , m_aColorAxis(COL_STANDARD_RED)
- , m_aColorMarkers(COL_STANDARD_RED)
- , m_aColorFirst(COL_STANDARD_RED)
- , m_aColorLast(COL_STANDARD_RED)
- , m_aColorHigh(COL_STANDARD_RED)
- , m_aColorLow(COL_STANDARD_RED)
+ : m_aColorSeries(model::ComplexColor::RGB(COL_STANDARD_BLUE))
+ , m_aColorNegative(model::ComplexColor::RGB(COL_STANDARD_RED))
+ , m_aColorAxis(model::ComplexColor::RGB(COL_STANDARD_RED))
+ , m_aColorMarkers(model::ComplexColor::RGB(COL_STANDARD_RED))
+ , m_aColorFirst(model::ComplexColor::RGB(COL_STANDARD_RED))
+ , m_aColorLast(model::ComplexColor::RGB(COL_STANDARD_RED))
+ , m_aColorHigh(model::ComplexColor::RGB(COL_STANDARD_RED))
+ , m_aColorLow(model::ComplexColor::RGB(COL_STANDARD_RED))
, m_eMinAxisType(AxisType::Individual)
, m_eMaxAxisType(AxisType::Individual)
, m_fLineWeight(0.75)
@@ -146,41 +145,92 @@ bool SparklineAttributes::operator==(SparklineAttributes const& rOther) const
return m_aImplementation == rOther.m_aImplementation;
}
-Color SparklineAttributes::getColorSeries() const { return m_aImplementation->m_aColorSeries; }
+void SparklineAttributes::resetColors()
+{
+ m_aImplementation->m_aColorSeries = model::ComplexColor();
+ m_aImplementation->m_aColorNegative = model::ComplexColor();
+ m_aImplementation->m_aColorAxis = model::ComplexColor();
+ m_aImplementation->m_aColorMarkers = model::ComplexColor();
+ m_aImplementation->m_aColorFirst = model::ComplexColor();
+ m_aImplementation->m_aColorLast = model::ComplexColor();
+ m_aImplementation->m_aColorHigh = model::ComplexColor();
+ m_aImplementation->m_aColorLow = model::ComplexColor();
+}
-void SparklineAttributes::setColorSeries(Color aColor)
+model::ComplexColor SparklineAttributes::getColorSeries() const
{
- m_aImplementation->m_aColorSeries = aColor;
+ return m_aImplementation->m_aColorSeries;
}
-Color SparklineAttributes::getColorNegative() const { return m_aImplementation->m_aColorNegative; }
+void SparklineAttributes::setColorSeries(model::ComplexColor const& rColor)
+{
+ m_aImplementation->m_aColorSeries = rColor;
+}
-void SparklineAttributes::setColorNegative(Color aColor)
+model::ComplexColor SparklineAttributes::getColorNegative() const
{
- m_aImplementation->m_aColorNegative = aColor;
+ return m_aImplementation->m_aColorNegative;
}
-Color SparklineAttributes::getColorAxis() const { return m_aImplementation->m_aColorAxis; }
+void SparklineAttributes::setColorNegative(model::ComplexColor const& rColor)
+{
+ m_aImplementation->m_aColorNegative = rColor;
+}
-void SparklineAttributes::setColorAxis(Color aColor) { m_aImplementation->m_aColorAxis = aColor; }
+model::ComplexColor SparklineAttributes::getColorAxis() const
+{
+ return m_aImplementation->m_aColorAxis;
+}
-Color SparklineAttributes::getColorMarkers() const { return m_aImplementation->m_aColorMarkers; }
-void SparklineAttributes::setColorMarkers(Color aColor)
+void SparklineAttributes::setColorAxis(model::ComplexColor const& rColor)
{
- m_aImplementation->m_aColorMarkers = aColor;
+ m_aImplementation->m_aColorAxis = rColor;
}
-Color SparklineAttributes::getColorFirst() const { return m_aImplementation->m_aColorFirst; }
-void SparklineAttributes::setColorFirst(Color aColor) { m_aImplementation->m_aColorFirst = aColor; }
+model::ComplexColor SparklineAttributes::getColorMarkers() const
+{
+ return m_aImplementation->m_aColorMarkers;
+}
+void SparklineAttributes::setColorMarkers(model::ComplexColor const& rColor)
+{
+ m_aImplementation->m_aColorMarkers = rColor;
+}
+
+model::ComplexColor SparklineAttributes::getColorFirst() const
+{
+ return m_aImplementation->m_aColorFirst;
+}
+void SparklineAttributes::setColorFirst(model::ComplexColor const& rColor)
+{
+ m_aImplementation->m_aColorFirst = rColor;
+}
-Color SparklineAttributes::getColorLast() const { return m_aImplementation->m_aColorLast; }
-void SparklineAttributes::setColorLast(Color aColor) { m_aImplementation->m_aColorLast = aColor; }
+model::ComplexColor SparklineAttributes::getColorLast() const
+{
+ return m_aImplementation->m_aColorLast;
+}
+void SparklineAttributes::setColorLast(model::ComplexColor const& rColor)
+{
+ m_aImplementation->m_aColorLast = rColor;
+}
-Color SparklineAttributes::getColorHigh() const { return m_aImplementation->m_aColorHigh; }
-void SparklineAttributes::setColorHigh(Color aColor) { m_aImplementation->m_aColorHigh = aColor; }
+model::ComplexColor SparklineAttributes::getColorHigh() const
+{
+ return m_aImplementation->m_aColorHigh;
+}
+void SparklineAttributes::setColorHigh(model::ComplexColor const& rColor)
+{
+ m_aImplementation->m_aColorHigh = rColor;
+}
-Color SparklineAttributes::getColorLow() const { return m_aImplementation->m_aColorLow; }
-void SparklineAttributes::setColorLow(Color aColor) { m_aImplementation->m_aColorLow = aColor; }
+model::ComplexColor SparklineAttributes::getColorLow() const
+{
+ return m_aImplementation->m_aColorLow;
+}
+void SparklineAttributes::setColorLow(model::ComplexColor const& rColor)
+{
+ m_aImplementation->m_aColorLow = rColor;
+}
AxisType SparklineAttributes::getMinAxisType() const { return m_aImplementation->m_eMinAxisType; }
void SparklineAttributes::setMinAxisType(AxisType eAxisType)
diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx b/sc/source/ui/theme/ThemeColorChanger.cxx
index 66683adbd682..be003b539636 100644
--- a/sc/source/ui/theme/ThemeColorChanger.cxx
+++ b/sc/source/ui/theme/ThemeColorChanger.cxx
@@ -29,9 +29,12 @@
#include <document.hxx>
#include <address.hxx>
#include <dociter.hxx>
+#include <docfunc.hxx>
#include <tabvwsh.hxx>
#include <undostyl.hxx>
#include <undoblk.hxx>
+#include <SparklineGroup.hxx>
+#include <SparklineList.hxx>
#include <undo/UndoThemeChange.hxx>
@@ -245,6 +248,52 @@ bool changeSheets(ScDocShell& rDocShell, ScDrawLayer* pModel,
return bChanged;
}
+model::ComplexColor modifyComplexColor(model::ComplexColor const& rComplexColor,
+ std::shared_ptr<model::ColorSet> const& pColorSet)
+{
+ model::ComplexColor aComplexColor(rComplexColor);
+
+ if (aComplexColor.isValidSchemeType())
+ {
+ Color aColor = pColorSet->getColor(aComplexColor.meSchemeType);
+ aColor = aComplexColor.applyTransformations(aColor);
+ aComplexColor.setFinalColor(aColor);
+ }
+ return aComplexColor;
+}
+
+void changeSparklines(ScDocShell& rDocShell, std::shared_ptr<model::ColorSet> const& pColorSet)
+{
+ ScDocument& rDocument = rDocShell.GetDocument();
+ auto& rDocFunc = rDocShell.GetDocFunc();
+ for (SCTAB nTab = 0; nTab < rDocument.GetTableCount(); ++nTab)
+ {
+ auto* pSparklineList = rDocument.GetSparklineList(nTab);
+ if (pSparklineList && !pSparklineList->getSparklineGroups().empty())
+ {
+ auto const& rSparklineGroups = pSparklineList->getSparklineGroups();
+ for (auto const& rSparklineGroup : rSparklineGroups)
+ {
+ auto aAttributes = rSparklineGroup->getAttributes();
+
+ aAttributes.setColorAxis(modifyComplexColor(aAttributes.getColorAxis(), pColorSet));
+ aAttributes.setColorSeries(
+ modifyComplexColor(aAttributes.getColorSeries(), pColorSet));
+ aAttributes.setColorNegative(
+ modifyComplexColor(aAttributes.getColorNegative(), pColorSet));
+ aAttributes.setColorMarkers(
+ modifyComplexColor(aAttributes.getColorMarkers(), pColorSet));
+ aAttributes.setColorHigh(modifyComplexColor(aAttributes.getColorHigh(), pColorSet));
+ aAttributes.setColorLow(modifyComplexColor(aAttributes.getColorLow(), pColorSet));
+ aAttributes.setColorFirst(
+ modifyComplexColor(aAttributes.getColorFirst(), pColorSet));
+ aAttributes.setColorLast(modifyComplexColor(aAttributes.getColorLast(), pColorSet));
+ rDocFunc.ChangeSparklineGroupAttributes(rSparklineGroup, aAttributes);
+ }
+ }
+ }
+}
+
void changeTheTheme(ScDocShell& rDocShell, std::shared_ptr<model::ColorSet> const& pColorSet)
{
ScDocument& rDocument = rDocShell.GetDocument();
@@ -295,6 +344,7 @@ void ThemeColorChanger::apply(std::shared_ptr<model::ColorSet> const& pColorSet)
bool bChanged = false;
bChanged = changeStyles(m_rDocShell, pColorSet) || bChanged;
bChanged = changeSheets(m_rDocShell, rDocument.GetDrawLayer(), pColorSet) || bChanged;
+ changeSparklines(m_rDocShell, pColorSet);
changeTheTheme(m_rDocShell, pColorSet);
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index 593df76f851e..c9571ac2a77a 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -1714,6 +1714,46 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
<rng:ref name="color"/>
</rng:attribute>
</rng:optional>
+ <rng:optional>
+ <rng:element name="calcext:sparkline-series-complex-color">
+ <rng:ref name="loext-complex-color-definition"/>
+ </rng:element>
+ </rng:optional>
+ <rng:optional>
+ <rng:element name="calcext:sparkline-negative-complex-color">
+ <rng:ref name="loext-complex-color-definition"/>
+ </rng:element>
+ </rng:optional>
+ <rng:optional>
+ <rng:element name="calcext:sparkline-axis-complex-color">
+ <rng:ref name="loext-complex-color-definition"/>
+ </rng:element>
+ </rng:optional>
+ <rng:optional>
+ <rng:element name="calcext:sparkline-markers-complex-color">
+ <rng:ref name="loext-complex-color-definition"/>
+ </rng:element>
+ </rng:optional>
+ <rng:optional>
+ <rng:element name="calcext:sparkline-first-complex-color">
+ <rng:ref name="loext-complex-color-definition"/>
+ </rng:element>
+ </rng:optional>
+ <rng:optional>
+ <rng:element name="calcext:sparkline-last-complex-color">
+ <rng:ref name="loext-complex-color-definition"/>
+ </rng:element>
+ </rng:optional>
+ <rng:optional>
+ <rng:element name="calcext:sparkline-high-complex-color">
+ <rng:ref name="loext-complex-color-definition"/>
+ </rng:element>
+ </rng:optional>
+ <rng:optional>
+ <rng:element name="calcext:sparkline-low-complex-color">
+ <rng:ref name="loext-complex-color-definition"/>
+ </rng:element>
+ </rng:optional>
<rng:element name="calcext:sparklines">
<rng:oneOrMore>
<rng:element name="calcext:sparkline">
@@ -3508,6 +3548,7 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
</rng:choice>
</rng:define>
+ <!-- TODO no proposal - Document Themes -->
<rng:define name="loext-transformation">
<rng:element name="loext:transformation">
<rng:attribute name="loext:type">
@@ -3519,6 +3560,7 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
</rng:element>
</rng:define>
+ <!-- TODO no proposal - Document Themes -->
<rng:define name="loext-complex-color-attlist">
<rng:interleave>
<rng:attribute name="loext:color-type">
@@ -3532,21 +3574,25 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
</rng:interleave>
</rng:define>
+ <!-- TODO no proposal - Document Themes -->
+ <rng:define name="loext-complex-color-definition">
+ <rng:ref name="loext-complex-color-attlist"/>
+ <rng:zeroOrMore>
+ <rng:ref name="loext-transformation"/>
+ </rng:zeroOrMore>
+ </rng:define>
+
+ <!-- TODO no proposal - Document Themes -->
<rng:define name="loext-char-complex-color">
<rng:element name="loext:char-complex-color">
- <rng:ref name="loext-complex-color-attlist"/>
- <rng:zeroOrMore>
- <rng:ref name="loext-transformation"/>
- </rng:zeroOrMore>
+ <rng:ref name="loext-complex-color-definition"/>
</rng:element>
</rng:define>
+ <!-- TODO no proposal - Document Themes -->
<rng:define name="loext-fill-complex-color">
<rng:element name="loext:fill-complex-color">
- <rng:ref name="loext-complex-color-attlist"/>
- <rng:zeroOrMore>
- <rng:ref name="loext-transformation"/>
- </rng:zeroOrMore>
+ <rng:ref name="loext-complex-color-definition"/>
</rng:element>
</rng:define>
@@ -3567,50 +3613,35 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
<!-- TODO no proposal - Document Themes -->
<rng:define name="loext-background-complex-color">
<rng:element name="loext:background-complex-color">
- <rng:ref name="loext-complex-color-attlist"/>
- <rng:zeroOrMore>
- <rng:ref name="loext-transformation"/>
- </rng:zeroOrMore>
+ <rng:ref name="loext-complex-color-definition"/>
</rng:element>
</rng:define>
<!-- TODO no proposal - Document Themes -->
<rng:define name="loext-border-bottom-complex-color">
<rng:element name="loext:border-bottom-complex-color">
- <rng:ref name="loext-complex-color-attlist"/>
- <rng:zeroOrMore>
- <rng:ref name="loext-transformation"/>
- </rng:zeroOrMore>
+ <rng:ref name="loext-complex-color-definition"/>
</rng:element>
</rng:define>
<!-- TODO no proposal - Document Themes -->
<rng:define name="loext-border-top-complex-color">
<rng:element name="loext:border-top-complex-color">
- <rng:ref name="loext-complex-color-attlist"/>
- <rng:zeroOrMore>
- <rng:ref name="loext-transformation"/>
- </rng:zeroOrMore>
+ <rng:ref name="loext-complex-color-definition"/>
</rng:element>
</rng:define>
<!-- TODO no proposal - Document Themes -->
<rng:define name="loext-border-left-complex-color">
<rng:element name="loext:border-left-complex-color">
- <rng:ref name="loext-complex-color-attlist"/>
- <rng:zeroOrMore>
- <rng:ref name="loext-transformation"/>
- </rng:zeroOrMore>
+ <rng:ref name="loext-complex-color-definition"/>
</rng:element>
</rng:define>
<!-- TODO no proposal - Document Themes -->
<rng:define name="loext-border-right-complex-color">
<rng:element name="loext:border-right-complex-color">
- <rng:ref name="loext-complex-color-attlist"/>
- <rng:zeroOrMore>
- <rng:ref name="loext-transformation"/>
- </rng:zeroOrMore>
+ <rng:ref name="loext-complex-color-definition"/>
</rng:element>
</rng:define>
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 2ecc3ea5ce7b..6564a2b866d7 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1813,10 +1813,18 @@ namespace xmloff::token {
TOKEN( "source-range-address", XML_SOURCE_RANGE_ADDRESS ),
TOKEN( "source-service", XML_SOURCE_SERVICE ),
TOKEN( "space-before", XML_SPACE_BEFORE ),
- TOKEN( "sparkline-groups", XML_SPARKLINE_GROUPS ),
- TOKEN( "sparkline-group", XML_SPARKLINE_GROUP ),
- TOKEN( "sparklines", XML_SPARKLINES ),
TOKEN( "sparkline", XML_SPARKLINE ),
+ TOKEN( "sparklines", XML_SPARKLINES ),
+ TOKEN( "sparkline-axis-complex-color", XML_SPARKLINE_AXIS_COMPLEX_COLOR),
+ TOKEN( "sparkline-first-complex-color", XML_SPARKLINE_FIRST_COMPLEX_COLOR),
+ TOKEN( "sparkline-group", XML_SPARKLINE_GROUP ),
+ TOKEN( "sparkline-groups", XML_SPARKLINE_GROUPS ),
+ TOKEN( "sparkline-high-complex-color", XML_SPARKLINE_HIGH_COMPLEX_COLOR),
+ TOKEN( "sparkline-last-complex-color", XML_SPARKLINE_LAST_COMPLEX_COLOR),
+ TOKEN( "sparkline-low-complex-color", XML_SPARKLINE_LOW_COMPLEX_COLOR),
+ TOKEN( "sparkline-markers-complex-color", XML_SPARKLINE_MARKERS_COMPLEX_COLOR),
+ TOKEN( "sparkline-negative-complex-color", XML_SPARKLINE_NEGATIVE_COMPLEX_COLOR),
+ TOKEN( "sparkline-series-complex-color", XML_SPARKLINE_SERIES_COMPLEX_COLOR),
TOKEN( "span", XML_SPAN ),
TOKEN( "specular", XML_SPECULAR ),
TOKEN( "specular-color", XML_SPECULAR_COLOR ),
diff --git a/xmloff/source/draw/XMLShapePropertySetContext.cxx b/xmloff/source/draw/XMLShapePropertySetContext.cxx
index 42cff9db52d8..40287e6516e0 100644
--- a/xmloff/source/draw/XMLShapePropertySetContext.cxx
+++ b/xmloff/source/draw/XMLShapePropertySetContext.cxx
@@ -84,7 +84,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLShapePropertySetCon
return new XMLTextColumnsContext(GetImport(), nElement, xAttrList, rProp, rProperties);
case CTF_COMPLEX_COLOR:
- return new XMLComplexColorContext(GetImport(), nElement, xAttrList, rProp, rProperties);
+ return new XMLPropertyComplexColorContext(GetImport(), nElement, xAttrList, rProp, rProperties);
}
return SvXMLPropertySetContext::createFastChildContext( nElement,
diff --git a/xmloff/source/style/StylePropertiesContext.cxx b/xmloff/source/style/StylePropertiesContext.cxx
index 1bda191485e6..910b7873d54f 100644
--- a/xmloff/source/style/StylePropertiesContext.cxx
+++ b/xmloff/source/style/StylePropertiesContext.cxx
@@ -35,7 +35,8 @@ StylePropertiesContext::createFastChildContext(
{
if (nElement == XML_ELEMENT(LO_EXT, XML_CHAR_COMPLEX_COLOR))
{
- return new XMLComplexColorContext(GetImport(), nElement, xAttrList, rProperty, rProperties);
+ return new XMLPropertyComplexColorContext(GetImport(), nElement, xAttrList, rProperty,
+ rProperties);
}
return SvXMLPropertySetContext::createFastChildContext(nElement, xAttrList, rProperties,
rProperty);
diff --git a/xmloff/source/text/XMLComplexColorContext.cxx b/xmloff/source/text/XMLComplexColorContext.cxx
index 39b8687cbc51..7b4e299f95e6 100644
--- a/xmloff/source/text/XMLComplexColorContext.cxx
+++ b/xmloff/source/text/XMLComplexColorContext.cxx
@@ -19,6 +19,7 @@
#include <xmloff/xmlement.hxx>
#include <xmloff/xmlprhdl.hxx>
#include <xmloff/XMLComplexColorContext.hxx>
+#include <docmodel/uno/UnoComplexColor.hxx>
using namespace css;
using namespace xmloff::token;
@@ -38,12 +39,13 @@ SvXMLEnumMapEntry<sal_Int16> const pXML_ThemeColor_Enum[] = { { XML_NONE, -1 },
{ XML_FOLLOWED_HYPERLINK, 11 },
{ XML_TOKEN_INVALID, 0 } };
-XMLComplexColorContext::XMLComplexColorContext(
- SvXMLImport& rImport, sal_Int32 nElement,
- const uno::Reference<xml::sax::XFastAttributeList>& xAttrList, const XMLPropertyState& rProp,
- std::vector<XMLPropertyState>& rProps)
- : XMLElementPropertyContext(rImport, nElement, rProp, rProps)
- , mnRootElement(nElement)
+XMLComplexColorImport::XMLComplexColorImport(model::ComplexColor& rComplexColor)
+ : mrComplexColor(rComplexColor)
+{
+}
+
+void XMLComplexColorImport::fillAttributes(
+ const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
{
for (auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
@@ -54,7 +56,7 @@ XMLComplexColorContext::XMLComplexColorContext(
sal_Int16 nValue = -1;
if (SvXMLUnitConverter::convertEnum(nValue, aIter.toView(), pXML_ThemeColor_Enum))
{
- maComplexColor.setSchemeColor(model::convertToThemeColorType(nValue));
+ mrComplexColor.setSchemeColor(model::convertToThemeColorType(nValue));
}
break;
}
@@ -62,7 +64,7 @@ XMLComplexColorContext::XMLComplexColorContext(
{
const OUString aValue = aIter.toString();
if (aValue == u"theme")
- maComplexColor.setType(model::ColorType::Scheme);
+ mrComplexColor.setType(model::ColorType::Scheme);
// TODO - handle other color types
break;
}
@@ -73,8 +75,7 @@ XMLComplexColorContext::XMLComplexColorContext(
}
}
-css::uno::Reference<css::xml::sax::XFastContextHandler>
-XMLComplexColorContext::createFastChildContext(
+bool XMLComplexColorImport::handleTransformContext(
sal_Int32 nElement, const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList)
{
if (nElement == XML_ELEMENT(LO_EXT, XML_TRANSFORMATION))
@@ -110,24 +111,62 @@ XMLComplexColorContext::createFastChildContext(
break;
}
}
- maComplexColor.addTransformation({ eTransformationType, nTransformationValue });
- return this;
+ mrComplexColor.addTransformation({ eTransformationType, nTransformationValue });
+ return true;
}
XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
+ return false;
+}
+
+XMLPropertyComplexColorContext::XMLPropertyComplexColorContext(
+ SvXMLImport& rImport, sal_Int32 nElement,
+ const uno::Reference<xml::sax::XFastAttributeList>& xAttrList, const XMLPropertyState& rProp,
+ std::vector<XMLPropertyState>& rProps)
+ : XMLElementPropertyContext(rImport, nElement, rProp, rProps)
+ , mnRootElement(nElement)
+ , maComplexColorImport(maComplexColor)
+{
+ maComplexColorImport.fillAttributes(xAttrList);
+}
+
+css::uno::Reference<css::xml::sax::XFastContextHandler>
+XMLPropertyComplexColorContext::createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList)
+{
+ if (maComplexColorImport.handleTransformContext(nElement, xAttrList))
+ return this;
return nullptr;
}
-void XMLComplexColorContext::endFastElement(sal_Int32 nElement)
+void XMLPropertyComplexColorContext::endFastElement(sal_Int32 nElement)
{
if (nElement == mnRootElement)
{
- if (maComplexColor.getSchemeType() != model::ThemeColorType::Unknown)
+ if (getComplexColor().getSchemeType() != model::ThemeColorType::Unknown)
{
- aProp.maValue <<= model::color::createXComplexColor(maComplexColor);
+ aProp.maValue <<= model::color::createXComplexColor(getComplexColor());
SetInsert(true);
}
}
XMLElementPropertyContext::endFastElement(nElement);
}
+XMLComplexColorContext::XMLComplexColorContext(
+ SvXMLImport& rImport, model::ComplexColor& rComplexColor,
+ const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
+ : SvXMLImportContext(rImport)
+ , maComplexColorImport(rComplexColor)
+{
+ maComplexColorImport.fillAttributes(xAttrList);
+}
+
+css::uno::Reference<css::xml::sax::XFastContextHandler>
+XMLComplexColorContext::createFastChildContext(
+ sal_Int32 nElement, const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList)
+{
+ if (maComplexColorImport.handleTransformContext(nElement, xAttrList))
+ return this;
+ return nullptr;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLComplexColorExport.cxx b/xmloff/source/text/XMLComplexColorExport.cxx
index 6d950dff3051..4465e0d74585 100644
--- a/xmloff/source/text/XMLComplexColorExport.cxx
+++ b/xmloff/source/text/XMLComplexColorExport.cxx
@@ -12,7 +12,6 @@
#include <sal/config.h>
#include <docmodel/uno/UnoComplexColor.hxx>
-#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlnamespace.hxx>
#include <xmloff/xmluconv.hxx>
#include <xmloff/xmlexp.hxx>
@@ -34,24 +33,18 @@ constexpr const std::array<XMLTokenEnum, 12> constThemeColorTypeToToken{
};
}
-void XMLComplexColorExport::exportXML(const uno::Any& rAny, sal_uInt16 nPrefix,
- const OUString& rLocalName)
+void XMLComplexColorExport::doExport(model::ComplexColor const& rComplexColor, sal_uInt16 nPrefix,
+ const OUString& rLocalName)
{
- uno::Reference<util::XComplexColor> xComplexColor;
- rAny >>= xComplexColor;
- if (!xComplexColor.is())
+ if (rComplexColor.getSchemeType() == model::ThemeColorType::Unknown)
return;
- model::ComplexColor aComplexColor = model::color::getFromXComplexColor(xComplexColor);
- if (aComplexColor.getSchemeType() == model::ThemeColorType::Unknown)
- return;
-
- XMLTokenEnum nToken = constThemeColorTypeToToken[sal_Int16(aComplexColor.getSchemeType())];
+ XMLTokenEnum nToken = constThemeColorTypeToToken[sal_Int16(rComplexColor.getSchemeType())];
mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_THEME_TYPE, nToken);
mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_COLOR_TYPE, "theme");
SvXMLElementExport aComplexColorElement(mrExport, nPrefix, rLocalName, true, true);
- for (auto const& rTransform : aComplexColor.getTransformations())
+ for (auto const& rTransform : rComplexColor.getTransformations())
{
OUString aType;
switch (rTransform.meType)
@@ -82,4 +75,22 @@ void XMLComplexColorExport::exportXML(const uno::Any& rAny, sal_uInt16 nPrefix,
}
}
+void XMLComplexColorExport::exportComplexColor(model::ComplexColor const& rComplexColor,
+ sal_uInt16 nPrefix, XMLTokenEnum nToken)
+{
+ doExport(rComplexColor, nPrefix, GetXMLToken(nToken));
+}
+
+void XMLComplexColorExport::exportXML(const uno::Any& rAny, sal_uInt16 nPrefix,
+ const OUString& rLocalName)
+{
+ uno::Reference<util::XComplexColor> xComplexColor;
+ rAny >>= xComplexColor;
+ if (!xComplexColor.is())
+ return;
+
+ model::ComplexColor aComplexColor = model::color::getFromXComplexColor(xComplexColor);
+ doExport(aComplexColor, nPrefix, rLocalName);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextPropertySetContext.cxx b/xmloff/source/text/XMLTextPropertySetContext.cxx
index bfe18db611cd..472001287e05 100644
--- a/xmloff/source/text/XMLTextPropertySetContext.cxx
+++ b/xmloff/source/text/XMLTextPropertySetContext.cxx
@@ -70,7 +70,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetCont
break;
case CTF_COMPLEX_COLOR:
- return new XMLComplexColorContext(GetImport(), nElement, xAttrList, rProp, rProperties);
+ return new XMLPropertyComplexColorContext(GetImport(), nElement, xAttrList, rProp, rProperties);
break;
case CTF_DROPCAPFORMAT:
diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx
index 729a94211e6a..52574c10d650 100644
--- a/xmloff/source/text/XMLTextShapeStyleContext.cxx
+++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx
@@ -91,7 +91,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextShapePropertySe
break;
case CTF_COMPLEX_COLOR:
- return new XMLComplexColorContext(GetImport(), nElement, xAttrList, rProp, rProperties);
+ return new XMLPropertyComplexColorContext(GetImport(), nElement, xAttrList, rProp, rProperties);
case CTF_BACKGROUND_URL:
DBG_ASSERT( rProp.mnIndex >= 3 &&
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 3dd0ab102f4d..f700d2ac11ad 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -1713,10 +1713,18 @@ source-name
source-range-address
source-service
space-before
-sparkline-groups
-sparkline-group
-sparklines
sparkline
+sparklines
+sparkline-axis-complex-color
+sparkline-first-complex-color
+sparkline-group
+sparkline-groups
+sparkline-high-complex-color
+sparkline-last-complex-color
+sparkline-low-complex-color
+sparkline-markers-complex-color
+sparkline-negative-complex-color
+sparkline-series-complex-color
span
specular
specular-color