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 #ifndef ZW_PARSER
00035 # define ZW_PARSER
00036
00037 #include <string>
00038 #include <vector>
00039
00040 #include <libwpd/libwpd.h>
00041
00042 #include "MWAWDebug.hxx"
00043 #include "MWAWInputStream.hxx"
00044
00045 #include "MWAWParser.hxx"
00046
00047 namespace ZWParserInternal
00048 {
00049 class SubDocument;
00050 struct State;
00051 }
00052
00053 class ZWText;
00054
00056 struct ZWField {
00058 ZWField() : m_pos() {
00059 }
00061 bool getString(MWAWInputStreamPtr &input, std::string &str) const;
00063 bool getBool(MWAWInputStreamPtr &input, bool &val) const;
00065 bool getInt(MWAWInputStreamPtr &input, int &val) const;
00067 bool getFloat(MWAWInputStreamPtr &input, float &val) const;
00069 bool getIntList(MWAWInputStreamPtr &input, std::vector<int> &val) const;
00070
00072 bool getDebugString(MWAWInputStreamPtr &input, std::string &str) const;
00073
00075 MWAWEntry m_pos;
00076 };
00077
00080 class ZWParser : public MWAWParser
00081 {
00082 friend class ZWParserInternal::SubDocument;
00083 friend class ZWText;
00084 public:
00086 ZWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
00088 virtual ~ZWParser();
00089
00091 bool checkHeader(MWAWHeader *header, bool strict=false);
00092
00093
00094 void parse(WPXDocumentInterface *documentInterface);
00095
00096 protected:
00098 void init();
00099
00101 void createDocument(WPXDocumentInterface *documentInterface);
00102
00104 Vec2f getPageLeftTop() const;
00106 void newPage(int number);
00107
00108
00109
00111 bool sendHeaderFooter(bool header);
00112
00113 protected:
00115 bool createZones();
00116
00118 bool readBarState(MWAWEntry const &entry);
00120 bool readHTMLPref(MWAWEntry const &entry);
00122 bool readPrintInfo(MWAWEntry const &entry);
00124 bool readCPRT(MWAWEntry const &entry);
00126 bool readSectionRange(MWAWEntry const &entry);
00128 bool readWindowPos(MWAWEntry const &entry);
00129
00131 bool readUnknownZone(MWAWEntry const &entry);
00132
00134 bool readCPos(MWAWEntry const &entry);
00136 bool readSLen(MWAWEntry const &entry);
00137
00139 bool getFieldList(MWAWEntry const &entry, std::vector<ZWField> &list);
00140
00142 MWAWInputStreamPtr rsrcInput();
00143
00145 libmwaw::DebugFile &rsrcAscii();
00146
00147
00148
00149
00150
00152 shared_ptr<ZWParserInternal::State> m_state;
00153
00155 shared_ptr<ZWText> m_textParser;
00156 };
00157 #endif
00158