VSDXTheme.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libvisio 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/.
*/
#ifndef __VSDXTHEME_H__
#define __VSDXTHEME_H__
#include <vector>
#include <map>
#include <optional>
#include <array>
#include <librevenge-stream/librevenge-stream.h>
#include "VSDXMLHelper.h"
namespace libvisio
{
class VSDCollector;
struct VSDXVariationClrScheme
{
Colour m_varColor1;
Colour m_varColor2;
Colour m_varColor3;
Colour m_varColor4;
Colour m_varColor5;
Colour m_varColor6;
Colour m_varColor7;
VSDXVariationClrScheme();
};
struct VSDXClrScheme
{
Colour m_dk1;
Colour m_lt1;
Colour m_dk2;
Colour m_lt2;
Colour m_accent1;
Colour m_accent2;
Colour m_accent3;
Colour m_accent4;
Colour m_accent5;
Colour m_accent6;
Colour m_hlink;
Colour m_folHlink;
Colour m_bkgnd;
std::vector<VSDXVariationClrScheme> m_variationClrSchemeLst;
VSDXClrScheme();
};
struct VSDXFont
{
librevenge::RVNGString m_latinTypeFace;
librevenge::RVNGString m_eaTypeFace;
librevenge::RVNGString m_csTypeFace;
std::map<unsigned, librevenge::RVNGString> m_typeFaces;
VSDXFont();
};
struct VSDXFontScheme
{
VSDXFont m_majorFont;
VSDXFont m_minorFont;
unsigned m_schemeId;
VSDXFontScheme();
};
struct VSDXVariationStyleScheme
{
std::array<std::array<unsigned, 4>, 4> m_varStyles;
VSDXVariationStyleScheme();
};
class VSDXTheme
{
public:
VSDXTheme();
~VSDXTheme();
bool parse(librevenge::RVNGInputStream *input);
std::optional<Colour> getThemeColour(unsigned value, unsigned variationIndex = 0) const;
std::optional<Colour> getStyleColour(unsigned value, unsigned variationIndex = 0) const;
std::optional<Colour> getFillStyleColour(unsigned value) const;
size_t getFillStyleLstSize() const { return m_fillStyleLst.size(); }
private:
VSDXTheme(const VSDXTheme &);
VSDXTheme &operator=(const VSDXTheme &);
std::optional<Colour> readSrgbClr(xmlTextReaderPtr reader);
std::optional<Colour> readSysClr(xmlTextReaderPtr reader);
std::optional<Colour> readSchemeClr(xmlTextReaderPtr reader);
void readClrScheme(xmlTextReaderPtr reader);
bool readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr);
void readVariationClrSchemeLst(xmlTextReaderPtr reader);
void readVariationClrScheme(xmlTextReaderPtr reader, VSDXVariationClrScheme &varClrSch);
void readVariationStyleSchemeLst(xmlTextReaderPtr reader);
void readVariationStyleScheme(xmlTextReaderPtr reader, int idToken, VSDXVariationStyleScheme &vaStyleSch);
void readVarIdx(xmlTextReaderPtr reader, std::array<unsigned, 4>& varStyle);
void readFontScheme(xmlTextReaderPtr reader);
void readFont(xmlTextReaderPtr reader, int idToken, VSDXFont &font);
bool readTypeFace(xmlTextReaderPtr reader, librevenge::RVNGString &typeFace);
bool readTypeFace(xmlTextReaderPtr reader, int &script, librevenge::RVNGString &typeFace);
void readFmtScheme(xmlTextReaderPtr reader);
void readFillStyleLst(xmlTextReaderPtr reader);
void readGradFill(xmlTextReaderPtr reader, std::size_t nPos);
void readGradFillLst(xmlTextReaderPtr reader, std::size_t nPos);
int getElementToken(xmlTextReaderPtr reader);
void skipUnimplemented(xmlTextReaderPtr reader, int idToken);
VSDXClrScheme m_clrScheme;
VSDXFontScheme m_fontScheme;
std::array<std::vector<std::optional<Colour>>, 6> m_fillStyleLst;
std::vector<VSDXVariationStyleScheme> m_variationStyleSchemeLst;
};
} // namespace libvisio
#endif // __VSDXTHEME_H__
/* 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