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 CLARIS_WKS_STYLE_MANAGER
00039 # define CLARIS_WKS_STYLE_MANAGER
00040
00041 #include <iostream>
00042 #include <string>
00043 #include <vector>
00044
00045 #include "libmwaw_internal.hxx"
00046
00047 #include "MWAWCell.hxx"
00048 #include "MWAWDebug.hxx"
00049 #include "MWAWGraphicStyle.hxx"
00050 #include "MWAWInputStream.hxx"
00051
00052 class ClarisWksDocument;
00053
00054 namespace ClarisWksStyleManagerInternal
00055 {
00056 struct State;
00057 }
00058
00060 class ClarisWksStyleManager
00061 {
00062 public:
00063 struct CellFormat;
00064 struct KSEN;
00065 struct Style;
00066 public:
00068 ClarisWksStyleManager(MWAWParserStatePtr parserState, ClarisWksDocument *document=0);
00070 ~ClarisWksStyleManager();
00071
00073 bool readColorList(MWAWEntry const &entry);
00075 bool readPatternList(long endPos=-1);
00077 bool readGradientList(long endPos=-1);
00079 bool readStyles(MWAWEntry const &entry);
00081 bool readFontNames();
00083 bool updateGradient(int grad, MWAWGraphicStyle &style) const;
00085 bool updateWallPaper(int wall, MWAWGraphicStyle &style) const;
00086
00088 int getFontId(int localId) const;
00090 bool getColor(int id, MWAWColor &col) const;
00092 bool getPattern(int id, MWAWGraphicStyle::Pattern &pattern, float &percent) const;
00094 bool getRulerName(int id, std::string &name) const;
00095
00097 bool get(int styleId, Style &style) const;
00099 bool get(int fontId, MWAWFont &font) const;
00101 bool get(int formatId, CellFormat &format) const;
00103 bool get(int ksenId, KSEN &ksen) const;
00105 bool get(int graphId, MWAWGraphicStyle &graph) const;
00106
00108 bool readFont(int id, int fontSize, MWAWFont &font);
00109
00110 protected:
00112 int version() const;
00113
00115 bool readGenStyle(int id);
00116
00118 bool readStylesDef(int N, int fSz);
00120 bool readLookUp(int N, int fSz);
00121
00122
00123 bool readCellStyles(int N, int fSz);
00125 bool readFontNames(int N, int fSz);
00127 bool readGraphStyles(int N, int fSz);
00129 bool readKSEN(int N, int fSz);
00131 bool readStyleNames(int N, int fSz);
00133 bool readStyleFonts(int N, int fSz);
00134
00135 protected:
00137 ClarisWksDocument *m_document;
00139 MWAWParserStatePtr m_parserState;
00141 shared_ptr<ClarisWksStyleManagerInternal::State> m_state;
00142
00143 private:
00144 ClarisWksStyleManager(ClarisWksStyleManager const &orig);
00145 ClarisWksStyleManager &operator=(ClarisWksStyleManager const &orig);
00146
00147 public:
00149 struct CellFormat : public MWAWCell::Format {
00151 CellFormat(MWAWCell::Format const &format=MWAWCell::Format()) :
00152 MWAWCell::Format(format), m_hAlign(MWAWCell::HALIGN_DEFAULT), m_fileFormat(-1), m_borders(0), m_wrap(false), m_extra("")
00153 {
00154 }
00156 friend std::ostream &operator<<(std::ostream &o, CellFormat const &form);
00158 MWAWCell::HorizontalAlignment m_hAlign;
00160 int m_fileFormat;
00162 int m_borders;
00164 bool m_wrap;
00166 std::string m_extra;
00167 };
00168
00170 struct KSEN {
00172 KSEN() : m_valign(0), m_lineType(MWAWBorder::Simple), m_lineRepeat(MWAWBorder::Single), m_lines(0), m_extra("")
00173 {
00174 }
00176 friend std::ostream &operator<<(std::ostream &o, KSEN const &ksen);
00178 int m_valign;
00180 MWAWBorder::Style m_lineType;
00182 MWAWBorder::Type m_lineRepeat;
00184 int m_lines;
00186 std::string m_extra;
00187 };
00188
00190 struct Style {
00192 Style() : m_fontId(-1), m_cellFormatId(-1), m_rulerId(-1), m_rulerPId(-1), m_nameId(-1), m_ksenId(-1), m_graphicId(-1), m_localStyleId(-1), m_styleId(-1), m_extra("")
00193 {
00194 }
00195
00197 friend std::ostream &operator<<(std::ostream &o, Style const &style);
00198
00200 int m_fontId;
00202 int m_cellFormatId;
00204 int m_rulerId;
00206 int m_rulerPId;
00208 int m_nameId;
00210 int m_ksenId;
00212 int m_graphicId;
00214 int m_localStyleId;
00216 int m_styleId;
00218 std::string m_extra;
00219 };
00220 };
00221
00222 #endif