VSDXTheme.h Source File documentation

VSDXTheme.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/*
3 * This file is part of the libvisio project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef __VSDXTHEME_H__
11#define __VSDXTHEME_H__
12
13#include <vector>
14#include <map>
15#include <optional>
16#include <array>
17#include <librevenge-stream/librevenge-stream.h>
18#include "VSDXMLHelper.h"
19
20namespace libvisio
21{
22
23class VSDCollector;
24
25 struct VSDXVariationClrScheme
26{
27 Colour m_varColor1;
28 Colour m_varColor2;
29 Colour m_varColor3;
30 Colour m_varColor4;
31 Colour m_varColor5;
32 Colour m_varColor6;
33 Colour m_varColor7;
34
35 VSDXVariationClrScheme();
36};
37
38 struct VSDXClrScheme
39{
40 Colour m_dk1;
41 Colour m_lt1;
42 Colour m_dk2;
43 Colour m_lt2;
44 Colour m_accent1;
45 Colour m_accent2;
46 Colour m_accent3;
47 Colour m_accent4;
48 Colour m_accent5;
49 Colour m_accent6;
50 Colour m_hlink;
51 Colour m_folHlink;
52 Colour m_bkgnd;
53 std::vector<VSDXVariationClrScheme> m_variationClrSchemeLst;
54
55 VSDXClrScheme();
56};
57
58 struct VSDXFont
59{
60 librevenge::RVNGString m_latinTypeFace;
61 librevenge::RVNGString m_eaTypeFace;
62 librevenge::RVNGString m_csTypeFace;
63 std::map<unsigned, librevenge::RVNGString> m_typeFaces;
64
65 VSDXFont();
66};
67
68 struct VSDXFontScheme
69{
70 VSDXFont m_majorFont;
71 VSDXFont m_minorFont;
72 unsigned m_schemeId;
73
74 VSDXFontScheme();
75};
76
77 struct VSDXVariationStyleScheme
78{
79 std::array<std::array<unsigned, 4>, 4> m_varStyles;
80
81 VSDXVariationStyleScheme();
82};
83
84 class VSDXTheme
85{
86public:
87 VSDXTheme();
88 ~VSDXTheme();
89 bool parse(librevenge::RVNGInputStream *input);
90 std::optional<Colour> getThemeColour(unsigned value, unsigned variationIndex = 0) const;
91 std::optional<Colour> getStyleColour(unsigned value, unsigned variationIndex = 0) const;
92 std::optional<Colour> getFillStyleColour(unsigned value) const;
93 size_t getFillStyleLstSize() const { return m_fillStyleLst.size(); }
94
95private:
96 VSDXTheme(const VSDXTheme &);
97 VSDXTheme &operator=(const VSDXTheme &);
98
99 std::optional<Colour> readSrgbClr(xmlTextReaderPtr reader);
100 std::optional<Colour> readSysClr(xmlTextReaderPtr reader);
101 std::optional<Colour> readSchemeClr(xmlTextReaderPtr reader);
102
103 void readClrScheme(xmlTextReaderPtr reader);
104 bool readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr);
105 void readVariationClrSchemeLst(xmlTextReaderPtr reader);
106 void readVariationClrScheme(xmlTextReaderPtr reader, VSDXVariationClrScheme &varClrSch);
107 void readVariationStyleSchemeLst(xmlTextReaderPtr reader);
108 void readVariationStyleScheme(xmlTextReaderPtr reader, int idToken, VSDXVariationStyleScheme &vaStyleSch);
109 void readVarIdx(xmlTextReaderPtr reader, std::array<unsigned, 4>& varStyle);
110 void readFontScheme(xmlTextReaderPtr reader);
111 void readFont(xmlTextReaderPtr reader, int idToken, VSDXFont &font);
112 bool readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace);
113 bool readTypeFace(xmlTextReaderPtr reader, int &script, librevenge::RVNGString &typeFace);
114 void readFmtScheme(xmlTextReaderPtr reader);
115 void readFillStyleLst(xmlTextReaderPtr reader);
116 void readGradFill(xmlTextReaderPtr reader, std::size_t nPos);
117 void readGradFillLst(xmlTextReaderPtr reader, std::size_t nPos);
118
119 int getElementToken(xmlTextReaderPtr reader);
120 void skipUnimplemented(xmlTextReaderPtr reader, int idToken);
121
122 VSDXClrScheme m_clrScheme;
123 VSDXFontScheme m_fontScheme;
124 std::array<std::vector<std::optional<Colour>>, 6> m_fillStyleLst;
125 std::vector<VSDXVariationStyleScheme> m_variationStyleSchemeLst;
126};
127
128} // namespace libvisio
129
130#endif // __VSDXTHEME_H__
131/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
VSDXMLHelper.h
libvisio::VSDCollector
Definition VSDCollector.h:21
libvisio::VSDXTheme::readFontScheme
void readFontScheme(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:216
libvisio::VSDXTheme::getFillStyleLstSize
size_t getFillStyleLstSize() const
Definition VSDXTheme.h:93
libvisio::VSDXTheme::getElementToken
int getElementToken(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:82
libvisio::VSDXTheme::m_clrScheme
VSDXClrScheme m_clrScheme
Definition VSDXTheme.h:122
libvisio::VSDXTheme::m_variationStyleSchemeLst
std::vector< VSDXVariationStyleScheme > m_variationStyleSchemeLst
Definition VSDXTheme.h:125
libvisio::VSDXTheme::readSrgbClr
std::optional< Colour > readSrgbClr(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:131
libvisio::VSDXTheme::readVariationStyleSchemeLst
void readVariationStyleSchemeLst(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:559
libvisio::VSDXTheme::readVariationClrScheme
void readVariationClrScheme(xmlTextReaderPtr reader, VSDXVariationClrScheme &varClrSch)
Definition VSDXTheme.cpp:452
libvisio::VSDXTheme::getThemeColour
std::optional< Colour > getThemeColour(unsigned value, unsigned variationIndex=0) const
Definition VSDXTheme.cpp:497
libvisio::VSDXTheme::skipUnimplemented
void skipUnimplemented(xmlTextReaderPtr reader, int idToken)
Definition VSDXTheme.cpp:716
libvisio::VSDXTheme::readTypeFace
bool readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace)
Definition VSDXTheme.cpp:289
libvisio::VSDXTheme::readFont
void readFont(xmlTextReaderPtr reader, int idToken, VSDXFont &font)
Definition VSDXTheme.cpp:248
libvisio::VSDXTheme::readVariationClrSchemeLst
void readVariationClrSchemeLst(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:421
libvisio::VSDXTheme::getStyleColour
std::optional< Colour > getStyleColour(unsigned value, unsigned variationIndex=0) const
Definition VSDXTheme.cpp:646
libvisio::VSDXTheme::parse
bool parse(librevenge::RVNGInputStream *input)
Definition VSDXTheme.cpp:87
libvisio::VSDXTheme::readClrScheme
void readClrScheme(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:314
libvisio::VSDXTheme::readSysClr
std::optional< Colour > readSysClr(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:151
libvisio::VSDXTheme::readThemeColour
bool readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr)
Definition VSDXTheme.cpp:381
libvisio::VSDXTheme::readGradFill
void readGradFill(xmlTextReaderPtr reader, std::size_t nPos)
Definition VSDXTheme.cpp:787
libvisio::VSDXTheme::~VSDXTheme
~VSDXTheme()
Definition VSDXTheme.cpp:77
libvisio::VSDXTheme::VSDXTheme
VSDXTheme(const VSDXTheme &)
libvisio::VSDXTheme::readVariationStyleScheme
void readVariationStyleScheme(xmlTextReaderPtr reader, int idToken, VSDXVariationStyleScheme &vaStyleSch)
Definition VSDXTheme.cpp:591
libvisio::VSDXTheme::operator=
VSDXTheme & operator=(const VSDXTheme &)
libvisio::VSDXTheme::readVarIdx
void readVarIdx(xmlTextReaderPtr reader, std::array< unsigned, 4 > &varStyle)
Definition VSDXTheme.cpp:627
libvisio::VSDXTheme::readGradFillLst
void readGradFillLst(xmlTextReaderPtr reader, std::size_t nPos)
Definition VSDXTheme.cpp:816
libvisio::VSDXTheme::readSchemeClr
std::optional< Colour > readSchemeClr(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:171
libvisio::VSDXTheme::readFillStyleLst
void readFillStyleLst(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:734
libvisio::VSDXTheme::m_fontScheme
VSDXFontScheme m_fontScheme
Definition VSDXTheme.h:123
libvisio::VSDXTheme::readFmtScheme
void readFmtScheme(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:686
libvisio::VSDXTheme::getFillStyleColour
std::optional< Colour > getFillStyleColour(unsigned value) const
Definition VSDXTheme.cpp:855
libvisio::VSDXTheme::m_fillStyleLst
std::array< std::vector< std::optional< Colour > >, 6 > m_fillStyleLst
Definition VSDXTheme.h:124
libvisio::VSDXTheme::VSDXTheme
VSDXTheme()
Definition VSDXTheme.cpp:69
libvisio
Definition libvisio_utils.h:47
libvisio::Colour
Definition VSDTypes.h:71
libvisio::VSDXClrScheme
Definition VSDXTheme.h:39
libvisio::VSDXClrScheme::VSDXClrScheme
VSDXClrScheme()
Definition VSDXTheme.cpp:31
libvisio::VSDXClrScheme::m_accent6
Colour m_accent6
Definition VSDXTheme.h:49
libvisio::VSDXClrScheme::m_accent3
Colour m_accent3
Definition VSDXTheme.h:46
libvisio::VSDXClrScheme::m_variationClrSchemeLst
std::vector< VSDXVariationClrScheme > m_variationClrSchemeLst
Definition VSDXTheme.h:53
libvisio::VSDXClrScheme::m_accent4
Colour m_accent4
Definition VSDXTheme.h:47
libvisio::VSDXClrScheme::m_dk1
Colour m_dk1
Definition VSDXTheme.h:40
libvisio::VSDXClrScheme::m_dk2
Colour m_dk2
Definition VSDXTheme.h:42
libvisio::VSDXClrScheme::m_lt2
Colour m_lt2
Definition VSDXTheme.h:43
libvisio::VSDXClrScheme::m_hlink
Colour m_hlink
Definition VSDXTheme.h:50
libvisio::VSDXClrScheme::m_lt1
Colour m_lt1
Definition VSDXTheme.h:41
libvisio::VSDXClrScheme::m_accent1
Colour m_accent1
Definition VSDXTheme.h:44
libvisio::VSDXClrScheme::m_folHlink
Colour m_folHlink
Definition VSDXTheme.h:51
libvisio::VSDXClrScheme::m_bkgnd
Colour m_bkgnd
Definition VSDXTheme.h:52
libvisio::VSDXClrScheme::m_accent5
Colour m_accent5
Definition VSDXTheme.h:48
libvisio::VSDXClrScheme::m_accent2
Colour m_accent2
Definition VSDXTheme.h:45
libvisio::VSDXFontScheme
Definition VSDXTheme.h:69
libvisio::VSDXFontScheme::VSDXFontScheme
VSDXFontScheme()
Definition VSDXTheme.cpp:57
libvisio::VSDXFontScheme::m_schemeId
unsigned m_schemeId
Definition VSDXTheme.h:72
libvisio::VSDXFontScheme::m_majorFont
VSDXFont m_majorFont
Definition VSDXTheme.h:70
libvisio::VSDXFontScheme::m_minorFont
VSDXFont m_minorFont
Definition VSDXTheme.h:71
libvisio::VSDXFont
Definition VSDXTheme.h:59
libvisio::VSDXFont::m_csTypeFace
librevenge::RVNGString m_csTypeFace
Definition VSDXTheme.h:62
libvisio::VSDXFont::m_latinTypeFace
librevenge::RVNGString m_latinTypeFace
Definition VSDXTheme.h:60
libvisio::VSDXFont::VSDXFont
VSDXFont()
Definition VSDXTheme.cpp:49
libvisio::VSDXFont::m_typeFaces
std::map< unsigned, librevenge::RVNGString > m_typeFaces
Definition VSDXTheme.h:63
libvisio::VSDXFont::m_eaTypeFace
librevenge::RVNGString m_eaTypeFace
Definition VSDXTheme.h:61
libvisio::VSDXVariationClrScheme
Definition VSDXTheme.h:26
libvisio::VSDXVariationClrScheme::m_varColor6
Colour m_varColor6
Definition VSDXTheme.h:32
libvisio::VSDXVariationClrScheme::VSDXVariationClrScheme
VSDXVariationClrScheme()
Definition VSDXTheme.cpp:20
libvisio::VSDXVariationClrScheme::m_varColor1
Colour m_varColor1
Definition VSDXTheme.h:27
libvisio::VSDXVariationClrScheme::m_varColor2
Colour m_varColor2
Definition VSDXTheme.h:28
libvisio::VSDXVariationClrScheme::m_varColor5
Colour m_varColor5
Definition VSDXTheme.h:31
libvisio::VSDXVariationClrScheme::m_varColor3
Colour m_varColor3
Definition VSDXTheme.h:29
libvisio::VSDXVariationClrScheme::m_varColor4
Colour m_varColor4
Definition VSDXTheme.h:30
libvisio::VSDXVariationClrScheme::m_varColor7
Colour m_varColor7
Definition VSDXTheme.h:33
libvisio::VSDXVariationStyleScheme
Definition VSDXTheme.h:78
libvisio::VSDXVariationStyleScheme::VSDXVariationStyleScheme
VSDXVariationStyleScheme()
Definition VSDXTheme.cpp:64
libvisio::VSDXVariationStyleScheme::m_varStyles
std::array< std::array< unsigned, 4 >, 4 > m_varStyles
Definition VSDXTheme.h:79