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 __CDRPARSER_H__
00031 #define __CDRPARSER_H__
00032
00033 #include <stdio.h>
00034 #include <iostream>
00035 #include <vector>
00036 #include <map>
00037 #include <stack>
00038 #include <libwpd-stream/libwpd-stream.h>
00039 #include "CDRTypes.h"
00040 #include "CommonParser.h"
00041
00042 namespace libcdr
00043 {
00044
00045 class CDRCollector;
00046
00047 class CDRParser : protected CommonParser
00048 {
00049 public:
00050 explicit CDRParser(const std::vector<WPXInputStream *> &externalStreams, CDRCollector *collector);
00051 virtual ~CDRParser();
00052 bool parseRecords(WPXInputStream *input, unsigned *blockLengths = 0, unsigned level = 0);
00053 bool parseWaldo(WPXInputStream *input);
00054
00055 private:
00056 CDRParser();
00057 CDRParser(const CDRParser &);
00058 CDRParser &operator=(const CDRParser &);
00059 bool parseWaldoStructure(WPXInputStream *input, std::stack<WaldoRecordType1> &waldoStack,
00060 const std::map<unsigned, WaldoRecordType1> &records1,
00061 std::map<unsigned, WaldoRecordInfo> &records2);
00062 bool gatherWaldoInformation(WPXInputStream *input, std::vector<WaldoRecordInfo> &records, std::map<unsigned, WaldoRecordInfo> &records2,
00063 std::map<unsigned, WaldoRecordInfo> &records3, std::map<unsigned, WaldoRecordInfo> &records4,
00064 std::map<unsigned, WaldoRecordInfo> &records6, std::map<unsigned, WaldoRecordInfo> &records7,
00065 std::map<unsigned, WaldoRecordInfo> &records8, std::map<unsigned, WaldoRecordInfo> recordsOther);
00066 void readWaldoRecord(WPXInputStream *input, const WaldoRecordInfo &info);
00067 bool parseRecord(WPXInputStream *input, unsigned *blockLengths = 0, unsigned level = 0);
00068 void readRecord(unsigned fourCC, unsigned length, WPXInputStream *input);
00069 double readRectCoord(WPXInputStream *input);
00070 CDRColor readColor(WPXInputStream *input);
00071
00072 void readRectangle(WPXInputStream *input);
00073 void readEllipse(WPXInputStream *input);
00074 void readLineAndCurve(WPXInputStream *input);
00075 void readBitmap(WPXInputStream *input);
00076 void readPageSize(WPXInputStream *input);
00077 void readWaldoBmp(WPXInputStream *input, unsigned length, unsigned id);
00078 void readWaldoBmpf(WPXInputStream *input, unsigned id);
00079 void readWaldoTrfd(WPXInputStream *input);
00080 void readWaldoOutl(WPXInputStream *input);
00081 void readWaldoFill(WPXInputStream *input);
00082 void readWaldoLoda(WPXInputStream *input, unsigned length);
00083 void readOpacity(WPXInputStream *input, unsigned length);
00084 void readTrfd(WPXInputStream *input, unsigned length);
00085 void readFild(WPXInputStream *input, unsigned length);
00086 void readOutl(WPXInputStream *input, unsigned length);
00087 void readLoda(WPXInputStream *input, unsigned length);
00088 void readFlags(WPXInputStream *input, unsigned length);
00089 void readMcfg(WPXInputStream *input, unsigned length);
00090 void readPath(WPXInputStream *input);
00091 void readPolygonCoords(WPXInputStream *input);
00092 void readPolygonTransform(WPXInputStream *input);
00093 void readBmp(WPXInputStream *input, unsigned length);
00094 void readBmpf(WPXInputStream *input, unsigned length);
00095 void readPpdt(WPXInputStream *input, unsigned length);
00096 void readFtil(WPXInputStream *input, unsigned length);
00097 void readDisp(WPXInputStream *input, unsigned length);
00098 void readVersion(WPXInputStream *input, unsigned length);
00099 void readIccd(WPXInputStream *input, unsigned length);
00100 void readBBox(WPXInputStream *input, unsigned length);
00101 void readSpnd(WPXInputStream *input, unsigned length);
00102 void readVpat(WPXInputStream *input, unsigned length);
00103 void readUidr(WPXInputStream *input, unsigned length);
00104 void readFont(WPXInputStream *input, unsigned length);
00105 void readStlt(WPXInputStream *input, unsigned length);
00106 void readStyd(WPXInputStream *input);
00107 void readTxsm(WPXInputStream *input, unsigned length);
00108 void readTxsm16(WPXInputStream *input);
00109 void readTxsm6(WPXInputStream *input);
00110 void readTxsm5(WPXInputStream *input);
00111 void readArtisticText(WPXInputStream *input);
00112 void readParagraphText(WPXInputStream *input);
00113
00114 bool _redirectX6Chunk(WPXInputStream **input, unsigned &length);
00115
00116 std::vector<WPXInputStream *> m_externalStreams;
00117
00118 std::map<unsigned, CDRFont> m_fonts;
00119 std::map<unsigned, CDRFillStyle> m_fillStyles;
00120 std::map<unsigned, CDRLineStyle> m_lineStyles;
00121
00122 unsigned m_version;
00123
00124 };
00125
00126 }
00127
00128 #endif // __CDRPARSER_H__
00129