summaryrefslogtreecommitdiff
path: root/include/svx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-12-12 22:12:58 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-01-01 23:34:32 +0000
commitd5a71bc6a28f8a3d726b2ac4688c7cef9d77ddf0 (patch)
tree9693aef03e7614720bd1218b9f07a007e9da361f /include/svx
parentec1acb45021fee2259028e4ee830c11b61c25fac (diff)
oox: add support for importing font scheme into a svx::Theme
Change-Id: I862256a17ce84c85174678f3fd03c8ef6661f2c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143995 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/svx')
-rw-r--r--include/svx/ColorSets.hxx149
1 files changed, 149 insertions, 0 deletions
diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 47e1d8866e5d..718b79b3e66c 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -101,6 +101,146 @@ public:
const ColorSet& getColorSet(std::u16string_view rName);
};
+struct SVXCORE_DLLPUBLIC ThemeSupplementalFont
+{
+ OUString maScript;
+ OUString maTypeface;
+};
+
+struct SVXCORE_DLLPUBLIC ThemeFont
+{
+ OUString maTypeface;
+ OUString maPanose;
+ sal_Int16 maPitch;
+ sal_Int16 maFamily;
+ sal_Int32 maCharset;
+
+ sal_Int16 getPitchFamily() const
+ {
+ return (maPitch & 0x0F) | (maFamily & 0x0F) << 4;
+ }
+};
+
+class SVXCORE_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() = default;
+ FontScheme(OUString const& rName)
+ : maName(rName)
+ {}
+
+ 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 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 setMajorSupplementalFontList(std::vector<ThemeSupplementalFont> const& rSupplementalFont)
+ {
+ maMajorSupplementalFontList = rSupplementalFont;
+ }
+};
+
/// A named theme has a named color set.
class SVXCORE_DLLPUBLIC Theme
{
@@ -108,9 +248,18 @@ private:
OUString maName;
std::unique_ptr<ColorSet> mpColorSet;
+ FontScheme maFontScheme;
+
public:
Theme(OUString const& rName);
+ void setFontScheme(FontScheme const& rFontScheme)
+ {
+ maFontScheme = rFontScheme;
+ }
+
+ FontScheme const& getFontScheme() const { return maFontScheme; }
+
void SetColorSet(std::unique_ptr<ColorSet> pColorSet);
const ColorSet* GetColorSet() const;
ColorSet* GetColorSet();