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 MS_WRD_MWAW_PARSER
00038 # define MS_WRD_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 MsWrdParserInternal
00053 {
00054 struct Object;
00055 struct State;
00056 class SubDocument;
00057 }
00058
00059 class MsWrdText;
00060 class MsWrdTextStyles;
00061
00063 struct MsWrdEntry : public MWAWEntry {
00064 MsWrdEntry() : MWAWEntry(), m_pictType(-1)
00065 {
00066 }
00071 int pictType() const
00072 {
00073 return m_pictType;
00074 }
00076 void setPictType(int newId)
00077 {
00078 m_pictType = newId;
00079 }
00081 friend std::ostream &operator<<(std::ostream &o, MsWrdEntry const &entry);
00083 int m_pictType;
00084 };
00085
00091 class MsWrdParser : public MWAWTextParser
00092 {
00093 friend class MsWrdText;
00094 friend class MsWrdTextStyles;
00095 friend class MsWrdParserInternal::SubDocument;
00096
00097 public:
00099 MsWrdParser(MWAWInputStreamPtr input, MWAWRSRCParserPtr rsrcParser, MWAWHeader *header);
00101 virtual ~MsWrdParser();
00102
00104 bool checkHeader(MWAWHeader *header, bool strict=false);
00105
00107 void parse(librevenge::RVNGTextInterface *documentInterface);
00108
00109 protected:
00111 void init();
00112
00114 void createDocument(librevenge::RVNGTextInterface *documentInterface);
00115
00117 bool createZones();
00118
00120 bool readHeaderEndV3();
00121
00123 bool readZoneList();
00124
00126 bool readPrintInfo(MsWrdEntry &entry);
00127
00129 bool readPrinter(MsWrdEntry &entry);
00130
00132 bool readDocSum(MsWrdEntry &entry);
00133
00135 bool readStringsZone(MsWrdEntry &entry, std::vector<std::string> &list);
00136
00138 bool readObjects();
00139
00141 bool readObjectList(MsWrdEntry &entry);
00142
00144 bool readObjectFlags(MsWrdEntry &entry);
00145
00147 bool readObject(MsWrdParserInternal::Object &obj);
00148
00150 bool readDocumentInfo(MsWrdEntry &entry);
00151
00153 bool readZone17(MsWrdEntry &entry);
00154
00156 bool checkPicturePos(long pos, int type);
00157
00159 bool readPicture(MsWrdEntry &entry);
00161 void sendPicture(long fPos, int cPos, MWAWPosition::AnchorTo anchor=MWAWPosition::Char);
00162
00164 bool getColor(int id, MWAWColor &col) const;
00165
00167 void newPage(int number);
00168
00169
00170
00171
00173 void sendFootnote(int id);
00174
00176 void sendFieldComment(int id);
00177
00179 void send(int id, libmwaw::SubDocumentType type);
00181 void send(MWAWEntry const &entry);
00182
00183
00184
00185
00186
00188 MsWrdEntry readEntry(std::string type, int id=-1);
00189
00190 protected:
00191
00192
00193
00195 shared_ptr<MsWrdParserInternal::State> m_state;
00196
00198 std::multimap<std::string, MsWrdEntry> m_entryMap;
00199
00201 shared_ptr<MsWrdText> m_textParser;
00202 };
00203 #endif
00204