summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/ColorSets.hxx13
-rw-r--r--svx/source/styles/ColorSets.cxx29
2 files changed, 27 insertions, 15 deletions
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 174e3ff70cce..4c6666833a14 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -18,7 +18,7 @@
#include <sal/log.hxx>
#include <sal/types.h>
#include <svx/svxdllapi.h>
-#include <docmodel/theme/ThemeColorType.hxx>
+#include <docmodel/theme/ThemeColor.hxx>
#include <tools/color.hxx>
typedef struct _xmlTextWriter* xmlTextWriterPtr;
@@ -43,15 +43,8 @@ public:
return maName;
}
- Color getColor(model::ThemeColorType nType) const
- {
- if (nType == model::ThemeColorType::Unknown)
- {
- SAL_WARN("svx", "ColorSet::getColor with ThemeColorType::Unknown");
- return COL_AUTO;
- }
- return maColors[size_t(nType)];
- }
+ Color resolveColor(model::ThemeColor const& rThemeColor) const;
+ Color getColor(model::ThemeColorType eType) const;
void dumpAsXml(xmlTextWriterPtr pWriter) const;
};
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"));