summaryrefslogtreecommitdiffstats
path: root/include/docmodel/theme
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /include/docmodel/theme
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/docmodel/theme')
-rw-r--r--include/docmodel/theme/ColorSet.hxx47
-rw-r--r--include/docmodel/theme/FormatScheme.hxx613
-rw-r--r--include/docmodel/theme/Theme.hxx197
-rw-r--r--include/docmodel/theme/ThemeColorType.hxx51
4 files changed, 908 insertions, 0 deletions
diff --git a/include/docmodel/theme/ColorSet.hxx b/include/docmodel/theme/ColorSet.hxx
new file mode 100644
index 0000000000..5bad82633c
--- /dev/null
+++ b/include/docmodel/theme/ColorSet.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <array>
+#include <docmodel/dllapi.h>
+#include <rtl/ustring.hxx>
+#include <docmodel/theme/ThemeColorType.hxx>
+#include <docmodel/color/ComplexColor.hxx>
+#include <tools/color.hxx>
+
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+namespace model
+{
+class DOCMODEL_DLLPUBLIC ColorSet
+{
+ OUString maName;
+ std::array<Color, 12> maColors;
+
+public:
+ ColorSet(OUString const& rName);
+
+ void setName(OUString const& rName) { maName = rName; }
+
+ void add(model::ThemeColorType Type, Color aColorData);
+
+ const OUString& getName() const { return maName; }
+
+ Color resolveColor(model::ComplexColor const& rComplexColor) const;
+
+ Color getColor(model::ThemeColorType eType) const;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+};
+
+} // end of namespace model
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/docmodel/theme/FormatScheme.hxx b/include/docmodel/theme/FormatScheme.hxx
new file mode 100644
index 0000000000..eb1eea3fbd
--- /dev/null
+++ b/include/docmodel/theme/FormatScheme.hxx
@@ -0,0 +1,613 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <docmodel/dllapi.h>
+#include <docmodel/color/ComplexColor.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+namespace model
+{
+enum class FillType
+{
+ None,
+ Solid,
+ Gradient,
+ Pattern,
+ Blip
+};
+
+class DOCMODEL_DLLPUBLIC Fill
+{
+public:
+ Fill(FillType eType)
+ : meType(eType)
+ {
+ }
+
+ FillType meType;
+};
+
+class DOCMODEL_DLLPUBLIC NoFill : public Fill
+{
+public:
+ NoFill()
+ : Fill(FillType::None)
+ {
+ }
+};
+
+class DOCMODEL_DLLPUBLIC SolidFill : public Fill
+{
+public:
+ ComplexColor maColor;
+
+ SolidFill()
+ : Fill(FillType::Solid)
+ {
+ }
+};
+
+class DOCMODEL_DLLPUBLIC GradientStop
+{
+public:
+ double mfPosition = 0.0; // 0.0 - 1.0
+ ComplexColor maColor;
+};
+
+enum class GradientType
+{
+ Undefined,
+ Linear,
+ Circle,
+ Rectangle,
+ Shape,
+};
+
+struct DOCMODEL_DLLPUBLIC LinearGradientProperties
+{
+ sal_Int32 mnAngle = 0;
+ bool mbScaled = false;
+};
+
+struct DOCMODEL_DLLPUBLIC RelativeRectangle
+{
+ sal_Int32 mnLeft = 0;
+ sal_Int32 mnTop = 0;
+ sal_Int32 mnRight = 0;
+ sal_Int32 mnBottom = 0;
+};
+
+class DOCMODEL_DLLPUBLIC GradientFill : public Fill
+{
+public:
+ bool mbRotateWithShape = false;
+ GradientType meGradientType = GradientType::Undefined;
+ std::vector<GradientStop> maGradientStops;
+ LinearGradientProperties maLinearGradient;
+ RelativeRectangle maFillToRectangle;
+ RelativeRectangle maTileRectangle;
+
+ GradientFill()
+ : Fill(FillType::Gradient)
+ {
+ }
+};
+
+enum class PatternPreset
+{
+ Unused,
+ Percent_5,
+ Percent_10,
+ Percent_20,
+ Percent_25,
+ Percent_30,
+ Percent_40,
+ Percent_50,
+ Percent_60,
+ Percent_70,
+ Percent_75,
+ Percent_80,
+ Percent_90,
+ Horizontal,
+ Vertical,
+ LightHorizontal,
+ LightVertical,
+ DarkHorizontal,
+ DarkVertical,
+ NarrowHorizontal,
+ NarrowVertical,
+ DashedHorizontal,
+ DashedVertical,
+ Cross,
+ DownwardDiagonal,
+ UpwardDiagonal,
+ LightDownwardDiagonal,
+ LightUpwardDiagonal,
+ DarkDownwardDiagonal,
+ DarkUpwardDiagonal,
+ WideDownwardDiagonal,
+ WideUpwardDiagonal,
+ DashedDownwardDiagonal,
+ DashedUpwardDiagonal,
+ DiagonalCross,
+ SmallCheckerBoard,
+ LargeCheckerBoard,
+ SmallGrid,
+ LargeGrid,
+ DottedGrid,
+ SmallConfetti,
+ LargeConfetti,
+ HorizontalBrick,
+ DiagonalBrick,
+ SolidDiamond,
+ OpenDiamond,
+ DottedDiamond,
+ Plaid,
+ Sphere,
+ Weave,
+ Divot,
+ Shingle,
+ Wave,
+ Trellis,
+ ZigZag
+};
+
+class DOCMODEL_DLLPUBLIC PatternFill : public Fill
+{
+public:
+ PatternPreset mePatternPreset = PatternPreset::Unused;
+ ComplexColor maForegroundColor;
+ ComplexColor maBackgroundColor;
+
+ PatternFill()
+ : Fill(FillType::Pattern)
+ {
+ }
+};
+
+enum class BitmapMode
+{
+ Unused,
+ Tile,
+ Stretch,
+};
+
+enum class FlipMode
+{
+ None,
+ X,
+ Y,
+ XY
+};
+
+enum class RectangleAlignment
+{
+ Unset,
+ TopLeft,
+ Top,
+ TopRight,
+ Left,
+ Center,
+ Right,
+ BottomLeft,
+ Bottom,
+ BottomRight
+};
+constexpr sal_uInt16 RECTANGLE_ALIGNMENT_COUNT
+ = static_cast<sal_uInt16>(RectangleAlignment::BottomRight) + 1;
+
+enum class BlipEffectType
+{
+ None,
+ AlphaBiLevel,
+ AlphaCeiling,
+ AlphaFloor,
+ AlphaInverse,
+ AlphaModulate,
+ AlphaModulateFixed,
+ AlphaReplace,
+ BiLevel,
+ Blur,
+ ColorChange,
+ ColorReplace,
+ DuoTone,
+ FillOverlay,
+ Grayscale,
+ HSL,
+ Luminance,
+ Tint,
+};
+
+class BlipEffect
+{
+public:
+ BlipEffectType meType = BlipEffectType::None;
+
+ sal_Int32 mnThreshold = 0; // AlphaBiLevel, BiLevel
+ ComplexColor maColor1; // AlphaInverse, ColorReplace, DuoTone, ColorChange (from)
+ ComplexColor maColor2; // DuoTone, ColorChange (to)
+ sal_Int32 mnAmount = 0; // AlphaModulateFixed, Tint
+ sal_Int32 mnRadius = 0; // Blur
+ bool mbGrow = false; // Blur
+ sal_Int32 mnAlpha = 0; // AlphaReplace
+ bool mbUseAlpha = false; // ColorChange
+ sal_Int32 mnHue = 0; // HSL, Tint
+ sal_Int32 mnSaturation = 0; // HSL
+ sal_Int32 mnLuminance = 0; // HSL
+ sal_Int32 mnBrightness = 0; // Luminance
+ sal_Int32 mnContrast = 0; // Luminance
+
+ ComplexColor& getColorFrom() { return maColor1; }
+ ComplexColor& getColorTo() { return maColor2; }
+};
+
+class DOCMODEL_DLLPUBLIC BlipFill : public Fill
+{
+public:
+ bool mbRotateWithShape = false;
+ RelativeRectangle maClipRectangle;
+ RelativeRectangle maFillRectangle;
+ BitmapMode meMode = BitmapMode::Unused;
+
+ sal_Int32 mnTileOffsetX = 0;
+ sal_Int32 mnTileOffsetY = 0;
+ sal_Int32 mnTileScaleX = 0;
+ sal_Int32 mnTileScaleY = 0;
+ FlipMode meTileFlipMode = FlipMode::None;
+ RectangleAlignment meTileAlignment = RectangleAlignment::TopLeft;
+
+ css::uno::Reference<css::graphic::XGraphic> mxGraphic;
+ std::vector<BlipEffect> maBlipEffects;
+
+ BlipFill()
+ : Fill(FillType::Blip)
+ {
+ }
+};
+
+class DOCMODEL_DLLPUBLIC FillStyle
+{
+public:
+ std::shared_ptr<Fill> mpFill;
+};
+
+enum class CapType
+{
+ Unset,
+ Flat,
+ Round,
+ Square
+};
+
+enum class PenAlignmentType
+{
+ Unset,
+ Center,
+ Inset
+};
+
+enum class CompoundLineType
+{
+ Unset,
+ Single,
+ Double,
+ ThickThin_Double,
+ ThinThick_Double,
+ Triple,
+};
+
+enum class PresetDashType
+{
+ Unset,
+ Dash,
+ DashDot,
+ Dot,
+ LargeDash,
+ LargeDashDot,
+ LargeDashDotDot,
+ Solid,
+ SystemDash,
+ SystemDashDot,
+ SystemDashDotDot,
+ SystemDot,
+};
+
+enum class LineJoinType
+{
+ Unset,
+ Round,
+ Bevel,
+ Miter,
+};
+
+struct DOCMODEL_DLLPUBLIC LineJoin
+{
+ LineJoinType meType = LineJoinType::Unset;
+ sal_Int32 mnMiterLimit = 0; // Percentage
+};
+
+enum class LineEndType
+{
+ None,
+ Triangle,
+ Stealth,
+ Diamond,
+ Oval,
+ Arrow
+};
+
+enum class LineEndWidth
+{
+ Unset,
+ Small,
+ Medium,
+ Large
+};
+
+enum class LineEndLength
+{
+ Unset,
+ Small,
+ Medium,
+ Large
+};
+
+struct DOCMODEL_DLLPUBLIC LineEnd
+{
+ LineEndType meType = LineEndType::None;
+ LineEndWidth meWidth = LineEndWidth::Unset;
+ LineEndLength meLength = LineEndLength::Unset;
+};
+
+struct DOCMODEL_DLLPUBLIC DashStop
+{
+ sal_Int32 mnDashLength = 0;
+ sal_Int32 mnStopLength = 0;
+};
+
+struct DOCMODEL_DLLPUBLIC LineDash
+{
+ PresetDashType mePresetType = PresetDashType::Unset;
+ std::vector<DashStop> maCustomList;
+};
+
+class DOCMODEL_DLLPUBLIC LineStyle
+{
+public:
+ sal_Int32 mnWidth;
+ CapType meCapType;
+ PenAlignmentType mePenAlignment;
+ CompoundLineType meCompoundLineType;
+ LineDash maLineDash;
+ LineJoin maLineJoin;
+ LineEnd maHeadEnd;
+ LineEnd maTailEnd;
+
+ FillStyle maLineFillStyle;
+};
+
+enum class EffectType
+{
+ Unset,
+ OuterShadow,
+ InnerShadow,
+ Glow,
+ SoftEdge,
+ Reflection,
+ Blur
+};
+
+class DOCMODEL_DLLPUBLIC Effect
+{
+public:
+ EffectType meType = EffectType::Unset;
+ sal_Int32 mnBlurRadius = 0;
+ sal_Int32 mnRadius = 0;
+ sal_Int32 mnDistance = 0;
+ sal_Int32 mnDirection = 0;
+ sal_Int32 mnScaleX = 100;
+ sal_Int32 mnScaley = 100;
+ sal_Int32 mnScewX = 0;
+ sal_Int32 mnScewY = 0;
+ RectangleAlignment meAlignment = RectangleAlignment::Bottom;
+ bool mbRotateWithShape = true;
+ ComplexColor maColor;
+ double mnEndAlpha = 100.0;
+ double mnEndPosition = 0.0;
+ double mnStartAlpha = 0.0;
+ double mnStartPosition = 100.0;
+ sal_Int32 mnFadeDirection = 0;
+ bool mbGrow = false;
+};
+
+class DOCMODEL_DLLPUBLIC EffectStyle
+{
+public:
+ std::vector<Effect> maEffectList;
+};
+
+class DOCMODEL_DLLPUBLIC FormatScheme
+{
+private:
+ OUString maName;
+ std::vector<FillStyle> maFillStyleList;
+ std::vector<LineStyle> maLineStyleList;
+ std::vector<EffectStyle> maEffectStyleList;
+ std::vector<FillStyle> maBackgroundFillStyleList;
+
+public:
+ FormatScheme() = default;
+
+ FormatScheme(OUString const& rName)
+ : maName(rName)
+ {
+ }
+
+ const OUString& getName() const { return maName; }
+
+ std::vector<FillStyle> const& getFillStyleList() const { return maFillStyleList; }
+
+ FillStyle* addFillStyle()
+ {
+ if (maFillStyleList.size() > 3)
+ return nullptr;
+ auto& rFillStyle = maFillStyleList.emplace_back();
+ return &rFillStyle;
+ }
+
+ void ensureFillStyleList() const
+ {
+ if (!maFillStyleList.empty())
+ return;
+
+ auto* pThis = const_cast<FormatScheme*>(this);
+ {
+ FillStyle* pFillStyle = pThis->addFillStyle();
+ auto pFill = std::make_shared<SolidFill>();
+ pFill->maColor.setThemePlaceholder();
+ pFillStyle->mpFill = pFill;
+ }
+ {
+ FillStyle* pFillStyle = pThis->addFillStyle();
+ auto pFill = std::make_shared<SolidFill>();
+ pFill->maColor.setThemePlaceholder();
+ pFillStyle->mpFill = pFill;
+ }
+ {
+ FillStyle* pFillStyle = pThis->addFillStyle();
+ auto pFill = std::make_shared<SolidFill>();
+ pFill->maColor.setThemePlaceholder();
+ pFillStyle->mpFill = pFill;
+ }
+ }
+
+ std::vector<LineStyle> const& getLineStyleList() const { return maLineStyleList; }
+
+ LineStyle* addLineStyle()
+ {
+ if (maLineStyleList.size() > 3)
+ return nullptr;
+ auto& rLineStyle = maLineStyleList.emplace_back();
+ return &rLineStyle;
+ }
+
+ void ensureLineStyleList() const
+ {
+ if (!maLineStyleList.empty())
+ return;
+
+ auto* pThis = const_cast<FormatScheme*>(this);
+
+ {
+ LineStyle* pLineStyle = pThis->addLineStyle();
+ pLineStyle->mnWidth = 6350;
+ pLineStyle->meCapType = CapType::Flat;
+ pLineStyle->mePenAlignment = PenAlignmentType::Center;
+ pLineStyle->meCompoundLineType = CompoundLineType::Single;
+ pLineStyle->maLineDash.mePresetType = PresetDashType::Solid;
+ pLineStyle->maLineJoin.meType = LineJoinType::Miter;
+ auto pFill = std::make_shared<SolidFill>();
+ pFill->maColor.setThemePlaceholder();
+ pLineStyle->maLineFillStyle.mpFill = pFill;
+ }
+ {
+ LineStyle* pLineStyle = pThis->addLineStyle();
+ pLineStyle->mnWidth = 6350;
+ pLineStyle->meCapType = CapType::Flat;
+ pLineStyle->mePenAlignment = PenAlignmentType::Center;
+ pLineStyle->meCompoundLineType = CompoundLineType::Single;
+ pLineStyle->maLineDash.mePresetType = PresetDashType::Solid;
+ pLineStyle->maLineJoin.meType = LineJoinType::Miter;
+ auto pFill = std::make_shared<SolidFill>();
+ pFill->maColor.setThemePlaceholder();
+ pLineStyle->maLineFillStyle.mpFill = pFill;
+ }
+ {
+ LineStyle* pLineStyle = pThis->addLineStyle();
+ pLineStyle->mnWidth = 6350;
+ pLineStyle->meCapType = CapType::Flat;
+ pLineStyle->mePenAlignment = PenAlignmentType::Center;
+ pLineStyle->meCompoundLineType = CompoundLineType::Single;
+ pLineStyle->maLineDash.mePresetType = PresetDashType::Solid;
+ pLineStyle->maLineJoin.meType = LineJoinType::Miter;
+ auto pFill = std::make_shared<SolidFill>();
+ pFill->maColor.setThemePlaceholder();
+ pLineStyle->maLineFillStyle.mpFill = pFill;
+ }
+ }
+
+ std::vector<EffectStyle> const& getEffectStyleList() const { return maEffectStyleList; }
+
+ EffectStyle* addEffectStyle()
+ {
+ if (maEffectStyleList.size() > 3)
+ return nullptr;
+ auto& rEffectStyle = maEffectStyleList.emplace_back();
+ return &rEffectStyle;
+ }
+
+ void ensureEffectStyleList() const
+ {
+ if (!maEffectStyleList.empty())
+ return;
+
+ auto* pThis = const_cast<FormatScheme*>(this);
+
+ pThis->addEffectStyle();
+ pThis->addEffectStyle();
+ pThis->addEffectStyle();
+ }
+
+ std::vector<FillStyle> const& getBackgroundFillStyleList() const
+ {
+ return maBackgroundFillStyleList;
+ }
+
+ FillStyle* addBackgroundFillStyle()
+ {
+ if (maBackgroundFillStyleList.size() > 3)
+ return nullptr;
+ auto& rBackgroundFillStyle = maBackgroundFillStyleList.emplace_back();
+ return &rBackgroundFillStyle;
+ }
+
+ void ensureBackgroundFillStyleList() const
+ {
+ if (!maBackgroundFillStyleList.empty())
+ return;
+
+ auto* pThis = const_cast<FormatScheme*>(this);
+
+ {
+ FillStyle* pFillStyle = pThis->addBackgroundFillStyle();
+ auto pFill = std::make_shared<SolidFill>();
+ pFill->maColor.setThemePlaceholder();
+ pFillStyle->mpFill = pFill;
+ }
+ {
+ FillStyle* pFillStyle = pThis->addBackgroundFillStyle();
+ auto pFill = std::make_shared<SolidFill>();
+ pFill->maColor.setThemePlaceholder();
+ pFillStyle->mpFill = pFill;
+ }
+ {
+ FillStyle* pFillStyle = pThis->addBackgroundFillStyle();
+ auto pFill = std::make_shared<SolidFill>();
+ pFill->maColor.setThemePlaceholder();
+ pFillStyle->mpFill = pFill;
+ }
+ }
+};
+
+} // end of namespace svx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/docmodel/theme/Theme.hxx b/include/docmodel/theme/Theme.hxx
new file mode 100644
index 0000000000..898cf3d787
--- /dev/null
+++ b/include/docmodel/theme/Theme.hxx
@@ -0,0 +1,197 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <docmodel/dllapi.h>
+#include <vector>
+
+#include <rtl/ustring.hxx>
+#include <docmodel/theme/ThemeColorType.hxx>
+#include <docmodel/theme/ColorSet.hxx>
+#include <docmodel/theme/FormatScheme.hxx>
+#include <tools/color.hxx>
+
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
+
+namespace model
+{
+struct DOCMODEL_DLLPUBLIC ThemeSupplementalFont
+{
+ OUString maScript;
+ OUString maTypeface;
+};
+
+struct DOCMODEL_DLLPUBLIC ThemeFont
+{
+ OUString maTypeface;
+ OUString maPanose;
+ sal_Int16 maPitch = 0;
+ sal_Int16 maFamily = 0;
+ sal_Int32 maCharset = 1;
+
+ sal_Int16 getPitchFamily() const { return (maPitch & 0x0F) | (maFamily & 0x0F) << 4; }
+};
+
+class DOCMODEL_DLLPUBLIC FontScheme
+{
+private:
+ OUString maName;
+
+ ThemeFont maMinorLatin;
+ ThemeFont maMinorAsian;
+ ThemeFont maMinorComplex;
+
+ ThemeFont maMajorLatin;
+ ThemeFont maMajorAsian;
+ ThemeFont maMajorComplex;
+
+ std::vector<ThemeSupplementalFont> maMinorSupplementalFontList;
+ std::vector<ThemeSupplementalFont> maMajorSupplementalFontList;
+
+public:
+ FontScheme()
+ : maName("Office")
+ {
+ }
+
+ FontScheme(OUString const& rName)
+ : maName(rName)
+ {
+ }
+
+ static FontScheme getDefault()
+ {
+ FontScheme aDefault;
+ aDefault.maMinorLatin.maTypeface = "Arial";
+ aDefault.maMinorAsian.maTypeface = "DejaVu Sans";
+ aDefault.maMinorComplex.maTypeface = "DejaVu Sans";
+
+ aDefault.maMajorLatin.maTypeface = "Arial";
+ aDefault.maMajorAsian.maTypeface = "DejaVu Sans";
+ aDefault.maMajorComplex.maTypeface = "DejaVu Sans";
+ return aDefault;
+ }
+
+ const OUString& getName() const { return maName; }
+
+ ThemeFont const& getMinorLatin() const { return maMinorLatin; }
+ void setMinorLatin(ThemeFont const& aMinor) { maMinorLatin = aMinor; }
+
+ ThemeFont const& getMinorAsian() const { return maMinorAsian; }
+ void setMinorAsian(ThemeFont const& aMinor) { maMinorAsian = aMinor; }
+
+ ThemeFont const& getMinorComplex() const { return maMinorComplex; }
+ void setMinorComplex(ThemeFont const& aMinor) { maMinorComplex = aMinor; }
+
+ ThemeFont const& getMajorLatin() const { return maMajorLatin; }
+ void setMajorLatin(ThemeFont const& aMajor) { maMajorLatin = aMajor; }
+
+ ThemeFont const& getMajorAsian() const { return maMajorAsian; }
+ void setMajorAsian(ThemeFont const& aMajor) { maMajorAsian = aMajor; }
+
+ ThemeFont const& getMajorComplex() const { return maMajorComplex; }
+ void setMajorComplex(ThemeFont const& aMajor) { maMajorComplex = aMajor; }
+
+ OUString findMinorSupplementalTypeface(std::u16string_view rScript) const
+ {
+ for (auto const& rSupplementalFont : maMinorSupplementalFontList)
+ {
+ if (rSupplementalFont.maScript == rScript)
+ return rSupplementalFont.maTypeface;
+ }
+ return OUString();
+ }
+
+ std::vector<ThemeSupplementalFont> const& getMinorSupplementalFontList() const
+ {
+ return maMinorSupplementalFontList;
+ }
+
+ void addMinorSupplementalFont(ThemeSupplementalFont const& rfont)
+ {
+ maMinorSupplementalFontList.push_back(rfont);
+ }
+
+ void setMinorSupplementalFontList(std::vector<ThemeSupplementalFont> const& rSupplementalFont)
+ {
+ maMinorSupplementalFontList = rSupplementalFont;
+ }
+
+ OUString findMajorSupplementalTypeface(std::u16string_view rScript) const
+ {
+ for (auto const& rSupplementalFont : maMajorSupplementalFontList)
+ {
+ if (rSupplementalFont.maScript == rScript)
+ return rSupplementalFont.maTypeface;
+ }
+ return OUString();
+ }
+
+ std::vector<ThemeSupplementalFont> const& getMajorSupplementalFontList() const
+ {
+ return maMajorSupplementalFontList;
+ }
+
+ void addMajorSupplementalFont(ThemeSupplementalFont const& rfont)
+ {
+ maMajorSupplementalFontList.push_back(rfont);
+ }
+
+ void setMajorSupplementalFontList(std::vector<ThemeSupplementalFont> const& rSupplementalFont)
+ {
+ maMajorSupplementalFontList = rSupplementalFont;
+ }
+};
+
+/// A named theme has a named color set.
+class DOCMODEL_DLLPUBLIC Theme
+{
+private:
+ OUString maName;
+ std::shared_ptr<model::ColorSet> mpColorSet;
+
+ FontScheme maFontScheme = FontScheme::getDefault();
+ FormatScheme maFormatScheme;
+
+public:
+ Theme();
+ Theme(OUString const& rName);
+
+ Theme(Theme const& rTheme);
+
+ void setFontScheme(FontScheme const& rFontScheme) { maFontScheme = rFontScheme; }
+ FontScheme const& getFontScheme() const { return maFontScheme; }
+
+ void setFormatScheme(FormatScheme const& rFormatScheme) { maFormatScheme = rFormatScheme; }
+ FormatScheme const& getFormatScheme() const { return maFormatScheme; }
+ FormatScheme& getFormatScheme() { return maFormatScheme; }
+
+ void setColorSet(std::shared_ptr<model::ColorSet> const& pColorSet) { mpColorSet = pColorSet; }
+
+ std::shared_ptr<model::ColorSet> const& getColorSet() const { return mpColorSet; }
+
+ void SetName(const OUString& rName);
+ const OUString& GetName() const;
+
+ void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+ void ToAny(css::uno::Any& rVal) const;
+
+ static std::unique_ptr<Theme> FromAny(const css::uno::Any& rVal);
+
+ std::vector<Color> GetColors() const;
+
+ Color GetColor(model::ThemeColorType eType) const;
+};
+
+} // end of namespace model
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/docmodel/theme/ThemeColorType.hxx b/include/docmodel/theme/ThemeColorType.hxx
new file mode 100644
index 0000000000..cab4174c68
--- /dev/null
+++ b/include/docmodel/theme/ThemeColorType.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <sal/types.h>
+
+namespace model
+{
+/// 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
+};
+
+enum class ThemeColorUsage
+{
+ Unknown = 0,
+ Text,
+ Background
+};
+
+constexpr ThemeColorType convertToThemeColorType(sal_Int32 nIndex)
+{
+ if (nIndex < 0 || nIndex > 11)
+ return ThemeColorType::Unknown;
+ return static_cast<ThemeColorType>(nIndex);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */