diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-05-08 14:09:00 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-05-12 05:00:28 +0200 |
commit | 1df0565fb92972bd410e7db85eef1e4bec3fcc31 (patch) | |
tree | 863c5cf54a5941ca84e2d76b68c4e895159d78de /xmloff | |
parent | 99a88c9e55872214ce01d89447d18708e47e956b (diff) |
use ComplexColor instead of ThemeColor for better OOXML compat.
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 <quikee@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/XMLThemeColorContext.hxx | 4 | ||||
-rw-r--r-- | xmloff/inc/XMLThemeColorHandler.hxx | 21 | ||||
-rw-r--r-- | xmloff/inc/xmlprop.hxx | 4 | ||||
-rw-r--r-- | xmloff/qa/unit/draw.cxx | 119 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/draw/XMLShapePropertySetContext.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/draw/sdpropls.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextPropertySetContext.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextShapeStyleContext.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/XMLThemeColorContext.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/XMLThemeColorExport.cxx | 19 | ||||
-rw-r--r-- | xmloff/source/text/txtexppr.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/text/txtprhdl.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/text/txtprmap.cxx | 6 |
14 files changed, 97 insertions, 106 deletions
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 <memory> #include "XMLElementPropertyContext.hxx" -#include <docmodel/uno/UnoThemeColor.hxx> +#include <docmodel/uno/UnoComplexColor.hxx> 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 <docmodel/uno/UnoThemeColor.hxx> +#include <docmodel/uno/UnoComplexColor.hxx> 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<util::XThemeColor> xThemeColor1; - uno::Reference<util::XThemeColor> 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<util::XComplexColor> xComplexColor1; + uno::Reference<util::XComplexColor> 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"; diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index e412a13c2833..716a1ad1cc7c 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -28,7 +28,7 @@ #include <svx/unopage.hxx> #include <svx/svdpage.hxx> #include <svx/svdomedia.hxx> -#include <docmodel/uno/UnoThemeColor.hxx> +#include <docmodel/uno/UnoComplexColor.hxx> #include <docmodel/uno/UnoTheme.hxx> #include <docmodel/theme/Theme.hxx> @@ -292,17 +292,16 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColorExportImport) uno::Reference<drawing::XShape> xShape(getShape(0)); CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY); - uno::Reference<util::XThemeColor> xThemeColor; - xShapeProperties->getPropertyValue("FillColorThemeReference") >>= xThemeColor; - CPPUNIT_ASSERT(xThemeColor.is()); - model::ThemeColor aThemeColor; - model::theme::setFromXThemeColor(aThemeColor, xThemeColor); - CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aThemeColor.getType()); - CPPUNIT_ASSERT_EQUAL(size_t(2), aThemeColor.getTransformations().size()); - auto const& rTrans1 = aThemeColor.getTransformations()[0]; + uno::Reference<util::XComplexColor> xComplexColor; + xShapeProperties->getPropertyValue("FillComplexColor") >>= xComplexColor; + CPPUNIT_ASSERT(xComplexColor.is()); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getSchemeType()); + CPPUNIT_ASSERT_EQUAL(size_t(2), aComplexColor.getTransformations().size()); + auto const& rTrans1 = aComplexColor.getTransformations()[0]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTrans1.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(2000), rTrans1.mnValue); - auto const& rTrans2 = aThemeColor.getTransformations()[1]; + auto const& rTrans2 = aComplexColor.getTransformations()[1]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTrans2.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(8000), rTrans2.mnValue); } @@ -310,17 +309,16 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColorExportImport) uno::Reference<drawing::XShape> xShape(getShape(1)); CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY); - uno::Reference<util::XThemeColor> xThemeColor; - xShapeProperties->getPropertyValue("FillColorThemeReference") >>= xThemeColor; - CPPUNIT_ASSERT(xThemeColor.is()); - model::ThemeColor aThemeColor; - model::theme::setFromXThemeColor(aThemeColor, xThemeColor); - CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aThemeColor.getType()); - CPPUNIT_ASSERT_EQUAL(size_t(2), aThemeColor.getTransformations().size()); - auto const& rTrans1 = aThemeColor.getTransformations()[0]; + uno::Reference<util::XComplexColor> xComplexColor; + xShapeProperties->getPropertyValue("FillComplexColor") >>= xComplexColor; + CPPUNIT_ASSERT(xComplexColor.is()); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getSchemeType()); + CPPUNIT_ASSERT_EQUAL(size_t(2), aComplexColor.getTransformations().size()); + auto const& rTrans1 = aComplexColor.getTransformations()[0]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTrans1.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(6000), rTrans1.mnValue); - auto const& rTrans2 = aThemeColor.getTransformations()[1]; + auto const& rTrans2 = aComplexColor.getTransformations()[1]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTrans2.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTrans2.mnValue); } @@ -328,14 +326,13 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColorExportImport) uno::Reference<drawing::XShape> xShape(getShape(2)); CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY); - uno::Reference<util::XThemeColor> xThemeColor; - xShapeProperties->getPropertyValue("FillColorThemeReference") >>= xThemeColor; - CPPUNIT_ASSERT(xThemeColor.is()); - model::ThemeColor aThemeColor; - model::theme::setFromXThemeColor(aThemeColor, xThemeColor); - CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aThemeColor.getType()); - CPPUNIT_ASSERT_EQUAL(size_t(1), aThemeColor.getTransformations().size()); - auto const& rTrans1 = aThemeColor.getTransformations()[0]; + uno::Reference<util::XComplexColor> xComplexColor; + xShapeProperties->getPropertyValue("FillComplexColor") >>= xComplexColor; + CPPUNIT_ASSERT(xComplexColor.is()); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getSchemeType()); + CPPUNIT_ASSERT_EQUAL(size_t(1), aComplexColor.getTransformations().size()); + auto const& rTrans1 = aComplexColor.getTransformations()[0]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTrans1.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(5000), rTrans1.mnValue); } @@ -348,17 +345,17 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColorExportImport) CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xPortion = getShapeTextPortion(0, xShape); CPPUNIT_ASSERT(xPortion.is()); - uno::Reference<util::XThemeColor> xThemeColor; - xPortion->getPropertyValue("CharColorThemeReference") >>= xThemeColor; - CPPUNIT_ASSERT(xThemeColor.is()); - model::ThemeColor aThemeColor; - model::theme::setFromXThemeColor(aThemeColor, xThemeColor); - CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aThemeColor.getType()); - CPPUNIT_ASSERT_EQUAL(size_t(2), aThemeColor.getTransformations().size()); - auto const& rTrans1 = aThemeColor.getTransformations()[0]; + uno::Reference<util::XComplexColor> xComplexColor; + xPortion->getPropertyValue("CharComplexColor") >>= xComplexColor; + CPPUNIT_ASSERT(xComplexColor.is()); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getSchemeType()); + auto const& rTransforms = aComplexColor.getTransformations(); + CPPUNIT_ASSERT_EQUAL(size_t(2), rTransforms.size()); + auto const& rTrans1 = rTransforms[0]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTrans1.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(2000), rTrans1.mnValue); - auto const& rTrans2 = aThemeColor.getTransformations()[1]; + auto const& rTrans2 = rTransforms[1]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTrans2.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(8000), rTrans2.mnValue); } @@ -369,17 +366,17 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColorExportImport) CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xPortion = getShapeTextPortion(0, xShape); CPPUNIT_ASSERT(xPortion.is()); - uno::Reference<util::XThemeColor> xThemeColor; - xPortion->getPropertyValue("CharColorThemeReference") >>= xThemeColor; - CPPUNIT_ASSERT(xThemeColor.is()); - model::ThemeColor aThemeColor; - model::theme::setFromXThemeColor(aThemeColor, xThemeColor); - CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aThemeColor.getType()); - CPPUNIT_ASSERT_EQUAL(size_t(2), aThemeColor.getTransformations().size()); - auto const& rTrans1 = aThemeColor.getTransformations()[0]; + uno::Reference<util::XComplexColor> xComplexColor; + xPortion->getPropertyValue("CharComplexColor") >>= xComplexColor; + CPPUNIT_ASSERT(xComplexColor.is()); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getSchemeType()); + auto const& rTransforms = aComplexColor.getTransformations(); + CPPUNIT_ASSERT_EQUAL(size_t(2), rTransforms.size()); + auto const& rTrans1 = rTransforms[0]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTrans1.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(6000), rTrans1.mnValue); - auto const& rTrans2 = aThemeColor.getTransformations()[1]; + auto const& rTrans2 = rTransforms[1]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTrans2.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTrans2.mnValue); } @@ -390,14 +387,13 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColorExportImport) CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xPortion = getShapeTextPortion(0, xShape); CPPUNIT_ASSERT(xPortion.is()); - uno::Reference<util::XThemeColor> xThemeColor; - xPortion->getPropertyValue("CharColorThemeReference") >>= xThemeColor; - CPPUNIT_ASSERT(xThemeColor.is()); - model::ThemeColor aThemeColor; - model::theme::setFromXThemeColor(aThemeColor, xThemeColor); - CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aThemeColor.getType()); - CPPUNIT_ASSERT_EQUAL(size_t(1), aThemeColor.getTransformations().size()); - auto const& rTrans1 = aThemeColor.getTransformations()[0]; + uno::Reference<util::XComplexColor> xComplexColor; + xPortion->getPropertyValue("CharComplexColor") >>= xComplexColor; + CPPUNIT_ASSERT(xComplexColor.is()); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getSchemeType()); + CPPUNIT_ASSERT_EQUAL(size_t(1), aComplexColor.getTransformations().size()); + auto const& rTrans1 = aComplexColor.getTransformations()[0]; CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTrans1.meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(5000), rTrans1.mnValue); } @@ -414,16 +410,15 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeColor_ShapeFill) uno::Reference<drawing::XShape> xShape(getShape(0)); CPPUNIT_ASSERT(xShape.is()); uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY); - uno::Reference<util::XThemeColor> xThemeColor; - xShapeProperties->getPropertyValue("FillColorThemeReference") >>= xThemeColor; - CPPUNIT_ASSERT(xThemeColor.is()); - model::ThemeColor aThemeColor; - model::theme::setFromXThemeColor(aThemeColor, xThemeColor); - CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent6, aThemeColor.getType()); - CPPUNIT_ASSERT_EQUAL(size_t(1), aThemeColor.getTransformations().size()); + uno::Reference<util::XComplexColor> xComplexColor; + xShapeProperties->getPropertyValue("FillComplexColor") >>= xComplexColor; + CPPUNIT_ASSERT(xComplexColor.is()); + auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); + CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent6, aComplexColor.getSchemeType()); + CPPUNIT_ASSERT_EQUAL(size_t(1), aComplexColor.getTransformations().size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, - aThemeColor.getTransformations()[0].meType); - CPPUNIT_ASSERT_EQUAL(sal_Int16(7500), aThemeColor.getTransformations()[0].mnValue); + aComplexColor.getTransformations()[0].meType); + CPPUNIT_ASSERT_EQUAL(sal_Int16(7500), aComplexColor.getTransformations()[0].mnValue); } CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTableInShape) diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index b35fa86b9ef3..bca1d6eccc0f 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3492,8 +3492,8 @@ namespace xmloff::token { TOKEN("linked-style-name", XML_LINKED_STYLE_NAME ), TOKEN("theme", XML_THEME ), - TOKEN("char-color-theme-reference", XML_CHAR_COLOR_THEME_REFERENCE), - TOKEN("fill-color-theme-reference", XML_FILL_COLOR_THEME_REFERENCE), + TOKEN("char-color-theme-reference", XML_CHAR_COMPLEX_COLOR), + TOKEN("fill-color-theme-reference", XML_FILL_COMPLEX_COLOR), TOKEN("dk1", XML_DK1 ), TOKEN("lt1", XML_LT1 ), TOKEN("dk2", XML_DK2 ), diff --git a/xmloff/source/draw/XMLShapePropertySetContext.cxx b/xmloff/source/draw/XMLShapePropertySetContext.cxx index 471a22d2a098..9db7cac43464 100644 --- a/xmloff/source/draw/XMLShapePropertySetContext.cxx +++ b/xmloff/source/draw/XMLShapePropertySetContext.cxx @@ -83,7 +83,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLShapePropertySetCon case CTF_TEXTCOLUMNS: return new XMLTextColumnsContext(GetImport(), nElement, xAttrList, rProp, rProperties); - case CTF_THEME_COLOR: + case CTF_COMPLEX_COLOR: return new XMLThemeColorContext(GetImport(), nElement, xAttrList, rProp, rProperties); } diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index 03e37c97bc2e..0555914f09a0 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -109,7 +109,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] = GMAP( PROP_FillStyle, XML_NAMESPACE_DRAW, XML_FILL, XML_SD_TYPE_FILLSTYLE, CTF_FILLSTYLE ), GMAP_D(PROP_FillColor, XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, CTF_FILLCOLOR ), GMAP_D(PROP_FillColor2, XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0), - GMAPV( PROP_FillColorThemeReference, XML_NAMESPACE_LO_EXT, XML_FILL_COLOR_THEME_REFERENCE, XML_TYPE_THEME_COLOR|MID_FLAG_ELEMENT_ITEM, CTF_THEME_COLOR, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED), + GMAPV( PROP_FillComplexColor, XML_NAMESPACE_LO_EXT, XML_FILL_COMPLEX_COLOR, XML_TYPE_COMPLEX_COLOR|MID_FLAG_ELEMENT_ITEM, CTF_COMPLEX_COLOR, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED), GMAP( PROP_FillGradientName, XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ), GMAP( PROP_FillGradientStepCount, XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ), GMAP( PROP_FillHatchName, XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ), @@ -1307,8 +1307,8 @@ const XMLPropertyHandler* XMLSdPropHdlFactory::GetPropertyHandler( sal_Int32 nTy case XML_TYPE_TEXT_COLUMNS: pHdl = new XMLTextColumnsPropertyHandler; break; - case XML_TYPE_THEME_COLOR: - pHdl = new XMLThemeColorHandler; + case XML_TYPE_COMPLEX_COLOR: + pHdl = new XMLComplexColorHandler; break; } diff --git a/xmloff/source/text/XMLTextPropertySetContext.cxx b/xmloff/source/text/XMLTextPropertySetContext.cxx index fd87f837dbf7..2f8398b76cf2 100644 --- a/xmloff/source/text/XMLTextPropertySetContext.cxx +++ b/xmloff/source/text/XMLTextPropertySetContext.cxx @@ -69,7 +69,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextPropertySetCont rProperties ); break; - case CTF_THEME_COLOR: + case CTF_COMPLEX_COLOR: return new XMLThemeColorContext(GetImport(), nElement, xAttrList, rProp, rProperties); break; diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx index eeda57a558a8..b0ece39a2d82 100644 --- a/xmloff/source/text/XMLTextShapeStyleContext.cxx +++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx @@ -90,7 +90,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextShapePropertySe rProperties ); break; - case CTF_THEME_COLOR: + case CTF_COMPLEX_COLOR: return new XMLThemeColorContext(GetImport(), nElement, xAttrList, rProp, rProperties); case CTF_BACKGROUND_URL: diff --git a/xmloff/source/text/XMLThemeColorContext.cxx b/xmloff/source/text/XMLThemeColorContext.cxx index c2cdd6cd35ce..aeea540bbdf3 100644 --- a/xmloff/source/text/XMLThemeColorContext.cxx +++ b/xmloff/source/text/XMLThemeColorContext.cxx @@ -45,7 +45,7 @@ XMLThemeColorContext::XMLThemeColorContext( sal_Int16 nValue = -1; if (SvXMLUnitConverter::convertEnum(nValue, aIter.toView(), pXML_ThemeColor_Enum)) { - aThemeColor.setType(model::convertToThemeColorType(nValue)); + maComplexColor.setSchemeColor(model::convertToThemeColorType(nValue)); } break; } @@ -93,7 +93,7 @@ XMLThemeColorContext::createFastChildContext( break; } } - aThemeColor.addTransformation({ eTransformationType, nTransformationValue }); + maComplexColor.addTransformation({ eTransformationType, nTransformationValue }); return this; } XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement); @@ -104,9 +104,9 @@ void XMLThemeColorContext::endFastElement(sal_Int32 nElement) { if (nElement == mnRootElement) { - if (aThemeColor.getType() != model::ThemeColorType::Unknown) + if (maComplexColor.getSchemeType() != model::ThemeColorType::Unknown) { - aProp.maValue <<= model::theme::createXThemeColor(aThemeColor); + aProp.maValue <<= model::color::createXComplexColor(maComplexColor); SetInsert(true); } } diff --git a/xmloff/source/text/XMLThemeColorExport.cxx b/xmloff/source/text/XMLThemeColorExport.cxx index 2f90e74ffbcf..9a48faf63546 100644 --- a/xmloff/source/text/XMLThemeColorExport.cxx +++ b/xmloff/source/text/XMLThemeColorExport.cxx @@ -11,7 +11,7 @@ #include <sal/config.h> -#include <docmodel/uno/UnoThemeColor.hxx> +#include <docmodel/uno/UnoComplexColor.hxx> #include <xmloff/xmltoken.hxx> #include <xmloff/xmlnamespace.hxx> #include <xmloff/xmluconv.hxx> @@ -37,21 +37,20 @@ constexpr const std::array<XMLTokenEnum, 12> constThemeColorTypeToToken{ void XMLThemeColorExport::exportXML(const uno::Any& rAny, sal_uInt16 nPrefix, const OUString& rLocalName) { - uno::Reference<util::XThemeColor> xThemeColor; - rAny >>= xThemeColor; - if (!xThemeColor.is()) + uno::Reference<util::XComplexColor> xComplexColor; + rAny >>= xComplexColor; + if (!xComplexColor.is()) return; - model::ThemeColor aThemeColor; - model::theme::setFromXThemeColor(aThemeColor, xThemeColor); - if (aThemeColor.getType() == model::ThemeColorType::Unknown) + model::ComplexColor aComplexColor = model::color::getFromXComplexColor(xComplexColor); + if (aComplexColor.getSchemeType() == model::ThemeColorType::Unknown) return; - XMLTokenEnum nToken = constThemeColorTypeToToken[sal_Int16(aThemeColor.getType())]; + XMLTokenEnum nToken = constThemeColorTypeToToken[sal_Int16(aComplexColor.getSchemeType())]; mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_TYPE, nToken); - SvXMLElementExport aThemeColorElement(mrExport, nPrefix, rLocalName, true, true); + SvXMLElementExport aComplexColorElement(mrExport, nPrefix, rLocalName, true, true); - for (auto const& rTransform : aThemeColor.getTransformations()) + for (auto const& rTransform : aComplexColor.getTransformations()) { OUString aType; switch (rTransform.meType) diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index a5e0d94b74cd..67f742b69b46 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -72,7 +72,7 @@ void XMLTextExportPropertySetMapper::handleElementItem( pThis->maTextColumnsExport.exportXML( rProperty.maValue ); break; - case CTF_THEME_COLOR: + case CTF_COMPLEX_COLOR: pThis->maThemeColorExport.exportXML(rProperty.maValue, getPropertySetMapper()->GetEntryNameSpace(rProperty.mnIndex), getPropertySetMapper()->GetEntryXMLName(rProperty.mnIndex)); diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx index 56d9642631b5..0755810efa4e 100644 --- a/xmloff/source/text/txtprhdl.cxx +++ b/xmloff/source/text/txtprhdl.cxx @@ -1412,8 +1412,8 @@ static const XMLPropertyHandler *GetPropertyHandler case XML_TYPE_GRAPHIC: pHdl = new XMLGraphicPropertyHandler; break; - case XML_TYPE_THEME_COLOR: - pHdl = new XMLThemeColorHandler; + case XML_TYPE_COMPLEX_COLOR: + pHdl = new XMLComplexColorHandler; break; default: { diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 1151eef64575..5d8ef1d3471e 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -139,7 +139,7 @@ XMLPropertyMapEntry constexpr aXMLParaPropMap[] = MT_ED( PROP_CharColor, STYLE, USE_WINDOW_FONT_COLOR, XML_TYPE_ISAUTOCOLOR|MID_FLAG_MERGE_PROPERTY, 0 ), MAP_EXT_I( PROP_CharTransparence, XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0), MAP_EXT( PROP_CharTransparence, XML_NAMESPACE_LO_EXT, XML_OPACITY, XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0), - MAP_EXT( PROP_CharColorThemeReference, XML_NAMESPACE_LO_EXT, XML_CHAR_COLOR_THEME_REFERENCE, XML_TYPE_THEME_COLOR|XML_TYPE_PROP_TEXT|MID_FLAG_ELEMENT_ITEM, CTF_THEME_COLOR), + MAP_EXT( PROP_CharComplexColor, XML_NAMESPACE_LO_EXT, XML_CHAR_COMPLEX_COLOR, XML_TYPE_COMPLEX_COLOR|XML_TYPE_PROP_TEXT|MID_FLAG_ELEMENT_ITEM, CTF_COMPLEX_COLOR), // RES_CHRATR_CONTOUR MT_E( PROP_CharContoured, STYLE, TEXT_OUTLINE, XML_TYPE_BOOL, 0 ), // RES_CHRATR_CROSSEDOUT @@ -490,7 +490,7 @@ XMLPropertyMapEntry constexpr aXMLTextPropMap[] = MT_ED( PROP_CharColor, STYLE, USE_WINDOW_FONT_COLOR, XML_TYPE_ISAUTOCOLOR|MID_FLAG_MERGE_PROPERTY, 0 ), MAP_EXT_I( PROP_CharTransparence, XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0), MAP_EXT( PROP_CharTransparence, XML_NAMESPACE_LO_EXT, XML_OPACITY, XML_TYPE_NEG_PERCENT16 | XML_TYPE_PROP_TEXT, 0), - MAP_EXT( PROP_CharColorThemeReference, XML_NAMESPACE_LO_EXT, XML_CHAR_COLOR_THEME_REFERENCE, XML_TYPE_THEME_COLOR|XML_TYPE_PROP_TEXT|MID_FLAG_ELEMENT_ITEM, CTF_THEME_COLOR), + MAP_EXT( PROP_CharComplexColor, XML_NAMESPACE_LO_EXT, XML_CHAR_COMPLEX_COLOR, XML_TYPE_COMPLEX_COLOR|XML_TYPE_PROP_TEXT|MID_FLAG_ELEMENT_ITEM, CTF_COMPLEX_COLOR), // RES_CHRATR_CONTOUR MT_E( PROP_CharContoured, STYLE, TEXT_OUTLINE, XML_TYPE_BOOL, 0 ), // RES_CHRATR_CROSSEDOUT @@ -1038,7 +1038,7 @@ XMLPropertyMapEntry constexpr aXMLCellPropMap[] = // text properties MT_ED( PROP_CharColor, FO, COLOR, XML_TYPE_COLORAUTO|MID_FLAG_MERGE_PROPERTY, 0 ), MT_ED( PROP_CharColor, STYLE, USE_WINDOW_FONT_COLOR, XML_TYPE_ISAUTOCOLOR|MID_FLAG_MERGE_PROPERTY, 0 ), - MAP_EXT( PROP_CharColorThemeReference, XML_NAMESPACE_LO_EXT, XML_CHAR_COLOR_THEME_REFERENCE, XML_TYPE_THEME_COLOR|XML_TYPE_PROP_TEXT|MID_FLAG_ELEMENT_ITEM, CTF_THEME_COLOR), + MAP_EXT( PROP_CharComplexColor, XML_NAMESPACE_LO_EXT, XML_CHAR_COMPLEX_COLOR, XML_TYPE_COMPLEX_COLOR|XML_TYPE_PROP_TEXT|MID_FLAG_ELEMENT_ITEM, CTF_COMPLEX_COLOR), MT_E( PROP_CharShadowed, FO, TEXT_SHADOW, XML_TYPE_TEXT_SHADOWED, 0 ), MT_E( PROP_CharContoured, STYLE, TEXT_OUTLINE, XML_TYPE_BOOL, 0 ), MT_E( PROP_CharStrikeout, STYLE, TEXT_LINE_THROUGH_STYLE, XML_TYPE_TEXT_CROSSEDOUT_STYLE|MID_FLAG_MERGE_PROPERTY, 0 ), |