summaryrefslogtreecommitdiff
path: root/svx/source/styles
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/styles')
-rw-r--r--svx/source/styles/ColorSets.cxx29
1 files changed, 24 insertions, 5 deletions
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index 0f24480c15e6..cf634b735c37 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -52,9 +52,7 @@ void UpdateTextPortionColorSet(const uno::Reference<beans::XPropertySet>& xPorti
if (aThemeColor.getType() == model::ThemeColorType::Unknown)
return;
- Color aColor = rColorSet.getColor(aThemeColor.getType());
- aColor = aThemeColor.applyTransformations(aColor);
-
+ Color aColor = rColorSet.resolveColor(aThemeColor);
xPortion->setPropertyValue(UNO_NAME_EDIT_CHAR_COLOR, uno::Any(static_cast<sal_Int32>(aColor)));
}
@@ -74,8 +72,7 @@ void UpdateFillColorSet(const uno::Reference<beans::XPropertySet>& xShape, const
if (aThemeColor.getType() == model::ThemeColorType::Unknown)
return;
- Color aColor = rColorSet.getColor(aThemeColor.getType());
- aColor = aThemeColor.applyTransformations(aColor);
+ Color aColor = rColorSet.resolveColor(aThemeColor);
xShape->setPropertyValue(UNO_NAME_FILLCOLOR, uno::Any(static_cast<sal_Int32>(aColor)));
}
@@ -125,6 +122,28 @@ void ColorSet::add(model::ThemeColorType eType, Color aColorData)
maColors[sal_Int16(eType)] = aColorData;
}
+Color ColorSet::getColor(model::ThemeColorType eType) const
+{
+ if (eType == model::ThemeColorType::Unknown)
+ {
+ SAL_WARN("svx", "ColorSet::getColor with ThemeColorType::Unknown");
+ return COL_AUTO;
+ }
+ return maColors[size_t(eType)];
+}
+
+Color ColorSet::resolveColor(model::ThemeColor const& rThemeColor) const
+{
+ auto eType = rThemeColor.getType();
+ if (eType == model::ThemeColorType::Unknown)
+ {
+ SAL_WARN("svx", "ColorSet::resolveColor with ThemeColorType::Unknown");
+ return COL_AUTO;
+ }
+ Color aColor = getColor(eType);
+ return rThemeColor.applyTransformations(aColor);
+}
+
void ColorSet::dumpAsXml(xmlTextWriterPtr pWriter) const
{
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("ColorSet"));