From 1df0565fb92972bd410e7db85eef1e4bec3fcc31 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Mon, 8 May 2023 14:09:00 +0900 Subject: use ComplexColor instead of ThemeColor for better OOXML compat. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In OOXML a color definition includes more represenations, one of which is scheme color (which is what is implemented in ThemeColor currently), but it supports other representations too (RGB, HSL, System,..). ComplexColor includes all the representations, so to have a better compatibility with OOXML, this changes all uses of ThemeColor to ComplexColor. In many cases the usage of ComplexColor isn't the same as the usage of ThemeColors, but this cases will need to be changed in a later commit. Change-Id: I9cc8acee2ac0a1998fe9b98247bcf4a96273149a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151492 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- xmloff/inc/XMLThemeColorContext.hxx | 4 ++-- xmloff/inc/XMLThemeColorHandler.hxx | 21 +++++++++------------ xmloff/inc/xmlprop.hxx | 4 ++-- 3 files changed, 13 insertions(+), 16 deletions(-) (limited to 'xmloff/inc') diff --git a/xmloff/inc/XMLThemeColorContext.hxx b/xmloff/inc/XMLThemeColorContext.hxx index 444de3b15588..8bab725c44a6 100644 --- a/xmloff/inc/XMLThemeColorContext.hxx +++ b/xmloff/inc/XMLThemeColorContext.hxx @@ -11,11 +11,11 @@ #include #include "XMLElementPropertyContext.hxx" -#include +#include class XMLThemeColorContext final : public XMLElementPropertyContext { - model::ThemeColor aThemeColor; + model::ComplexColor maComplexColor; sal_Int32 mnRootElement; public: diff --git a/xmloff/inc/XMLThemeColorHandler.hxx b/xmloff/inc/XMLThemeColorHandler.hxx index 2ede6f182048..052b0db6c1d4 100644 --- a/xmloff/inc/XMLThemeColorHandler.hxx +++ b/xmloff/inc/XMLThemeColorHandler.hxx @@ -9,12 +9,12 @@ #pragma once -#include +#include using namespace ::xmloff::token; using namespace css; -class XMLThemeColorHandler : public XMLPropertyHandler +class XMLComplexColorHandler : public XMLPropertyHandler { public: bool importXML(const OUString& /*rStrImpValue*/, css::uno::Any& /*rValue*/, @@ -31,16 +31,13 @@ public: bool equals(const css::uno::Any& rAny1, const css::uno::Any& rAny2) const override { - uno::Reference xThemeColor1; - uno::Reference xThemeColor2; - rAny1 >>= xThemeColor1; - rAny2 >>= xThemeColor2; - model::ThemeColor aThemeColor1; - model::ThemeColor aThemeColor2; - model::theme::setFromXThemeColor(aThemeColor1, xThemeColor1); - model::theme::setFromXThemeColor(aThemeColor2, xThemeColor2); - - return aThemeColor1 == aThemeColor2; + uno::Reference xComplexColor1; + uno::Reference xComplexColor2; + rAny1 >>= xComplexColor1; + rAny2 >>= xComplexColor2; + model::ComplexColor aComplexColor1 = model::color::getFromXComplexColor(xComplexColor1); + model::ComplexColor aComplexColor2 = model::color::getFromXComplexColor(xComplexColor2); + return aComplexColor1 == aComplexColor2; } }; diff --git a/xmloff/inc/xmlprop.hxx b/xmloff/inc/xmlprop.hxx index e2968b688e2c..14da0a3ad36d 100644 --- a/xmloff/inc/xmlprop.hxx +++ b/xmloff/inc/xmlprop.hxx @@ -56,7 +56,7 @@ inline constexpr OUStringLiteral PROP_CharBottomBorder = u"CharBottomBorder"; inline constexpr OUStringLiteral PROP_CharBottomBorderDistance = u"CharBottomBorderDistance"; inline constexpr OUStringLiteral PROP_CharCaseMap = u"CharCaseMap"; inline constexpr OUStringLiteral PROP_CharColor = u"CharColor"; -inline constexpr OUStringLiteral PROP_CharColorThemeReference = u"CharColorThemeReference"; +inline constexpr OUStringLiteral PROP_CharComplexColor = u"CharComplexColor"; inline constexpr OUStringLiteral PROP_CharCombineIsOn = u"CharCombineIsOn"; inline constexpr OUStringLiteral PROP_CharCombinePrefix = u"CharCombinePrefix"; inline constexpr OUStringLiteral PROP_CharCombineSuffix = u"CharCombineSuffix"; @@ -208,7 +208,7 @@ inline constexpr OUStringLiteral PROP_FillBitmapSizeX = u"FillBitmapSizeX"; inline constexpr OUStringLiteral PROP_FillBitmapSizeY = u"FillBitmapSizeY"; inline constexpr OUStringLiteral PROP_FillColor = u"FillColor"; inline constexpr OUStringLiteral PROP_FillColor2 = u"FillColor2"; -inline constexpr OUStringLiteral PROP_FillColorThemeReference = u"FillColorThemeReference"; +inline constexpr OUStringLiteral PROP_FillComplexColor = u"FillComplexColor"; inline constexpr OUStringLiteral PROP_FillGradientName = u"FillGradientName"; inline constexpr OUStringLiteral PROP_FillGradientStepCount = u"FillGradientStepCount"; inline constexpr OUStringLiteral PROP_FillHatchName = u"FillHatchName"; -- cgit