1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libsw602 project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_LIBSW602_SOFTWARE602DOCUMENT_H
#define INCLUDED_LIBSW602_SOFTWARE602DOCUMENT_H
#include <librevenge/librevenge.h>
#ifdef DLL_EXPORT
#ifdef LIBSW602_BUILD
#define SW602API __declspec(dllexport)
#else
#define SW602API __declspec(dllimport)
#endif
#else // !DLL_EXPORT
#ifdef LIBSW602_VISIBILITY
#define SW602API __attribute__((visibility("default")))
#else
#define SW602API
#endif
#endif
namespace libsw602
{
class SW602Document
{
public:
/** Likelihood that the file format is supported.
*/
enum Confidence
{
CONFIDENCE_NONE, //< not supported
CONFIDENCE_UNSUPPORTED_ENCRYPTION, //< encryption using unsupported encryption
CONFIDENCE_SUPPORTED_ENCRYPTION, //< encrypted using supported encryption
CONFIDENCE_EXCELLENT //< supported
};
/** Kind of document.
*/
enum Kind
{
KIND_UNKNOWN,
KIND_TEXT,
KIND_SPREADSHEET,
KIND_CHART,
KIND_DATABASE
};
/** Type of document.
*/
enum Type
{
TYPE_UNKNOWN, //< unrecognized format
TYPE_T602, //< T602 (text)
TYPE_C602, //< C602 (spreadsheet)
TYPE_C602_CHART, //< standalone C602 chart file
TYPE_K602, //< K602 (database)
TYPE_WINTEXT602, //< WinText602/602Text
TYPE_MAGICTAB, //< MagicTab/602Tab
TYPE_RESERVED_0,
TYPE_RESERVED_1,
TYPE_RESERVED_2,
TYPE_RESERVED_3,
TYPE_RESERVED_4,
TYPE_RESERVED_5,
TYPE_RESERVED_6,
TYPE_RESERVED_7,
TYPE_RESERVED_8,
TYPE_RESERVED_9
};
/** Text encoding, for formats which do not contain the information.
*/
enum Encoding
{
ENCODING_UNSPECIFIED, //< unspecified encoding, a format default will be used
ENCODING_LATIN2, //< PC Latin 2/CP852
ENCODING_KEYBCS2, //< KEYBCS2/CP895(?)
ENCODING_KOI8CS, //< KOI-8 CS2
ENCODING_WINEE //< WinEE/Windows-1250/CP1250
};
/** Result of parsing the file.
*/
enum Result
{
RESULT_OK, //< parsed without any problem
RESULT_UNSUPPORTED_FORMAT, //< unsupported file format
RESULT_PASSWORD_MISMATCH, //< wrong password
RESULT_FILE_ACCESS_ERROR, //< problem when accessing the file
RESULT_PARSE_ERROR, //< problem when parsing the file
RESULT_UNKNOWN_ERROR //< an unspecified error
};
public:
/** Detect if the stream contains a valid Software602 document.
*/
static SW602API Confidence isSupported(librevenge::RVNGInputStream *input, Kind &kind, Type *type = 0, bool *needsEncoding = 0);
/** Parse a text document.
*/
static SW602API Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document, const char *password = 0);
static SW602API Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document, Type type, const char *password = 0);
static SW602API Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document, Encoding encoding, const char *password = 0);
static SW602API Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGTextInterface *document, Type type, Encoding encoding, const char *password = 0);
/** Parse a spreadsheet.
*/
static SW602API Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGSpreadsheetInterface *document, const char *password = 0);
static SW602API Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGSpreadsheetInterface *document, Type type, const char *password = 0);
static SW602API Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGSpreadsheetInterface *document, Encoding encoding, const char *password = 0);
static SW602API Result parse(librevenge::RVNGInputStream *input, librevenge::RVNGSpreadsheetInterface *document, Type type, Encoding encoding, const char *password = 0);
};
} // namespace libsw602
#endif // INCLUDED_LIBSW602_SOFTWARE602DOCUMENT_H
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
|