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 CW_MWAW_PARSER
00039 # define CW_MWAW_PARSER
00040
00041 #include <set>
00042 #include <string>
00043 #include <vector>
00044
00045 #include <libwpd/libwpd.h>
00046
00047 #include "MWAWEntry.hxx"
00048 #include "MWAWPosition.hxx"
00049
00050 #include "MWAWParser.hxx"
00051
00052 #include "CWStruct.hxx"
00053
00054 namespace CWParserInternal
00055 {
00056 struct State;
00057 class SubDocument;
00058 }
00059
00060 class CWDatabase;
00061 class CWGraph;
00062 class CWPresentation;
00063 class CWSpreadsheet;
00064 class CWStyleManager;
00065 class CWTable;
00066 class CWText;
00067
00073 class CWParser : public MWAWParser
00074 {
00075 friend class CWParserInternal::SubDocument;
00076 friend class CWDatabase;
00077 friend class CWGraph;
00078 friend class CWPresentation;
00079 friend class CWSpreadsheet;
00080 friend class CWStyleManager;
00081 friend class CWTable;
00082 friend class CWText;
00083
00084 public:
00086 CWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
00088 virtual ~CWParser();
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 bool createZones();
00105
00107 shared_ptr<CWStruct::DSET> getZone(int zId) const;
00108
00110 bool exploreZonesGraph();
00112 bool exploreZonesGraphRec(int zId, std::set<int> ¬DoneList);
00113
00115 void typeMainZones();
00116
00118 int typeMainZonesRec(int zId, CWStruct::DSET::Type type, int maxHeight);
00119
00121 bool readZone();
00122
00124 bool readPrintInfo();
00125
00127 bool readStructZone(char const *zoneName, bool hasEntete);
00128
00131 bool readStructIntZone(char const *zoneName, bool hasEntete, int fSz, std::vector<int> &res);
00132
00134 Vec2i getDocumentPages() const;
00136 double getTextHeight() const;
00138 Vec2f getPageLeftTop() const;
00140 void newPage(int number);
00141
00142
00143
00144
00145
00147 bool canSendZoneAsGraphic(int number) const;
00149 bool sendZone(int zoneId, bool asGraphic, MWAWPosition pos=MWAWPosition());
00151 void forceParsed(int zoneId);
00152
00154 void sendFootnote(int zoneId);
00155
00157 MWAWSection getMainSection() const;
00158
00159
00160
00161
00162
00164 void getHeaderFooterId(int &headerId, int &footerId) const;
00165
00166
00167
00168
00169
00171 bool readDocHeader();
00172
00174 bool readDocInfo();
00175
00177 bool readEndTable();
00178
00182 shared_ptr<CWStruct::DSET> readDSET(bool &complete);
00183
00184
00185
00186
00187 bool readDSUM(MWAWEntry const &entry, bool inHeader);
00188
00189
00190 bool readTNAM(MWAWEntry const &entry);
00191
00192
00193 bool readSNAP(MWAWEntry const &entry);
00194
00195
00196
00197 bool readCPRT(MWAWEntry const &entry);
00198
00200 void checkOrdering(std::vector<int16_t> &vec16, std::vector<int32_t> &vec32) const;
00201
00202 protected:
00203
00204
00205
00206
00207
00209 shared_ptr<CWParserInternal::State> m_state;
00210
00212 bool m_pageSpanSet;
00213
00215 shared_ptr<CWDatabase> m_databaseParser;
00216
00218 shared_ptr<CWGraph> m_graphParser;
00219
00221 shared_ptr<CWPresentation> m_presentationParser;
00222
00224 shared_ptr<CWSpreadsheet> m_spreadsheetParser;
00225
00227 shared_ptr<CWStyleManager> m_styleManager;
00228
00230 shared_ptr<CWTable> m_tableParser;
00231
00233 shared_ptr<CWText> m_textParser;
00234 };
00235 #endif
00236