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 <boost/optional.hpp>
16#include <librevenge-stream/librevenge-stream.h>
17#include "VSDXMLHelper.h"
18
19 namespace libvisio
20{
21
22 class VSDCollector;
23
24 struct VSDXVariationClrScheme
25{
26 Colour m_varColor1;
27 Colour m_varColor2;
28 Colour m_varColor3;
29 Colour m_varColor4;
30 Colour m_varColor5;
31 Colour m_varColor6;
32 Colour m_varColor7;
33
34 VSDXVariationClrScheme();
35};
36
37 struct VSDXClrScheme
38{
39 Colour m_dk1;
40 Colour m_lt1;
41 Colour m_dk2;
42 Colour m_lt2;
43 Colour m_accent1;
44 Colour m_accent2;
45 Colour m_accent3;
46 Colour m_accent4;
47 Colour m_accent5;
48 Colour m_accent6;
49 Colour m_hlink;
50 Colour m_folHlink;
51 Colour m_bkgnd;
52 std::vector<VSDXVariationClrScheme> m_variationClrSchemeLst;
53
54 VSDXClrScheme();
55};
56
57 struct VSDXFont
58{
59 librevenge::RVNGString m_latinTypeFace;
60 librevenge::RVNGString m_eaTypeFace;
61 librevenge::RVNGString m_csTypeFace;
62 std::map<unsigned, librevenge::RVNGString> m_typeFaces;
63
64 VSDXFont();
65};
66
67 struct VSDXFontScheme
68{
69 VSDXFont m_majorFont;
70 VSDXFont m_minorFont;
71 unsigned m_schemeId;
72
73 VSDXFontScheme();
74};
75
76 class VSDXTheme
77{
78 public:
79 VSDXTheme();
80 ~VSDXTheme();
81 bool parse(librevenge::RVNGInputStream *input);
82 boost::optional<Colour> getThemeColour(unsigned value, unsigned variationIndex = 0) const;
83 boost::optional<Colour> getFillStyleColour(unsigned value) const;
84
85 private:
86 VSDXTheme(const VSDXTheme &);
87 VSDXTheme &operator=(const VSDXTheme &);
88
89 boost::optional<Colour> readSrgbClr(xmlTextReaderPtr reader);
90 boost::optional<Colour> readSysClr(xmlTextReaderPtr reader);
91
92 void readClrScheme(xmlTextReaderPtr reader);
93 bool readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr);
94 void readVariationClrSchemeLst(xmlTextReaderPtr reader);
95 void readVariationClrScheme(xmlTextReaderPtr reader, VSDXVariationClrScheme &varClrSch);
96 void readFontScheme(xmlTextReaderPtr reader);
97 void readFont(xmlTextReaderPtr reader, int idToken, VSDXFont &font);
98 bool readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace);
99 bool readTypeFace(xmlTextReaderPtr reader, int &script, librevenge::RVNGString &typeFace);
100 void readFmtScheme(xmlTextReaderPtr reader);
101 void readFillStyleLst(xmlTextReaderPtr reader);
102
103 int getElementToken(xmlTextReaderPtr reader);
104 void skipUnimplemented(xmlTextReaderPtr reader, int idToken);
105
106 VSDXClrScheme m_clrScheme;
107 VSDXFontScheme m_fontScheme;
108 std::vector<boost::optional<Colour>> m_fillStyleLst;
109};
110
111} // namespace libvisio
112
113#endif // __VSDXTHEME_H__
114/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
VSDXMLHelper.h
libvisio::VSDXTheme
Definition VSDXTheme.h:77
libvisio::VSDXTheme::readFontScheme
void readFontScheme(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:162
libvisio::VSDXTheme::getElementToken
int getElementToken(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:76
libvisio::VSDXTheme::m_clrScheme
VSDXClrScheme m_clrScheme
Definition VSDXTheme.h:106
libvisio::VSDXTheme::readVariationClrScheme
void readVariationClrScheme(xmlTextReaderPtr reader, VSDXVariationClrScheme &varClrSch)
Definition VSDXTheme.cpp:395
libvisio::VSDXTheme::skipUnimplemented
void skipUnimplemented(xmlTextReaderPtr reader, int idToken)
Definition VSDXTheme.cpp:532
libvisio::VSDXTheme::readTypeFace
bool readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace)
Definition VSDXTheme.cpp:235
libvisio::VSDXTheme::readFont
void readFont(xmlTextReaderPtr reader, int idToken, VSDXFont &font)
Definition VSDXTheme.cpp:194
libvisio::VSDXTheme::readVariationClrSchemeLst
void readVariationClrSchemeLst(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:364
libvisio::VSDXTheme::parse
bool parse(librevenge::RVNGInputStream *input)
Definition VSDXTheme.cpp:81
libvisio::VSDXTheme::readClrScheme
void readClrScheme(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:260
libvisio::VSDXTheme::m_fillStyleLst
std::vector< boost::optional< Colour > > m_fillStyleLst
Definition VSDXTheme.h:108
libvisio::VSDXTheme::readThemeColour
bool readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr)
Definition VSDXTheme.cpp:327
libvisio::VSDXTheme::~VSDXTheme
~VSDXTheme()
Definition VSDXTheme.cpp:71
libvisio::VSDXTheme::readSysClr
boost::optional< Colour > readSysClr(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:142
libvisio::VSDXTheme::VSDXTheme
VSDXTheme(const VSDXTheme &)
libvisio::VSDXTheme::getThemeColour
boost::optional< Colour > getThemeColour(unsigned value, unsigned variationIndex=0) const
Definition VSDXTheme.cpp:440
libvisio::VSDXTheme::operator=
VSDXTheme & operator=(const VSDXTheme &)
libvisio::VSDXTheme::readFillStyleLst
void readFillStyleLst(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:550
libvisio::VSDXTheme::m_fontScheme
VSDXFontScheme m_fontScheme
Definition VSDXTheme.h:107
libvisio::VSDXTheme::readSrgbClr
boost::optional< Colour > readSrgbClr(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:122
libvisio::VSDXTheme::readFmtScheme
void readFmtScheme(xmlTextReaderPtr reader)
Definition VSDXTheme.cpp:502
libvisio::VSDXTheme::getFillStyleColour
boost::optional< Colour > getFillStyleColour(unsigned value) const
Definition VSDXTheme.cpp:593
libvisio::VSDXTheme::VSDXTheme
VSDXTheme()
Definition VSDXTheme.cpp:64
libvisio
Definition libvisio_utils.h:49
libvisio::Colour
Definition VSDTypes.h:71
libvisio::VSDXClrScheme
Definition VSDXTheme.h:38
libvisio::VSDXClrScheme::VSDXClrScheme
VSDXClrScheme()
Definition VSDXTheme.cpp:31
libvisio::VSDXClrScheme::m_accent6
Colour m_accent6
Definition VSDXTheme.h:48
libvisio::VSDXClrScheme::m_accent3
Colour m_accent3
Definition VSDXTheme.h:45
libvisio::VSDXClrScheme::m_variationClrSchemeLst
std::vector< VSDXVariationClrScheme > m_variationClrSchemeLst
Definition VSDXTheme.h:52
libvisio::VSDXClrScheme::m_accent4
Colour m_accent4
Definition VSDXTheme.h:46
libvisio::VSDXClrScheme::m_dk1
Colour m_dk1
Definition VSDXTheme.h:39
libvisio::VSDXClrScheme::m_dk2
Colour m_dk2
Definition VSDXTheme.h:41
libvisio::VSDXClrScheme::m_lt2
Colour m_lt2
Definition VSDXTheme.h:42
libvisio::VSDXClrScheme::m_hlink
Colour m_hlink
Definition VSDXTheme.h:49
libvisio::VSDXClrScheme::m_lt1
Colour m_lt1
Definition VSDXTheme.h:40
libvisio::VSDXClrScheme::m_accent1
Colour m_accent1
Definition VSDXTheme.h:43
libvisio::VSDXClrScheme::m_folHlink
Colour m_folHlink
Definition VSDXTheme.h:50
libvisio::VSDXClrScheme::m_bkgnd
Colour m_bkgnd
Definition VSDXTheme.h:51
libvisio::VSDXClrScheme::m_accent5
Colour m_accent5
Definition VSDXTheme.h:47
libvisio::VSDXClrScheme::m_accent2
Colour m_accent2
Definition VSDXTheme.h:44
libvisio::VSDXFontScheme
Definition VSDXTheme.h:68
libvisio::VSDXFontScheme::VSDXFontScheme
VSDXFontScheme()
Definition VSDXTheme.cpp:57
libvisio::VSDXFontScheme::m_schemeId
unsigned m_schemeId
Definition VSDXTheme.h:71
libvisio::VSDXFontScheme::m_majorFont
VSDXFont m_majorFont
Definition VSDXTheme.h:69
libvisio::VSDXFontScheme::m_minorFont
VSDXFont m_minorFont
Definition VSDXTheme.h:70
libvisio::VSDXFont
Definition VSDXTheme.h:58
libvisio::VSDXFont::m_csTypeFace
librevenge::RVNGString m_csTypeFace
Definition VSDXTheme.h:61
libvisio::VSDXFont::m_latinTypeFace
librevenge::RVNGString m_latinTypeFace
Definition VSDXTheme.h:59
libvisio::VSDXFont::VSDXFont
VSDXFont()
Definition VSDXTheme.cpp:49
libvisio::VSDXFont::m_typeFaces
std::map< unsigned, librevenge::RVNGString > m_typeFaces
Definition VSDXTheme.h:62
libvisio::VSDXFont::m_eaTypeFace
librevenge::RVNGString m_eaTypeFace
Definition VSDXTheme.h:60
libvisio::VSDXVariationClrScheme
Definition VSDXTheme.h:25
libvisio::VSDXVariationClrScheme::m_varColor6
Colour m_varColor6
Definition VSDXTheme.h:31
libvisio::VSDXVariationClrScheme::VSDXVariationClrScheme
VSDXVariationClrScheme()
Definition VSDXTheme.cpp:20
libvisio::VSDXVariationClrScheme::m_varColor1
Colour m_varColor1
Definition VSDXTheme.h:26
libvisio::VSDXVariationClrScheme::m_varColor2
Colour m_varColor2
Definition VSDXTheme.h:27
libvisio::VSDXVariationClrScheme::m_varColor5
Colour m_varColor5
Definition VSDXTheme.h:30
libvisio::VSDXVariationClrScheme::m_varColor3
Colour m_varColor3
Definition VSDXTheme.h:28
libvisio::VSDXVariationClrScheme::m_varColor4
Colour m_varColor4
Definition VSDXTheme.h:29
libvisio::VSDXVariationClrScheme::m_varColor7
Colour m_varColor7
Definition VSDXTheme.h:32