1 | #include <stdio.h>
|
---|
2 | #include <stdlib.h>
|
---|
3 | #include <ctype.h>
|
---|
4 | #include <string.h>
|
---|
5 | #include "wv.h"
|
---|
6 |
|
---|
7 | /*
|
---|
8 | void wvToggle(int ret,CHP *in,STSH *stsh,U8 toggle,type)
|
---|
9 |
|
---|
10 | When the parameter of the sprm is set to 0 or 1, then
|
---|
11 | the CHP property is set to the parameter value.
|
---|
12 |
|
---|
13 | */
|
---|
14 |
|
---|
15 | /*
|
---|
16 | When the parameter of the sprm is 128, then the CHP property is set to the
|
---|
17 | value that is stored for the property in the style sheet. CHP When the
|
---|
18 | parameter of the sprm is 129, the CHP property is set to the negation of the
|
---|
19 | value that is stored for the property in the style sheet CHP.
|
---|
20 | sprmCFBold through sprmCFVanish are stored only in grpprls linked to piece table
|
---|
21 | entries.
|
---|
22 |
|
---|
23 |
|
---|
24 | */
|
---|
25 |
|
---|
26 | /*
|
---|
27 | an argument might be made that instead of in being returned or negated that
|
---|
28 | it should be the looked up in the original chp through the istd that should
|
---|
29 | be used, in which case this should be a macro that does the right thing.
|
---|
30 | but im uncertain as to which is the correct one to do, ideas on a postcard
|
---|
31 | to... etc etc
|
---|
32 |
|
---|
33 | This argument which i left as a comment to the original function has been
|
---|
34 | bourne out in practice, so i converted this to a macro and did a lookup
|
---|
35 | on the original unmodified chp in the stylesheet to check against
|
---|
36 |
|
---|
37 | Interestingly enough, even though the spec says that these are only used
|
---|
38 | in piece table grpprls this is untrue, examples/doc-that-needs-utf8.doc
|
---|
39 | has them in the stylesheet definition portion, which is a serious problem
|
---|
40 | as the style that must be checked is not generated before this modifier
|
---|
41 | comes along, a real nuisance.
|
---|
42 | */
|
---|
43 |
|
---|
44 | #define wvTOGGLE(ret,in,stsh,toggle,type) \
|
---|
45 | { \
|
---|
46 | CHP ctemp; \
|
---|
47 | if ((toggle == 0) || (toggle == 1)) \
|
---|
48 | ret = toggle; \
|
---|
49 | else \
|
---|
50 | { \
|
---|
51 | \
|
---|
52 | wvInitCHPFromIstd(&ctemp,in->istd,stsh); \
|
---|
53 | \
|
---|
54 | if (toggle == 128) \
|
---|
55 | ret = ctemp.type; \
|
---|
56 | else if (toggle == 129) \
|
---|
57 | ret = !ctemp.type; \
|
---|
58 | else \
|
---|
59 | wvWarning("Strangle sprm toggle value, ignoring\n"); \
|
---|
60 | } \
|
---|
61 | }
|
---|
62 |
|
---|
63 |
|
---|
64 | /*
|
---|
65 | spra value operand size
|
---|
66 | 0 1 byte (operand affects 1 bit)
|
---|
67 | 1 1 byte
|
---|
68 | 2 2 bytes
|
---|
69 | 3 4 bytes
|
---|
70 | 4 2 bytes
|
---|
71 | 5 2 bytes
|
---|
72 | 6 variable length -- following byte is size of operand
|
---|
73 | 7 3 bytes
|
---|
74 | */
|
---|
75 | int wvSprmLen(int spra)
|
---|
76 | {
|
---|
77 | switch(spra)
|
---|
78 | {
|
---|
79 | case 0:
|
---|
80 | case 1:
|
---|
81 | return(1);
|
---|
82 | case 2:
|
---|
83 | case 4:
|
---|
84 | case 5:
|
---|
85 | return(2);
|
---|
86 | case 7:
|
---|
87 | return(3);
|
---|
88 | case 3:
|
---|
89 | return(4);
|
---|
90 | case 6:
|
---|
91 | return(-1);
|
---|
92 | /*variable length -- following byte is size of operand*/
|
---|
93 | default:
|
---|
94 | wvError(("Incorrect spra value %d\n",spra));
|
---|
95 | }
|
---|
96 | return(-2);
|
---|
97 | }
|
---|
98 |
|
---|
99 | void wvInitSprm(Sprm *Sprm)
|
---|
100 | {
|
---|
101 | Sprm->ispmd = 0;
|
---|
102 | Sprm->fSpec = 0;
|
---|
103 | Sprm->sgc = 0;
|
---|
104 | Sprm->spra = 0;
|
---|
105 | }
|
---|
106 |
|
---|
107 | void wvGetSprmFromU16(Sprm *Sprm,U16 sprm)
|
---|
108 | {
|
---|
109 | #ifdef PURIFY
|
---|
110 | wvInitSprm(Sprm);
|
---|
111 | #endif
|
---|
112 | Sprm->ispmd = sprm & 0x01ff;
|
---|
113 | Sprm->fSpec = (sprm & 0x0200)>>9;
|
---|
114 | Sprm->sgc = (sprm & 0x1c00)>>10;
|
---|
115 | Sprm->spra = (sprm & 0xe000)>>13;
|
---|
116 | }
|
---|
117 |
|
---|
118 | U8 wvEatSprm(U16 sprm,U8 *pointer, U16 *pos)
|
---|
119 | {
|
---|
120 | int len;
|
---|
121 | Sprm aSprm;
|
---|
122 | wvTrace(("Eating sprm %x\n",sprm));
|
---|
123 | wvGetSprmFromU16(&aSprm,sprm);
|
---|
124 | if (sprm == sprmPChgTabs)
|
---|
125 | {
|
---|
126 | wvTrace(("sprmPChgTabs\n"));
|
---|
127 | len = wvApplysprmPChgTabs(NULL,pointer,pos);
|
---|
128 | len++;
|
---|
129 | return(len);
|
---|
130 | }
|
---|
131 | else if ((sprm == sprmTDefTable) || (sprm == sprmTDefTable10))
|
---|
132 | {
|
---|
133 | wvTrace(("sprmTDefTable\\sprmTDefTable10\n"));
|
---|
134 | len = bread_16ubit(pointer,pos);
|
---|
135 | len--;
|
---|
136 | }
|
---|
137 | else
|
---|
138 | {
|
---|
139 | len = wvSprmLen(aSprm.spra);
|
---|
140 | wvTrace(("wvSprmLen len is %d\n",len));
|
---|
141 | if (len < 0)
|
---|
142 | {
|
---|
143 | len = bgetc(pointer,pos);
|
---|
144 | len++;
|
---|
145 | }
|
---|
146 | }
|
---|
147 | (*pos)+=len;
|
---|
148 | return(len);
|
---|
149 | }
|
---|
150 |
|
---|
151 | Sprm wvApplySprmFromBucket(version ver,U16 sprm,PAP *apap,CHP *achp,SEP *asep,STSH *stsh, U8 *pointer, U16 *pos,FILE *data)
|
---|
152 | {
|
---|
153 | BRC10 tempBRC10;
|
---|
154 | U16 temp16;
|
---|
155 | U8 temp8;
|
---|
156 | PAP temppap;
|
---|
157 | CHP tempchp;
|
---|
158 | SEP tempsep;
|
---|
159 | U8 toggle;
|
---|
160 | Sprm RetSprm;
|
---|
161 |
|
---|
162 | /*bullet proofing*/
|
---|
163 | if (apap == NULL)
|
---|
164 | {
|
---|
165 | wvInitPAP(&temppap);
|
---|
166 | apap = &temppap;
|
---|
167 | }
|
---|
168 | if (achp == NULL)
|
---|
169 | {
|
---|
170 | wvInitCHP(&tempchp);
|
---|
171 | achp = &tempchp;
|
---|
172 | }
|
---|
173 | if (asep == NULL)
|
---|
174 | {
|
---|
175 | #ifdef PURIFY
|
---|
176 | wvInitSEP(&tempsep);
|
---|
177 | #endif
|
---|
178 | asep = &tempsep;
|
---|
179 | }
|
---|
180 | #ifdef SPRMTEST
|
---|
181 | wvError(("sprm is %x\n",sprm));
|
---|
182 | #endif
|
---|
183 |
|
---|
184 | switch(sprm)
|
---|
185 | {
|
---|
186 | /*Beginning of PAP*/
|
---|
187 | case sprmPIstd:
|
---|
188 | apap->istd = bread_16ubit(pointer,pos);
|
---|
189 | break;
|
---|
190 | case sprmPIstdPermute:
|
---|
191 | wvApplysprmPIstdPermute(apap,pointer,pos);
|
---|
192 | break;
|
---|
193 | case sprmPIncLvl:
|
---|
194 | wvApplysprmPIncLvl(apap,pointer,pos);
|
---|
195 | break;
|
---|
196 | case sprmPJc:
|
---|
197 | apap->jc = bgetc(pointer,pos);
|
---|
198 | wvTrace(("jc is now %d\n",apap->jc));
|
---|
199 | break;
|
---|
200 | case sprmPFSideBySide:
|
---|
201 | apap->fSideBySide = bgetc(pointer,pos);
|
---|
202 | break;
|
---|
203 | case sprmPFKeep:
|
---|
204 | apap->fKeep = bgetc(pointer,pos);
|
---|
205 | break;
|
---|
206 | case sprmPFKeepFollow:
|
---|
207 | apap->fKeepFollow = bgetc(pointer,pos);
|
---|
208 | break;
|
---|
209 | case sprmPFPageBreakBefore:
|
---|
210 | apap->fPageBreakBefore = bgetc(pointer,pos);
|
---|
211 | break;
|
---|
212 | case sprmPBrcl:
|
---|
213 | apap->brcl = bgetc(pointer,pos);
|
---|
214 | break;
|
---|
215 | case sprmPBrcp:
|
---|
216 | apap->brcp = bgetc(pointer,pos);
|
---|
217 | break;
|
---|
218 | case sprmPIlvl:
|
---|
219 | apap->ilvl = bgetc(pointer,pos);
|
---|
220 | break;
|
---|
221 | case sprmPIlfo:
|
---|
222 | apap->ilfo = (S16)bread_16ubit(pointer,pos);
|
---|
223 | wvTrace(("ilfo is %d\n",apap->ilfo));
|
---|
224 | break;
|
---|
225 | case sprmPFNoLineNumb:
|
---|
226 | apap->fNoLnn = bgetc(pointer,pos);
|
---|
227 | break;
|
---|
228 | case sprmPChgTabsPapx:
|
---|
229 | wvApplysprmPChgTabsPapx(apap,pointer,pos);
|
---|
230 | break;
|
---|
231 | case sprmPDxaRight:
|
---|
232 | apap->dxaRight = (S16)bread_16ubit(pointer,pos);
|
---|
233 | break;
|
---|
234 | case sprmPDxaLeft:
|
---|
235 | apap->dxaLeft = (S16)bread_16ubit(pointer,pos);
|
---|
236 | break;
|
---|
237 | case sprmPNest:
|
---|
238 | /*
|
---|
239 | sprmPNest (opcode 0x4610) causes its operand, a two-byte dxa value to be
|
---|
240 | added to pap.dxaLeft. If the result of the addition is less than 0, 0 is
|
---|
241 | stored into pap.dxaLeft.
|
---|
242 | */
|
---|
243 | temp16 = (S16)bread_16ubit(pointer,pos);
|
---|
244 | apap->dxaLeft += temp16;
|
---|
245 | if ( apap->dxaLeft < 0) apap->dxaLeft=0;
|
---|
246 | break;
|
---|
247 | case sprmPDxaLeft1:
|
---|
248 | apap->dxaLeft1 = (S16)bread_16ubit(pointer,pos);
|
---|
249 | break;
|
---|
250 | case sprmPDyaLine:
|
---|
251 | wvGetLSPDFromBucket(&apap->lspd,pointer);
|
---|
252 | (*pos)+=4;
|
---|
253 | break;
|
---|
254 | case sprmPDyaBefore:
|
---|
255 | apap->dyaBefore = bread_16ubit(pointer,pos);
|
---|
256 | break;
|
---|
257 | case sprmPDyaAfter:
|
---|
258 | apap->dyaAfter = bread_16ubit(pointer,pos);
|
---|
259 | break;
|
---|
260 | case sprmPChgTabs:
|
---|
261 | wvApplysprmPChgTabs(apap,pointer,pos);
|
---|
262 | break;
|
---|
263 | case sprmPFInTable:
|
---|
264 | apap->fInTable = bgetc(pointer,pos);
|
---|
265 | break;
|
---|
266 | case sprmPFTtp:
|
---|
267 | apap->fTtp = bgetc(pointer,pos);
|
---|
268 | break;
|
---|
269 | case sprmPDxaAbs:
|
---|
270 | apap->dxaAbs = (S16)bread_16ubit(pointer,pos);
|
---|
271 | break;
|
---|
272 | case sprmPDyaAbs:
|
---|
273 | apap->dyaAbs = (S16)bread_16ubit(pointer,pos);
|
---|
274 | break;
|
---|
275 | case sprmPDxaWidth:
|
---|
276 | apap->dxaWidth = (S16)bread_16ubit(pointer,pos);
|
---|
277 | break;
|
---|
278 | case sprmPPc:
|
---|
279 | wvApplysprmPPc(apap,pointer,pos);
|
---|
280 | break;
|
---|
281 | case sprmPBrcTop10:
|
---|
282 | wvGetBRC10FromBucket(&tempBRC10,pointer);
|
---|
283 | (*pos)+=2;
|
---|
284 | wvConvertBRC10ToBRC(&apap->brcTop,&tempBRC10);
|
---|
285 | break;
|
---|
286 | case sprmPBrcLeft10:
|
---|
287 | wvGetBRC10FromBucket(&tempBRC10,pointer);
|
---|
288 | (*pos)+=2;
|
---|
289 | wvConvertBRC10ToBRC(&apap->brcLeft,&tempBRC10);
|
---|
290 | break;
|
---|
291 | case sprmPBrcBottom10:
|
---|
292 | wvGetBRC10FromBucket(&tempBRC10,pointer);
|
---|
293 | (*pos)+=2;
|
---|
294 | wvConvertBRC10ToBRC(&apap->brcBottom,&tempBRC10);
|
---|
295 | break;
|
---|
296 | case sprmPBrcRight10:
|
---|
297 | wvGetBRC10FromBucket(&tempBRC10,pointer);
|
---|
298 | (*pos)+=2;
|
---|
299 | wvConvertBRC10ToBRC(&apap->brcRight,&tempBRC10);
|
---|
300 | break;
|
---|
301 | case sprmPBrcBetween10:
|
---|
302 | wvGetBRC10FromBucket(&tempBRC10,pointer);
|
---|
303 | (*pos)+=2;
|
---|
304 | wvConvertBRC10ToBRC(&apap->brcBetween,&tempBRC10);
|
---|
305 | break;
|
---|
306 | case sprmPBrcBar10:
|
---|
307 | wvGetBRC10FromBucket(&tempBRC10,pointer);
|
---|
308 | (*pos)+=2;
|
---|
309 | wvConvertBRC10ToBRC(&apap->brcBar,&tempBRC10);
|
---|
310 | break;
|
---|
311 | case sprmPDxaFromText10:
|
---|
312 | apap->dxaFromText = (S16)bread_16ubit(pointer,pos);
|
---|
313 | break;
|
---|
314 | case sprmPWr:
|
---|
315 | apap->wr = bgetc(pointer,pos);
|
---|
316 | break;
|
---|
317 | case sprmPBrcTop:
|
---|
318 | (*pos)+=wvGetBRCFromBucket(ver,&apap->brcTop,pointer);
|
---|
319 | break;
|
---|
320 | case sprmPBrcLeft:
|
---|
321 | (*pos)+=wvGetBRCFromBucket(ver,&apap->brcLeft,pointer);
|
---|
322 | break;
|
---|
323 | case sprmPBrcBottom:
|
---|
324 | (*pos)+=wvGetBRCFromBucket(ver,&apap->brcBottom,pointer);
|
---|
325 | break;
|
---|
326 | case sprmPBrcRight:
|
---|
327 | (*pos)+=wvGetBRCFromBucket(ver,&apap->brcRight,pointer);
|
---|
328 | break;
|
---|
329 | case sprmPBrcBetween:
|
---|
330 | (*pos)+=wvGetBRCFromBucket(ver,&apap->brcBetween,pointer);
|
---|
331 | break;
|
---|
332 | case sprmPBrcBar:
|
---|
333 | (*pos)+=wvGetBRCFromBucket(ver,&apap->brcBar,pointer);
|
---|
334 | break;
|
---|
335 | case sprmPFNoAutoHyph:
|
---|
336 | apap->fNoAutoHyph = bgetc(pointer,pos);
|
---|
337 | break;
|
---|
338 | case sprmPWHeightAbs:
|
---|
339 | /* ???? apap->wHeightAbs*/
|
---|
340 | (*pos)+=2;
|
---|
341 | break;
|
---|
342 | case sprmPDcs:
|
---|
343 | wvGetDCSFromBucket(&apap->dcs,pointer);
|
---|
344 | (*pos)+=2;
|
---|
345 | break;
|
---|
346 | case sprmPShd:
|
---|
347 | wvGetSHDFromBucket(&apap->shd,pointer);
|
---|
348 | (*pos)+=2;
|
---|
349 | break;
|
---|
350 | case sprmPDyaFromText:
|
---|
351 | apap->dyaFromText = (S16)bread_16ubit(pointer,pos);
|
---|
352 | break;
|
---|
353 | case sprmPDxaFromText:
|
---|
354 | apap->dxaFromText = (S16)bread_16ubit(pointer,pos);
|
---|
355 | break;
|
---|
356 | case sprmPFLocked:
|
---|
357 | apap->fLocked = bgetc(pointer,pos);
|
---|
358 | break;
|
---|
359 | case sprmPFWidowControl:
|
---|
360 | apap->fWidowControl = bgetc(pointer,pos);
|
---|
361 | break;
|
---|
362 | case sprmPFKinsoku:
|
---|
363 | apap->fKinsoku = bgetc(pointer,pos);
|
---|
364 | break;
|
---|
365 | case sprmPFWordWrap:
|
---|
366 | apap->fWordWrap = bgetc(pointer,pos);
|
---|
367 | break;
|
---|
368 | case sprmPFOverflowPunct:
|
---|
369 | apap->fOverflowPunct = bgetc(pointer,pos);
|
---|
370 | break;
|
---|
371 | case sprmPFTopLinePunct:
|
---|
372 | apap->fTopLinePunct = bgetc(pointer,pos);
|
---|
373 | break;
|
---|
374 | case sprmPFAutoSpaceDE:
|
---|
375 | apap->fAutoSpaceDE = bgetc(pointer,pos);
|
---|
376 | break;
|
---|
377 | case sprmPFAutoSpaceDN:
|
---|
378 | /* ???? apap->fAutoSpaceDN */
|
---|
379 | (*pos)++;
|
---|
380 | break;
|
---|
381 | case sprmPWAlignFont:
|
---|
382 | apap->wAlignFont = (S16)bread_16ubit(pointer,pos);
|
---|
383 | break;
|
---|
384 | case sprmPFrameTextFlow:
|
---|
385 | wvApplysprmPFrameTextFlow(apap,pointer,pos);
|
---|
386 | break;
|
---|
387 | case sprmPISnapBaseLine:
|
---|
388 | /*obsolete: not applicable in Word97 and later versions*/
|
---|
389 | (*pos)++;
|
---|
390 | break;
|
---|
391 | case sprmPNLvlAnm:
|
---|
392 | /*obsolete: not applicable in Word97 and later version*/
|
---|
393 | apap->nLvlAnm = bgetc(pointer,pos);
|
---|
394 | wvTrace(("%d\n",apap->nLvlAnm));
|
---|
395 | break;
|
---|
396 | case sprmPAnld:
|
---|
397 | wvApplysprmPAnld(ver,apap,pointer,pos);
|
---|
398 | break;
|
---|
399 | case sprmPPropRMark:
|
---|
400 | wvApplysprmPPropRMark(apap,pointer,pos);
|
---|
401 | break;
|
---|
402 | case sprmPOutLvl:
|
---|
403 | /*has no effect if pap.istd is < 1 or is > 9*/
|
---|
404 | temp8 = bgetc(pointer,pos);
|
---|
405 | if ((apap->istd >= 1) && (apap->istd <=9))
|
---|
406 | apap->lvl=temp8;
|
---|
407 | break;
|
---|
408 | case sprmPFBiDi:
|
---|
409 | /* ???? */
|
---|
410 | bgetc(pointer,pos);
|
---|
411 | break;
|
---|
412 | case sprmPFNumRMIns:
|
---|
413 | apap->fNumRMIns = bgetc(pointer,pos);
|
---|
414 | break;
|
---|
415 | case sprmPCrLf:
|
---|
416 | /* ???? */
|
---|
417 | (*pos)++;
|
---|
418 | break;
|
---|
419 | case sprmPNumRM:
|
---|
420 | wvApplysprmPNumRM(apap,pointer,pos);
|
---|
421 | break;
|
---|
422 | case sprmPHugePapx2:
|
---|
423 | case sprmPHugePapx:
|
---|
424 | wvApplysprmPHugePapx(apap,pointer,pos,data,stsh);
|
---|
425 | break;
|
---|
426 | case sprmPFUsePgsuSettings:
|
---|
427 | apap->fUsePgsuSettings = bgetc(pointer,pos);
|
---|
428 | break;
|
---|
429 | case sprmPFAdjustRight:
|
---|
430 | apap->fAdjustRight = bgetc(pointer,pos);
|
---|
431 | break;
|
---|
432 | /*End of PAP*/
|
---|
433 |
|
---|
434 |
|
---|
435 | /*Begin of CHP*/
|
---|
436 | case sprmCFRMarkDel:
|
---|
437 | achp->fRMarkDel = bgetc(pointer,pos);
|
---|
438 | break;
|
---|
439 | case sprmCFRMark:
|
---|
440 | achp->fRMark = bgetc(pointer,pos);
|
---|
441 | break;
|
---|
442 | case sprmCFFldVanish:
|
---|
443 | achp->fFldVanish = bgetc(pointer,pos);
|
---|
444 | break;
|
---|
445 | case sprmCPicLocation:
|
---|
446 | if (ver != WORD8)
|
---|
447 | {
|
---|
448 | wvTrace(("byte is %x\n",bgetc(pointer,pos)));
|
---|
449 | pointer++;
|
---|
450 | }
|
---|
451 | /*
|
---|
452 | This sprm moves the 4-byte operand of the sprm into the
|
---|
453 | chp.fcPic field. It simultaneously sets chp.fSpec to 1.
|
---|
454 | */
|
---|
455 | achp->fcPic_fcObj_lTagObj = bread_32ubit(pointer,pos);
|
---|
456 | wvTrace(("Len is %x\n",achp->fcPic_fcObj_lTagObj));
|
---|
457 | achp->fSpec = 1;
|
---|
458 | break;
|
---|
459 | case sprmCIbstRMark:
|
---|
460 | achp->ibstRMark = (S16) bread_16ubit(pointer,pos);
|
---|
461 | break;
|
---|
462 | case sprmCDttmRMark:
|
---|
463 | wvGetDTTMFromBucket(&achp->dttmRMark,pointer);
|
---|
464 | (*pos)+=4;
|
---|
465 | break;
|
---|
466 | case sprmCFData:
|
---|
467 | achp->fData = bgetc(pointer,pos);
|
---|
468 | break;
|
---|
469 | case sprmCIdslRMark:
|
---|
470 | achp->idslRMReason = (S16)bread_16ubit(pointer,pos);
|
---|
471 | break;
|
---|
472 | case sprmCChs:
|
---|
473 | wvApplysprmCChs(achp,pointer,pos);
|
---|
474 | break;
|
---|
475 | case sprmCSymbol:
|
---|
476 | wvApplysprmCSymbol(ver,achp,pointer,pos);
|
---|
477 | break;
|
---|
478 | case sprmCFOle2:
|
---|
479 | achp->fOle2 = bgetc(pointer,pos);
|
---|
480 | break;
|
---|
481 | case sprmCHighlight:
|
---|
482 | /* ico (fHighlight is set to 1 iff ico is not 0) */
|
---|
483 | achp->icoHighlight = bgetc(pointer,pos);
|
---|
484 | if (achp->icoHighlight) achp->fHighlight = 1; /*?*/
|
---|
485 |
|
---|
486 | /*another possibility is...*/
|
---|
487 | /* if (achp->ico) achp->fHighlight = 1; */
|
---|
488 | /*
|
---|
489 | or is it something else, who knows the entire documentation on
|
---|
490 | the topic consist of the if and only if (iff) line, or maybe
|
---|
491 | iff is a type for if, who knows eh ?
|
---|
492 | */
|
---|
493 | break;
|
---|
494 | case sprmCObjLocation:
|
---|
495 | achp->fcPic_fcObj_lTagObj = (S32)bread_32ubit(pointer,pos);
|
---|
496 | break;
|
---|
497 | case sprmCIstd:
|
---|
498 | achp->istd = bread_16ubit(pointer,pos);
|
---|
499 | break;
|
---|
500 | case sprmCIstdPermute:
|
---|
501 | wvApplysprmCIstdPermute(achp,pointer,pos); /*unfinished*/
|
---|
502 | break;
|
---|
503 | case sprmCDefault:
|
---|
504 | wvApplysprmCDefault(achp,pointer,pos);
|
---|
505 | break;
|
---|
506 | case sprmCPlain:
|
---|
507 | wvApplysprmCPlain(achp,stsh);
|
---|
508 | break;
|
---|
509 | case sprmCFBold:
|
---|
510 | toggle = bgetc(pointer,pos);
|
---|
511 | wvTrace(("toggle here is %d, istd is %d\n",toggle,achp->istd));
|
---|
512 | wvTOGGLE(achp->fBold,achp,stsh,toggle,fBold)
|
---|
513 | break;
|
---|
514 | case sprmCFItalic:
|
---|
515 | toggle = bgetc(pointer,pos);
|
---|
516 | wvTrace(("Italic is %d, sprm val is %d\n",achp->fItalic,toggle));
|
---|
517 | wvTOGGLE(achp->fItalic,achp,stsh,toggle,fItalic)
|
---|
518 | wvTrace(("Italic is now %d\n",achp->fItalic));
|
---|
519 | break;
|
---|
520 | case sprmCFStrike:
|
---|
521 | toggle = bgetc(pointer,pos);
|
---|
522 | wvTOGGLE(achp->fStrike,achp,stsh,toggle,fStrike)
|
---|
523 | break;
|
---|
524 | case sprmCFOutline:
|
---|
525 | toggle = bgetc(pointer,pos);
|
---|
526 | wvTOGGLE(achp->fOutline,achp,stsh,toggle,fOutline)
|
---|
527 | break;
|
---|
528 | case sprmCFShadow:
|
---|
529 | toggle = bgetc(pointer,pos);
|
---|
530 | wvTOGGLE(achp->fShadow,achp,stsh,toggle,fShadow)
|
---|
531 | break;
|
---|
532 | case sprmCFSmallCaps:
|
---|
533 | toggle = bgetc(pointer,pos);
|
---|
534 | wvTOGGLE(achp->fSmallCaps,achp,stsh,toggle,fSmallCaps)
|
---|
535 | break;
|
---|
536 | case sprmCFCaps:
|
---|
537 | toggle = bgetc(pointer,pos);
|
---|
538 | wvTOGGLE(achp->fCaps,achp,stsh,toggle,fCaps)
|
---|
539 | break;
|
---|
540 | case sprmCFVanish:
|
---|
541 | wvTrace(("vanish modified\n"));
|
---|
542 | toggle = bgetc(pointer,pos);
|
---|
543 | wvTOGGLE(achp->fVanish,achp,stsh,toggle,fVanish)
|
---|
544 | break;
|
---|
545 | case sprmCFtcDefault:
|
---|
546 | toggle = bgetc(pointer,pos);
|
---|
547 | wvTOGGLE(achp->fBold,achp,stsh,toggle,fBold)
|
---|
548 | break;
|
---|
549 | case sprmCKul:
|
---|
550 | achp->kul = bgetc(pointer,pos);
|
---|
551 | break;
|
---|
552 | case sprmCSizePos:
|
---|
553 | wvApplysprmCSizePos(achp,pointer,pos);
|
---|
554 | break;
|
---|
555 | case sprmCDxaSpace:
|
---|
556 | achp->dxaSpace = (S16)bread_16ubit(pointer,pos);
|
---|
557 | break;
|
---|
558 | case sprmCIco:
|
---|
559 | achp->ico = bgetc(pointer,pos);
|
---|
560 | break;
|
---|
561 | case sprmCHps:
|
---|
562 | /*incorrect marked as being a byte in docs ?*/
|
---|
563 | achp->hps = bread_16ubit(pointer,pos);
|
---|
564 | break;
|
---|
565 | case sprmCHpsInc:
|
---|
566 | wvApplysprmCHpsInc(achp,pointer,pos);
|
---|
567 | break;
|
---|
568 | case sprmCHpsPos:
|
---|
569 | /*incorrect marked as being a byte in docs ?*/
|
---|
570 | achp->hpsPos = bread_16ubit(pointer,pos);
|
---|
571 | break;
|
---|
572 | case sprmCHpsPosAdj:
|
---|
573 | wvApplysprmCHpsPosAdj(achp,pointer,pos);
|
---|
574 | break;
|
---|
575 | case sprmCMajority:
|
---|
576 | wvApplysprmCMajority(achp,stsh,pointer,pos);
|
---|
577 | break;
|
---|
578 | case sprmCIss:
|
---|
579 | achp->iss = bgetc(pointer,pos);
|
---|
580 | break;
|
---|
581 | case sprmCHpsNew50:
|
---|
582 | bgetc(pointer,pos);
|
---|
583 | achp->hps = bread_16ubit(pointer,pos);
|
---|
584 | break;
|
---|
585 | case sprmCHpsInc1:
|
---|
586 | wvApplysprmCHpsInc1(achp,pointer,pos);
|
---|
587 | break;
|
---|
588 | case sprmCHpsKern:
|
---|
589 | /*the spec would you have you believe that this is a U8*/
|
---|
590 | achp->hpsKern = bread_16ubit(pointer,pos);
|
---|
591 | break;
|
---|
592 | case sprmCMajority50:
|
---|
593 | wvApplysprmCMajority50(achp,stsh,pointer,pos);
|
---|
594 | break;
|
---|
595 | case sprmCHpsMul:
|
---|
596 | /*percentage to grow hps ??*/
|
---|
597 | achp->hps = achp->hps * bread_16ubit(pointer,pos)/100;
|
---|
598 | break;
|
---|
599 | case sprmCYsri:
|
---|
600 | /* ???? achp->ysri*/
|
---|
601 | bgetc(pointer,pos);
|
---|
602 | break;
|
---|
603 | case sprmCRgFtc0:
|
---|
604 | achp->ftcAscii = bread_16ubit(pointer,pos);
|
---|
605 | break;
|
---|
606 | case sprmCRgFtc1:
|
---|
607 | achp->ftcFE = bread_16ubit(pointer,pos);
|
---|
608 | break;
|
---|
609 | case sprmCRgFtc2:
|
---|
610 | achp->ftcOther = bread_16ubit(pointer,pos);
|
---|
611 | break;
|
---|
612 | case sprmCFDStrike:
|
---|
613 | achp->fDStrike = bgetc(pointer,pos);
|
---|
614 | break;
|
---|
615 | case sprmCFImprint:
|
---|
616 | achp->fImprint = bgetc(pointer,pos);
|
---|
617 | break;
|
---|
618 | case sprmCFSpec:
|
---|
619 | achp->fSpec = bgetc(pointer,pos);
|
---|
620 | break;
|
---|
621 | case sprmCFObj:
|
---|
622 | achp->fObj = bgetc(pointer,pos);
|
---|
623 | break;
|
---|
624 | case sprmCPropRMark:
|
---|
625 | wvApplysprmCPropRMark(achp,pointer,pos);
|
---|
626 | break;
|
---|
627 | case sprmCFEmboss:
|
---|
628 | achp->fEmboss = bgetc(pointer,pos);
|
---|
629 | break;
|
---|
630 | case sprmCSfxText:
|
---|
631 | achp->sfxtText = bgetc(pointer,pos);
|
---|
632 | break;
|
---|
633 | case sprmCDispFldRMark:
|
---|
634 | wvApplysprmCDispFldRMark(achp,pointer,pos);
|
---|
635 | break;
|
---|
636 | case sprmCIbstRMarkDel:
|
---|
637 | achp->ibstRMarkDel = (S16) bread_16ubit(pointer,pos);
|
---|
638 | break;
|
---|
639 | case sprmCDttmRMarkDel:
|
---|
640 | wvGetDTTMFromBucket(&achp->dttmRMarkDel,pointer);
|
---|
641 | (*pos)+=4;
|
---|
642 | break;
|
---|
643 | case sprmCBrc:
|
---|
644 | (*pos)+=wvGetBRCFromBucket(ver,&achp->brc,pointer);
|
---|
645 | break;
|
---|
646 | case sprmCShd:
|
---|
647 | wvGetSHDFromBucket(&apap->shd,pointer);
|
---|
648 | (*pos)+=2;
|
---|
649 | case sprmCIdslRMarkDel:
|
---|
650 | /* achp->idslRMReasonDel ???? */
|
---|
651 | (S16) bread_16ubit(pointer,pos);
|
---|
652 | break;
|
---|
653 | case sprmCFUsePgsuSettings:
|
---|
654 | achp->fUsePgsuSettings = bgetc(pointer,pos);
|
---|
655 | break;
|
---|
656 | case sprmCRgLid0:
|
---|
657 | achp->lidDefault = bread_16ubit(pointer,pos);
|
---|
658 | break;
|
---|
659 | case sprmCRgLid1:
|
---|
660 | achp->lidFE = bread_16ubit(pointer,pos);
|
---|
661 | break;
|
---|
662 | case sprmCIdctHint:
|
---|
663 | achp->idctHint = bgetc(pointer,pos);
|
---|
664 | break;
|
---|
665 | case sprmCFFtcAsciSymb: /* not fully mentioned in spec*/
|
---|
666 | achp->fFtcAsciSym = bgetc(pointer,pos);
|
---|
667 | break;
|
---|
668 | case sprmCCpg: /* not fully mentioned in spec*/
|
---|
669 | achp->cpg = bread_16ubit(pointer,pos);
|
---|
670 | break;
|
---|
671 | case sprmCLid: /*
|
---|
672 | only used internally, never stored ( word 97 )
|
---|
673 | but exists in earlier versions so...
|
---|
674 | */
|
---|
675 | achp->lid = bread_16ubit(pointer,pos);
|
---|
676 | achp->lidDefault = achp->lid;
|
---|
677 | achp->lidFE = achp->lid;
|
---|
678 | wvTrace(("lid is %x\n",achp->lidDefault));
|
---|
679 | break;
|
---|
680 | case sprmCFBoldBi: /* ???? */
|
---|
681 | case sprmCFBiDi: /* ???? */
|
---|
682 | bgetc(pointer,pos);
|
---|
683 | break;
|
---|
684 | case sprmCHpsBi: /* ???? */
|
---|
685 | bread_16ubit(pointer,pos);
|
---|
686 | break;
|
---|
687 | /* End of CHP */
|
---|
688 |
|
---|
689 |
|
---|
690 | /* Begin of SEP */
|
---|
691 | case sprmScnsPgn:
|
---|
692 | asep->cnsPgn = bgetc(pointer,pos);
|
---|
693 | break;
|
---|
694 | case sprmSiHeadingPgn:
|
---|
695 | asep->iHeadingPgn = bgetc(pointer,pos);
|
---|
696 | break;
|
---|
697 | case sprmSOlstAnm:
|
---|
698 | wvApplysprmSOlstAnm(ver,asep,pointer,pos);
|
---|
699 | break;
|
---|
700 | case sprmSDxaColWidth:
|
---|
701 | case sprmSDxaColSpacing:
|
---|
702 | /* well then no one has docs for these two , they're 3 long
|
---|
703 | but affects (i guess by name) a 89 long array so who
|
---|
704 | knows
|
---|
705 | */
|
---|
706 | bgetc(pointer,pos);
|
---|
707 | bgetc(pointer,pos);
|
---|
708 | bgetc(pointer,pos);
|
---|
709 | break;
|
---|
710 | case sprmSFEvenlySpaced:
|
---|
711 | asep->fEvenlySpaced = bgetc(pointer,pos);
|
---|
712 | break;
|
---|
713 | case sprmSFProtected:
|
---|
714 | asep->fUnlocked = bgetc(pointer,pos);
|
---|
715 | break;
|
---|
716 | case sprmSDmBinFirst:
|
---|
717 | asep->dmBinFirst = bread_16ubit(pointer,pos);
|
---|
718 | break;
|
---|
719 | case sprmSDmBinOther:
|
---|
720 | asep->dmBinFirst = bread_16ubit(pointer,pos);
|
---|
721 | break;
|
---|
722 | case sprmSBkc:
|
---|
723 | asep->bkc = bgetc(pointer,pos);
|
---|
724 | break;
|
---|
725 | case sprmSFTitlePage:
|
---|
726 | asep->fTitlePage = bgetc(pointer,pos);
|
---|
727 | break;
|
---|
728 | case sprmSCcolumns:
|
---|
729 | asep->ccolM1 = bread_16ubit(pointer,pos);
|
---|
730 | break;
|
---|
731 | case sprmSDxaColumns:
|
---|
732 | asep->dxaColumns = (S16)bread_16ubit(pointer,pos);
|
---|
733 | break;
|
---|
734 | case sprmSFAutoPgn:
|
---|
735 | asep->fAutoPgn = bgetc(pointer,pos);
|
---|
736 | break;
|
---|
737 | case sprmSNfcPgn:
|
---|
738 | asep->nfcPgn = bgetc(pointer,pos);
|
---|
739 | break;
|
---|
740 | case sprmSDyaPgn:
|
---|
741 | asep->dyaPgn = (S16)bread_16ubit(pointer,pos);
|
---|
742 | break;
|
---|
743 | case sprmSDxaPgn:
|
---|
744 | asep->dxaPgn = (S16)bread_16ubit(pointer,pos);
|
---|
745 | break;
|
---|
746 | case sprmSFPgnRestart:
|
---|
747 | asep->fPgnRestart = bgetc(pointer,pos);
|
---|
748 | break;
|
---|
749 | case sprmSFEndnote:
|
---|
750 | asep->fEndNote = bgetc(pointer,pos);
|
---|
751 | break;
|
---|
752 | case sprmSLnc:
|
---|
753 | asep->lnc = bgetc(pointer,pos);
|
---|
754 | break;
|
---|
755 | case sprmSGprfIhdt:
|
---|
756 | asep->grpfIhdt = bgetc(pointer,pos);
|
---|
757 | break;
|
---|
758 | case sprmSNLnnMod:
|
---|
759 | asep->nLnnMod = bread_16ubit(pointer,pos);
|
---|
760 | break;
|
---|
761 | case sprmSDxaLnn:
|
---|
762 | asep->dxaLnn = (S16) bread_16ubit(pointer,pos);
|
---|
763 | break;
|
---|
764 | case sprmSDyaHdrTop:
|
---|
765 | asep->dyaHdrTop = bread_16ubit(pointer,pos);
|
---|
766 | break;
|
---|
767 | case sprmSDyaHdrBottom:
|
---|
768 | asep->dyaHdrBottom = bread_16ubit(pointer,pos);
|
---|
769 | break;
|
---|
770 | case sprmSLBetween:
|
---|
771 | asep->fLBetween = bgetc(pointer,pos);
|
---|
772 | break;
|
---|
773 | case sprmSVjc:
|
---|
774 | asep->fLBetween = bgetc(pointer,pos);
|
---|
775 | break;
|
---|
776 | case sprmSLnnMin:
|
---|
777 | asep->lnnMin = (S16) bread_16ubit(pointer,pos);
|
---|
778 | break;
|
---|
779 | case sprmSPgnStart:
|
---|
780 | asep->pgnStart = bread_16ubit(pointer,pos);
|
---|
781 | break;
|
---|
782 | case sprmSBOrientation:
|
---|
783 | asep->dmOrientPage = bgetc(pointer,pos);
|
---|
784 | break;
|
---|
785 | case sprmSBCustomize:
|
---|
786 | /*noone knows what this is*/
|
---|
787 | bgetc(pointer,pos);
|
---|
788 | break;
|
---|
789 | case sprmSXaPage:
|
---|
790 | asep->xaPage = bread_16ubit(pointer,pos);
|
---|
791 | break;
|
---|
792 | case sprmSYaPage:
|
---|
793 | asep->yaPage = bread_16ubit(pointer,pos);
|
---|
794 | break;
|
---|
795 | case sprmSDxaLeft:
|
---|
796 | asep->dxaLeft = bread_16ubit(pointer,pos);
|
---|
797 | break;
|
---|
798 | case sprmSDxaRight:
|
---|
799 | asep->dxaRight = bread_16ubit(pointer,pos);
|
---|
800 | break;
|
---|
801 | case sprmSDyaTop:
|
---|
802 | asep->dyaTop = (S16)bread_16ubit(pointer,pos);
|
---|
803 | break;
|
---|
804 | case sprmSDyaBottom:
|
---|
805 | asep->dyaBottom = (S16)bread_16ubit(pointer,pos);
|
---|
806 | break;
|
---|
807 | case sprmSDzaGutter:
|
---|
808 | asep->dzaGutter = bread_16ubit(pointer,pos);
|
---|
809 | break;
|
---|
810 | case sprmSDmPaperReq:
|
---|
811 | asep->dmPaperReq = bread_16ubit(pointer,pos);
|
---|
812 | break;
|
---|
813 | case sprmSPropRMark:
|
---|
814 | wvApplysprmSPropRMark(asep,pointer,pos);
|
---|
815 | break;
|
---|
816 | case sprmSFBiDi: /* ?????? , what the hell are these three*/
|
---|
817 | case sprmSFFacingCol:
|
---|
818 | case sprmSFRTLGutter:
|
---|
819 | bgetc(pointer,pos);
|
---|
820 | break;
|
---|
821 | case sprmSBrcTop:
|
---|
822 | (*pos)+=wvGetBRCFromBucket(ver,&asep->brcTop,pointer);
|
---|
823 | break;
|
---|
824 | case sprmSBrcLeft:
|
---|
825 | (*pos)+=wvGetBRCFromBucket(ver,&asep->brcLeft,pointer);
|
---|
826 | break;
|
---|
827 | case sprmSBrcBottom:
|
---|
828 | (*pos)+=wvGetBRCFromBucket(ver,&asep->brcBottom,pointer);
|
---|
829 | break;
|
---|
830 | case sprmSBrcRight:
|
---|
831 | (*pos)+=wvGetBRCFromBucket(ver,&asep->brcRight,pointer);
|
---|
832 | break;
|
---|
833 | case sprmSPgbProp:
|
---|
834 | asep->pgbProp = (S16)bread_16ubit(pointer,pos);
|
---|
835 | break;
|
---|
836 | case sprmSDxtCharSpace:
|
---|
837 | asep->dxtCharSpace = (S32)bread_32ubit(pointer,pos);
|
---|
838 | break;
|
---|
839 | case sprmSDyaLinePitch:
|
---|
840 | asep->dyaLinePitch = (S32)bread_32ubit(pointer,pos);
|
---|
841 | break;
|
---|
842 | case sprmSClm:
|
---|
843 | /* who knows */
|
---|
844 | bread_16ubit(pointer,pos);
|
---|
845 | break;
|
---|
846 | case sprmSTextFlow:
|
---|
847 | asep->wTextFlow = (S16)bread_16ubit(pointer,pos);
|
---|
848 | break;
|
---|
849 | /* End of SEP */
|
---|
850 |
|
---|
851 | /* Begin of TAP */
|
---|
852 | case sprmTJc:
|
---|
853 | apap->ptap.jc = (S16)bread_16ubit(pointer,pos);
|
---|
854 | break;
|
---|
855 | case sprmTFCantSplit:
|
---|
856 | apap->ptap.fCantSplit = bgetc(pointer,pos);
|
---|
857 | break;
|
---|
858 | case sprmTTableHeader:
|
---|
859 | apap->ptap.fTableHeader = bgetc(pointer,pos);
|
---|
860 | break;
|
---|
861 | case sprmTDyaRowHeight: /* check len */
|
---|
862 | asep->dyaLinePitch = (S16)bread_16ubit(pointer,pos);
|
---|
863 | break;
|
---|
864 | case sprmTDiagLine: /* ????? */
|
---|
865 | wvError(("huh, show me this document\n"));
|
---|
866 | break;
|
---|
867 | case sprmTHTMLProps: /* ???? */
|
---|
868 | apap->ptap.lwHTMLProps = (S32)bread_32ubit(pointer,pos);
|
---|
869 | break;
|
---|
870 | case sprmTDxaLeft:
|
---|
871 | wvApplysprmTDxaLeft(&apap->ptap,pointer,pos);
|
---|
872 | break;
|
---|
873 | case sprmTDxaGapHalf:
|
---|
874 | wvApplysprmTDxaGapHalf(&apap->ptap,pointer,pos);
|
---|
875 | break;
|
---|
876 | case sprmTTableBorders:
|
---|
877 | wvApplysprmTTableBorders(ver,&apap->ptap,pointer,pos);
|
---|
878 | break;
|
---|
879 | case sprmTDefTable10:
|
---|
880 | wvApplysprmTDefTable10(&apap->ptap,pointer,pos);
|
---|
881 | break;
|
---|
882 | case sprmTDefTable:
|
---|
883 | wvApplysprmTDefTable(&apap->ptap,pointer,pos);
|
---|
884 | break;
|
---|
885 | case sprmTDefTableShd:
|
---|
886 | /*
|
---|
887 | wvApplysprmTDefTableShd follows the written spec, but
|
---|
888 | it isnt't working out for me, maybe its my own fault,
|
---|
889 | anyhow Im trying wv2 out temporarily
|
---|
890 | */
|
---|
891 | wv2ApplysprmTDefTableShd(&apap->ptap,pointer,pos);
|
---|
892 | /*
|
---|
893 | wvApplysprmTDefTableShd(&apap->ptap,pointer,pos);
|
---|
894 | */
|
---|
895 | break;
|
---|
896 | case sprmTTlp:
|
---|
897 | wvGetTLPFromBucket(&(apap->ptap.tlp),pointer);
|
---|
898 | (*pos)+=cbTLP;
|
---|
899 | break;
|
---|
900 | case sprmTSetBrc:
|
---|
901 | wvApplysprmTSetBrc(ver,&apap->ptap,pointer,pos);
|
---|
902 | break;
|
---|
903 | case sprmTInsert:
|
---|
904 | wvApplysprmTInsert(&apap->ptap,pointer,pos);
|
---|
905 | break;
|
---|
906 | case sprmTDelete:
|
---|
907 | wvApplysprmTDelete(&apap->ptap,pointer,pos);
|
---|
908 | break;
|
---|
909 | case sprmTDxaCol:
|
---|
910 | wvApplysprmTDxaCol(&apap->ptap,pointer,pos);
|
---|
911 | break;
|
---|
912 | case sprmTMerge:
|
---|
913 | wvApplysprmTMerge(&apap->ptap,pointer,pos);
|
---|
914 | break;
|
---|
915 | case sprmTSplit:
|
---|
916 | wvApplysprmTSplit(&apap->ptap,pointer,pos);
|
---|
917 | break;
|
---|
918 | case sprmTSetBrc10:
|
---|
919 | wvApplysprmTSetBrc10(&apap->ptap,pointer,pos);
|
---|
920 | break;
|
---|
921 | case sprmTSetShd:
|
---|
922 | wvApplysprmTSetShd(&apap->ptap,pointer,pos);
|
---|
923 | break;
|
---|
924 | case sprmTSetShdOdd:
|
---|
925 | wvApplysprmTSetShdOdd(&apap->ptap,pointer,pos);
|
---|
926 | break;
|
---|
927 | case sprmTTextFlow:
|
---|
928 | wvError(("huh, show me this document\n"));
|
---|
929 | wvApplysprmTTextFlow(&apap->ptap,pointer,pos);
|
---|
930 | break;
|
---|
931 | case sprmTVertMerge:
|
---|
932 | wvApplysprmTVertMerge(&apap->ptap,pointer,pos);
|
---|
933 | break;
|
---|
934 | case sprmTFBiDi: /* ????? */
|
---|
935 | bread_16ubit(pointer,pos);
|
---|
936 | break;
|
---|
937 | case sprmTUNKNOWN1:
|
---|
938 | /* read wv.h and word 6 sprm 204
|
---|
939 | further down in this file to understand this
|
---|
940 | */
|
---|
941 | bgetc(pointer,pos);
|
---|
942 | bread_16ubit(pointer,pos);
|
---|
943 | break;
|
---|
944 | case sprmTVertAlign:
|
---|
945 | wvApplysprmTVertAlign(&apap->ptap,pointer,pos);
|
---|
946 | break;
|
---|
947 |
|
---|
948 | /* end of TAP */
|
---|
949 |
|
---|
950 | /*
|
---|
951 | case sprmPicBrcl
|
---|
952 | */
|
---|
953 |
|
---|
954 | case sprmCFDiacColor: /* ???? */
|
---|
955 | case sprmCFItalicBi: /* ???? */
|
---|
956 | case sprmCFtcBi: /* ???? */
|
---|
957 | case sprmCLidBi: /* ???? */
|
---|
958 | case sprmCIcoBi: /* ???? */
|
---|
959 | case sprmPRuler: /* ???? */
|
---|
960 | case sprmCIdCharType: /* obsolete*/
|
---|
961 | case sprmCKcd: /* ???? */
|
---|
962 | case sprmCCharScale: /* ???? */
|
---|
963 | case sprmNoop: /* no operand */
|
---|
964 | break;
|
---|
965 | default:
|
---|
966 | wvEatSprm(sprm,pointer,pos);
|
---|
967 | break;
|
---|
968 | }
|
---|
969 |
|
---|
970 | wvGetSprmFromU16(&RetSprm,sprm);
|
---|
971 | return(RetSprm);
|
---|
972 | }
|
---|
973 |
|
---|
974 | void wvApplysprmPIstdPermute(PAP *apap,U8 *pointer,U16 *pos)
|
---|
975 | {
|
---|
976 | U8 cch;
|
---|
977 | U8 fLongg;
|
---|
978 | U8 fSpare;
|
---|
979 | U16 istdFirst;
|
---|
980 | U16 istdLast;
|
---|
981 | U16 *rgistd;
|
---|
982 | U16 i;
|
---|
983 |
|
---|
984 | cch = dgetc(NULL,&pointer);
|
---|
985 | (*pos)++;
|
---|
986 | fLongg = dgetc(NULL,&pointer);
|
---|
987 | (*pos)++;
|
---|
988 | fSpare = dgetc(NULL,&pointer);
|
---|
989 | (*pos)++;
|
---|
990 | istdFirst = dread_16ubit(NULL,&pointer);
|
---|
991 | (*pos)+=2;
|
---|
992 | istdLast = dread_16ubit(NULL,&pointer);
|
---|
993 | (*pos)+=2;
|
---|
994 | if ((cch-6)/2 != 0)
|
---|
995 | {
|
---|
996 | rgistd = (U16 *)malloc(sizeof(U16) * ((cch-6)/2));
|
---|
997 | if (rgistd == NULL)
|
---|
998 | {
|
---|
999 | wvError(("Could not allocate %d\n",sizeof(U16) * ((cch-6)/2)));
|
---|
1000 | return;
|
---|
1001 | }
|
---|
1002 | for(i=0;i<(cch-6)/2;i++)
|
---|
1003 | {
|
---|
1004 | rgistd[i] = dread_16ubit(NULL,&pointer);
|
---|
1005 | (*pos)+=2;
|
---|
1006 | }
|
---|
1007 | }
|
---|
1008 | else
|
---|
1009 | rgistd = NULL;
|
---|
1010 | /*
|
---|
1011 | First check if pap.istd is greater than the istdFirst recorded in the sprm
|
---|
1012 | and less than or equal to the istdLast recorded in the sprm If not, the sprm
|
---|
1013 | has no effect. If it is, pap.istd is set to rgistd[pap.istd - istdFirst]
|
---|
1014 | */
|
---|
1015 |
|
---|
1016 | if ((apap->istd > istdFirst) && (apap->istd<=istdLast))
|
---|
1017 | {
|
---|
1018 | wvTrace(("%d %d %d\n",apap->istd,istdFirst,istdLast));
|
---|
1019 | apap->istd = rgistd[apap->istd - istdFirst];
|
---|
1020 | }
|
---|
1021 | wvFree(rgistd);
|
---|
1022 | }
|
---|
1023 |
|
---|
1024 | void wvApplysprmPIncLvl(PAP *apap,U8 *pointer,U16 *pos)
|
---|
1025 | {
|
---|
1026 | U8 temp8;
|
---|
1027 | S8 tempS8;
|
---|
1028 | temp8 = bgetc(pointer,pos);
|
---|
1029 | /*
|
---|
1030 | If pap.stc is < 1 or > 9, sprmPIncLvl has no effect. Otherwise, if the value
|
---|
1031 | stored in the byte has its highest order bit off, the value is a positive
|
---|
1032 | difference which should be added to pap.istd and pap.lvl and then pap.stc
|
---|
1033 | should be set to min(pap.istd, 9). If the byte value has its highest order
|
---|
1034 | bit on, the value is a negative difference which should be sign extended to
|
---|
1035 | a word and then subtracted from pap.istd and pap.lvl. Then pap.stc should be
|
---|
1036 | set to max(1, pap.istd).
|
---|
1037 |
|
---|
1038 | Now... hang on a sec coz
|
---|
1039 |
|
---|
1040 | Note that the storage and behavior of styles has changed radically since
|
---|
1041 | Word 2 for Windows, beginning with nFib 63. Some of the differences are:
|
---|
1042 | <chomp>
|
---|
1043 | * The style code is called an istd, rather than an stc.
|
---|
1044 |
|
---|
1045 | So, for the purposes of this filter, we ignore the stc component of the
|
---|
1046 | instructions
|
---|
1047 |
|
---|
1048 | */
|
---|
1049 |
|
---|
1050 | if ((apap->istd < 1) || (apap->istd > 9))
|
---|
1051 | return;
|
---|
1052 |
|
---|
1053 | if ((temp8 & 0x80) >> 7 == 0)
|
---|
1054 | {
|
---|
1055 | apap->istd += temp8;
|
---|
1056 | apap->lvl += temp8;
|
---|
1057 | /*
|
---|
1058 | apap->stc = min(apap->istd, 9);
|
---|
1059 | */
|
---|
1060 | }
|
---|
1061 | else
|
---|
1062 | {
|
---|
1063 | tempS8 = (S8)temp8;
|
---|
1064 | apap->istd += tempS8;
|
---|
1065 | apap->lvl += tempS8;
|
---|
1066 | /*
|
---|
1067 | apap->stc = max(1, apap->istd);
|
---|
1068 | */
|
---|
1069 | }
|
---|
1070 | }
|
---|
1071 |
|
---|
1072 | void wvApplysprmPChgTabsPapx(PAP *apap,U8 *pointer,U16 *pos)
|
---|
1073 | {
|
---|
1074 | S16 temp_rgdxaTab[itbdMax];
|
---|
1075 | TBD temp_rgtbd[itbdMax];
|
---|
1076 | int i,j,k=0,oldpos;
|
---|
1077 | U8 cch,itbdDelMax;
|
---|
1078 | S16 *rgdxaDel;
|
---|
1079 | U8 itbdAddMax;
|
---|
1080 | S16 *rgdxaAdd;
|
---|
1081 | int add=0;
|
---|
1082 | TBD *rgtbdAdd;
|
---|
1083 |
|
---|
1084 | oldpos = *pos;
|
---|
1085 | cch = dgetc(NULL,&pointer);
|
---|
1086 | (*pos)++;
|
---|
1087 | itbdDelMax = dgetc(NULL,&pointer);
|
---|
1088 | (*pos)++;
|
---|
1089 | if (itbdDelMax != 0)
|
---|
1090 | {
|
---|
1091 | rgdxaDel = (S16 *)malloc(sizeof(U16) * itbdDelMax);
|
---|
1092 | for(i=0;i<itbdDelMax;i++)
|
---|
1093 | {
|
---|
1094 | rgdxaDel[i] = (S16)dread_16ubit(NULL,&pointer);
|
---|
1095 | (*pos)+=2;
|
---|
1096 | }
|
---|
1097 | }
|
---|
1098 | else
|
---|
1099 | rgdxaDel = NULL;
|
---|
1100 | itbdAddMax = dgetc(NULL,&pointer);
|
---|
1101 | wvTrace(("itbdAddMax is %d\n",itbdAddMax));
|
---|
1102 | (*pos)++;
|
---|
1103 | if (itbdAddMax != 0)
|
---|
1104 | {
|
---|
1105 | rgdxaAdd = (S16 *)malloc(sizeof(U16) * itbdAddMax);
|
---|
1106 | for(i=0;i<itbdAddMax;i++)
|
---|
1107 | {
|
---|
1108 | rgdxaAdd[i] = (S16)dread_16ubit(NULL,&pointer);
|
---|
1109 | wvTrace(("stops are %d\n",rgdxaAdd[i]));
|
---|
1110 | (*pos)+=2;
|
---|
1111 | }
|
---|
1112 | rgtbdAdd = (TBD *)malloc(itbdAddMax*sizeof(TBD));
|
---|
1113 | for(i=0;i<itbdAddMax;i++)
|
---|
1114 | {
|
---|
1115 | wvGetTBDFromBucket(&rgtbdAdd[i],pointer);
|
---|
1116 | (*pos)++;
|
---|
1117 | }
|
---|
1118 | }
|
---|
1119 | else
|
---|
1120 | {
|
---|
1121 | rgdxaAdd=NULL;
|
---|
1122 | rgtbdAdd=NULL;
|
---|
1123 | }
|
---|
1124 |
|
---|
1125 | #ifdef DEBUG
|
---|
1126 | if (*pos-oldpos != cch+1)
|
---|
1127 | wvTrace(("Offset Problem in wvApplysprmPChgTabsPapx\n"));
|
---|
1128 | #endif
|
---|
1129 |
|
---|
1130 | /*
|
---|
1131 | When sprmPChgTabsPapx is interpreted, the rgdxaDel of the sprm is applied
|
---|
1132 | first to the pap that is being transformed. This is done by deleting from
|
---|
1133 | the pap the rgdxaTab entry and rgtbd entry of any tab whose rgdxaTab value
|
---|
1134 | is equal to one of the rgdxaDel values in the sprm. It is guaranteed that
|
---|
1135 | the entries in pap.rgdxaTab and the sprm's rgdxaDel and rgdxaAdd are
|
---|
1136 | recorded in ascending dxa order.
|
---|
1137 |
|
---|
1138 | Then the rgdxaAdd and rgtbdAdd entries are merged into the pap's rgdxaTab
|
---|
1139 | and rgtbd arrays so that the resulting pap rgdxaTab is sorted in ascending
|
---|
1140 | order with no duplicates.
|
---|
1141 | */
|
---|
1142 | for(j=0;j<apap->itbdMac;j++)
|
---|
1143 | {
|
---|
1144 | add=1;
|
---|
1145 | for(i=0;i<itbdDelMax;i++)
|
---|
1146 | {
|
---|
1147 | if (rgdxaDel[i] == apap->rgdxaTab[j])
|
---|
1148 | {
|
---|
1149 | add=0;
|
---|
1150 | break;
|
---|
1151 | }
|
---|
1152 | }
|
---|
1153 | if (add)
|
---|
1154 | {
|
---|
1155 | temp_rgdxaTab[k] = apap->rgdxaTab[j];
|
---|
1156 | wvCopyTBD(&temp_rgtbd[k++],&apap->rgtbd[j]);
|
---|
1157 | }
|
---|
1158 | }
|
---|
1159 | /*temp_rgdxaTab now contains all the tab stops to be retained after the delete*/
|
---|
1160 | apap->itbdMac = k;
|
---|
1161 | k=0;
|
---|
1162 | j=0;
|
---|
1163 | i=0;
|
---|
1164 | while ((j<apap->itbdMac) || (i < itbdAddMax))
|
---|
1165 | {
|
---|
1166 | wvTrace(("i %d j apap->itbdMac %d %d\n",i,j,apap->itbdMac));
|
---|
1167 | wvTrace(("temp_rgdxaTab[j] %d\n",temp_rgdxaTab[j]));
|
---|
1168 | wvTrace(("rgdxaAdd[i] %d\n",rgdxaAdd[i]));
|
---|
1169 | if ( (j<apap->itbdMac) && (i >= itbdAddMax || temp_rgdxaTab[j] < rgdxaAdd[i]) )
|
---|
1170 | {
|
---|
1171 | /* if we have one from the retained group that should be added */
|
---|
1172 | apap->rgdxaTab[k] = temp_rgdxaTab[j];
|
---|
1173 | wvCopyTBD(&apap->rgtbd[k++],&temp_rgtbd[j++]);
|
---|
1174 | }
|
---|
1175 | else if ((j<apap->itbdMac) && (temp_rgdxaTab[j] == rgdxaAdd[i]))
|
---|
1176 | {
|
---|
1177 | /* if we have one from the retained group that should be added
|
---|
1178 | which is the same as one from the new group */
|
---|
1179 | apap->rgdxaTab[k] = rgdxaAdd[i];
|
---|
1180 | wvCopyTBD(&apap->rgtbd[k++],&rgtbdAdd[i++]);
|
---|
1181 | j++;
|
---|
1182 | }
|
---|
1183 | else /*if (i < itbdAddMax)*/
|
---|
1184 | {
|
---|
1185 | /* if we have one from the new group to be added */
|
---|
1186 | apap->rgdxaTab[k] = rgdxaAdd[i];
|
---|
1187 | wvCopyTBD(&apap->rgtbd[k++],&rgtbdAdd[i++]);
|
---|
1188 | }
|
---|
1189 | }
|
---|
1190 | wvTrace(("k is %d\n",k));
|
---|
1191 |
|
---|
1192 | apap->itbdMac = k;
|
---|
1193 |
|
---|
1194 | for (i = 0; i < apap->itbdMac; i++) {
|
---|
1195 | wvTrace(("tab %d rgdxa %d %x\n", i, apap->rgdxaTab[i],apap->rgdxaTab[i]));
|
---|
1196 | }
|
---|
1197 |
|
---|
1198 | wvFree(rgtbdAdd);
|
---|
1199 | wvFree(rgdxaAdd);
|
---|
1200 | wvFree(rgdxaDel);
|
---|
1201 | }
|
---|
1202 |
|
---|
1203 | int wvApplysprmPChgTabs(PAP *apap,U8 *pointer,U16 *pos)
|
---|
1204 | {
|
---|
1205 | S16 temp_rgdxaTab[itbdMax];
|
---|
1206 | TBD temp_rgtbd[itbdMax];
|
---|
1207 | U8 cch;
|
---|
1208 | U8 itbdDelMax;
|
---|
1209 | S16 *rgdxaDel;
|
---|
1210 | S16 *rgdxaClose;
|
---|
1211 | U8 itbdAddMax;
|
---|
1212 | S16 *rgdxaAdd;
|
---|
1213 | TBD *rgtbdAdd;
|
---|
1214 | int add=0;
|
---|
1215 | U8 i,j,k=0;
|
---|
1216 |
|
---|
1217 | wvTrace(("entering wvApplysprmPChgTabs\n"));
|
---|
1218 | /*
|
---|
1219 | itbdDelMax and itbdAddMax are defined to be equal to 50. This means that the
|
---|
1220 | largest possible instance of sprmPChgTabs is 354. When the length of the
|
---|
1221 | sprm is greater than or equal to 255, the cch field will be set equal to
|
---|
1222 | 255. When cch == 255, the actual length of the sprm can be calculated as
|
---|
1223 | follows: length = 2 + itbdDelMax * 4 + itbdAddMax * 3.
|
---|
1224 | */
|
---|
1225 |
|
---|
1226 | cch = dgetc(NULL,&pointer);
|
---|
1227 | wvTrace(("cch is %d\n",cch));
|
---|
1228 | (*pos)++;
|
---|
1229 | itbdDelMax = dgetc(NULL,&pointer);
|
---|
1230 | (*pos)++;
|
---|
1231 |
|
---|
1232 | wvTrace(("itbdDelMax is %d\n",itbdDelMax));
|
---|
1233 | if (itbdDelMax != 0)
|
---|
1234 | {
|
---|
1235 | rgdxaDel = (S16*)malloc(sizeof(S16) * itbdDelMax);
|
---|
1236 | rgdxaClose = (S16*)malloc(sizeof(S16) * itbdDelMax);
|
---|
1237 | for (i=0;i<itbdDelMax;i++)
|
---|
1238 | {
|
---|
1239 | rgdxaDel[i] = (S16)dread_16ubit(NULL,&pointer);
|
---|
1240 | (*pos)+=2;
|
---|
1241 | }
|
---|
1242 | for (i=0;i<itbdDelMax;i++)
|
---|
1243 | {
|
---|
1244 | rgdxaClose[i] = dread_16ubit(NULL,&pointer);
|
---|
1245 | (*pos)+=2;
|
---|
1246 | }
|
---|
1247 | }
|
---|
1248 | else
|
---|
1249 | {
|
---|
1250 | rgdxaDel = NULL;
|
---|
1251 | rgdxaClose = NULL;
|
---|
1252 | }
|
---|
1253 | itbdAddMax = dgetc(NULL,&pointer);
|
---|
1254 | wvTrace(("itbdAddMax is %d\n",itbdAddMax));
|
---|
1255 | (*pos)++;
|
---|
1256 | if (itbdAddMax != 0)
|
---|
1257 | {
|
---|
1258 | rgdxaAdd = (S16*)malloc(sizeof(S16) * itbdAddMax);
|
---|
1259 | rgtbdAdd = (TBD*)malloc(itbdAddMax*sizeof(TBD));
|
---|
1260 | for (i=0;i<itbdAddMax;i++)
|
---|
1261 | {
|
---|
1262 | rgdxaAdd[i] = (S16)dread_16ubit(NULL,&pointer);
|
---|
1263 | wvTrace(("rgdxaAdd %d is %x\n",i,rgdxaAdd[i]));
|
---|
1264 | (*pos)+=2;
|
---|
1265 | }
|
---|
1266 | for (i=0;i<itbdAddMax;i++)
|
---|
1267 | {
|
---|
1268 | wvGetTBDFromBucket(&rgtbdAdd[i],pointer);
|
---|
1269 | (*pos)++;
|
---|
1270 | }
|
---|
1271 | }
|
---|
1272 | else
|
---|
1273 | {
|
---|
1274 | rgdxaAdd = NULL;
|
---|
1275 | rgtbdAdd = NULL;
|
---|
1276 | }
|
---|
1277 |
|
---|
1278 | if (cch == 225)
|
---|
1279 | cch = 2 + itbdDelMax * 4 + itbdAddMax * 3;
|
---|
1280 |
|
---|
1281 | /*
|
---|
1282 | When sprmPChgTabs is interpreted, the rgdxaDel of the sprm is applied first
|
---|
1283 | to the pap that is being transformed. This is done by deleting from the pap
|
---|
1284 | the rgdxaTab entry and rgtbd entry of any tab whose rgdxaTab value is within
|
---|
1285 | the interval [rgdxaDel[i] - rgdxaClose[i], rgdxaDel[i] + rgdxaClose[i]] It
|
---|
1286 | is guaranteed that the entries in pap.rgdxaTab and the sprm's rgdxaDel and
|
---|
1287 | rgdxaAdd are recorded in ascending dxa order.
|
---|
1288 |
|
---|
1289 | Then the rgdxaAdd and rgtbdAdd entries are merged into the pap's rgdxaTab
|
---|
1290 | and rgtbd arrays so that the resulting pap rgdxaTab is sorted in ascending
|
---|
1291 | order with no duplicates.
|
---|
1292 | */
|
---|
1293 | if (apap == NULL)
|
---|
1294 | {
|
---|
1295 | wvFree(rgdxaDel);
|
---|
1296 | wvFree(rgtbdAdd);
|
---|
1297 | wvFree(rgdxaAdd);
|
---|
1298 | wvFree(rgdxaClose);
|
---|
1299 | return(cch);
|
---|
1300 | }
|
---|
1301 |
|
---|
1302 | wvTrace(("here %d\n",apap->itbdMac));
|
---|
1303 | for(j=0;j<apap->itbdMac;j++)
|
---|
1304 | {
|
---|
1305 | add=1;
|
---|
1306 | for(i=0;i<itbdDelMax;i++)
|
---|
1307 | {
|
---|
1308 | wvTrace(("examing %x against %x\n",apap->rgdxaTab[j],rgdxaDel[i]));
|
---|
1309 | if ( (apap->rgdxaTab[j] >= rgdxaDel[i] - rgdxaClose[i])
|
---|
1310 | && (apap->rgdxaTab[j] <= rgdxaDel[i] + rgdxaClose[i]) )
|
---|
1311 | {
|
---|
1312 | wvTrace(("deleting\n"));
|
---|
1313 | add=0;
|
---|
1314 | break;
|
---|
1315 | }
|
---|
1316 | }
|
---|
1317 | if (add)
|
---|
1318 | {
|
---|
1319 | temp_rgdxaTab[k] = apap->rgdxaTab[j];
|
---|
1320 | wvCopyTBD(&temp_rgtbd[k++],&apap->rgtbd[j]);
|
---|
1321 | }
|
---|
1322 | }
|
---|
1323 | apap->itbdMac = k;
|
---|
1324 | wvTrace(("here %d\n",apap->itbdMac));
|
---|
1325 |
|
---|
1326 | k=0;
|
---|
1327 | j=0;
|
---|
1328 | i=0;
|
---|
1329 | while ((j<apap->itbdMac) || (i < itbdAddMax))
|
---|
1330 | {
|
---|
1331 | if ( (j<apap->itbdMac) && (i >= itbdAddMax || temp_rgdxaTab[j] < rgdxaAdd[i]) )
|
---|
1332 | {
|
---|
1333 | wvTrace(("adding from nondeleted tab stops\n"));
|
---|
1334 | apap->rgdxaTab[k] = temp_rgdxaTab[j];
|
---|
1335 | wvCopyTBD(&apap->rgtbd[k++],&temp_rgtbd[j++]);
|
---|
1336 | }
|
---|
1337 | else if ((j<apap->itbdMac) && (temp_rgdxaTab[j] == rgdxaAdd[i]))
|
---|
1338 | {
|
---|
1339 | wvTrace(("adding from new tab stops\n"));
|
---|
1340 | apap->rgdxaTab[k] = rgdxaAdd[i];
|
---|
1341 | wvCopyTBD(&apap->rgtbd[k++],&rgtbdAdd[i++]);
|
---|
1342 | j++;
|
---|
1343 | }
|
---|
1344 | else /*if (i < itbdAddMax)*/
|
---|
1345 | {
|
---|
1346 | wvTrace(("adding from new tab stops\n"));
|
---|
1347 | apap->rgdxaTab[k] = rgdxaAdd[i];
|
---|
1348 | wvCopyTBD(&apap->rgtbd[k++],&rgtbdAdd[i++]);
|
---|
1349 | }
|
---|
1350 | }
|
---|
1351 |
|
---|
1352 | apap->itbdMac = k;
|
---|
1353 | wvTrace(("here %d\n",apap->itbdMac));
|
---|
1354 |
|
---|
1355 | for (i = 0; i < apap->itbdMac; i++) {
|
---|
1356 | wvTrace(("tab %d rgdxa %d %x\n", i, apap->rgdxaTab[i],apap->rgdxaTab[i]));
|
---|
1357 | }
|
---|
1358 |
|
---|
1359 | wvFree(rgdxaDel);
|
---|
1360 | wvFree(rgtbdAdd);
|
---|
1361 | wvFree(rgdxaAdd);
|
---|
1362 | wvFree(rgdxaClose);
|
---|
1363 | wvTrace(("Exiting Successfully\n"));
|
---|
1364 |
|
---|
1365 | return(cch);
|
---|
1366 | }
|
---|
1367 |
|
---|
1368 | void wvApplysprmPPc(PAP *apap,U8 *pointer,U16 *pos)
|
---|
1369 | {
|
---|
1370 | U8 temp8;
|
---|
1371 | struct _temp
|
---|
1372 | {
|
---|
1373 | U32 reserved:4;
|
---|
1374 | U32 pcVert:2;
|
---|
1375 | U32 pcHorz:2;
|
---|
1376 | } temp;
|
---|
1377 |
|
---|
1378 |
|
---|
1379 | temp8 = bgetc(pointer,pos);
|
---|
1380 | #ifdef PURIFY
|
---|
1381 | temp.pcVert = 0;
|
---|
1382 | temp.pcHorz = 0;
|
---|
1383 | #endif
|
---|
1384 | temp.pcVert = (temp8 & 0x0C) >> 4;
|
---|
1385 | temp.pcHorz = (temp8 & 0x03) >> 6;
|
---|
1386 |
|
---|
1387 | /*
|
---|
1388 | sprmPPc is interpreted by moving pcVert to pap.pcVert if pcVert != 3 and by
|
---|
1389 | moving pcHorz to pap.pcHorz if pcHorz != 3.
|
---|
1390 | */
|
---|
1391 |
|
---|
1392 | if (temp.pcVert != 3)
|
---|
1393 | apap->pcVert = temp.pcVert;
|
---|
1394 | if (temp.pcHorz != 3)
|
---|
1395 | apap->pcHorz = temp.pcHorz;
|
---|
1396 | }
|
---|
1397 |
|
---|
1398 | void wvApplysprmPFrameTextFlow(PAP *apap,U8 *pointer,U16 *pos)
|
---|
1399 | {
|
---|
1400 | U16 temp16 = bread_16ubit(pointer,pos);
|
---|
1401 |
|
---|
1402 | apap->fVertical = temp16 & 0x0001;
|
---|
1403 | apap->fBackward = (temp16 & 0x0002) >> 1;
|
---|
1404 | apap->fRotateFont = (temp16 & 0x0004) >> 2;
|
---|
1405 | }
|
---|
1406 |
|
---|
1407 | void wvApplysprmPAnld(version ver,PAP *apap,U8 *pointer, U16 *pos)
|
---|
1408 | {
|
---|
1409 | dgetc(NULL,&pointer);
|
---|
1410 | (*pos)++;
|
---|
1411 | wvGetANLD_FromBucket(ver,&apap->anld,pointer);
|
---|
1412 | if (ver == WORD8)
|
---|
1413 | (*pos)+=cbANLD;
|
---|
1414 | else
|
---|
1415 | (*pos)+=cb6ANLD;
|
---|
1416 | }
|
---|
1417 |
|
---|
1418 | void wvApplysprmPPropRMark(PAP *apap,U8 *pointer,U16 *pos)
|
---|
1419 | {
|
---|
1420 | dgetc(NULL,&pointer);
|
---|
1421 | /*
|
---|
1422 | sprmPPropRMark is interpreted by moving the first parameter
|
---|
1423 | byte to pap.fPropRMark, the next two bytes to pap.ibstPropRMark, and the
|
---|
1424 | remaining four bytes to pap.dttmPropRMark.
|
---|
1425 | */
|
---|
1426 | apap->fPropRMark = dgetc(NULL,&pointer);
|
---|
1427 | (*pos)++;
|
---|
1428 | apap->ibstPropRMark = dread_16ubit(NULL,&pointer);
|
---|
1429 | (*pos)+=2;
|
---|
1430 | wvGetDTTMFromBucket(&apap->dttmPropRMark,pointer);
|
---|
1431 | (*pos)+=4;
|
---|
1432 | }
|
---|
1433 |
|
---|
1434 | void wvApplysprmPNumRM(PAP *apap,U8 *pointer, U16 *pos)
|
---|
1435 | {
|
---|
1436 | dgetc(NULL,&pointer);
|
---|
1437 | (*pos)++;
|
---|
1438 | wvGetNUMRMFromBucket(&apap->numrm,pointer);
|
---|
1439 | (*pos)+=cbNUMRM;
|
---|
1440 | }
|
---|
1441 |
|
---|
1442 | void wvApplysprmPHugePapx(PAP *apap, U8 *pointer, U16 *pos,FILE *data, STSH *stsh)
|
---|
1443 | {
|
---|
1444 | U32 offset;
|
---|
1445 | U16 len,i,sprm;
|
---|
1446 | U8 *grpprl,*pointer2;
|
---|
1447 | /*
|
---|
1448 | sprmPHugePapx is stored in PAPX FKPs in place of the grpprl of a PAPX which
|
---|
1449 | would otherwise be too big to fit in an FKP (as of this writing, 488 bytes
|
---|
1450 | is the size of the largest PAPX which can fit in an FKP). The parameter fc
|
---|
1451 | gives the location of the grpprl in the data stream. The first word at that
|
---|
1452 | fc counts the number of bytes in the grpprl (not including the byte count
|
---|
1453 | itself). A sprmPHugePapx should therefore only be found in a PAPX FKP and
|
---|
1454 | should be the only sprm in that PAPX's grpprl.
|
---|
1455 | */
|
---|
1456 | offset = dread_32ubit(NULL,&pointer);
|
---|
1457 | (*pos)+=4;
|
---|
1458 | wvTrace(("Offset is %x in data stream\n",offset));
|
---|
1459 | if (!(data))
|
---|
1460 | {
|
---|
1461 | wvError(("No data stream!!\n"));
|
---|
1462 | return;
|
---|
1463 | }
|
---|
1464 | if (0 != fseek(data, offset, SEEK_SET))
|
---|
1465 | {
|
---|
1466 | wvError(("Couldn't seek data stream!!\n"));
|
---|
1467 | return;
|
---|
1468 | }
|
---|
1469 | len = read_16ubit(data);
|
---|
1470 | if (!len)
|
---|
1471 | {
|
---|
1472 | wvWarning("sprmPHugePapx len is 0, seems unlikely\n");
|
---|
1473 | return;
|
---|
1474 | }
|
---|
1475 |
|
---|
1476 | grpprl = (U8*)malloc(len);
|
---|
1477 |
|
---|
1478 | for (i=0;i<len;i++)
|
---|
1479 | grpprl[i] = getc(data);
|
---|
1480 |
|
---|
1481 | i=0;
|
---|
1482 | while (i < len-2)
|
---|
1483 | {
|
---|
1484 | sprm = bread_16ubit(grpprl+i,&i);
|
---|
1485 | #ifdef SPRMTEST
|
---|
1486 | wvError(("sprm is %x\n",sprm));
|
---|
1487 | #endif
|
---|
1488 | pointer2 = grpprl+i;
|
---|
1489 | if (i < len)
|
---|
1490 | wvApplySprmFromBucket(WORD8,sprm,apap,NULL,NULL,stsh,pointer2,&i,data);
|
---|
1491 | }
|
---|
1492 | wvFree(grpprl);
|
---|
1493 | }
|
---|
1494 |
|
---|
1495 | void wvApplysprmCChs(CHP *achp,U8 *pointer,U16 *pos)
|
---|
1496 | {
|
---|
1497 | /*
|
---|
1498 | When this sprm is interpreted, the first byte of the operand is moved to
|
---|
1499 | chp.fChsDiff and the remaining word is moved to chp.chse.
|
---|
1500 | */
|
---|
1501 | achp->fChsDiff = dgetc(NULL,&pointer);
|
---|
1502 | (*pos)++;
|
---|
1503 | /*achp->chse ???? */
|
---|
1504 | /* the doc says to set this, but it doesnt exist anywhere else in the docs */
|
---|
1505 | dread_16ubit(NULL,&pointer);
|
---|
1506 | (*pos)+=2;
|
---|
1507 | }
|
---|
1508 |
|
---|
1509 | void wvApplysprmCSymbol(version ver,CHP *achp,U8 *pointer,U16 *pos)
|
---|
1510 | {
|
---|
1511 | if (ver == WORD8)
|
---|
1512 | {
|
---|
1513 | /*
|
---|
1514 | Word 8
|
---|
1515 | This sprm's operand is 4 bytes. The first 2 hold the font code; the last 2
|
---|
1516 | hold a character specifier. When this sprm is interpreted, the font code is
|
---|
1517 | moved to chp.ftcSym and the character specifier is moved to chp.xchSym and
|
---|
1518 | chp.fSpec is set to 1.
|
---|
1519 | */
|
---|
1520 | achp->ftcSym = dread_16ubit(NULL,&pointer);
|
---|
1521 | (*pos)+=2;
|
---|
1522 | achp->xchSym = dread_16ubit(NULL,&pointer);
|
---|
1523 | (*pos)+=2;
|
---|
1524 | wvTrace(("%d %d\n",achp->ftcSym,achp->xchSym));
|
---|
1525 | }
|
---|
1526 | else
|
---|
1527 | {
|
---|
1528 | /*
|
---|
1529 | Word 6 and 7
|
---|
1530 | The length byte recorded at offset 1 in this
|
---|
1531 | sprm will always be 3. When this sprm is interpreted the two byte
|
---|
1532 | font code recorded at offset 2 is moved to chp.ftcSym, the single
|
---|
1533 | byte character specifier recorded at offset 4 is moved to chp.chSym
|
---|
1534 | and chp.fSpec is set to 1.
|
---|
1535 | */
|
---|
1536 | dgetc(NULL,&pointer);
|
---|
1537 | (*pos)++;
|
---|
1538 | achp->ftcSym = dread_16ubit(NULL,&pointer);
|
---|
1539 | (*pos)+=2;
|
---|
1540 | achp->xchSym = dgetc(NULL,&pointer);
|
---|
1541 | achp->xchSym += 61440; /* promote this char into a unicode char to
|
---|
1542 | be consistent with what word 8 does */
|
---|
1543 | (*pos)++;
|
---|
1544 | }
|
---|
1545 | achp->fSpec=1;
|
---|
1546 | }
|
---|
1547 |
|
---|
1548 | void wvApplysprmCIstdPermute(CHP *achp,U8 *pointer,U16 *pos)
|
---|
1549 | {
|
---|
1550 | U8 cch;
|
---|
1551 | U8 fLongg;
|
---|
1552 | U8 fSpare;
|
---|
1553 | U16 istdFirst;
|
---|
1554 | U16 istdLast;
|
---|
1555 | U16 *rgistd;
|
---|
1556 | U16 i;
|
---|
1557 |
|
---|
1558 | cch = dgetc(NULL,&pointer);
|
---|
1559 | (*pos)++;
|
---|
1560 | fLongg = dgetc(NULL,&pointer);
|
---|
1561 | (*pos)++;
|
---|
1562 | fSpare = dgetc(NULL,&pointer);
|
---|
1563 | (*pos)++;
|
---|
1564 | istdFirst = dread_16ubit(NULL,&pointer);
|
---|
1565 | (*pos)+=2;
|
---|
1566 | istdLast = dread_16ubit(NULL,&pointer);
|
---|
1567 | (*pos)+=2;
|
---|
1568 | if ((cch-6)/2 != 0)
|
---|
1569 | {
|
---|
1570 | rgistd = (U16 *)malloc(sizeof(U16) * ((cch-6)/2));
|
---|
1571 | for(i=0;i<(cch-6)/2;i++)
|
---|
1572 | {
|
---|
1573 | rgistd[i] = dread_16ubit(NULL,&pointer);
|
---|
1574 | (*pos)+=2;
|
---|
1575 | }
|
---|
1576 | }
|
---|
1577 | else
|
---|
1578 | rgistd = NULL;
|
---|
1579 | /*
|
---|
1580 | first check if chp.istd is greater than the
|
---|
1581 | istdFirst recorded in the sprm and less than or equal to the istdLast
|
---|
1582 | recorded in the sprm If not, the sprm has no effect. If it is, chp.istd is
|
---|
1583 | set to rgstd[chp.istd - istdFirst] and any chpx stored in that rgstd entry
|
---|
1584 | is applied to the chp.
|
---|
1585 |
|
---|
1586 | Note that it is possible that an istd may be recorded in the rgistd that
|
---|
1587 | refers to a paragraph style. This will no harmful consequences since the
|
---|
1588 | istd for a paragraph style should never be recorded in chp.istd.
|
---|
1589 | */
|
---|
1590 |
|
---|
1591 | if ((achp->istd > istdFirst) && (achp->istd<=istdLast))
|
---|
1592 | {
|
---|
1593 | achp->istd = rgistd[achp->istd - istdFirst];
|
---|
1594 | /*
|
---|
1595 | if really a chp style
|
---|
1596 | wvAddCHPXFromUPEBucket(achp,&(stsh->std[achp->istd].grupe[0].chpx),stsh);
|
---|
1597 | else
|
---|
1598 | complain;
|
---|
1599 | */
|
---|
1600 | }
|
---|
1601 | wvFree(rgistd);
|
---|
1602 | }
|
---|
1603 |
|
---|
1604 | void wvApplysprmCDefault(CHP *achp,U8 *pointer,U16 *pos)
|
---|
1605 | {
|
---|
1606 | /*
|
---|
1607 | sprmCDefault (opcode 0x2A32) clears the fBold, fItalic, fOutline, fStrike,
|
---|
1608 | fShadow, fSmallCaps, fCaps, fVanish, kul and ico fields of the chp to 0. It
|
---|
1609 | was first defined for Word 3.01 and had to be backward compatible with Word
|
---|
1610 | 3.00 so it is a variable length sprm whose count of bytes is 0. It consists
|
---|
1611 | of the sprmCDefault opcode followed by a byte of 0.
|
---|
1612 | */
|
---|
1613 | dgetc(NULL,&pointer);
|
---|
1614 | (*pos)++;
|
---|
1615 | achp->fBold = 0;
|
---|
1616 | achp->fItalic = 0;
|
---|
1617 | achp->fOutline = 0;
|
---|
1618 | achp->fStrike = 0;
|
---|
1619 | achp->fShadow = 0;
|
---|
1620 | achp->fSmallCaps = 0;
|
---|
1621 | achp->fCaps = 0;
|
---|
1622 | achp->fVanish = 0;
|
---|
1623 | achp->kul = 0;
|
---|
1624 | achp->ico = 0;
|
---|
1625 | }
|
---|
1626 |
|
---|
1627 | void wvApplysprmCPlain(CHP *achp,STSH *stsh)
|
---|
1628 | {
|
---|
1629 | U8 fSpec;
|
---|
1630 | /*
|
---|
1631 | the style sheet CHP is copied over the original CHP preserving the
|
---|
1632 | fSpec setting from the original CHP.
|
---|
1633 | */
|
---|
1634 | fSpec = achp->fSpec;
|
---|
1635 | wvInitCHPFromIstd(achp,achp->istd,stsh);
|
---|
1636 | achp->fSpec = fSpec;
|
---|
1637 | }
|
---|
1638 |
|
---|
1639 |
|
---|
1640 | U8 wvToggle(U8 in,U8 toggle)
|
---|
1641 | {
|
---|
1642 | /*
|
---|
1643 | When the parameter of the sprm is set to 0 or 1, then
|
---|
1644 | the CHP property is set to the parameter value.
|
---|
1645 | */
|
---|
1646 | if ((toggle == 0) || (toggle == 1))
|
---|
1647 | return(toggle);
|
---|
1648 | /*
|
---|
1649 | When the parameter of the sprm is 128, then the CHP property is set to the
|
---|
1650 | value that is stored for the property in the style sheet. CHP When the
|
---|
1651 | parameter of the sprm is 129, the CHP property is set to the negation of the
|
---|
1652 | value that is stored for the property in the style sheet CHP.
|
---|
1653 | */
|
---|
1654 |
|
---|
1655 | /*
|
---|
1656 | an argument might be made that instead of in being returned or negated that
|
---|
1657 | it should be the looked up in the original chp through the istd that should
|
---|
1658 | be used, in which case this should be a macro that does the right thing.
|
---|
1659 | but im uncertain as to which is the correct one to do, ideas on a postcard
|
---|
1660 | to... etc etc
|
---|
1661 | */
|
---|
1662 | if (toggle == 128)
|
---|
1663 | return(in);
|
---|
1664 | else if (toggle == 129)
|
---|
1665 | return(!in);
|
---|
1666 | wvWarning("Strangle sprm toggle value, ignoring\n");
|
---|
1667 | return(in);
|
---|
1668 | }
|
---|
1669 |
|
---|
1670 | void wvApplysprmCSizePos(CHP *achp,U8 *pointer,U16 *pos)
|
---|
1671 | {
|
---|
1672 | U8 prevhpsPos;
|
---|
1673 | U16 temp8;
|
---|
1674 | struct _temp
|
---|
1675 | {
|
---|
1676 | U32 hpsSize:8;
|
---|
1677 | U32 cInc:7;
|
---|
1678 | U32 fAdjust:1;
|
---|
1679 | U32 hpsPos:8;
|
---|
1680 | } temp;
|
---|
1681 | temp.hpsSize = dgetc(NULL,&pointer);
|
---|
1682 | (*pos)++;
|
---|
1683 | temp8 = dgetc(NULL,&pointer);
|
---|
1684 | (*pos)++;
|
---|
1685 | temp.cInc = (temp8 & 0x7f) >> 8;
|
---|
1686 | temp.fAdjust = (temp8 & 0x80) >> 7;
|
---|
1687 | temp.hpsPos= dgetc(NULL,&pointer);
|
---|
1688 | (*pos)++;
|
---|
1689 |
|
---|
1690 | /*
|
---|
1691 | if hpsSize != 0 then chp.hps is set to hpsSize.
|
---|
1692 |
|
---|
1693 | If cInc is != 0, the cInc is interpreted as a 7 bit twos complement
|
---|
1694 | number and the procedure described below for interpreting sprmCHpsInc is
|
---|
1695 | followed to increase or decrease the chp.hps by the specified number of
|
---|
1696 | levels.
|
---|
1697 |
|
---|
1698 | If hpsPos is != 128, then chp.hpsPos is set equal to hpsPos.
|
---|
1699 |
|
---|
1700 | If fAdjust is on , hpsPos != 128 and hpsPos != 0 and the previous value of
|
---|
1701 | chp.hpsPos == 0, then chp.hps is reduced by one level following the method
|
---|
1702 | described for sprmCHpsInc.
|
---|
1703 |
|
---|
1704 | If fAdjust is on, hpsPos == 0 and the previous value of chp.hpsPos != 0,
|
---|
1705 | then the chp.hps value is increased by one level using the method described
|
---|
1706 | below for sprmCHpsInc.
|
---|
1707 | */
|
---|
1708 |
|
---|
1709 | if (temp.hpsSize != 0)
|
---|
1710 | achp->hps = temp.hpsSize;
|
---|
1711 |
|
---|
1712 | if (temp.cInc != 0)
|
---|
1713 | {
|
---|
1714 | }
|
---|
1715 |
|
---|
1716 | prevhpsPos = achp->hpsPos;
|
---|
1717 |
|
---|
1718 | if (temp.hpsPos != 128)
|
---|
1719 | achp->hpsPos = temp.hpsPos;
|
---|
1720 | #if 0
|
---|
1721 | /*else ? who knows ?*/
|
---|
1722 | if ((temp.fAdjust) && (temp.hpsPos != 128) && (temp.hpsPos != 0) && (achp->hpsPos == 0))
|
---|
1723 | /*reduce level */;
|
---|
1724 | if ((temp.fAdjust) && (temp.hpsPos == 0) && (achp->hpsPos != 0))
|
---|
1725 | /*increase level*/;
|
---|
1726 | #endif
|
---|
1727 |
|
---|
1728 | /*
|
---|
1729 | This depends on an implementation of sprmCHpsInc, read wvApplysprmCHpsInc for
|
---|
1730 | some comments on the whole matter
|
---|
1731 | */
|
---|
1732 |
|
---|
1733 | wvError(("This document has an unsupported sprm (sprmCSizePos), please mail "));
|
---|
1734 | wvError(("[email protected] with this document, as i haven't been able to "));
|
---|
1735 | wvError(("get any examples of it so as to figure out how to handle it\n"));
|
---|
1736 |
|
---|
1737 | }
|
---|
1738 |
|
---|
1739 | void wvApplysprmCHpsInc(CHP *achp,U8 *pointer,U16 *pos)
|
---|
1740 | {
|
---|
1741 | U8 param;
|
---|
1742 | /*
|
---|
1743 | sprmCHpsInc(opcode 0x2A44) is a three-byte sprm consisting of the sprm
|
---|
1744 | opcode and a one-byte parameter.
|
---|
1745 |
|
---|
1746 | Word keeps an ordered array of the font sizes that are defined for the fonts
|
---|
1747 | recorded in the system file with each font size transformed into an hps.
|
---|
1748 |
|
---|
1749 | The parameter is a one-byte twos complement number. Word uses this number
|
---|
1750 | to calculate an index in the font size array to determine the new hps for a
|
---|
1751 | run. When Word interprets this sprm and the parameter is positive, it searches
|
---|
1752 | the array of font sizes to find the index of the smallest entry in the font
|
---|
1753 | size table that is greater than the current chp.hps.It then adds the
|
---|
1754 | parameter minus 1 to the index and maxes this with the index of the last array
|
---|
1755 | entry. It uses the result as an index into the font size array and assigns that
|
---|
1756 | entry of the array to chp.hps.
|
---|
1757 |
|
---|
1758 | When the parameter is negative, Word searches the array of font sizes to
|
---|
1759 | find the index of the entry that is less than or equal to the current
|
---|
1760 | chp.hps. It then adds the negative parameter to the index and does a min of
|
---|
1761 | the result with 0. The result of the min function is used as an index into
|
---|
1762 | the font size array and that entry of the array is assigned to chp.hps.
|
---|
1763 | sprmCHpsInc is stored only in grpprls linked to piece table entries.
|
---|
1764 | */
|
---|
1765 |
|
---|
1766 | wvError(("This document has an unsupported sprm (sprmCHpsInc), please mail "));
|
---|
1767 | wvError(("[email protected] with this document, as i haven't been able to "));
|
---|
1768 | wvError(("get any examples of it so as to figure out how to handle it\n"));
|
---|
1769 |
|
---|
1770 | param = dgetc(NULL,&pointer);
|
---|
1771 |
|
---|
1772 | /*
|
---|
1773 | Now for christ sake !!, how on earth would i have an "ordered array of the
|
---|
1774 | font sizes that are defined for the fonts recorded in the system file", that
|
---|
1775 | sounds to me that i would have to have access to the fonts on the actual
|
---|
1776 | machine that word was last run on !, it sounds to me that this sprm might only
|
---|
1777 | be used during the editing of a file, so im going to have to ignore it because
|
---|
1778 | it complete goobledegook to me
|
---|
1779 | */
|
---|
1780 |
|
---|
1781 | }
|
---|
1782 |
|
---|
1783 | void wvApplysprmCHpsPosAdj(CHP *achp,U8 *pointer,U16 *pos)
|
---|
1784 | {
|
---|
1785 | U8 param;
|
---|
1786 | /*
|
---|
1787 | sprmCHpsPosAdj (opcode 0x2A46) causes the hps of a run to be reduced the
|
---|
1788 | first time text is superscripted or subscripted and causes the hps of a run
|
---|
1789 | to be increased when superscripting/subscripting is removed from a run.
|
---|
1790 |
|
---|
1791 | The one byte parameter of this sprm is the new hpsPos value that is to be
|
---|
1792 | stored in chp.hpsPos.
|
---|
1793 |
|
---|
1794 | If the new hpsPos is not equal 0 (meaning that the text is to be super/
|
---|
1795 | subscripted), Word first examines the current value of chp.hpsPos
|
---|
1796 | to see if it is equal to 0.
|
---|
1797 |
|
---|
1798 | If so, Word uses the algorithm described for sprmCHpsInc to decrease chp.hps
|
---|
1799 | by one level.
|
---|
1800 |
|
---|
1801 | If the new hpsPos == 0 (meaning the text is not super/subscripted),
|
---|
1802 | Word examines the current chp.hpsPos to see if it is not equal to 0. If it is
|
---|
1803 | not (which means text is being restored to normal position), Word uses the
|
---|
1804 | sprmCHpsInc algorithm to increase chp.hps by one level.
|
---|
1805 |
|
---|
1806 | After chp.hps is adjusted, the parameter value is stored in chp.hpsPos.
|
---|
1807 | */
|
---|
1808 |
|
---|
1809 | wvError(("This document has an partially unsupported sprm (sprmCHpsPosAdj), please mail "));
|
---|
1810 | wvError(("[email protected] with this document, as i haven't been able to "));
|
---|
1811 | wvError(("get any examples of it so as to figure out how to handle it\n"));
|
---|
1812 |
|
---|
1813 | param = dgetc(NULL,&pointer);
|
---|
1814 | (*pos)++;
|
---|
1815 |
|
---|
1816 | /*
|
---|
1817 | please see wvApplysprmCHpsInc for why this is unfinished
|
---|
1818 | */
|
---|
1819 |
|
---|
1820 | #if 0
|
---|
1821 | if ( (param != 0) && (achp->hpsPos == 0) )
|
---|
1822 | /*decrease chp.hps*/;
|
---|
1823 | else if ( (param == 0) && (achp->hpsPos != 0) )
|
---|
1824 | /*increase chp.hps*/;
|
---|
1825 | #endif
|
---|
1826 |
|
---|
1827 | achp->hpsPos = param;
|
---|
1828 |
|
---|
1829 |
|
---|
1830 | }
|
---|
1831 |
|
---|
1832 | void wvApplysprmCMajority(CHP *achp,STSH *stsh,U8 *pointer,U16 *pos)
|
---|
1833 | {
|
---|
1834 | U16 i;
|
---|
1835 | CHP base;
|
---|
1836 | CHP orig;
|
---|
1837 | UPXF upxf;
|
---|
1838 | /*
|
---|
1839 | Bytes 0 and 1 of
|
---|
1840 | sprmCMajority contains the opcode, byte 2 contains the length of the
|
---|
1841 | following list of character sprms. . Word begins interpretation of this sprm
|
---|
1842 | by applying the stored character sprm list to a standard chp. That chp has
|
---|
1843 | chp.istd = istdNormalChar. chp.hps=20, chp.lid=0x0400 and chp.ftc = 4. Word
|
---|
1844 | then compares fBold, fItalic, fStrike, fOutline, fShadow, fSmallCaps, fCaps,
|
---|
1845 | ftc, hps, hpsPos, kul, qpsSpace and ico in the original CHP with the values
|
---|
1846 | recorded for these fields in the generated CHP.. If a field in the original
|
---|
1847 | CHP has the same value as the field stored in the generated CHP, then that
|
---|
1848 | field is reset to the value stored in the style's CHP. If the two copies
|
---|
1849 | differ, then the original CHP value is left unchanged.
|
---|
1850 | */
|
---|
1851 | wvTrace(("This document has a sprm (sprmCMajority), that ive never seen in practice please mail "));
|
---|
1852 | wvTrace(("[email protected] with this document, as i haven't been able to "));
|
---|
1853 | wvTrace(("get any examples of it so as to figure out if its handled correctly\n"));
|
---|
1854 |
|
---|
1855 | wvInitCHP(&base);
|
---|
1856 | base.ftc=4;
|
---|
1857 |
|
---|
1858 | /*generate a UPE and run wvAddCHPXFromBucket*/
|
---|
1859 |
|
---|
1860 | upxf.cbUPX = dgetc(NULL,&pointer);
|
---|
1861 | (*pos)++;
|
---|
1862 | upxf.upx.chpx.grpprl = (U8 *)malloc(upxf.cbUPX);
|
---|
1863 |
|
---|
1864 | for (i=0;i<upxf.cbUPX;i++)
|
---|
1865 | {
|
---|
1866 | upxf.upx.chpx.grpprl[i] = dgetc(NULL,&pointer);
|
---|
1867 | (*pos)++;
|
---|
1868 | }
|
---|
1869 |
|
---|
1870 | wvTrace(("achp istd is %d\n",achp->istd));
|
---|
1871 |
|
---|
1872 | wvAddCHPXFromBucket(&base,&upxf,stsh);
|
---|
1873 |
|
---|
1874 | wvTrace(("achp istd is %d\n",achp->istd));
|
---|
1875 |
|
---|
1876 | wvTrace(("my underline started as %d\n",achp->kul));
|
---|
1877 |
|
---|
1878 | wvInitCHPFromIstd(&orig,achp->istd,stsh);
|
---|
1879 |
|
---|
1880 | /* this might be a little wrong, review after doing dedicated CHP's*/
|
---|
1881 | if (achp->fBold == base.fBold)
|
---|
1882 | achp->fBold = orig.fBold;
|
---|
1883 | if (achp->fItalic == base.fItalic)
|
---|
1884 | achp->fItalic = orig.fItalic;
|
---|
1885 | if (achp->fStrike == base.fStrike)
|
---|
1886 | achp->fStrike = orig.fStrike;
|
---|
1887 | if (achp->fOutline == base.fOutline)
|
---|
1888 | achp->fOutline = orig.fOutline;
|
---|
1889 | if (achp->fShadow == base.fShadow)
|
---|
1890 | achp->fShadow = orig.fShadow;
|
---|
1891 | if (achp->fSmallCaps == base.fSmallCaps)
|
---|
1892 | achp->fSmallCaps = orig.fSmallCaps;
|
---|
1893 | if (achp->fCaps == base.fCaps)
|
---|
1894 | achp->fCaps = orig.fCaps;
|
---|
1895 | if (achp->ftc == base.ftc)
|
---|
1896 | achp->ftc = orig.ftc;
|
---|
1897 | if (achp->hps == base.hps)
|
---|
1898 | achp->hps = orig.hps;
|
---|
1899 | if (achp->hpsPos == base.hpsPos)
|
---|
1900 | achp->hpsPos = orig.hpsPos;
|
---|
1901 | if (achp->kul == base.kul)
|
---|
1902 | achp->kul = orig.kul;
|
---|
1903 | /* ????
|
---|
1904 | if (achp->qpsSpace == base.qpsSpace)
|
---|
1905 | achp->qpsSpace = orig.qpsSpace;
|
---|
1906 | */
|
---|
1907 | if (achp->ico == base.ico)
|
---|
1908 | achp->ico = orig.ico;
|
---|
1909 |
|
---|
1910 | /*
|
---|
1911 | these ones are mentioned in a different part of the spec, that
|
---|
1912 | doesnt have as much weight as the above, but i'm going to add them
|
---|
1913 | anyway
|
---|
1914 | */
|
---|
1915 | if (achp->fVanish == base.fVanish)
|
---|
1916 | achp->fVanish = orig.fVanish;
|
---|
1917 | wvTrace(("%d\n",base.dxaSpace));
|
---|
1918 | wvTrace(("%d\n",achp->dxaSpace));
|
---|
1919 | if (achp->dxaSpace == base.dxaSpace)
|
---|
1920 | achp->dxaSpace = orig.dxaSpace;
|
---|
1921 | if (achp->lidDefault == base.lidDefault)
|
---|
1922 | achp->lidDefault = orig.lidDefault;
|
---|
1923 | if (achp->lidFE == base.lidFE)
|
---|
1924 | achp->lidFE = orig.lidFE;
|
---|
1925 | wvFree(upxf.upx.chpx.grpprl);
|
---|
1926 |
|
---|
1927 |
|
---|
1928 | wvTrace(("my underline ended as %d\n",achp->kul));
|
---|
1929 | }
|
---|
1930 |
|
---|
1931 | void wvApplysprmCHpsInc1(CHP *achp,U8 *pointer,U16 *pos)
|
---|
1932 | {
|
---|
1933 | /*
|
---|
1934 | This sprm is interpreted by adding the two byte increment
|
---|
1935 | stored as the opcode of the sprm to chp.hps. If this result is less than 8,
|
---|
1936 | the chp.hps is set to 8. If the result is greater than 32766, the chp.hps is
|
---|
1937 | set to 32766.
|
---|
1938 | */
|
---|
1939 | dgetc(NULL,&pointer);
|
---|
1940 | (*pos)++;
|
---|
1941 | achp->hps += dread_16ubit(NULL,&pointer);
|
---|
1942 | (*pos)+=2;
|
---|
1943 | if (achp->hps < 8)
|
---|
1944 | achp->hps=8;
|
---|
1945 | else if (achp->hps > 32766)
|
---|
1946 | achp->hps=32766;
|
---|
1947 | }
|
---|
1948 |
|
---|
1949 |
|
---|
1950 | void wvApplysprmCMajority50(CHP *achp,STSH *stsh,U8 *pointer,U16 *pos)
|
---|
1951 | {
|
---|
1952 | U16 i;
|
---|
1953 | CHP base;
|
---|
1954 | CHP orig;
|
---|
1955 | UPXF upxf;
|
---|
1956 | /*
|
---|
1957 | Bytes 0 and 1 of
|
---|
1958 | sprmCMajority contains the opcode, byte 2 contains the length of the
|
---|
1959 | following list of character sprms. . Word begins interpretation of this sprm
|
---|
1960 | by applying the stored character sprm list to a standard chp. That chp has
|
---|
1961 | chp.istd = istdNormalChar. chp.hps=20, chp.lid=0x0400 and chp.ftc = 4. Word
|
---|
1962 | then compares fBold, fItalic, fStrike, fOutline, fShadow, fSmallCaps, fCaps,
|
---|
1963 | ftc, hps, hpsPos, kul, qpsSpace and ico in the original CHP with the values
|
---|
1964 | recorded for these fields in the generated CHP.. If a field in the original
|
---|
1965 | CHP has the same value as the field stored in the generated CHP, then that
|
---|
1966 | field is reset to the value stored in the style's CHP. If the two copies
|
---|
1967 | differ, then the original CHP value is left unchanged.
|
---|
1968 | */
|
---|
1969 | wvTrace(("This document has a sprm (sprmCMajority50), that ive never seen in practice please mail "));
|
---|
1970 | wvTrace(("[email protected] with this document, as i haven't been able to "));
|
---|
1971 | wvTrace(("get any examples of it so as to figure out if its handled correctly\n"));
|
---|
1972 |
|
---|
1973 | wvInitCHP(&base);
|
---|
1974 | base.ftc=4;
|
---|
1975 |
|
---|
1976 | /*generate a UPE and run wvAddCHPXFromBucket*/
|
---|
1977 |
|
---|
1978 | upxf.cbUPX = dgetc(NULL,&pointer);
|
---|
1979 | (*pos)++;
|
---|
1980 | upxf.upx.chpx.grpprl = (U8 *)malloc(upxf.cbUPX);
|
---|
1981 |
|
---|
1982 | for (i=0;i<upxf.cbUPX;i++)
|
---|
1983 | {
|
---|
1984 | upxf.upx.chpx.grpprl[i] = dgetc(NULL,&pointer);
|
---|
1985 | (*pos)++;
|
---|
1986 | }
|
---|
1987 |
|
---|
1988 | wvAddCHPXFromBucket(&base,&upxf,stsh);
|
---|
1989 |
|
---|
1990 | wvInitCHPFromIstd(&orig,achp->istd,stsh);
|
---|
1991 |
|
---|
1992 | /* this might be a little wrong, review after doing dedicated CHP's*/
|
---|
1993 | wvTrace(("istd is %d\n",achp->istd));
|
---|
1994 | if (achp->fBold == base.fBold)
|
---|
1995 | achp->fBold = orig.fBold;
|
---|
1996 | if (achp->fItalic == base.fItalic)
|
---|
1997 | achp->fItalic = orig.fItalic;
|
---|
1998 | if (achp->fStrike == base.fStrike)
|
---|
1999 | achp->fStrike = orig.fStrike;
|
---|
2000 | if (achp->fSmallCaps == base.fSmallCaps)
|
---|
2001 | achp->fSmallCaps = orig.fSmallCaps;
|
---|
2002 | if (achp->fCaps == base.fCaps)
|
---|
2003 | achp->fCaps = orig.fCaps;
|
---|
2004 | if (achp->ftc == base.ftc)
|
---|
2005 | achp->ftc = orig.ftc;
|
---|
2006 | if (achp->hps == base.hps)
|
---|
2007 | achp->hps = orig.hps;
|
---|
2008 | if (achp->hpsPos == base.hpsPos)
|
---|
2009 | achp->hpsPos = orig.hpsPos;
|
---|
2010 | if (achp->kul == base.kul)
|
---|
2011 | achp->kul = orig.kul;
|
---|
2012 | if (achp->ico == base.ico)
|
---|
2013 | achp->ico = orig.ico;
|
---|
2014 | if (achp->fVanish == base.fVanish)
|
---|
2015 | achp->fVanish = orig.fVanish;
|
---|
2016 | if (achp->dxaSpace == base.dxaSpace)
|
---|
2017 | achp->dxaSpace = orig.dxaSpace;
|
---|
2018 | }
|
---|
2019 |
|
---|
2020 | void wvApplysprmCPropRMark(CHP *achp,U8 *pointer,U16 *pos)
|
---|
2021 | {
|
---|
2022 | dgetc(NULL,&pointer); /*len*/
|
---|
2023 | (*pos)++;
|
---|
2024 | achp->fPropRMark = dgetc(NULL,&pointer);
|
---|
2025 | (*pos)++;
|
---|
2026 | achp->ibstPropRMark = (S16)dread_16ubit(NULL,&pointer);
|
---|
2027 | (*pos)+=2;
|
---|
2028 | wvGetDTTMFromBucket(&achp->dttmPropRMark,pointer);
|
---|
2029 | (*pos)+=4;
|
---|
2030 | }
|
---|
2031 |
|
---|
2032 | void wvApplysprmCDispFldRMark(CHP *achp,U8 *pointer,U16 *pos)
|
---|
2033 | {
|
---|
2034 | /*
|
---|
2035 | is interpreted by moving the first
|
---|
2036 | parameter byte to chp.fDispFldRMark, the next two bytes to
|
---|
2037 | chp.ibstDispFldRMark, the next four bytes to chp.dttmDispFldRMark,
|
---|
2038 | and the remaining 32 bytes to chp.xstDispFldRMark.
|
---|
2039 | */
|
---|
2040 |
|
---|
2041 | int i;
|
---|
2042 | dgetc(NULL,&pointer); /*len*/
|
---|
2043 | (*pos)++;
|
---|
2044 | achp->fDispFldRMark = dgetc(NULL,&pointer);
|
---|
2045 | (*pos)++;
|
---|
2046 | achp->ibstDispFldRMark = (S16)dread_16ubit(NULL,&pointer);
|
---|
2047 | (*pos)+=2;
|
---|
2048 | wvGetDTTMFromBucket(&achp->dttmDispFldRMark,pointer);
|
---|
2049 | (*pos)+=4;
|
---|
2050 | pointer+=4;
|
---|
2051 | for (i=0;i<16;i++)
|
---|
2052 | {
|
---|
2053 | achp->xstDispFldRMark[i] = dread_16ubit(NULL,&pointer);
|
---|
2054 | (*pos)+=2;
|
---|
2055 | }
|
---|
2056 | }
|
---|
2057 |
|
---|
2058 |
|
---|
2059 | void wvApplysprmSOlstAnm(version ver,SEP *asep,U8 *pointer,U16 *pos)
|
---|
2060 | {
|
---|
2061 | U8 len = dgetc(NULL,&pointer);
|
---|
2062 | wvGetOLSTFromBucket(ver,&asep->olstAnm,pointer);
|
---|
2063 | if (len != cbOLST)
|
---|
2064 | wvError(("OLST len is different from expected\n"));
|
---|
2065 | (*pos)+=len;
|
---|
2066 | }
|
---|
2067 |
|
---|
2068 | void wvApplysprmSPropRMark(SEP *asep,U8 *pointer,U16 *pos)
|
---|
2069 | {
|
---|
2070 | dgetc(NULL,&pointer);
|
---|
2071 | (*pos)++;
|
---|
2072 | /*
|
---|
2073 | sprmPPropRMark is interpreted by moving the first parameter
|
---|
2074 | byte to pap.fPropRMark, the next two bytes to pap.ibstPropRMark, and the
|
---|
2075 | remaining four bytes to pap.dttmPropRMark.
|
---|
2076 | */
|
---|
2077 | asep->fPropRMark = dgetc(NULL,&pointer);
|
---|
2078 | (*pos)++;
|
---|
2079 | asep->ibstPropRMark = dread_16ubit(NULL,&pointer);
|
---|
2080 | (*pos)+=2;
|
---|
2081 | wvGetDTTMFromBucket(&asep->dttmPropRMark,pointer);
|
---|
2082 | (*pos)+=4;
|
---|
2083 | }
|
---|
2084 |
|
---|
2085 |
|
---|
2086 | /*
|
---|
2087 | sprmTDxaLeft (opcode 0x9601) is called to adjust the x position within a
|
---|
2088 | column which marks the left boundary of text within the first cell of a
|
---|
2089 | table row. This sprm causes a whole table row to be shifted left or right
|
---|
2090 | within its column leaving the horizontal width and vertical height of cells
|
---|
2091 | in the row unchanged. Bytes 0-1 of the sprm contains the opcode, and the new
|
---|
2092 | dxa position, call it dxaNew, is stored as an integer in bytes 2 and 3. Word
|
---|
2093 | interprets this sprm by adding dxaNew - (rgdxaCenter[0] + tap.dxaGapHalf) to
|
---|
2094 | every entry of tap.rgdxaCenter whose index is less than tap.itcMac.
|
---|
2095 | sprmTDxaLeft is stored only in grpprls linked to piece table entries.
|
---|
2096 | */
|
---|
2097 | void wvApplysprmTDxaLeft(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2098 | {
|
---|
2099 | S16 dxaNew = (S16)dread_16ubit(NULL,&pointer);
|
---|
2100 | int i;
|
---|
2101 | (*pos)+=2;
|
---|
2102 | dxaNew = dxaNew - (tap->rgdxaCenter[0] + tap->dxaGapHalf);
|
---|
2103 | for (i=0;i<tap->itcMac;i++)
|
---|
2104 | tap->rgdxaCenter[i] += dxaNew;
|
---|
2105 | }
|
---|
2106 |
|
---|
2107 | /*
|
---|
2108 | sprmTDxaGapHalf (opcode 0x9602) adjusts the white space that is maintained
|
---|
2109 | between columns by changing tap.dxaGapHalf. Because we want the left
|
---|
2110 | boundary of text within the leftmost cell to be at the same location after
|
---|
2111 | the sprm is applied, Word also adjusts tap.rgdxCenter[0] by the amount that
|
---|
2112 | tap.dxaGapHalf changes. Bytes 0-1 of the sprm contains the opcode, and the
|
---|
2113 | new dxaGapHalf, call it dxaGapHalfNew, is stored in bytes 2 and 3. When the
|
---|
2114 | sprm is interpreted, the change between the old and new dxaGapHalf values,
|
---|
2115 | tap.dxaGapHalf - dxaGapHalfNew, is added to tap.rgdxaCenter[0] and then
|
---|
2116 | dxaGapHalfNew is moved to tap.dxaGapHalf. sprmTDxaGapHalf is stored in PAPXs
|
---|
2117 | and also in grpprls linked to piece table entries.
|
---|
2118 |
|
---|
2119 | */
|
---|
2120 | void wvApplysprmTDxaGapHalf(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2121 | {
|
---|
2122 | S16 dxaGapHalfNew = (S16)dread_16ubit(NULL,&pointer);
|
---|
2123 | (*pos)+=2;
|
---|
2124 | tap->rgdxaCenter[0] += tap->dxaGapHalf - dxaGapHalfNew;
|
---|
2125 | tap->dxaGapHalf = dxaGapHalfNew;
|
---|
2126 | }
|
---|
2127 |
|
---|
2128 | /*
|
---|
2129 | sprmTTableBorders (opcode 0xD605) sets the tap.rgbrcTable. The sprm is
|
---|
2130 | interpreted by moving the 24 bytes of the sprm's operand to tap.rgbrcTable.
|
---|
2131 | */
|
---|
2132 | void wvApplysprmTTableBorders(version ver,TAP *tap,U8 *pointer,U16 *pos)
|
---|
2133 | {
|
---|
2134 | int i,d;
|
---|
2135 | if (ver == WORD8)
|
---|
2136 | {
|
---|
2137 | dgetc(NULL,&pointer);
|
---|
2138 | (*pos)++;
|
---|
2139 | }
|
---|
2140 | for (i=0;i<6;i++)
|
---|
2141 | {
|
---|
2142 | d = wvGetBRCFromBucket(ver,&(tap->rgbrcTable[i]),pointer);
|
---|
2143 | pointer+=d;
|
---|
2144 | (*pos)+=d;
|
---|
2145 | }
|
---|
2146 | }
|
---|
2147 |
|
---|
2148 | /*
|
---|
2149 | sprmTDefTable (opcode 0xD608) defines the boundaries of table cells
|
---|
2150 | (tap.rgdxaCenter) and the properties of each cell in a table (tap.rgtc).
|
---|
2151 | Bytes 0 and 1 of the sprm contain its opcode. Bytes 2 and 3 store a two-byte
|
---|
2152 | length of the following parameter. Byte 4 contains the number of cells that
|
---|
2153 | are to be defined by the sprm, call it itcMac. When the sprm is interpreted,
|
---|
2154 | itcMac is moved to tap.itcMac. itcMac cannot be larger than 32. In bytes 5
|
---|
2155 | through 5+2*(itcMac + 1) -1 , is stored an array of integer dxa values
|
---|
2156 | sorted in ascending order which will be moved to tap.rgdxaCenter. In bytes
|
---|
2157 | 5+ 2*(itcMac + 1) through byte 5+2*(itcMac + 1) + 10*itcMac - 1 is stored an
|
---|
2158 | array of TC entries corresponding to the stored tap.rgdxaCenter. This array
|
---|
2159 | is moved to tap.rgtc. sprmTDefTable is only stored in PAPXs.
|
---|
2160 | */
|
---|
2161 | void wvApplysprmTDefTable(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2162 | {
|
---|
2163 | U16 len;
|
---|
2164 | int i,t,oldpos;
|
---|
2165 | version type;
|
---|
2166 | len = dread_16ubit(NULL,&pointer);
|
---|
2167 | (*pos)+=2;
|
---|
2168 | wvTrace(("wvApplysprmTDefTable\n"));
|
---|
2169 | tap->itcMac = dgetc(NULL,&pointer);
|
---|
2170 | (*pos)++;
|
---|
2171 | oldpos = (*pos)-2;
|
---|
2172 | wvTrace(("oldpos is %x\n",oldpos));
|
---|
2173 | wvTrace(("C: there are %d cells\n",tap->itcMac));
|
---|
2174 | for (i=0;i<tap->itcMac + 1;i++)
|
---|
2175 | {
|
---|
2176 | tap->rgdxaCenter[i] = (S16)dread_16ubit(NULL,&pointer);
|
---|
2177 | wvTrace(("C: cell boun is %d\n",tap->rgdxaCenter[i]));
|
---|
2178 | (*pos)+=2;
|
---|
2179 | }
|
---|
2180 |
|
---|
2181 | wvTrace(("HERE-->pos is now %d, the len was %d, there is %d left\n",*pos,len,len-(*pos-oldpos)));
|
---|
2182 |
|
---|
2183 | if ( (len-(*pos-oldpos)) < (cb6TC * tap->itcMac) )
|
---|
2184 | {
|
---|
2185 | pointer += len - (*pos - oldpos);
|
---|
2186 | (*pos) += len - (*pos - oldpos);
|
---|
2187 | return;
|
---|
2188 | }
|
---|
2189 |
|
---|
2190 | if ( (len-(*pos-oldpos)) < (cbTC * tap->itcMac) )
|
---|
2191 | type = WORD6;
|
---|
2192 | else
|
---|
2193 | type = WORD8;
|
---|
2194 |
|
---|
2195 | wvTrace(("type is %d\n",type));
|
---|
2196 |
|
---|
2197 | wvTrace(("left over is %d\n",len-(*pos-oldpos)));
|
---|
2198 |
|
---|
2199 | for (i=0;i<tap->itcMac;i++)
|
---|
2200 | {
|
---|
2201 | t = wvGetTCFromBucket(type,&(tap->rgtc[i]),pointer);
|
---|
2202 | wvTrace(("DefTable merge is %d\n",tap->rgtc[i].fVertMerge));
|
---|
2203 | /* for christ sake !!, word 8 stores word 6 sized TC's in this sprm ! */
|
---|
2204 | (*pos)+=t;
|
---|
2205 | pointer+=t;
|
---|
2206 | wvTrace(("t is %d, under is %x\n",t,*pointer));
|
---|
2207 | }
|
---|
2208 |
|
---|
2209 | wvTrace(("left over is %d\n",len-(*pos-oldpos)));
|
---|
2210 |
|
---|
2211 | while (len-(*pos-oldpos))
|
---|
2212 | {
|
---|
2213 | wvTrace(("Eating byte %x\n",dgetc(NULL,&pointer)));
|
---|
2214 | (*pos)++;
|
---|
2215 | }
|
---|
2216 | wvTrace(("oldpos is %x, pos is %x, diff is %d\n",oldpos,*pos,*pos-oldpos-2));
|
---|
2217 | }
|
---|
2218 | /*
|
---|
2219 | sprmTDefTable10 (opcode0xD606) is an obsolete version of sprmTDefTable
|
---|
2220 | (opcode 0xD608) that was used in WinWord 1.x. Its contents are identical to
|
---|
2221 | those in sprmTDefTable, except that the TC structures contain the obsolete
|
---|
2222 | structures BRC10s.
|
---|
2223 | */
|
---|
2224 |
|
---|
2225 | void wvApplysprmTDefTable10(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2226 | {
|
---|
2227 | U16 len;
|
---|
2228 | int i,t;
|
---|
2229 | len = dread_16ubit(NULL,&pointer);
|
---|
2230 | (*pos)+=2;
|
---|
2231 | tap->itcMac = dgetc(NULL,&pointer);
|
---|
2232 | (*pos)++;
|
---|
2233 | for (i=0;i<tap->itcMac + 1;i++)
|
---|
2234 | {
|
---|
2235 | tap->rgdxaCenter[i] = (S16)dread_16ubit(NULL,&pointer);
|
---|
2236 | (*pos)+=2;
|
---|
2237 | }
|
---|
2238 | for (i=0;i<tap->itcMac;i++)
|
---|
2239 | {
|
---|
2240 | t=wvGetTCFromBucket(WORD6,&(tap->rgtc[i]),pointer);
|
---|
2241 | (*pos)+=t;
|
---|
2242 | pointer+=t;
|
---|
2243 | }
|
---|
2244 | }
|
---|
2245 |
|
---|
2246 | void wv2ApplysprmTDefTableShd(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2247 | {
|
---|
2248 | U8 len;
|
---|
2249 | U16 itcMac;
|
---|
2250 | int i;
|
---|
2251 |
|
---|
2252 | len = dgetc(NULL,&pointer);
|
---|
2253 | (*pos)++;
|
---|
2254 | itcMac = len/cbSHD;
|
---|
2255 | wvTrace(("len in 2sprmTDefTableShd is %d, no of cells is %d\n",len,itcMac));
|
---|
2256 |
|
---|
2257 | for (i=0;i<itcMac;i++)
|
---|
2258 | {
|
---|
2259 | wvGetSHDFromBucket(&(tap->rgshd[i]),pointer);
|
---|
2260 | pointer+=cbSHD;
|
---|
2261 | (*pos)+=cbSHD;
|
---|
2262 | }
|
---|
2263 | }
|
---|
2264 |
|
---|
2265 |
|
---|
2266 | /*
|
---|
2267 | sprmTDefTableShd (opcode 0xD609) is similar to sprmTDefTable, and
|
---|
2268 | compliments it by defining the shading of each cell in a table (tap.rgshd).
|
---|
2269 | Bytes 0 and 1 of the sprm contain its opcode. Bytes 2 and 3 store a two-byte
|
---|
2270 | length of the following parameter. Byte 4 contains the number of cells that
|
---|
2271 | are to be defined by the sprm, call it itcMac. itcMac cannot be larger than
|
---|
2272 | 32. In bytes 5 through 5+2*(itcMac + 1) -1 , is stored an array of SHDs.
|
---|
2273 | This array is moved to tap.rgshd. sprmTDefTable is only stored in PAPXs.
|
---|
2274 | */
|
---|
2275 | void wvApplysprmTDefTableShd(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2276 | {
|
---|
2277 | U16 len;
|
---|
2278 | U16 itcMac;
|
---|
2279 | int i,oldpos;
|
---|
2280 |
|
---|
2281 | len = dread_16ubit(NULL,&pointer);
|
---|
2282 | (*pos)+=2;
|
---|
2283 | if (len >= 0x4000)
|
---|
2284 | {
|
---|
2285 | len = len&0x00ff;
|
---|
2286 | wvError(("bad len in sprmTDefTableShd, munging to %d instead\n",len));
|
---|
2287 | }
|
---|
2288 | wvTrace(("wvApplysprmTDefTableShd, len %d\n",len));
|
---|
2289 | itcMac = dgetc(NULL,&pointer);
|
---|
2290 | (*pos)++;
|
---|
2291 | oldpos = (*pos)-2;
|
---|
2292 | wvTrace(("oldpos is %x\n",oldpos));
|
---|
2293 | wvTrace(("C: there are %d cells\n",itcMac));
|
---|
2294 | if (itcMac > 32)
|
---|
2295 | wvError(("Broken word doc, recovering from stupidity\n"));
|
---|
2296 | else
|
---|
2297 | {
|
---|
2298 | if ( (len-(*pos-oldpos)) < (cbSHD * tap->itcMac) )
|
---|
2299 | {
|
---|
2300 | wvError(("Broken sprmDefTableShd, recovering from problem\n"));
|
---|
2301 | pointer += len - (*pos - oldpos);
|
---|
2302 | (*pos) += len - (*pos - oldpos);
|
---|
2303 | return;
|
---|
2304 | }
|
---|
2305 |
|
---|
2306 | for (i=0;i<itcMac;i++)
|
---|
2307 | {
|
---|
2308 | wvGetSHDFromBucket(&(tap->rgshd[i]),pointer);
|
---|
2309 | pointer+=cbSHD;
|
---|
2310 | (*pos)+=cbSHD;
|
---|
2311 | }
|
---|
2312 | }
|
---|
2313 |
|
---|
2314 | while (len-(*pos-oldpos))
|
---|
2315 | {
|
---|
2316 | wvTrace(("Eating byte %x\n",dgetc(NULL,&pointer)));
|
---|
2317 | (*pos)++;
|
---|
2318 | }
|
---|
2319 | wvTrace(("oldpos is %x, pos is %x, diff is %d\n",oldpos,*pos,*pos-oldpos-2));
|
---|
2320 | }
|
---|
2321 | /*
|
---|
2322 | Word 8
|
---|
2323 |
|
---|
2324 | sprmTSetBrc (opcode 0xD620) allows the border definitions(BRCs) within TCs
|
---|
2325 | to be set to new values. It has the following format:
|
---|
2326 |
|
---|
2327 | b10 b16 field type size bitfield comments
|
---|
2328 |
|
---|
2329 | 0 0 sprm short opcode 0xD620
|
---|
2330 |
|
---|
2331 | 2 2 count byte number of bytes for operand
|
---|
2332 |
|
---|
2333 | 3 3 itcFirst byte the index of the first cell
|
---|
2334 | that is to have its borders
|
---|
2335 | changed.
|
---|
2336 |
|
---|
2337 | 4 4 itcLim byte index of the cell that follows
|
---|
2338 | the last cell to have its
|
---|
2339 | borders changed
|
---|
2340 |
|
---|
2341 | 5 5 short :4 F0 reserved
|
---|
2342 |
|
---|
2343 | fChangeRight short :1 08 =1 when tap.rgtc[].brcRight is
|
---|
2344 | to be changed
|
---|
2345 |
|
---|
2346 | fChangeBottom short :1 04 =1 when tap.rgtc[].brcBottom
|
---|
2347 | is to be changed
|
---|
2348 |
|
---|
2349 | fChangeLeft short :1 02 =1 when tap.rgtc[].brcLeft is
|
---|
2350 | to be changed
|
---|
2351 |
|
---|
2352 | fChangeTop short :1 01 =1 when tap.rgtc[].brcTop is
|
---|
2353 | to be changed
|
---|
2354 |
|
---|
2355 | 6 6 brc BRC new BRC value to be stored in
|
---|
2356 | TCs.
|
---|
2357 |
|
---|
2358 | */
|
---|
2359 | /* Pre Word 8 *
|
---|
2360 | 0 0 sprm byte opcode 193
|
---|
2361 | 1 1 itcFirst byte
|
---|
2362 | 2 2 itcLim byte
|
---|
2363 | 3 3 int :4 F0 reserved
|
---|
2364 | fChangeRight int :1 08
|
---|
2365 | fChangeBottom int :1 04
|
---|
2366 | fChangeLeft int :1 02
|
---|
2367 | fChangeTop int :1 01
|
---|
2368 | 4 4 brc BRC
|
---|
2369 | */
|
---|
2370 | void wvApplysprmTSetBrc(version ver,TAP *tap,U8 *pointer,U16 *pos)
|
---|
2371 | {
|
---|
2372 | U8 itcFirst,itcLim,len,temp8;
|
---|
2373 | BRC abrc;
|
---|
2374 | int i;
|
---|
2375 | if (ver == WORD8)
|
---|
2376 | {
|
---|
2377 | len = dgetc(NULL,&pointer);
|
---|
2378 | (*pos)++;
|
---|
2379 | wvTrace(("the len is %d",len));
|
---|
2380 | }
|
---|
2381 | itcFirst = dgetc(NULL,&pointer);
|
---|
2382 | itcLim = dgetc(NULL,&pointer);
|
---|
2383 | temp8 = dgetc(NULL,&pointer);
|
---|
2384 | (*pos)+=3;
|
---|
2385 | (*pos) += wvGetBRCFromBucket(ver,&abrc,pointer);
|
---|
2386 |
|
---|
2387 | for (i=itcFirst;i<itcLim;i++)
|
---|
2388 | {
|
---|
2389 | if (temp8 & 0x08)
|
---|
2390 | wvCopyBRC(&tap->rgtc[i].brcRight, &abrc);
|
---|
2391 | if (temp8 & 0x04)
|
---|
2392 | wvCopyBRC(&tap->rgtc[i].brcBottom, &abrc);
|
---|
2393 | if (temp8 & 0x02)
|
---|
2394 | wvCopyBRC(&tap->rgtc[i].brcLeft, &abrc);
|
---|
2395 | if (temp8 & 0x01)
|
---|
2396 | wvCopyBRC(&tap->rgtc[i].brcTop, &abrc);
|
---|
2397 | }
|
---|
2398 | }
|
---|
2399 |
|
---|
2400 | /*
|
---|
2401 | sprmTInsert (opcode 0x7621) inserts new cell definitions in an existing
|
---|
2402 | table's cell structure.
|
---|
2403 |
|
---|
2404 | Bytes 0 and 1 of the sprm contain the opcode.
|
---|
2405 |
|
---|
2406 | Byte 2 is the index within tap.rgdxaCenter and tap.rgtc at which the new dxaCenter
|
---|
2407 | and tc values will be inserted. Call this index itcInsert.
|
---|
2408 |
|
---|
2409 | Byte 3 contains a count of the cell definitions to be added to the tap, call it ctc.
|
---|
2410 |
|
---|
2411 | Bytes 4 and 5 contain the width of the cells that will be added, call it dxaCol.
|
---|
2412 |
|
---|
2413 | If there are already cells defined at the index where cells are to be inserted,
|
---|
2414 | tap.rgdxaCenter entries at or above this index must be moved to the entry
|
---|
2415 | ctc higher and must be adjusted by adding ctc*dxaCol to the value stored.
|
---|
2416 |
|
---|
2417 | The contents of tap.rgtc at or above the index must be moved 10*ctc bytes
|
---|
2418 | higher in tap.rgtc.
|
---|
2419 |
|
---|
2420 | If itcInsert is greater than the original tap.itcMac, itcInsert - tap.ctc columns
|
---|
2421 | beginning with index tap.itcMac must be added of width dxaCol
|
---|
2422 | (loop from itcMac to itcMac+itcInsert-tap.ctc adding dxaCol to the rgdxaCenter
|
---|
2423 | value of the previous entry and storing sum as dxaCenter of new entry),
|
---|
2424 | whose TC entries are cleared to zeros.
|
---|
2425 |
|
---|
2426 | Beginning with index itcInsert, ctc columns of width dxaCol must be added by
|
---|
2427 | constructing new tap.rgdxaCenter and tap.rgtc entries with the newly defined
|
---|
2428 | rgtc entries cleared to zeros.
|
---|
2429 |
|
---|
2430 | Finally, the number of cells that were added to the tap is added to tap.itcMac.
|
---|
2431 |
|
---|
2432 | sprmTInsert is stored only in grpprls linked to piece table entries.
|
---|
2433 | */
|
---|
2434 |
|
---|
2435 | void wvApplysprmTInsert(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2436 | {
|
---|
2437 | U8 itcInsert = dgetc(NULL,&pointer);
|
---|
2438 | U8 ctc = dgetc(NULL,&pointer);
|
---|
2439 | S16 dxaCol = (S16)dread_16ubit(NULL,&pointer);
|
---|
2440 | int i;
|
---|
2441 | (*pos)+=4;
|
---|
2442 |
|
---|
2443 | if (itcInsert <= tap->itcMac+1)
|
---|
2444 | {
|
---|
2445 | for (i=tap->itcMac+1;i>=itcInsert;i--)
|
---|
2446 | {
|
---|
2447 | tap->rgdxaCenter[i+ctc] = tap->rgdxaCenter[i]+ctc*dxaCol;
|
---|
2448 | tap->rgtc[i+ctc] = tap->rgtc[i];
|
---|
2449 | }
|
---|
2450 | }
|
---|
2451 |
|
---|
2452 | if (itcInsert > tap->itcMac)
|
---|
2453 | {
|
---|
2454 | for (i=tap->itcMac;i<tap->itcMac+itcInsert-ctc;i++)
|
---|
2455 | {
|
---|
2456 | tap->rgdxaCenter[i] = tap->rgdxaCenter[i-1] + dxaCol;
|
---|
2457 | wvInitTC(&(tap->rgtc[i]));
|
---|
2458 | }
|
---|
2459 | }
|
---|
2460 |
|
---|
2461 | for (i=itcInsert;i<ctc+itcInsert;i++)
|
---|
2462 | {
|
---|
2463 | tap->rgdxaCenter[i] = tap->rgdxaCenter[i-1] + dxaCol;
|
---|
2464 | wvInitTC(&(tap->rgtc[i]));
|
---|
2465 | }
|
---|
2466 |
|
---|
2467 | tap->itcMac+=ctc;
|
---|
2468 | }
|
---|
2469 |
|
---|
2470 |
|
---|
2471 | /*
|
---|
2472 | sprmTDelete (opcode 0x5622) deletes cell definitions from an existing
|
---|
2473 | table's cell structure. Bytes 0 and 1of the sprm contain the opcode. Byte 2
|
---|
2474 | contains the index of the first cell to delete, call it itcFirst. Byte 3
|
---|
2475 | contains the index of the cell that follows the last cell to be deleted,
|
---|
2476 | call it itcLim. sprmTDelete causes any rgdxaCenter and rgtc entries whose
|
---|
2477 | index is greater than or equal to itcLim to be moved to the entry that is
|
---|
2478 | itcLim - itcFirst lower, and causes tap.itcMac to be decreased by the number
|
---|
2479 | of cells deleted. sprmTDelete is stored only in grpprls linked to piece
|
---|
2480 | table entries.
|
---|
2481 | */
|
---|
2482 | void wvApplysprmTDelete(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2483 | {
|
---|
2484 | U8 itcFirst = dgetc(NULL,&pointer);
|
---|
2485 | U8 itcLim = dgetc(NULL,&pointer);
|
---|
2486 | int i;
|
---|
2487 | (*pos)+=2;
|
---|
2488 |
|
---|
2489 | for (i=itcLim;i<=tap->itcMac+1;i++)
|
---|
2490 | {
|
---|
2491 | tap->rgdxaCenter[i-(itcLim - itcFirst)] = tap->rgdxaCenter[i];
|
---|
2492 | wvCopyTC( &(tap->rgtc[i-(itcLim - itcFirst)]),&(tap->rgtc[i]) );
|
---|
2493 | }
|
---|
2494 | }
|
---|
2495 |
|
---|
2496 | /*
|
---|
2497 | sprmTDxaCol (opcode 0x7623) changes the width of cells whose index is within
|
---|
2498 | a certain range to be a certain value. Bytes 0 and 1of the sprm contain the
|
---|
2499 | opcode. Byte 2 contains the index of the first cell whose width is to be
|
---|
2500 | changed, call it itcFirst. Byte 3 contains the index of the cell that
|
---|
2501 | follows the last cell whose width is to be changed, call it itcLim. Bytes 4
|
---|
2502 | and 5 contain the new width of the cell, call it dxaCol.
|
---|
2503 |
|
---|
2504 | This sprm causes the itcLim - itcFirst entries of tap.rgdxaCenter to be
|
---|
2505 | adjusted so that tap.rgdxaCenter[i+1] = tap.rgdxaCenter[i] + dxaCol. Any
|
---|
2506 | tap.rgdxaCenter entries that exist beyond itcLim are adjusted to take into
|
---|
2507 | account the amount added to or removed from the previous columns.
|
---|
2508 | */
|
---|
2509 | void wvApplysprmTDxaCol(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2510 | {
|
---|
2511 | U8 itcFirst = dgetc(NULL,&pointer);
|
---|
2512 | U8 itcLim = dgetc(NULL,&pointer);
|
---|
2513 | S16 dxaCol = (S16)dread_16ubit(NULL,&pointer);
|
---|
2514 | S16 diff=0;
|
---|
2515 | int i;
|
---|
2516 | (*pos)+=4;
|
---|
2517 | for (i=itcFirst;i<itcLim;i++);
|
---|
2518 | {
|
---|
2519 | diff += tap->rgdxaCenter[i+1]-(tap->rgdxaCenter[i] + dxaCol);
|
---|
2520 | tap->rgdxaCenter[i+1] = tap->rgdxaCenter[i] + dxaCol;
|
---|
2521 | }
|
---|
2522 | for (i=itcLim;i<tap->itcMac+1;i++);
|
---|
2523 | tap->rgdxaCenter[i+1] +=diff;
|
---|
2524 | }
|
---|
2525 |
|
---|
2526 | /*
|
---|
2527 | sprmTMerge (opcode 0x5624) merges the display areas of cells within a
|
---|
2528 | specified range. Bytes 0 and 1 of the sprm contain the opcode. Byte 2
|
---|
2529 | contains the index of the first cell that is to be merged, call it itcFirst.
|
---|
2530 | Byte 3 contains the index of the cell that follows the last cell to be
|
---|
2531 | merged, call it itcLim.
|
---|
2532 |
|
---|
2533 | This sprm causes tap.rgtc[itcFirst].fFirstMerged to
|
---|
2534 | be set to 1. Cells in the range whose index is greater than itcFirst and
|
---|
2535 | less than itcLim have tap.rgtc[].fMerged set to 1. sprmTMerge is stored only
|
---|
2536 | in grpprls linked to piece table entries.
|
---|
2537 |
|
---|
2538 | */
|
---|
2539 | void wvApplysprmTMerge(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2540 | {
|
---|
2541 | U8 itcFirst = dgetc(NULL,&pointer);
|
---|
2542 | U8 itcLim = dgetc(NULL,&pointer);
|
---|
2543 | int i;
|
---|
2544 | (*pos)+=2;
|
---|
2545 |
|
---|
2546 | tap->rgtc[itcFirst].fFirstMerged = 1;
|
---|
2547 | for (i=itcFirst+1;i<itcLim;i++)
|
---|
2548 | tap->rgtc[i].fMerged = 1;
|
---|
2549 | }
|
---|
2550 |
|
---|
2551 | /*
|
---|
2552 | sprmTSplit (opcode 0x5625) splits the display areas of merged cells into
|
---|
2553 | their originally assigned display areas. Bytes 0 and 1 of the sprm contain
|
---|
2554 | the opcode. Byte 2 contains the index of the first cell that is to be split,
|
---|
2555 | call it itcFirst. Byte 3 contains the index of the cell that follows the
|
---|
2556 | last cell to be split, call it itcLim.
|
---|
2557 |
|
---|
2558 | This sprm clears
|
---|
2559 | tap.rgtc[].fFirstMerged and tap.rgtc[].fMerged for all rgtc entries >=
|
---|
2560 | itcFirst and < itcLim. sprmTSplit is stored only in grpprls linked to piece
|
---|
2561 | table entries.
|
---|
2562 | */
|
---|
2563 | void wvApplysprmTSplit(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2564 | {
|
---|
2565 | U8 itcFirst = dgetc(NULL,&pointer);
|
---|
2566 | U8 itcLim = dgetc(NULL,&pointer);
|
---|
2567 | int i;
|
---|
2568 | (*pos)+=2;
|
---|
2569 |
|
---|
2570 | for (i=itcFirst;i<itcLim;i++)
|
---|
2571 | {
|
---|
2572 | tap->rgtc[i].fMerged = 0;
|
---|
2573 | tap->rgtc[itcFirst].fFirstMerged = 0;
|
---|
2574 | }
|
---|
2575 | }
|
---|
2576 |
|
---|
2577 | /*
|
---|
2578 | This is guess based upon SetBrc
|
---|
2579 | */
|
---|
2580 | void wvApplysprmTSetBrc10(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2581 | {
|
---|
2582 | U8 itcFirst,itcLim,len,temp8;
|
---|
2583 | BRC10 abrc;
|
---|
2584 | int i;
|
---|
2585 | len = dgetc(NULL,&pointer);
|
---|
2586 | itcFirst = dgetc(NULL,&pointer);
|
---|
2587 | itcLim = dgetc(NULL,&pointer);
|
---|
2588 | temp8 = dgetc(NULL,&pointer);
|
---|
2589 | (*pos)+=3;
|
---|
2590 | (*pos) += wvGetBRC10FromBucket(&abrc,pointer);
|
---|
2591 |
|
---|
2592 | for (i=itcFirst;i<itcLim;i++)
|
---|
2593 | {
|
---|
2594 | if (temp8 & 0x08)
|
---|
2595 | wvConvertBRC10ToBRC(&tap->rgtc[i].brcRight,&abrc);
|
---|
2596 | if (temp8 & 0x04)
|
---|
2597 | wvConvertBRC10ToBRC(&tap->rgtc[i].brcBottom,&abrc);
|
---|
2598 | if (temp8 & 0x02)
|
---|
2599 | wvConvertBRC10ToBRC(&tap->rgtc[i].brcLeft,&abrc);
|
---|
2600 | if (temp8 & 0x01)
|
---|
2601 | wvConvertBRC10ToBRC(&tap->rgtc[i].brcTop,&abrc);
|
---|
2602 | }
|
---|
2603 | }
|
---|
2604 |
|
---|
2605 | /*
|
---|
2606 | sprmTSetShd (opcode 0x7627) allows the shading definitions(SHDs) within a
|
---|
2607 | tap to be set to new values. Bytes 0 and 1 of the sprm contain the opcode.
|
---|
2608 | Byte 2 contains the index of the first cell whose shading is to be changed,
|
---|
2609 | call it itcFirst. Byte 3 contains the index of the cell that follows the
|
---|
2610 | last cell whose shading is to be changed, call it itcLim. Bytes 4 and 5
|
---|
2611 | contain the SHD structure, call it shd. This sprm causes the itcLim -
|
---|
2612 | itcFirst entries of tap.rgshd to be set to shd. sprmTSetShd is stored only
|
---|
2613 | in grpprls linked to piece table entries.
|
---|
2614 | */
|
---|
2615 | void wvApplysprmTSetShd(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2616 | {
|
---|
2617 | U8 itcFirst = dgetc(NULL,&pointer);
|
---|
2618 | U8 itcLim = dgetc(NULL,&pointer);
|
---|
2619 | int i;
|
---|
2620 | SHD shd;
|
---|
2621 | (*pos)+=2;
|
---|
2622 |
|
---|
2623 | wvGetSHDFromBucket(&shd,pointer);
|
---|
2624 | (*pos)+=cbSHD;
|
---|
2625 |
|
---|
2626 | for(i=itcFirst;i<itcLim;i++)
|
---|
2627 | wvCopySHD(&tap->rgshd[i],&shd);
|
---|
2628 | }
|
---|
2629 |
|
---|
2630 | /*
|
---|
2631 | sprmTSetShdOdd (opcode 0x7628) is identical to sprmTSetShd, but it only
|
---|
2632 | changes the rgshd for odd indices between itcFirst and. sprmTSetShdOdd is
|
---|
2633 | stored only in grpprls linked to piece table entries.
|
---|
2634 | */
|
---|
2635 | void wvApplysprmTSetShdOdd(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2636 | {
|
---|
2637 | U8 itcFirst = dgetc(NULL,&pointer);
|
---|
2638 | U8 itcLim = dgetc(NULL,&pointer);
|
---|
2639 | int i;
|
---|
2640 | SHD shd;
|
---|
2641 | (*pos)+=2;
|
---|
2642 |
|
---|
2643 | wvGetSHDFromBucket(&shd,pointer);
|
---|
2644 | (*pos)+=cbSHD;
|
---|
2645 |
|
---|
2646 | for(i=itcFirst;i<itcLim;i++)
|
---|
2647 | {
|
---|
2648 | if ( (i/2) != (i+1)/2 )
|
---|
2649 | wvCopySHD(&tap->rgshd[i],&shd);
|
---|
2650 | }
|
---|
2651 | }
|
---|
2652 |
|
---|
2653 | /* guess */
|
---|
2654 | void wvApplysprmTTextFlow(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2655 | {
|
---|
2656 | U8 val = dgetc(NULL,&pointer);
|
---|
2657 | int i;
|
---|
2658 | (*pos)++;
|
---|
2659 |
|
---|
2660 | for (i=0;i<tap->itcMac;i++)
|
---|
2661 | {
|
---|
2662 | /* just a complete guess who knows*/
|
---|
2663 | tap->rgtc[i].fVertical = val&0x0001;
|
---|
2664 | tap->rgtc[i].fBackward = (val&0x0002)>>1;
|
---|
2665 | tap->rgtc[i].fRotateFont = (val&0x0004)>>2;
|
---|
2666 | }
|
---|
2667 | }
|
---|
2668 |
|
---|
2669 | /*
|
---|
2670 | sprmTVertMerge (opcode 0xD62B) changes the vertical cell merge properties
|
---|
2671 | for a cell in the tap.rgtc[]. Bytes 0 and 1 of the sprm contain the opcode.
|
---|
2672 | Byte 2 contains the index of the cell whose vertical cell merge properties
|
---|
2673 | are to be changed. Byte 3 codes the new vertical cell merge properties for
|
---|
2674 | the cell, a 0 clears both fVertMerge and fVertRestart, a 1 sets fVertMerge
|
---|
2675 | and clears fVertRestart, and a 3 sets both flags. sprmTVertMerge is stored
|
---|
2676 | only in grpprls linked to piece table entries.
|
---|
2677 | */
|
---|
2678 | void wvApplysprmTVertMerge(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2679 | {
|
---|
2680 | U8 index,props,count;
|
---|
2681 | wvTrace(("doing Vertical merge\n"));
|
---|
2682 |
|
---|
2683 | count = dgetc(NULL,&pointer);
|
---|
2684 | wvTrace(("count is %d\n",count)); /* check against word 8 please */
|
---|
2685 | index = dgetc(NULL,&pointer);
|
---|
2686 | props = dgetc(NULL,&pointer);
|
---|
2687 | (*pos)+=3;
|
---|
2688 |
|
---|
2689 | switch(props)
|
---|
2690 | {
|
---|
2691 | case 0:
|
---|
2692 | tap->rgtc[index].fVertMerge = 0;
|
---|
2693 | tap->rgtc[index].fVertRestart = 0;
|
---|
2694 | break;
|
---|
2695 | case 1:
|
---|
2696 | tap->rgtc[index].fVertMerge = 1;
|
---|
2697 | tap->rgtc[index].fVertRestart = 0;
|
---|
2698 | break;
|
---|
2699 | case 3:
|
---|
2700 | tap->rgtc[index].fVertMerge = 1;
|
---|
2701 | tap->rgtc[index].fVertRestart = 1;
|
---|
2702 | break;
|
---|
2703 | }
|
---|
2704 | }
|
---|
2705 |
|
---|
2706 | /*
|
---|
2707 | sprmTVertAlign (opcode 0xD62C) changes the vertical alignment property in
|
---|
2708 | the tap.rgtc[]. Bytes 0 and 1 of the sprm contain the opcode. Byte 2
|
---|
2709 | contains the index of the first cell whose shading is to be changed, call it
|
---|
2710 | itcFirst. Byte 3 contains the index of the cell that follows the last cell
|
---|
2711 | whose shading is to be changed, call it itcLim. This sprm causes the
|
---|
2712 | vertAlign properties of the itcLim - itcFirst entries of tap.rgtc[] to be
|
---|
2713 | set to the new vertical alignment property contained in Byte 4.
|
---|
2714 | sprmTVertAlign is stored only in grpprls linked to piece table entries.
|
---|
2715 | */
|
---|
2716 | void wvApplysprmTVertAlign(TAP *tap,U8 *pointer,U16 *pos)
|
---|
2717 | {
|
---|
2718 | U8 itcFirst = dgetc(NULL,&pointer);
|
---|
2719 | U8 itcLim = dgetc(NULL,&pointer);
|
---|
2720 | U8 props = dgetc(NULL,&pointer);
|
---|
2721 | int i;
|
---|
2722 | (*pos)+=3;
|
---|
2723 |
|
---|
2724 | for (i=itcFirst;i<itcLim;i++)
|
---|
2725 | tap->rgtc[i].vertAlign = props;
|
---|
2726 | }
|
---|
2727 |
|
---|
2728 | SprmName rgsprmPrm[0x80] =
|
---|
2729 | {sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmPIncLvl, sprmPJc,
|
---|
2730 | sprmPFSideBySide, sprmPFKeep, sprmPFKeepFollow, sprmPFPageBreakBefore,
|
---|
2731 | sprmPBrcl, sprmPBrcp, sprmPIlvl, sprmNoop, sprmPFNoLineNumb, sprmNoop,
|
---|
2732 | sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop,
|
---|
2733 | sprmNoop, sprmPFInTable, sprmPFTtp, sprmNoop, sprmNoop, sprmNoop, sprmPPc,
|
---|
2734 | sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop,
|
---|
2735 | sprmPWr, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop,
|
---|
2736 | sprmPFNoAutoHyph, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop,
|
---|
2737 | sprmPFLocked, sprmPFWidowControl, sprmNoop, sprmPFKinsoku, sprmPFWordWrap,
|
---|
2738 | sprmPFOverflowPunct, sprmPFTopLinePunct, sprmPFAutoSpaceDE,
|
---|
2739 | sprmPFAutoSpaceDN, sprmNoop, sprmNoop, sprmPISnapBaseLine, sprmNoop,
|
---|
2740 | sprmNoop, sprmNoop, sprmCFStrikeRM, sprmCFRMark, sprmCFFldVanish, sprmNoop,
|
---|
2741 | sprmNoop, sprmNoop, sprmCFData, sprmNoop, sprmNoop, sprmNoop, sprmCFOle2,
|
---|
2742 | sprmNoop, sprmCHighlight, sprmCFEmboss, sprmCSfxText, sprmNoop, sprmNoop,
|
---|
2743 | sprmNoop, sprmCPlain, sprmNoop, sprmCFBold, sprmCFItalic, sprmCFStrike,
|
---|
2744 | sprmCFOutline, sprmCFShadow, sprmCFSmallCaps, sprmCFCaps, sprmCFVanish,
|
---|
2745 | sprmNoop, sprmCKul, sprmNoop, sprmNoop, sprmNoop, sprmCIco, sprmNoop,
|
---|
2746 | sprmCHpsInc, sprmNoop, sprmCHpsPosAdj, sprmNoop, sprmCIss, sprmNoop,
|
---|
2747 | sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop,
|
---|
2748 | sprmNoop, sprmNoop, sprmCFDStrike, sprmCFImprint, sprmCFSpec, sprmCFObj,
|
---|
2749 | sprmPicBrcl, sprmPOutLvl, sprmNoop, sprmNoop, sprmNoop, sprmNoop, sprmNoop,
|
---|
2750 | sprmPPnbrRMarkNot};
|
---|
2751 |
|
---|
2752 | SprmName wvGetrgsprmPrm(U16 in)
|
---|
2753 | {
|
---|
2754 | if (in > 0x80)
|
---|
2755 | {
|
---|
2756 | wvError(("Impossible rgsprmPrm value\n"));
|
---|
2757 | return(sprmNoop);
|
---|
2758 | }
|
---|
2759 | return(rgsprmPrm[in]);
|
---|
2760 | }
|
---|
2761 |
|
---|
2762 |
|
---|
2763 | SprmName rgsprmWord6[256] =
|
---|
2764 | {
|
---|
2765 | sprmNoop/* 0*/,
|
---|
2766 | sprmNoop/* 1*/,
|
---|
2767 | sprmPIstd/* 2*/,
|
---|
2768 | sprmPIstdPermute/* 3*/,
|
---|
2769 | sprmPIncLvl/* 4*/,
|
---|
2770 | sprmPJc/* 5*/,
|
---|
2771 | sprmPFSideBySide/* 6*/,
|
---|
2772 | sprmPFKeep/* 7*/,
|
---|
2773 | sprmPFKeepFollow/* 8*/,
|
---|
2774 | sprmPFPageBreakBefore/* 9*/, /* added F */
|
---|
2775 | sprmPBrcl/* 10*/,
|
---|
2776 | sprmPBrcp/* 11*/,
|
---|
2777 | sprmPAnld/* 12*/,
|
---|
2778 | sprmPNLvlAnm/* 13*/,
|
---|
2779 | sprmPFNoLineNumb/* 14*/,
|
---|
2780 | sprmPChgTabsPapx/* 15*/,
|
---|
2781 | sprmPDxaRight/* 16*/,
|
---|
2782 | sprmPDxaLeft/* 17*/,
|
---|
2783 | sprmPNest/* 18*/,
|
---|
2784 | sprmPDxaLeft1/* 19*/,
|
---|
2785 | sprmPDyaLine/* 20*/,
|
---|
2786 | sprmPDyaBefore/* 21*/,
|
---|
2787 | sprmPDyaAfter/* 22*/,
|
---|
2788 | sprmPChgTabs/* 23*/,
|
---|
2789 | sprmPFInTable/* 24*/,
|
---|
2790 | sprmPFTtp/* 25*/, /* added F */
|
---|
2791 | sprmPDxaAbs/* 26*/,
|
---|
2792 | sprmPDyaAbs/* 27*/,
|
---|
2793 | sprmPDxaWidth/* 28*/,
|
---|
2794 | sprmPPc/* 29*/,
|
---|
2795 | sprmPBrcTop10/* 30*/,
|
---|
2796 | sprmPBrcLeft10/* 31*/,
|
---|
2797 | sprmPBrcBottom10/* 32*/,
|
---|
2798 | sprmPBrcRight10/* 33*/,
|
---|
2799 | sprmPBrcBetween10/* 34*/,
|
---|
2800 | sprmPBrcBar10/* 35*/,
|
---|
2801 | sprmPDxaFromText10/* 36*/, /* new name */
|
---|
2802 | sprmPWr/* 37*/,
|
---|
2803 | sprmPBrcTop/* 38*/,
|
---|
2804 | sprmPBrcLeft/* 39*/,
|
---|
2805 | sprmPBrcBottom/* 40*/,
|
---|
2806 | sprmPBrcRight/* 41*/,
|
---|
2807 | sprmPBrcBetween/* 42*/,
|
---|
2808 | sprmPBrcBar/* 43*/,
|
---|
2809 | sprmPFNoAutoHyph/* 44*/,
|
---|
2810 | sprmPWHeightAbs/* 45*/,
|
---|
2811 | sprmPDcs/* 46*/,
|
---|
2812 | sprmPShd/* 47*/,
|
---|
2813 | sprmPDyaFromText/* 48*/,
|
---|
2814 | sprmPDxaFromText/* 49*/,
|
---|
2815 | sprmPFLocked/* 50*/,
|
---|
2816 | sprmPFWidowControl/* 51*/,
|
---|
2817 | sprmNoop/* 52*/,
|
---|
2818 | sprmNoop/* 53*/,
|
---|
2819 | sprmNoop/* 54*/,
|
---|
2820 | sprmNoop/* 55*/,
|
---|
2821 | sprmNoop/* 56*/,
|
---|
2822 | sprmPUNKNOWN2/* 57*/,
|
---|
2823 | sprmPUNKNOWN3/* 58*/,
|
---|
2824 | sprmPUNKNOWN4/* 59*/,
|
---|
2825 | sprmNoop/* 60*/,
|
---|
2826 | sprmNoop/* 61*/,
|
---|
2827 | sprmNoop/* 62*/,
|
---|
2828 | sprmNoop/* 63*/,
|
---|
2829 | sprmNoop/* 64*/,
|
---|
2830 | sprmCFStrikeRM/* 65*/,
|
---|
2831 | sprmCFRMark/* 66*/,
|
---|
2832 | sprmCFFldVanish/* 67*/,
|
---|
2833 | sprmCPicLocation/* 68*/,
|
---|
2834 | sprmCIbstRMark/* 69*/,
|
---|
2835 | sprmCDttmRMark/* 70*/,
|
---|
2836 | sprmCFData/* 71*/,
|
---|
2837 | sprmCIdslRMark/* 72*/, /* new name */
|
---|
2838 | sprmCChs/* 73*/, /* new name */
|
---|
2839 | sprmCSymbol/* 74*/,
|
---|
2840 | sprmCFOle2/* 75*/,
|
---|
2841 | sprmNoop/* 76*/,
|
---|
2842 | sprmNoop/* 77*/,
|
---|
2843 | sprmNoop/* 78*/,
|
---|
2844 | sprmNoop/* 79*/,
|
---|
2845 | sprmCIstd/* 80*/,
|
---|
2846 | sprmCIstdPermute/* 81*/,
|
---|
2847 | sprmCDefault/* 82*/,
|
---|
2848 | sprmCPlain/* 83*/,
|
---|
2849 | sprmNoop/* 84*/,
|
---|
2850 | sprmCFBold/* 85*/,
|
---|
2851 | sprmCFItalic/* 86*/,
|
---|
2852 | sprmCFStrike/* 87*/,
|
---|
2853 | sprmCFOutline/* 88*/,
|
---|
2854 | sprmCFShadow/* 89*/,
|
---|
2855 | sprmCFSmallCaps/* 90*/,
|
---|
2856 | sprmCFCaps/* 91*/,
|
---|
2857 | sprmCFVanish/* 92*/,
|
---|
2858 | sprmCFtc/* 93*/,
|
---|
2859 | sprmCKul/* 94*/,
|
---|
2860 | sprmCSizePos/* 95*/,
|
---|
2861 | sprmCDxaSpace/* 96*/,
|
---|
2862 | sprmCLid/* 97*/,
|
---|
2863 | sprmCIco/* 98*/,
|
---|
2864 | sprmCHps/* 99*/,
|
---|
2865 | sprmCHpsInc/* 100*/,
|
---|
2866 | sprmCHpsPos/* 101*/,
|
---|
2867 | sprmCHpsPosAdj/* 102*/,
|
---|
2868 | sprmCMajority/* 103*/,
|
---|
2869 | sprmCIss/* 104*/,
|
---|
2870 | sprmCHpsNew50/* 105*/,
|
---|
2871 | sprmCHpsInc1/* 106*/,
|
---|
2872 | sprmCHpsKern/* 107*/,
|
---|
2873 | sprmCMajority50/* 108*/,
|
---|
2874 | sprmCHpsMul/* 109*/,
|
---|
2875 | sprmCYsri/* 110*/, /* new name */
|
---|
2876 | sprmCUNKNOWN5/* 111*/,
|
---|
2877 | sprmCUNKNOWN6/* 112*/,
|
---|
2878 | sprmCUNKNOWN7/* 113*/,
|
---|
2879 | sprmNoop/* 114*/,
|
---|
2880 | sprmNoop/* 115*/,
|
---|
2881 | sprmNoop/* 116*/,
|
---|
2882 | sprmCFSpec/* 117*/,
|
---|
2883 | sprmCFObj/* 118*/,
|
---|
2884 | sprmPicBrcl/* 119*/,
|
---|
2885 | sprmPicScale/* 120*/,
|
---|
2886 | sprmPicBrcTop/* 121*/,
|
---|
2887 | sprmPicBrcLeft/* 122*/,
|
---|
2888 | sprmPicBrcBottom/* 123*/,
|
---|
2889 | sprmPicBrcRight/* 124*/,
|
---|
2890 | sprmNoop/* 125*/,
|
---|
2891 | sprmNoop/* 126*/,
|
---|
2892 | sprmNoop/* 127*/,
|
---|
2893 | sprmNoop/* 128*/,
|
---|
2894 | sprmNoop/* 129*/,
|
---|
2895 | sprmNoop/* 130*/,
|
---|
2896 | sprmScnsPgn/* 131*/, /* new name */
|
---|
2897 | sprmSiHeadingPgn/* 132*/,
|
---|
2898 | sprmSOlstAnm/* 133*/,
|
---|
2899 | sprmNoop/* 134*/,
|
---|
2900 | sprmNoop/* 135*/,
|
---|
2901 | sprmSDxaColWidth/* 136*/,
|
---|
2902 | sprmSDxaColWidth/* 137*/, /* new name */
|
---|
2903 | sprmSFEvenlySpaced/*138*/,
|
---|
2904 | sprmSFProtected/* 139*/,
|
---|
2905 | sprmSDmBinFirst/* 140*/,
|
---|
2906 | sprmSDmBinOther/* 141*/,
|
---|
2907 | sprmSBkc/* 142*/,
|
---|
2908 | sprmSFTitlePage/* 143*/,
|
---|
2909 | sprmSCcolumns/* 144*/,
|
---|
2910 | sprmSDxaColumns/* 145*/,
|
---|
2911 | sprmSFAutoPgn/* 146*/,
|
---|
2912 | sprmSNfcPgn/* 147*/,
|
---|
2913 | sprmSDyaPgn/* 148*/,
|
---|
2914 | sprmSDxaPgn/* 149*/,
|
---|
2915 | sprmSFPgnRestart/* 150*/,
|
---|
2916 | sprmSFEndnote/* 151*/,
|
---|
2917 | sprmSLnc/* 152*/,
|
---|
2918 | sprmSGprfIhdt/* 153*/,
|
---|
2919 | sprmSNLnnMod/* 154*/,
|
---|
2920 | sprmSDxaLnn/* 155*/,
|
---|
2921 | sprmSDyaHdrTop/* 156*/,
|
---|
2922 | sprmSDyaHdrBottom/* 157*/,
|
---|
2923 | sprmNoop/* 158*/,
|
---|
2924 | sprmSVjc/* 159*/,
|
---|
2925 | sprmSLnnMin/* 160*/,
|
---|
2926 | sprmSPgnStart/* 161*/,
|
---|
2927 | sprmSBOrientation/* 162*/,
|
---|
2928 | sprmSBCustomize/* 163*/,
|
---|
2929 | sprmSXaPage/* 164*/,
|
---|
2930 | sprmSYaPage/* 165*/,
|
---|
2931 | sprmSDxaLeft/* 166*/,
|
---|
2932 | sprmSDxaRight/* 167*/,
|
---|
2933 | sprmSDyaTop/* 168*/,
|
---|
2934 | sprmSDyaBottom/* 169*/,
|
---|
2935 | sprmSDzaGutter/* 170*/,
|
---|
2936 | sprmSDmPaperReq/* 171*/,
|
---|
2937 | sprmNoop/* 172*/,
|
---|
2938 | sprmNoop/* 173*/,
|
---|
2939 | sprmNoop/* 174*/,
|
---|
2940 | sprmNoop/* 175*/,
|
---|
2941 | sprmNoop/* 176*/,
|
---|
2942 | sprmNoop/* 177*/,
|
---|
2943 | sprmNoop/* 178*/,
|
---|
2944 | sprmNoop/* 179*/,
|
---|
2945 | sprmNoop/* 180*/,
|
---|
2946 | sprmNoop/* 181*/,
|
---|
2947 | sprmTJc/* 182*/,
|
---|
2948 | sprmTDxaLeft/* 183*/,
|
---|
2949 | sprmTDxaGapHalf/* 184*/,
|
---|
2950 | sprmTFCantSplit/* 185*/,
|
---|
2951 | sprmTTableHeader/* 186*/,
|
---|
2952 | sprmTTableBorders/* 187*/,
|
---|
2953 | sprmTDefTable10/* 188*/,
|
---|
2954 | sprmTDyaRowHeight/* 189*/,
|
---|
2955 | sprmTDefTable/* 190*/,
|
---|
2956 | sprmTDefTableShd/* 191*/,
|
---|
2957 | sprmTTlp/* 192*/,
|
---|
2958 | sprmTSetBrc/* 193*/,
|
---|
2959 | sprmTInsert/* 194*/,
|
---|
2960 | sprmTDelete/* 195*/,
|
---|
2961 | sprmTDxaCol/* 196*/,
|
---|
2962 | sprmTMerge/* 197*/,
|
---|
2963 | sprmTSplit/* 198*/,
|
---|
2964 | sprmTSetBrc10/* 199*/,
|
---|
2965 | sprmTSetShd/* 200*/,
|
---|
2966 | sprmNoop/* 201*/,
|
---|
2967 | sprmNoop/* 202*/,
|
---|
2968 | sprmNoop/* 203*/,
|
---|
2969 |
|
---|
2970 | sprmTUNKNOWN1/* 204*/,
|
---|
2971 | /*guess I know that this should be either
|
---|
2972 | * a) 3 bytes long,
|
---|
2973 | * b) complex with a len of 2,
|
---|
2974 | * its certainly a table related sprm, my guess is sprmTVertMerge
|
---|
2975 | * as that fits its profile, but it isn't working in practice.
|
---|
2976 | * */
|
---|
2977 | #if 0
|
---|
2978 | sprmNoop/* 205*/,
|
---|
2979 | sprmNoop/* 206*/,
|
---|
2980 | sprmNoop/* 207*/,
|
---|
2981 | sprmMax/* 208*/
|
---|
2982 | #endif
|
---|
2983 | };
|
---|
2984 |
|
---|
2985 | SprmName wvGetrgsprmWord6(U8 in)
|
---|
2986 | {
|
---|
2987 | return(rgsprmWord6[in]);
|
---|
2988 | }
|
---|