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 #ifndef WPS4_TEXT_H
00031 #define WPS4_TEXT_H
00032
00033 #include <ostream>
00034 #include <vector>
00035
00036 #include "WPSEntry.h"
00037 #include "WPSDebug.h"
00038
00039 class WPS4Parser;
00040 namespace WPS4TextInternal
00041 {
00042 struct DataFOD;
00043 struct Font;
00044 struct Paragraph;
00045 struct State;
00046 }
00047
00048 typedef class WPSContentListener WPS4ContentListener;
00049 typedef shared_ptr<WPS4ContentListener> WPS4ContentListenerPtr;
00050
00070 class WPS4Text
00071 {
00072 friend class WPS4Parser;
00073
00074 public:
00076 WPS4Text(WPS4Parser &parser, WPXInputStreamPtr &input);
00077
00079 ~WPS4Text();
00080
00082 void setListener(WPS4ContentListenerPtr &listen)
00083 {
00084 m_listener = listen;
00085 }
00086
00088 int numPages() const;
00089
00090
00092 void flushExtra();
00093
00094 protected:
00096 WPSEntry getHeaderEntry() const;
00097
00099 WPSEntry getFooterEntry() const;
00100
00102 WPSEntry getMainTextEntry() const;
00103
00105 WPSEntry getAllTextEntry() const;
00106
00108 bool readText(WPSEntry const &entry);
00109
00111 bool readEntries();
00113 bool readStructures();
00114
00115 protected:
00116
00117
00118
00119
00122 bool findFDPStructures(int which);
00125 bool findFDPStructuresByHand(int which);
00126
00127
00128
00129
00130
00135 typedef bool (WPS4Text::* FDPParser) (long endPos, int &id, std::string &mess);
00136
00142 bool readFDP(WPSEntry const &entry,
00143 std::vector<WPS4TextInternal::DataFOD> &fods, FDPParser parser);
00144
00152 typedef bool (WPS4Text::* DataParser)
00153 (long bot, long eot, int id, long endPos, std::string &mess);
00154
00161 bool readPLC(WPSEntry const &zone,
00162 std::vector<long> &textPtrs, std::vector<long> &listValues,
00163 DataParser parser = 0L);
00164
00166 bool defDataParser (long bot, long eot, int id, long endPos, std::string &mess);
00167
00169 bool readFontNames(WPSEntry const &entry);
00170
00172 bool readFont(long endPos, int &id, std::string &mess);
00176 void setProperty(WPS4TextInternal::Font const &font);
00177
00179 bool readParagraph(long endPos, int &id, std::string &mess);
00183 void setProperty(WPS4TextInternal::Paragraph const ¶);
00184
00186 bool readDosLink(WPSEntry const &entry);
00187
00189 bool objectDataParser (long bot, long eot, int id,
00190 long endPos, std::string &mess);
00191
00193 bool readFootNotes(WPSEntry const &ftnD, WPSEntry const &ftnP);
00194
00196 bool footNotesDataParser (long bot, long eot, int id, long endPos, std::string &mess);
00197
00199 bool bkmkDataParser (long bot, long eot, int id, long endPos, std::string &mess);
00200
00202 bool dttmDataParser (long bot, long eot, int id, long endPos, std::string &mess);
00203
00204 protected:
00206 int version() const;
00207
00209 libwps::DebugFile &ascii()
00210 {
00211 return m_asciiFile;
00212 }
00213 protected:
00215 WPXInputStreamPtr m_input;
00216
00218 WPS4Parser &m_mainParser;
00219
00221 WPS4ContentListenerPtr m_listener;
00222
00224 mutable shared_ptr<WPS4TextInternal::State> m_state;
00225
00227 libwps::DebugFile &m_asciiFile;
00228 };
00229 #endif
00230