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 MSW_TEXT_STYLES
00039 # define MSW_TEXT_STYLES
00040
00041 #include <iostream>
00042 #include <map>
00043 #include <string>
00044
00045 #include "libmwaw_internal.hxx"
00046
00047 #include "MWAWEntry.hxx"
00048 #include "MWAWParagraph.hxx"
00049
00050 class MSWParser;
00051 class MSWText;
00052
00053 namespace MSWStruct
00054 {
00055 struct Font;
00056 struct Paragraph;
00057 struct Section;
00058 }
00059
00060 namespace MSWTextStylesInternal
00061 {
00062 struct State;
00063 }
00064
00066 class MSWTextStyles
00067 {
00068 friend class MSWText;
00069 public:
00070 enum ZoneType { TextZone, TextStructZone, StyleZone, InParagraphDefinition };
00072 MSWTextStyles(MSWText &textParser);
00074 virtual ~MSWTextStyles();
00075
00077 int version() const;
00078
00079 protected:
00080
00082 MWAWFont const &getDefaultFont() const;
00084 bool getFont(ZoneType type, int id, MSWStruct::Font &actFont);
00085
00086
00087 void setProperty(MSWStruct::Font const &font);
00091 bool readFont(MSWStruct::Font &font, ZoneType type);
00092
00093
00095 bool getParagraph(ZoneType type, int id, MSWStruct::Paragraph ¶);
00097 bool readParagraph(MSWStruct::Paragraph ¶, int dataSz=-1);
00099 void sendDefaultParagraph();
00100
00102 bool readPLCList(MSWEntry &entry);
00104 bool readTextStructList(MSWEntry &entry);
00107 int readPropertyModifier(bool &complex, std::string &extra);
00109 bool readPLC(MSWEntry &entry, int type, Vec2<long> const &fileLimit);
00110
00111
00113 bool getSection(ZoneType type, int id, MSWStruct::Section §ion);
00115 bool getSectionParagraph(ZoneType type, int id, MSWStruct::Paragraph ¶);
00117 bool getSectionFont(ZoneType type, int id, MSWStruct::Font &font);
00119 bool readSection(MSWEntry &entry, std::vector<long> &cLimits);
00121 bool sendSection(int id, int textStructId);
00122
00124 bool readSection(MSWStruct::Section §ion, long pos);
00126 void setProperty(MSWStruct::Section const &sec);
00127
00128
00130 bool readStyles(MSWEntry &entry);
00132 bool readStylesHierarchy(MSWEntry &entry, int N, std::vector<int> &orig);
00134 bool readStylesNames(MSWEntry const &zone, int N, int &Nnamed);
00136 bool readStylesFont(MSWEntry &zone, int N, std::vector<int> const &previous,
00137 std::vector<int> const &order);
00139 bool readStylesParagraph(MSWEntry &zone, int N, std::vector<int> const &previous,
00140 std::vector<int> const &order);
00142 std::map<int,int> const &getNextStyleMap() const;
00144 static std::vector<int> orderStyles(std::vector<int> const &previous);
00145
00146 private:
00147 MSWTextStyles(MSWTextStyles const &orig);
00148 MSWTextStyles &operator=(MSWTextStyles const &orig);
00149
00150 protected:
00151
00152
00153
00155 MWAWParserStatePtr m_parserState;
00156
00158 shared_ptr<MSWTextStylesInternal::State> m_state;
00159
00161 MSWParser *m_mainParser;
00162
00164 MSWText *m_textParser;
00165 };
00166 #endif
00167