summaryrefslogtreecommitdiff
path: root/include/svx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-12-12 20:17:09 +0900
committerTomaž Vajngerl <quikee@gmail.com>2022-12-26 07:53:45 +0000
commit1386e26b2d7fc5173266ffbfb94bc82b1d3f7bb9 (patch)
tree4dc37db1a0716db7452af316ec7f3a178dd7357e /include/svx
parent18b39c8c9b35528c8fb172339126b613827d09aa (diff)
svx: rename ThemeColorType enum values, use enum instead of index
Change-Id: I81c1553205365c4076562474078b3b0aa834b249 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143990 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/svx')
-rw-r--r--include/svx/ColorSets.hxx48
1 files changed, 29 insertions, 19 deletions
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 91ac4e1651c7..71f12c2dbe71 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -24,6 +24,32 @@ class SdrPage;
namespace svx
{
+/// Offsets into the color list of a theme.
+enum class ThemeColorType : sal_Int32
+{
+ Unknown = -1,
+ Dark1 = 0,
+ Light1 = 1,
+ Dark2 = 2,
+ Light2 = 3,
+ Accent1 = 4,
+ Accent2 = 5,
+ Accent3 = 6,
+ Accent4 = 7,
+ Accent5 = 8,
+ Accent6 = 9,
+ Hyperlink = 10,
+ FollowedHyperlink = 11,
+ LAST = FollowedHyperlink
+};
+
+constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex)
+{
+ if (nIndex < 0 || nIndex > 11)
+ return ThemeColorType::Unknown;
+ return static_cast<ThemeColorType>(nIndex);
+}
+
class ColorSet
{
OUString maColorSetName;
@@ -40,9 +66,10 @@ public:
{
return maColorSetName;
}
- const Color& getColor(sal_uInt32 nIndex) const
+
+ Color getColor(ThemeColorType nType) const
{
- return maColors[nIndex];
+ return maColors[size_t(nType)];
}
void dumpAsXml(xmlTextWriterPtr pWriter) const;
@@ -69,23 +96,6 @@ public:
const ColorSet& getColorSet(std::u16string_view rName);
};
-/// Offsets into the color list of a theme.
-enum class ThemeColorType
-{
- DK1 = 0,
- LT1 = 1,
- DK2 = 2,
- LT2 = 3,
- ACCENT1 = 4,
- ACCENT2 = 5,
- ACCENT3 = 6,
- ACCENT4 = 7,
- ACCENT5 = 8,
- ACCENT6 = 9,
- HLINK = 10,
- FOLHLINK = 11,
-};
-
/// A named theme has a named color set.
class SVXCORE_DLLPUBLIC Theme
{