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 #ifndef MSW_MWAW_PARSER
00038 # define MSW_MWAW_PARSER
00039
00040 #include <list>
00041 #include <map>
00042 #include <string>
00043 #include <vector>
00044
00045 #include "MWAWDebug.hxx"
00046 #include "MWAWEntry.hxx"
00047 #include "MWAWInputStream.hxx"
00048 #include "MWAWPosition.hxx"
00049
00050 #include "MWAWParser.hxx"
00051
00052 namespace MSWParserInternal
00053 {
00054 struct Object;
00055 struct State;
00056 class SubDocument;
00057 }
00058
00059 class MSWText;
00060 class MSWTextStyles;
00061
00063 struct MSWEntry : public MWAWEntry {
00064 MSWEntry() : MWAWEntry(), m_pictType(-1) {
00065 }
00070 int pictType() const {
00071 return m_pictType;
00072 }
00074 void setPictType(int newId) {
00075 m_pictType = newId;
00076 }
00078 friend std::ostream &operator<<(std::ostream &o, MSWEntry const &entry);
00080 int m_pictType;
00081 };
00082
00088 class MSWParser : public MWAWParser
00089 {
00090 friend class MSWText;
00091 friend class MSWTextStyles;
00092 friend class MSWParserInternal::SubDocument;
00093
00094 public:
00096 MSWParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
00098 virtual ~MSWParser();
00099
00101 bool checkHeader(MWAWHeader *header, bool strict=false);
00102
00104 void parse(WPXDocumentInterface *documentInterface);
00105
00106 protected:
00108 void init();
00109
00111 void createDocument(WPXDocumentInterface *documentInterface);
00112
00114 bool createZones();
00115
00117 bool readHeaderEndV3();
00118
00120 bool readZoneList();
00121
00123 bool readPrintInfo(MSWEntry &entry);
00124
00126 bool readPrinter(MSWEntry &entry);
00127
00129 bool readDocSum(MSWEntry &entry);
00130
00132 bool readStringsZone(MSWEntry &entry, std::vector<std::string> &list);
00133
00135 bool readObjects();
00136
00138 bool readObjectList(MSWEntry &entry);
00139
00141 bool readObjectFlags(MSWEntry &entry);
00142
00144 bool readObject(MSWParserInternal::Object &obj);
00145
00147 bool readDocumentInfo(MSWEntry &entry);
00148
00150 bool readZone17(MSWEntry &entry);
00151
00153 bool checkPicturePos(long pos, int type);
00154
00156 bool readPicture(MSWEntry &entry);
00158 void sendPicture(long fPos, int cPos, MWAWPosition::AnchorTo anchor=MWAWPosition::Char);
00159
00161 bool getColor(int id, MWAWColor &col) const;
00162
00164 void newPage(int number);
00165
00166
00167
00168
00170 void sendFootnote(int id);
00171
00173 void sendFieldComment(int id);
00174
00176 void send(int id, libmwaw::SubDocumentType type);
00178 void send(MWAWEntry const &entry);
00179
00180
00181
00182
00183
00185 MSWEntry readEntry(std::string type, int id=-1);
00186
00187 protected:
00188
00189
00190
00192 shared_ptr<MSWParserInternal::State> m_state;
00193
00195 std::multimap<std::string, MSWEntry> m_entryMap;
00196
00198 shared_ptr<MSWText> m_textParser;
00199 };
00200 #endif
00201