97
97
header = WPXHeader::constructHeader(document);
100
switch (header->getMajorVersion())
100
switch (header->getFileType())
104
case 0x03: // WP Mac 3.0-3.5
105
case 0x04: // WP Mac 3.5e
106
confidence = WPD_CONFIDENCE_EXCELLENT;
102
case 0x0a: // WordPerfect File
103
switch (header->getMajorVersion())
107
confidence = WPD_CONFIDENCE_EXCELLENT;
110
// unhandled file format
111
confidence = WPD_CONFIDENCE_NONE;
115
case 0x2c: // WP Mac File
116
switch (header->getMajorVersion())
118
case 0x02: // WP Mac 2.x
119
case 0x03: // WP Mac 3.0-3.5
120
case 0x04: // WP Mac 3.5e
121
confidence = WPD_CONFIDENCE_EXCELLENT;
124
// unhandled file format
125
confidence = WPD_CONFIDENCE_NONE;
109
// unhandled file format
130
// unhandled file type
110
131
confidence = WPD_CONFIDENCE_NONE;
185
switch (header->getMajorVersion())
206
switch (header->getFileType())
188
WPD_DEBUG_MSG(("WordPerfect: Using the WP5 parser.\n"));
189
parser = new WP5Parser(document, header);
190
parser->parse(listenerImpl);
193
WPD_DEBUG_MSG(("WordPerfect: Using the WP6 parser.\n"));
194
parser = new WP6Parser(document, header);
195
parser->parse(listenerImpl);
197
case 0x03: // WP Mac 3.0-3.5
198
case 0x04: // WP Mac 3.5e
199
WPD_DEBUG_MSG(("WordPerfect: Using the WP3 parser.\n"));
200
parser = new WP3Parser(document, header);
201
parser->parse(listenerImpl);
208
case 0x0a: // WordPerfect File
209
switch (header->getMajorVersion())
212
WPD_DEBUG_MSG(("WordPerfect: Using the WP5 parser.\n"));
213
parser = new WP5Parser(document, header);
214
parser->parse(listenerImpl);
217
WPD_DEBUG_MSG(("WordPerfect: Using the WP6 parser.\n"));
218
parser = new WP6Parser(document, header);
219
parser->parse(listenerImpl);
222
// unhandled file format
223
WPD_DEBUG_MSG(("WordPerfect: Unsupported file format.\n"));
227
case 0x2c: // WP Mac File
228
switch (header->getMajorVersion())
230
case 0x02: // WP Mac 2.x
231
case 0x03: // WP Mac 3.0-3.5
232
case 0x04: // WP Mac 3.5e
233
WPD_DEBUG_MSG(("WordPerfect: Using the WP3 parser.\n"));
234
parser = new WP3Parser(document, header);
235
parser->parse(listenerImpl);
238
// unhandled file format
239
WPD_DEBUG_MSG(("WordPerfect: Unsupported file format.\n"));
204
244
// unhandled file format
205
WPD_DEBUG_MSG(("WordPerfect: Unsupported file format.\n"));
245
WPD_DEBUG_MSG(("WordPerfect: Unsupported file type.\n"));
216
256
// a file in the WP4.2 format.
217
257
int confidence = WP42Heuristics::isWP42FileFormat(document, false /* FIXME: allow for partial content */);
219
if (confidence == WPD_CONFIDENCE_GOOD || confidence == WPD_CONFIDENCE_EXCELLENT)
259
if (confidence != WPD_CONFIDENCE_NONE)
221
261
WPD_DEBUG_MSG(("WordPerfect: Mostly likely the file format is WP4.2.\n\n"));
222
262
WPD_DEBUG_MSG(("WordPerfect: Using the WP4.2 parser.\n\n"));
262
TOTALLY BROKEN, DO NOT USE!!!
265
void WPDocument::parse(WPXInputStream *input, WPXHLListenerImpl *listenerImpl, WPXFileType fileType)
267
WPXParser *parser = NULL;
268
WPXHeader *header = NULL;
275
WPD_DEBUG_MSG(("WordPerfect: Using the WP42 parser.\n"));
276
parser = new WP42Parser(input);
277
parser->parse(listenerImpl);
281
WPD_DEBUG_MSG(("WordPerfect: Using the WP5 parser.\n"));
282
header = new WPXHeader(input);
283
parser = new WP5Parser(input, header);
284
parser->parse(listenerImpl);
289
WPD_DEBUG_MSG(("WordPerfect: Using the WP6 parser.\n"));
290
header = new WPXHeader(input);
291
parser = new WP6Parser(input, header);
292
parser->parse(listenerImpl);
297
// unhandled file format
298
WPD_DEBUG_MSG(("WordPerfect: Unsupported file format.\n"));
302
catch (NoFileHeaderException)
307
throw NoFileHeaderException();
309
catch (FileException)
313
throw FileException();
321
TOTALLY BROKEN - MIGHT BE NICE TO HAVE
323
WPXFileType WPDocument::WPXParser::getFileType(WPXInputStream *input)