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 
20 namespace libvisio
21 {
22 
23 class VSDCollector;
24 
26 {
34 
36 };
37 
39 {
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 
69 {
72  unsigned m_schemeId;
73 
75 };
76 
78 {
79  std::array<std::array<unsigned, 4>, 4> m_varStyles;
80 
82 };
83 
84 class VSDXTheme
85 {
86 public:
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 
95 private:
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 
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: */
Colour m_accent5
Definition: VSDXTheme.h:48
Colour m_varColor7
Definition: VSDXTheme.h:33
std::array< std::vector< std::optional< Colour > >, 6 > m_fillStyleLst
Definition: VSDXTheme.h:124
VSDXVariationStyleScheme()
Definition: VSDXTheme.cpp:64
bool parse(librevenge::RVNGInputStream *input)
Definition: VSDXTheme.cpp:87
Colour m_varColor4
Definition: VSDXTheme.h:30
void readVarIdx(xmlTextReaderPtr reader, std::array< unsigned, 4 > &varStyle)
Definition: VSDXTheme.cpp:627
Colour m_lt2
Definition: VSDXTheme.h:43
std::optional< Colour > readSchemeClr(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:171
VSDXFont m_minorFont
Definition: VSDXTheme.h:71
Colour m_varColor3
Definition: VSDXTheme.h:29
Colour m_varColor2
Definition: VSDXTheme.h:28
Colour m_bkgnd
Definition: VSDXTheme.h:52
Colour m_lt1
Definition: VSDXTheme.h:41
Definition: VSDTypes.h:70
std::array< std::array< unsigned, 4 >, 4 > m_varStyles
Definition: VSDXTheme.h:79
void readGradFillLst(xmlTextReaderPtr reader, std::size_t nPos)
Definition: VSDXTheme.cpp:816
VSDXTheme()
Definition: VSDXTheme.cpp:69
Colour m_dk1
Definition: VSDXTheme.h:40
Colour m_varColor1
Definition: VSDXTheme.h:27
Definition: VSDXTheme.h:25
unsigned m_schemeId
Definition: VSDXTheme.h:72
void readFmtScheme(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:686
Colour m_accent6
Definition: VSDXTheme.h:49
void readVariationClrScheme(xmlTextReaderPtr reader, VSDXVariationClrScheme &varClrSch)
Definition: VSDXTheme.cpp:452
Colour m_varColor6
Definition: VSDXTheme.h:32
void readFillStyleLst(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:734
bool readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr)
Definition: VSDXTheme.cpp:381
Definition: VSDXTheme.h:38
VSDXClrScheme m_clrScheme
Definition: VSDXTheme.h:122
std::optional< Colour > getThemeColour(unsigned value, unsigned variationIndex=0) const
Definition: VSDXTheme.cpp:497
void readClrScheme(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:314
Colour m_accent4
Definition: VSDXTheme.h:47
bool readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace)
Definition: VSDXTheme.cpp:289
librevenge::RVNGString m_latinTypeFace
Definition: VSDXTheme.h:60
VSDXFontScheme()
Definition: VSDXTheme.cpp:57
~VSDXTheme()
Definition: VSDXTheme.cpp:77
Definition: VSDXTheme.h:68
VSDXClrScheme()
Definition: VSDXTheme.cpp:31
std::optional< Colour > readSysClr(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:151
std::optional< Colour > getStyleColour(unsigned value, unsigned variationIndex=0) const
Definition: VSDXTheme.cpp:646
std::optional< Colour > getFillStyleColour(unsigned value) const
Definition: VSDXTheme.cpp:855
VSDXTheme & operator=(const VSDXTheme &)
Colour m_accent1
Definition: VSDXTheme.h:44
librevenge::RVNGString m_eaTypeFace
Definition: VSDXTheme.h:61
librevenge::RVNGString m_csTypeFace
Definition: VSDXTheme.h:62
std::optional< Colour > readSrgbClr(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:131
void readVariationStyleSchemeLst(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:559
Colour m_folHlink
Definition: VSDXTheme.h:51
void skipUnimplemented(xmlTextReaderPtr reader, int idToken)
Definition: VSDXTheme.cpp:716
void readGradFill(xmlTextReaderPtr reader, std::size_t nPos)
Definition: VSDXTheme.cpp:787
std::map< unsigned, librevenge::RVNGString > m_typeFaces
Definition: VSDXTheme.h:63
void readFont(xmlTextReaderPtr reader, int idToken, VSDXFont &font)
Definition: VSDXTheme.cpp:248
Colour m_dk2
Definition: VSDXTheme.h:42
size_t getFillStyleLstSize() const
Definition: VSDXTheme.h:93
Definition: VSDXTheme.h:77
std::vector< VSDXVariationStyleScheme > m_variationStyleSchemeLst
Definition: VSDXTheme.h:125
Definition: libvisio_utils.h:46
Colour m_hlink
Definition: VSDXTheme.h:50
void readVariationStyleScheme(xmlTextReaderPtr reader, int idToken, VSDXVariationStyleScheme &vaStyleSch)
Definition: VSDXTheme.cpp:591
int getElementToken(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:82
VSDXFont m_majorFont
Definition: VSDXTheme.h:70
Colour m_varColor5
Definition: VSDXTheme.h:31
Definition: VSDXTheme.h:58
void readVariationClrSchemeLst(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:421
Definition: VSDXTheme.h:84
void readFontScheme(xmlTextReaderPtr reader)
Definition: VSDXTheme.cpp:216
VSDXVariationClrScheme()
Definition: VSDXTheme.cpp:20
Colour m_accent3
Definition: VSDXTheme.h:46
Colour m_accent2
Definition: VSDXTheme.h:45
std::vector< VSDXVariationClrScheme > m_variationClrSchemeLst
Definition: VSDXTheme.h:53
VSDXFontScheme m_fontScheme
Definition: VSDXTheme.h:123
VSDXFont()
Definition: VSDXTheme.cpp:49

Generated for libvisio by doxygen 1.8.10