-
Notifications
You must be signed in to change notification settings - Fork 6
/
fld.c
308 lines (200 loc) · 7.31 KB
/
fld.c
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
/* wvWare
* Copyright (C) Caolan McNamara, Dom Lachowicz, and others
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include "wv.h"
/*
flt value live/dead field type
1 unknown keyword
2 live possible bookmark (syntax matches bookmark name)
3 live bookmark reference
4 dead index entry
5 live footnote reference
6 live Set command (for Print Merge)
7 live If command (for Print Merge)
8 live create index
9 dead table of contents entry
10 live Style reference
11 dead document reference
12 live sequence mark
13 live create table-of-contents
14 live quote Info variable
15 live quote Title variable
16 live quote Subject variable
17 live quote Author variable
18 live quote Keywords variable
19 live quote Comments variable
20 live quote Last Revised By variable
21 live quote Creation Date variable
22 live quote Revision Date variable
23 live quote Print Date variable
24 live quote Revision Number variable
25 live quote Edit Time variable
26 live quote Number of Pages variable
27 live quote Number of Words variable
28 live quote Number of Characters variable
29 live quote File Name variable
30 live quote Document Template Name variable
31 live quote Current Date variable
32 live quote Current Time variable
33 live quote Current Page variable
34 live evaluate expression
35 live insert literal text
36 live Include command (Print Merge)
37 live page reference
38 live Ask command (Print Merge)
39 live Fill-in command to display prompt (Print Merge)
40 live Data command (Print Merge)
41 live Next command (Print Merge)
42 live NextIf command (Print Merge)
43 live SkipIf (Print Merge)
44 live inserts number of current Print Merge record
45 live DDE reference
46 live DDE automatic reference
47 live Inserts Glossary Entry
48 live sends characters to printer without translation
49 live Formula definition
50 live Goto Button
51 live Macro Button
52 live insert auto numbering field in outline format
53 live insert auto numbering field in legal format
54 live insert auto numbering field in Arabic number format
55 live reads a TIFF file
56 live Link
57 live Symbol
58 live Embedded Object
59 live Merge fields
60 live User Name
61 live User Initial
62 live User Address
63 live Bar code
64 live Document variable
65 live Section
66 live Section pages
67 live Include Picture
68 live Include Text
69 live File Size
70 live Form Text Box
71 live Form Check Box
72 live Note Reference
73 live Create Table of Authorities
74 dead Mark Table of Authorities Entry
75 live Merge record sequence number
76 either Macro
77 dead Private
78 live Insert Database
79 live Autotext
80 live Compare two values
81 live Plug-in module private
82 live Subscriber
83 live Form List Box
84 live Advance
85 live Document property
86 live
87 live OCX
88 live Hyperlink
89 live AutoTextList
90 live List element
91 live HTML control
Since dead fields have no entry in the plcffld, the string in the field code
must be used to determine the field type. All versions of Word '97 use
English field code strings, except French, German, and Spanish versions of
Word. The strings for all languages for all possible dead fields are listed
below.
flt English French German Spanish field type
value string string string string
4 XE EX XE E index entry
9 TC TE INHALT TC table of contents
entry
11 RD RD RD RD document reference
74 TA TA TA TA Mark Table of
Authorities Entry
76 Macro
77 PRIVATE PRIVE PRIVATE PRIVATESPA Private
*/
void
wvGetFLD (FLD * item, wvStream * fd)
{
U8 temp8;
U8 ch;
temp8 = read_8ubit (fd);
ch = temp8 & 0x1f;
if (ch == 19)
{
item->var1.ch = temp8 & 0x1f;
item->var1.reserved = (temp8 & 0xe0) >> 5;
item->var1.flt = read_8ubit (fd);
}
else
{
item->var2.ch = temp8 & 0x1f;
item->var2.reserved = (temp8 & 0xe0) >> 5;
temp8 = read_8ubit (fd);
item->var2.fDiffer = temp8 & 0x01;
item->var2.fZombieEmbed = (temp8 & 0x02) >> 1;
item->var2.fResultDirty = (temp8 & 0x04) >> 2;
item->var2.fResultEdited = (temp8 & 0x08) >> 3;
item->var2.fLocked = (temp8 & 0x10) >> 4;
item->var2.fPrivateResult = (temp8 & 0x20) >> 5;
item->var2.fNested = (temp8 & 0x40) >> 6;
item->var2.fHasSep = (temp8 & 0x80) >> 7;
}
}
int
wvGetFLD_PLCF (FLD ** fld, U32 ** pos, U32 * nofld, U32 offset, U32 len,
wvStream * fd)
{
U32 i;
if (len == 0)
{
*fld = NULL;
*pos = NULL;
*nofld = 0;
}
else
{
*nofld = (len - 4) / 6;
*pos = (U32 *) wvMalloc ((*nofld + 1) * sizeof (U32));
if (*pos == NULL)
{
wvError (
("NO MEM 1, failed to alloc %d bytes\n",
(*nofld + 1) * sizeof (U32)));
return (1);
}
*fld = (FLD *) wvMalloc (*nofld * sizeof (FLD));
if (*fld == NULL)
{
wvError (
("NO MEM 1, failed to alloc %d bytes\n",
*nofld * sizeof (FLD)));
wvFree (pos);
return (1);
}
wvStream_goto (fd, offset);
for (i = 0; i <= *nofld; i++)
(*pos)[i] = read_32ubit (fd);
for (i = 0; i < *nofld; i++)
wvGetFLD (&((*fld)[i]), fd);
}
return (0);
}