2
* Copyright (C) 2002-2003 William Lachance (wrlach@gmail.com)
3
* Copyright (C) 2002-2004 Marc Maurer (uwog@uwog.net)
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19
* For further information visit http://libwpd.sourceforge.net
23
#include "HtmlListenerImpl.h"
24
#include "WPXStreamImplementation.h"
25
#include "WPDocument.h"
27
int main(int argc, char *argv[])
31
printf("Usage: wpd2html <WordPerfect Document>\n");
35
WPXInputStream* input = new WPXFileStream(argv[1]);
37
WPDConfidence confidence = WPDocument::isFileFormatSupported(input, false);
38
if (confidence == WPD_CONFIDENCE_NONE || confidence == WPD_CONFIDENCE_POOR)
40
printf("ERROR: Unsupported file format!\n");
45
HtmlListenerImpl listenerImpl;
46
WPDResult error = WPDocument::parse(input, static_cast<WPXHLListenerImpl *>(&listenerImpl));
48
if (error == WPD_FILE_ACCESS_ERROR)
49
fprintf(stderr, "ERROR: File Exception!\n");
50
else if (error == WPD_PARSE_ERROR)
51
fprintf(stderr, "ERROR: Parse Exception!\n");
52
else if (error == WPD_UNSUPPORTED_ENCRYPTION_ERROR)
53
fprintf(stderr, "ERROR: File is password protected!\n");
54
else if (error == WPD_OLE_ERROR)
55
fprintf(stderr, "ERROR: File is an OLE document, but does not contain a WordPerfect stream!\n");
56
else if (error != WPD_OK)
57
fprintf(stderr, "ERROR: Unknown Error!\n");