diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-12-12 21:48:17 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-12-26 23:57:14 +0000 |
commit | 29c2bba1f3ef216d226c97197185066880fc1ab5 (patch) | |
tree | 8c7727c96529a23a467a3d19246b41e9e875c3cb /include | |
parent | cffe7884342f249e82780a46f9aba4213e9dd378 (diff) |
svx: use array for colors in ColorSet, add consts, rename vars
Use std::array for colors in ColorSet as there are always only 12
colors for a color scheme.
Add "const" to getters where appropriate.
Rename maColorSetName to maName in ColorSet - long variable name
is not needed.
Change-Id: Iacb976a22af2d2585d627b0ba65d98cbe1b825c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143994
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svx/ColorSets.hxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index 692e683218e8..6b4504ebb877 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -11,6 +11,7 @@ #ifndef INCLUDED_SVX_COLORSETS_HXX #define INCLUDED_SVX_COLORSETS_HXX +#include <array> #include <vector> #include <rtl/ustring.hxx> @@ -52,19 +53,17 @@ constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex) class SVXCORE_DLLPUBLIC ColorSet { - OUString maColorSetName; - std::vector<Color> maColors; + OUString maName; + std::array<Color, 12> maColors; + public: - ColorSet(OUString aName); + ColorSet(OUString const& rName); - void add(sal_uInt32 nIndex, ::Color aColorData) - { - maColors[nIndex] = aColorData; - } + void add(sal_uInt32 nIndex, Color aColorData); const OUString& getName() const { - return maColorSetName; + return maName; } Color getColor(ThemeColorType nType) const @@ -88,7 +87,7 @@ public: return maColorSets; } - const ColorSet& getColorSet(sal_uInt32 nIndex) + const ColorSet& getColorSet(sal_uInt32 nIndex) const { return maColorSets[nIndex]; } @@ -99,14 +98,15 @@ public: /// A named theme has a named color set. class SVXCORE_DLLPUBLIC Theme { +private: OUString maName; std::unique_ptr<ColorSet> mpColorSet; public: - Theme(OUString sName); - ~Theme(); + Theme(OUString const& rName); void SetColorSet(std::unique_ptr<ColorSet> pColorSet); + const ColorSet* GetColorSet() const; ColorSet* GetColorSet(); void SetName(const OUString& rName); |