-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecordParser.h
263 lines (252 loc) · 7.55 KB
/
RecordParser.h
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
#ifndef RECORD_PARSER_H
#define RECORD_PARSER_H
#include <QtCore>
#include "RecordReader.h"
/*
datetime stored as double number,the integer part represent days offset to 1990-1-1,
the fraction part represent seconds;
total seconds=(fraction+0.0000001)*86400
$totalseconds = floor(SPREADSHEET_EXCEL_READER_MSINADAY * $fractionalDay);
$secs = $totalseconds % 60;
$totalseconds -= $secs;
$hours = floor($totalseconds / (60 * 60));
$mins = floor($totalseconds / 60) % 60;
*/
namespace ExceLite
{
struct Font
{
qint16 dyHeight; //o4s2 height of the font(1/20 of a point)
qint16 grbit; //o6s2 font attributes
qint16 icv; //o8s2 index to color palette
qint16 bls; //o10s2 Bold style
qint16 sss; //o12s2 00=None,01=Superscript,02=subscript
qint8 uls; //o14s1 Underline style 00=None 01=Single 02=Double 21=Single Accounting 22=Double Accounting
qint8 bFamily; //o15s1 font family
qint8 bCharSet; //o16s1 Character Set
qint8 Reserved; //o17s1 must be 0
//qint8 cch; //o18s1 Length of the font name
QString fontName; //o19sv
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct Sst
{
bool ParseRecord(QByteArray& rawbytes,QStringList& list,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
bool AppendContinue(QByteArray& continuebytes,QStringList& list,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
qint32 cstTotal; //o4s4 Total number of strings in sst and extsst
qint32 cstUnique; //o8s4 Number of unique strings in sst
private:
bool sharedRead(QDataStream &odqs,QStringList& list);
biff8String curStr;
};
struct Boundsheet
{
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
qint32 lbPlyPos;
qint16 grbit;
QString name;
};
struct Format
{
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
qint16 ifmt;
QString formating;
};
struct Xf
{
public:
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
qint16 ifnt; //4
qint16 ifmt; //6
qint16 fLocked; //8
qint16 alc; //10
qint16 cIndent; //12
qint16 dgLeft;//14
qint16 icvLeft; //16
qint32 icvTop; //18
qint16 icvFore;//22
};
struct DIMENSIONS//YES
{
quint32 rwMic;
quint32 rwMac;
quint16 colMic;
quint16 colMac;
quint16 reserv;
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct REF
{
quint16 rwFirst;
quint16 rwLast;
quint16 colFirst;
quint16 colLast;
};
struct ARRAY//NO
{
quint16 rwFirst;
quint16 rwLast;
quint8 colFirst;
quint8 colLast;
quint8 grbit;
quint32 chn;
quint16 cce;
QString rgce;//Parsed formula expression
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QStringList& list,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct BLANK//YES
{
quint16 rw;
quint16 col;
quint16 ixfe;
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct BOOLERR//NO
{
quint16 rw;
quint16 col;
quint16 ixfe;
quint8 bBoolErr;
quint8 fError;
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct FORMULA//part
{
quint16 rw;
quint16 col;
quint16 ixfe;
double num;
quint16 grbit;
quint32 chn;
quint16 cce;
//QString rgce;//Parsed formula expression,not implemented current
bool booleanvalue;
quint8 errorvalue;
quint8 result_type;
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct LABEL//no
{
quint16 rw;
quint16 col;
quint16 ixfe;
quint16 cch;
quint8 grbit;
QByteArray rgb;//Array of string characters
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct LABELSST//yes
{
quint16 rw;
quint16 col;
quint16 ixfe;
quint32 isst;
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct NUMBER//yes
{
quint16 rw;
quint16 col;
quint16 ixfe;
double num;//Floating-point number value
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct MULBLANK//yes
{
quint16 rw;
quint16 colFirst;
QVector<qint16> rgixfe;//Array of indexes to XF records
quint16 colLast;
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
typedef struct rkrec
{
quint16 ixfe; /* index to XF record */
qint32 rk; /* RK number */
double num;
} RKREC;
static double NumFromRk(qint32 rk)
{
double num;
if(rk&0x02)
{
num=(double)(rk>>2);
}
else
{
*((qint32*)&num+1)=rk&0xfffffffc;
*((qint32*)&num)=0;
}
if(rk&0x01)
{
num/=100;
}
return num;
}
struct MULRK//yes
{
quint16 rw;
quint16 colFirst;
QVector<RKREC> rgrkrec;
quint16 colLast;
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct RK//分数,yes
{
quint16 rw;
quint16 col;
quint16 ixfe;
qint32 rk;
double num;
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct SHRFMLA//no
{
quint16 rwFirst;
quint16 rwLast;
quint8 colFirst;
quint8 colLast;
qint16 Reserved;
qint16 cce;
QString rgce;
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct STRING//yes
{
qint16 cch;
qint8 grbit;
QString rgch;
//Access Interface
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct MERGECELLS//yes
{
qint16 cmcs;
QVector<REF> rgRef;
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
struct ROW
{
quint16 rw;
quint16 colMic;
quint16 colMac;
qint16 miyRw;
qint16 irwMac;
qint16 reserv;
qint16 grbit;
qint16 ixfe;
bool ParseRecord(QByteArray& rawbytes,QDataStream::ByteOrder byteorder=QDataStream::LittleEndian);
};
}
#endif // RECORD_PARSER_H