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_MWAW_TEXT
00039 # define MSW_MWAW_TEXT
00040
00041 #include <map>
00042 #include <string>
00043 #include <vector>
00044
00045 #include "libmwaw_internal.hxx"
00046
00047 #include "MWAWEntry.hxx"
00048
00049 #include "MWAWDebug.hxx"
00050
00051 #include "MSWTextStyles.hxx"
00052
00053 namespace MSWTextInternal
00054 {
00055 struct State;
00056 struct Table;
00057 }
00058
00059 struct MSWEntry;
00060 class MSWParser;
00061 class MSWTextStyles;
00062
00064 class MSWText
00065 {
00066 friend class MSWParser;
00067 friend class MSWTextStyles;
00068 public:
00070 struct PLC {
00071 enum Type { TextPosition, HeaderFooter, Page, Section, ParagraphInfo, Paragraph, Font, Footnote, FootnoteDef, Field, Object };
00072 PLC(Type type, int id=0) : m_type(type), m_id(id), m_extra("") {
00073 }
00075 friend std::ostream &operator<<(std::ostream &o, PLC const &plc);
00077 struct ltstr {
00078 bool operator()(PLC const &s1, PLC const &s2) const {
00079 if (s1.m_type != s2.m_type)
00080 return int(s1.m_type) < int(s2.m_type);
00081 if (s1.m_id != s2.m_id)
00082 return s1.m_id < s2.m_id;
00083 return false;
00084 }
00085 };
00087 Type m_type;
00089 int m_id;
00091 std::string m_extra;
00092 };
00093 public:
00095 MSWText(MSWParser &parser);
00097 virtual ~MSWText();
00098
00100 int version() const;
00101
00103 int numPages() const;
00104
00106 MWAWEntry getHeader() const;
00107
00109 MWAWEntry getFooter() const;
00110 protected:
00112 shared_ptr<MWAWParserState> &getParserState() {
00113 return m_parserState;
00114 }
00115
00117 bool sendMainText();
00118
00120 bool sendText(MWAWEntry const &textEntry, bool mainZone, bool tableCell=false);
00122 bool sendSection(int sectionId);
00124 bool readHeaderTextLength();
00125
00127 bool createZones(long bot);
00128
00130 bool readTextStruct(MSWEntry &entry);
00131
00133 bool readPageBreak(MSWEntry &entry);
00134
00136 bool readParagraphInfo(MSWEntry entry);
00137
00139 bool readFields(MSWEntry &entry, std::vector<long> const &fieldPos);
00140
00142 bool sendFieldComment(int id);
00143
00145 bool readFootnotesPos(MSWEntry &entry, std::vector<long> const ¬eDef);
00146
00148 bool readFootnotesData(MSWEntry &entry);
00149
00151 bool sendFootnote(int id);
00152
00154 bool readFontNames(MSWEntry &entry);
00155
00157 void flushExtra();
00158
00160 bool sendTable(MSWTextInternal::Table const &table);
00161
00162
00163
00165 long getMainTextLength() const;
00167 std::multimap<long, MSWText::PLC> &getTextPLCMap();
00169 std::multimap<long, MSWText::PLC> &getFilePLCMap();
00170
00171
00172
00173
00174
00176 void prepareData();
00177
00179 void prepareLines();
00181 void convertFilePLCPos();
00183 void prepareParagraphProperties();
00185 void prepareFontProperties();
00186
00188 void prepareTableLimits();
00190 bool updateTableBeginnningAt(long cPos, long &nextCPos);
00191
00193 bool readLongZone(MSWEntry &entry, int sz, std::vector<long> &list);
00194
00195 private:
00196 MSWText(MSWText const &orig);
00197 MSWText &operator=(MSWText const &orig);
00198
00199 protected:
00200
00201
00202
00204 MWAWParserStatePtr m_parserState;
00205
00207 shared_ptr<MSWTextInternal::State> m_state;
00208
00210 shared_ptr<MSWTextStyles> m_stylesManager;
00211
00213 MSWParser *m_mainParser;
00214 };
00215 #endif
00216