Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef CW_STYLE_MANAGER
00039 # define CW_STYLE_MANAGER
00040
00041 #include <iostream>
00042 #include <string>
00043 #include <vector>
00044
00045 #include "libmwaw_internal.hxx"
00046
00047 #include "MWAWDebug.hxx"
00048 #include "MWAWGraphicStyle.hxx"
00049 #include "MWAWInputStream.hxx"
00050
00051 class CWParser;
00052
00053 namespace CWStyleManagerInternal
00054 {
00055 struct State;
00056 }
00057
00059 class CWStyleManager
00060 {
00061 public:
00062 struct CellFormat;
00063 struct KSEN;
00064 struct Style;
00065 public:
00067 CWStyleManager(CWParser &mainParser);
00069 ~CWStyleManager();
00070
00072 bool readColorList(MWAWEntry const &entry);
00074 bool readPatternList(long endPos=-1);
00076 bool readGradientList(long endPos=-1);
00078 bool readStyles(MWAWEntry const &entry);
00080 bool updateGradient(int grad, MWAWGraphicStyle &style) const;
00082 bool updateWallPaper(int wall, MWAWGraphicStyle &style) const;
00083
00085 int getFontId(int localId) const;
00087 bool getColor(int id, MWAWColor &col) const;
00089 bool getPattern(int id, MWAWGraphicStyle::Pattern &pattern, float &percent) const;
00090
00092 bool get(int styleId, Style &style) const;
00094 bool get(int fontId, MWAWFont &font) const;
00096 bool get(int formatId, CellFormat &format) const;
00098 bool get(int ksenId, KSEN &ksen) const;
00100 bool get(int graphId, MWAWGraphicStyle &graph) const;
00101
00103 bool readFont(int id, int fontSize, MWAWFont &font);
00104
00105 protected:
00107 int version() const;
00108
00110 bool readGenStyle(int id);
00111
00113 bool readStylesDef(int N, int fSz);
00115 bool readLookUp(int N, int fSz);
00116
00117
00118 bool readCellStyles(int N, int fSz);
00120 bool readFontNames(int N, int fSz);
00122 bool readGraphStyles(int N, int fSz);
00124 bool readKSEN(int N, int fSz);
00126 bool readStyleNames(int N, int fSz);
00128 bool readStyleFonts(int N, int fSz);
00129
00130 protected:
00132 MWAWParserStatePtr m_parserState;
00134 CWParser *m_mainParser;
00136 shared_ptr<CWStyleManagerInternal::State> m_state;
00137
00138 private:
00139 CWStyleManager(CWStyleManager const &orig);
00140 CWStyleManager &operator=(CWStyleManager const &orig);
00141
00142 public:
00144 struct CellFormat {
00146 CellFormat() : m_justify(0), m_format(-1), m_numDigits(2), m_separateThousand(false), m_parentheseNegatif(false), m_wrap(false), m_extra("") {
00147 }
00149 friend std::ostream &operator<<(std::ostream &o, CellFormat const &form);
00151 int m_justify;
00153 int m_format;
00155 int m_numDigits;
00157 bool m_separateThousand;
00159 bool m_parentheseNegatif;
00161 bool m_wrap;
00163 std::string m_extra;
00164 };
00165
00167 struct KSEN {
00169 KSEN() : m_valign(0), m_lineType(MWAWBorder::Simple), m_lineRepeat(MWAWBorder::Single), m_lines(0), m_extra("") {
00170 }
00172 friend std::ostream &operator<<(std::ostream &o, KSEN const &ksen);
00174 int m_valign;
00176 MWAWBorder::Style m_lineType;
00178 MWAWBorder::Type m_lineRepeat;
00180 int m_lines;
00182 std::string m_extra;
00183 };
00184
00186 struct Style {
00188 Style() : m_fontId(-1), m_cellFormatId(-1), m_rulerId(-1), m_rulerHash(-1), m_ksenId(-1), m_graphicId(-1), m_localStyleId(-1), m_styleId(-1), m_extra("") {
00189 }
00190
00192 friend std::ostream &operator<<(std::ostream &o, Style const &style);
00193
00195 int m_fontId;
00197 int m_cellFormatId;
00199 int m_rulerId;
00201 int m_rulerHash;
00203 int m_ksenId;
00205 int m_graphicId;
00207 int m_localStyleId;
00209 int m_styleId;
00211 std::string m_extra;
00212 };
00213 };
00214
00215 #endif