VSDXTheme.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libvisio project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __VSDXTHEME_H__
00011 #define __VSDXTHEME_H__
00012 
00013 #include <vector>
00014 #include <boost/optional.hpp>
00015 #include <librevenge-stream/librevenge-stream.h>
00016 #include "VSDXMLHelper.h"
00017 
00018 namespace libvisio
00019 {
00020 
00021 class VSDCollector;
00022 
00023 struct VSDXVariationClrScheme
00024 {
00025   Colour m_varColor1;
00026   Colour m_varColor2;
00027   Colour m_varColor3;
00028   Colour m_varColor4;
00029   Colour m_varColor5;
00030   Colour m_varColor6;
00031   Colour m_varColor7;
00032 
00033   VSDXVariationClrScheme();
00034 };
00035 
00036 struct VSDXClrScheme
00037 {
00038   Colour m_dk1;
00039   Colour m_lt1;
00040   Colour m_dk2;
00041   Colour m_lt2;
00042   Colour m_accent1;
00043   Colour m_accent2;
00044   Colour m_accent3;
00045   Colour m_accent4;
00046   Colour m_accent5;
00047   Colour m_accent6;
00048   Colour m_hlink;
00049   Colour m_folHlink;
00050   Colour m_bkgnd;
00051   std::vector<VSDXVariationClrScheme> m_variationClrSchemeLst;
00052 
00053   VSDXClrScheme();
00054 };
00055 
00056 class VSDXTheme
00057 {
00058 public:
00059   VSDXTheme();
00060   ~VSDXTheme();
00061   bool parse(librevenge::RVNGInputStream *input);
00062   boost::optional<Colour> getThemeColour(unsigned value, unsigned variationIndex = 0) const;
00063 
00064 private:
00065   VSDXTheme(const VSDXTheme &);
00066   VSDXTheme &operator=(const VSDXTheme &);
00067 
00068   boost::optional<Colour> readSrgbClr(xmlTextReaderPtr reader);
00069   boost::optional<Colour> readSysClr(xmlTextReaderPtr reader);
00070 
00071   void readClrScheme(xmlTextReaderPtr reader);
00072   void readThemeColour(xmlTextReaderPtr reader, int idToken, Colour &clr);
00073   void readVariationClrSchemeLst(xmlTextReaderPtr reader);
00074   void readVariationClrScheme(xmlTextReaderPtr reader, VSDXVariationClrScheme &varClrSch);
00075 
00076   int getElementToken(xmlTextReaderPtr reader);
00077 
00078   VSDXClrScheme m_clrScheme;
00079 };
00080 
00081 } // namespace libvisio
00082 
00083 #endif // __VSDXTHEME_H__
00084 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */