diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-12-28 09:43:46 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-01-12 23:15:58 +0000 |
commit | bd0f526f2d3e1ffe43a74672485815768eee6e9e (patch) | |
tree | fcb675aa06dcc3251f2c23961520ee317483a225 /include/svx | |
parent | c945eafc99856f0bcd0a99195e2c5164c2a6d24a (diff) |
introduce docmodel comp., model::ThemeColor, use it in SvxColorItem
Added a new component docmodel, that has the document model types,
which only depend on other basic components. This is needed so the
types can be used in every relevant component - xmloff, oox, svx,
editeng,...
Introduces model::ThemeColor, which is a class used to store the
theme color data, including transformations (svx::Transformation).
For UNO use XThemeColor is added, and the implementation UnoThemeColor
which wraps svx::ThemeColor, so it can be tranported around.
Reactor all the code and tests to accomodate for this change.
Change-Id: I7ce6752cdfaf5e4d3b8e4d90314afa469dd65cfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144847
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/svx')
-rw-r--r-- | include/svx/ColorSets.hxx | 32 | ||||
-rw-r--r-- | include/svx/xcolit.hxx | 9 |
2 files changed, 8 insertions, 33 deletions
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx index 115b7448a8a0..a5d41cc05a57 100644 --- a/include/svx/ColorSets.hxx +++ b/include/svx/ColorSets.hxx @@ -18,6 +18,7 @@ #include <sal/log.hxx> #include <sal/types.h> #include <svx/svxdllapi.h> +#include <docmodel/theme/ThemeColorType.hxx> #include <tools/color.hxx> typedef struct _xmlTextWriter* xmlTextWriterPtr; @@ -26,31 +27,6 @@ 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 SVXCORE_DLLPUBLIC ColorSet { @@ -67,9 +43,9 @@ public: return maName; } - Color getColor(ThemeColorType nType) const + Color getColor(model::ThemeColorType nType) const { - if (nType == ThemeColorType::Unknown) + if (nType == model::ThemeColorType::Unknown) { SAL_WARN("svx", "ColorSet::getColor with ThemeColorType::Unknown"); return COL_AUTO; @@ -279,7 +255,7 @@ public: std::vector<Color> GetColors() const; - Color GetColor(ThemeColorType eType) const; + Color GetColor(model::ThemeColorType eType) const; }; } // end of namespace svx diff --git a/include/svx/xcolit.hxx b/include/svx/xcolit.hxx index 5b882f9a97a9..3ece0ef3b52b 100644 --- a/include/svx/xcolit.hxx +++ b/include/svx/xcolit.hxx @@ -22,18 +22,17 @@ #include <tools/color.hxx> #include <editeng/colritem.hxx> +#include <docmodel/theme/ThemeColor.hxx> #include <svx/svxdllapi.h> #include <svx/xit.hxx> class XColorList; - - class SVXCORE_DLLPUBLIC XColorItem : public NameOrIndex { Color aColor; - SvxThemeColor maThemeColor; + model::ThemeColor maThemeColor; public: static SfxPoolItem* CreateDefault(); @@ -51,8 +50,8 @@ public: const Color& GetColorValue() const; void SetColorValue(const Color& rNew) { aColor = rNew; Detach(); } - SvxThemeColor& GetThemeColor() { return maThemeColor; } - const SvxThemeColor& GetThemeColor() const { return maThemeColor; } + model::ThemeColor& GetThemeColor() { return maThemeColor; } + const model::ThemeColor& GetThemeColor() const { return maThemeColor; } virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; |