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 #ifndef MW_PRO_PARSER
00036 # define MW_PRO_PARSER
00037
00038 #include <list>
00039 #include <string>
00040 #include <vector>
00041
00042 #include "MWAWDebug.hxx"
00043 #include "MWAWEntry.hxx"
00044 #include "MWAWInputStream.hxx"
00045
00046 #include "MWAWParser.hxx"
00047
00048 class WPXBinaryData;
00049
00050 namespace MWProParserInternal
00051 {
00052 struct State;
00053 struct TextZoneData;
00054 struct TextZone;
00055 struct Token;
00056 struct Zone;
00057 class SubDocument;
00058 }
00059
00060 class MWProStructures;
00061 class MWProStructuresListenerState;
00062
00068 class MWProParser : public MWAWParser
00069 {
00070 friend class MWProStructures;
00071 friend class MWProStructuresListenerState;
00072 friend class MWProParserInternal::SubDocument;
00073
00074 public:
00076 MWProParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
00078 virtual ~MWProParser();
00079
00081 bool checkHeader(MWAWHeader *header, bool strict=false);
00082
00083
00084 void parse(WPXDocumentInterface *documentInterface);
00085
00086 protected:
00088 void init();
00089
00091 void createDocument(WPXDocumentInterface *documentInterface);
00092
00094 bool createZones();
00095
00097 bool getZoneData(WPXBinaryData &data, int blockId);
00098
00100 bool getFreeZoneList(int blockId, std::vector<int> &blockLists);
00101
00106 bool parseDataZone(int blockId, int type);
00107
00109 bool parseTextZone(shared_ptr<MWProParserInternal::Zone> zone);
00110
00112 bool readTextEntries(shared_ptr<MWProParserInternal::Zone> zone,
00113 std::vector<MWAWEntry> &res, int textLength);
00115 bool readTextIds(shared_ptr<MWProParserInternal::Zone> zone,
00116 std::vector<MWProParserInternal::TextZoneData> &res,
00117 int textLength, int type);
00119 bool readTextTokens(shared_ptr<MWProParserInternal::Zone> zone,
00120 std::vector<MWProParserInternal::Token> &res,
00121 int textLength);
00122
00125 std::vector<int> const &getBlocksCalledByToken() const;
00126
00128 float pageHeight() const;
00130 int numColumns() const;
00131
00133 void newPage(int number, bool softBreak=false);
00134
00135
00136
00137
00138
00140 bool sendTextZone(int blockId, bool mainZone = false);
00141
00143 int findNumHardBreaks(int blockId);
00144
00146 bool sendPictureZone(int blockId, MWAWPosition const &pictPos,
00147 WPXPropertyList extras = WPXPropertyList());
00148
00150 bool sendTextBoxZone(int blockId, MWAWPosition const &pos,
00151 WPXPropertyList extras = WPXPropertyList());
00152
00154 bool sendEmptyFrameZone(MWAWPosition const &pos, WPXPropertyList extras);
00155
00156
00157
00158
00159
00161 bool readPrintInfo();
00162
00164 bool readDocHeader();
00165
00166 #ifdef DEBUG
00167
00168 void saveOriginal(MWAWInputStreamPtr input);
00169 #endif
00170
00172 bool sendPicture(shared_ptr<MWProParserInternal::Zone> zone, MWAWPosition pictPos, WPXPropertyList const &extras);
00173
00175 bool sendText(shared_ptr<MWProParserInternal::TextZone> zone, bool mainZone = false);
00176
00178 int findNumHardBreaks(shared_ptr<MWProParserInternal::TextZone> zone);
00179
00181 void checkUnparsed();
00182
00183 protected:
00184
00185
00186
00188 shared_ptr<MWProParserInternal::State> m_state;
00189
00191 shared_ptr<MWProStructures> m_structures;
00192 };
00193 #endif
00194