-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathproperties.c
198 lines (186 loc) · 5.85 KB
/
properties.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
/*
* properties.c
* Copyright (C) 1998-2005 A.J. van Os; Released under GNU GPL
*
* Description:
* Read the properties information from a MS Word file
*/
#include <stdlib.h>
#include <string.h>
#include "antiword.h"
/*
* Build the lists with Property Information
*/
void
vGetPropertyInfo(FILE *pFile, const pps_info_type *pPPS,
const ULONG *aulBBD, size_t tBBDLen,
const ULONG *aulSBD, size_t tSBDLen,
const UCHAR *aucHeader, int iWordVersion)
{
options_type tOptions;
TRACE_MSG("vGetPropertyInfo");
fail(pFile == NULL);
fail(pPPS == NULL && iWordVersion >= 6);
fail(aulBBD == NULL && tBBDLen != 0);
fail(aulSBD == NULL && tSBDLen != 0);
fail(aucHeader == NULL);
/* Get the options */
vGetOptions(&tOptions);
/* Get the property information per Word version */
switch (iWordVersion) {
case 0:
vGet0DopInfo(pFile, aucHeader);
vGet0SepInfo(pFile, aucHeader);
vGet0PapInfo(pFile, aucHeader);
if (tOptions.eConversionType == conversion_draw ||
tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_xml ||
tOptions.eConversionType == conversion_fmt_text ||
tOptions.eConversionType == conversion_pdf) {
vGet0ChrInfo(pFile, aucHeader);
}
if (tOptions.eConversionType == conversion_draw ||
tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_pdf) {
vCreate0FontTable();
}
vSet0SummaryInfo(pFile, aucHeader);
break;
case 1:
case 2:
vGet2Stylesheet(pFile, iWordVersion, aucHeader);
vGet2DopInfo(pFile, aucHeader);
vGet2SepInfo(pFile, aucHeader);
vGet2PapInfo(pFile, aucHeader);
if (tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_pdf) {
vGet2HdrFtrInfo(pFile, aucHeader);
}
if (tOptions.eConversionType == conversion_draw ||
tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_xml ||
tOptions.eConversionType == conversion_fmt_text ||
tOptions.eConversionType == conversion_pdf) {
vGet2ChrInfo(pFile, iWordVersion, aucHeader);
}
if (tOptions.eConversionType == conversion_draw ||
tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_pdf) {
vCreate2FontTable(pFile, iWordVersion, aucHeader);
}
vSet2SummaryInfo(pFile, iWordVersion, aucHeader);
break;
case 4:
case 5:
break;
case 6:
case 7:
vGet6Stylesheet(pFile, pPPS->tWordDocument.ulSB,
aulBBD, tBBDLen, aucHeader);
vGet6DopInfo(pFile, pPPS->tWordDocument.ulSB,
aulBBD, tBBDLen, aucHeader);
vGet6SepInfo(pFile, pPPS->tWordDocument.ulSB,
aulBBD, tBBDLen, aucHeader);
vGet6PapInfo(pFile, pPPS->tWordDocument.ulSB,
aulBBD, tBBDLen, aucHeader);
if (tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_pdf) {
vGet6HdrFtrInfo(pFile, pPPS->tWordDocument.ulSB,
aulBBD, tBBDLen, aucHeader);
}
if (tOptions.eConversionType == conversion_draw ||
tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_xml ||
tOptions.eConversionType == conversion_fmt_text ||
tOptions.eConversionType == conversion_pdf) {
vGet6ChrInfo(pFile, pPPS->tWordDocument.ulSB,
aulBBD, tBBDLen, aucHeader);
}
if (tOptions.eConversionType == conversion_draw ||
tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_pdf) {
vCreate6FontTable(pFile, pPPS->tWordDocument.ulSB,
aulBBD, tBBDLen, aucHeader);
}
vSet6SummaryInfo(pFile, pPPS,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
break;
case 8:
vGet8LstInfo(pFile, pPPS,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
vGet8Stylesheet(pFile, pPPS,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
vGet8DopInfo(pFile, &pPPS->tTable,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
vGet8SepInfo(pFile, pPPS,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
vGet8PapInfo(pFile, pPPS,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
if (tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_pdf) {
vGet8HdrFtrInfo(pFile, &pPPS->tTable,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
}
if (tOptions.eConversionType == conversion_draw ||
tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_xml ||
tOptions.eConversionType == conversion_fmt_text ||
tOptions.eConversionType == conversion_pdf) {
vGet8ChrInfo(pFile, pPPS,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
}
if (tOptions.eConversionType == conversion_draw ||
tOptions.eConversionType == conversion_ps ||
tOptions.eConversionType == conversion_pdf) {
vCreate8FontTable(pFile, pPPS,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
}
vSet8SummaryInfo(pFile, pPPS,
aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
break;
default:
DBG_DEC(iWordVersion);
DBG_FIXME();
werr(0, "Sorry, no property information");
break;
}
/* Temporarily: Correct the font table */
vCorrectFontTable(tOptions.eConversionType, tOptions.eEncoding);
} /* end of vGetPropertyInfo */
/*
* ePropMod2RowInfo - Turn the Property Modifier into row information
*
* Returns: the row information
*/
row_info_enum
ePropMod2RowInfo(USHORT usPropMod, int iWordVersion)
{
row_block_type tRow;
const UCHAR *aucPropMod;
int iLen;
TRACE_MSG("ePropMod2RowInfo");
aucPropMod = aucReadPropModListItem(usPropMod);
if (aucPropMod == NULL) {
return found_nothing;
}
iLen = (int)usGetWord(0, aucPropMod);
switch (iWordVersion) {
case 0:
return found_nothing;
case 1:
case 2:
return eGet2RowInfo(0, aucPropMod + 2, iLen, &tRow);
case 4:
case 5:
return found_nothing;
case 6:
case 7:
return eGet6RowInfo(0, aucPropMod + 2, iLen, &tRow);
case 8:
return eGet8RowInfo(0, aucPropMod + 2, iLen, &tRow);
default:
DBG_DEC(iWordVersion);
DBG_FIXME();
return found_nothing;
}
} /* end of ePropMod2RowInfo */