1 /* This file is part of the wvWare 2 project
2 Copyright (C) 2001 Werner Trobin <trobin@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 Boston, MA 02111-1307, USA.
17 */
18
19 // This code is generated from the Microsoft HTML specification of the
20 // WinWord format. Do NOT edit this code, but fix the spec or the script
21 // generating the sources. If you want to add some additional code, some
22 // includes or any other stuff, please add it to the template file!
23 // For information about the script and the "hidden features" please read
24 // the comments at the begin of the script.
25
26 // If you find bugs or strange behavior please contact Werner Trobin
27 // <trobin@kde.org>
28
29 #include <word97_generated.h>
30 #include <olestream.h>
31 #include <string.h> // memset(), memcpy()
32 #include "wvlog.h"
33
34 namespace wvWare {
35
36 namespace Word97 {
37
38 // FFN implementation, located in template-Word97.cpp
FFN()39 FFN::FFN() {
40 clearInternal();
41 }
42
FFN(OLEStreamReader * stream,Version version,bool preservePos)43 FFN::FFN(OLEStreamReader *stream, Version version, bool preservePos) {
44 clearInternal();
45 read(stream, version, preservePos);
46 }
47
read(OLEStreamReader * stream,Version version,bool preservePos)48 bool FFN::read(OLEStreamReader *stream, Version version, bool preservePos) {
49
50 U8 shifterU8;
51
52 if(preservePos)
53 stream->push();
54
55 cbFfnM1=stream->readU8();
56 shifterU8=stream->readU8();
57 prq=shifterU8;
58 shifterU8>>=2;
59 fTrueType=shifterU8;
60 shifterU8>>=1;
61 unused1_3=shifterU8;
62 shifterU8>>=1;
63 ff=shifterU8;
64 shifterU8>>=3;
65 unused1_7=shifterU8;
66 wWeight=stream->readS16();
67 chs=stream->readU8();
68 ixchSzAlt=stream->readU8();
69
70 U8 remainingSize = cbFfnM1 - 5;
71
72 if ( version == Word97 ) {
73 for(int _i=0; _i<(10); ++_i)
74 panose[_i]=stream->readU8();
75 for(int _i=0; _i<(24); ++_i)
76 fs[_i]=stream->readU8();
77 remainingSize -= 34;
78
79 // Remaining size in bytes -> shorts
80 remainingSize /= 2;
81 XCHAR* string = new XCHAR[ remainingSize ];
82 for ( int i = 0; i < remainingSize; ++i )
83 string[ i ] = stream->readU16();
84 if ( ixchSzAlt == 0 )
85 xszFfn = UString( reinterpret_cast<const wvWare::UChar *>( string ), remainingSize - 1 );
86 else {
87 xszFfn = UString( reinterpret_cast<const wvWare::UChar *>( string ), ixchSzAlt - 1 );
88 xszFfnAlt = UString( reinterpret_cast<const wvWare::UChar *>( &string[ ixchSzAlt ] ), remainingSize - 1 - ixchSzAlt );
89 }
90 delete [] string;
91 }
92 else {
93 U8* string = new U8[ remainingSize ];
94 stream->read( string, remainingSize );
95 // ###### Assume plain latin1 strings, maybe we'll have to use a textconverter here...
96 if ( ixchSzAlt == 0 )
97 xszFfn = UString( reinterpret_cast<char*>( string ) );
98 else {
99 xszFfn = UString( reinterpret_cast<char*>( string ) ); // The strings are 0-terminated, according to the SPEC
100 xszFfnAlt = UString( reinterpret_cast<char*>( &string[ ixchSzAlt ] ) );
101 }
102 delete [] string;
103 }
104
105 if(preservePos)
106 stream->pop();
107 return true;
108 }
109
clear()110 void FFN::clear() {
111 clearInternal();
112 }
113
clearInternal()114 void FFN::clearInternal() {
115 cbFfnM1=0;
116 prq=0;
117 fTrueType=0;
118 unused1_3=0;
119 ff=0;
120 unused1_7=0;
121 wWeight=0;
122 chs=0;
123 ixchSzAlt=0;
124 for(int _i=0; _i<(10); ++_i)
125 panose[_i]=0;
126 for(int _i=0; _i<(24); ++_i)
127 fs[_i]=0;
128 xszFfn = UString::null;
129 xszFfnAlt = UString::null;
130 }
131
132 // There can be only one tab at a given position, no matter what the other options are
operator ==(const TabDescriptor & lhs,const TabDescriptor & rhs)133 bool operator==( const TabDescriptor& lhs, const TabDescriptor& rhs ) { return lhs.dxaTab == rhs.dxaTab; }
operator !=(const TabDescriptor & lhs,const TabDescriptor & rhs)134 bool operator!=( const TabDescriptor& lhs, const TabDescriptor& rhs ) { return lhs.dxaTab != rhs.dxaTab; }
operator <(const TabDescriptor & lhs,const TabDescriptor & rhs)135 bool operator<( const TabDescriptor& lhs, const TabDescriptor& rhs ) { return lhs.dxaTab < rhs.dxaTab; }
operator >(const TabDescriptor & lhs,const TabDescriptor & rhs)136 bool operator>( const TabDescriptor& lhs, const TabDescriptor& rhs ) { return lhs.dxaTab > rhs.dxaTab; }
137
138
139 // DTTM implementation
140
141 const unsigned int DTTM::sizeOf = 4;
142
DTTM()143 DTTM::DTTM() {
144 clear();
145 }
146
DTTM(OLEStreamReader * stream,bool preservePos)147 DTTM::DTTM(OLEStreamReader *stream, bool preservePos) {
148 clear();
149 read(stream, preservePos);
150 }
151
DTTM(const U8 * ptr)152 DTTM::DTTM(const U8 *ptr) {
153 clear();
154 readPtr(ptr);
155 }
156
read(OLEStreamReader * stream,bool preservePos)157 bool DTTM::read(OLEStreamReader *stream, bool preservePos) {
158
159 U16 shifterU16;
160
161 if(preservePos)
162 stream->push();
163
164 shifterU16=stream->readU16();
165 mint=shifterU16;
166 shifterU16>>=6;
167 hr=shifterU16;
168 shifterU16>>=5;
169 dom=shifterU16;
170 shifterU16=stream->readU16();
171 mon=shifterU16;
172 shifterU16>>=4;
173 yr=shifterU16;
174 shifterU16>>=9;
175 wdy=shifterU16;
176
177 if(preservePos)
178 stream->pop();
179 return true;
180 }
181
readPtr(const U8 * ptr)182 void DTTM::readPtr(const U8 *ptr) {
183
184 U16 shifterU16;
185
186 shifterU16=readU16(ptr);
187 ptr+=sizeof(U16);
188 mint=shifterU16;
189 shifterU16>>=6;
190 hr=shifterU16;
191 shifterU16>>=5;
192 dom=shifterU16;
193 shifterU16=readU16(ptr);
194 ptr+=sizeof(U16);
195 mon=shifterU16;
196 shifterU16>>=4;
197 yr=shifterU16;
198 shifterU16>>=9;
199 wdy=shifterU16;
200 }
201
write(OLEStreamWriter * stream,bool preservePos) const202 bool DTTM::write(OLEStreamWriter *stream, bool preservePos) const {
203
204 U16 shifterU16;
205
206 if(preservePos)
207 stream->push();
208
209 shifterU16=mint;
210 shifterU16|=hr << 6;
211 shifterU16|=dom << 11;
212 stream->write(shifterU16);
213 shifterU16=mon;
214 shifterU16|=yr << 4;
215 shifterU16|=wdy << 13;
216 stream->write(shifterU16);
217
218 if(preservePos)
219 stream->pop();
220 return true;
221 }
222
clear()223 void DTTM::clear() {
224 mint=0;
225 hr=0;
226 dom=0;
227 mon=0;
228 yr=0;
229 wdy=0;
230 }
231
dump() const232 void DTTM::dump() const
233 {
234 wvlog << "Dumping DTTM:" << std::endl;
235 wvlog << toString().c_str() << std::endl;
236 wvlog << "\nDumping DTTM done." << std::endl;
237 }
238
toString() const239 std::string DTTM::toString() const
240 {
241 std::string s( "DTTM:" );
242 s += "\nmint=";
243 s += uint2string( mint );
244 s += "\nhr=";
245 s += uint2string( hr );
246 s += "\ndom=";
247 s += uint2string( dom );
248 s += "\nmon=";
249 s += uint2string( mon );
250 s += "\nyr=";
251 s += uint2string( yr );
252 s += "\nwdy=";
253 s += uint2string( wdy );
254 s += "\nDTTM Done.";
255 return s;
256 }
257
operator ==(const DTTM & lhs,const DTTM & rhs)258 bool operator==(const DTTM &lhs, const DTTM &rhs) {
259
260 return lhs.mint==rhs.mint &&
261 lhs.hr==rhs.hr &&
262 lhs.dom==rhs.dom &&
263 lhs.mon==rhs.mon &&
264 lhs.yr==rhs.yr &&
265 lhs.wdy==rhs.wdy;
266 }
267
operator !=(const DTTM & lhs,const DTTM & rhs)268 bool operator!=(const DTTM &lhs, const DTTM &rhs) {
269 return !(lhs==rhs);
270 }
271
272
273 // DOPTYPOGRAPHY implementation
274
DOPTYPOGRAPHY()275 DOPTYPOGRAPHY::DOPTYPOGRAPHY() {
276 clear();
277 }
278
DOPTYPOGRAPHY(OLEStreamReader * stream,bool preservePos)279 DOPTYPOGRAPHY::DOPTYPOGRAPHY(OLEStreamReader *stream, bool preservePos) {
280 clear();
281 read(stream, preservePos);
282 }
283
read(OLEStreamReader * stream,bool preservePos)284 bool DOPTYPOGRAPHY::read(OLEStreamReader *stream, bool preservePos) {
285
286 U16 shifterU16;
287
288 if(preservePos)
289 stream->push();
290
291 shifterU16=stream->readU16();
292 fKerningPunct=shifterU16;
293 shifterU16>>=1;
294 iJustification=shifterU16;
295 shifterU16>>=2;
296 iLevelOfKinsoku=shifterU16;
297 shifterU16>>=2;
298 f2on1=shifterU16;
299 shifterU16>>=1;
300 unused0_6=shifterU16;
301 cchFollowingPunct=stream->readS16();
302 cchLeadingPunct=stream->readS16();
303 for(int _i=0; _i<(101); ++_i)
304 rgxchFPunct[_i]=stream->readU16();
305 for(int _i=0; _i<(51); ++_i)
306 rgxchLPunct[_i]=stream->readU16();
307
308 if(preservePos)
309 stream->pop();
310 return true;
311 }
312
write(OLEStreamWriter * stream,bool preservePos) const313 bool DOPTYPOGRAPHY::write(OLEStreamWriter *stream, bool preservePos) const {
314
315 U16 shifterU16;
316
317 if(preservePos)
318 stream->push();
319
320 shifterU16=fKerningPunct;
321 shifterU16|=iJustification << 1;
322 shifterU16|=iLevelOfKinsoku << 3;
323 shifterU16|=f2on1 << 5;
324 shifterU16|=unused0_6 << 6;
325 stream->write(shifterU16);
326 stream->write(cchFollowingPunct);
327 stream->write(cchLeadingPunct);
328 for(int _i=0; _i<(101); ++_i)
329 stream->write(rgxchFPunct[_i]);
330 for(int _i=0; _i<(51); ++_i)
331 stream->write(rgxchLPunct[_i]);
332
333 if(preservePos)
334 stream->pop();
335 return true;
336 }
337
clear()338 void DOPTYPOGRAPHY::clear() {
339 fKerningPunct=0;
340 iJustification=0;
341 iLevelOfKinsoku=0;
342 f2on1=0;
343 unused0_6=0;
344 cchFollowingPunct=0;
345 cchLeadingPunct=0;
346 for(int _i=0; _i<(101); ++_i)
347 rgxchFPunct[_i]=0;
348 for(int _i=0; _i<(51); ++_i)
349 rgxchLPunct[_i]=0;
350 }
351
operator ==(const DOPTYPOGRAPHY & lhs,const DOPTYPOGRAPHY & rhs)352 bool operator==(const DOPTYPOGRAPHY &lhs, const DOPTYPOGRAPHY &rhs) {
353
354 for(int _i=0; _i<(101); ++_i) {
355 if(lhs.rgxchFPunct[_i]!=rhs.rgxchFPunct[_i])
356 return false;
357 }
358
359 for(int _i=0; _i<(51); ++_i) {
360 if(lhs.rgxchLPunct[_i]!=rhs.rgxchLPunct[_i])
361 return false;
362 }
363
364 return lhs.fKerningPunct==rhs.fKerningPunct &&
365 lhs.iJustification==rhs.iJustification &&
366 lhs.iLevelOfKinsoku==rhs.iLevelOfKinsoku &&
367 lhs.f2on1==rhs.f2on1 &&
368 lhs.unused0_6==rhs.unused0_6 &&
369 lhs.cchFollowingPunct==rhs.cchFollowingPunct &&
370 lhs.cchLeadingPunct==rhs.cchLeadingPunct;
371 }
372
operator !=(const DOPTYPOGRAPHY & lhs,const DOPTYPOGRAPHY & rhs)373 bool operator!=(const DOPTYPOGRAPHY &lhs, const DOPTYPOGRAPHY &rhs) {
374 return !(lhs==rhs);
375 }
376
377
378 // PRM2 implementation
379
PRM2()380 PRM2::PRM2() {
381 clear();
382 }
383
PRM2(OLEStreamReader * stream,bool preservePos)384 PRM2::PRM2(OLEStreamReader *stream, bool preservePos) {
385 clear();
386 read(stream, preservePos);
387 }
388
read(OLEStreamReader * stream,bool preservePos)389 bool PRM2::read(OLEStreamReader *stream, bool preservePos) {
390
391 U16 shifterU16;
392
393 if(preservePos)
394 stream->push();
395
396 shifterU16=stream->readU16();
397 fComplex=shifterU16;
398 shifterU16>>=1;
399 igrpprl=shifterU16;
400
401 if(preservePos)
402 stream->pop();
403 return true;
404 }
405
write(OLEStreamWriter * stream,bool preservePos) const406 bool PRM2::write(OLEStreamWriter *stream, bool preservePos) const {
407
408 U16 shifterU16;
409
410 if(preservePos)
411 stream->push();
412
413 shifterU16=fComplex;
414 shifterU16|=igrpprl << 1;
415 stream->write(shifterU16);
416
417 if(preservePos)
418 stream->pop();
419 return true;
420 }
421
clear()422 void PRM2::clear() {
423 fComplex=0;
424 igrpprl=0;
425 }
426
operator ==(const PRM2 & lhs,const PRM2 & rhs)427 bool operator==(const PRM2 &lhs, const PRM2 &rhs) {
428
429 return lhs.fComplex==rhs.fComplex &&
430 lhs.igrpprl==rhs.igrpprl;
431 }
432
operator !=(const PRM2 & lhs,const PRM2 & rhs)433 bool operator!=(const PRM2 &lhs, const PRM2 &rhs) {
434 return !(lhs==rhs);
435 }
436
437
438 // PRM implementation
439
440 const unsigned int PRM::sizeOf = 2;
441
PRM()442 PRM::PRM() {
443 clear();
444 }
445
PRM(OLEStreamReader * stream,bool preservePos)446 PRM::PRM(OLEStreamReader *stream, bool preservePos) {
447 clear();
448 read(stream, preservePos);
449 }
450
PRM(const U8 * ptr)451 PRM::PRM(const U8 *ptr) {
452 clear();
453 readPtr(ptr);
454 }
455
read(OLEStreamReader * stream,bool preservePos)456 bool PRM::read(OLEStreamReader *stream, bool preservePos) {
457
458 U16 shifterU16;
459
460 if(preservePos)
461 stream->push();
462
463 shifterU16=stream->readU16();
464 fComplex=shifterU16;
465 shifterU16>>=1;
466 isprm=shifterU16;
467 shifterU16>>=7;
468 val=shifterU16;
469
470 if(preservePos)
471 stream->pop();
472 return true;
473 }
474
readPtr(const U8 * ptr)475 void PRM::readPtr(const U8 *ptr) {
476
477 U16 shifterU16;
478
479 shifterU16=readU16(ptr);
480 ptr+=sizeof(U16);
481 fComplex=shifterU16;
482 shifterU16>>=1;
483 isprm=shifterU16;
484 shifterU16>>=7;
485 val=shifterU16;
486 }
487
write(OLEStreamWriter * stream,bool preservePos) const488 bool PRM::write(OLEStreamWriter *stream, bool preservePos) const {
489
490 U16 shifterU16;
491
492 if(preservePos)
493 stream->push();
494
495 shifterU16=fComplex;
496 shifterU16|=isprm << 1;
497 shifterU16|=val << 8;
498 stream->write(shifterU16);
499
500 if(preservePos)
501 stream->pop();
502 return true;
503 }
504
clear()505 void PRM::clear() {
506 fComplex=0;
507 isprm=0;
508 val=0;
509 }
510
operator ==(const PRM & lhs,const PRM & rhs)511 bool operator==(const PRM &lhs, const PRM &rhs) {
512
513 return lhs.fComplex==rhs.fComplex &&
514 lhs.isprm==rhs.isprm &&
515 lhs.val==rhs.val;
516 }
517
operator !=(const PRM & lhs,const PRM & rhs)518 bool operator!=(const PRM &lhs, const PRM &rhs) {
519 return !(lhs==rhs);
520 }
521
522
523 // SHD implementation
524
525 const unsigned int SHD::sizeOf = 10;
526
SHD()527 SHD::SHD() {
528 clear();
529 }
530
SHD(OLEStreamReader * stream,bool preservePos)531 SHD::SHD(OLEStreamReader *stream, bool preservePos) {
532 clear();
533 read(stream, preservePos);
534 }
535
SHD(const U8 * ptr)536 SHD::SHD(const U8 *ptr) {
537 clear();
538 readPtr(ptr);
539 }
540
read(OLEStreamReader * stream,bool preservePos)541 bool SHD::read(OLEStreamReader *stream, bool preservePos) {
542
543 U16 shifterU16;
544 U16 ico;
545
546 if(preservePos)
547 stream->push();
548
549 shifterU16=stream->readU16();
550 ico=shifterU16;
551 cvFore=Word97::icoToRGB(ico);
552 shifterU16>>=5;
553 ico=shifterU16;
554 cvBack=Word97::icoToRGB(ico);
555 shifterU16>>=5;
556 ipat=shifterU16;
557
558 if(preservePos)
559 stream->pop();
560 return true;
561 }
562
readPtr(const U8 * ptr)563 void SHD::readPtr(const U8 *ptr) {
564
565 U16 shifterU16;
566 U16 ico;
567
568 shifterU16=readU16(ptr);
569 ptr+=sizeof(U16);
570 ico=shifterU16 & 0x1F;
571 cvFore=Word97::icoToRGB(ico);
572 shifterU16>>=5;
573 ico=shifterU16 & 0x1F;
574 cvBack=Word97::icoToRGB(ico);
575 shifterU16>>=5;
576 ipat=shifterU16;
577 }
578
read90Ptr(const U8 * ptr)579 void SHD::read90Ptr(const U8 *ptr) {
580
581 U16 shifterU16;
582 U8 r,g,b,cvauto;
583
584 r=readU8(ptr);
585 ptr+=sizeof(U8);
586 g=readU8(ptr);
587 ptr+=sizeof(U8);
588 b=readU8(ptr);
589 ptr+=sizeof(U8);
590 cvauto=readU8(ptr);
591 ptr+=sizeof(U8);
592 cvFore=(cvauto<<24)|(r<<16)|(g<<8)|(b);
593 r=readU8(ptr);
594 ptr+=sizeof(U8);
595 g=readU8(ptr);
596 ptr+=sizeof(U8);
597 b=readU8(ptr);
598 ptr+=sizeof(U8);
599 cvauto=readU8(ptr);
600 ptr+=sizeof(U8);
601 cvBack=(cvauto<<24)|(r<<16)|(g<<8)|(b);
602 shifterU16=readU16(ptr);
603 ipat=shifterU16;
604 }
605
write(OLEStreamWriter * stream,bool preservePos) const606 bool SHD::write(OLEStreamWriter *stream, bool preservePos) const {
607
608 U16 shifterU16;
609
610 if(preservePos)
611 stream->push();
612
613 //shifterU16=icoFore;
614 //shifterU16|=icoBack << 5;
615 shifterU16|=ipat << 10;
616 stream->write(shifterU16);
617
618 if(preservePos)
619 stream->pop();
620 return true;
621 }
622
clear()623 void SHD::clear() {
624 cvFore=0xff000000;
625 cvBack=0xff000000;
626 ipat=0;
627 }
628
dump() const629 void SHD::dump() const
630 {
631 wvlog << "Dumping SHD:" << std::endl;
632 wvlog << toString().c_str() << std::endl;
633 wvlog << "\nDumping SHD done." << std::endl;
634 }
635
toString() const636 std::string SHD::toString() const
637 {
638 std::string s( "SHD:" );
639 s += "\ncvFore=";
640 s += uint2string( cvFore );
641 s += "\nicvBack=";
642 s += uint2string( cvBack );
643 s += "\nipat=";
644 s += uint2string( ipat );
645 s += "\nSHD Done.";
646 return s;
647 }
648
operator ==(const SHD & lhs,const SHD & rhs)649 bool operator==(const SHD &lhs, const SHD &rhs) {
650
651 return lhs.cvFore==rhs.cvFore &&
652 lhs.cvBack==rhs.cvBack &&
653 lhs.ipat==rhs.ipat;
654 }
655
operator !=(const SHD & lhs,const SHD & rhs)656 bool operator!=(const SHD &lhs, const SHD &rhs) {
657 return !(lhs==rhs);
658 }
659
660
661 // PHE implementation
662
663 const unsigned int PHE::sizeOf = 12;
664
PHE()665 PHE::PHE() {
666 clear();
667 }
668
PHE(OLEStreamReader * stream,bool preservePos)669 PHE::PHE(OLEStreamReader *stream, bool preservePos) {
670 clear();
671 read(stream, preservePos);
672 }
673
PHE(const U8 * ptr)674 PHE::PHE(const U8 *ptr) {
675 clear();
676 readPtr(ptr);
677 }
678
read(OLEStreamReader * stream,bool preservePos)679 bool PHE::read(OLEStreamReader *stream, bool preservePos) {
680
681 U16 shifterU16;
682
683 if(preservePos)
684 stream->push();
685
686 shifterU16=stream->readU16();
687 fSpare=shifterU16;
688 shifterU16>>=1;
689 fUnk=shifterU16;
690 shifterU16>>=1;
691 fDiffLines=shifterU16;
692 shifterU16>>=1;
693 unused0_3=shifterU16;
694 shifterU16>>=5;
695 clMac=shifterU16;
696 unused2=stream->readU16();
697 dxaCol=stream->readS32();
698 dym=stream->readS32();
699
700 if(preservePos)
701 stream->pop();
702 return true;
703 }
704
readPtr(const U8 * ptr)705 void PHE::readPtr(const U8 *ptr) {
706
707 U16 shifterU16;
708
709 shifterU16=readU16(ptr);
710 ptr+=sizeof(U16);
711 fSpare=shifterU16;
712 shifterU16>>=1;
713 fUnk=shifterU16;
714 shifterU16>>=1;
715 fDiffLines=shifterU16;
716 shifterU16>>=1;
717 unused0_3=shifterU16;
718 shifterU16>>=5;
719 clMac=shifterU16;
720 unused2=readU16(ptr);
721 ptr+=sizeof(U16);
722 dxaCol=readS32(ptr);
723 ptr+=sizeof(S32);
724 dym=readS32(ptr);
725 ptr+=sizeof(S32);
726 }
727
write(OLEStreamWriter * stream,bool preservePos) const728 bool PHE::write(OLEStreamWriter *stream, bool preservePos) const {
729
730 U16 shifterU16;
731
732 if(preservePos)
733 stream->push();
734
735 shifterU16=fSpare;
736 shifterU16|=fUnk << 1;
737 shifterU16|=fDiffLines << 2;
738 shifterU16|=unused0_3 << 3;
739 shifterU16|=clMac << 8;
740 stream->write(shifterU16);
741 stream->write(unused2);
742 stream->write(dxaCol);
743 stream->write(dym);
744
745 if(preservePos)
746 stream->pop();
747 return true;
748 }
749
clear()750 void PHE::clear() {
751 fSpare=0;
752 fUnk=0;
753 fDiffLines=0;
754 unused0_3=0;
755 clMac=0;
756 unused2=0;
757 dxaCol=0;
758 dym=0;
759 }
760
dump() const761 void PHE::dump() const
762 {
763 wvlog << "Dumping PHE:" << std::endl;
764 wvlog << toString().c_str() << std::endl;
765 wvlog << "\nDumping PHE done." << std::endl;
766 }
767
toString() const768 std::string PHE::toString() const
769 {
770 std::string s( "PHE:" );
771 s += "\nfSpare=";
772 s += uint2string( fSpare );
773 s += "\nfUnk=";
774 s += uint2string( fUnk );
775 s += "\nfDiffLines=";
776 s += uint2string( fDiffLines );
777 s += "\nunused0_3=";
778 s += uint2string( unused0_3 );
779 s += "\nclMac=";
780 s += uint2string( clMac );
781 s += "\nunused2=";
782 s += uint2string( unused2 );
783 s += "\ndxaCol=";
784 s += int2string( dxaCol );
785 s += "\ndym=";
786 s += int2string( dym );
787 s += "\nPHE Done.";
788 return s;
789 }
790
operator ==(const PHE & lhs,const PHE & rhs)791 bool operator==(const PHE &lhs, const PHE &rhs) {
792
793 return lhs.fSpare==rhs.fSpare &&
794 lhs.fUnk==rhs.fUnk &&
795 lhs.fDiffLines==rhs.fDiffLines &&
796 lhs.unused0_3==rhs.unused0_3 &&
797 lhs.clMac==rhs.clMac &&
798 lhs.unused2==rhs.unused2 &&
799 lhs.dxaCol==rhs.dxaCol &&
800 lhs.dym==rhs.dym;
801 }
802
operator !=(const PHE & lhs,const PHE & rhs)803 bool operator!=(const PHE &lhs, const PHE &rhs) {
804 return !(lhs==rhs);
805 }
806
807
808 // BRC implementation
809
810 const unsigned int BRC::sizeOf = 8;
811 const unsigned int BRC::sizeOf97 = 4;
812
BRC()813 BRC::BRC() {
814 clear();
815 }
816
BRC(OLEStreamReader * stream,bool preservePos)817 BRC::BRC(OLEStreamReader *stream, bool preservePos) {
818 clear();
819 read(stream, preservePos);
820 }
821
BRC(const U8 * ptr)822 BRC::BRC(const U8 *ptr) {
823 clear();
824 readPtr(ptr);
825 }
826
read(OLEStreamReader * stream,bool preservePos)827 bool BRC::read(OLEStreamReader *stream, bool preservePos) {
828 U16 shifterU16;
829 U16 ico;
830
831 if(preservePos)
832 stream->push();
833
834 shifterU16=stream->readU16();
835 dptLineWidth=shifterU16;
836 shifterU16>>=8;
837 brcType=shifterU16;
838 shifterU16=stream->readU16();
839 ico=shifterU16;
840 cv=Word97::icoToRGB(ico);
841 shifterU16>>=8;
842 dptSpace=shifterU16;
843 shifterU16>>=5;
844 fShadow=shifterU16;
845 shifterU16>>=1;
846 fFrame=shifterU16;
847 shifterU16>>=1;
848 unused2_15=shifterU16;
849
850 if(preservePos)
851 stream->pop();
852 return true;
853 }
854
readPtr(const U8 * ptr)855 void BRC::readPtr(const U8 *ptr) {
856 U16 shifterU16;
857 U16 ico;
858
859 shifterU16=readU16(ptr);
860 ptr+=sizeof(U16);
861 dptLineWidth=shifterU16;
862 shifterU16>>=8;
863 brcType=shifterU16;
864 shifterU16=readU16(ptr);
865 ptr+=sizeof(U16);
866 ico=shifterU16;
867 cv=Word97::icoToRGB(ico);
868 shifterU16>>=8;
869 dptSpace=shifterU16;
870 shifterU16>>=5;
871 fShadow=shifterU16;
872 shifterU16>>=1;
873 fFrame=shifterU16;
874 shifterU16>>=1;
875 unused2_15=shifterU16;
876 }
877
read90Ptr(const U8 * ptr)878 void BRC::read90Ptr(const U8 *ptr) {
879 U16 shifterU16;
880 U8 r,g,b,cvauto;
881
882 r=readU8(ptr);
883 ptr+=sizeof(U8);
884 g=readU8(ptr);
885 ptr+=sizeof(U8);
886 b=readU8(ptr);
887 ptr+=sizeof(U8);
888 cvauto=readU8(ptr);
889 ptr+=sizeof(U8);
890 cv=(cvauto<<24)|(r<<16)|(g<<8)|(b);
891 shifterU16=readU16(ptr);
892 ptr+=sizeof(U16);
893 dptLineWidth=shifterU16;
894 shifterU16>>=8;
895 brcType=shifterU16;
896 shifterU16=readU16(ptr);
897 ptr+=sizeof(U16);
898 dptSpace=shifterU16;
899 shifterU16>>=5;
900 fShadow=shifterU16;
901 shifterU16>>=1;
902 fFrame=shifterU16;
903 shifterU16>>=1;
904 unused2_15=shifterU16;
905 }
906
write(OLEStreamWriter * stream,bool preservePos) const907 bool BRC::write(OLEStreamWriter *stream, bool preservePos) const {
908
909 U16 shifterU16;
910
911 if(preservePos)
912 stream->push();
913
914 shifterU16=dptLineWidth;
915 shifterU16|=brcType << 8;
916 stream->write(shifterU16);
917 shifterU16=1; // FIXME used to be ico - we should possibly convert cv to ico
918 shifterU16|=dptSpace << 8;
919 shifterU16|=fShadow << 13;
920 shifterU16|=fFrame << 14;
921 shifterU16|=unused2_15 << 15;
922 stream->write(shifterU16);
923
924 if(preservePos)
925 stream->pop();
926 return true;
927 }
928
clear()929 void BRC::clear() {
930 dptLineWidth=0;
931 brcType=0;
932 cv=0;
933 dptSpace=0;
934 fShadow=0;
935 fFrame=0;
936 unused2_15=0;
937 }
938
dump() const939 void BRC::dump() const
940 {
941 wvlog << "Dumping BRC:" << std::endl;
942 wvlog << toString().c_str() << std::endl;
943 wvlog << "\nDumping BRC done." << std::endl;
944 }
945
toString() const946 std::string BRC::toString() const
947 {
948 std::string s( "BRC:" );
949 s += "\ndptLineWidth=";
950 s += uint2string( dptLineWidth );
951 s += "\nbrcType=";
952 s += uint2string( brcType );
953 s += "\ncv=";
954 s += uint2string( cv );
955 s += "\ndptSpace=";
956 s += uint2string( dptSpace );
957 s += "\nfShadow=";
958 s += uint2string( fShadow );
959 s += "\nfFrame=";
960 s += uint2string( fFrame );
961 s += "\nunused2_15=";
962 s += uint2string( unused2_15 );
963 s += "\nBRC Done.";
964 return s;
965 }
966
operator ==(const BRC & lhs,const BRC & rhs)967 bool operator==(const BRC &lhs, const BRC &rhs) {
968
969 return lhs.dptLineWidth==rhs.dptLineWidth &&
970 lhs.brcType==rhs.brcType &&
971 lhs.cv==rhs.cv &&
972 lhs.dptSpace==rhs.dptSpace &&
973 lhs.fShadow==rhs.fShadow &&
974 lhs.fFrame==rhs.fFrame &&
975 lhs.unused2_15==rhs.unused2_15;
976 }
977
operator !=(const BRC & lhs,const BRC & rhs)978 bool operator!=(const BRC &lhs, const BRC &rhs) {
979 return !(lhs==rhs);
980 }
981
982
983 // TLP implementation
984
TLP()985 TLP::TLP() {
986 clear();
987 }
988
TLP(OLEStreamReader * stream,bool preservePos)989 TLP::TLP(OLEStreamReader *stream, bool preservePos) {
990 clear();
991 read(stream, preservePos);
992 }
993
TLP(const U8 * ptr)994 TLP::TLP(const U8 *ptr) {
995 clear();
996 readPtr(ptr);
997 }
998
read(OLEStreamReader * stream,bool preservePos)999 bool TLP::read(OLEStreamReader *stream, bool preservePos) {
1000
1001 U16 shifterU16;
1002
1003 if(preservePos)
1004 stream->push();
1005
1006 itl=stream->readS16();
1007 shifterU16=stream->readU16();
1008 fBorders=shifterU16;
1009 shifterU16>>=1;
1010 fShading=shifterU16;
1011 shifterU16>>=1;
1012 fFont=shifterU16;
1013 shifterU16>>=1;
1014 fColor=shifterU16;
1015 shifterU16>>=1;
1016 fBestFit=shifterU16;
1017 shifterU16>>=1;
1018 fHdrRows=shifterU16;
1019 shifterU16>>=1;
1020 fLastRow=shifterU16;
1021 shifterU16>>=1;
1022 fHdrCols=shifterU16;
1023 shifterU16>>=1;
1024 fLastCol=shifterU16;
1025 shifterU16>>=1;
1026 unused2_9=shifterU16;
1027
1028 if(preservePos)
1029 stream->pop();
1030 return true;
1031 }
1032
readPtr(const U8 * ptr)1033 void TLP::readPtr(const U8 *ptr) {
1034
1035 U16 shifterU16;
1036
1037 itl=readS16(ptr);
1038 ptr+=sizeof(S16);
1039 shifterU16=readU16(ptr);
1040 ptr+=sizeof(U16);
1041 fBorders=shifterU16;
1042 shifterU16>>=1;
1043 fShading=shifterU16;
1044 shifterU16>>=1;
1045 fFont=shifterU16;
1046 shifterU16>>=1;
1047 fColor=shifterU16;
1048 shifterU16>>=1;
1049 fBestFit=shifterU16;
1050 shifterU16>>=1;
1051 fHdrRows=shifterU16;
1052 shifterU16>>=1;
1053 fLastRow=shifterU16;
1054 shifterU16>>=1;
1055 fHdrCols=shifterU16;
1056 shifterU16>>=1;
1057 fLastCol=shifterU16;
1058 shifterU16>>=1;
1059 unused2_9=shifterU16;
1060 }
1061
write(OLEStreamWriter * stream,bool preservePos) const1062 bool TLP::write(OLEStreamWriter *stream, bool preservePos) const {
1063
1064 U16 shifterU16;
1065
1066 if(preservePos)
1067 stream->push();
1068
1069 stream->write(itl);
1070 shifterU16=fBorders;
1071 shifterU16|=fShading << 1;
1072 shifterU16|=fFont << 2;
1073 shifterU16|=fColor << 3;
1074 shifterU16|=fBestFit << 4;
1075 shifterU16|=fHdrRows << 5;
1076 shifterU16|=fLastRow << 6;
1077 shifterU16|=fHdrCols << 7;
1078 shifterU16|=fLastCol << 8;
1079 shifterU16|=unused2_9 << 9;
1080 stream->write(shifterU16);
1081
1082 if(preservePos)
1083 stream->pop();
1084 return true;
1085 }
1086
clear()1087 void TLP::clear() {
1088 itl=0;
1089 fBorders=0;
1090 fShading=0;
1091 fFont=0;
1092 fColor=0;
1093 fBestFit=0;
1094 fHdrRows=0;
1095 fLastRow=0;
1096 fHdrCols=0;
1097 fLastCol=0;
1098 unused2_9=0;
1099 }
1100
dump() const1101 void TLP::dump() const
1102 {
1103 wvlog << "Dumping TLP:" << std::endl;
1104 wvlog << toString().c_str() << std::endl;
1105 wvlog << "\nDumping TLP done." << std::endl;
1106 }
1107
toString() const1108 std::string TLP::toString() const
1109 {
1110 std::string s( "TLP:" );
1111 s += "\nitl=";
1112 s += int2string( itl );
1113 s += "\nfBorders=";
1114 s += uint2string( fBorders );
1115 s += "\nfShading=";
1116 s += uint2string( fShading );
1117 s += "\nfFont=";
1118 s += uint2string( fFont );
1119 s += "\nfColor=";
1120 s += uint2string( fColor );
1121 s += "\nfBestFit=";
1122 s += uint2string( fBestFit );
1123 s += "\nfHdrRows=";
1124 s += uint2string( fHdrRows );
1125 s += "\nfLastRow=";
1126 s += uint2string( fLastRow );
1127 s += "\nfHdrCols=";
1128 s += uint2string( fHdrCols );
1129 s += "\nfLastCol=";
1130 s += uint2string( fLastCol );
1131 s += "\nunused2_9=";
1132 s += uint2string( unused2_9 );
1133 s += "\nTLP Done.";
1134 return s;
1135 }
1136
operator ==(const TLP & lhs,const TLP & rhs)1137 bool operator==(const TLP &lhs, const TLP &rhs) {
1138
1139 return lhs.itl==rhs.itl &&
1140 lhs.fBorders==rhs.fBorders &&
1141 lhs.fShading==rhs.fShading &&
1142 lhs.fFont==rhs.fFont &&
1143 lhs.fColor==rhs.fColor &&
1144 lhs.fBestFit==rhs.fBestFit &&
1145 lhs.fHdrRows==rhs.fHdrRows &&
1146 lhs.fLastRow==rhs.fLastRow &&
1147 lhs.fHdrCols==rhs.fHdrCols &&
1148 lhs.fLastCol==rhs.fLastCol &&
1149 lhs.unused2_9==rhs.unused2_9;
1150 }
1151
operator !=(const TLP & lhs,const TLP & rhs)1152 bool operator!=(const TLP &lhs, const TLP &rhs) {
1153 return !(lhs==rhs);
1154 }
1155
1156
1157 // TC implementation
1158
1159 const unsigned int TC::sizeOf = 20;
1160
TC()1161 TC::TC() {
1162 clear();
1163 }
1164
TC(OLEStreamReader * stream,bool preservePos)1165 TC::TC(OLEStreamReader *stream, bool preservePos) {
1166 clear();
1167 read(stream, preservePos);
1168 }
1169
TC(const U8 * ptr)1170 TC::TC(const U8 *ptr) {
1171 clear();
1172 readPtr(ptr);
1173 }
1174
read(OLEStreamReader * stream,bool preservePos)1175 bool TC::read(OLEStreamReader *stream, bool preservePos) {
1176
1177 U16 shifterU16;
1178
1179 if(preservePos)
1180 stream->push();
1181
1182 shifterU16=stream->readU16();
1183 fFirstMerged=shifterU16;
1184 shifterU16>>=1;
1185 fMerged=shifterU16;
1186 shifterU16>>=1;
1187 fVertical=shifterU16;
1188 shifterU16>>=1;
1189 fBackward=shifterU16;
1190 shifterU16>>=1;
1191 fRotateFont=shifterU16;
1192 shifterU16>>=1;
1193 fVertMerge=shifterU16;
1194 shifterU16>>=1;
1195 fVertRestart=shifterU16;
1196 shifterU16>>=1;
1197 vertAlign=shifterU16;
1198 shifterU16>>=2;
1199 fUnused=shifterU16;
1200 wUnused=stream->readU16();
1201 brcTop.read(stream, false);
1202 brcLeft.read(stream, false);
1203 brcBottom.read(stream, false);
1204 brcRight.read(stream, false);
1205
1206 if(preservePos)
1207 stream->pop();
1208 return true;
1209 }
1210
readPtr(const U8 * ptr)1211 void TC::readPtr(const U8 *ptr) {
1212
1213 U16 shifterU16;
1214
1215 shifterU16=readU16(ptr);
1216 ptr+=sizeof(U16);
1217 fFirstMerged=shifterU16;
1218 shifterU16>>=1;
1219 fMerged=shifterU16;
1220 shifterU16>>=1;
1221 fVertical=shifterU16;
1222 shifterU16>>=1;
1223 fBackward=shifterU16;
1224 shifterU16>>=1;
1225 fRotateFont=shifterU16;
1226 shifterU16>>=1;
1227 fVertMerge=shifterU16;
1228 shifterU16>>=1;
1229 fVertRestart=shifterU16;
1230 shifterU16>>=1;
1231 vertAlign=shifterU16;
1232 shifterU16>>=2;
1233 fUnused=shifterU16;
1234 wUnused=readU16(ptr);
1235 ptr+=sizeof(U16);
1236 wvlog << std::endl;
1237 brcTop.readPtr(ptr);
1238 ptr+=BRC::sizeOf97;
1239 brcLeft.readPtr(ptr);
1240 ptr+=BRC::sizeOf97;
1241 brcBottom.readPtr(ptr);
1242 ptr+=BRC::sizeOf97;
1243 brcRight.readPtr(ptr);
1244 ptr+=BRC::sizeOf;
1245 }
1246
write(OLEStreamWriter * stream,bool preservePos) const1247 bool TC::write(OLEStreamWriter *stream, bool preservePos) const {
1248
1249 U16 shifterU16;
1250
1251 if(preservePos)
1252 stream->push();
1253
1254 shifterU16=fFirstMerged;
1255 shifterU16|=fMerged << 1;
1256 shifterU16|=fVertical << 2;
1257 shifterU16|=fBackward << 3;
1258 shifterU16|=fRotateFont << 4;
1259 shifterU16|=fVertMerge << 5;
1260 shifterU16|=fVertRestart << 6;
1261 shifterU16|=vertAlign << 7;
1262 shifterU16|=fUnused << 9;
1263 stream->write(shifterU16);
1264 stream->write(wUnused);
1265 brcTop.write(stream, false);
1266 brcLeft.write(stream, false);
1267 brcBottom.write(stream, false);
1268 brcRight.write(stream, false);
1269
1270 if(preservePos)
1271 stream->pop();
1272 return true;
1273 }
1274
clear()1275 void TC::clear() {
1276 fFirstMerged=0;
1277 fMerged=0;
1278 fVertical=0;
1279 fBackward=0;
1280 fRotateFont=0;
1281 fVertMerge=0;
1282 fVertRestart=0;
1283 vertAlign=0;
1284 fUnused=0;
1285 wUnused=0;
1286 brcTop.clear();
1287 brcLeft.clear();
1288 brcBottom.clear();
1289 brcRight.clear();
1290 }
1291
dump() const1292 void TC::dump() const
1293 {
1294 wvlog << "Dumping TC:" << std::endl;
1295 wvlog << toString().c_str() << std::endl;
1296 wvlog << "\nDumping TC done." << std::endl;
1297 }
1298
toString() const1299 std::string TC::toString() const
1300 {
1301 std::string s( "TC:" );
1302 s += "\nfFirstMerged=";
1303 s += uint2string( fFirstMerged );
1304 s += "\nfMerged=";
1305 s += uint2string( fMerged );
1306 s += "\nfVertical=";
1307 s += uint2string( fVertical );
1308 s += "\nfBackward=";
1309 s += uint2string( fBackward );
1310 s += "\nfRotateFont=";
1311 s += uint2string( fRotateFont );
1312 s += "\nfVertMerge=";
1313 s += uint2string( fVertMerge );
1314 s += "\nfVertRestart=";
1315 s += uint2string( fVertRestart );
1316 s += "\nvertAlign=";
1317 s += uint2string( vertAlign );
1318 s += "\nfUnused=";
1319 s += uint2string( fUnused );
1320 s += "\nwUnused=";
1321 s += uint2string( wUnused );
1322 s += "\nbrcTop=";
1323 s += "\n{" + brcTop.toString() + "}\n";
1324 s += "\nbrcLeft=";
1325 s += "\n{" + brcLeft.toString() + "}\n";
1326 s += "\nbrcBottom=";
1327 s += "\n{" + brcBottom.toString() + "}\n";
1328 s += "\nbrcRight=";
1329 s += "\n{" + brcRight.toString() + "}\n";
1330 s += "\nTC Done.";
1331 return s;
1332 }
1333
operator ==(const TC & lhs,const TC & rhs)1334 bool operator==(const TC &lhs, const TC &rhs) {
1335
1336 return lhs.fFirstMerged==rhs.fFirstMerged &&
1337 lhs.fMerged==rhs.fMerged &&
1338 lhs.fVertical==rhs.fVertical &&
1339 lhs.fBackward==rhs.fBackward &&
1340 lhs.fRotateFont==rhs.fRotateFont &&
1341 lhs.fVertMerge==rhs.fVertMerge &&
1342 lhs.fVertRestart==rhs.fVertRestart &&
1343 lhs.vertAlign==rhs.vertAlign &&
1344 lhs.fUnused==rhs.fUnused &&
1345 lhs.wUnused==rhs.wUnused &&
1346 lhs.brcTop==rhs.brcTop &&
1347 lhs.brcLeft==rhs.brcLeft &&
1348 lhs.brcBottom==rhs.brcBottom &&
1349 lhs.brcRight==rhs.brcRight;
1350 }
1351
operator !=(const TC & lhs,const TC & rhs)1352 bool operator!=(const TC &lhs, const TC &rhs) {
1353 return !(lhs==rhs);
1354 }
1355
1356
1357 // TAP implementation
1358
TAP()1359 TAP::TAP() : Shared() {
1360 clear();
1361 }
1362
TAP(OLEStreamReader * stream,bool preservePos)1363 TAP::TAP(OLEStreamReader *stream, bool preservePos) : Shared() {
1364 clear();
1365 read(stream, preservePos);
1366 }
1367
read(OLEStreamReader * stream,bool preservePos)1368 bool TAP::read(OLEStreamReader *stream, bool preservePos) {
1369
1370 U16 shifterU16;
1371
1372 if(preservePos)
1373 stream->push();
1374
1375 jc=stream->readS16();
1376 dxaGapHalf=stream->readS32();
1377 dyaRowHeight=stream->readS32();
1378 fCantSplit=stream->readU8();
1379 fTableHeader=stream->readU8();
1380 tlp.read(stream, false);
1381 lwHTMLProps=stream->readS32();
1382 shifterU16=stream->readU16();
1383 fCaFull=shifterU16;
1384 shifterU16>>=1;
1385 fFirstRow=shifterU16;
1386 shifterU16>>=1;
1387 fLastRow=shifterU16;
1388 shifterU16>>=1;
1389 fOutline=shifterU16;
1390 shifterU16>>=1;
1391 unused20_12=shifterU16;
1392 itcMac=stream->readS16();
1393 dxaAdjust=stream->readS32();
1394 dxaScale=stream->readS32();
1395 dxsInch=stream->readS32();
1396 // skipping the std::vector rgdxaCenter
1397 // skipping the std::vector rgdxaCenterPrint
1398 // skipping the std::vector rgtc
1399 // skipping the std::vector rgshd
1400 for(int _i=0; _i<(6); ++_i)
1401 rgbrcTable[_i].read(stream, false);
1402
1403 if(preservePos)
1404 stream->pop();
1405 return true;
1406 }
1407
write(OLEStreamWriter * stream,bool preservePos) const1408 bool TAP::write(OLEStreamWriter *stream, bool preservePos) const {
1409
1410 U16 shifterU16;
1411
1412 if(preservePos)
1413 stream->push();
1414
1415 stream->write(jc);
1416 stream->write(dxaGapHalf);
1417 stream->write(dyaRowHeight);
1418 stream->write(fCantSplit);
1419 stream->write(fTableHeader);
1420 tlp.write(stream, false);
1421 stream->write(lwHTMLProps);
1422 shifterU16=fCaFull;
1423 shifterU16|=fFirstRow << 1;
1424 shifterU16|=fLastRow << 2;
1425 shifterU16|=fOutline << 3;
1426 shifterU16|=unused20_12 << 4;
1427 stream->write(shifterU16);
1428 stream->write(itcMac);
1429 stream->write(dxaAdjust);
1430 stream->write(dxaScale);
1431 stream->write(dxsInch);
1432 // skipping the std::vector rgdxaCenter
1433 // skipping the std::vector rgdxaCenterPrint
1434 // skipping the std::vector rgtc
1435 // skipping the std::vector rgshd
1436 for(int _i=0; _i<(6); ++_i)
1437 rgbrcTable[_i].write(stream, false);
1438
1439 if(preservePos)
1440 stream->pop();
1441 return true;
1442 }
1443
clear()1444 void TAP::clear() {
1445 jc=0;
1446 dxaGapHalf=0;
1447 dyaRowHeight=0;
1448 fCantSplit=0;
1449 fTableHeader=0;
1450 tlp.clear();
1451 lwHTMLProps=0;
1452 fCaFull=0;
1453 fFirstRow=0;
1454 fLastRow=0;
1455 fOutline=0;
1456 unused20_12=0;
1457 itcMac=0;
1458 dxaAdjust=0;
1459 dxaScale=0;
1460 dxsInch=0;
1461 rgdxaCenter.clear();
1462 rgdxaCenterPrint.clear();
1463 rgtc.clear();
1464 rgshd.clear();
1465 for(int _i=0; _i<(6); ++_i)
1466 rgbrcTable[_i].clear();
1467 }
1468
dump() const1469 void TAP::dump() const
1470 {
1471 wvlog << "Dumping TAP:" << std::endl;
1472 wvlog << toString().c_str() << std::endl;
1473 wvlog << "\nDumping TAP done." << std::endl;
1474 }
1475
toString() const1476 std::string TAP::toString() const
1477 {
1478 std::string s( "TAP:" );
1479 s += "\njc=";
1480 s += int2string( jc );
1481 s += "\ndxaGapHalf=";
1482 s += int2string( dxaGapHalf );
1483 s += "\ndyaRowHeight=";
1484 s += int2string( dyaRowHeight );
1485 s += "\nfCantSplit=";
1486 s += uint2string( fCantSplit );
1487 s += "\nfTableHeader=";
1488 s += uint2string( fTableHeader );
1489 s += "\ntlp=";
1490 s += "\n{" + tlp.toString() + "}\n";
1491 s += "\nlwHTMLProps=";
1492 s += int2string( lwHTMLProps );
1493 s += "\nfCaFull=";
1494 s += uint2string( fCaFull );
1495 s += "\nfFirstRow=";
1496 s += uint2string( fFirstRow );
1497 s += "\nfLastRow=";
1498 s += uint2string( fLastRow );
1499 s += "\nfOutline=";
1500 s += uint2string( fOutline );
1501 s += "\nunused20_12=";
1502 s += uint2string( unused20_12 );
1503 s += "\nitcMac=";
1504 s += int2string( itcMac );
1505 s += "\ndxaAdjust=";
1506 s += int2string( dxaAdjust );
1507 s += "\ndxaScale=";
1508 s += int2string( dxaScale );
1509 s += "\ndxsInch=";
1510 s += int2string( dxsInch );
1511 s += "\nrgdxaCenter=";
1512 // skipping the std::vector rgdxaCenter
1513 s += "\nrgdxaCenterPrint=";
1514 // skipping the std::vector rgdxaCenterPrint
1515 s += "\nrgtc=";
1516 // skipping the std::vector rgtc
1517 s += "\nrgshd=";
1518 // skipping the std::vector rgshd
1519 for(int _i=0; _i<(6); ++_i) {
1520 s += "\nrgbrcTable[" + int2string( _i ) + "]=";
1521 s += "\n{" + rgbrcTable[_i].toString() + "}\n";
1522 }
1523 s += "\nTAP Done.";
1524 return s;
1525 }
1526
operator ==(const TAP & lhs,const TAP & rhs)1527 bool operator==(const TAP &lhs, const TAP &rhs) {
1528
1529 for(int _i=0; _i<(6); ++_i) {
1530 if(lhs.rgbrcTable[_i]!=rhs.rgbrcTable[_i])
1531 return false;
1532 }
1533
1534 return lhs.jc==rhs.jc &&
1535 lhs.dxaGapHalf==rhs.dxaGapHalf &&
1536 lhs.dyaRowHeight==rhs.dyaRowHeight &&
1537 lhs.fCantSplit==rhs.fCantSplit &&
1538 lhs.fTableHeader==rhs.fTableHeader &&
1539 lhs.tlp==rhs.tlp &&
1540 lhs.lwHTMLProps==rhs.lwHTMLProps &&
1541 lhs.fCaFull==rhs.fCaFull &&
1542 lhs.fFirstRow==rhs.fFirstRow &&
1543 lhs.fLastRow==rhs.fLastRow &&
1544 lhs.fOutline==rhs.fOutline &&
1545 lhs.unused20_12==rhs.unused20_12 &&
1546 lhs.itcMac==rhs.itcMac &&
1547 lhs.dxaAdjust==rhs.dxaAdjust &&
1548 lhs.dxaScale==rhs.dxaScale &&
1549 lhs.dxsInch==rhs.dxsInch &&
1550 lhs.rgdxaCenter==rhs.rgdxaCenter &&
1551 lhs.rgdxaCenterPrint==rhs.rgdxaCenterPrint &&
1552 lhs.rgtc==rhs.rgtc &&
1553 lhs.rgshd==rhs.rgshd;
1554 }
1555
operator !=(const TAP & lhs,const TAP & rhs)1556 bool operator!=(const TAP &lhs, const TAP &rhs) {
1557 return !(lhs==rhs);
1558 }
1559
1560
1561 // ANLD implementation
1562
ANLD()1563 ANLD::ANLD() {
1564 clear();
1565 }
1566
ANLD(OLEStreamReader * stream,bool preservePos)1567 ANLD::ANLD(OLEStreamReader *stream, bool preservePos) {
1568 clear();
1569 read(stream, preservePos);
1570 }
1571
ANLD(const U8 * ptr)1572 ANLD::ANLD(const U8 *ptr) {
1573 clear();
1574 readPtr(ptr);
1575 }
1576
read(OLEStreamReader * stream,bool preservePos)1577 bool ANLD::read(OLEStreamReader *stream, bool preservePos) {
1578
1579 U8 shifterU8;
1580
1581 if(preservePos)
1582 stream->push();
1583
1584 nfc=stream->readU8();
1585 cxchTextBefore=stream->readU8();
1586 cxchTextAfter=stream->readU8();
1587 shifterU8=stream->readU8();
1588 jc=shifterU8;
1589 shifterU8>>=2;
1590 fPrev=shifterU8;
1591 shifterU8>>=1;
1592 fHang=shifterU8;
1593 shifterU8>>=1;
1594 fSetBold=shifterU8;
1595 shifterU8>>=1;
1596 fSetItalic=shifterU8;
1597 shifterU8>>=1;
1598 fSetSmallCaps=shifterU8;
1599 shifterU8>>=1;
1600 fSetCaps=shifterU8;
1601 shifterU8=stream->readU8();
1602 fSetStrike=shifterU8;
1603 shifterU8>>=1;
1604 fSetKul=shifterU8;
1605 shifterU8>>=1;
1606 fPrevSpace=shifterU8;
1607 shifterU8>>=1;
1608 fBold=shifterU8;
1609 shifterU8>>=1;
1610 fItalic=shifterU8;
1611 shifterU8>>=1;
1612 fSmallCaps=shifterU8;
1613 shifterU8>>=1;
1614 fCaps=shifterU8;
1615 shifterU8>>=1;
1616 fStrike=shifterU8;
1617 shifterU8=stream->readU8();
1618 kul=shifterU8;
1619 shifterU8>>=3;
1620 ico=shifterU8;
1621 ftc=stream->readS16();
1622 hps=stream->readU16();
1623 iStartAt=stream->readU16();
1624 dxaIndent=stream->readU16();
1625 dxaSpace=stream->readU16();
1626 fNumber1=stream->readU8();
1627 fNumberAcross=stream->readU8();
1628 fRestartHdn=stream->readU8();
1629 fSpareX=stream->readU8();
1630 for(int _i=0; _i<(32); ++_i)
1631 rgxch[_i]=stream->readU16();
1632
1633 if(preservePos)
1634 stream->pop();
1635 return true;
1636 }
1637
readPtr(const U8 * ptr)1638 void ANLD::readPtr(const U8 *ptr) {
1639
1640 U8 shifterU8;
1641
1642 nfc=readU8(ptr);
1643 ptr+=sizeof(U8);
1644 cxchTextBefore=readU8(ptr);
1645 ptr+=sizeof(U8);
1646 cxchTextAfter=readU8(ptr);
1647 ptr+=sizeof(U8);
1648 shifterU8=readU8(ptr);
1649 ptr+=sizeof(U8);
1650 jc=shifterU8;
1651 shifterU8>>=2;
1652 fPrev=shifterU8;
1653 shifterU8>>=1;
1654 fHang=shifterU8;
1655 shifterU8>>=1;
1656 fSetBold=shifterU8;
1657 shifterU8>>=1;
1658 fSetItalic=shifterU8;
1659 shifterU8>>=1;
1660 fSetSmallCaps=shifterU8;
1661 shifterU8>>=1;
1662 fSetCaps=shifterU8;
1663 shifterU8=readU8(ptr);
1664 ptr+=sizeof(U8);
1665 fSetStrike=shifterU8;
1666 shifterU8>>=1;
1667 fSetKul=shifterU8;
1668 shifterU8>>=1;
1669 fPrevSpace=shifterU8;
1670 shifterU8>>=1;
1671 fBold=shifterU8;
1672 shifterU8>>=1;
1673 fItalic=shifterU8;
1674 shifterU8>>=1;
1675 fSmallCaps=shifterU8;
1676 shifterU8>>=1;
1677 fCaps=shifterU8;
1678 shifterU8>>=1;
1679 fStrike=shifterU8;
1680 shifterU8=readU8(ptr);
1681 ptr+=sizeof(U8);
1682 kul=shifterU8;
1683 shifterU8>>=3;
1684 ico=shifterU8;
1685 ftc=readS16(ptr);
1686 ptr+=sizeof(S16);
1687 hps=readU16(ptr);
1688 ptr+=sizeof(U16);
1689 iStartAt=readU16(ptr);
1690 ptr+=sizeof(U16);
1691 dxaIndent=readU16(ptr);
1692 ptr+=sizeof(U16);
1693 dxaSpace=readU16(ptr);
1694 ptr+=sizeof(U16);
1695 fNumber1=readU8(ptr);
1696 ptr+=sizeof(U8);
1697 fNumberAcross=readU8(ptr);
1698 ptr+=sizeof(U8);
1699 fRestartHdn=readU8(ptr);
1700 ptr+=sizeof(U8);
1701 fSpareX=readU8(ptr);
1702 ptr+=sizeof(U8);
1703 for(int _i=0; _i<(32); ++_i) {
1704 rgxch[_i]=readU16(ptr);
1705 ptr+=sizeof(U16);
1706 }
1707 }
1708
write(OLEStreamWriter * stream,bool preservePos) const1709 bool ANLD::write(OLEStreamWriter *stream, bool preservePos) const {
1710
1711 U8 shifterU8;
1712
1713 if(preservePos)
1714 stream->push();
1715
1716 stream->write(nfc);
1717 stream->write(cxchTextBefore);
1718 stream->write(cxchTextAfter);
1719 shifterU8=jc;
1720 shifterU8|=fPrev << 2;
1721 shifterU8|=fHang << 3;
1722 shifterU8|=fSetBold << 4;
1723 shifterU8|=fSetItalic << 5;
1724 shifterU8|=fSetSmallCaps << 6;
1725 shifterU8|=fSetCaps << 7;
1726 stream->write(shifterU8);
1727 shifterU8=fSetStrike;
1728 shifterU8|=fSetKul << 1;
1729 shifterU8|=fPrevSpace << 2;
1730 shifterU8|=fBold << 3;
1731 shifterU8|=fItalic << 4;
1732 shifterU8|=fSmallCaps << 5;
1733 shifterU8|=fCaps << 6;
1734 shifterU8|=fStrike << 7;
1735 stream->write(shifterU8);
1736 shifterU8=kul;
1737 shifterU8|=ico << 3;
1738 stream->write(shifterU8);
1739 stream->write(ftc);
1740 stream->write(hps);
1741 stream->write(iStartAt);
1742 stream->write(dxaIndent);
1743 stream->write(dxaSpace);
1744 stream->write(fNumber1);
1745 stream->write(fNumberAcross);
1746 stream->write(fRestartHdn);
1747 stream->write(fSpareX);
1748 for(int _i=0; _i<(32); ++_i)
1749 stream->write(rgxch[_i]);
1750
1751 if(preservePos)
1752 stream->pop();
1753 return true;
1754 }
1755
clear()1756 void ANLD::clear() {
1757 nfc=0;
1758 cxchTextBefore=0;
1759 cxchTextAfter=0;
1760 jc=0;
1761 fPrev=0;
1762 fHang=0;
1763 fSetBold=0;
1764 fSetItalic=0;
1765 fSetSmallCaps=0;
1766 fSetCaps=0;
1767 fSetStrike=0;
1768 fSetKul=0;
1769 fPrevSpace=0;
1770 fBold=0;
1771 fItalic=0;
1772 fSmallCaps=0;
1773 fCaps=0;
1774 fStrike=0;
1775 kul=0;
1776 ico=0;
1777 ftc=0;
1778 hps=0;
1779 iStartAt=0;
1780 dxaIndent=0;
1781 dxaSpace=0;
1782 fNumber1=0;
1783 fNumberAcross=0;
1784 fRestartHdn=0;
1785 fSpareX=0;
1786 for(int _i=0; _i<(32); ++_i)
1787 rgxch[_i]=0;
1788 }
1789
dump() const1790 void ANLD::dump() const
1791 {
1792 wvlog << "Dumping ANLD:" << std::endl;
1793 wvlog << toString().c_str() << std::endl;
1794 wvlog << "\nDumping ANLD done." << std::endl;
1795 }
1796
toString() const1797 std::string ANLD::toString() const
1798 {
1799 std::string s( "ANLD:" );
1800 s += "\nnfc=";
1801 s += uint2string( nfc );
1802 s += "\ncxchTextBefore=";
1803 s += uint2string( cxchTextBefore );
1804 s += "\ncxchTextAfter=";
1805 s += uint2string( cxchTextAfter );
1806 s += "\njc=";
1807 s += uint2string( jc );
1808 s += "\nfPrev=";
1809 s += uint2string( fPrev );
1810 s += "\nfHang=";
1811 s += uint2string( fHang );
1812 s += "\nfSetBold=";
1813 s += uint2string( fSetBold );
1814 s += "\nfSetItalic=";
1815 s += uint2string( fSetItalic );
1816 s += "\nfSetSmallCaps=";
1817 s += uint2string( fSetSmallCaps );
1818 s += "\nfSetCaps=";
1819 s += uint2string( fSetCaps );
1820 s += "\nfSetStrike=";
1821 s += uint2string( fSetStrike );
1822 s += "\nfSetKul=";
1823 s += uint2string( fSetKul );
1824 s += "\nfPrevSpace=";
1825 s += uint2string( fPrevSpace );
1826 s += "\nfBold=";
1827 s += uint2string( fBold );
1828 s += "\nfItalic=";
1829 s += uint2string( fItalic );
1830 s += "\nfSmallCaps=";
1831 s += uint2string( fSmallCaps );
1832 s += "\nfCaps=";
1833 s += uint2string( fCaps );
1834 s += "\nfStrike=";
1835 s += uint2string( fStrike );
1836 s += "\nkul=";
1837 s += uint2string( kul );
1838 s += "\nico=";
1839 s += uint2string( ico );
1840 s += "\nftc=";
1841 s += int2string( ftc );
1842 s += "\nhps=";
1843 s += uint2string( hps );
1844 s += "\niStartAt=";
1845 s += uint2string( iStartAt );
1846 s += "\ndxaIndent=";
1847 s += uint2string( dxaIndent );
1848 s += "\ndxaSpace=";
1849 s += uint2string( dxaSpace );
1850 s += "\nfNumber1=";
1851 s += uint2string( fNumber1 );
1852 s += "\nfNumberAcross=";
1853 s += uint2string( fNumberAcross );
1854 s += "\nfRestartHdn=";
1855 s += uint2string( fRestartHdn );
1856 s += "\nfSpareX=";
1857 s += uint2string( fSpareX );
1858 for(int _i=0; _i<(32); ++_i) {
1859 s += "\nrgxch[" + int2string( _i ) + "]=";
1860 s += uint2string( rgxch[_i] );
1861 }
1862 s += "\nANLD Done.";
1863 return s;
1864 }
1865
operator ==(const ANLD & lhs,const ANLD & rhs)1866 bool operator==(const ANLD &lhs, const ANLD &rhs) {
1867
1868 for(int _i=0; _i<(32); ++_i) {
1869 if(lhs.rgxch[_i]!=rhs.rgxch[_i])
1870 return false;
1871 }
1872
1873 return lhs.nfc==rhs.nfc &&
1874 lhs.cxchTextBefore==rhs.cxchTextBefore &&
1875 lhs.cxchTextAfter==rhs.cxchTextAfter &&
1876 lhs.jc==rhs.jc &&
1877 lhs.fPrev==rhs.fPrev &&
1878 lhs.fHang==rhs.fHang &&
1879 lhs.fSetBold==rhs.fSetBold &&
1880 lhs.fSetItalic==rhs.fSetItalic &&
1881 lhs.fSetSmallCaps==rhs.fSetSmallCaps &&
1882 lhs.fSetCaps==rhs.fSetCaps &&
1883 lhs.fSetStrike==rhs.fSetStrike &&
1884 lhs.fSetKul==rhs.fSetKul &&
1885 lhs.fPrevSpace==rhs.fPrevSpace &&
1886 lhs.fBold==rhs.fBold &&
1887 lhs.fItalic==rhs.fItalic &&
1888 lhs.fSmallCaps==rhs.fSmallCaps &&
1889 lhs.fCaps==rhs.fCaps &&
1890 lhs.fStrike==rhs.fStrike &&
1891 lhs.kul==rhs.kul &&
1892 lhs.ico==rhs.ico &&
1893 lhs.ftc==rhs.ftc &&
1894 lhs.hps==rhs.hps &&
1895 lhs.iStartAt==rhs.iStartAt &&
1896 lhs.dxaIndent==rhs.dxaIndent &&
1897 lhs.dxaSpace==rhs.dxaSpace &&
1898 lhs.fNumber1==rhs.fNumber1 &&
1899 lhs.fNumberAcross==rhs.fNumberAcross &&
1900 lhs.fRestartHdn==rhs.fRestartHdn &&
1901 lhs.fSpareX==rhs.fSpareX;
1902 }
1903
operator !=(const ANLD & lhs,const ANLD & rhs)1904 bool operator!=(const ANLD &lhs, const ANLD &rhs) {
1905 return !(lhs==rhs);
1906 }
1907
1908
1909 // ANLV implementation
1910
1911 const unsigned int ANLV::sizeOf = 16;
1912
ANLV()1913 ANLV::ANLV() {
1914 clear();
1915 }
1916
ANLV(OLEStreamReader * stream,bool preservePos)1917 ANLV::ANLV(OLEStreamReader *stream, bool preservePos) {
1918 clear();
1919 read(stream, preservePos);
1920 }
1921
ANLV(const U8 * ptr)1922 ANLV::ANLV(const U8 *ptr) {
1923 clear();
1924 readPtr(ptr);
1925 }
1926
read(OLEStreamReader * stream,bool preservePos)1927 bool ANLV::read(OLEStreamReader *stream, bool preservePos) {
1928
1929 U8 shifterU8;
1930
1931 if(preservePos)
1932 stream->push();
1933
1934 nfc=stream->readU8();
1935 cxchTextBefore=stream->readU8();
1936 cxchTextAfter=stream->readU8();
1937 shifterU8=stream->readU8();
1938 jc=shifterU8;
1939 shifterU8>>=2;
1940 fPrev=shifterU8;
1941 shifterU8>>=1;
1942 fHang=shifterU8;
1943 shifterU8>>=1;
1944 fSetBold=shifterU8;
1945 shifterU8>>=1;
1946 fSetItalic=shifterU8;
1947 shifterU8>>=1;
1948 fSetSmallCaps=shifterU8;
1949 shifterU8>>=1;
1950 fSetCaps=shifterU8;
1951 shifterU8=stream->readU8();
1952 fSetStrike=shifterU8;
1953 shifterU8>>=1;
1954 fSetKul=shifterU8;
1955 shifterU8>>=1;
1956 fPrevSpace=shifterU8;
1957 shifterU8>>=1;
1958 fBold=shifterU8;
1959 shifterU8>>=1;
1960 fItalic=shifterU8;
1961 shifterU8>>=1;
1962 fSmallCaps=shifterU8;
1963 shifterU8>>=1;
1964 fCaps=shifterU8;
1965 shifterU8>>=1;
1966 fStrike=shifterU8;
1967 shifterU8=stream->readU8();
1968 kul=shifterU8;
1969 shifterU8>>=3;
1970 ico=shifterU8;
1971 ftc=stream->readS16();
1972 hps=stream->readU16();
1973 iStartAt=stream->readU16();
1974 dxaIndent=stream->readU16();
1975 dxaSpace=stream->readU16();
1976
1977 if(preservePos)
1978 stream->pop();
1979 return true;
1980 }
1981
readPtr(const U8 * ptr)1982 void ANLV::readPtr(const U8 *ptr) {
1983
1984 U8 shifterU8;
1985
1986 nfc=readU8(ptr);
1987 ptr+=sizeof(U8);
1988 cxchTextBefore=readU8(ptr);
1989 ptr+=sizeof(U8);
1990 cxchTextAfter=readU8(ptr);
1991 ptr+=sizeof(U8);
1992 shifterU8=readU8(ptr);
1993 ptr+=sizeof(U8);
1994 jc=shifterU8;
1995 shifterU8>>=2;
1996 fPrev=shifterU8;
1997 shifterU8>>=1;
1998 fHang=shifterU8;
1999 shifterU8>>=1;
2000 fSetBold=shifterU8;
2001 shifterU8>>=1;
2002 fSetItalic=shifterU8;
2003 shifterU8>>=1;
2004 fSetSmallCaps=shifterU8;
2005 shifterU8>>=1;
2006 fSetCaps=shifterU8;
2007 shifterU8=readU8(ptr);
2008 ptr+=sizeof(U8);
2009 fSetStrike=shifterU8;
2010 shifterU8>>=1;
2011 fSetKul=shifterU8;
2012 shifterU8>>=1;
2013 fPrevSpace=shifterU8;
2014 shifterU8>>=1;
2015 fBold=shifterU8;
2016 shifterU8>>=1;
2017 fItalic=shifterU8;
2018 shifterU8>>=1;
2019 fSmallCaps=shifterU8;
2020 shifterU8>>=1;
2021 fCaps=shifterU8;
2022 shifterU8>>=1;
2023 fStrike=shifterU8;
2024 shifterU8=readU8(ptr);
2025 ptr+=sizeof(U8);
2026 kul=shifterU8;
2027 shifterU8>>=3;
2028 ico=shifterU8;
2029 ftc=readS16(ptr);
2030 ptr+=sizeof(S16);
2031 hps=readU16(ptr);
2032 ptr+=sizeof(U16);
2033 iStartAt=readU16(ptr);
2034 ptr+=sizeof(U16);
2035 dxaIndent=readU16(ptr);
2036 ptr+=sizeof(U16);
2037 dxaSpace=readU16(ptr);
2038 ptr+=sizeof(U16);
2039 }
2040
write(OLEStreamWriter * stream,bool preservePos) const2041 bool ANLV::write(OLEStreamWriter *stream, bool preservePos) const {
2042
2043 U8 shifterU8;
2044
2045 if(preservePos)
2046 stream->push();
2047
2048 stream->write(nfc);
2049 stream->write(cxchTextBefore);
2050 stream->write(cxchTextAfter);
2051 shifterU8=jc;
2052 shifterU8|=fPrev << 2;
2053 shifterU8|=fHang << 3;
2054 shifterU8|=fSetBold << 4;
2055 shifterU8|=fSetItalic << 5;
2056 shifterU8|=fSetSmallCaps << 6;
2057 shifterU8|=fSetCaps << 7;
2058 stream->write(shifterU8);
2059 shifterU8=fSetStrike;
2060 shifterU8|=fSetKul << 1;
2061 shifterU8|=fPrevSpace << 2;
2062 shifterU8|=fBold << 3;
2063 shifterU8|=fItalic << 4;
2064 shifterU8|=fSmallCaps << 5;
2065 shifterU8|=fCaps << 6;
2066 shifterU8|=fStrike << 7;
2067 stream->write(shifterU8);
2068 shifterU8=kul;
2069 shifterU8|=ico << 3;
2070 stream->write(shifterU8);
2071 stream->write(ftc);
2072 stream->write(hps);
2073 stream->write(iStartAt);
2074 stream->write(dxaIndent);
2075 stream->write(dxaSpace);
2076
2077 if(preservePos)
2078 stream->pop();
2079 return true;
2080 }
2081
clear()2082 void ANLV::clear() {
2083 nfc=0;
2084 cxchTextBefore=0;
2085 cxchTextAfter=0;
2086 jc=0;
2087 fPrev=0;
2088 fHang=0;
2089 fSetBold=0;
2090 fSetItalic=0;
2091 fSetSmallCaps=0;
2092 fSetCaps=0;
2093 fSetStrike=0;
2094 fSetKul=0;
2095 fPrevSpace=0;
2096 fBold=0;
2097 fItalic=0;
2098 fSmallCaps=0;
2099 fCaps=0;
2100 fStrike=0;
2101 kul=0;
2102 ico=0;
2103 ftc=0;
2104 hps=0;
2105 iStartAt=0;
2106 dxaIndent=0;
2107 dxaSpace=0;
2108 }
2109
dump() const2110 void ANLV::dump() const
2111 {
2112 wvlog << "Dumping ANLV:" << std::endl;
2113 wvlog << toString().c_str() << std::endl;
2114 wvlog << "\nDumping ANLV done." << std::endl;
2115 }
2116
toString() const2117 std::string ANLV::toString() const
2118 {
2119 std::string s( "ANLV:" );
2120 s += "\nnfc=";
2121 s += uint2string( nfc );
2122 s += "\ncxchTextBefore=";
2123 s += uint2string( cxchTextBefore );
2124 s += "\ncxchTextAfter=";
2125 s += uint2string( cxchTextAfter );
2126 s += "\njc=";
2127 s += uint2string( jc );
2128 s += "\nfPrev=";
2129 s += uint2string( fPrev );
2130 s += "\nfHang=";
2131 s += uint2string( fHang );
2132 s += "\nfSetBold=";
2133 s += uint2string( fSetBold );
2134 s += "\nfSetItalic=";
2135 s += uint2string( fSetItalic );
2136 s += "\nfSetSmallCaps=";
2137 s += uint2string( fSetSmallCaps );
2138 s += "\nfSetCaps=";
2139 s += uint2string( fSetCaps );
2140 s += "\nfSetStrike=";
2141 s += uint2string( fSetStrike );
2142 s += "\nfSetKul=";
2143 s += uint2string( fSetKul );
2144 s += "\nfPrevSpace=";
2145 s += uint2string( fPrevSpace );
2146 s += "\nfBold=";
2147 s += uint2string( fBold );
2148 s += "\nfItalic=";
2149 s += uint2string( fItalic );
2150 s += "\nfSmallCaps=";
2151 s += uint2string( fSmallCaps );
2152 s += "\nfCaps=";
2153 s += uint2string( fCaps );
2154 s += "\nfStrike=";
2155 s += uint2string( fStrike );
2156 s += "\nkul=";
2157 s += uint2string( kul );
2158 s += "\nico=";
2159 s += uint2string( ico );
2160 s += "\nftc=";
2161 s += int2string( ftc );
2162 s += "\nhps=";
2163 s += uint2string( hps );
2164 s += "\niStartAt=";
2165 s += uint2string( iStartAt );
2166 s += "\ndxaIndent=";
2167 s += uint2string( dxaIndent );
2168 s += "\ndxaSpace=";
2169 s += uint2string( dxaSpace );
2170 s += "\nANLV Done.";
2171 return s;
2172 }
2173
operator ==(const ANLV & lhs,const ANLV & rhs)2174 bool operator==(const ANLV &lhs, const ANLV &rhs) {
2175
2176 return lhs.nfc==rhs.nfc &&
2177 lhs.cxchTextBefore==rhs.cxchTextBefore &&
2178 lhs.cxchTextAfter==rhs.cxchTextAfter &&
2179 lhs.jc==rhs.jc &&
2180 lhs.fPrev==rhs.fPrev &&
2181 lhs.fHang==rhs.fHang &&
2182 lhs.fSetBold==rhs.fSetBold &&
2183 lhs.fSetItalic==rhs.fSetItalic &&
2184 lhs.fSetSmallCaps==rhs.fSetSmallCaps &&
2185 lhs.fSetCaps==rhs.fSetCaps &&
2186 lhs.fSetStrike==rhs.fSetStrike &&
2187 lhs.fSetKul==rhs.fSetKul &&
2188 lhs.fPrevSpace==rhs.fPrevSpace &&
2189 lhs.fBold==rhs.fBold &&
2190 lhs.fItalic==rhs.fItalic &&
2191 lhs.fSmallCaps==rhs.fSmallCaps &&
2192 lhs.fCaps==rhs.fCaps &&
2193 lhs.fStrike==rhs.fStrike &&
2194 lhs.kul==rhs.kul &&
2195 lhs.ico==rhs.ico &&
2196 lhs.ftc==rhs.ftc &&
2197 lhs.hps==rhs.hps &&
2198 lhs.iStartAt==rhs.iStartAt &&
2199 lhs.dxaIndent==rhs.dxaIndent &&
2200 lhs.dxaSpace==rhs.dxaSpace;
2201 }
2202
operator !=(const ANLV & lhs,const ANLV & rhs)2203 bool operator!=(const ANLV &lhs, const ANLV &rhs) {
2204 return !(lhs==rhs);
2205 }
2206
2207
2208 // ASUMY implementation
2209
ASUMY()2210 ASUMY::ASUMY() {
2211 clear();
2212 }
2213
ASUMY(OLEStreamReader * stream,bool preservePos)2214 ASUMY::ASUMY(OLEStreamReader *stream, bool preservePos) {
2215 clear();
2216 read(stream, preservePos);
2217 }
2218
read(OLEStreamReader * stream,bool preservePos)2219 bool ASUMY::read(OLEStreamReader *stream, bool preservePos) {
2220
2221 if(preservePos)
2222 stream->push();
2223
2224 lLevel=stream->readS32();
2225
2226 if(preservePos)
2227 stream->pop();
2228 return true;
2229 }
2230
write(OLEStreamWriter * stream,bool preservePos) const2231 bool ASUMY::write(OLEStreamWriter *stream, bool preservePos) const {
2232
2233 if(preservePos)
2234 stream->push();
2235
2236 stream->write(lLevel);
2237
2238 if(preservePos)
2239 stream->pop();
2240 return true;
2241 }
2242
clear()2243 void ASUMY::clear() {
2244 lLevel=0;
2245 }
2246
operator ==(const ASUMY & lhs,const ASUMY & rhs)2247 bool operator==(const ASUMY &lhs, const ASUMY &rhs) {
2248
2249 return lhs.lLevel==rhs.lLevel;
2250 }
2251
operator !=(const ASUMY & lhs,const ASUMY & rhs)2252 bool operator!=(const ASUMY &lhs, const ASUMY &rhs) {
2253 return !(lhs==rhs);
2254 }
2255
2256
2257 // ASUMYI implementation
2258
ASUMYI()2259 ASUMYI::ASUMYI() {
2260 clear();
2261 }
2262
ASUMYI(OLEStreamReader * stream,bool preservePos)2263 ASUMYI::ASUMYI(OLEStreamReader *stream, bool preservePos) {
2264 clear();
2265 read(stream, preservePos);
2266 }
2267
read(OLEStreamReader * stream,bool preservePos)2268 bool ASUMYI::read(OLEStreamReader *stream, bool preservePos) {
2269
2270 U16 shifterU16;
2271
2272 if(preservePos)
2273 stream->push();
2274
2275 shifterU16=stream->readU16();
2276 fValid=shifterU16;
2277 shifterU16>>=1;
2278 fView=shifterU16;
2279 shifterU16>>=1;
2280 iViewBy=shifterU16;
2281 shifterU16>>=2;
2282 fUpdateProps=shifterU16;
2283 shifterU16>>=1;
2284 unused0_5=shifterU16;
2285 wDlgLevel=stream->readS16();
2286 lHighestLevel=stream->readS32();
2287 lCurrentLevel=stream->readS32();
2288
2289 if(preservePos)
2290 stream->pop();
2291 return true;
2292 }
2293
write(OLEStreamWriter * stream,bool preservePos) const2294 bool ASUMYI::write(OLEStreamWriter *stream, bool preservePos) const {
2295
2296 U16 shifterU16;
2297
2298 if(preservePos)
2299 stream->push();
2300
2301 shifterU16=fValid;
2302 shifterU16|=fView << 1;
2303 shifterU16|=iViewBy << 2;
2304 shifterU16|=fUpdateProps << 4;
2305 shifterU16|=unused0_5 << 5;
2306 stream->write(shifterU16);
2307 stream->write(wDlgLevel);
2308 stream->write(lHighestLevel);
2309 stream->write(lCurrentLevel);
2310
2311 if(preservePos)
2312 stream->pop();
2313 return true;
2314 }
2315
clear()2316 void ASUMYI::clear() {
2317 fValid=0;
2318 fView=0;
2319 iViewBy=0;
2320 fUpdateProps=0;
2321 unused0_5=0;
2322 wDlgLevel=0;
2323 lHighestLevel=0;
2324 lCurrentLevel=0;
2325 }
2326
operator ==(const ASUMYI & lhs,const ASUMYI & rhs)2327 bool operator==(const ASUMYI &lhs, const ASUMYI &rhs) {
2328
2329 return lhs.fValid==rhs.fValid &&
2330 lhs.fView==rhs.fView &&
2331 lhs.iViewBy==rhs.iViewBy &&
2332 lhs.fUpdateProps==rhs.fUpdateProps &&
2333 lhs.unused0_5==rhs.unused0_5 &&
2334 lhs.wDlgLevel==rhs.wDlgLevel &&
2335 lhs.lHighestLevel==rhs.lHighestLevel &&
2336 lhs.lCurrentLevel==rhs.lCurrentLevel;
2337 }
2338
operator !=(const ASUMYI & lhs,const ASUMYI & rhs)2339 bool operator!=(const ASUMYI &lhs, const ASUMYI &rhs) {
2340 return !(lhs==rhs);
2341 }
2342
2343
2344 // ATRD implementation
2345
ATRD()2346 ATRD::ATRD() {
2347 clear();
2348 }
2349
ATRD(OLEStreamReader * stream,bool preservePos)2350 ATRD::ATRD(OLEStreamReader *stream, bool preservePos) {
2351 clear();
2352 read(stream, preservePos);
2353 }
2354
read(OLEStreamReader * stream,bool preservePos)2355 bool ATRD::read(OLEStreamReader *stream, bool preservePos) {
2356
2357 U16 shifterU16;
2358
2359 if(preservePos)
2360 stream->push();
2361
2362 for(int _i=0; _i<(10); ++_i)
2363 xstUsrInitl[_i]=stream->readU16();
2364 ibst=stream->readS16();
2365 shifterU16=stream->readU16();
2366 ak=shifterU16;
2367 shifterU16>>=2;
2368 unused22_2=shifterU16;
2369 grfbmc=stream->readU16();
2370 lTagBkmk=stream->readS32();
2371
2372 if(preservePos)
2373 stream->pop();
2374 return true;
2375 }
2376
write(OLEStreamWriter * stream,bool preservePos) const2377 bool ATRD::write(OLEStreamWriter *stream, bool preservePos) const {
2378
2379 U16 shifterU16;
2380
2381 if(preservePos)
2382 stream->push();
2383
2384 for(int _i=0; _i<(10); ++_i)
2385 stream->write(xstUsrInitl[_i]);
2386 stream->write(ibst);
2387 shifterU16=ak;
2388 shifterU16|=unused22_2 << 2;
2389 stream->write(shifterU16);
2390 stream->write(grfbmc);
2391 stream->write(lTagBkmk);
2392
2393 if(preservePos)
2394 stream->pop();
2395 return true;
2396 }
2397
clear()2398 void ATRD::clear() {
2399 for(int _i=0; _i<(10); ++_i)
2400 xstUsrInitl[_i]=0;
2401 ibst=0;
2402 ak=0;
2403 unused22_2=0;
2404 grfbmc=0;
2405 lTagBkmk=0;
2406 }
2407
operator ==(const ATRD & lhs,const ATRD & rhs)2408 bool operator==(const ATRD &lhs, const ATRD &rhs) {
2409
2410 for(int _i=0; _i<(10); ++_i) {
2411 if(lhs.xstUsrInitl[_i]!=rhs.xstUsrInitl[_i])
2412 return false;
2413 }
2414
2415 return lhs.ibst==rhs.ibst &&
2416 lhs.ak==rhs.ak &&
2417 lhs.unused22_2==rhs.unused22_2 &&
2418 lhs.grfbmc==rhs.grfbmc &&
2419 lhs.lTagBkmk==rhs.lTagBkmk;
2420 }
2421
operator !=(const ATRD & lhs,const ATRD & rhs)2422 bool operator!=(const ATRD &lhs, const ATRD &rhs) {
2423 return !(lhs==rhs);
2424 }
2425
2426
2427 // BKD implementation
2428
2429 const unsigned int BKD::sizeOf = 6;
2430
BKD()2431 BKD::BKD() {
2432 clear();
2433 }
2434
BKD(OLEStreamReader * stream,bool preservePos)2435 BKD::BKD(OLEStreamReader *stream, bool preservePos) {
2436 clear();
2437 read(stream, preservePos);
2438 }
2439
read(OLEStreamReader * stream,bool preservePos)2440 bool BKD::read(OLEStreamReader *stream, bool preservePos) {
2441
2442 U16 shifterU16;
2443
2444 if(preservePos)
2445 stream->push();
2446
2447 ipgd_itxbxs=stream->readS16();
2448 dcpDepend=stream->readS16();
2449 shifterU16=stream->readU16();
2450 icol=shifterU16;
2451 shifterU16>>=8;
2452 fTableBreak=shifterU16;
2453 shifterU16>>=1;
2454 fColumnBreak=shifterU16;
2455 shifterU16>>=1;
2456 fMarked=shifterU16;
2457 shifterU16>>=1;
2458 fUnk=shifterU16;
2459 shifterU16>>=1;
2460 fTextOverflow=shifterU16;
2461 shifterU16>>=1;
2462 unused4_13=shifterU16;
2463
2464 if(preservePos)
2465 stream->pop();
2466 return true;
2467 }
2468
write(OLEStreamWriter * stream,bool preservePos) const2469 bool BKD::write(OLEStreamWriter *stream, bool preservePos) const {
2470
2471 U16 shifterU16;
2472
2473 if(preservePos)
2474 stream->push();
2475
2476 stream->write(ipgd_itxbxs);
2477 stream->write(dcpDepend);
2478 shifterU16=icol;
2479 shifterU16|=fTableBreak << 8;
2480 shifterU16|=fColumnBreak << 9;
2481 shifterU16|=fMarked << 10;
2482 shifterU16|=fUnk << 11;
2483 shifterU16|=fTextOverflow << 12;
2484 shifterU16|=unused4_13 << 13;
2485 stream->write(shifterU16);
2486
2487 if(preservePos)
2488 stream->pop();
2489 return true;
2490 }
2491
clear()2492 void BKD::clear() {
2493 ipgd_itxbxs=0;
2494 dcpDepend=0;
2495 icol=0;
2496 fTableBreak=0;
2497 fColumnBreak=0;
2498 fMarked=0;
2499 fUnk=0;
2500 fTextOverflow=0;
2501 unused4_13=0;
2502 }
2503
operator ==(const BKD & lhs,const BKD & rhs)2504 bool operator==(const BKD &lhs, const BKD &rhs) {
2505
2506 return lhs.ipgd_itxbxs==rhs.ipgd_itxbxs &&
2507 lhs.dcpDepend==rhs.dcpDepend &&
2508 lhs.icol==rhs.icol &&
2509 lhs.fTableBreak==rhs.fTableBreak &&
2510 lhs.fColumnBreak==rhs.fColumnBreak &&
2511 lhs.fMarked==rhs.fMarked &&
2512 lhs.fUnk==rhs.fUnk &&
2513 lhs.fTextOverflow==rhs.fTextOverflow &&
2514 lhs.unused4_13==rhs.unused4_13;
2515 }
2516
operator !=(const BKD & lhs,const BKD & rhs)2517 bool operator!=(const BKD &lhs, const BKD &rhs) {
2518 return !(lhs==rhs);
2519 }
2520
2521
2522 // BKF implementation
2523
BKF()2524 BKF::BKF() {
2525 clear();
2526 }
2527
BKF(OLEStreamReader * stream,bool preservePos)2528 BKF::BKF(OLEStreamReader *stream, bool preservePos) {
2529 clear();
2530 read(stream, preservePos);
2531 }
2532
read(OLEStreamReader * stream,bool preservePos)2533 bool BKF::read(OLEStreamReader *stream, bool preservePos) {
2534
2535 U16 shifterU16;
2536
2537 if(preservePos)
2538 stream->push();
2539
2540 ibkl=stream->readS16();
2541 shifterU16=stream->readU16();
2542 itcFirst=shifterU16;
2543 shifterU16>>=7;
2544 fPub=shifterU16;
2545 shifterU16>>=1;
2546 itcLim=shifterU16;
2547 shifterU16>>=7;
2548 fCol=shifterU16;
2549
2550 if(preservePos)
2551 stream->pop();
2552 return true;
2553 }
2554
write(OLEStreamWriter * stream,bool preservePos) const2555 bool BKF::write(OLEStreamWriter *stream, bool preservePos) const {
2556
2557 U16 shifterU16;
2558
2559 if(preservePos)
2560 stream->push();
2561
2562 stream->write(ibkl);
2563 shifterU16=itcFirst;
2564 shifterU16|=fPub << 7;
2565 shifterU16|=itcLim << 8;
2566 shifterU16|=fCol << 15;
2567 stream->write(shifterU16);
2568
2569 if(preservePos)
2570 stream->pop();
2571 return true;
2572 }
2573
clear()2574 void BKF::clear() {
2575 ibkl=0;
2576 itcFirst=0;
2577 fPub=0;
2578 itcLim=0;
2579 fCol=0;
2580 }
2581
operator ==(const BKF & lhs,const BKF & rhs)2582 bool operator==(const BKF &lhs, const BKF &rhs) {
2583
2584 return lhs.ibkl==rhs.ibkl &&
2585 lhs.itcFirst==rhs.itcFirst &&
2586 lhs.fPub==rhs.fPub &&
2587 lhs.itcLim==rhs.itcLim &&
2588 lhs.fCol==rhs.fCol;
2589 }
2590
operator !=(const BKF & lhs,const BKF & rhs)2591 bool operator!=(const BKF &lhs, const BKF &rhs) {
2592 return !(lhs==rhs);
2593 }
2594
2595
2596 // BKL implementation
2597
BKL()2598 BKL::BKL() {
2599 clear();
2600 }
2601
BKL(OLEStreamReader * stream,bool preservePos)2602 BKL::BKL(OLEStreamReader *stream, bool preservePos) {
2603 clear();
2604 read(stream, preservePos);
2605 }
2606
read(OLEStreamReader * stream,bool preservePos)2607 bool BKL::read(OLEStreamReader *stream, bool preservePos) {
2608
2609 if(preservePos)
2610 stream->push();
2611
2612 ibkf=stream->readS16();
2613
2614 if(preservePos)
2615 stream->pop();
2616 return true;
2617 }
2618
write(OLEStreamWriter * stream,bool preservePos) const2619 bool BKL::write(OLEStreamWriter *stream, bool preservePos) const {
2620
2621 if(preservePos)
2622 stream->push();
2623
2624 stream->write(ibkf);
2625
2626 if(preservePos)
2627 stream->pop();
2628 return true;
2629 }
2630
clear()2631 void BKL::clear() {
2632 ibkf=0;
2633 }
2634
operator ==(const BKL & lhs,const BKL & rhs)2635 bool operator==(const BKL &lhs, const BKL &rhs) {
2636
2637 return lhs.ibkf==rhs.ibkf;
2638 }
2639
operator !=(const BKL & lhs,const BKL & rhs)2640 bool operator!=(const BKL &lhs, const BKL &rhs) {
2641 return !(lhs==rhs);
2642 }
2643
2644
2645 // BRC10 implementation
2646
BRC10()2647 BRC10::BRC10() {
2648 clear();
2649 }
2650
BRC10(OLEStreamReader * stream,bool preservePos)2651 BRC10::BRC10(OLEStreamReader *stream, bool preservePos) {
2652 clear();
2653 read(stream, preservePos);
2654 }
2655
read(OLEStreamReader * stream,bool preservePos)2656 bool BRC10::read(OLEStreamReader *stream, bool preservePos) {
2657
2658 U16 shifterU16;
2659
2660 if(preservePos)
2661 stream->push();
2662
2663 shifterU16=stream->readU16();
2664 dxpLine2Width=shifterU16;
2665 shifterU16>>=3;
2666 dxpSpaceBetween=shifterU16;
2667 shifterU16>>=3;
2668 dxpLine1Width=shifterU16;
2669 shifterU16>>=3;
2670 dxpSpace=shifterU16;
2671 shifterU16>>=5;
2672 fShadow=shifterU16;
2673 shifterU16>>=1;
2674 fSpare=shifterU16;
2675
2676 if(preservePos)
2677 stream->pop();
2678 return true;
2679 }
2680
write(OLEStreamWriter * stream,bool preservePos) const2681 bool BRC10::write(OLEStreamWriter *stream, bool preservePos) const {
2682
2683 U16 shifterU16;
2684
2685 if(preservePos)
2686 stream->push();
2687
2688 shifterU16=dxpLine2Width;
2689 shifterU16|=dxpSpaceBetween << 3;
2690 shifterU16|=dxpLine1Width << 6;
2691 shifterU16|=dxpSpace << 9;
2692 shifterU16|=fShadow << 14;
2693 shifterU16|=fSpare << 15;
2694 stream->write(shifterU16);
2695
2696 if(preservePos)
2697 stream->pop();
2698 return true;
2699 }
2700
clear()2701 void BRC10::clear() {
2702 dxpLine2Width=0;
2703 dxpSpaceBetween=0;
2704 dxpLine1Width=0;
2705 dxpSpace=0;
2706 fShadow=0;
2707 fSpare=0;
2708 }
2709
operator ==(const BRC10 & lhs,const BRC10 & rhs)2710 bool operator==(const BRC10 &lhs, const BRC10 &rhs) {
2711
2712 return lhs.dxpLine2Width==rhs.dxpLine2Width &&
2713 lhs.dxpSpaceBetween==rhs.dxpSpaceBetween &&
2714 lhs.dxpLine1Width==rhs.dxpLine1Width &&
2715 lhs.dxpSpace==rhs.dxpSpace &&
2716 lhs.fShadow==rhs.fShadow &&
2717 lhs.fSpare==rhs.fSpare;
2718 }
2719
operator !=(const BRC10 & lhs,const BRC10 & rhs)2720 bool operator!=(const BRC10 &lhs, const BRC10 &rhs) {
2721 return !(lhs==rhs);
2722 }
2723
2724
2725 // BTE implementation
2726
2727 const unsigned int BTE::sizeOf = 4;
2728
BTE()2729 BTE::BTE() {
2730 clear();
2731 }
2732
BTE(OLEStreamReader * stream,bool preservePos)2733 BTE::BTE(OLEStreamReader *stream, bool preservePos) {
2734 clear();
2735 read(stream, preservePos);
2736 }
2737
read(OLEStreamReader * stream,bool preservePos)2738 bool BTE::read(OLEStreamReader *stream, bool preservePos) {
2739
2740 if(preservePos)
2741 stream->push();
2742
2743 pn=stream->readU32();
2744
2745 if(preservePos)
2746 stream->pop();
2747 return true;
2748 }
2749
write(OLEStreamWriter * stream,bool preservePos) const2750 bool BTE::write(OLEStreamWriter *stream, bool preservePos) const {
2751
2752 if(preservePos)
2753 stream->push();
2754
2755 stream->write(pn);
2756
2757 if(preservePos)
2758 stream->pop();
2759 return true;
2760 }
2761
clear()2762 void BTE::clear() {
2763 pn=0;
2764 }
2765
operator ==(const BTE & lhs,const BTE & rhs)2766 bool operator==(const BTE &lhs, const BTE &rhs) {
2767
2768 return lhs.pn==rhs.pn;
2769 }
2770
operator !=(const BTE & lhs,const BTE & rhs)2771 bool operator!=(const BTE &lhs, const BTE &rhs) {
2772 return !(lhs==rhs);
2773 }
2774
2775
2776 // CHP implementation
2777
CHP()2778 CHP::CHP() : Shared() {
2779 clear();
2780 }
2781
CHP(OLEStreamReader * stream,bool preservePos)2782 CHP::CHP(OLEStreamReader *stream, bool preservePos) : Shared() {
2783 clear();
2784 read(stream, preservePos);
2785 }
2786
read(OLEStreamReader * stream,bool preservePos)2787 bool CHP::read(OLEStreamReader *stream, bool preservePos) {
2788
2789 U8 shifterU8;
2790 U16 shifterU16;
2791
2792 if(preservePos)
2793 stream->push();
2794
2795 shifterU8=stream->readU8();
2796 fBold=shifterU8;
2797 shifterU8>>=1;
2798 fItalic=shifterU8;
2799 shifterU8>>=1;
2800 fRMarkDel=shifterU8;
2801 shifterU8>>=1;
2802 fOutline=shifterU8;
2803 shifterU8>>=1;
2804 fFldVanish=shifterU8;
2805 shifterU8>>=1;
2806 fSmallCaps=shifterU8;
2807 shifterU8>>=1;
2808 fCaps=shifterU8;
2809 shifterU8>>=1;
2810 fVanish=shifterU8;
2811 shifterU8=stream->readU8();
2812 fRMark=shifterU8;
2813 shifterU8>>=1;
2814 fSpec=shifterU8;
2815 shifterU8>>=1;
2816 fStrike=shifterU8;
2817 shifterU8>>=1;
2818 fObj=shifterU8;
2819 shifterU8>>=1;
2820 fShadow=shifterU8;
2821 shifterU8>>=1;
2822 fLowerCase=shifterU8;
2823 shifterU8>>=1;
2824 fData=shifterU8;
2825 shifterU8>>=1;
2826 fOle2=shifterU8;
2827 shifterU16=stream->readU16();
2828 fEmboss=shifterU16;
2829 shifterU16>>=1;
2830 fImprint=shifterU16;
2831 shifterU16>>=1;
2832 fDStrike=shifterU16;
2833 shifterU16>>=1;
2834 fUsePgsuSettings=shifterU16;
2835 shifterU16>>=1;
2836 unused2_4=shifterU16;
2837 unused4=stream->readS32();
2838 ftc=stream->readS16();
2839 ftcAscii=stream->readS16();
2840 ftcFE=stream->readS16();
2841 ftcOther=stream->readS16();
2842 hps=stream->readU16();
2843 dxaSpace=stream->readS32();
2844 shifterU8=stream->readU8();
2845 iss=shifterU8;
2846 shifterU8>>=3;
2847 kul=shifterU8;
2848 shifterU8>>=4;
2849 fSpecSymbol=shifterU8;
2850 shifterU8=stream->readU8();
2851 //ico=shifterU8;
2852 shifterU8>>=5;
2853 unused23_5=shifterU8;
2854 shifterU8>>=1;
2855 fSysVanish=shifterU8;
2856 shifterU8>>=1;
2857 hpScript=shifterU8;
2858 hpsPos=stream->readS16();
2859 lid=stream->readU16();
2860 lidDefault=stream->readU16();
2861 lidFE=stream->readU16();
2862 idct=stream->readU8();
2863 idctHint=stream->readU8();
2864 wCharScale=stream->readU16();
2865 fcPic_fcObj_lTagObj=stream->readS32();
2866 ibstRMark=stream->readS16();
2867 ibstRMarkDel=stream->readS16();
2868 dttmRMark.read(stream, false);
2869 dttmRMarkDel.read(stream, false);
2870 unused52=stream->readS16();
2871 istd=stream->readU16();
2872 ftcSym=stream->readS16();
2873 xchSym=stream->readU16();
2874 idslRMReason=stream->readS16();
2875 idslRMReasonDel=stream->readS16();
2876 ysr=stream->readU8();
2877 chYsr=stream->readU8();
2878 chse=stream->readU16();
2879 hpsKern=stream->readU16();
2880 shifterU16=stream->readU16();
2881 icoHighlight=shifterU16;
2882 shifterU16>>=5;
2883 fHighlight=shifterU16;
2884 shifterU16>>=1;
2885 kcd=shifterU16;
2886 shifterU16>>=3;
2887 fNavHighlight=shifterU16;
2888 shifterU16>>=1;
2889 fChsDiff=shifterU16;
2890 shifterU16>>=1;
2891 fMacChs=shifterU16;
2892 shifterU16>>=1;
2893 fFtcAsciSym=shifterU16;
2894 shifterU16>>=1;
2895 reserved_3=shifterU16;
2896 fPropMark=stream->readU16();
2897 ibstPropRMark=stream->readS16();
2898 dttmPropRMark.read(stream, false);
2899 sfxtText=stream->readU8();
2900 unused81=stream->readU8();
2901 unused82=stream->readU8();
2902 unused83=stream->readU16();
2903 unused85=stream->readS16();
2904 unused87=stream->readU32();
2905 fDispFldRMark=stream->readS8();
2906 ibstDispFldRMark=stream->readS16();
2907 dttmDispFldRMark=stream->readU32();
2908 for(int _i=0; _i<(16); ++_i)
2909 xstDispFldRMark[_i]=stream->readU16();
2910 shd.read(stream, false);
2911 brc.read(stream, false);
2912
2913 if(preservePos)
2914 stream->pop();
2915 return true;
2916 }
2917
write(OLEStreamWriter * stream,bool preservePos) const2918 bool CHP::write(OLEStreamWriter *stream, bool preservePos) const {
2919
2920 U8 shifterU8;
2921 U16 shifterU16;
2922
2923 if(preservePos)
2924 stream->push();
2925
2926 shifterU8=fBold;
2927 shifterU8|=fItalic << 1;
2928 shifterU8|=fRMarkDel << 2;
2929 shifterU8|=fOutline << 3;
2930 shifterU8|=fFldVanish << 4;
2931 shifterU8|=fSmallCaps << 5;
2932 shifterU8|=fCaps << 6;
2933 shifterU8|=fVanish << 7;
2934 stream->write(shifterU8);
2935 shifterU8=fRMark;
2936 shifterU8|=fSpec << 1;
2937 shifterU8|=fStrike << 2;
2938 shifterU8|=fObj << 3;
2939 shifterU8|=fShadow << 4;
2940 shifterU8|=fLowerCase << 5;
2941 shifterU8|=fData << 6;
2942 shifterU8|=fOle2 << 7;
2943 stream->write(shifterU8);
2944 shifterU16=fEmboss;
2945 shifterU16|=fImprint << 1;
2946 shifterU16|=fDStrike << 2;
2947 shifterU16|=fUsePgsuSettings << 3;
2948 shifterU16|=unused2_4 << 4;
2949 stream->write(shifterU16);
2950 stream->write(unused4);
2951 stream->write(ftc);
2952 stream->write(ftcAscii);
2953 stream->write(ftcFE);
2954 stream->write(ftcOther);
2955 stream->write(hps);
2956 stream->write(dxaSpace);
2957 shifterU8=iss;
2958 shifterU8|=kul << 3;
2959 shifterU8|=fSpecSymbol << 7;
2960 stream->write(shifterU8);
2961 shifterU8=0; //Was ico
2962 shifterU8|=unused23_5 << 5;
2963 shifterU8|=fSysVanish << 6;
2964 shifterU8|=hpScript << 7;
2965 stream->write(shifterU8);
2966 stream->write(hpsPos);
2967 stream->write(lid);
2968 stream->write(lidDefault);
2969 stream->write(lidFE);
2970 stream->write(idct);
2971 stream->write(idctHint);
2972 stream->write(wCharScale);
2973 stream->write(fcPic_fcObj_lTagObj);
2974 stream->write(ibstRMark);
2975 stream->write(ibstRMarkDel);
2976 dttmRMark.write(stream, false);
2977 dttmRMarkDel.write(stream, false);
2978 stream->write(unused52);
2979 stream->write(istd);
2980 stream->write(ftcSym);
2981 stream->write(xchSym);
2982 stream->write(idslRMReason);
2983 stream->write(idslRMReasonDel);
2984 stream->write(ysr);
2985 stream->write(chYsr);
2986 stream->write(chse);
2987 stream->write(hpsKern);
2988 shifterU16=icoHighlight;
2989 shifterU16|=fHighlight << 5;
2990 shifterU16|=kcd << 6;
2991 shifterU16|=fNavHighlight << 9;
2992 shifterU16|=fChsDiff << 10;
2993 shifterU16|=fMacChs << 11;
2994 shifterU16|=fFtcAsciSym << 12;
2995 shifterU16|=reserved_3 << 13;
2996 stream->write(shifterU16);
2997 stream->write(fPropMark);
2998 stream->write(ibstPropRMark);
2999 dttmPropRMark.write(stream, false);
3000 stream->write(sfxtText);
3001 stream->write(unused81);
3002 stream->write(unused82);
3003 stream->write(unused83);
3004 stream->write(unused85);
3005 stream->write(unused87);
3006 stream->write(fDispFldRMark);
3007 stream->write(ibstDispFldRMark);
3008 stream->write(dttmDispFldRMark);
3009 for(int _i=0; _i<(16); ++_i)
3010 stream->write(xstDispFldRMark[_i]);
3011 shd.write(stream, false);
3012 brc.write(stream, false);
3013
3014 if(preservePos)
3015 stream->pop();
3016 return true;
3017 }
3018
clear()3019 void CHP::clear() {
3020 fBold=0;
3021 fItalic=0;
3022 fRMarkDel=0;
3023 fOutline=0;
3024 fFldVanish=0;
3025 fSmallCaps=0;
3026 fCaps=0;
3027 fVanish=0;
3028 fRMark=0;
3029 fSpec=0;
3030 fStrike=0;
3031 fObj=0;
3032 fShadow=0;
3033 fLowerCase=0;
3034 fData=0;
3035 fOle2=0;
3036 fEmboss=0;
3037 fImprint=0;
3038 fDStrike=0;
3039 fUsePgsuSettings=0;
3040 unused2_4=0;
3041 unused4=0;
3042 ftc=0;
3043 ftcAscii=0;
3044 ftcFE=0;
3045 ftcOther=0;
3046 hps=20;
3047 dxaSpace=0;
3048 iss=0;
3049 kul=0;
3050 fSpecSymbol=0;
3051 unused23_5=0;
3052 fSysVanish=0;
3053 hpScript=0;
3054 hpsPos=0;
3055 lid=0x0400;
3056 lidDefault=0x0400;
3057 lidFE=0x0400;
3058 idct=0;
3059 idctHint=0;
3060 wCharScale=100;
3061 fcPic_fcObj_lTagObj=-1;
3062 ibstRMark=0;
3063 ibstRMarkDel=0;
3064 dttmRMark.clear();
3065 dttmRMarkDel.clear();
3066 unused52=0;
3067 istd=10;
3068 ftcSym=0;
3069 xchSym=0;
3070 idslRMReason=0;
3071 idslRMReasonDel=0;
3072 ysr=0;
3073 chYsr=0;
3074 chse=0;
3075 hpsKern=0;
3076 icoHighlight=0;
3077 fHighlight=0;
3078 kcd=0;
3079 fNavHighlight=0;
3080 fChsDiff=0;
3081 fMacChs=0;
3082 fFtcAsciSym=0;
3083 reserved_3=0;
3084 fPropMark=0;
3085 ibstPropRMark=0;
3086 dttmPropRMark.clear();
3087 sfxtText=0;
3088 unused81=0;
3089 unused82=0;
3090 unused83=0;
3091 unused85=0;
3092 unused87=0;
3093 fDispFldRMark=0;
3094 ibstDispFldRMark=0;
3095 dttmDispFldRMark=0;
3096 for(int _i=0; _i<(16); ++_i)
3097 xstDispFldRMark[_i]=0;
3098 shd.clear();
3099 brc.clear();
3100 cv=0;
3101 }
3102
dump() const3103 void CHP::dump() const
3104 {
3105 wvlog << "Dumping CHP:" << std::endl;
3106 wvlog << toString().c_str() << std::endl;
3107 wvlog << "\nDumping CHP done." << std::endl;
3108 }
3109
toString() const3110 std::string CHP::toString() const
3111 {
3112 std::string s( "CHP:" );
3113 s += "\nfBold=";
3114 s += uint2string( fBold );
3115 s += "\nfItalic=";
3116 s += uint2string( fItalic );
3117 s += "\nfRMarkDel=";
3118 s += uint2string( fRMarkDel );
3119 s += "\nfOutline=";
3120 s += uint2string( fOutline );
3121 s += "\nfFldVanish=";
3122 s += uint2string( fFldVanish );
3123 s += "\nfSmallCaps=";
3124 s += uint2string( fSmallCaps );
3125 s += "\nfCaps=";
3126 s += uint2string( fCaps );
3127 s += "\nfVanish=";
3128 s += uint2string( fVanish );
3129 s += "\nfRMark=";
3130 s += uint2string( fRMark );
3131 s += "\nfSpec=";
3132 s += uint2string( fSpec );
3133 s += "\nfStrike=";
3134 s += uint2string( fStrike );
3135 s += "\nfObj=";
3136 s += uint2string( fObj );
3137 s += "\nfShadow=";
3138 s += uint2string( fShadow );
3139 s += "\nfLowerCase=";
3140 s += uint2string( fLowerCase );
3141 s += "\nfData=";
3142 s += uint2string( fData );
3143 s += "\nfOle2=";
3144 s += uint2string( fOle2 );
3145 s += "\nfEmboss=";
3146 s += uint2string( fEmboss );
3147 s += "\nfImprint=";
3148 s += uint2string( fImprint );
3149 s += "\nfDStrike=";
3150 s += uint2string( fDStrike );
3151 s += "\nfUsePgsuSettings=";
3152 s += uint2string( fUsePgsuSettings );
3153 s += "\nunused2_4=";
3154 s += uint2string( unused2_4 );
3155 s += "\nunused4=";
3156 s += int2string( unused4 );
3157 s += "\nftc=";
3158 s += int2string( ftc );
3159 s += "\nftcAscii=";
3160 s += int2string( ftcAscii );
3161 s += "\nftcFE=";
3162 s += int2string( ftcFE );
3163 s += "\nftcOther=";
3164 s += int2string( ftcOther );
3165 s += "\nhps=";
3166 s += uint2string( hps );
3167 s += "\ndxaSpace=";
3168 s += int2string( dxaSpace );
3169 s += "\niss=";
3170 s += uint2string( iss );
3171 s += "\nkul=";
3172 s += uint2string( kul );
3173 s += "\nfSpecSymbol=";
3174 s += uint2string( fSpecSymbol );
3175 s += "\nunused23_5=";
3176 s += uint2string( unused23_5 );
3177 s += "\nfSysVanish=";
3178 s += uint2string( fSysVanish );
3179 s += "\nhpScript=";
3180 s += uint2string( hpScript );
3181 s += "\nhpsPos=";
3182 s += int2string( hpsPos );
3183 s += "\nlid=";
3184 s += uint2string( lid );
3185 s += "\nlidDefault=";
3186 s += uint2string( lidDefault );
3187 s += "\nlidFE=";
3188 s += uint2string( lidFE );
3189 s += "\nidct=";
3190 s += uint2string( idct );
3191 s += "\nidctHint=";
3192 s += uint2string( idctHint );
3193 s += "\nwCharScale=";
3194 s += uint2string( wCharScale );
3195 s += "\nfcPic_fcObj_lTagObj=";
3196 s += int2string( fcPic_fcObj_lTagObj );
3197 s += "\nibstRMark=";
3198 s += int2string( ibstRMark );
3199 s += "\nibstRMarkDel=";
3200 s += int2string( ibstRMarkDel );
3201 s += "\ndttmRMark=";
3202 s += "\n{" + dttmRMark.toString() + "}\n";
3203 s += "\ndttmRMarkDel=";
3204 s += "\n{" + dttmRMarkDel.toString() + "}\n";
3205 s += "\nunused52=";
3206 s += int2string( unused52 );
3207 s += "\nistd=";
3208 s += uint2string( istd );
3209 s += "\nftcSym=";
3210 s += int2string( ftcSym );
3211 s += "\nxchSym=";
3212 s += uint2string( xchSym );
3213 s += "\nidslRMReason=";
3214 s += int2string( idslRMReason );
3215 s += "\nidslRMReasonDel=";
3216 s += int2string( idslRMReasonDel );
3217 s += "\nysr=";
3218 s += uint2string( ysr );
3219 s += "\nchYsr=";
3220 s += uint2string( chYsr );
3221 s += "\nchse=";
3222 s += uint2string( chse );
3223 s += "\nhpsKern=";
3224 s += uint2string( hpsKern );
3225 s += "\nicoHighlight=";
3226 s += uint2string( icoHighlight );
3227 s += "\nfHighlight=";
3228 s += uint2string( fHighlight );
3229 s += "\nkcd=";
3230 s += uint2string( kcd );
3231 s += "\nfNavHighlight=";
3232 s += uint2string( fNavHighlight );
3233 s += "\nfChsDiff=";
3234 s += uint2string( fChsDiff );
3235 s += "\nfMacChs=";
3236 s += uint2string( fMacChs );
3237 s += "\nfFtcAsciSym=";
3238 s += uint2string( fFtcAsciSym );
3239 s += "\nreserved_3=";
3240 s += uint2string( reserved_3 );
3241 s += "\nfPropMark=";
3242 s += uint2string( fPropMark );
3243 s += "\nibstPropRMark=";
3244 s += int2string( ibstPropRMark );
3245 s += "\ndttmPropRMark=";
3246 s += "\n{" + dttmPropRMark.toString() + "}\n";
3247 s += "\nsfxtText=";
3248 s += uint2string( sfxtText );
3249 s += "\nunused81=";
3250 s += uint2string( unused81 );
3251 s += "\nunused82=";
3252 s += uint2string( unused82 );
3253 s += "\nunused83=";
3254 s += uint2string( unused83 );
3255 s += "\nunused85=";
3256 s += int2string( unused85 );
3257 s += "\nunused87=";
3258 s += uint2string( unused87 );
3259 s += "\nfDispFldRMark=";
3260 s += int2string( fDispFldRMark );
3261 s += "\nibstDispFldRMark=";
3262 s += int2string( ibstDispFldRMark );
3263 s += "\ndttmDispFldRMark=";
3264 s += uint2string( dttmDispFldRMark );
3265 for(int _i=0; _i<(16); ++_i) {
3266 s += "\nxstDispFldRMark[" + int2string( _i ) + "]=";
3267 s += uint2string( xstDispFldRMark[_i] );
3268 }
3269 s += "\nshd=";
3270 s += "\n{" + shd.toString() + "}\n";
3271 s += "\nbrc=";
3272 s += "\n{" + brc.toString() + "}\n";
3273 s += "\nCHP Done.";
3274 return s;
3275 }
3276
operator ==(const CHP & lhs,const CHP & rhs)3277 bool operator==(const CHP &lhs, const CHP &rhs) {
3278
3279 for(int _i=0; _i<(16); ++_i) {
3280 if(lhs.xstDispFldRMark[_i]!=rhs.xstDispFldRMark[_i])
3281 return false;
3282 }
3283
3284 return lhs.fBold==rhs.fBold &&
3285 lhs.fItalic==rhs.fItalic &&
3286 lhs.fRMarkDel==rhs.fRMarkDel &&
3287 lhs.fOutline==rhs.fOutline &&
3288 lhs.fFldVanish==rhs.fFldVanish &&
3289 lhs.fSmallCaps==rhs.fSmallCaps &&
3290 lhs.fCaps==rhs.fCaps &&
3291 lhs.fVanish==rhs.fVanish &&
3292 lhs.fRMark==rhs.fRMark &&
3293 lhs.fSpec==rhs.fSpec &&
3294 lhs.fStrike==rhs.fStrike &&
3295 lhs.fObj==rhs.fObj &&
3296 lhs.fShadow==rhs.fShadow &&
3297 lhs.fLowerCase==rhs.fLowerCase &&
3298 lhs.fData==rhs.fData &&
3299 lhs.fOle2==rhs.fOle2 &&
3300 lhs.fEmboss==rhs.fEmboss &&
3301 lhs.fImprint==rhs.fImprint &&
3302 lhs.fDStrike==rhs.fDStrike &&
3303 lhs.fUsePgsuSettings==rhs.fUsePgsuSettings &&
3304 lhs.unused2_4==rhs.unused2_4 &&
3305 lhs.unused4==rhs.unused4 &&
3306 lhs.ftc==rhs.ftc &&
3307 lhs.ftcAscii==rhs.ftcAscii &&
3308 lhs.ftcFE==rhs.ftcFE &&
3309 lhs.ftcOther==rhs.ftcOther &&
3310 lhs.hps==rhs.hps &&
3311 lhs.dxaSpace==rhs.dxaSpace &&
3312 lhs.iss==rhs.iss &&
3313 lhs.kul==rhs.kul &&
3314 lhs.fSpecSymbol==rhs.fSpecSymbol &&
3315 lhs.cv==rhs.cv &&
3316 lhs.unused23_5==rhs.unused23_5 &&
3317 lhs.fSysVanish==rhs.fSysVanish &&
3318 lhs.hpScript==rhs.hpScript &&
3319 lhs.hpsPos==rhs.hpsPos &&
3320 lhs.lid==rhs.lid &&
3321 lhs.lidDefault==rhs.lidDefault &&
3322 lhs.lidFE==rhs.lidFE &&
3323 lhs.idct==rhs.idct &&
3324 lhs.idctHint==rhs.idctHint &&
3325 lhs.wCharScale==rhs.wCharScale &&
3326 lhs.fcPic_fcObj_lTagObj==rhs.fcPic_fcObj_lTagObj &&
3327 lhs.ibstRMark==rhs.ibstRMark &&
3328 lhs.ibstRMarkDel==rhs.ibstRMarkDel &&
3329 lhs.dttmRMark==rhs.dttmRMark &&
3330 lhs.dttmRMarkDel==rhs.dttmRMarkDel &&
3331 lhs.unused52==rhs.unused52 &&
3332 lhs.istd==rhs.istd &&
3333 lhs.ftcSym==rhs.ftcSym &&
3334 lhs.xchSym==rhs.xchSym &&
3335 lhs.idslRMReason==rhs.idslRMReason &&
3336 lhs.idslRMReasonDel==rhs.idslRMReasonDel &&
3337 lhs.ysr==rhs.ysr &&
3338 lhs.chYsr==rhs.chYsr &&
3339 lhs.chse==rhs.chse &&
3340 lhs.hpsKern==rhs.hpsKern &&
3341 lhs.icoHighlight==rhs.icoHighlight &&
3342 lhs.fHighlight==rhs.fHighlight &&
3343 lhs.kcd==rhs.kcd &&
3344 lhs.fNavHighlight==rhs.fNavHighlight &&
3345 lhs.fChsDiff==rhs.fChsDiff &&
3346 lhs.fMacChs==rhs.fMacChs &&
3347 lhs.fFtcAsciSym==rhs.fFtcAsciSym &&
3348 lhs.reserved_3==rhs.reserved_3 &&
3349 lhs.fPropMark==rhs.fPropMark &&
3350 lhs.ibstPropRMark==rhs.ibstPropRMark &&
3351 lhs.dttmPropRMark==rhs.dttmPropRMark &&
3352 lhs.sfxtText==rhs.sfxtText &&
3353 lhs.unused81==rhs.unused81 &&
3354 lhs.unused82==rhs.unused82 &&
3355 lhs.unused83==rhs.unused83 &&
3356 lhs.unused85==rhs.unused85 &&
3357 lhs.unused87==rhs.unused87 &&
3358 lhs.fDispFldRMark==rhs.fDispFldRMark &&
3359 lhs.ibstDispFldRMark==rhs.ibstDispFldRMark &&
3360 lhs.dttmDispFldRMark==rhs.dttmDispFldRMark &&
3361 lhs.shd==rhs.shd &&
3362 lhs.brc==rhs.brc;
3363 }
3364
operator !=(const CHP & lhs,const CHP & rhs)3365 bool operator!=(const CHP &lhs, const CHP &rhs) {
3366 return !(lhs==rhs);
3367 }
3368
3369
3370 // DCS implementation
3371
DCS()3372 DCS::DCS() {
3373 clear();
3374 }
3375
DCS(OLEStreamReader * stream,bool preservePos)3376 DCS::DCS(OLEStreamReader *stream, bool preservePos) {
3377 clear();
3378 read(stream, preservePos);
3379 }
3380
DCS(const U8 * ptr)3381 DCS::DCS(const U8 *ptr) {
3382 clear();
3383 readPtr(ptr);
3384 }
3385
read(OLEStreamReader * stream,bool preservePos)3386 bool DCS::read(OLEStreamReader *stream, bool preservePos) {
3387
3388 U8 shifterU8;
3389
3390 if(preservePos)
3391 stream->push();
3392
3393 shifterU8=stream->readU8();
3394 fdct=shifterU8;
3395 shifterU8>>=3;
3396 lines=shifterU8;
3397 unused1=stream->readU8();
3398
3399 if(preservePos)
3400 stream->pop();
3401 return true;
3402 }
3403
readPtr(const U8 * ptr)3404 void DCS::readPtr(const U8 *ptr) {
3405
3406 U8 shifterU8;
3407
3408 shifterU8=readU8(ptr);
3409 ptr+=sizeof(U8);
3410 fdct=shifterU8;
3411 shifterU8>>=3;
3412 lines=shifterU8;
3413 unused1=readU8(ptr);
3414 ptr+=sizeof(U8);
3415 }
3416
write(OLEStreamWriter * stream,bool preservePos) const3417 bool DCS::write(OLEStreamWriter *stream, bool preservePos) const {
3418
3419 U8 shifterU8;
3420
3421 if(preservePos)
3422 stream->push();
3423
3424 shifterU8=fdct;
3425 shifterU8|=lines << 3;
3426 stream->write(shifterU8);
3427 stream->write(unused1);
3428
3429 if(preservePos)
3430 stream->pop();
3431 return true;
3432 }
3433
clear()3434 void DCS::clear() {
3435 fdct=0;
3436 lines=0;
3437 unused1=0;
3438 }
3439
dump() const3440 void DCS::dump() const
3441 {
3442 wvlog << "Dumping DCS:" << std::endl;
3443 wvlog << toString().c_str() << std::endl;
3444 wvlog << "\nDumping DCS done." << std::endl;
3445 }
3446
toString() const3447 std::string DCS::toString() const
3448 {
3449 std::string s( "DCS:" );
3450 s += "\nfdct=";
3451 s += uint2string( fdct );
3452 s += "\nlines=";
3453 s += uint2string( lines );
3454 s += "\nunused1=";
3455 s += uint2string( unused1 );
3456 s += "\nDCS Done.";
3457 return s;
3458 }
3459
operator ==(const DCS & lhs,const DCS & rhs)3460 bool operator==(const DCS &lhs, const DCS &rhs) {
3461
3462 return lhs.fdct==rhs.fdct &&
3463 lhs.lines==rhs.lines &&
3464 lhs.unused1==rhs.unused1;
3465 }
3466
operator !=(const DCS & lhs,const DCS & rhs)3467 bool operator!=(const DCS &lhs, const DCS &rhs) {
3468 return !(lhs==rhs);
3469 }
3470
3471
3472 // DOGRID implementation
3473
DOGRID()3474 DOGRID::DOGRID() {
3475 clear();
3476 }
3477
DOGRID(OLEStreamReader * stream,bool preservePos)3478 DOGRID::DOGRID(OLEStreamReader *stream, bool preservePos) {
3479 clear();
3480 read(stream, preservePos);
3481 }
3482
read(OLEStreamReader * stream,bool preservePos)3483 bool DOGRID::read(OLEStreamReader *stream, bool preservePos) {
3484
3485 U16 shifterU16;
3486
3487 if(preservePos)
3488 stream->push();
3489
3490 xaGrid=stream->readS16();
3491 yaGrid=stream->readS16();
3492 dxaGrid=stream->readS16();
3493 dyaGrid=stream->readS16();
3494 shifterU16=stream->readU16();
3495 dyGridDisplay=shifterU16;
3496 shifterU16>>=7;
3497 fTurnItOff=shifterU16;
3498 shifterU16>>=1;
3499 dxGridDisplay=shifterU16;
3500 shifterU16>>=7;
3501 fFollowMargins=shifterU16;
3502
3503 if(preservePos)
3504 stream->pop();
3505 return true;
3506 }
3507
write(OLEStreamWriter * stream,bool preservePos) const3508 bool DOGRID::write(OLEStreamWriter *stream, bool preservePos) const {
3509
3510 U16 shifterU16;
3511
3512 if(preservePos)
3513 stream->push();
3514
3515 stream->write(xaGrid);
3516 stream->write(yaGrid);
3517 stream->write(dxaGrid);
3518 stream->write(dyaGrid);
3519 shifterU16=dyGridDisplay;
3520 shifterU16|=fTurnItOff << 7;
3521 shifterU16|=dxGridDisplay << 8;
3522 shifterU16|=fFollowMargins << 15;
3523 stream->write(shifterU16);
3524
3525 if(preservePos)
3526 stream->pop();
3527 return true;
3528 }
3529
clear()3530 void DOGRID::clear() {
3531 xaGrid=0;
3532 yaGrid=0;
3533 dxaGrid=0;
3534 dyaGrid=0;
3535 dyGridDisplay=0;
3536 fTurnItOff=0;
3537 dxGridDisplay=0;
3538 fFollowMargins=0;
3539 }
3540
operator ==(const DOGRID & lhs,const DOGRID & rhs)3541 bool operator==(const DOGRID &lhs, const DOGRID &rhs) {
3542
3543 return lhs.xaGrid==rhs.xaGrid &&
3544 lhs.yaGrid==rhs.yaGrid &&
3545 lhs.dxaGrid==rhs.dxaGrid &&
3546 lhs.dyaGrid==rhs.dyaGrid &&
3547 lhs.dyGridDisplay==rhs.dyGridDisplay &&
3548 lhs.fTurnItOff==rhs.fTurnItOff &&
3549 lhs.dxGridDisplay==rhs.dxGridDisplay &&
3550 lhs.fFollowMargins==rhs.fFollowMargins;
3551 }
3552
operator !=(const DOGRID & lhs,const DOGRID & rhs)3553 bool operator!=(const DOGRID &lhs, const DOGRID &rhs) {
3554 return !(lhs==rhs);
3555 }
3556
3557
3558 // DOP implementation
3559
DOP()3560 DOP::DOP() {
3561 clear();
3562 }
3563
DOP(OLEStreamReader * stream,bool preservePos)3564 DOP::DOP(OLEStreamReader *stream, bool preservePos) {
3565 clear();
3566 read(stream, preservePos);
3567 }
3568
read(OLEStreamReader * stream,bool preservePos)3569 bool DOP::read(OLEStreamReader *stream, bool preservePos) {
3570
3571 U8 shifterU8;
3572 U16 shifterU16;
3573 U32 shifterU32;
3574
3575 if(preservePos)
3576 stream->push();
3577
3578 shifterU16=stream->readU16();
3579 fFacingPages=shifterU16;
3580 shifterU16>>=1;
3581 fWidowControl=shifterU16;
3582 shifterU16>>=1;
3583 fPMHMainDoc=shifterU16;
3584 shifterU16>>=1;
3585 grfSuppression=shifterU16;
3586 shifterU16>>=2;
3587 fpc=shifterU16;
3588 shifterU16>>=2;
3589 unused0_7=shifterU16;
3590 shifterU16>>=1;
3591 grpfIhdt=shifterU16;
3592 shifterU16=stream->readU16();
3593 rncFtn=shifterU16;
3594 shifterU16>>=2;
3595 nFtn=shifterU16;
3596 shifterU8=stream->readU8();
3597 fOutlineDirtySave=shifterU8;
3598 shifterU8>>=1;
3599 unused4_1=shifterU8;
3600 shifterU8=stream->readU8();
3601 fOnlyMacPics=shifterU8;
3602 shifterU8>>=1;
3603 fOnlyWinPics=shifterU8;
3604 shifterU8>>=1;
3605 fLabelDoc=shifterU8;
3606 shifterU8>>=1;
3607 fHyphCapitals=shifterU8;
3608 shifterU8>>=1;
3609 fAutoHyphen=shifterU8;
3610 shifterU8>>=1;
3611 fFormNoFields=shifterU8;
3612 shifterU8>>=1;
3613 fLinkStyles=shifterU8;
3614 shifterU8>>=1;
3615 fRevMarking=shifterU8;
3616 shifterU8=stream->readU8();
3617 fBackup=shifterU8;
3618 shifterU8>>=1;
3619 fExactCWords=shifterU8;
3620 shifterU8>>=1;
3621 fPagHidden=shifterU8;
3622 shifterU8>>=1;
3623 fPagResults=shifterU8;
3624 shifterU8>>=1;
3625 fLockAtn=shifterU8;
3626 shifterU8>>=1;
3627 fMirrorMargins=shifterU8;
3628 shifterU8>>=1;
3629 unused6_6=shifterU8;
3630 shifterU8>>=1;
3631 fDfltTrueType=shifterU8;
3632 shifterU8=stream->readU8();
3633 fPagSuppressTopSpacing=shifterU8;
3634 shifterU8>>=1;
3635 fProtEnabled=shifterU8;
3636 shifterU8>>=1;
3637 fDispFormFldSel=shifterU8;
3638 shifterU8>>=1;
3639 fRMView=shifterU8;
3640 shifterU8>>=1;
3641 fRMPrint=shifterU8;
3642 shifterU8>>=1;
3643 unused7_5=shifterU8;
3644 shifterU8>>=1;
3645 fLockRev=shifterU8;
3646 shifterU8>>=1;
3647 fEmbedFonts=shifterU8;
3648 shifterU16=stream->readU16();
3649 copts_fNoTabForInd=shifterU16;
3650 shifterU16>>=1;
3651 copts_fNoSpaceRaiseLower=shifterU16;
3652 shifterU16>>=1;
3653 copts_fSuppressSpbfAfterPageBreak=shifterU16;
3654 shifterU16>>=1;
3655 copts_fWrapTrailSpaces=shifterU16;
3656 shifterU16>>=1;
3657 copts_fMapPrintTextColor=shifterU16;
3658 shifterU16>>=1;
3659 copts_fNoColumnBalance=shifterU16;
3660 shifterU16>>=1;
3661 copts_fConvMailMergeEsc=shifterU16;
3662 shifterU16>>=1;
3663 copts_fSupressTopSpacing=shifterU16;
3664 shifterU16>>=1;
3665 copts_fOrigWordTableRules=shifterU16;
3666 shifterU16>>=1;
3667 copts_fTransparentMetafiles=shifterU16;
3668 shifterU16>>=1;
3669 copts_fShowBreaksInFrames=shifterU16;
3670 shifterU16>>=1;
3671 copts_fSwapBordersFacingPgs=shifterU16;
3672 shifterU16>>=1;
3673 unused8_12=shifterU16;
3674 dxaTab=stream->readU16();
3675 wSpare=stream->readU16();
3676 dxaHotZ=stream->readU16();
3677 cConsecHypLim=stream->readU16();
3678 wSpare2=stream->readU16();
3679 dttmCreated.read(stream, false);
3680 dttmRevised.read(stream, false);
3681 dttmLastPrint.read(stream, false);
3682 nRevision=stream->readS16();
3683 tmEdited=stream->readS32();
3684 cWords=stream->readS32();
3685 cCh=stream->readS32();
3686 cPg=stream->readS16();
3687 cParas=stream->readS32();
3688 shifterU16=stream->readU16();
3689 rncEdn=shifterU16;
3690 shifterU16>>=2;
3691 nEdn=shifterU16;
3692 shifterU16=stream->readU16();
3693 epc=shifterU16;
3694 shifterU16>>=2;
3695 nfcFtnRef=shifterU16;
3696 shifterU16>>=4;
3697 nfcEdnRef=shifterU16;
3698 shifterU16>>=4;
3699 fPrintFormData=shifterU16;
3700 shifterU16>>=1;
3701 fSaveFormData=shifterU16;
3702 shifterU16>>=1;
3703 fShadeFormData=shifterU16;
3704 shifterU16>>=1;
3705 unused54_13=shifterU16;
3706 shifterU16>>=2;
3707 fWCFtnEdn=shifterU16;
3708 cLines=stream->readS32();
3709 cWordsFtnEnd=stream->readS32();
3710 cChFtnEdn=stream->readS32();
3711 cPgFtnEdn=stream->readS16();
3712 cParasFtnEdn=stream->readS32();
3713 cLinesFtnEdn=stream->readS32();
3714 lKeyProtDoc=stream->readS32();
3715 shifterU16=stream->readU16();
3716 wvkSaved=shifterU16;
3717 shifterU16>>=3;
3718 wScaleSaved=shifterU16;
3719 shifterU16>>=9;
3720 zkSaved=shifterU16;
3721 shifterU16>>=2;
3722 fRotateFontW6=shifterU16;
3723 shifterU16>>=1;
3724 iGutterPos=shifterU16;
3725 shifterU32=stream->readU32();
3726 fNoTabForInd=shifterU32;
3727 shifterU32>>=1;
3728 fNoSpaceRaiseLower=shifterU32;
3729 shifterU32>>=1;
3730 fSupressSpbfAfterPageBreak=shifterU32;
3731 shifterU32>>=1;
3732 fWrapTrailSpaces=shifterU32;
3733 shifterU32>>=1;
3734 fMapPrintTextColor=shifterU32;
3735 shifterU32>>=1;
3736 fNoColumnBalance=shifterU32;
3737 shifterU32>>=1;
3738 fConvMailMergeEsc=shifterU32;
3739 shifterU32>>=1;
3740 fSupressTopSpacing=shifterU32;
3741 shifterU32>>=1;
3742 fOrigWordTableRules=shifterU32;
3743 shifterU32>>=1;
3744 fTransparentMetafiles=shifterU32;
3745 shifterU32>>=1;
3746 fShowBreaksInFrames=shifterU32;
3747 shifterU32>>=1;
3748 fSwapBordersFacingPgs=shifterU32;
3749 shifterU32>>=1;
3750 unused84_12=shifterU32;
3751 shifterU32>>=4;
3752 fSuppressTopSpacingMac5=shifterU32;
3753 shifterU32>>=1;
3754 fTruncDxaExpand=shifterU32;
3755 shifterU32>>=1;
3756 fPrintBodyBeforeHdr=shifterU32;
3757 shifterU32>>=1;
3758 fNoLeading=shifterU32;
3759 shifterU32>>=1;
3760 unused84_20=shifterU32;
3761 shifterU32>>=1;
3762 fMWSmallCaps=shifterU32;
3763 shifterU32>>=1;
3764 unused84_22=shifterU32;
3765 adt=stream->readU16();
3766 doptypography.read(stream, false);
3767 dogrid.read(stream, false);
3768 shifterU16=stream->readU16();
3769 reserved=shifterU16;
3770 shifterU16>>=1;
3771 lvl=shifterU16;
3772 shifterU16>>=4;
3773 fGramAllDone=shifterU16;
3774 shifterU16>>=1;
3775 fGramAllClean=shifterU16;
3776 shifterU16>>=1;
3777 fSubsetFonts=shifterU16;
3778 shifterU16>>=1;
3779 fHideLastVersion=shifterU16;
3780 shifterU16>>=1;
3781 fHtmlDoc=shifterU16;
3782 shifterU16>>=1;
3783 unused410_11=shifterU16;
3784 shifterU16>>=1;
3785 fSnapBorder=shifterU16;
3786 shifterU16>>=1;
3787 fIncludeHeader=shifterU16;
3788 shifterU16>>=1;
3789 fIncludeFooter=shifterU16;
3790 shifterU16>>=1;
3791 fForcePageSizePag=shifterU16;
3792 shifterU16>>=1;
3793 fMinFontSizePag=shifterU16;
3794 shifterU16=stream->readU16();
3795 fHaveVersions=shifterU16;
3796 shifterU16>>=1;
3797 fAutoVersion=shifterU16;
3798 shifterU16>>=1;
3799 unused412_2=shifterU16;
3800 asumyi.read(stream, false);
3801 cChWS=stream->readS32();
3802 cChWSFtnEdn=stream->readS32();
3803 grfDocEvents=stream->readS32();
3804 shifterU32=stream->readU32();
3805 fVirusPrompted=shifterU32;
3806 shifterU32>>=1;
3807 fVirusLoadSafe=shifterU32;
3808 shifterU32>>=1;
3809 KeyVirusSession30=shifterU32;
3810 for(int _i=0; _i<(30); ++_i)
3811 Spare[_i]=stream->readU8();
3812 unused472=stream->readU32();
3813 unused476=stream->readU32();
3814 cDBC=stream->readS32();
3815 cDBCFtnEdn=stream->readS32();
3816 unused488=stream->readU32();
3817 nfcFtnRef2=stream->readS16();
3818 nfcEdnRef2=stream->readS16();
3819 hpsZoonFontPag=stream->readS16();
3820 dywDispPag=stream->readS16();
3821
3822 if(preservePos)
3823 stream->pop();
3824 return true;
3825 }
3826
write(OLEStreamWriter * stream,bool preservePos) const3827 bool DOP::write(OLEStreamWriter *stream, bool preservePos) const {
3828
3829 U8 shifterU8;
3830 U16 shifterU16;
3831 U32 shifterU32;
3832
3833 if(preservePos)
3834 stream->push();
3835
3836 shifterU16=fFacingPages;
3837 shifterU16|=fWidowControl << 1;
3838 shifterU16|=fPMHMainDoc << 2;
3839 shifterU16|=grfSuppression << 3;
3840 shifterU16|=fpc << 5;
3841 shifterU16|=unused0_7 << 7;
3842 shifterU16|=grpfIhdt << 8;
3843 stream->write(shifterU16);
3844 shifterU16=rncFtn;
3845 shifterU16|=nFtn << 2;
3846 stream->write(shifterU16);
3847 shifterU8=fOutlineDirtySave;
3848 shifterU8|=unused4_1 << 1;
3849 stream->write(shifterU8);
3850 shifterU8=fOnlyMacPics;
3851 shifterU8|=fOnlyWinPics << 1;
3852 shifterU8|=fLabelDoc << 2;
3853 shifterU8|=fHyphCapitals << 3;
3854 shifterU8|=fAutoHyphen << 4;
3855 shifterU8|=fFormNoFields << 5;
3856 shifterU8|=fLinkStyles << 6;
3857 shifterU8|=fRevMarking << 7;
3858 stream->write(shifterU8);
3859 shifterU8=fBackup;
3860 shifterU8|=fExactCWords << 1;
3861 shifterU8|=fPagHidden << 2;
3862 shifterU8|=fPagResults << 3;
3863 shifterU8|=fLockAtn << 4;
3864 shifterU8|=fMirrorMargins << 5;
3865 shifterU8|=unused6_6 << 6;
3866 shifterU8|=fDfltTrueType << 7;
3867 stream->write(shifterU8);
3868 shifterU8=fPagSuppressTopSpacing;
3869 shifterU8|=fProtEnabled << 1;
3870 shifterU8|=fDispFormFldSel << 2;
3871 shifterU8|=fRMView << 3;
3872 shifterU8|=fRMPrint << 4;
3873 shifterU8|=unused7_5 << 5;
3874 shifterU8|=fLockRev << 6;
3875 shifterU8|=fEmbedFonts << 7;
3876 stream->write(shifterU8);
3877 shifterU16=copts_fNoTabForInd;
3878 shifterU16|=copts_fNoSpaceRaiseLower << 1;
3879 shifterU16|=copts_fSuppressSpbfAfterPageBreak << 2;
3880 shifterU16|=copts_fWrapTrailSpaces << 3;
3881 shifterU16|=copts_fMapPrintTextColor << 4;
3882 shifterU16|=copts_fNoColumnBalance << 5;
3883 shifterU16|=copts_fConvMailMergeEsc << 6;
3884 shifterU16|=copts_fSupressTopSpacing << 7;
3885 shifterU16|=copts_fOrigWordTableRules << 8;
3886 shifterU16|=copts_fTransparentMetafiles << 9;
3887 shifterU16|=copts_fShowBreaksInFrames << 10;
3888 shifterU16|=copts_fSwapBordersFacingPgs << 11;
3889 shifterU16|=unused8_12 << 12;
3890 stream->write(shifterU16);
3891 stream->write(dxaTab);
3892 stream->write(wSpare);
3893 stream->write(dxaHotZ);
3894 stream->write(cConsecHypLim);
3895 stream->write(wSpare2);
3896 dttmCreated.write(stream, false);
3897 dttmRevised.write(stream, false);
3898 dttmLastPrint.write(stream, false);
3899 stream->write(nRevision);
3900 stream->write(tmEdited);
3901 stream->write(cWords);
3902 stream->write(cCh);
3903 stream->write(cPg);
3904 stream->write(cParas);
3905 shifterU16=rncEdn;
3906 shifterU16|=nEdn << 2;
3907 stream->write(shifterU16);
3908 shifterU16=epc;
3909 shifterU16|=nfcFtnRef << 2;
3910 shifterU16|=nfcEdnRef << 6;
3911 shifterU16|=fPrintFormData << 10;
3912 shifterU16|=fSaveFormData << 11;
3913 shifterU16|=fShadeFormData << 12;
3914 shifterU16|=unused54_13 << 13;
3915 shifterU16|=fWCFtnEdn << 15;
3916 stream->write(shifterU16);
3917 stream->write(cLines);
3918 stream->write(cWordsFtnEnd);
3919 stream->write(cChFtnEdn);
3920 stream->write(cPgFtnEdn);
3921 stream->write(cParasFtnEdn);
3922 stream->write(cLinesFtnEdn);
3923 stream->write(lKeyProtDoc);
3924 shifterU16=wvkSaved;
3925 shifterU16|=wScaleSaved << 3;
3926 shifterU16|=zkSaved << 12;
3927 shifterU16|=fRotateFontW6 << 14;
3928 shifterU16|=iGutterPos << 15;
3929 stream->write(shifterU16);
3930 shifterU32=fNoTabForInd;
3931 shifterU32|=fNoSpaceRaiseLower << 1;
3932 shifterU32|=fSupressSpbfAfterPageBreak << 2;
3933 shifterU32|=fWrapTrailSpaces << 3;
3934 shifterU32|=fMapPrintTextColor << 4;
3935 shifterU32|=fNoColumnBalance << 5;
3936 shifterU32|=fConvMailMergeEsc << 6;
3937 shifterU32|=fSupressTopSpacing << 7;
3938 shifterU32|=fOrigWordTableRules << 8;
3939 shifterU32|=fTransparentMetafiles << 9;
3940 shifterU32|=fShowBreaksInFrames << 10;
3941 shifterU32|=fSwapBordersFacingPgs << 11;
3942 shifterU32|=unused84_12 << 12;
3943 shifterU32|=fSuppressTopSpacingMac5 << 16;
3944 shifterU32|=fTruncDxaExpand << 17;
3945 shifterU32|=fPrintBodyBeforeHdr << 18;
3946 shifterU32|=fNoLeading << 19;
3947 shifterU32|=unused84_20 << 20;
3948 shifterU32|=fMWSmallCaps << 21;
3949 shifterU32|=unused84_22 << 22;
3950 stream->write(shifterU32);
3951 stream->write(adt);
3952 doptypography.write(stream, false);
3953 dogrid.write(stream, false);
3954 shifterU16=reserved;
3955 shifterU16|=lvl << 1;
3956 shifterU16|=fGramAllDone << 5;
3957 shifterU16|=fGramAllClean << 6;
3958 shifterU16|=fSubsetFonts << 7;
3959 shifterU16|=fHideLastVersion << 8;
3960 shifterU16|=fHtmlDoc << 9;
3961 shifterU16|=unused410_11 << 10;
3962 shifterU16|=fSnapBorder << 11;
3963 shifterU16|=fIncludeHeader << 12;
3964 shifterU16|=fIncludeFooter << 13;
3965 shifterU16|=fForcePageSizePag << 14;
3966 shifterU16|=fMinFontSizePag << 15;
3967 stream->write(shifterU16);
3968 shifterU16=fHaveVersions;
3969 shifterU16|=fAutoVersion << 1;
3970 shifterU16|=unused412_2 << 2;
3971 stream->write(shifterU16);
3972 asumyi.write(stream, false);
3973 stream->write(cChWS);
3974 stream->write(cChWSFtnEdn);
3975 stream->write(grfDocEvents);
3976 shifterU32=fVirusPrompted;
3977 shifterU32|=fVirusLoadSafe << 1;
3978 shifterU32|=KeyVirusSession30 << 2;
3979 stream->write(shifterU32);
3980 for(int _i=0; _i<(30); ++_i)
3981 stream->write(Spare[_i]);
3982 stream->write(unused472);
3983 stream->write(unused476);
3984 stream->write(cDBC);
3985 stream->write(cDBCFtnEdn);
3986 stream->write(unused488);
3987 stream->write(nfcFtnRef2);
3988 stream->write(nfcEdnRef2);
3989 stream->write(hpsZoonFontPag);
3990 stream->write(dywDispPag);
3991
3992 if(preservePos)
3993 stream->pop();
3994 return true;
3995 }
3996
clear()3997 void DOP::clear() {
3998 fFacingPages=0;
3999 fWidowControl=1;
4000 fPMHMainDoc=0;
4001 grfSuppression=0;
4002 fpc=1;
4003 unused0_7=0;
4004 grpfIhdt=0;
4005 rncFtn=0;
4006 nFtn=1;
4007 fOutlineDirtySave=0;
4008 unused4_1=0;
4009 fOnlyMacPics=0;
4010 fOnlyWinPics=0;
4011 fLabelDoc=0;
4012 fHyphCapitals=0;
4013 fAutoHyphen=0;
4014 fFormNoFields=0;
4015 fLinkStyles=0;
4016 fRevMarking=0;
4017 fBackup=0;
4018 fExactCWords=0;
4019 fPagHidden=0;
4020 fPagResults=0;
4021 fLockAtn=0;
4022 fMirrorMargins=0;
4023 unused6_6=0;
4024 fDfltTrueType=0;
4025 fPagSuppressTopSpacing=0;
4026 fProtEnabled=0;
4027 fDispFormFldSel=0;
4028 fRMView=0;
4029 fRMPrint=0;
4030 unused7_5=0;
4031 fLockRev=0;
4032 fEmbedFonts=0;
4033 copts_fNoTabForInd=0;
4034 copts_fNoSpaceRaiseLower=0;
4035 copts_fSuppressSpbfAfterPageBreak=0;
4036 copts_fWrapTrailSpaces=0;
4037 copts_fMapPrintTextColor=0;
4038 copts_fNoColumnBalance=0;
4039 copts_fConvMailMergeEsc=0;
4040 copts_fSupressTopSpacing=0;
4041 copts_fOrigWordTableRules=0;
4042 copts_fTransparentMetafiles=0;
4043 copts_fShowBreaksInFrames=0;
4044 copts_fSwapBordersFacingPgs=0;
4045 unused8_12=0;
4046 dxaTab=720;
4047 wSpare=0;
4048 dxaHotZ=0;
4049 cConsecHypLim=0;
4050 wSpare2=0;
4051 dttmCreated.clear();
4052 dttmRevised.clear();
4053 dttmLastPrint.clear();
4054 nRevision=0;
4055 tmEdited=0;
4056 cWords=0;
4057 cCh=0;
4058 cPg=0;
4059 cParas=0;
4060 rncEdn=0;
4061 nEdn=0;
4062 epc=0;
4063 nfcFtnRef=0;
4064 nfcEdnRef=0;
4065 fPrintFormData=0;
4066 fSaveFormData=0;
4067 fShadeFormData=0;
4068 unused54_13=0;
4069 fWCFtnEdn=0;
4070 cLines=0;
4071 cWordsFtnEnd=0;
4072 cChFtnEdn=0;
4073 cPgFtnEdn=0;
4074 cParasFtnEdn=0;
4075 cLinesFtnEdn=0;
4076 lKeyProtDoc=0;
4077 wvkSaved=0;
4078 wScaleSaved=0;
4079 zkSaved=0;
4080 fRotateFontW6=0;
4081 iGutterPos=0;
4082 fNoTabForInd=0;
4083 fNoSpaceRaiseLower=0;
4084 fSupressSpbfAfterPageBreak=0;
4085 fWrapTrailSpaces=0;
4086 fMapPrintTextColor=0;
4087 fNoColumnBalance=0;
4088 fConvMailMergeEsc=0;
4089 fSupressTopSpacing=0;
4090 fOrigWordTableRules=0;
4091 fTransparentMetafiles=0;
4092 fShowBreaksInFrames=0;
4093 fSwapBordersFacingPgs=0;
4094 unused84_12=0;
4095 fSuppressTopSpacingMac5=0;
4096 fTruncDxaExpand=0;
4097 fPrintBodyBeforeHdr=0;
4098 fNoLeading=0;
4099 unused84_20=0;
4100 fMWSmallCaps=0;
4101 unused84_22=0;
4102 adt=0;
4103 doptypography.clear();
4104 dogrid.clear();
4105 reserved=0;
4106 lvl=0;
4107 fGramAllDone=0;
4108 fGramAllClean=0;
4109 fSubsetFonts=0;
4110 fHideLastVersion=0;
4111 fHtmlDoc=0;
4112 unused410_11=0;
4113 fSnapBorder=0;
4114 fIncludeHeader=0;
4115 fIncludeFooter=0;
4116 fForcePageSizePag=0;
4117 fMinFontSizePag=0;
4118 fHaveVersions=0;
4119 fAutoVersion=0;
4120 unused412_2=0;
4121 asumyi.clear();
4122 cChWS=0;
4123 cChWSFtnEdn=0;
4124 grfDocEvents=0;
4125 fVirusPrompted=0;
4126 fVirusLoadSafe=0;
4127 KeyVirusSession30=0;
4128 for(int _i=0; _i<(30); ++_i)
4129 Spare[_i]=0;
4130 unused472=0;
4131 unused476=0;
4132 cDBC=0;
4133 cDBCFtnEdn=0;
4134 unused488=0;
4135 nfcFtnRef2=0;
4136 nfcEdnRef2=0;
4137 hpsZoonFontPag=0;
4138 dywDispPag=0;
4139 }
4140
operator ==(const DOP & lhs,const DOP & rhs)4141 bool operator==(const DOP &lhs, const DOP &rhs) {
4142
4143 for(int _i=0; _i<(30); ++_i) {
4144 if(lhs.Spare[_i]!=rhs.Spare[_i])
4145 return false;
4146 }
4147
4148 return lhs.fFacingPages==rhs.fFacingPages &&
4149 lhs.fWidowControl==rhs.fWidowControl &&
4150 lhs.fPMHMainDoc==rhs.fPMHMainDoc &&
4151 lhs.grfSuppression==rhs.grfSuppression &&
4152 lhs.fpc==rhs.fpc &&
4153 lhs.unused0_7==rhs.unused0_7 &&
4154 lhs.grpfIhdt==rhs.grpfIhdt &&
4155 lhs.rncFtn==rhs.rncFtn &&
4156 lhs.nFtn==rhs.nFtn &&
4157 lhs.fOutlineDirtySave==rhs.fOutlineDirtySave &&
4158 lhs.unused4_1==rhs.unused4_1 &&
4159 lhs.fOnlyMacPics==rhs.fOnlyMacPics &&
4160 lhs.fOnlyWinPics==rhs.fOnlyWinPics &&
4161 lhs.fLabelDoc==rhs.fLabelDoc &&
4162 lhs.fHyphCapitals==rhs.fHyphCapitals &&
4163 lhs.fAutoHyphen==rhs.fAutoHyphen &&
4164 lhs.fFormNoFields==rhs.fFormNoFields &&
4165 lhs.fLinkStyles==rhs.fLinkStyles &&
4166 lhs.fRevMarking==rhs.fRevMarking &&
4167 lhs.fBackup==rhs.fBackup &&
4168 lhs.fExactCWords==rhs.fExactCWords &&
4169 lhs.fPagHidden==rhs.fPagHidden &&
4170 lhs.fPagResults==rhs.fPagResults &&
4171 lhs.fLockAtn==rhs.fLockAtn &&
4172 lhs.fMirrorMargins==rhs.fMirrorMargins &&
4173 lhs.unused6_6==rhs.unused6_6 &&
4174 lhs.fDfltTrueType==rhs.fDfltTrueType &&
4175 lhs.fPagSuppressTopSpacing==rhs.fPagSuppressTopSpacing &&
4176 lhs.fProtEnabled==rhs.fProtEnabled &&
4177 lhs.fDispFormFldSel==rhs.fDispFormFldSel &&
4178 lhs.fRMView==rhs.fRMView &&
4179 lhs.fRMPrint==rhs.fRMPrint &&
4180 lhs.unused7_5==rhs.unused7_5 &&
4181 lhs.fLockRev==rhs.fLockRev &&
4182 lhs.fEmbedFonts==rhs.fEmbedFonts &&
4183 lhs.copts_fNoTabForInd==rhs.copts_fNoTabForInd &&
4184 lhs.copts_fNoSpaceRaiseLower==rhs.copts_fNoSpaceRaiseLower &&
4185 lhs.copts_fSuppressSpbfAfterPageBreak==rhs.copts_fSuppressSpbfAfterPageBreak &&
4186 lhs.copts_fWrapTrailSpaces==rhs.copts_fWrapTrailSpaces &&
4187 lhs.copts_fMapPrintTextColor==rhs.copts_fMapPrintTextColor &&
4188 lhs.copts_fNoColumnBalance==rhs.copts_fNoColumnBalance &&
4189 lhs.copts_fConvMailMergeEsc==rhs.copts_fConvMailMergeEsc &&
4190 lhs.copts_fSupressTopSpacing==rhs.copts_fSupressTopSpacing &&
4191 lhs.copts_fOrigWordTableRules==rhs.copts_fOrigWordTableRules &&
4192 lhs.copts_fTransparentMetafiles==rhs.copts_fTransparentMetafiles &&
4193 lhs.copts_fShowBreaksInFrames==rhs.copts_fShowBreaksInFrames &&
4194 lhs.copts_fSwapBordersFacingPgs==rhs.copts_fSwapBordersFacingPgs &&
4195 lhs.unused8_12==rhs.unused8_12 &&
4196 lhs.dxaTab==rhs.dxaTab &&
4197 lhs.wSpare==rhs.wSpare &&
4198 lhs.dxaHotZ==rhs.dxaHotZ &&
4199 lhs.cConsecHypLim==rhs.cConsecHypLim &&
4200 lhs.wSpare2==rhs.wSpare2 &&
4201 lhs.dttmCreated==rhs.dttmCreated &&
4202 lhs.dttmRevised==rhs.dttmRevised &&
4203 lhs.dttmLastPrint==rhs.dttmLastPrint &&
4204 lhs.nRevision==rhs.nRevision &&
4205 lhs.tmEdited==rhs.tmEdited &&
4206 lhs.cWords==rhs.cWords &&
4207 lhs.cCh==rhs.cCh &&
4208 lhs.cPg==rhs.cPg &&
4209 lhs.cParas==rhs.cParas &&
4210 lhs.rncEdn==rhs.rncEdn &&
4211 lhs.nEdn==rhs.nEdn &&
4212 lhs.epc==rhs.epc &&
4213 lhs.nfcFtnRef==rhs.nfcFtnRef &&
4214 lhs.nfcEdnRef==rhs.nfcEdnRef &&
4215 lhs.fPrintFormData==rhs.fPrintFormData &&
4216 lhs.fSaveFormData==rhs.fSaveFormData &&
4217 lhs.fShadeFormData==rhs.fShadeFormData &&
4218 lhs.unused54_13==rhs.unused54_13 &&
4219 lhs.fWCFtnEdn==rhs.fWCFtnEdn &&
4220 lhs.cLines==rhs.cLines &&
4221 lhs.cWordsFtnEnd==rhs.cWordsFtnEnd &&
4222 lhs.cChFtnEdn==rhs.cChFtnEdn &&
4223 lhs.cPgFtnEdn==rhs.cPgFtnEdn &&
4224 lhs.cParasFtnEdn==rhs.cParasFtnEdn &&
4225 lhs.cLinesFtnEdn==rhs.cLinesFtnEdn &&
4226 lhs.lKeyProtDoc==rhs.lKeyProtDoc &&
4227 lhs.wvkSaved==rhs.wvkSaved &&
4228 lhs.wScaleSaved==rhs.wScaleSaved &&
4229 lhs.zkSaved==rhs.zkSaved &&
4230 lhs.fRotateFontW6==rhs.fRotateFontW6 &&
4231 lhs.iGutterPos==rhs.iGutterPos &&
4232 lhs.fNoTabForInd==rhs.fNoTabForInd &&
4233 lhs.fNoSpaceRaiseLower==rhs.fNoSpaceRaiseLower &&
4234 lhs.fSupressSpbfAfterPageBreak==rhs.fSupressSpbfAfterPageBreak &&
4235 lhs.fWrapTrailSpaces==rhs.fWrapTrailSpaces &&
4236 lhs.fMapPrintTextColor==rhs.fMapPrintTextColor &&
4237 lhs.fNoColumnBalance==rhs.fNoColumnBalance &&
4238 lhs.fConvMailMergeEsc==rhs.fConvMailMergeEsc &&
4239 lhs.fSupressTopSpacing==rhs.fSupressTopSpacing &&
4240 lhs.fOrigWordTableRules==rhs.fOrigWordTableRules &&
4241 lhs.fTransparentMetafiles==rhs.fTransparentMetafiles &&
4242 lhs.fShowBreaksInFrames==rhs.fShowBreaksInFrames &&
4243 lhs.fSwapBordersFacingPgs==rhs.fSwapBordersFacingPgs &&
4244 lhs.unused84_12==rhs.unused84_12 &&
4245 lhs.fSuppressTopSpacingMac5==rhs.fSuppressTopSpacingMac5 &&
4246 lhs.fTruncDxaExpand==rhs.fTruncDxaExpand &&
4247 lhs.fPrintBodyBeforeHdr==rhs.fPrintBodyBeforeHdr &&
4248 lhs.fNoLeading==rhs.fNoLeading &&
4249 lhs.unused84_20==rhs.unused84_20 &&
4250 lhs.fMWSmallCaps==rhs.fMWSmallCaps &&
4251 lhs.unused84_22==rhs.unused84_22 &&
4252 lhs.adt==rhs.adt &&
4253 lhs.doptypography==rhs.doptypography &&
4254 lhs.dogrid==rhs.dogrid &&
4255 lhs.reserved==rhs.reserved &&
4256 lhs.lvl==rhs.lvl &&
4257 lhs.fGramAllDone==rhs.fGramAllDone &&
4258 lhs.fGramAllClean==rhs.fGramAllClean &&
4259 lhs.fSubsetFonts==rhs.fSubsetFonts &&
4260 lhs.fHideLastVersion==rhs.fHideLastVersion &&
4261 lhs.fHtmlDoc==rhs.fHtmlDoc &&
4262 lhs.unused410_11==rhs.unused410_11 &&
4263 lhs.fSnapBorder==rhs.fSnapBorder &&
4264 lhs.fIncludeHeader==rhs.fIncludeHeader &&
4265 lhs.fIncludeFooter==rhs.fIncludeFooter &&
4266 lhs.fForcePageSizePag==rhs.fForcePageSizePag &&
4267 lhs.fMinFontSizePag==rhs.fMinFontSizePag &&
4268 lhs.fHaveVersions==rhs.fHaveVersions &&
4269 lhs.fAutoVersion==rhs.fAutoVersion &&
4270 lhs.unused412_2==rhs.unused412_2 &&
4271 lhs.asumyi==rhs.asumyi &&
4272 lhs.cChWS==rhs.cChWS &&
4273 lhs.cChWSFtnEdn==rhs.cChWSFtnEdn &&
4274 lhs.grfDocEvents==rhs.grfDocEvents &&
4275 lhs.fVirusPrompted==rhs.fVirusPrompted &&
4276 lhs.fVirusLoadSafe==rhs.fVirusLoadSafe &&
4277 lhs.KeyVirusSession30==rhs.KeyVirusSession30 &&
4278 lhs.unused472==rhs.unused472 &&
4279 lhs.unused476==rhs.unused476 &&
4280 lhs.cDBC==rhs.cDBC &&
4281 lhs.cDBCFtnEdn==rhs.cDBCFtnEdn &&
4282 lhs.unused488==rhs.unused488 &&
4283 lhs.nfcFtnRef2==rhs.nfcFtnRef2 &&
4284 lhs.nfcEdnRef2==rhs.nfcEdnRef2 &&
4285 lhs.hpsZoonFontPag==rhs.hpsZoonFontPag &&
4286 lhs.dywDispPag==rhs.dywDispPag;
4287 }
4288
operator !=(const DOP & lhs,const DOP & rhs)4289 bool operator!=(const DOP &lhs, const DOP &rhs) {
4290 return !(lhs==rhs);
4291 }
4292
4293
4294 // FIB implementation
4295
FIB()4296 FIB::FIB() {
4297 clear();
4298 }
4299
FIB(OLEStreamReader * stream,bool preservePos)4300 FIB::FIB(OLEStreamReader *stream, bool preservePos) {
4301 clear();
4302 read(stream, preservePos);
4303 }
4304
read(OLEStreamReader * stream,bool preservePos)4305 bool FIB::read(OLEStreamReader *stream, bool preservePos) {
4306
4307 U8 shifterU8;
4308 U16 shifterU16;
4309
4310 if(preservePos)
4311 stream->push();
4312
4313 wIdent=stream->readU16();
4314 nFib=stream->readU16();
4315 nProduct=stream->readU16();
4316 lid=stream->readU16();
4317 pnNext=stream->readS16();
4318 shifterU16=stream->readU16();
4319 fDot=shifterU16;
4320 shifterU16>>=1;
4321 fGlsy=shifterU16;
4322 shifterU16>>=1;
4323 fComplex=shifterU16;
4324 shifterU16>>=1;
4325 fHasPic=shifterU16;
4326 shifterU16>>=1;
4327 cQuickSaves=shifterU16;
4328 shifterU16>>=4;
4329 fEncrypted=shifterU16;
4330 shifterU16>>=1;
4331 fWhichTblStm=shifterU16;
4332 shifterU16>>=1;
4333 fReadOnlyRecommended=shifterU16;
4334 shifterU16>>=1;
4335 fWriteReservation=shifterU16;
4336 shifterU16>>=1;
4337 fExtChar=shifterU16;
4338 shifterU16>>=1;
4339 fLoadOverride=shifterU16;
4340 shifterU16>>=1;
4341 fFarEast=shifterU16;
4342 shifterU16>>=1;
4343 fCrypto=shifterU16;
4344 nFibBack=stream->readU16();
4345 lKey=stream->readU32();
4346 envr=stream->readU8();
4347 shifterU8=stream->readU8();
4348 fMac=shifterU8;
4349 shifterU8>>=1;
4350 fEmptySpecial=shifterU8;
4351 shifterU8>>=1;
4352 fLoadOverridePage=shifterU8;
4353 shifterU8>>=1;
4354 fFutureSavedUndo=shifterU8;
4355 shifterU8>>=1;
4356 fWord97Saved=shifterU8;
4357 shifterU8>>=1;
4358 fSpare0=shifterU8;
4359 chs=stream->readU16();
4360 chsTables=stream->readU16();
4361 fcMin=stream->readU32();
4362 fcMac=stream->readU32();
4363 csw=stream->readU16();
4364 wMagicCreated=stream->readU16();
4365 wMagicRevised=stream->readU16();
4366 wMagicCreatedPrivate=stream->readU16();
4367 wMagicRevisedPrivate=stream->readU16();
4368 pnFbpChpFirst_W6=stream->readU16();
4369 pnChpFirst_W6=stream->readU16();
4370 cpnBteChp_W6=stream->readU16();
4371 pnFbpPapFirst_W6=stream->readU16();
4372 pnPapFirst_W6=stream->readU16();
4373 cpnBtePap_W6=stream->readU16();
4374 pnFbpLvcFirst_W6=stream->readU16();
4375 pnLvcFirst_W6=stream->readU16();
4376 cpnBteLvc_W6=stream->readU16();
4377 lidFE=stream->readS16();
4378 clw=stream->readU16();
4379 cbMac=stream->readU32();
4380 lProductCreated=stream->readU32();
4381 lProductRevised=stream->readU32();
4382 ccpText=stream->readU32();
4383 ccpFtn=stream->readU32();
4384 ccpHdd=stream->readU32();
4385 ccpMcr=stream->readU32();
4386 ccpAtn=stream->readU32();
4387 ccpEdn=stream->readU32();
4388 ccpTxbx=stream->readU32();
4389 ccpHdrTxbx=stream->readU32();
4390 pnFbpChpFirst=stream->readU32();
4391 pnChpFirst=stream->readU32();
4392 cpnBteChp=stream->readU32();
4393 pnFbpPapFirst=stream->readU32();
4394 pnPapFirst=stream->readU32();
4395 cpnBtePap=stream->readU32();
4396 pnFbpLvcFirst=stream->readU32();
4397 pnLvcFirst=stream->readU32();
4398 cpnBteLvc=stream->readU32();
4399 fcIslandFirst=stream->readU32();
4400 fcIslandLim=stream->readU32();
4401 cfclcb=stream->readU16();
4402 fcStshfOrig=stream->readU32();
4403 lcbStshfOrig=stream->readU32();
4404 fcStshf=stream->readU32();
4405 lcbStshf=stream->readU32();
4406 fcPlcffndRef=stream->readU32();
4407 lcbPlcffndRef=stream->readU32();
4408 fcPlcffndTxt=stream->readU32();
4409 lcbPlcffndTxt=stream->readU32();
4410 fcPlcfandRef=stream->readU32();
4411 lcbPlcfandRef=stream->readU32();
4412 fcPlcfandTxt=stream->readU32();
4413 lcbPlcfandTxt=stream->readU32();
4414 fcPlcfsed=stream->readU32();
4415 lcbPlcfsed=stream->readU32();
4416 fcPlcfpad=stream->readU32();
4417 lcbPlcfpad=stream->readU32();
4418 fcPlcfphe=stream->readU32();
4419 lcbPlcfphe=stream->readU32();
4420 fcSttbfglsy=stream->readU32();
4421 lcbSttbfglsy=stream->readU32();
4422 fcPlcfglsy=stream->readU32();
4423 lcbPlcfglsy=stream->readU32();
4424 fcPlcfhdd=stream->readU32();
4425 lcbPlcfhdd=stream->readU32();
4426 fcPlcfbteChpx=stream->readU32();
4427 lcbPlcfbteChpx=stream->readU32();
4428 fcPlcfbtePapx=stream->readU32();
4429 lcbPlcfbtePapx=stream->readU32();
4430 fcPlcfsea=stream->readU32();
4431 lcbPlcfsea=stream->readU32();
4432 fcSttbfffn=stream->readU32();
4433 lcbSttbfffn=stream->readU32();
4434 fcPlcffldMom=stream->readU32();
4435 lcbPlcffldMom=stream->readU32();
4436 fcPlcffldHdr=stream->readU32();
4437 lcbPlcffldHdr=stream->readU32();
4438 fcPlcffldFtn=stream->readU32();
4439 lcbPlcffldFtn=stream->readU32();
4440 fcPlcffldAtn=stream->readU32();
4441 lcbPlcffldAtn=stream->readU32();
4442 fcPlcffldMcr=stream->readU32();
4443 lcbPlcffldMcr=stream->readU32();
4444 fcSttbfbkmk=stream->readU32();
4445 lcbSttbfbkmk=stream->readU32();
4446 fcPlcfbkf=stream->readU32();
4447 lcbPlcfbkf=stream->readU32();
4448 fcPlcfbkl=stream->readU32();
4449 lcbPlcfbkl=stream->readU32();
4450 fcCmds=stream->readU32();
4451 lcbCmds=stream->readU32();
4452 fcPlcmcr=stream->readU32();
4453 lcbPlcmcr=stream->readU32();
4454 fcSttbfmcr=stream->readU32();
4455 lcbSttbfmcr=stream->readU32();
4456 fcPrDrvr=stream->readU32();
4457 lcbPrDrvr=stream->readU32();
4458 fcPrEnvPort=stream->readU32();
4459 lcbPrEnvPort=stream->readU32();
4460 fcPrEnvLand=stream->readU32();
4461 lcbPrEnvLand=stream->readU32();
4462 fcWss=stream->readU32();
4463 lcbWss=stream->readU32();
4464 fcDop=stream->readU32();
4465 lcbDop=stream->readU32();
4466 fcSttbfAssoc=stream->readU32();
4467 lcbSttbfAssoc=stream->readU32();
4468 fcClx=stream->readU32();
4469 lcbClx=stream->readU32();
4470 fcPlcfpgdFtn=stream->readU32();
4471 lcbPlcfpgdFtn=stream->readU32();
4472 fcAutosaveSource=stream->readU32();
4473 lcbAutosaveSource=stream->readU32();
4474 fcGrpXstAtnOwners=stream->readU32();
4475 lcbGrpXstAtnOwners=stream->readU32();
4476 fcSttbfAtnbkmk=stream->readU32();
4477 lcbSttbfAtnbkmk=stream->readU32();
4478 fcPlcdoaMom=stream->readU32();
4479 lcbPlcdoaMom=stream->readU32();
4480 fcPlcdoaHdr=stream->readU32();
4481 lcbPlcdoaHdr=stream->readU32();
4482 fcPlcspaMom=stream->readU32();
4483 lcbPlcspaMom=stream->readU32();
4484 fcPlcspaHdr=stream->readU32();
4485 lcbPlcspaHdr=stream->readU32();
4486 fcPlcfAtnbkf=stream->readU32();
4487 lcbPlcfAtnbkf=stream->readU32();
4488 fcPlcfAtnbkl=stream->readU32();
4489 lcbPlcfAtnbkl=stream->readU32();
4490 fcPms=stream->readU32();
4491 lcbPms=stream->readU32();
4492 fcFormFldSttbf=stream->readU32();
4493 lcbFormFldSttbf=stream->readU32();
4494 fcPlcfendRef=stream->readU32();
4495 lcbPlcfendRef=stream->readU32();
4496 fcPlcfendTxt=stream->readU32();
4497 lcbPlcfendTxt=stream->readU32();
4498 fcPlcffldEdn=stream->readU32();
4499 lcbPlcffldEdn=stream->readU32();
4500 fcPlcfpgdEdn=stream->readU32();
4501 lcbPlcfpgdEdn=stream->readU32();
4502 fcDggInfo=stream->readU32();
4503 lcbDggInfo=stream->readU32();
4504 fcSttbfRMark=stream->readU32();
4505 lcbSttbfRMark=stream->readU32();
4506 fcSttbfCaption=stream->readU32();
4507 lcbSttbfCaption=stream->readU32();
4508 fcSttbfAutoCaption=stream->readU32();
4509 lcbSttbfAutoCaption=stream->readU32();
4510 fcPlcfwkb=stream->readU32();
4511 lcbPlcfwkb=stream->readU32();
4512 fcPlcfspl=stream->readU32();
4513 lcbPlcfspl=stream->readU32();
4514 fcPlcftxbxTxt=stream->readU32();
4515 lcbPlcftxbxTxt=stream->readU32();
4516 fcPlcffldTxbx=stream->readU32();
4517 lcbPlcffldTxbx=stream->readU32();
4518 fcPlcfHdrtxbxTxt=stream->readU32();
4519 lcbPlcfHdrtxbxTxt=stream->readU32();
4520 fcPlcffldHdrTxbx=stream->readU32();
4521 lcbPlcffldHdrTxbx=stream->readU32();
4522 fcStwUser=stream->readU32();
4523 lcbStwUser=stream->readU32();
4524 fcSttbttmbd=stream->readU32();
4525 lcbSttbttmbd=stream->readU32();
4526 fcUnused=stream->readU32();
4527 lcbUnused=stream->readU32();
4528 fcPgdMother=stream->readU32();
4529 lcbPgdMother=stream->readU32();
4530 fcBkdMother=stream->readU32();
4531 lcbBkdMother=stream->readU32();
4532 fcPgdFtn=stream->readU32();
4533 lcbPgdFtn=stream->readU32();
4534 fcBkdFtn=stream->readU32();
4535 lcbBkdFtn=stream->readU32();
4536 fcPgdEdn=stream->readU32();
4537 lcbPgdEdn=stream->readU32();
4538 fcBkdEdn=stream->readU32();
4539 lcbBkdEdn=stream->readU32();
4540 fcSttbfIntlFld=stream->readU32();
4541 lcbSttbfIntlFld=stream->readU32();
4542 fcRouteSlip=stream->readU32();
4543 lcbRouteSlip=stream->readU32();
4544 fcSttbSavedBy=stream->readU32();
4545 lcbSttbSavedBy=stream->readU32();
4546 fcSttbFnm=stream->readU32();
4547 lcbSttbFnm=stream->readU32();
4548 fcPlcfLst=stream->readU32();
4549 lcbPlcfLst=stream->readU32();
4550 fcPlfLfo=stream->readU32();
4551 lcbPlfLfo=stream->readU32();
4552 fcPlcftxbxBkd=stream->readU32();
4553 lcbPlcftxbxBkd=stream->readU32();
4554 fcPlcftxbxHdrBkd=stream->readU32();
4555 lcbPlcftxbxHdrBkd=stream->readU32();
4556 fcDocUndo=stream->readU32();
4557 lcbDocUndo=stream->readU32();
4558 fcRgbuse=stream->readU32();
4559 lcbRgbuse=stream->readU32();
4560 fcUsp=stream->readU32();
4561 lcbUsp=stream->readU32();
4562 fcUskf=stream->readU32();
4563 lcbUskf=stream->readU32();
4564 fcPlcupcRgbuse=stream->readU32();
4565 lcbPlcupcRgbuse=stream->readU32();
4566 fcPlcupcUsp=stream->readU32();
4567 lcbPlcupcUsp=stream->readU32();
4568 fcSttbGlsyStyle=stream->readU32();
4569 lcbSttbGlsyStyle=stream->readU32();
4570 fcPlgosl=stream->readU32();
4571 lcbPlgosl=stream->readU32();
4572 fcPlcocx=stream->readU32();
4573 lcbPlcocx=stream->readU32();
4574 fcPlcfbteLvc=stream->readU32();
4575 lcbPlcfbteLvc=stream->readU32();
4576 dwLowDateTime=stream->readU32();
4577 dwHighDateTime=stream->readU32();
4578 fcPlcflvc=stream->readU32();
4579 lcbPlcflvc=stream->readU32();
4580 fcPlcasumy=stream->readU32();
4581 lcbPlcasumy=stream->readU32();
4582 fcPlcfgram=stream->readU32();
4583 lcbPlcfgram=stream->readU32();
4584 fcSttbListNames=stream->readU32();
4585 lcbSttbListNames=stream->readU32();
4586 fcSttbfUssr=stream->readU32();
4587 lcbSttbfUssr=stream->readU32();
4588
4589 if(preservePos)
4590 stream->pop();
4591 return true;
4592 }
4593
write(OLEStreamWriter * stream,bool preservePos) const4594 bool FIB::write(OLEStreamWriter *stream, bool preservePos) const {
4595
4596 U8 shifterU8;
4597 U16 shifterU16;
4598
4599 if(preservePos)
4600 stream->push();
4601
4602 stream->write(wIdent);
4603 stream->write(nFib);
4604 stream->write(nProduct);
4605 stream->write(lid);
4606 stream->write(pnNext);
4607 shifterU16=fDot;
4608 shifterU16|=fGlsy << 1;
4609 shifterU16|=fComplex << 2;
4610 shifterU16|=fHasPic << 3;
4611 shifterU16|=cQuickSaves << 4;
4612 shifterU16|=fEncrypted << 8;
4613 shifterU16|=fWhichTblStm << 9;
4614 shifterU16|=fReadOnlyRecommended << 10;
4615 shifterU16|=fWriteReservation << 11;
4616 shifterU16|=fExtChar << 12;
4617 shifterU16|=fLoadOverride << 13;
4618 shifterU16|=fFarEast << 14;
4619 shifterU16|=fCrypto << 15;
4620 stream->write(shifterU16);
4621 stream->write(nFibBack);
4622 stream->write(lKey);
4623 stream->write(envr);
4624 shifterU8=fMac;
4625 shifterU8|=fEmptySpecial << 1;
4626 shifterU8|=fLoadOverridePage << 2;
4627 shifterU8|=fFutureSavedUndo << 3;
4628 shifterU8|=fWord97Saved << 4;
4629 shifterU8|=fSpare0 << 5;
4630 stream->write(shifterU8);
4631 stream->write(chs);
4632 stream->write(chsTables);
4633 stream->write(fcMin);
4634 stream->write(fcMac);
4635 stream->write(csw);
4636 stream->write(wMagicCreated);
4637 stream->write(wMagicRevised);
4638 stream->write(wMagicCreatedPrivate);
4639 stream->write(wMagicRevisedPrivate);
4640 stream->write(pnFbpChpFirst_W6);
4641 stream->write(pnChpFirst_W6);
4642 stream->write(cpnBteChp_W6);
4643 stream->write(pnFbpPapFirst_W6);
4644 stream->write(pnPapFirst_W6);
4645 stream->write(cpnBtePap_W6);
4646 stream->write(pnFbpLvcFirst_W6);
4647 stream->write(pnLvcFirst_W6);
4648 stream->write(cpnBteLvc_W6);
4649 stream->write(lidFE);
4650 stream->write(clw);
4651 stream->write(cbMac);
4652 stream->write(lProductCreated);
4653 stream->write(lProductRevised);
4654 stream->write(ccpText);
4655 stream->write(ccpFtn);
4656 stream->write(ccpHdd);
4657 stream->write(ccpMcr);
4658 stream->write(ccpAtn);
4659 stream->write(ccpEdn);
4660 stream->write(ccpTxbx);
4661 stream->write(ccpHdrTxbx);
4662 stream->write(pnFbpChpFirst);
4663 stream->write(pnChpFirst);
4664 stream->write(cpnBteChp);
4665 stream->write(pnFbpPapFirst);
4666 stream->write(pnPapFirst);
4667 stream->write(cpnBtePap);
4668 stream->write(pnFbpLvcFirst);
4669 stream->write(pnLvcFirst);
4670 stream->write(cpnBteLvc);
4671 stream->write(fcIslandFirst);
4672 stream->write(fcIslandLim);
4673 stream->write(cfclcb);
4674 stream->write(fcStshfOrig);
4675 stream->write(lcbStshfOrig);
4676 stream->write(fcStshf);
4677 stream->write(lcbStshf);
4678 stream->write(fcPlcffndRef);
4679 stream->write(lcbPlcffndRef);
4680 stream->write(fcPlcffndTxt);
4681 stream->write(lcbPlcffndTxt);
4682 stream->write(fcPlcfandRef);
4683 stream->write(lcbPlcfandRef);
4684 stream->write(fcPlcfandTxt);
4685 stream->write(lcbPlcfandTxt);
4686 stream->write(fcPlcfsed);
4687 stream->write(lcbPlcfsed);
4688 stream->write(fcPlcfpad);
4689 stream->write(lcbPlcfpad);
4690 stream->write(fcPlcfphe);
4691 stream->write(lcbPlcfphe);
4692 stream->write(fcSttbfglsy);
4693 stream->write(lcbSttbfglsy);
4694 stream->write(fcPlcfglsy);
4695 stream->write(lcbPlcfglsy);
4696 stream->write(fcPlcfhdd);
4697 stream->write(lcbPlcfhdd);
4698 stream->write(fcPlcfbteChpx);
4699 stream->write(lcbPlcfbteChpx);
4700 stream->write(fcPlcfbtePapx);
4701 stream->write(lcbPlcfbtePapx);
4702 stream->write(fcPlcfsea);
4703 stream->write(lcbPlcfsea);
4704 stream->write(fcSttbfffn);
4705 stream->write(lcbSttbfffn);
4706 stream->write(fcPlcffldMom);
4707 stream->write(lcbPlcffldMom);
4708 stream->write(fcPlcffldHdr);
4709 stream->write(lcbPlcffldHdr);
4710 stream->write(fcPlcffldFtn);
4711 stream->write(lcbPlcffldFtn);
4712 stream->write(fcPlcffldAtn);
4713 stream->write(lcbPlcffldAtn);
4714 stream->write(fcPlcffldMcr);
4715 stream->write(lcbPlcffldMcr);
4716 stream->write(fcSttbfbkmk);
4717 stream->write(lcbSttbfbkmk);
4718 stream->write(fcPlcfbkf);
4719 stream->write(lcbPlcfbkf);
4720 stream->write(fcPlcfbkl);
4721 stream->write(lcbPlcfbkl);
4722 stream->write(fcCmds);
4723 stream->write(lcbCmds);
4724 stream->write(fcPlcmcr);
4725 stream->write(lcbPlcmcr);
4726 stream->write(fcSttbfmcr);
4727 stream->write(lcbSttbfmcr);
4728 stream->write(fcPrDrvr);
4729 stream->write(lcbPrDrvr);
4730 stream->write(fcPrEnvPort);
4731 stream->write(lcbPrEnvPort);
4732 stream->write(fcPrEnvLand);
4733 stream->write(lcbPrEnvLand);
4734 stream->write(fcWss);
4735 stream->write(lcbWss);
4736 stream->write(fcDop);
4737 stream->write(lcbDop);
4738 stream->write(fcSttbfAssoc);
4739 stream->write(lcbSttbfAssoc);
4740 stream->write(fcClx);
4741 stream->write(lcbClx);
4742 stream->write(fcPlcfpgdFtn);
4743 stream->write(lcbPlcfpgdFtn);
4744 stream->write(fcAutosaveSource);
4745 stream->write(lcbAutosaveSource);
4746 stream->write(fcGrpXstAtnOwners);
4747 stream->write(lcbGrpXstAtnOwners);
4748 stream->write(fcSttbfAtnbkmk);
4749 stream->write(lcbSttbfAtnbkmk);
4750 stream->write(fcPlcdoaMom);
4751 stream->write(lcbPlcdoaMom);
4752 stream->write(fcPlcdoaHdr);
4753 stream->write(lcbPlcdoaHdr);
4754 stream->write(fcPlcspaMom);
4755 stream->write(lcbPlcspaMom);
4756 stream->write(fcPlcspaHdr);
4757 stream->write(lcbPlcspaHdr);
4758 stream->write(fcPlcfAtnbkf);
4759 stream->write(lcbPlcfAtnbkf);
4760 stream->write(fcPlcfAtnbkl);
4761 stream->write(lcbPlcfAtnbkl);
4762 stream->write(fcPms);
4763 stream->write(lcbPms);
4764 stream->write(fcFormFldSttbf);
4765 stream->write(lcbFormFldSttbf);
4766 stream->write(fcPlcfendRef);
4767 stream->write(lcbPlcfendRef);
4768 stream->write(fcPlcfendTxt);
4769 stream->write(lcbPlcfendTxt);
4770 stream->write(fcPlcffldEdn);
4771 stream->write(lcbPlcffldEdn);
4772 stream->write(fcPlcfpgdEdn);
4773 stream->write(lcbPlcfpgdEdn);
4774 stream->write(fcDggInfo);
4775 stream->write(lcbDggInfo);
4776 stream->write(fcSttbfRMark);
4777 stream->write(lcbSttbfRMark);
4778 stream->write(fcSttbfCaption);
4779 stream->write(lcbSttbfCaption);
4780 stream->write(fcSttbfAutoCaption);
4781 stream->write(lcbSttbfAutoCaption);
4782 stream->write(fcPlcfwkb);
4783 stream->write(lcbPlcfwkb);
4784 stream->write(fcPlcfspl);
4785 stream->write(lcbPlcfspl);
4786 stream->write(fcPlcftxbxTxt);
4787 stream->write(lcbPlcftxbxTxt);
4788 stream->write(fcPlcffldTxbx);
4789 stream->write(lcbPlcffldTxbx);
4790 stream->write(fcPlcfHdrtxbxTxt);
4791 stream->write(lcbPlcfHdrtxbxTxt);
4792 stream->write(fcPlcffldHdrTxbx);
4793 stream->write(lcbPlcffldHdrTxbx);
4794 stream->write(fcStwUser);
4795 stream->write(lcbStwUser);
4796 stream->write(fcSttbttmbd);
4797 stream->write(lcbSttbttmbd);
4798 stream->write(fcUnused);
4799 stream->write(lcbUnused);
4800 stream->write(fcPgdMother);
4801 stream->write(lcbPgdMother);
4802 stream->write(fcBkdMother);
4803 stream->write(lcbBkdMother);
4804 stream->write(fcPgdFtn);
4805 stream->write(lcbPgdFtn);
4806 stream->write(fcBkdFtn);
4807 stream->write(lcbBkdFtn);
4808 stream->write(fcPgdEdn);
4809 stream->write(lcbPgdEdn);
4810 stream->write(fcBkdEdn);
4811 stream->write(lcbBkdEdn);
4812 stream->write(fcSttbfIntlFld);
4813 stream->write(lcbSttbfIntlFld);
4814 stream->write(fcRouteSlip);
4815 stream->write(lcbRouteSlip);
4816 stream->write(fcSttbSavedBy);
4817 stream->write(lcbSttbSavedBy);
4818 stream->write(fcSttbFnm);
4819 stream->write(lcbSttbFnm);
4820 stream->write(fcPlcfLst);
4821 stream->write(lcbPlcfLst);
4822 stream->write(fcPlfLfo);
4823 stream->write(lcbPlfLfo);
4824 stream->write(fcPlcftxbxBkd);
4825 stream->write(lcbPlcftxbxBkd);
4826 stream->write(fcPlcftxbxHdrBkd);
4827 stream->write(lcbPlcftxbxHdrBkd);
4828 stream->write(fcDocUndo);
4829 stream->write(lcbDocUndo);
4830 stream->write(fcRgbuse);
4831 stream->write(lcbRgbuse);
4832 stream->write(fcUsp);
4833 stream->write(lcbUsp);
4834 stream->write(fcUskf);
4835 stream->write(lcbUskf);
4836 stream->write(fcPlcupcRgbuse);
4837 stream->write(lcbPlcupcRgbuse);
4838 stream->write(fcPlcupcUsp);
4839 stream->write(lcbPlcupcUsp);
4840 stream->write(fcSttbGlsyStyle);
4841 stream->write(lcbSttbGlsyStyle);
4842 stream->write(fcPlgosl);
4843 stream->write(lcbPlgosl);
4844 stream->write(fcPlcocx);
4845 stream->write(lcbPlcocx);
4846 stream->write(fcPlcfbteLvc);
4847 stream->write(lcbPlcfbteLvc);
4848 stream->write(dwLowDateTime);
4849 stream->write(dwHighDateTime);
4850 stream->write(fcPlcflvc);
4851 stream->write(lcbPlcflvc);
4852 stream->write(fcPlcasumy);
4853 stream->write(lcbPlcasumy);
4854 stream->write(fcPlcfgram);
4855 stream->write(lcbPlcfgram);
4856 stream->write(fcSttbListNames);
4857 stream->write(lcbSttbListNames);
4858 stream->write(fcSttbfUssr);
4859 stream->write(lcbSttbfUssr);
4860
4861 if(preservePos)
4862 stream->pop();
4863 return true;
4864 }
4865
clear()4866 void FIB::clear() {
4867 wIdent=0;
4868 nFib=0;
4869 nProduct=0;
4870 lid=0;
4871 pnNext=0;
4872 fDot=0;
4873 fGlsy=0;
4874 fComplex=0;
4875 fHasPic=0;
4876 cQuickSaves=0;
4877 fEncrypted=0;
4878 fWhichTblStm=0;
4879 fReadOnlyRecommended=0;
4880 fWriteReservation=0;
4881 fExtChar=0;
4882 fLoadOverride=0;
4883 fFarEast=0;
4884 fCrypto=0;
4885 nFibBack=0;
4886 lKey=0;
4887 envr=0;
4888 fMac=0;
4889 fEmptySpecial=0;
4890 fLoadOverridePage=0;
4891 fFutureSavedUndo=0;
4892 fWord97Saved=0;
4893 fSpare0=0;
4894 chs=0;
4895 chsTables=0;
4896 fcMin=0;
4897 fcMac=0;
4898 csw=0;
4899 wMagicCreated=0;
4900 wMagicRevised=0;
4901 wMagicCreatedPrivate=0;
4902 wMagicRevisedPrivate=0;
4903 pnFbpChpFirst_W6=0;
4904 pnChpFirst_W6=0;
4905 cpnBteChp_W6=0;
4906 pnFbpPapFirst_W6=0;
4907 pnPapFirst_W6=0;
4908 cpnBtePap_W6=0;
4909 pnFbpLvcFirst_W6=0;
4910 pnLvcFirst_W6=0;
4911 cpnBteLvc_W6=0;
4912 lidFE=0;
4913 clw=0;
4914 cbMac=0;
4915 lProductCreated=0;
4916 lProductRevised=0;
4917 ccpText=0;
4918 ccpFtn=0;
4919 ccpHdd=0;
4920 ccpMcr=0;
4921 ccpAtn=0;
4922 ccpEdn=0;
4923 ccpTxbx=0;
4924 ccpHdrTxbx=0;
4925 pnFbpChpFirst=0;
4926 pnChpFirst=0;
4927 cpnBteChp=0;
4928 pnFbpPapFirst=0;
4929 pnPapFirst=0;
4930 cpnBtePap=0;
4931 pnFbpLvcFirst=0;
4932 pnLvcFirst=0;
4933 cpnBteLvc=0;
4934 fcIslandFirst=0;
4935 fcIslandLim=0;
4936 cfclcb=0;
4937 fcStshfOrig=0;
4938 lcbStshfOrig=0;
4939 fcStshf=0;
4940 lcbStshf=0;
4941 fcPlcffndRef=0;
4942 lcbPlcffndRef=0;
4943 fcPlcffndTxt=0;
4944 lcbPlcffndTxt=0;
4945 fcPlcfandRef=0;
4946 lcbPlcfandRef=0;
4947 fcPlcfandTxt=0;
4948 lcbPlcfandTxt=0;
4949 fcPlcfsed=0;
4950 lcbPlcfsed=0;
4951 fcPlcfpad=0;
4952 lcbPlcfpad=0;
4953 fcPlcfphe=0;
4954 lcbPlcfphe=0;
4955 fcSttbfglsy=0;
4956 lcbSttbfglsy=0;
4957 fcPlcfglsy=0;
4958 lcbPlcfglsy=0;
4959 fcPlcfhdd=0;
4960 lcbPlcfhdd=0;
4961 fcPlcfbteChpx=0;
4962 lcbPlcfbteChpx=0;
4963 fcPlcfbtePapx=0;
4964 lcbPlcfbtePapx=0;
4965 fcPlcfsea=0;
4966 lcbPlcfsea=0;
4967 fcSttbfffn=0;
4968 lcbSttbfffn=0;
4969 fcPlcffldMom=0;
4970 lcbPlcffldMom=0;
4971 fcPlcffldHdr=0;
4972 lcbPlcffldHdr=0;
4973 fcPlcffldFtn=0;
4974 lcbPlcffldFtn=0;
4975 fcPlcffldAtn=0;
4976 lcbPlcffldAtn=0;
4977 fcPlcffldMcr=0;
4978 lcbPlcffldMcr=0;
4979 fcSttbfbkmk=0;
4980 lcbSttbfbkmk=0;
4981 fcPlcfbkf=0;
4982 lcbPlcfbkf=0;
4983 fcPlcfbkl=0;
4984 lcbPlcfbkl=0;
4985 fcCmds=0;
4986 lcbCmds=0;
4987 fcPlcmcr=0;
4988 lcbPlcmcr=0;
4989 fcSttbfmcr=0;
4990 lcbSttbfmcr=0;
4991 fcPrDrvr=0;
4992 lcbPrDrvr=0;
4993 fcPrEnvPort=0;
4994 lcbPrEnvPort=0;
4995 fcPrEnvLand=0;
4996 lcbPrEnvLand=0;
4997 fcWss=0;
4998 lcbWss=0;
4999 fcDop=0;
5000 lcbDop=0;
5001 fcSttbfAssoc=0;
5002 lcbSttbfAssoc=0;
5003 fcClx=0;
5004 lcbClx=0;
5005 fcPlcfpgdFtn=0;
5006 lcbPlcfpgdFtn=0;
5007 fcAutosaveSource=0;
5008 lcbAutosaveSource=0;
5009 fcGrpXstAtnOwners=0;
5010 lcbGrpXstAtnOwners=0;
5011 fcSttbfAtnbkmk=0;
5012 lcbSttbfAtnbkmk=0;
5013 fcPlcdoaMom=0;
5014 lcbPlcdoaMom=0;
5015 fcPlcdoaHdr=0;
5016 lcbPlcdoaHdr=0;
5017 fcPlcspaMom=0;
5018 lcbPlcspaMom=0;
5019 fcPlcspaHdr=0;
5020 lcbPlcspaHdr=0;
5021 fcPlcfAtnbkf=0;
5022 lcbPlcfAtnbkf=0;
5023 fcPlcfAtnbkl=0;
5024 lcbPlcfAtnbkl=0;
5025 fcPms=0;
5026 lcbPms=0;
5027 fcFormFldSttbf=0;
5028 lcbFormFldSttbf=0;
5029 fcPlcfendRef=0;
5030 lcbPlcfendRef=0;
5031 fcPlcfendTxt=0;
5032 lcbPlcfendTxt=0;
5033 fcPlcffldEdn=0;
5034 lcbPlcffldEdn=0;
5035 fcPlcfpgdEdn=0;
5036 lcbPlcfpgdEdn=0;
5037 fcDggInfo=0;
5038 lcbDggInfo=0;
5039 fcSttbfRMark=0;
5040 lcbSttbfRMark=0;
5041 fcSttbfCaption=0;
5042 lcbSttbfCaption=0;
5043 fcSttbfAutoCaption=0;
5044 lcbSttbfAutoCaption=0;
5045 fcPlcfwkb=0;
5046 lcbPlcfwkb=0;
5047 fcPlcfspl=0;
5048 lcbPlcfspl=0;
5049 fcPlcftxbxTxt=0;
5050 lcbPlcftxbxTxt=0;
5051 fcPlcffldTxbx=0;
5052 lcbPlcffldTxbx=0;
5053 fcPlcfHdrtxbxTxt=0;
5054 lcbPlcfHdrtxbxTxt=0;
5055 fcPlcffldHdrTxbx=0;
5056 lcbPlcffldHdrTxbx=0;
5057 fcStwUser=0;
5058 lcbStwUser=0;
5059 fcSttbttmbd=0;
5060 lcbSttbttmbd=0;
5061 fcUnused=0;
5062 lcbUnused=0;
5063 fcPgdMother=0;
5064 lcbPgdMother=0;
5065 fcBkdMother=0;
5066 lcbBkdMother=0;
5067 fcPgdFtn=0;
5068 lcbPgdFtn=0;
5069 fcBkdFtn=0;
5070 lcbBkdFtn=0;
5071 fcPgdEdn=0;
5072 lcbPgdEdn=0;
5073 fcBkdEdn=0;
5074 lcbBkdEdn=0;
5075 fcSttbfIntlFld=0;
5076 lcbSttbfIntlFld=0;
5077 fcRouteSlip=0;
5078 lcbRouteSlip=0;
5079 fcSttbSavedBy=0;
5080 lcbSttbSavedBy=0;
5081 fcSttbFnm=0;
5082 lcbSttbFnm=0;
5083 fcPlcfLst=0;
5084 lcbPlcfLst=0;
5085 fcPlfLfo=0;
5086 lcbPlfLfo=0;
5087 fcPlcftxbxBkd=0;
5088 lcbPlcftxbxBkd=0;
5089 fcPlcftxbxHdrBkd=0;
5090 lcbPlcftxbxHdrBkd=0;
5091 fcDocUndo=0;
5092 lcbDocUndo=0;
5093 fcRgbuse=0;
5094 lcbRgbuse=0;
5095 fcUsp=0;
5096 lcbUsp=0;
5097 fcUskf=0;
5098 lcbUskf=0;
5099 fcPlcupcRgbuse=0;
5100 lcbPlcupcRgbuse=0;
5101 fcPlcupcUsp=0;
5102 lcbPlcupcUsp=0;
5103 fcSttbGlsyStyle=0;
5104 lcbSttbGlsyStyle=0;
5105 fcPlgosl=0;
5106 lcbPlgosl=0;
5107 fcPlcocx=0;
5108 lcbPlcocx=0;
5109 fcPlcfbteLvc=0;
5110 lcbPlcfbteLvc=0;
5111 dwLowDateTime=0;
5112 dwHighDateTime=0;
5113 fcPlcflvc=0;
5114 lcbPlcflvc=0;
5115 fcPlcasumy=0;
5116 lcbPlcasumy=0;
5117 fcPlcfgram=0;
5118 lcbPlcfgram=0;
5119 fcSttbListNames=0;
5120 lcbSttbListNames=0;
5121 fcSttbfUssr=0;
5122 lcbSttbfUssr=0;
5123 }
5124
operator ==(const FIB & lhs,const FIB & rhs)5125 bool operator==(const FIB &lhs, const FIB &rhs) {
5126
5127 return lhs.wIdent==rhs.wIdent &&
5128 lhs.nFib==rhs.nFib &&
5129 lhs.nProduct==rhs.nProduct &&
5130 lhs.lid==rhs.lid &&
5131 lhs.pnNext==rhs.pnNext &&
5132 lhs.fDot==rhs.fDot &&
5133 lhs.fGlsy==rhs.fGlsy &&
5134 lhs.fComplex==rhs.fComplex &&
5135 lhs.fHasPic==rhs.fHasPic &&
5136 lhs.cQuickSaves==rhs.cQuickSaves &&
5137 lhs.fEncrypted==rhs.fEncrypted &&
5138 lhs.fWhichTblStm==rhs.fWhichTblStm &&
5139 lhs.fReadOnlyRecommended==rhs.fReadOnlyRecommended &&
5140 lhs.fWriteReservation==rhs.fWriteReservation &&
5141 lhs.fExtChar==rhs.fExtChar &&
5142 lhs.fLoadOverride==rhs.fLoadOverride &&
5143 lhs.fFarEast==rhs.fFarEast &&
5144 lhs.fCrypto==rhs.fCrypto &&
5145 lhs.nFibBack==rhs.nFibBack &&
5146 lhs.lKey==rhs.lKey &&
5147 lhs.envr==rhs.envr &&
5148 lhs.fMac==rhs.fMac &&
5149 lhs.fEmptySpecial==rhs.fEmptySpecial &&
5150 lhs.fLoadOverridePage==rhs.fLoadOverridePage &&
5151 lhs.fFutureSavedUndo==rhs.fFutureSavedUndo &&
5152 lhs.fWord97Saved==rhs.fWord97Saved &&
5153 lhs.fSpare0==rhs.fSpare0 &&
5154 lhs.chs==rhs.chs &&
5155 lhs.chsTables==rhs.chsTables &&
5156 lhs.fcMin==rhs.fcMin &&
5157 lhs.fcMac==rhs.fcMac &&
5158 lhs.csw==rhs.csw &&
5159 lhs.wMagicCreated==rhs.wMagicCreated &&
5160 lhs.wMagicRevised==rhs.wMagicRevised &&
5161 lhs.wMagicCreatedPrivate==rhs.wMagicCreatedPrivate &&
5162 lhs.wMagicRevisedPrivate==rhs.wMagicRevisedPrivate &&
5163 lhs.pnFbpChpFirst_W6==rhs.pnFbpChpFirst_W6 &&
5164 lhs.pnChpFirst_W6==rhs.pnChpFirst_W6 &&
5165 lhs.cpnBteChp_W6==rhs.cpnBteChp_W6 &&
5166 lhs.pnFbpPapFirst_W6==rhs.pnFbpPapFirst_W6 &&
5167 lhs.pnPapFirst_W6==rhs.pnPapFirst_W6 &&
5168 lhs.cpnBtePap_W6==rhs.cpnBtePap_W6 &&
5169 lhs.pnFbpLvcFirst_W6==rhs.pnFbpLvcFirst_W6 &&
5170 lhs.pnLvcFirst_W6==rhs.pnLvcFirst_W6 &&
5171 lhs.cpnBteLvc_W6==rhs.cpnBteLvc_W6 &&
5172 lhs.lidFE==rhs.lidFE &&
5173 lhs.clw==rhs.clw &&
5174 lhs.cbMac==rhs.cbMac &&
5175 lhs.lProductCreated==rhs.lProductCreated &&
5176 lhs.lProductRevised==rhs.lProductRevised &&
5177 lhs.ccpText==rhs.ccpText &&
5178 lhs.ccpFtn==rhs.ccpFtn &&
5179 lhs.ccpHdd==rhs.ccpHdd &&
5180 lhs.ccpMcr==rhs.ccpMcr &&
5181 lhs.ccpAtn==rhs.ccpAtn &&
5182 lhs.ccpEdn==rhs.ccpEdn &&
5183 lhs.ccpTxbx==rhs.ccpTxbx &&
5184 lhs.ccpHdrTxbx==rhs.ccpHdrTxbx &&
5185 lhs.pnFbpChpFirst==rhs.pnFbpChpFirst &&
5186 lhs.pnChpFirst==rhs.pnChpFirst &&
5187 lhs.cpnBteChp==rhs.cpnBteChp &&
5188 lhs.pnFbpPapFirst==rhs.pnFbpPapFirst &&
5189 lhs.pnPapFirst==rhs.pnPapFirst &&
5190 lhs.cpnBtePap==rhs.cpnBtePap &&
5191 lhs.pnFbpLvcFirst==rhs.pnFbpLvcFirst &&
5192 lhs.pnLvcFirst==rhs.pnLvcFirst &&
5193 lhs.cpnBteLvc==rhs.cpnBteLvc &&
5194 lhs.fcIslandFirst==rhs.fcIslandFirst &&
5195 lhs.fcIslandLim==rhs.fcIslandLim &&
5196 lhs.cfclcb==rhs.cfclcb &&
5197 lhs.fcStshfOrig==rhs.fcStshfOrig &&
5198 lhs.lcbStshfOrig==rhs.lcbStshfOrig &&
5199 lhs.fcStshf==rhs.fcStshf &&
5200 lhs.lcbStshf==rhs.lcbStshf &&
5201 lhs.fcPlcffndRef==rhs.fcPlcffndRef &&
5202 lhs.lcbPlcffndRef==rhs.lcbPlcffndRef &&
5203 lhs.fcPlcffndTxt==rhs.fcPlcffndTxt &&
5204 lhs.lcbPlcffndTxt==rhs.lcbPlcffndTxt &&
5205 lhs.fcPlcfandRef==rhs.fcPlcfandRef &&
5206 lhs.lcbPlcfandRef==rhs.lcbPlcfandRef &&
5207 lhs.fcPlcfandTxt==rhs.fcPlcfandTxt &&
5208 lhs.lcbPlcfandTxt==rhs.lcbPlcfandTxt &&
5209 lhs.fcPlcfsed==rhs.fcPlcfsed &&
5210 lhs.lcbPlcfsed==rhs.lcbPlcfsed &&
5211 lhs.fcPlcfpad==rhs.fcPlcfpad &&
5212 lhs.lcbPlcfpad==rhs.lcbPlcfpad &&
5213 lhs.fcPlcfphe==rhs.fcPlcfphe &&
5214 lhs.lcbPlcfphe==rhs.lcbPlcfphe &&
5215 lhs.fcSttbfglsy==rhs.fcSttbfglsy &&
5216 lhs.lcbSttbfglsy==rhs.lcbSttbfglsy &&
5217 lhs.fcPlcfglsy==rhs.fcPlcfglsy &&
5218 lhs.lcbPlcfglsy==rhs.lcbPlcfglsy &&
5219 lhs.fcPlcfhdd==rhs.fcPlcfhdd &&
5220 lhs.lcbPlcfhdd==rhs.lcbPlcfhdd &&
5221 lhs.fcPlcfbteChpx==rhs.fcPlcfbteChpx &&
5222 lhs.lcbPlcfbteChpx==rhs.lcbPlcfbteChpx &&
5223 lhs.fcPlcfbtePapx==rhs.fcPlcfbtePapx &&
5224 lhs.lcbPlcfbtePapx==rhs.lcbPlcfbtePapx &&
5225 lhs.fcPlcfsea==rhs.fcPlcfsea &&
5226 lhs.lcbPlcfsea==rhs.lcbPlcfsea &&
5227 lhs.fcSttbfffn==rhs.fcSttbfffn &&
5228 lhs.lcbSttbfffn==rhs.lcbSttbfffn &&
5229 lhs.fcPlcffldMom==rhs.fcPlcffldMom &&
5230 lhs.lcbPlcffldMom==rhs.lcbPlcffldMom &&
5231 lhs.fcPlcffldHdr==rhs.fcPlcffldHdr &&
5232 lhs.lcbPlcffldHdr==rhs.lcbPlcffldHdr &&
5233 lhs.fcPlcffldFtn==rhs.fcPlcffldFtn &&
5234 lhs.lcbPlcffldFtn==rhs.lcbPlcffldFtn &&
5235 lhs.fcPlcffldAtn==rhs.fcPlcffldAtn &&
5236 lhs.lcbPlcffldAtn==rhs.lcbPlcffldAtn &&
5237 lhs.fcPlcffldMcr==rhs.fcPlcffldMcr &&
5238 lhs.lcbPlcffldMcr==rhs.lcbPlcffldMcr &&
5239 lhs.fcSttbfbkmk==rhs.fcSttbfbkmk &&
5240 lhs.lcbSttbfbkmk==rhs.lcbSttbfbkmk &&
5241 lhs.fcPlcfbkf==rhs.fcPlcfbkf &&
5242 lhs.lcbPlcfbkf==rhs.lcbPlcfbkf &&
5243 lhs.fcPlcfbkl==rhs.fcPlcfbkl &&
5244 lhs.lcbPlcfbkl==rhs.lcbPlcfbkl &&
5245 lhs.fcCmds==rhs.fcCmds &&
5246 lhs.lcbCmds==rhs.lcbCmds &&
5247 lhs.fcPlcmcr==rhs.fcPlcmcr &&
5248 lhs.lcbPlcmcr==rhs.lcbPlcmcr &&
5249 lhs.fcSttbfmcr==rhs.fcSttbfmcr &&
5250 lhs.lcbSttbfmcr==rhs.lcbSttbfmcr &&
5251 lhs.fcPrDrvr==rhs.fcPrDrvr &&
5252 lhs.lcbPrDrvr==rhs.lcbPrDrvr &&
5253 lhs.fcPrEnvPort==rhs.fcPrEnvPort &&
5254 lhs.lcbPrEnvPort==rhs.lcbPrEnvPort &&
5255 lhs.fcPrEnvLand==rhs.fcPrEnvLand &&
5256 lhs.lcbPrEnvLand==rhs.lcbPrEnvLand &&
5257 lhs.fcWss==rhs.fcWss &&
5258 lhs.lcbWss==rhs.lcbWss &&
5259 lhs.fcDop==rhs.fcDop &&
5260 lhs.lcbDop==rhs.lcbDop &&
5261 lhs.fcSttbfAssoc==rhs.fcSttbfAssoc &&
5262 lhs.lcbSttbfAssoc==rhs.lcbSttbfAssoc &&
5263 lhs.fcClx==rhs.fcClx &&
5264 lhs.lcbClx==rhs.lcbClx &&
5265 lhs.fcPlcfpgdFtn==rhs.fcPlcfpgdFtn &&
5266 lhs.lcbPlcfpgdFtn==rhs.lcbPlcfpgdFtn &&
5267 lhs.fcAutosaveSource==rhs.fcAutosaveSource &&
5268 lhs.lcbAutosaveSource==rhs.lcbAutosaveSource &&
5269 lhs.fcGrpXstAtnOwners==rhs.fcGrpXstAtnOwners &&
5270 lhs.lcbGrpXstAtnOwners==rhs.lcbGrpXstAtnOwners &&
5271 lhs.fcSttbfAtnbkmk==rhs.fcSttbfAtnbkmk &&
5272 lhs.lcbSttbfAtnbkmk==rhs.lcbSttbfAtnbkmk &&
5273 lhs.fcPlcdoaMom==rhs.fcPlcdoaMom &&
5274 lhs.lcbPlcdoaMom==rhs.lcbPlcdoaMom &&
5275 lhs.fcPlcdoaHdr==rhs.fcPlcdoaHdr &&
5276 lhs.lcbPlcdoaHdr==rhs.lcbPlcdoaHdr &&
5277 lhs.fcPlcspaMom==rhs.fcPlcspaMom &&
5278 lhs.lcbPlcspaMom==rhs.lcbPlcspaMom &&
5279 lhs.fcPlcspaHdr==rhs.fcPlcspaHdr &&
5280 lhs.lcbPlcspaHdr==rhs.lcbPlcspaHdr &&
5281 lhs.fcPlcfAtnbkf==rhs.fcPlcfAtnbkf &&
5282 lhs.lcbPlcfAtnbkf==rhs.lcbPlcfAtnbkf &&
5283 lhs.fcPlcfAtnbkl==rhs.fcPlcfAtnbkl &&
5284 lhs.lcbPlcfAtnbkl==rhs.lcbPlcfAtnbkl &&
5285 lhs.fcPms==rhs.fcPms &&
5286 lhs.lcbPms==rhs.lcbPms &&
5287 lhs.fcFormFldSttbf==rhs.fcFormFldSttbf &&
5288 lhs.lcbFormFldSttbf==rhs.lcbFormFldSttbf &&
5289 lhs.fcPlcfendRef==rhs.fcPlcfendRef &&
5290 lhs.lcbPlcfendRef==rhs.lcbPlcfendRef &&
5291 lhs.fcPlcfendTxt==rhs.fcPlcfendTxt &&
5292 lhs.lcbPlcfendTxt==rhs.lcbPlcfendTxt &&
5293 lhs.fcPlcffldEdn==rhs.fcPlcffldEdn &&
5294 lhs.lcbPlcffldEdn==rhs.lcbPlcffldEdn &&
5295 lhs.fcPlcfpgdEdn==rhs.fcPlcfpgdEdn &&
5296 lhs.lcbPlcfpgdEdn==rhs.lcbPlcfpgdEdn &&
5297 lhs.fcDggInfo==rhs.fcDggInfo &&
5298 lhs.lcbDggInfo==rhs.lcbDggInfo &&
5299 lhs.fcSttbfRMark==rhs.fcSttbfRMark &&
5300 lhs.lcbSttbfRMark==rhs.lcbSttbfRMark &&
5301 lhs.fcSttbfCaption==rhs.fcSttbfCaption &&
5302 lhs.lcbSttbfCaption==rhs.lcbSttbfCaption &&
5303 lhs.fcSttbfAutoCaption==rhs.fcSttbfAutoCaption &&
5304 lhs.lcbSttbfAutoCaption==rhs.lcbSttbfAutoCaption &&
5305 lhs.fcPlcfwkb==rhs.fcPlcfwkb &&
5306 lhs.lcbPlcfwkb==rhs.lcbPlcfwkb &&
5307 lhs.fcPlcfspl==rhs.fcPlcfspl &&
5308 lhs.lcbPlcfspl==rhs.lcbPlcfspl &&
5309 lhs.fcPlcftxbxTxt==rhs.fcPlcftxbxTxt &&
5310 lhs.lcbPlcftxbxTxt==rhs.lcbPlcftxbxTxt &&
5311 lhs.fcPlcffldTxbx==rhs.fcPlcffldTxbx &&
5312 lhs.lcbPlcffldTxbx==rhs.lcbPlcffldTxbx &&
5313 lhs.fcPlcfHdrtxbxTxt==rhs.fcPlcfHdrtxbxTxt &&
5314 lhs.lcbPlcfHdrtxbxTxt==rhs.lcbPlcfHdrtxbxTxt &&
5315 lhs.fcPlcffldHdrTxbx==rhs.fcPlcffldHdrTxbx &&
5316 lhs.lcbPlcffldHdrTxbx==rhs.lcbPlcffldHdrTxbx &&
5317 lhs.fcStwUser==rhs.fcStwUser &&
5318 lhs.lcbStwUser==rhs.lcbStwUser &&
5319 lhs.fcSttbttmbd==rhs.fcSttbttmbd &&
5320 lhs.lcbSttbttmbd==rhs.lcbSttbttmbd &&
5321 lhs.fcUnused==rhs.fcUnused &&
5322 lhs.lcbUnused==rhs.lcbUnused &&
5323 lhs.fcPgdMother==rhs.fcPgdMother &&
5324 lhs.lcbPgdMother==rhs.lcbPgdMother &&
5325 lhs.fcBkdMother==rhs.fcBkdMother &&
5326 lhs.lcbBkdMother==rhs.lcbBkdMother &&
5327 lhs.fcPgdFtn==rhs.fcPgdFtn &&
5328 lhs.lcbPgdFtn==rhs.lcbPgdFtn &&
5329 lhs.fcBkdFtn==rhs.fcBkdFtn &&
5330 lhs.lcbBkdFtn==rhs.lcbBkdFtn &&
5331 lhs.fcPgdEdn==rhs.fcPgdEdn &&
5332 lhs.lcbPgdEdn==rhs.lcbPgdEdn &&
5333 lhs.fcBkdEdn==rhs.fcBkdEdn &&
5334 lhs.lcbBkdEdn==rhs.lcbBkdEdn &&
5335 lhs.fcSttbfIntlFld==rhs.fcSttbfIntlFld &&
5336 lhs.lcbSttbfIntlFld==rhs.lcbSttbfIntlFld &&
5337 lhs.fcRouteSlip==rhs.fcRouteSlip &&
5338 lhs.lcbRouteSlip==rhs.lcbRouteSlip &&
5339 lhs.fcSttbSavedBy==rhs.fcSttbSavedBy &&
5340 lhs.lcbSttbSavedBy==rhs.lcbSttbSavedBy &&
5341 lhs.fcSttbFnm==rhs.fcSttbFnm &&
5342 lhs.lcbSttbFnm==rhs.lcbSttbFnm &&
5343 lhs.fcPlcfLst==rhs.fcPlcfLst &&
5344 lhs.lcbPlcfLst==rhs.lcbPlcfLst &&
5345 lhs.fcPlfLfo==rhs.fcPlfLfo &&
5346 lhs.lcbPlfLfo==rhs.lcbPlfLfo &&
5347 lhs.fcPlcftxbxBkd==rhs.fcPlcftxbxBkd &&
5348 lhs.lcbPlcftxbxBkd==rhs.lcbPlcftxbxBkd &&
5349 lhs.fcPlcftxbxHdrBkd==rhs.fcPlcftxbxHdrBkd &&
5350 lhs.lcbPlcftxbxHdrBkd==rhs.lcbPlcftxbxHdrBkd &&
5351 lhs.fcDocUndo==rhs.fcDocUndo &&
5352 lhs.lcbDocUndo==rhs.lcbDocUndo &&
5353 lhs.fcRgbuse==rhs.fcRgbuse &&
5354 lhs.lcbRgbuse==rhs.lcbRgbuse &&
5355 lhs.fcUsp==rhs.fcUsp &&
5356 lhs.lcbUsp==rhs.lcbUsp &&
5357 lhs.fcUskf==rhs.fcUskf &&
5358 lhs.lcbUskf==rhs.lcbUskf &&
5359 lhs.fcPlcupcRgbuse==rhs.fcPlcupcRgbuse &&
5360 lhs.lcbPlcupcRgbuse==rhs.lcbPlcupcRgbuse &&
5361 lhs.fcPlcupcUsp==rhs.fcPlcupcUsp &&
5362 lhs.lcbPlcupcUsp==rhs.lcbPlcupcUsp &&
5363 lhs.fcSttbGlsyStyle==rhs.fcSttbGlsyStyle &&
5364 lhs.lcbSttbGlsyStyle==rhs.lcbSttbGlsyStyle &&
5365 lhs.fcPlgosl==rhs.fcPlgosl &&
5366 lhs.lcbPlgosl==rhs.lcbPlgosl &&
5367 lhs.fcPlcocx==rhs.fcPlcocx &&
5368 lhs.lcbPlcocx==rhs.lcbPlcocx &&
5369 lhs.fcPlcfbteLvc==rhs.fcPlcfbteLvc &&
5370 lhs.lcbPlcfbteLvc==rhs.lcbPlcfbteLvc &&
5371 lhs.dwLowDateTime==rhs.dwLowDateTime &&
5372 lhs.dwHighDateTime==rhs.dwHighDateTime &&
5373 lhs.fcPlcflvc==rhs.fcPlcflvc &&
5374 lhs.lcbPlcflvc==rhs.lcbPlcflvc &&
5375 lhs.fcPlcasumy==rhs.fcPlcasumy &&
5376 lhs.lcbPlcasumy==rhs.lcbPlcasumy &&
5377 lhs.fcPlcfgram==rhs.fcPlcfgram &&
5378 lhs.lcbPlcfgram==rhs.lcbPlcfgram &&
5379 lhs.fcSttbListNames==rhs.fcSttbListNames &&
5380 lhs.lcbSttbListNames==rhs.lcbSttbListNames &&
5381 lhs.fcSttbfUssr==rhs.fcSttbfUssr &&
5382 lhs.lcbSttbfUssr==rhs.lcbSttbfUssr;
5383 }
5384
operator !=(const FIB & lhs,const FIB & rhs)5385 bool operator!=(const FIB &lhs, const FIB &rhs) {
5386 return !(lhs==rhs);
5387 }
5388
5389
5390 // FIBFCLCB implementation
5391
FIBFCLCB()5392 FIBFCLCB::FIBFCLCB() {
5393 clear();
5394 }
5395
FIBFCLCB(OLEStreamReader * stream,bool preservePos)5396 FIBFCLCB::FIBFCLCB(OLEStreamReader *stream, bool preservePos) {
5397 clear();
5398 read(stream, preservePos);
5399 }
5400
read(OLEStreamReader * stream,bool preservePos)5401 bool FIBFCLCB::read(OLEStreamReader *stream, bool preservePos) {
5402
5403 if(preservePos)
5404 stream->push();
5405
5406 fc=stream->readU32();
5407 lcb=stream->readU32();
5408
5409 if(preservePos)
5410 stream->pop();
5411 return true;
5412 }
5413
write(OLEStreamWriter * stream,bool preservePos) const5414 bool FIBFCLCB::write(OLEStreamWriter *stream, bool preservePos) const {
5415
5416 if(preservePos)
5417 stream->push();
5418
5419 stream->write(fc);
5420 stream->write(lcb);
5421
5422 if(preservePos)
5423 stream->pop();
5424 return true;
5425 }
5426
clear()5427 void FIBFCLCB::clear() {
5428 fc=0;
5429 lcb=0;
5430 }
5431
operator ==(const FIBFCLCB & lhs,const FIBFCLCB & rhs)5432 bool operator==(const FIBFCLCB &lhs, const FIBFCLCB &rhs) {
5433
5434 return lhs.fc==rhs.fc &&
5435 lhs.lcb==rhs.lcb;
5436 }
5437
operator !=(const FIBFCLCB & lhs,const FIBFCLCB & rhs)5438 bool operator!=(const FIBFCLCB &lhs, const FIBFCLCB &rhs) {
5439 return !(lhs==rhs);
5440 }
5441
5442
5443 // FRD implementation
5444
5445 const unsigned int FRD::sizeOf = 2;
5446
FRD()5447 FRD::FRD() {
5448 clear();
5449 }
5450
FRD(OLEStreamReader * stream,bool preservePos)5451 FRD::FRD(OLEStreamReader *stream, bool preservePos) {
5452 clear();
5453 read(stream, preservePos);
5454 }
5455
read(OLEStreamReader * stream,bool preservePos)5456 bool FRD::read(OLEStreamReader *stream, bool preservePos) {
5457
5458 if(preservePos)
5459 stream->push();
5460
5461 nAuto=stream->readS16();
5462
5463 if(preservePos)
5464 stream->pop();
5465 return true;
5466 }
5467
write(OLEStreamWriter * stream,bool preservePos) const5468 bool FRD::write(OLEStreamWriter *stream, bool preservePos) const {
5469
5470 if(preservePos)
5471 stream->push();
5472
5473 stream->write(nAuto);
5474
5475 if(preservePos)
5476 stream->pop();
5477 return true;
5478 }
5479
clear()5480 void FRD::clear() {
5481 nAuto=0;
5482 }
5483
operator ==(const FRD & lhs,const FRD & rhs)5484 bool operator==(const FRD &lhs, const FRD &rhs) {
5485
5486 return lhs.nAuto==rhs.nAuto;
5487 }
5488
operator !=(const FRD & lhs,const FRD & rhs)5489 bool operator!=(const FRD &lhs, const FRD &rhs) {
5490 return !(lhs==rhs);
5491 }
5492
5493
5494 // FSPA implementation
5495
5496 const unsigned int FSPA::sizeOf = 26;
5497
FSPA()5498 FSPA::FSPA() {
5499 clear();
5500 }
5501
FSPA(OLEStreamReader * stream,bool preservePos)5502 FSPA::FSPA(OLEStreamReader *stream, bool preservePos) {
5503 clear();
5504 read(stream, preservePos);
5505 }
5506
read(OLEStreamReader * stream,bool preservePos)5507 bool FSPA::read(OLEStreamReader *stream, bool preservePos) {
5508
5509 U16 shifterU16;
5510
5511 if(preservePos)
5512 stream->push();
5513
5514 spid=stream->readS32();
5515 xaLeft=stream->readS32();
5516 yaTop=stream->readS32();
5517 xaRight=stream->readS32();
5518 yaBottom=stream->readS32();
5519 shifterU16=stream->readU16();
5520 fHdr=shifterU16;
5521 shifterU16>>=1;
5522 bx=shifterU16;
5523 shifterU16>>=2;
5524 by=shifterU16;
5525 shifterU16>>=2;
5526 wr=shifterU16;
5527 shifterU16>>=4;
5528 wrk=shifterU16;
5529 shifterU16>>=4;
5530 fRcaSimple=shifterU16;
5531 shifterU16>>=1;
5532 fBelowText=shifterU16;
5533 shifterU16>>=1;
5534 fAnchorLock=shifterU16;
5535 cTxbx=stream->readS32();
5536
5537 if(preservePos)
5538 stream->pop();
5539 return true;
5540 }
5541
write(OLEStreamWriter * stream,bool preservePos) const5542 bool FSPA::write(OLEStreamWriter *stream, bool preservePos) const {
5543
5544 U16 shifterU16;
5545
5546 if(preservePos)
5547 stream->push();
5548
5549 stream->write(spid);
5550 stream->write(xaLeft);
5551 stream->write(yaTop);
5552 stream->write(xaRight);
5553 stream->write(yaBottom);
5554 shifterU16=fHdr;
5555 shifterU16|=bx << 1;
5556 shifterU16|=by << 3;
5557 shifterU16|=wr << 5;
5558 shifterU16|=wrk << 9;
5559 shifterU16|=fRcaSimple << 13;
5560 shifterU16|=fBelowText << 14;
5561 shifterU16|=fAnchorLock << 15;
5562 stream->write(shifterU16);
5563 stream->write(cTxbx);
5564
5565 if(preservePos)
5566 stream->pop();
5567 return true;
5568 }
5569
clear()5570 void FSPA::clear() {
5571 spid=0;
5572 xaLeft=0;
5573 yaTop=0;
5574 xaRight=0;
5575 yaBottom=0;
5576 fHdr=0;
5577 bx=0;
5578 by=0;
5579 wr=0;
5580 wrk=0;
5581 fRcaSimple=0;
5582 fBelowText=0;
5583 fAnchorLock=0;
5584 cTxbx=0;
5585 }
5586
operator ==(const FSPA & lhs,const FSPA & rhs)5587 bool operator==(const FSPA &lhs, const FSPA &rhs) {
5588
5589 return lhs.spid==rhs.spid &&
5590 lhs.xaLeft==rhs.xaLeft &&
5591 lhs.yaTop==rhs.yaTop &&
5592 lhs.xaRight==rhs.xaRight &&
5593 lhs.yaBottom==rhs.yaBottom &&
5594 lhs.fHdr==rhs.fHdr &&
5595 lhs.bx==rhs.bx &&
5596 lhs.by==rhs.by &&
5597 lhs.wr==rhs.wr &&
5598 lhs.wrk==rhs.wrk &&
5599 lhs.fRcaSimple==rhs.fRcaSimple &&
5600 lhs.fBelowText==rhs.fBelowText &&
5601 lhs.fAnchorLock==rhs.fAnchorLock &&
5602 lhs.cTxbx==rhs.cTxbx;
5603 }
5604
operator !=(const FSPA & lhs,const FSPA & rhs)5605 bool operator!=(const FSPA &lhs, const FSPA &rhs) {
5606 return !(lhs==rhs);
5607 }
5608
5609
5610 // FTXBXS implementation
5611
5612 const unsigned int FTXBXS::sizeOf = 22;
5613
FTXBXS()5614 FTXBXS::FTXBXS() {
5615 clear();
5616 }
5617
FTXBXS(OLEStreamReader * stream,bool preservePos)5618 FTXBXS::FTXBXS(OLEStreamReader *stream, bool preservePos) {
5619 clear();
5620 read(stream, preservePos);
5621 }
5622
read(OLEStreamReader * stream,bool preservePos)5623 bool FTXBXS::read(OLEStreamReader *stream, bool preservePos) {
5624
5625 if(preservePos)
5626 stream->push();
5627
5628 cTxbx_iNextReuse=stream->readS32();
5629 cReusable=stream->readS32();
5630 fReusable=stream->readS16();
5631 reserved=stream->readU32();
5632 lid=stream->readS32();
5633 txidUndo=stream->readS32();
5634
5635 if(preservePos)
5636 stream->pop();
5637 return true;
5638 }
5639
write(OLEStreamWriter * stream,bool preservePos) const5640 bool FTXBXS::write(OLEStreamWriter *stream, bool preservePos) const {
5641
5642 if(preservePos)
5643 stream->push();
5644
5645 stream->write(cTxbx_iNextReuse);
5646 stream->write(cReusable);
5647 stream->write(fReusable);
5648 stream->write(reserved);
5649 stream->write(lid);
5650 stream->write(txidUndo);
5651
5652 if(preservePos)
5653 stream->pop();
5654 return true;
5655 }
5656
clear()5657 void FTXBXS::clear() {
5658 cTxbx_iNextReuse=0;
5659 cReusable=0;
5660 fReusable=0;
5661 reserved=0;
5662 lid=0;
5663 txidUndo=0;
5664 }
5665
operator ==(const FTXBXS & lhs,const FTXBXS & rhs)5666 bool operator==(const FTXBXS &lhs, const FTXBXS &rhs) {
5667
5668 return lhs.cTxbx_iNextReuse==rhs.cTxbx_iNextReuse &&
5669 lhs.cReusable==rhs.cReusable &&
5670 lhs.fReusable==rhs.fReusable &&
5671 lhs.reserved==rhs.reserved &&
5672 lhs.lid==rhs.lid &&
5673 lhs.txidUndo==rhs.txidUndo;
5674 }
5675
operator !=(const FTXBXS & lhs,const FTXBXS & rhs)5676 bool operator!=(const FTXBXS &lhs, const FTXBXS &rhs) {
5677 return !(lhs==rhs);
5678 }
5679
5680
5681 // LFO implementation
5682
5683 const unsigned int LFO::sizeOf = 16;
5684
LFO()5685 LFO::LFO() {
5686 clear();
5687 }
5688
LFO(OLEStreamReader * stream,bool preservePos)5689 LFO::LFO(OLEStreamReader *stream, bool preservePos) {
5690 clear();
5691 read(stream, preservePos);
5692 }
5693
read(OLEStreamReader * stream,bool preservePos)5694 bool LFO::read(OLEStreamReader *stream, bool preservePos) {
5695
5696 if(preservePos)
5697 stream->push();
5698
5699 lsid=stream->readS32();
5700 unused4=stream->readS32();
5701 unused8=stream->readS32();
5702 clfolvl=stream->readU8();
5703 for(int _i=0; _i<(3); ++_i)
5704 reserved[_i]=stream->readU8();
5705
5706 if(preservePos)
5707 stream->pop();
5708 return true;
5709 }
5710
write(OLEStreamWriter * stream,bool preservePos) const5711 bool LFO::write(OLEStreamWriter *stream, bool preservePos) const {
5712
5713 if(preservePos)
5714 stream->push();
5715
5716 stream->write(lsid);
5717 stream->write(unused4);
5718 stream->write(unused8);
5719 stream->write(clfolvl);
5720 for(int _i=0; _i<(3); ++_i)
5721 stream->write(reserved[_i]);
5722
5723 if(preservePos)
5724 stream->pop();
5725 return true;
5726 }
5727
clear()5728 void LFO::clear() {
5729 lsid=0;
5730 unused4=0;
5731 unused8=0;
5732 clfolvl=0;
5733 for(int _i=0; _i<(3); ++_i)
5734 reserved[_i]=0;
5735 }
5736
operator ==(const LFO & lhs,const LFO & rhs)5737 bool operator==(const LFO &lhs, const LFO &rhs) {
5738
5739 for(int _i=0; _i<(3); ++_i) {
5740 if(lhs.reserved[_i]!=rhs.reserved[_i])
5741 return false;
5742 }
5743
5744 return lhs.lsid==rhs.lsid &&
5745 lhs.unused4==rhs.unused4 &&
5746 lhs.unused8==rhs.unused8 &&
5747 lhs.clfolvl==rhs.clfolvl;
5748 }
5749
operator !=(const LFO & lhs,const LFO & rhs)5750 bool operator!=(const LFO &lhs, const LFO &rhs) {
5751 return !(lhs==rhs);
5752 }
5753
5754
5755 // LFOLVL implementation
5756
LFOLVL()5757 LFOLVL::LFOLVL() {
5758 clear();
5759 }
5760
LFOLVL(OLEStreamReader * stream,bool preservePos)5761 LFOLVL::LFOLVL(OLEStreamReader *stream, bool preservePos) {
5762 clear();
5763 read(stream, preservePos);
5764 }
5765
read(OLEStreamReader * stream,bool preservePos)5766 bool LFOLVL::read(OLEStreamReader *stream, bool preservePos) {
5767
5768 U8 shifterU8;
5769
5770 if(preservePos)
5771 stream->push();
5772
5773 iStartAt=stream->readS32();
5774 shifterU8=stream->readU8();
5775 ilvl=shifterU8;
5776 shifterU8>>=4;
5777 fStartAt=shifterU8;
5778 shifterU8>>=1;
5779 fFormatting=shifterU8;
5780 shifterU8>>=1;
5781 unsigned4_6=shifterU8;
5782 for(int _i=0; _i<(3); ++_i)
5783 reserved[_i]=stream->readU8();
5784
5785 if(preservePos)
5786 stream->pop();
5787 return true;
5788 }
5789
write(OLEStreamWriter * stream,bool preservePos) const5790 bool LFOLVL::write(OLEStreamWriter *stream, bool preservePos) const {
5791
5792 U8 shifterU8;
5793
5794 if(preservePos)
5795 stream->push();
5796
5797 stream->write(iStartAt);
5798 shifterU8=ilvl;
5799 shifterU8|=fStartAt << 4;
5800 shifterU8|=fFormatting << 5;
5801 shifterU8|=unsigned4_6 << 6;
5802 stream->write(shifterU8);
5803 for(int _i=0; _i<(3); ++_i)
5804 stream->write(reserved[_i]);
5805
5806 if(preservePos)
5807 stream->pop();
5808 return true;
5809 }
5810
clear()5811 void LFOLVL::clear() {
5812 iStartAt=0;
5813 ilvl=0;
5814 fStartAt=0;
5815 fFormatting=0;
5816 unsigned4_6=0;
5817 for(int _i=0; _i<(3); ++_i)
5818 reserved[_i]=0;
5819 }
5820
operator ==(const LFOLVL & lhs,const LFOLVL & rhs)5821 bool operator==(const LFOLVL &lhs, const LFOLVL &rhs) {
5822
5823 for(int _i=0; _i<(3); ++_i) {
5824 if(lhs.reserved[_i]!=rhs.reserved[_i])
5825 return false;
5826 }
5827
5828 return lhs.iStartAt==rhs.iStartAt &&
5829 lhs.ilvl==rhs.ilvl &&
5830 lhs.fStartAt==rhs.fStartAt &&
5831 lhs.fFormatting==rhs.fFormatting &&
5832 lhs.unsigned4_6==rhs.unsigned4_6;
5833 }
5834
operator !=(const LFOLVL & lhs,const LFOLVL & rhs)5835 bool operator!=(const LFOLVL &lhs, const LFOLVL &rhs) {
5836 return !(lhs==rhs);
5837 }
5838
5839
5840 // LSPD implementation
5841
LSPD()5842 LSPD::LSPD() {
5843 clear();
5844 }
5845
LSPD(OLEStreamReader * stream,bool preservePos)5846 LSPD::LSPD(OLEStreamReader *stream, bool preservePos) {
5847 clear();
5848 read(stream, preservePos);
5849 }
5850
read(OLEStreamReader * stream,bool preservePos)5851 bool LSPD::read(OLEStreamReader *stream, bool preservePos) {
5852
5853 if(preservePos)
5854 stream->push();
5855
5856 dyaLine=stream->readS16();
5857 fMultLinespace=stream->readS16();
5858
5859 if(preservePos)
5860 stream->pop();
5861 return true;
5862 }
5863
write(OLEStreamWriter * stream,bool preservePos) const5864 bool LSPD::write(OLEStreamWriter *stream, bool preservePos) const {
5865
5866 if(preservePos)
5867 stream->push();
5868
5869 stream->write(dyaLine);
5870 stream->write(fMultLinespace);
5871
5872 if(preservePos)
5873 stream->pop();
5874 return true;
5875 }
5876
clear()5877 void LSPD::clear() {
5878 dyaLine=240;
5879 fMultLinespace=1;
5880 }
5881
dump() const5882 void LSPD::dump() const
5883 {
5884 wvlog << "Dumping LSPD:" << std::endl;
5885 wvlog << toString().c_str() << std::endl;
5886 wvlog << "\nDumping LSPD done." << std::endl;
5887 }
5888
toString() const5889 std::string LSPD::toString() const
5890 {
5891 std::string s( "LSPD:" );
5892 s += "\ndyaLine=";
5893 s += int2string( dyaLine );
5894 s += "\nfMultLinespace=";
5895 s += int2string( fMultLinespace );
5896 s += "\nLSPD Done.";
5897 return s;
5898 }
5899
operator ==(const LSPD & lhs,const LSPD & rhs)5900 bool operator==(const LSPD &lhs, const LSPD &rhs) {
5901
5902 return lhs.dyaLine==rhs.dyaLine &&
5903 lhs.fMultLinespace==rhs.fMultLinespace;
5904 }
5905
operator !=(const LSPD & lhs,const LSPD & rhs)5906 bool operator!=(const LSPD &lhs, const LSPD &rhs) {
5907 return !(lhs==rhs);
5908 }
5909
5910
5911 // LSTF implementation
5912
5913 const unsigned int LSTF::sizeOf = 28;
5914
LSTF()5915 LSTF::LSTF() {
5916 clear();
5917 }
5918
LSTF(OLEStreamReader * stream,bool preservePos)5919 LSTF::LSTF(OLEStreamReader *stream, bool preservePos) {
5920 clear();
5921 read(stream, preservePos);
5922 }
5923
read(OLEStreamReader * stream,bool preservePos)5924 bool LSTF::read(OLEStreamReader *stream, bool preservePos) {
5925
5926 U8 shifterU8;
5927
5928 if(preservePos)
5929 stream->push();
5930
5931 lsid=stream->readS32();
5932 tplc=stream->readS32();
5933 for(int _i=0; _i<(9); ++_i)
5934 rgistd[_i]=stream->readU16();
5935 shifterU8=stream->readU8();
5936 fSimpleList=shifterU8;
5937 shifterU8>>=1;
5938 fRestartHdn=shifterU8;
5939 shifterU8>>=1;
5940 unsigned26_2=shifterU8;
5941 reserved=stream->readU8();
5942
5943 if(preservePos)
5944 stream->pop();
5945 return true;
5946 }
5947
write(OLEStreamWriter * stream,bool preservePos) const5948 bool LSTF::write(OLEStreamWriter *stream, bool preservePos) const {
5949
5950 U8 shifterU8;
5951
5952 if(preservePos)
5953 stream->push();
5954
5955 stream->write(lsid);
5956 stream->write(tplc);
5957 for(int _i=0; _i<(9); ++_i)
5958 stream->write(rgistd[_i]);
5959 shifterU8=fSimpleList;
5960 shifterU8|=fRestartHdn << 1;
5961 shifterU8|=unsigned26_2 << 2;
5962 stream->write(shifterU8);
5963 stream->write(reserved);
5964
5965 if(preservePos)
5966 stream->pop();
5967 return true;
5968 }
5969
clear()5970 void LSTF::clear() {
5971 lsid=0;
5972 tplc=0;
5973 for(int _i=0; _i<(9); ++_i)
5974 rgistd[_i]=0;
5975 fSimpleList=0;
5976 fRestartHdn=0;
5977 unsigned26_2=0;
5978 reserved=0;
5979 }
5980
operator ==(const LSTF & lhs,const LSTF & rhs)5981 bool operator==(const LSTF &lhs, const LSTF &rhs) {
5982
5983 for(int _i=0; _i<(9); ++_i) {
5984 if(lhs.rgistd[_i]!=rhs.rgistd[_i])
5985 return false;
5986 }
5987
5988 return lhs.lsid==rhs.lsid &&
5989 lhs.tplc==rhs.tplc &&
5990 lhs.fSimpleList==rhs.fSimpleList &&
5991 lhs.fRestartHdn==rhs.fRestartHdn &&
5992 lhs.unsigned26_2==rhs.unsigned26_2 &&
5993 lhs.reserved==rhs.reserved;
5994 }
5995
operator !=(const LSTF & lhs,const LSTF & rhs)5996 bool operator!=(const LSTF &lhs, const LSTF &rhs) {
5997 return !(lhs==rhs);
5998 }
5999
6000
6001 // LVLF implementation
6002
LVLF()6003 LVLF::LVLF() {
6004 clear();
6005 }
6006
LVLF(OLEStreamReader * stream,bool preservePos)6007 LVLF::LVLF(OLEStreamReader *stream, bool preservePos) {
6008 clear();
6009 read(stream, preservePos);
6010 }
6011
read(OLEStreamReader * stream,bool preservePos)6012 bool LVLF::read(OLEStreamReader *stream, bool preservePos) {
6013
6014 U8 shifterU8;
6015
6016 if(preservePos)
6017 stream->push();
6018
6019 iStartAt=stream->readU32();
6020 nfc=stream->readU8();
6021 shifterU8=stream->readU8();
6022 jc=shifterU8;
6023 shifterU8>>=2;
6024 fLegal=shifterU8;
6025 shifterU8>>=1;
6026 fNoRestart=shifterU8;
6027 shifterU8>>=1;
6028 fPrev=shifterU8;
6029 shifterU8>>=1;
6030 fPrevSpace=shifterU8;
6031 shifterU8>>=1;
6032 fWord6=shifterU8;
6033 shifterU8>>=1;
6034 unused5_7=shifterU8;
6035 for(int _i=0; _i<(9); ++_i)
6036 rgbxchNums[_i]=stream->readU8();
6037 ixchFollow=stream->readU8();
6038 dxaSpace=stream->readS32();
6039 dxaIndent=stream->readS32();
6040 cbGrpprlChpx=stream->readU8();
6041 cbGrpprlPapx=stream->readU8();
6042 reserved=stream->readU16();
6043
6044 if(preservePos)
6045 stream->pop();
6046 return true;
6047 }
6048
write(OLEStreamWriter * stream,bool preservePos) const6049 bool LVLF::write(OLEStreamWriter *stream, bool preservePos) const {
6050
6051 U8 shifterU8;
6052
6053 if(preservePos)
6054 stream->push();
6055
6056 stream->write(iStartAt);
6057 stream->write(nfc);
6058 shifterU8=jc;
6059 shifterU8|=fLegal << 2;
6060 shifterU8|=fNoRestart << 3;
6061 shifterU8|=fPrev << 4;
6062 shifterU8|=fPrevSpace << 5;
6063 shifterU8|=fWord6 << 6;
6064 shifterU8|=unused5_7 << 7;
6065 stream->write(shifterU8);
6066 for(int _i=0; _i<(9); ++_i)
6067 stream->write(rgbxchNums[_i]);
6068 stream->write(ixchFollow);
6069 stream->write(dxaSpace);
6070 stream->write(dxaIndent);
6071 stream->write(cbGrpprlChpx);
6072 stream->write(cbGrpprlPapx);
6073 stream->write(reserved);
6074
6075 if(preservePos)
6076 stream->pop();
6077 return true;
6078 }
6079
clear()6080 void LVLF::clear() {
6081 iStartAt=0;
6082 nfc=0;
6083 jc=0;
6084 fLegal=0;
6085 fNoRestart=0;
6086 fPrev=0;
6087 fPrevSpace=0;
6088 fWord6=0;
6089 unused5_7=0;
6090 for(int _i=0; _i<(9); ++_i)
6091 rgbxchNums[_i]=0;
6092 ixchFollow=0;
6093 dxaSpace=0;
6094 dxaIndent=0;
6095 cbGrpprlChpx=0;
6096 cbGrpprlPapx=0;
6097 reserved=0;
6098 }
6099
operator ==(const LVLF & lhs,const LVLF & rhs)6100 bool operator==(const LVLF &lhs, const LVLF &rhs) {
6101
6102 for(int _i=0; _i<(9); ++_i) {
6103 if(lhs.rgbxchNums[_i]!=rhs.rgbxchNums[_i])
6104 return false;
6105 }
6106
6107 return lhs.iStartAt==rhs.iStartAt &&
6108 lhs.nfc==rhs.nfc &&
6109 lhs.jc==rhs.jc &&
6110 lhs.fLegal==rhs.fLegal &&
6111 lhs.fNoRestart==rhs.fNoRestart &&
6112 lhs.fPrev==rhs.fPrev &&
6113 lhs.fPrevSpace==rhs.fPrevSpace &&
6114 lhs.fWord6==rhs.fWord6 &&
6115 lhs.unused5_7==rhs.unused5_7 &&
6116 lhs.ixchFollow==rhs.ixchFollow &&
6117 lhs.dxaSpace==rhs.dxaSpace &&
6118 lhs.dxaIndent==rhs.dxaIndent &&
6119 lhs.cbGrpprlChpx==rhs.cbGrpprlChpx &&
6120 lhs.cbGrpprlPapx==rhs.cbGrpprlPapx &&
6121 lhs.reserved==rhs.reserved;
6122 }
6123
operator !=(const LVLF & lhs,const LVLF & rhs)6124 bool operator!=(const LVLF &lhs, const LVLF &rhs) {
6125 return !(lhs==rhs);
6126 }
6127
6128
6129 // METAFILEPICT implementation
6130
METAFILEPICT()6131 METAFILEPICT::METAFILEPICT() {
6132 clear();
6133 }
6134
METAFILEPICT(OLEStreamReader * stream,bool preservePos)6135 METAFILEPICT::METAFILEPICT(OLEStreamReader *stream, bool preservePos) {
6136 clear();
6137 read(stream, preservePos);
6138 }
6139
read(OLEStreamReader * stream,bool preservePos)6140 bool METAFILEPICT::read(OLEStreamReader *stream, bool preservePos) {
6141
6142 if(preservePos)
6143 stream->push();
6144
6145 mm=stream->readS16();
6146 xExt=stream->readS16();
6147 yExt=stream->readS16();
6148 hMF=stream->readS16();
6149
6150 if(preservePos)
6151 stream->pop();
6152 return true;
6153 }
6154
write(OLEStreamWriter * stream,bool preservePos) const6155 bool METAFILEPICT::write(OLEStreamWriter *stream, bool preservePos) const {
6156
6157 if(preservePos)
6158 stream->push();
6159
6160 stream->write(mm);
6161 stream->write(xExt);
6162 stream->write(yExt);
6163 stream->write(hMF);
6164
6165 if(preservePos)
6166 stream->pop();
6167 return true;
6168 }
6169
clear()6170 void METAFILEPICT::clear() {
6171 mm=0;
6172 xExt=0;
6173 yExt=0;
6174 hMF=0;
6175 }
6176
dump() const6177 void METAFILEPICT::dump() const
6178 {
6179 wvlog << "Dumping METAFILEPICT:" << std::endl;
6180 wvlog << toString().c_str() << std::endl;
6181 wvlog << "\nDumping METAFILEPICT done." << std::endl;
6182 }
6183
toString() const6184 std::string METAFILEPICT::toString() const
6185 {
6186 std::string s( "METAFILEPICT:" );
6187 s += "\nmm=";
6188 s += int2string( mm );
6189 s += "\nxExt=";
6190 s += int2string( xExt );
6191 s += "\nyExt=";
6192 s += int2string( yExt );
6193 s += "\nhMF=";
6194 s += int2string( hMF );
6195 s += "\nMETAFILEPICT Done.";
6196 return s;
6197 }
6198
operator ==(const METAFILEPICT & lhs,const METAFILEPICT & rhs)6199 bool operator==(const METAFILEPICT &lhs, const METAFILEPICT &rhs) {
6200
6201 return lhs.mm==rhs.mm &&
6202 lhs.xExt==rhs.xExt &&
6203 lhs.yExt==rhs.yExt &&
6204 lhs.hMF==rhs.hMF;
6205 }
6206
operator !=(const METAFILEPICT & lhs,const METAFILEPICT & rhs)6207 bool operator!=(const METAFILEPICT &lhs, const METAFILEPICT &rhs) {
6208 return !(lhs==rhs);
6209 }
6210
6211
6212 // NUMRM implementation
6213
NUMRM()6214 NUMRM::NUMRM() {
6215 clear();
6216 }
6217
NUMRM(OLEStreamReader * stream,bool preservePos)6218 NUMRM::NUMRM(OLEStreamReader *stream, bool preservePos) {
6219 clear();
6220 read(stream, preservePos);
6221 }
6222
NUMRM(const U8 * ptr)6223 NUMRM::NUMRM(const U8 *ptr) {
6224 clear();
6225 readPtr(ptr);
6226 }
6227
read(OLEStreamReader * stream,bool preservePos)6228 bool NUMRM::read(OLEStreamReader *stream, bool preservePos) {
6229
6230 if(preservePos)
6231 stream->push();
6232
6233 fNumRM=stream->readU8();
6234 unused1=stream->readU8();
6235 ibstNumRM=stream->readS16();
6236 dttmNumRM.read(stream, false);
6237 for(int _i=0; _i<(9); ++_i)
6238 rgbxchNums[_i]=stream->readU8();
6239 for(int _i=0; _i<(9); ++_i)
6240 rgnfc[_i]=stream->readU8();
6241 unused26=stream->readS16();
6242 for(int _i=0; _i<(9); ++_i)
6243 PNBR[_i]=stream->readU32();
6244 for(int _i=0; _i<(32); ++_i)
6245 xst[_i]=stream->readU16();
6246
6247 if(preservePos)
6248 stream->pop();
6249 return true;
6250 }
6251
readPtr(const U8 * ptr)6252 void NUMRM::readPtr(const U8 *ptr) {
6253
6254 fNumRM=readU8(ptr);
6255 ptr+=sizeof(U8);
6256 unused1=readU8(ptr);
6257 ptr+=sizeof(U8);
6258 ibstNumRM=readS16(ptr);
6259 ptr+=sizeof(S16);
6260 dttmNumRM.readPtr(ptr);
6261 ptr+=DTTM::sizeOf;
6262 for(int _i=0; _i<(9); ++_i) {
6263 rgbxchNums[_i]=readU8(ptr);
6264 ptr+=sizeof(U8);
6265 }
6266 for(int _i=0; _i<(9); ++_i) {
6267 rgnfc[_i]=readU8(ptr);
6268 ptr+=sizeof(U8);
6269 }
6270 unused26=readS16(ptr);
6271 ptr+=sizeof(S16);
6272 for(int _i=0; _i<(9); ++_i) {
6273 PNBR[_i]=readU32(ptr);
6274 ptr+=sizeof(U32);
6275 }
6276 for(int _i=0; _i<(32); ++_i) {
6277 xst[_i]=readU16(ptr);
6278 ptr+=sizeof(U16);
6279 }
6280 }
6281
write(OLEStreamWriter * stream,bool preservePos) const6282 bool NUMRM::write(OLEStreamWriter *stream, bool preservePos) const {
6283
6284 if(preservePos)
6285 stream->push();
6286
6287 stream->write(fNumRM);
6288 stream->write(unused1);
6289 stream->write(ibstNumRM);
6290 dttmNumRM.write(stream, false);
6291 for(int _i=0; _i<(9); ++_i)
6292 stream->write(rgbxchNums[_i]);
6293 for(int _i=0; _i<(9); ++_i)
6294 stream->write(rgnfc[_i]);
6295 stream->write(unused26);
6296 for(int _i=0; _i<(9); ++_i)
6297 stream->write(PNBR[_i]);
6298 for(int _i=0; _i<(32); ++_i)
6299 stream->write(xst[_i]);
6300
6301 if(preservePos)
6302 stream->pop();
6303 return true;
6304 }
6305
clear()6306 void NUMRM::clear() {
6307 fNumRM=0;
6308 unused1=0;
6309 ibstNumRM=0;
6310 dttmNumRM.clear();
6311 for(int _i=0; _i<(9); ++_i)
6312 rgbxchNums[_i]=0;
6313 for(int _i=0; _i<(9); ++_i)
6314 rgnfc[_i]=0;
6315 unused26=0;
6316 for(int _i=0; _i<(9); ++_i)
6317 PNBR[_i]=0;
6318 for(int _i=0; _i<(32); ++_i)
6319 xst[_i]=0;
6320 }
6321
dump() const6322 void NUMRM::dump() const
6323 {
6324 wvlog << "Dumping NUMRM:" << std::endl;
6325 wvlog << toString().c_str() << std::endl;
6326 wvlog << "\nDumping NUMRM done." << std::endl;
6327 }
6328
toString() const6329 std::string NUMRM::toString() const
6330 {
6331 std::string s( "NUMRM:" );
6332 s += "\nfNumRM=";
6333 s += uint2string( fNumRM );
6334 s += "\nunused1=";
6335 s += uint2string( unused1 );
6336 s += "\nibstNumRM=";
6337 s += int2string( ibstNumRM );
6338 s += "\ndttmNumRM=";
6339 s += "\n{" + dttmNumRM.toString() + "}\n";
6340 for(int _i=0; _i<(9); ++_i) {
6341 s += "\nrgbxchNums[" + int2string( _i ) + "]=";
6342 s += uint2string( rgbxchNums[_i] );
6343 }
6344 for(int _i=0; _i<(9); ++_i) {
6345 s += "\nrgnfc[" + int2string( _i ) + "]=";
6346 s += uint2string( rgnfc[_i] );
6347 }
6348 s += "\nunused26=";
6349 s += int2string( unused26 );
6350 for(int _i=0; _i<(9); ++_i) {
6351 s += "\nPNBR[" + int2string( _i ) + "]=";
6352 s += uint2string( PNBR[_i] );
6353 }
6354 for(int _i=0; _i<(32); ++_i) {
6355 s += "\nxst[" + int2string( _i ) + "]=";
6356 s += uint2string( xst[_i] );
6357 }
6358 s += "\nNUMRM Done.";
6359 return s;
6360 }
6361
operator ==(const NUMRM & lhs,const NUMRM & rhs)6362 bool operator==(const NUMRM &lhs, const NUMRM &rhs) {
6363
6364 for(int _i=0; _i<(9); ++_i) {
6365 if(lhs.rgbxchNums[_i]!=rhs.rgbxchNums[_i])
6366 return false;
6367 }
6368
6369 for(int _i=0; _i<(9); ++_i) {
6370 if(lhs.rgnfc[_i]!=rhs.rgnfc[_i])
6371 return false;
6372 }
6373
6374 for(int _i=0; _i<(9); ++_i) {
6375 if(lhs.PNBR[_i]!=rhs.PNBR[_i])
6376 return false;
6377 }
6378
6379 for(int _i=0; _i<(32); ++_i) {
6380 if(lhs.xst[_i]!=rhs.xst[_i])
6381 return false;
6382 }
6383
6384 return lhs.fNumRM==rhs.fNumRM &&
6385 lhs.unused1==rhs.unused1 &&
6386 lhs.ibstNumRM==rhs.ibstNumRM &&
6387 lhs.dttmNumRM==rhs.dttmNumRM &&
6388 lhs.unused26==rhs.unused26;
6389 }
6390
operator !=(const NUMRM & lhs,const NUMRM & rhs)6391 bool operator!=(const NUMRM &lhs, const NUMRM &rhs) {
6392 return !(lhs==rhs);
6393 }
6394
6395
6396 // OBJHEADER implementation
6397
OBJHEADER()6398 OBJHEADER::OBJHEADER() {
6399 clear();
6400 }
6401
OBJHEADER(OLEStreamReader * stream,bool preservePos)6402 OBJHEADER::OBJHEADER(OLEStreamReader *stream, bool preservePos) {
6403 clear();
6404 read(stream, preservePos);
6405 }
6406
read(OLEStreamReader * stream,bool preservePos)6407 bool OBJHEADER::read(OLEStreamReader *stream, bool preservePos) {
6408
6409 if(preservePos)
6410 stream->push();
6411
6412 lcb=stream->readU32();
6413 cbHeader=stream->readU16();
6414 icf=stream->readU16();
6415
6416 if(preservePos)
6417 stream->pop();
6418 return true;
6419 }
6420
write(OLEStreamWriter * stream,bool preservePos) const6421 bool OBJHEADER::write(OLEStreamWriter *stream, bool preservePos) const {
6422
6423 if(preservePos)
6424 stream->push();
6425
6426 stream->write(lcb);
6427 stream->write(cbHeader);
6428 stream->write(icf);
6429
6430 if(preservePos)
6431 stream->pop();
6432 return true;
6433 }
6434
clear()6435 void OBJHEADER::clear() {
6436 lcb=0;
6437 cbHeader=0;
6438 icf=0;
6439 }
6440
operator ==(const OBJHEADER & lhs,const OBJHEADER & rhs)6441 bool operator==(const OBJHEADER &lhs, const OBJHEADER &rhs) {
6442
6443 return lhs.lcb==rhs.lcb &&
6444 lhs.cbHeader==rhs.cbHeader &&
6445 lhs.icf==rhs.icf;
6446 }
6447
operator !=(const OBJHEADER & lhs,const OBJHEADER & rhs)6448 bool operator!=(const OBJHEADER &lhs, const OBJHEADER &rhs) {
6449 return !(lhs==rhs);
6450 }
6451
6452
6453 // OLST implementation
6454
6455 const unsigned int OLST::sizeOf = 212;
6456
OLST()6457 OLST::OLST() {
6458 clear();
6459 }
6460
OLST(OLEStreamReader * stream,bool preservePos)6461 OLST::OLST(OLEStreamReader *stream, bool preservePos) {
6462 clear();
6463 read(stream, preservePos);
6464 }
6465
OLST(const U8 * ptr)6466 OLST::OLST(const U8 *ptr) {
6467 clear();
6468 readPtr(ptr);
6469 }
6470
read(OLEStreamReader * stream,bool preservePos)6471 bool OLST::read(OLEStreamReader *stream, bool preservePos) {
6472
6473 if(preservePos)
6474 stream->push();
6475
6476 for(int _i=0; _i<(9); ++_i)
6477 rganlv[_i].read(stream, false);
6478 fRestartHdr=stream->readU8();
6479 fSpareOlst2=stream->readU8();
6480 fSpareOlst3=stream->readU8();
6481 fSpareOlst4=stream->readU8();
6482 for(int _i=0; _i<(32); ++_i)
6483 rgxch[_i]=stream->readU16();
6484
6485 if(preservePos)
6486 stream->pop();
6487 return true;
6488 }
6489
readPtr(const U8 * ptr)6490 void OLST::readPtr(const U8 *ptr) {
6491
6492 for(int _i=0; _i<(9); ++_i) {
6493 rganlv[_i].readPtr(ptr);
6494 ptr+=ANLV::sizeOf;
6495 }
6496 fRestartHdr=readU8(ptr);
6497 ptr+=sizeof(U8);
6498 fSpareOlst2=readU8(ptr);
6499 ptr+=sizeof(U8);
6500 fSpareOlst3=readU8(ptr);
6501 ptr+=sizeof(U8);
6502 fSpareOlst4=readU8(ptr);
6503 ptr+=sizeof(U8);
6504 for(int _i=0; _i<(32); ++_i) {
6505 rgxch[_i]=readU16(ptr);
6506 ptr+=sizeof(U16);
6507 }
6508 }
6509
write(OLEStreamWriter * stream,bool preservePos) const6510 bool OLST::write(OLEStreamWriter *stream, bool preservePos) const {
6511
6512 if(preservePos)
6513 stream->push();
6514
6515 for(int _i=0; _i<(9); ++_i)
6516 rganlv[_i].write(stream, false);
6517 stream->write(fRestartHdr);
6518 stream->write(fSpareOlst2);
6519 stream->write(fSpareOlst3);
6520 stream->write(fSpareOlst4);
6521 for(int _i=0; _i<(32); ++_i)
6522 stream->write(rgxch[_i]);
6523
6524 if(preservePos)
6525 stream->pop();
6526 return true;
6527 }
6528
clear()6529 void OLST::clear() {
6530 for(int _i=0; _i<(9); ++_i)
6531 rganlv[_i].clear();
6532 fRestartHdr=0;
6533 fSpareOlst2=0;
6534 fSpareOlst3=0;
6535 fSpareOlst4=0;
6536 for(int _i=0; _i<(32); ++_i)
6537 rgxch[_i]=0;
6538 }
6539
dump() const6540 void OLST::dump() const
6541 {
6542 wvlog << "Dumping OLST:" << std::endl;
6543 wvlog << toString().c_str() << std::endl;
6544 wvlog << "\nDumping OLST done." << std::endl;
6545 }
6546
toString() const6547 std::string OLST::toString() const
6548 {
6549 std::string s( "OLST:" );
6550 for(int _i=0; _i<(9); ++_i) {
6551 s += "\nrganlv[" + int2string( _i ) + "]=";
6552 s += "\n{" + rganlv[_i].toString() + "}\n";
6553 }
6554 s += "\nfRestartHdr=";
6555 s += uint2string( fRestartHdr );
6556 s += "\nfSpareOlst2=";
6557 s += uint2string( fSpareOlst2 );
6558 s += "\nfSpareOlst3=";
6559 s += uint2string( fSpareOlst3 );
6560 s += "\nfSpareOlst4=";
6561 s += uint2string( fSpareOlst4 );
6562 for(int _i=0; _i<(32); ++_i) {
6563 s += "\nrgxch[" + int2string( _i ) + "]=";
6564 s += uint2string( rgxch[_i] );
6565 }
6566 s += "\nOLST Done.";
6567 return s;
6568 }
6569
operator ==(const OLST & lhs,const OLST & rhs)6570 bool operator==(const OLST &lhs, const OLST &rhs) {
6571
6572 for(int _i=0; _i<(9); ++_i) {
6573 if(lhs.rganlv[_i]!=rhs.rganlv[_i])
6574 return false;
6575 }
6576
6577 for(int _i=0; _i<(32); ++_i) {
6578 if(lhs.rgxch[_i]!=rhs.rgxch[_i])
6579 return false;
6580 }
6581
6582 return lhs.fRestartHdr==rhs.fRestartHdr &&
6583 lhs.fSpareOlst2==rhs.fSpareOlst2 &&
6584 lhs.fSpareOlst3==rhs.fSpareOlst3 &&
6585 lhs.fSpareOlst4==rhs.fSpareOlst4;
6586 }
6587
operator !=(const OLST & lhs,const OLST & rhs)6588 bool operator!=(const OLST &lhs, const OLST &rhs) {
6589 return !(lhs==rhs);
6590 }
6591
6592
6593 // PAP implementation
6594
PAP()6595 PAP::PAP() : Shared() {
6596 clear();
6597 }
6598
PAP(OLEStreamReader * stream,bool preservePos)6599 PAP::PAP(OLEStreamReader *stream, bool preservePos) : Shared() {
6600 clear();
6601 read(stream, preservePos);
6602 }
6603
read(OLEStreamReader * stream,bool preservePos)6604 bool PAP::read(OLEStreamReader *stream, bool preservePos) {
6605
6606 U8 shifterU8;
6607 U16 shifterU16;
6608
6609 if(preservePos)
6610 stream->push();
6611
6612 istd=stream->readU16();
6613 jc=stream->readU8();
6614 fKeep=stream->readU8();
6615 fKeepFollow=stream->readU8();
6616 fPageBreakBefore=stream->readU8();
6617 shifterU8=stream->readU8();
6618 fBrLnAbove=shifterU8;
6619 shifterU8>>=1;
6620 fBrLnBelow=shifterU8;
6621 shifterU8>>=1;
6622 fUnused=shifterU8;
6623 shifterU8>>=2;
6624 pcVert=shifterU8;
6625 shifterU8>>=2;
6626 pcHorz=shifterU8;
6627 brcp=stream->readU8();
6628 brcl=stream->readU8();
6629 unused9=stream->readU8();
6630 ilvl=stream->readU8();
6631 fNoLnn=stream->readU8();
6632 ilfo=stream->readS16();
6633 nLvlAnm=stream->readU8();
6634 unused15=stream->readU8();
6635 fSideBySide=stream->readU8();
6636 unused17=stream->readU8();
6637 fNoAutoHyph=stream->readU8();
6638 fWidowControl=stream->readU8();
6639 dxaRight=stream->readS32();
6640 dxaLeft=stream->readS32();
6641 dxaLeft1=stream->readS32();
6642 lspd.read(stream, false);
6643 dyaBefore=stream->readU32();
6644 dyaAfter=stream->readU32();
6645 phe.read(stream, false);
6646 fCrLf=stream->readU8();
6647 fUsePgsuSettings=stream->readU8();
6648 fAdjustRight=stream->readU8();
6649 unused59=stream->readU8();
6650 fKinsoku=stream->readU8();
6651 fWordWrap=stream->readU8();
6652 fOverflowPunct=stream->readU8();
6653 fTopLinePunct=stream->readU8();
6654 fAutoSpaceDE=stream->readU8();
6655 fAutoSpaceDN=stream->readU8();
6656 wAlignFont=stream->readU16();
6657 shifterU16=stream->readU16();
6658 fVertical=shifterU16;
6659 shifterU16>>=1;
6660 fBackward=shifterU16;
6661 shifterU16>>=1;
6662 fRotateFont=shifterU16;
6663 shifterU16>>=1;
6664 unused68_3=shifterU16;
6665 unused70=stream->readU16();
6666 fInTable=stream->readS8();
6667 fTtp=stream->readS8();
6668 wr=stream->readU8();
6669 fLocked=stream->readU8();
6670 ptap=stream->readU32();
6671 dxaAbs=stream->readS32();
6672 dyaAbs=stream->readS32();
6673 dxaWidth=stream->readS32();
6674 brcTop.read(stream, false);
6675 brcLeft.read(stream, false);
6676 brcBottom.read(stream, false);
6677 brcRight.read(stream, false);
6678 brcBetween.read(stream, false);
6679 brcBar.read(stream, false);
6680 dxaFromText=stream->readS32();
6681 dyaFromText=stream->readS32();
6682 shifterU16=stream->readU16();
6683 dyaHeight=shifterU16;
6684 shifterU16>>=15;
6685 fMinHeight=shifterU16;
6686 shd.read(stream, false);
6687 dcs.read(stream, false);
6688 lvl=stream->readS8();
6689 fNumRMIns=stream->readS8();
6690 anld.read(stream, false);
6691 fPropRMark=stream->readS16();
6692 ibstPropRMark=stream->readS16();
6693 dttmPropRMark.read(stream, false);
6694 numrm.read(stream, false);
6695 itbdMac=stream->readS16();
6696 // skipping the std::vector rgdxaTab
6697
6698 if(preservePos)
6699 stream->pop();
6700 return true;
6701 }
6702
write(OLEStreamWriter * stream,bool preservePos) const6703 bool PAP::write(OLEStreamWriter *stream, bool preservePos) const {
6704
6705 U8 shifterU8;
6706 U16 shifterU16;
6707
6708 if(preservePos)
6709 stream->push();
6710
6711 stream->write(istd);
6712 stream->write(jc);
6713 stream->write(fKeep);
6714 stream->write(fKeepFollow);
6715 stream->write(fPageBreakBefore);
6716 shifterU8=fBrLnAbove;
6717 shifterU8|=fBrLnBelow << 1;
6718 shifterU8|=fUnused << 2;
6719 shifterU8|=pcVert << 4;
6720 shifterU8|=pcHorz << 6;
6721 stream->write(shifterU8);
6722 stream->write(brcp);
6723 stream->write(brcl);
6724 stream->write(unused9);
6725 stream->write(ilvl);
6726 stream->write(fNoLnn);
6727 stream->write(ilfo);
6728 stream->write(nLvlAnm);
6729 stream->write(unused15);
6730 stream->write(fSideBySide);
6731 stream->write(unused17);
6732 stream->write(fNoAutoHyph);
6733 stream->write(fWidowControl);
6734 stream->write(dxaRight);
6735 stream->write(dxaLeft);
6736 stream->write(dxaLeft1);
6737 lspd.write(stream, false);
6738 stream->write(dyaBefore);
6739 stream->write(dyaAfter);
6740 phe.write(stream, false);
6741 stream->write(fCrLf);
6742 stream->write(fUsePgsuSettings);
6743 stream->write(fAdjustRight);
6744 stream->write(unused59);
6745 stream->write(fKinsoku);
6746 stream->write(fWordWrap);
6747 stream->write(fOverflowPunct);
6748 stream->write(fTopLinePunct);
6749 stream->write(fAutoSpaceDE);
6750 stream->write(fAutoSpaceDN);
6751 stream->write(wAlignFont);
6752 shifterU16=fVertical;
6753 shifterU16|=fBackward << 1;
6754 shifterU16|=fRotateFont << 2;
6755 shifterU16|=unused68_3 << 3;
6756 stream->write(shifterU16);
6757 stream->write(unused70);
6758 stream->write(fInTable);
6759 stream->write(fTtp);
6760 stream->write(wr);
6761 stream->write(fLocked);
6762 stream->write(ptap);
6763 stream->write(dxaAbs);
6764 stream->write(dyaAbs);
6765 stream->write(dxaWidth);
6766 brcTop.write(stream, false);
6767 brcLeft.write(stream, false);
6768 brcBottom.write(stream, false);
6769 brcRight.write(stream, false);
6770 brcBetween.write(stream, false);
6771 brcBar.write(stream, false);
6772 stream->write(dxaFromText);
6773 stream->write(dyaFromText);
6774 shifterU16=dyaHeight;
6775 shifterU16|=fMinHeight << 15;
6776 stream->write(shifterU16);
6777 shd.write(stream, false);
6778 dcs.write(stream, false);
6779 stream->write(lvl);
6780 stream->write(fNumRMIns);
6781 anld.write(stream, false);
6782 stream->write(fPropRMark);
6783 stream->write(ibstPropRMark);
6784 dttmPropRMark.write(stream, false);
6785 numrm.write(stream, false);
6786 stream->write(itbdMac);
6787 // skipping the std::vector rgdxaTab
6788
6789 if(preservePos)
6790 stream->pop();
6791 return true;
6792 }
6793
clear()6794 void PAP::clear() {
6795 istd=0;
6796 jc=0;
6797 fKeep=0;
6798 fKeepFollow=0;
6799 fPageBreakBefore=0;
6800 fBrLnAbove=0;
6801 fBrLnBelow=0;
6802 fUnused=0;
6803 pcVert=0;
6804 pcHorz=0;
6805 brcp=0;
6806 brcl=0;
6807 unused9=0;
6808 ilvl=0;
6809 fNoLnn=0;
6810 ilfo=0;
6811 nLvlAnm=0;
6812 unused15=0;
6813 fSideBySide=0;
6814 unused17=0;
6815 fNoAutoHyph=0;
6816 fWidowControl=1;
6817 dxaRight=0;
6818 dxaLeft=0;
6819 dxaLeft1=0;
6820 lspd.clear();
6821 dyaBefore=0;
6822 dyaAfter=0;
6823 phe.clear();
6824 fCrLf=0;
6825 fUsePgsuSettings=0;
6826 fAdjustRight=0;
6827 unused59=0;
6828 fKinsoku=0;
6829 fWordWrap=0;
6830 fOverflowPunct=0;
6831 fTopLinePunct=0;
6832 fAutoSpaceDE=0;
6833 fAutoSpaceDN=0;
6834 wAlignFont=0;
6835 fVertical=0;
6836 fBackward=0;
6837 fRotateFont=0;
6838 unused68_3=0;
6839 unused70=0;
6840 fInTable=0;
6841 fTtp=0;
6842 wr=0;
6843 fLocked=0;
6844 ptap=0;
6845 dxaAbs=0;
6846 dyaAbs=0;
6847 dxaWidth=0;
6848 brcTop.clear();
6849 brcLeft.clear();
6850 brcBottom.clear();
6851 brcRight.clear();
6852 brcBetween.clear();
6853 brcBar.clear();
6854 dxaFromText=0;
6855 dyaFromText=0;
6856 dyaHeight=0;
6857 fMinHeight=0;
6858 shd.clear();
6859 dcs.clear();
6860 lvl=9;
6861 fNumRMIns=0;
6862 anld.clear();
6863 fPropRMark=0;
6864 ibstPropRMark=0;
6865 dttmPropRMark.clear();
6866 numrm.clear();
6867 itbdMac=0;
6868 rgdxaTab.clear();
6869 }
6870
dump() const6871 void PAP::dump() const
6872 {
6873 wvlog << "Dumping PAP:" << std::endl;
6874 wvlog << toString().c_str() << std::endl;
6875 wvlog << "\nDumping PAP done." << std::endl;
6876 }
6877
toString() const6878 std::string PAP::toString() const
6879 {
6880 std::string s( "PAP:" );
6881 s += "\nistd=";
6882 s += uint2string( istd );
6883 s += "\njc=";
6884 s += uint2string( jc );
6885 s += "\nfKeep=";
6886 s += uint2string( fKeep );
6887 s += "\nfKeepFollow=";
6888 s += uint2string( fKeepFollow );
6889 s += "\nfPageBreakBefore=";
6890 s += uint2string( fPageBreakBefore );
6891 s += "\nfBrLnAbove=";
6892 s += uint2string( fBrLnAbove );
6893 s += "\nfBrLnBelow=";
6894 s += uint2string( fBrLnBelow );
6895 s += "\nfUnused=";
6896 s += uint2string( fUnused );
6897 s += "\npcVert=";
6898 s += uint2string( pcVert );
6899 s += "\npcHorz=";
6900 s += uint2string( pcHorz );
6901 s += "\nbrcp=";
6902 s += uint2string( brcp );
6903 s += "\nbrcl=";
6904 s += uint2string( brcl );
6905 s += "\nunused9=";
6906 s += uint2string( unused9 );
6907 s += "\nilvl=";
6908 s += uint2string( ilvl );
6909 s += "\nfNoLnn=";
6910 s += uint2string( fNoLnn );
6911 s += "\nilfo=";
6912 s += int2string( ilfo );
6913 s += "\nnLvlAnm=";
6914 s += uint2string( nLvlAnm );
6915 s += "\nunused15=";
6916 s += uint2string( unused15 );
6917 s += "\nfSideBySide=";
6918 s += uint2string( fSideBySide );
6919 s += "\nunused17=";
6920 s += uint2string( unused17 );
6921 s += "\nfNoAutoHyph=";
6922 s += uint2string( fNoAutoHyph );
6923 s += "\nfWidowControl=";
6924 s += uint2string( fWidowControl );
6925 s += "\ndxaRight=";
6926 s += int2string( dxaRight );
6927 s += "\ndxaLeft=";
6928 s += int2string( dxaLeft );
6929 s += "\ndxaLeft1=";
6930 s += int2string( dxaLeft1 );
6931 s += "\nlspd=";
6932 s += "\n{" + lspd.toString() + "}\n";
6933 s += "\ndyaBefore=";
6934 s += uint2string( dyaBefore );
6935 s += "\ndyaAfter=";
6936 s += uint2string( dyaAfter );
6937 s += "\nphe=";
6938 s += "\n{" + phe.toString() + "}\n";
6939 s += "\nfCrLf=";
6940 s += uint2string( fCrLf );
6941 s += "\nfUsePgsuSettings=";
6942 s += uint2string( fUsePgsuSettings );
6943 s += "\nfAdjustRight=";
6944 s += uint2string( fAdjustRight );
6945 s += "\nunused59=";
6946 s += uint2string( unused59 );
6947 s += "\nfKinsoku=";
6948 s += uint2string( fKinsoku );
6949 s += "\nfWordWrap=";
6950 s += uint2string( fWordWrap );
6951 s += "\nfOverflowPunct=";
6952 s += uint2string( fOverflowPunct );
6953 s += "\nfTopLinePunct=";
6954 s += uint2string( fTopLinePunct );
6955 s += "\nfAutoSpaceDE=";
6956 s += uint2string( fAutoSpaceDE );
6957 s += "\nfAutoSpaceDN=";
6958 s += uint2string( fAutoSpaceDN );
6959 s += "\nwAlignFont=";
6960 s += uint2string( wAlignFont );
6961 s += "\nfVertical=";
6962 s += uint2string( fVertical );
6963 s += "\nfBackward=";
6964 s += uint2string( fBackward );
6965 s += "\nfRotateFont=";
6966 s += uint2string( fRotateFont );
6967 s += "\nunused68_3=";
6968 s += uint2string( unused68_3 );
6969 s += "\nunused70=";
6970 s += uint2string( unused70 );
6971 s += "\nfInTable=";
6972 s += int2string( fInTable );
6973 s += "\nfTtp=";
6974 s += int2string( fTtp );
6975 s += "\nwr=";
6976 s += uint2string( wr );
6977 s += "\nfLocked=";
6978 s += uint2string( fLocked );
6979 s += "\nptap=";
6980 s += uint2string( ptap );
6981 s += "\ndxaAbs=";
6982 s += int2string( dxaAbs );
6983 s += "\ndyaAbs=";
6984 s += int2string( dyaAbs );
6985 s += "\ndxaWidth=";
6986 s += int2string( dxaWidth );
6987 s += "\nbrcTop=";
6988 s += "\n{" + brcTop.toString() + "}\n";
6989 s += "\nbrcLeft=";
6990 s += "\n{" + brcLeft.toString() + "}\n";
6991 s += "\nbrcBottom=";
6992 s += "\n{" + brcBottom.toString() + "}\n";
6993 s += "\nbrcRight=";
6994 s += "\n{" + brcRight.toString() + "}\n";
6995 s += "\nbrcBetween=";
6996 s += "\n{" + brcBetween.toString() + "}\n";
6997 s += "\nbrcBar=";
6998 s += "\n{" + brcBar.toString() + "}\n";
6999 s += "\ndxaFromText=";
7000 s += int2string( dxaFromText );
7001 s += "\ndyaFromText=";
7002 s += int2string( dyaFromText );
7003 s += "\ndyaHeight=";
7004 s += uint2string( dyaHeight );
7005 s += "\nfMinHeight=";
7006 s += uint2string( fMinHeight );
7007 s += "\nshd=";
7008 s += "\n{" + shd.toString() + "}\n";
7009 s += "\ndcs=";
7010 s += "\n{" + dcs.toString() + "}\n";
7011 s += "\nlvl=";
7012 s += int2string( lvl );
7013 s += "\nfBiDi=";
7014 s += int2string( fBiDi );
7015 s += "\nfNumRMIns=";
7016 s += int2string( fNumRMIns );
7017 s += "\nanld=";
7018 s += "\n{" + anld.toString() + "}\n";
7019 s += "\nfPropRMark=";
7020 s += int2string( fPropRMark );
7021 s += "\nibstPropRMark=";
7022 s += int2string( ibstPropRMark );
7023 s += "\ndttmPropRMark=";
7024 s += "\n{" + dttmPropRMark.toString() + "}\n";
7025 s += "\nnumrm=";
7026 s += "\n{" + numrm.toString() + "}\n";
7027 s += "\nitbdMac=";
7028 s += int2string( itbdMac );
7029 s += "\nrgdxaTab=";
7030 // skipping the std::vector rgdxaTab
7031 s += "\nPAP Done.";
7032 return s;
7033 }
7034
operator ==(const PAP & lhs,const PAP & rhs)7035 bool operator==(const PAP &lhs, const PAP &rhs) {
7036
7037 return lhs.istd==rhs.istd &&
7038 lhs.jc==rhs.jc &&
7039 lhs.fKeep==rhs.fKeep &&
7040 lhs.fKeepFollow==rhs.fKeepFollow &&
7041 lhs.fPageBreakBefore==rhs.fPageBreakBefore &&
7042 lhs.fBrLnAbove==rhs.fBrLnAbove &&
7043 lhs.fBrLnBelow==rhs.fBrLnBelow &&
7044 lhs.fUnused==rhs.fUnused &&
7045 lhs.pcVert==rhs.pcVert &&
7046 lhs.pcHorz==rhs.pcHorz &&
7047 lhs.brcp==rhs.brcp &&
7048 lhs.brcl==rhs.brcl &&
7049 lhs.unused9==rhs.unused9 &&
7050 lhs.ilvl==rhs.ilvl &&
7051 lhs.fNoLnn==rhs.fNoLnn &&
7052 lhs.ilfo==rhs.ilfo &&
7053 lhs.nLvlAnm==rhs.nLvlAnm &&
7054 lhs.unused15==rhs.unused15 &&
7055 lhs.fSideBySide==rhs.fSideBySide &&
7056 lhs.unused17==rhs.unused17 &&
7057 lhs.fNoAutoHyph==rhs.fNoAutoHyph &&
7058 lhs.fWidowControl==rhs.fWidowControl &&
7059 lhs.dxaRight==rhs.dxaRight &&
7060 lhs.dxaLeft==rhs.dxaLeft &&
7061 lhs.dxaLeft1==rhs.dxaLeft1 &&
7062 lhs.lspd==rhs.lspd &&
7063 lhs.dyaBefore==rhs.dyaBefore &&
7064 lhs.dyaAfter==rhs.dyaAfter &&
7065 lhs.phe==rhs.phe &&
7066 lhs.fCrLf==rhs.fCrLf &&
7067 lhs.fUsePgsuSettings==rhs.fUsePgsuSettings &&
7068 lhs.fAdjustRight==rhs.fAdjustRight &&
7069 lhs.unused59==rhs.unused59 &&
7070 lhs.fKinsoku==rhs.fKinsoku &&
7071 lhs.fWordWrap==rhs.fWordWrap &&
7072 lhs.fOverflowPunct==rhs.fOverflowPunct &&
7073 lhs.fTopLinePunct==rhs.fTopLinePunct &&
7074 lhs.fAutoSpaceDE==rhs.fAutoSpaceDE &&
7075 lhs.fAutoSpaceDN==rhs.fAutoSpaceDN &&
7076 lhs.wAlignFont==rhs.wAlignFont &&
7077 lhs.fVertical==rhs.fVertical &&
7078 lhs.fBackward==rhs.fBackward &&
7079 lhs.fRotateFont==rhs.fRotateFont &&
7080 lhs.unused68_3==rhs.unused68_3 &&
7081 lhs.unused70==rhs.unused70 &&
7082 lhs.fInTable==rhs.fInTable &&
7083 lhs.fTtp==rhs.fTtp &&
7084 lhs.wr==rhs.wr &&
7085 lhs.fLocked==rhs.fLocked &&
7086 lhs.ptap==rhs.ptap &&
7087 lhs.dxaAbs==rhs.dxaAbs &&
7088 lhs.dyaAbs==rhs.dyaAbs &&
7089 lhs.dxaWidth==rhs.dxaWidth &&
7090 lhs.brcTop==rhs.brcTop &&
7091 lhs.brcLeft==rhs.brcLeft &&
7092 lhs.brcBottom==rhs.brcBottom &&
7093 lhs.brcRight==rhs.brcRight &&
7094 lhs.brcBetween==rhs.brcBetween &&
7095 lhs.brcBar==rhs.brcBar &&
7096 lhs.dxaFromText==rhs.dxaFromText &&
7097 lhs.dyaFromText==rhs.dyaFromText &&
7098 lhs.dyaHeight==rhs.dyaHeight &&
7099 lhs.fMinHeight==rhs.fMinHeight &&
7100 lhs.shd==rhs.shd &&
7101 lhs.dcs==rhs.dcs &&
7102 lhs.lvl==rhs.lvl &&
7103 lhs.fBiDi==rhs.fBiDi &&
7104 lhs.fNumRMIns==rhs.fNumRMIns &&
7105 lhs.anld==rhs.anld &&
7106 lhs.fPropRMark==rhs.fPropRMark &&
7107 lhs.ibstPropRMark==rhs.ibstPropRMark &&
7108 lhs.dttmPropRMark==rhs.dttmPropRMark &&
7109 lhs.numrm==rhs.numrm &&
7110 lhs.itbdMac==rhs.itbdMac &&
7111 lhs.rgdxaTab==rhs.rgdxaTab;
7112 }
7113
operator !=(const PAP & lhs,const PAP & rhs)7114 bool operator!=(const PAP &lhs, const PAP &rhs) {
7115 return !(lhs==rhs);
7116 }
7117
7118
7119 // PCD implementation
7120
7121 const unsigned int PCD::sizeOf = 8;
7122
PCD()7123 PCD::PCD() {
7124 clear();
7125 }
7126
PCD(OLEStreamReader * stream,bool preservePos)7127 PCD::PCD(OLEStreamReader *stream, bool preservePos) {
7128 clear();
7129 read(stream, preservePos);
7130 }
7131
PCD(const U8 * ptr)7132 PCD::PCD(const U8 *ptr) {
7133 clear();
7134 readPtr(ptr);
7135 }
7136
read(OLEStreamReader * stream,bool preservePos)7137 bool PCD::read(OLEStreamReader *stream, bool preservePos) {
7138
7139 U16 shifterU16;
7140
7141 if(preservePos)
7142 stream->push();
7143
7144 shifterU16=stream->readU16();
7145 fNoParaLast=shifterU16;
7146 shifterU16>>=1;
7147 fPaphNil=shifterU16;
7148 shifterU16>>=1;
7149 fCopied=shifterU16;
7150 shifterU16>>=1;
7151 unused0_3=shifterU16;
7152 shifterU16>>=5;
7153 fn=shifterU16;
7154 fc=stream->readU32();
7155 prm.read(stream, false);
7156
7157 if(preservePos)
7158 stream->pop();
7159 return true;
7160 }
7161
readPtr(const U8 * ptr)7162 void PCD::readPtr(const U8 *ptr) {
7163
7164 U16 shifterU16;
7165
7166 shifterU16=readU16(ptr);
7167 ptr+=sizeof(U16);
7168 fNoParaLast=shifterU16;
7169 shifterU16>>=1;
7170 fPaphNil=shifterU16;
7171 shifterU16>>=1;
7172 fCopied=shifterU16;
7173 shifterU16>>=1;
7174 unused0_3=shifterU16;
7175 shifterU16>>=5;
7176 fn=shifterU16;
7177 fc=readU32(ptr);
7178 ptr+=sizeof(U32);
7179 prm.readPtr(ptr);
7180 ptr+=PRM::sizeOf;
7181 }
7182
write(OLEStreamWriter * stream,bool preservePos) const7183 bool PCD::write(OLEStreamWriter *stream, bool preservePos) const {
7184
7185 U16 shifterU16;
7186
7187 if(preservePos)
7188 stream->push();
7189
7190 shifterU16=fNoParaLast;
7191 shifterU16|=fPaphNil << 1;
7192 shifterU16|=fCopied << 2;
7193 shifterU16|=unused0_3 << 3;
7194 shifterU16|=fn << 8;
7195 stream->write(shifterU16);
7196 stream->write(fc);
7197 prm.write(stream, false);
7198
7199 if(preservePos)
7200 stream->pop();
7201 return true;
7202 }
7203
clear()7204 void PCD::clear() {
7205 fNoParaLast=0;
7206 fPaphNil=0;
7207 fCopied=0;
7208 unused0_3=0;
7209 fn=0;
7210 fc=0;
7211 prm.clear();
7212 }
7213
operator ==(const PCD & lhs,const PCD & rhs)7214 bool operator==(const PCD &lhs, const PCD &rhs) {
7215
7216 return lhs.fNoParaLast==rhs.fNoParaLast &&
7217 lhs.fPaphNil==rhs.fPaphNil &&
7218 lhs.fCopied==rhs.fCopied &&
7219 lhs.unused0_3==rhs.unused0_3 &&
7220 lhs.fn==rhs.fn &&
7221 lhs.fc==rhs.fc &&
7222 lhs.prm==rhs.prm;
7223 }
7224
operator !=(const PCD & lhs,const PCD & rhs)7225 bool operator!=(const PCD &lhs, const PCD &rhs) {
7226 return !(lhs==rhs);
7227 }
7228
7229
7230 // PGD implementation
7231
PGD()7232 PGD::PGD() {
7233 clear();
7234 }
7235
PGD(OLEStreamReader * stream,bool preservePos)7236 PGD::PGD(OLEStreamReader *stream, bool preservePos) {
7237 clear();
7238 read(stream, preservePos);
7239 }
7240
read(OLEStreamReader * stream,bool preservePos)7241 bool PGD::read(OLEStreamReader *stream, bool preservePos) {
7242
7243 U16 shifterU16;
7244
7245 if(preservePos)
7246 stream->push();
7247
7248 shifterU16=stream->readU16();
7249 fContinue=shifterU16;
7250 shifterU16>>=1;
7251 fUnk=shifterU16;
7252 shifterU16>>=1;
7253 fRight=shifterU16;
7254 shifterU16>>=1;
7255 fPgnRestart=shifterU16;
7256 shifterU16>>=1;
7257 fEmptyPage=shifterU16;
7258 shifterU16>>=1;
7259 fAllFtn=shifterU16;
7260 shifterU16>>=1;
7261 unused0_6=shifterU16;
7262 shifterU16>>=1;
7263 fTableBreaks=shifterU16;
7264 shifterU16>>=1;
7265 fMarked=shifterU16;
7266 shifterU16>>=1;
7267 fColumnBreaks=shifterU16;
7268 shifterU16>>=1;
7269 fTableHeader=shifterU16;
7270 shifterU16>>=1;
7271 fNewPage=shifterU16;
7272 shifterU16>>=1;
7273 bkc=shifterU16;
7274 lnn=stream->readU16();
7275 pgn=stream->readU16();
7276 dym=stream->readS32();
7277
7278 if(preservePos)
7279 stream->pop();
7280 return true;
7281 }
7282
write(OLEStreamWriter * stream,bool preservePos) const7283 bool PGD::write(OLEStreamWriter *stream, bool preservePos) const {
7284
7285 U16 shifterU16;
7286
7287 if(preservePos)
7288 stream->push();
7289
7290 shifterU16=fContinue;
7291 shifterU16|=fUnk << 1;
7292 shifterU16|=fRight << 2;
7293 shifterU16|=fPgnRestart << 3;
7294 shifterU16|=fEmptyPage << 4;
7295 shifterU16|=fAllFtn << 5;
7296 shifterU16|=unused0_6 << 6;
7297 shifterU16|=fTableBreaks << 7;
7298 shifterU16|=fMarked << 8;
7299 shifterU16|=fColumnBreaks << 9;
7300 shifterU16|=fTableHeader << 10;
7301 shifterU16|=fNewPage << 11;
7302 shifterU16|=bkc << 12;
7303 stream->write(shifterU16);
7304 stream->write(lnn);
7305 stream->write(pgn);
7306 stream->write(dym);
7307
7308 if(preservePos)
7309 stream->pop();
7310 return true;
7311 }
7312
clear()7313 void PGD::clear() {
7314 fContinue=0;
7315 fUnk=0;
7316 fRight=0;
7317 fPgnRestart=0;
7318 fEmptyPage=0;
7319 fAllFtn=0;
7320 unused0_6=0;
7321 fTableBreaks=0;
7322 fMarked=0;
7323 fColumnBreaks=0;
7324 fTableHeader=0;
7325 fNewPage=0;
7326 bkc=0;
7327 lnn=0;
7328 pgn=0;
7329 dym=0;
7330 }
7331
operator ==(const PGD & lhs,const PGD & rhs)7332 bool operator==(const PGD &lhs, const PGD &rhs) {
7333
7334 return lhs.fContinue==rhs.fContinue &&
7335 lhs.fUnk==rhs.fUnk &&
7336 lhs.fRight==rhs.fRight &&
7337 lhs.fPgnRestart==rhs.fPgnRestart &&
7338 lhs.fEmptyPage==rhs.fEmptyPage &&
7339 lhs.fAllFtn==rhs.fAllFtn &&
7340 lhs.unused0_6==rhs.unused0_6 &&
7341 lhs.fTableBreaks==rhs.fTableBreaks &&
7342 lhs.fMarked==rhs.fMarked &&
7343 lhs.fColumnBreaks==rhs.fColumnBreaks &&
7344 lhs.fTableHeader==rhs.fTableHeader &&
7345 lhs.fNewPage==rhs.fNewPage &&
7346 lhs.bkc==rhs.bkc &&
7347 lhs.lnn==rhs.lnn &&
7348 lhs.pgn==rhs.pgn &&
7349 lhs.dym==rhs.dym;
7350 }
7351
operator !=(const PGD & lhs,const PGD & rhs)7352 bool operator!=(const PGD &lhs, const PGD &rhs) {
7353 return !(lhs==rhs);
7354 }
7355
7356
7357 // PHE2 implementation
7358
PHE2()7359 PHE2::PHE2() {
7360 clear();
7361 }
7362
PHE2(OLEStreamReader * stream,bool preservePos)7363 PHE2::PHE2(OLEStreamReader *stream, bool preservePos) {
7364 clear();
7365 read(stream, preservePos);
7366 }
7367
read(OLEStreamReader * stream,bool preservePos)7368 bool PHE2::read(OLEStreamReader *stream, bool preservePos) {
7369
7370 U32 shifterU32;
7371
7372 if(preservePos)
7373 stream->push();
7374
7375 shifterU32=stream->readU32();
7376 fSpare=shifterU32;
7377 shifterU32>>=1;
7378 fUnk=shifterU32;
7379 shifterU32>>=1;
7380 dcpTtpNext=shifterU32;
7381 dxaCol=stream->readS32();
7382 dymTableHeight=stream->readS32();
7383
7384 if(preservePos)
7385 stream->pop();
7386 return true;
7387 }
7388
write(OLEStreamWriter * stream,bool preservePos) const7389 bool PHE2::write(OLEStreamWriter *stream, bool preservePos) const {
7390
7391 U32 shifterU32;
7392
7393 if(preservePos)
7394 stream->push();
7395
7396 shifterU32=fSpare;
7397 shifterU32|=fUnk << 1;
7398 shifterU32|=dcpTtpNext << 2;
7399 stream->write(shifterU32);
7400 stream->write(dxaCol);
7401 stream->write(dymTableHeight);
7402
7403 if(preservePos)
7404 stream->pop();
7405 return true;
7406 }
7407
clear()7408 void PHE2::clear() {
7409 fSpare=0;
7410 fUnk=0;
7411 dcpTtpNext=0;
7412 dxaCol=0;
7413 dymTableHeight=0;
7414 }
7415
operator ==(const PHE2 & lhs,const PHE2 & rhs)7416 bool operator==(const PHE2 &lhs, const PHE2 &rhs) {
7417
7418 return lhs.fSpare==rhs.fSpare &&
7419 lhs.fUnk==rhs.fUnk &&
7420 lhs.dcpTtpNext==rhs.dcpTtpNext &&
7421 lhs.dxaCol==rhs.dxaCol &&
7422 lhs.dymTableHeight==rhs.dymTableHeight;
7423 }
7424
operator !=(const PHE2 & lhs,const PHE2 & rhs)7425 bool operator!=(const PHE2 &lhs, const PHE2 &rhs) {
7426 return !(lhs==rhs);
7427 }
7428
7429
7430 // PICF implementation
7431
PICF()7432 PICF::PICF() : Shared() {
7433 clear();
7434 }
7435
PICF(OLEStreamReader * stream,bool preservePos)7436 PICF::PICF(OLEStreamReader *stream, bool preservePos) : Shared() {
7437 clear();
7438 read(stream, preservePos);
7439 }
7440
read(OLEStreamReader * stream,bool preservePos)7441 bool PICF::read(OLEStreamReader *stream, bool preservePos) {
7442
7443 U16 shifterU16;
7444
7445 if(preservePos)
7446 stream->push();
7447
7448 lcb=stream->readU32();
7449 cbHeader=stream->readU16();
7450 mfp.read(stream, false);
7451 for(int _i=0; _i<(14); ++_i)
7452 bm_rcWinMF[_i]=stream->readU8();
7453 dxaGoal=stream->readS16();
7454 dyaGoal=stream->readS16();
7455 mx=stream->readU16();
7456 my=stream->readU16();
7457 dxaCropLeft=stream->readS16();
7458 dyaCropTop=stream->readS16();
7459 dxaCropRight=stream->readS16();
7460 dyaCropBottom=stream->readS16();
7461 shifterU16=stream->readU16();
7462 brcl=shifterU16;
7463 shifterU16>>=4;
7464 fFrameEmpty=shifterU16;
7465 shifterU16>>=1;
7466 fBitmap=shifterU16;
7467 shifterU16>>=1;
7468 fDrawHatch=shifterU16;
7469 shifterU16>>=1;
7470 fError=shifterU16;
7471 shifterU16>>=1;
7472 bpp=shifterU16;
7473 brcTop.read(stream, false);
7474 brcLeft.read(stream, false);
7475 brcBottom.read(stream, false);
7476 brcRight.read(stream, false);
7477 dxaOrigin=stream->readS16();
7478 dyaOrigin=stream->readS16();
7479 cProps=stream->readS16();
7480
7481 if(preservePos)
7482 stream->pop();
7483 return true;
7484 }
7485
write(OLEStreamWriter * stream,bool preservePos) const7486 bool PICF::write(OLEStreamWriter *stream, bool preservePos) const {
7487
7488 U16 shifterU16;
7489
7490 if(preservePos)
7491 stream->push();
7492
7493 stream->write(lcb);
7494 stream->write(cbHeader);
7495 mfp.write(stream, false);
7496 for(int _i=0; _i<(14); ++_i)
7497 stream->write(bm_rcWinMF[_i]);
7498 stream->write(dxaGoal);
7499 stream->write(dyaGoal);
7500 stream->write(mx);
7501 stream->write(my);
7502 stream->write(dxaCropLeft);
7503 stream->write(dyaCropTop);
7504 stream->write(dxaCropRight);
7505 stream->write(dyaCropBottom);
7506 shifterU16=brcl;
7507 shifterU16|=fFrameEmpty << 4;
7508 shifterU16|=fBitmap << 5;
7509 shifterU16|=fDrawHatch << 6;
7510 shifterU16|=fError << 7;
7511 shifterU16|=bpp << 8;
7512 stream->write(shifterU16);
7513 brcTop.write(stream, false);
7514 brcLeft.write(stream, false);
7515 brcBottom.write(stream, false);
7516 brcRight.write(stream, false);
7517 stream->write(dxaOrigin);
7518 stream->write(dyaOrigin);
7519 stream->write(cProps);
7520
7521 if(preservePos)
7522 stream->pop();
7523 return true;
7524 }
7525
clear()7526 void PICF::clear() {
7527 lcb=0;
7528 cbHeader=0;
7529 mfp.clear();
7530 for(int _i=0; _i<(14); ++_i)
7531 bm_rcWinMF[_i]=0;
7532 dxaGoal=0;
7533 dyaGoal=0;
7534 mx=0;
7535 my=0;
7536 dxaCropLeft=0;
7537 dyaCropTop=0;
7538 dxaCropRight=0;
7539 dyaCropBottom=0;
7540 brcl=0;
7541 fFrameEmpty=0;
7542 fBitmap=0;
7543 fDrawHatch=0;
7544 fError=0;
7545 bpp=0;
7546 brcTop.clear();
7547 brcLeft.clear();
7548 brcBottom.clear();
7549 brcRight.clear();
7550 dxaOrigin=0;
7551 dyaOrigin=0;
7552 cProps=0;
7553 }
7554
dump() const7555 void PICF::dump() const
7556 {
7557 wvlog << "Dumping PICF:" << std::endl;
7558 wvlog << toString().c_str() << std::endl;
7559 wvlog << "\nDumping PICF done." << std::endl;
7560 }
7561
toString() const7562 std::string PICF::toString() const
7563 {
7564 std::string s( "PICF:" );
7565 s += "\nlcb=";
7566 s += uint2string( lcb );
7567 s += "\ncbHeader=";
7568 s += uint2string( cbHeader );
7569 s += "\nmfp=";
7570 s += "\n{" + mfp.toString() + "}\n";
7571 for(int _i=0; _i<(14); ++_i) {
7572 s += "\nbm_rcWinMF[" + int2string( _i ) + "]=";
7573 s += uint2string( bm_rcWinMF[_i] );
7574 }
7575 s += "\ndxaGoal=";
7576 s += int2string( dxaGoal );
7577 s += "\ndyaGoal=";
7578 s += int2string( dyaGoal );
7579 s += "\nmx=";
7580 s += uint2string( mx );
7581 s += "\nmy=";
7582 s += uint2string( my );
7583 s += "\ndxaCropLeft=";
7584 s += int2string( dxaCropLeft );
7585 s += "\ndyaCropTop=";
7586 s += int2string( dyaCropTop );
7587 s += "\ndxaCropRight=";
7588 s += int2string( dxaCropRight );
7589 s += "\ndyaCropBottom=";
7590 s += int2string( dyaCropBottom );
7591 s += "\nbrcl=";
7592 s += uint2string( brcl );
7593 s += "\nfFrameEmpty=";
7594 s += uint2string( fFrameEmpty );
7595 s += "\nfBitmap=";
7596 s += uint2string( fBitmap );
7597 s += "\nfDrawHatch=";
7598 s += uint2string( fDrawHatch );
7599 s += "\nfError=";
7600 s += uint2string( fError );
7601 s += "\nbpp=";
7602 s += uint2string( bpp );
7603 s += "\nbrcTop=";
7604 s += "\n{" + brcTop.toString() + "}\n";
7605 s += "\nbrcLeft=";
7606 s += "\n{" + brcLeft.toString() + "}\n";
7607 s += "\nbrcBottom=";
7608 s += "\n{" + brcBottom.toString() + "}\n";
7609 s += "\nbrcRight=";
7610 s += "\n{" + brcRight.toString() + "}\n";
7611 s += "\ndxaOrigin=";
7612 s += int2string( dxaOrigin );
7613 s += "\ndyaOrigin=";
7614 s += int2string( dyaOrigin );
7615 s += "\ncProps=";
7616 s += int2string( cProps );
7617 s += "\nPICF Done.";
7618 return s;
7619 }
7620
operator ==(const PICF & lhs,const PICF & rhs)7621 bool operator==(const PICF &lhs, const PICF &rhs) {
7622
7623 for(int _i=0; _i<(14); ++_i) {
7624 if(lhs.bm_rcWinMF[_i]!=rhs.bm_rcWinMF[_i])
7625 return false;
7626 }
7627
7628 return lhs.lcb==rhs.lcb &&
7629 lhs.cbHeader==rhs.cbHeader &&
7630 lhs.mfp==rhs.mfp &&
7631 lhs.dxaGoal==rhs.dxaGoal &&
7632 lhs.dyaGoal==rhs.dyaGoal &&
7633 lhs.mx==rhs.mx &&
7634 lhs.my==rhs.my &&
7635 lhs.dxaCropLeft==rhs.dxaCropLeft &&
7636 lhs.dyaCropTop==rhs.dyaCropTop &&
7637 lhs.dxaCropRight==rhs.dxaCropRight &&
7638 lhs.dyaCropBottom==rhs.dyaCropBottom &&
7639 lhs.brcl==rhs.brcl &&
7640 lhs.fFrameEmpty==rhs.fFrameEmpty &&
7641 lhs.fBitmap==rhs.fBitmap &&
7642 lhs.fDrawHatch==rhs.fDrawHatch &&
7643 lhs.fError==rhs.fError &&
7644 lhs.bpp==rhs.bpp &&
7645 lhs.brcTop==rhs.brcTop &&
7646 lhs.brcLeft==rhs.brcLeft &&
7647 lhs.brcBottom==rhs.brcBottom &&
7648 lhs.brcRight==rhs.brcRight &&
7649 lhs.dxaOrigin==rhs.dxaOrigin &&
7650 lhs.dyaOrigin==rhs.dyaOrigin &&
7651 lhs.cProps==rhs.cProps;
7652 }
7653
operator !=(const PICF & lhs,const PICF & rhs)7654 bool operator!=(const PICF &lhs, const PICF &rhs) {
7655 return !(lhs==rhs);
7656 }
7657
7658
7659 // RR implementation
7660
RR()7661 RR::RR() {
7662 clear();
7663 }
7664
RR(OLEStreamReader * stream,bool preservePos)7665 RR::RR(OLEStreamReader *stream, bool preservePos) {
7666 clear();
7667 read(stream, preservePos);
7668 }
7669
read(OLEStreamReader * stream,bool preservePos)7670 bool RR::read(OLEStreamReader *stream, bool preservePos) {
7671
7672 if(preservePos)
7673 stream->push();
7674
7675 cb=stream->readU16();
7676 cbSzRecip=stream->readU16();
7677
7678 if(preservePos)
7679 stream->pop();
7680 return true;
7681 }
7682
write(OLEStreamWriter * stream,bool preservePos) const7683 bool RR::write(OLEStreamWriter *stream, bool preservePos) const {
7684
7685 if(preservePos)
7686 stream->push();
7687
7688 stream->write(cb);
7689 stream->write(cbSzRecip);
7690
7691 if(preservePos)
7692 stream->pop();
7693 return true;
7694 }
7695
clear()7696 void RR::clear() {
7697 cb=0;
7698 cbSzRecip=0;
7699 }
7700
operator ==(const RR & lhs,const RR & rhs)7701 bool operator==(const RR &lhs, const RR &rhs) {
7702
7703 return lhs.cb==rhs.cb &&
7704 lhs.cbSzRecip==rhs.cbSzRecip;
7705 }
7706
operator !=(const RR & lhs,const RR & rhs)7707 bool operator!=(const RR &lhs, const RR &rhs) {
7708 return !(lhs==rhs);
7709 }
7710
7711
7712 // RS implementation
7713
RS()7714 RS::RS() {
7715 clear();
7716 }
7717
RS(OLEStreamReader * stream,bool preservePos)7718 RS::RS(OLEStreamReader *stream, bool preservePos) {
7719 clear();
7720 read(stream, preservePos);
7721 }
7722
read(OLEStreamReader * stream,bool preservePos)7723 bool RS::read(OLEStreamReader *stream, bool preservePos) {
7724
7725 if(preservePos)
7726 stream->push();
7727
7728 fRouted=stream->readS16();
7729 fReturnOrig=stream->readS16();
7730 fTrackStatus=stream->readS16();
7731 fDirty=stream->readS16();
7732 nProtect=stream->readS16();
7733 iStage=stream->readS16();
7734 delOption=stream->readS16();
7735 cRecip=stream->readS16();
7736
7737 if(preservePos)
7738 stream->pop();
7739 return true;
7740 }
7741
write(OLEStreamWriter * stream,bool preservePos) const7742 bool RS::write(OLEStreamWriter *stream, bool preservePos) const {
7743
7744 if(preservePos)
7745 stream->push();
7746
7747 stream->write(fRouted);
7748 stream->write(fReturnOrig);
7749 stream->write(fTrackStatus);
7750 stream->write(fDirty);
7751 stream->write(nProtect);
7752 stream->write(iStage);
7753 stream->write(delOption);
7754 stream->write(cRecip);
7755
7756 if(preservePos)
7757 stream->pop();
7758 return true;
7759 }
7760
clear()7761 void RS::clear() {
7762 fRouted=0;
7763 fReturnOrig=0;
7764 fTrackStatus=0;
7765 fDirty=0;
7766 nProtect=0;
7767 iStage=0;
7768 delOption=0;
7769 cRecip=0;
7770 }
7771
operator ==(const RS & lhs,const RS & rhs)7772 bool operator==(const RS &lhs, const RS &rhs) {
7773
7774 return lhs.fRouted==rhs.fRouted &&
7775 lhs.fReturnOrig==rhs.fReturnOrig &&
7776 lhs.fTrackStatus==rhs.fTrackStatus &&
7777 lhs.fDirty==rhs.fDirty &&
7778 lhs.nProtect==rhs.nProtect &&
7779 lhs.iStage==rhs.iStage &&
7780 lhs.delOption==rhs.delOption &&
7781 lhs.cRecip==rhs.cRecip;
7782 }
7783
operator !=(const RS & lhs,const RS & rhs)7784 bool operator!=(const RS &lhs, const RS &rhs) {
7785 return !(lhs==rhs);
7786 }
7787
7788
7789 // SED implementation
7790
7791 const unsigned int SED::sizeOf = 12;
7792
SED()7793 SED::SED() {
7794 clear();
7795 }
7796
SED(OLEStreamReader * stream,bool preservePos)7797 SED::SED(OLEStreamReader *stream, bool preservePos) {
7798 clear();
7799 read(stream, preservePos);
7800 }
7801
read(OLEStreamReader * stream,bool preservePos)7802 bool SED::read(OLEStreamReader *stream, bool preservePos) {
7803
7804 if(preservePos)
7805 stream->push();
7806
7807 fn=stream->readS16();
7808 fcSepx=stream->readU32();
7809 fnMpr=stream->readS16();
7810 fcMpr=stream->readU32();
7811
7812 if(preservePos)
7813 stream->pop();
7814 return true;
7815 }
7816
write(OLEStreamWriter * stream,bool preservePos) const7817 bool SED::write(OLEStreamWriter *stream, bool preservePos) const {
7818
7819 if(preservePos)
7820 stream->push();
7821
7822 stream->write(fn);
7823 stream->write(fcSepx);
7824 stream->write(fnMpr);
7825 stream->write(fcMpr);
7826
7827 if(preservePos)
7828 stream->pop();
7829 return true;
7830 }
7831
clear()7832 void SED::clear() {
7833 fn=0;
7834 fcSepx=0;
7835 fnMpr=0;
7836 fcMpr=0;
7837 }
7838
operator ==(const SED & lhs,const SED & rhs)7839 bool operator==(const SED &lhs, const SED &rhs) {
7840
7841 return lhs.fn==rhs.fn &&
7842 lhs.fcSepx==rhs.fcSepx &&
7843 lhs.fnMpr==rhs.fnMpr &&
7844 lhs.fcMpr==rhs.fcMpr;
7845 }
7846
operator !=(const SED & lhs,const SED & rhs)7847 bool operator!=(const SED &lhs, const SED &rhs) {
7848 return !(lhs==rhs);
7849 }
7850
7851
7852 // SEP implementation
7853
SEP()7854 SEP::SEP() : Shared() {
7855 clear();
7856 }
7857
SEP(OLEStreamReader * stream,bool preservePos)7858 SEP::SEP(OLEStreamReader *stream, bool preservePos) : Shared() {
7859 clear();
7860 read(stream, preservePos);
7861 }
7862
read(OLEStreamReader * stream,bool preservePos)7863 bool SEP::read(OLEStreamReader *stream, bool preservePos) {
7864
7865 U16 shifterU16;
7866
7867 if(preservePos)
7868 stream->push();
7869
7870 bkc=stream->readU8();
7871 fTitlePage=stream->readU8();
7872 fAutoPgn=stream->readS8();
7873 nfcPgn=stream->readU8();
7874 fUnlocked=stream->readU8();
7875 cnsPgn=stream->readU8();
7876 fPgnRestart=stream->readU8();
7877 fEndNote=stream->readU8();
7878 lnc=stream->readS8();
7879 grpfIhdt=stream->readS8();
7880 nLnnMod=stream->readU16();
7881 dxaLnn=stream->readS32();
7882 dxaPgn=stream->readS16();
7883 dyaPgn=stream->readS16();
7884 fLBetween=stream->readS8();
7885 vjc=stream->readS8();
7886 dmBinFirst=stream->readU16();
7887 dmBinOther=stream->readU16();
7888 dmPaperReq=stream->readU16();
7889 brcTop.read(stream, false);
7890 brcLeft.read(stream, false);
7891 brcBottom.read(stream, false);
7892 brcRight.read(stream, false);
7893 fPropRMark=stream->readS16();
7894 ibstPropRMark=stream->readS16();
7895 dttmPropRMark.read(stream, false);
7896 dxtCharSpace=stream->readS32();
7897 dyaLinePitch=stream->readS32();
7898 clm=stream->readU16();
7899 unused62=stream->readU16();
7900 dmOrientPage=stream->readU8();
7901 iHeadingPgn=stream->readU8();
7902 pgnStart=stream->readU16();
7903 lnnMin=stream->readS16();
7904 wTextFlow=stream->readU16();
7905 unused72=stream->readU16();
7906 shifterU16=stream->readU16();
7907 pgbApplyTo=shifterU16;
7908 shifterU16>>=3;
7909 pgbPageDepth=shifterU16;
7910 shifterU16>>=2;
7911 pgbOffsetFrom=shifterU16;
7912 shifterU16>>=3;
7913 unused74_8=shifterU16;
7914 xaPage=stream->readU32();
7915 yaPage=stream->readU32();
7916 xaPageNUp=stream->readU32();
7917 yaPageNUp=stream->readU32();
7918 dxaLeft=stream->readU32();
7919 dxaRight=stream->readU32();
7920 dyaTop=stream->readS32();
7921 dyaBottom=stream->readS32();
7922 dzaGutter=stream->readU32();
7923 dyaHdrTop=stream->readU32();
7924 dyaHdrBottom=stream->readU32();
7925 ccolM1=stream->readS16();
7926 fEvenlySpaced=stream->readS8();
7927 unused123=stream->readU8();
7928 dxaColumns=stream->readS32();
7929 // skipping the std::vector rgdxaColumnWidthSpacing
7930 dxaColumnWidth=stream->readS32();
7931 dmOrientFirst=stream->readU8();
7932 fLayout=stream->readU8();
7933 unused490=stream->readU16();
7934 olstAnm.read(stream, false);
7935
7936 if(preservePos)
7937 stream->pop();
7938 return true;
7939 }
7940
write(OLEStreamWriter * stream,bool preservePos) const7941 bool SEP::write(OLEStreamWriter *stream, bool preservePos) const {
7942
7943 U16 shifterU16;
7944
7945 if(preservePos)
7946 stream->push();
7947
7948 stream->write(bkc);
7949 stream->write(fTitlePage);
7950 stream->write(fAutoPgn);
7951 stream->write(nfcPgn);
7952 stream->write(fUnlocked);
7953 stream->write(cnsPgn);
7954 stream->write(fPgnRestart);
7955 stream->write(fEndNote);
7956 stream->write(lnc);
7957 stream->write(grpfIhdt);
7958 stream->write(nLnnMod);
7959 stream->write(dxaLnn);
7960 stream->write(dxaPgn);
7961 stream->write(dyaPgn);
7962 stream->write(fLBetween);
7963 stream->write(vjc);
7964 stream->write(dmBinFirst);
7965 stream->write(dmBinOther);
7966 stream->write(dmPaperReq);
7967 brcTop.write(stream, false);
7968 brcLeft.write(stream, false);
7969 brcBottom.write(stream, false);
7970 brcRight.write(stream, false);
7971 stream->write(fPropRMark);
7972 stream->write(ibstPropRMark);
7973 dttmPropRMark.write(stream, false);
7974 stream->write(dxtCharSpace);
7975 stream->write(dyaLinePitch);
7976 stream->write(clm);
7977 stream->write(unused62);
7978 stream->write(dmOrientPage);
7979 stream->write(iHeadingPgn);
7980 stream->write(pgnStart);
7981 stream->write(lnnMin);
7982 stream->write(wTextFlow);
7983 stream->write(unused72);
7984 shifterU16=pgbApplyTo;
7985 shifterU16|=pgbPageDepth << 3;
7986 shifterU16|=pgbOffsetFrom << 5;
7987 shifterU16|=unused74_8 << 8;
7988 stream->write(shifterU16);
7989 stream->write(xaPage);
7990 stream->write(yaPage);
7991 stream->write(xaPageNUp);
7992 stream->write(yaPageNUp);
7993 stream->write(dxaLeft);
7994 stream->write(dxaRight);
7995 stream->write(dyaTop);
7996 stream->write(dyaBottom);
7997 stream->write(dzaGutter);
7998 stream->write(dyaHdrTop);
7999 stream->write(dyaHdrBottom);
8000 stream->write(ccolM1);
8001 stream->write(fEvenlySpaced);
8002 stream->write(unused123);
8003 stream->write(dxaColumns);
8004 // skipping the std::vector rgdxaColumnWidthSpacing
8005 stream->write(dxaColumnWidth);
8006 stream->write(dmOrientFirst);
8007 stream->write(fLayout);
8008 stream->write(unused490);
8009 olstAnm.write(stream, false);
8010
8011 if(preservePos)
8012 stream->pop();
8013 return true;
8014 }
8015
clear()8016 void SEP::clear() {
8017 bkc=2;
8018 fTitlePage=0;
8019 fAutoPgn=0;
8020 nfcPgn=0;
8021 fUnlocked=0;
8022 cnsPgn=0;
8023 fPgnRestart=0;
8024 fEndNote=1;
8025 lnc=0;
8026 grpfIhdt=0;
8027 nLnnMod=0;
8028 dxaLnn=0;
8029 dxaPgn=720;
8030 dyaPgn=720;
8031 fLBetween=0;
8032 vjc=0;
8033 dmBinFirst=0;
8034 dmBinOther=0;
8035 dmPaperReq=0;
8036 brcTop.clear();
8037 brcLeft.clear();
8038 brcBottom.clear();
8039 brcRight.clear();
8040 fPropRMark=0;
8041 ibstPropRMark=0;
8042 dttmPropRMark.clear();
8043 dxtCharSpace=0;
8044 dyaLinePitch=0;
8045 clm=0;
8046 unused62=0;
8047 dmOrientPage=1;
8048 iHeadingPgn=0;
8049 pgnStart=1;
8050 lnnMin=0;
8051 wTextFlow=0;
8052 unused72=0;
8053 pgbApplyTo=0;
8054 pgbPageDepth=0;
8055 pgbOffsetFrom=0;
8056 unused74_8=0;
8057 xaPage=12240;
8058 yaPage=15840;
8059 xaPageNUp=12240;
8060 yaPageNUp=15840;
8061 dxaLeft=1800;
8062 dxaRight=1800;
8063 dyaTop=1440;
8064 dyaBottom=1440;
8065 dzaGutter=0;
8066 dyaHdrTop=720;
8067 dyaHdrBottom=720;
8068 ccolM1=0;
8069 fEvenlySpaced=1;
8070 unused123=0;
8071 dxaColumns=720;
8072 rgdxaColumnWidthSpacing.clear();
8073 dxaColumnWidth=0;
8074 dmOrientFirst=0;
8075 fLayout=0;
8076 unused490=0;
8077 olstAnm.clear();
8078 }
8079
dump() const8080 void SEP::dump() const
8081 {
8082 wvlog << "Dumping SEP:" << std::endl;
8083 wvlog << toString().c_str() << std::endl;
8084 wvlog << "\nDumping SEP done." << std::endl;
8085 }
8086
toString() const8087 std::string SEP::toString() const
8088 {
8089 std::string s( "SEP:" );
8090 s += "\nbkc=";
8091 s += uint2string( bkc );
8092 s += "\nfTitlePage=";
8093 s += uint2string( fTitlePage );
8094 s += "\nfAutoPgn=";
8095 s += int2string( fAutoPgn );
8096 s += "\nnfcPgn=";
8097 s += uint2string( nfcPgn );
8098 s += "\nfUnlocked=";
8099 s += uint2string( fUnlocked );
8100 s += "\ncnsPgn=";
8101 s += uint2string( cnsPgn );
8102 s += "\nfPgnRestart=";
8103 s += uint2string( fPgnRestart );
8104 s += "\nfEndNote=";
8105 s += uint2string( fEndNote );
8106 s += "\nlnc=";
8107 s += int2string( lnc );
8108 s += "\ngrpfIhdt=";
8109 s += int2string( grpfIhdt );
8110 s += "\nnLnnMod=";
8111 s += uint2string( nLnnMod );
8112 s += "\ndxaLnn=";
8113 s += int2string( dxaLnn );
8114 s += "\ndxaPgn=";
8115 s += int2string( dxaPgn );
8116 s += "\ndyaPgn=";
8117 s += int2string( dyaPgn );
8118 s += "\nfLBetween=";
8119 s += int2string( fLBetween );
8120 s += "\nvjc=";
8121 s += int2string( vjc );
8122 s += "\ndmBinFirst=";
8123 s += uint2string( dmBinFirst );
8124 s += "\ndmBinOther=";
8125 s += uint2string( dmBinOther );
8126 s += "\ndmPaperReq=";
8127 s += uint2string( dmPaperReq );
8128 s += "\nbrcTop=";
8129 s += "\n{" + brcTop.toString() + "}\n";
8130 s += "\nbrcLeft=";
8131 s += "\n{" + brcLeft.toString() + "}\n";
8132 s += "\nbrcBottom=";
8133 s += "\n{" + brcBottom.toString() + "}\n";
8134 s += "\nbrcRight=";
8135 s += "\n{" + brcRight.toString() + "}\n";
8136 s += "\nfPropRMark=";
8137 s += int2string( fPropRMark );
8138 s += "\nibstPropRMark=";
8139 s += int2string( ibstPropRMark );
8140 s += "\ndttmPropRMark=";
8141 s += "\n{" + dttmPropRMark.toString() + "}\n";
8142 s += "\ndxtCharSpace=";
8143 s += int2string( dxtCharSpace );
8144 s += "\ndyaLinePitch=";
8145 s += int2string( dyaLinePitch );
8146 s += "\nclm=";
8147 s += uint2string( clm );
8148 s += "\nunused62=";
8149 s += uint2string( unused62 );
8150 s += "\ndmOrientPage=";
8151 s += uint2string( dmOrientPage );
8152 s += "\niHeadingPgn=";
8153 s += uint2string( iHeadingPgn );
8154 s += "\npgnStart=";
8155 s += uint2string( pgnStart );
8156 s += "\nlnnMin=";
8157 s += int2string( lnnMin );
8158 s += "\nwTextFlow=";
8159 s += uint2string( wTextFlow );
8160 s += "\nunused72=";
8161 s += uint2string( unused72 );
8162 s += "\npgbApplyTo=";
8163 s += uint2string( pgbApplyTo );
8164 s += "\npgbPageDepth=";
8165 s += uint2string( pgbPageDepth );
8166 s += "\npgbOffsetFrom=";
8167 s += uint2string( pgbOffsetFrom );
8168 s += "\nunused74_8=";
8169 s += uint2string( unused74_8 );
8170 s += "\nxaPage=";
8171 s += uint2string( xaPage );
8172 s += "\nyaPage=";
8173 s += uint2string( yaPage );
8174 s += "\nxaPageNUp=";
8175 s += uint2string( xaPageNUp );
8176 s += "\nyaPageNUp=";
8177 s += uint2string( yaPageNUp );
8178 s += "\ndxaLeft=";
8179 s += uint2string( dxaLeft );
8180 s += "\ndxaRight=";
8181 s += uint2string( dxaRight );
8182 s += "\ndyaTop=";
8183 s += int2string( dyaTop );
8184 s += "\ndyaBottom=";
8185 s += int2string( dyaBottom );
8186 s += "\ndzaGutter=";
8187 s += uint2string( dzaGutter );
8188 s += "\ndyaHdrTop=";
8189 s += uint2string( dyaHdrTop );
8190 s += "\ndyaHdrBottom=";
8191 s += uint2string( dyaHdrBottom );
8192 s += "\nccolM1=";
8193 s += int2string( ccolM1 );
8194 s += "\nfEvenlySpaced=";
8195 s += int2string( fEvenlySpaced );
8196 s += "\nunused123=";
8197 s += uint2string( unused123 );
8198 s += "\ndxaColumns=";
8199 s += int2string( dxaColumns );
8200 s += "\nrgdxaColumnWidthSpacing=";
8201 // skipping the std::vector rgdxaColumnWidthSpacing
8202 s += "\ndxaColumnWidth=";
8203 s += int2string( dxaColumnWidth );
8204 s += "\ndmOrientFirst=";
8205 s += uint2string( dmOrientFirst );
8206 s += "\nfLayout=";
8207 s += uint2string( fLayout );
8208 s += "\nunused490=";
8209 s += uint2string( unused490 );
8210 s += "\nolstAnm=";
8211 s += "\n{" + olstAnm.toString() + "}\n";
8212 s += "\nSEP Done.";
8213 return s;
8214 }
8215
operator ==(const SEP & lhs,const SEP & rhs)8216 bool operator==(const SEP &lhs, const SEP &rhs) {
8217
8218 return lhs.bkc==rhs.bkc &&
8219 lhs.fTitlePage==rhs.fTitlePage &&
8220 lhs.fAutoPgn==rhs.fAutoPgn &&
8221 lhs.nfcPgn==rhs.nfcPgn &&
8222 lhs.fUnlocked==rhs.fUnlocked &&
8223 lhs.cnsPgn==rhs.cnsPgn &&
8224 lhs.fPgnRestart==rhs.fPgnRestart &&
8225 lhs.fEndNote==rhs.fEndNote &&
8226 lhs.lnc==rhs.lnc &&
8227 lhs.grpfIhdt==rhs.grpfIhdt &&
8228 lhs.nLnnMod==rhs.nLnnMod &&
8229 lhs.dxaLnn==rhs.dxaLnn &&
8230 lhs.dxaPgn==rhs.dxaPgn &&
8231 lhs.dyaPgn==rhs.dyaPgn &&
8232 lhs.fLBetween==rhs.fLBetween &&
8233 lhs.vjc==rhs.vjc &&
8234 lhs.dmBinFirst==rhs.dmBinFirst &&
8235 lhs.dmBinOther==rhs.dmBinOther &&
8236 lhs.dmPaperReq==rhs.dmPaperReq &&
8237 lhs.brcTop==rhs.brcTop &&
8238 lhs.brcLeft==rhs.brcLeft &&
8239 lhs.brcBottom==rhs.brcBottom &&
8240 lhs.brcRight==rhs.brcRight &&
8241 lhs.fPropRMark==rhs.fPropRMark &&
8242 lhs.ibstPropRMark==rhs.ibstPropRMark &&
8243 lhs.dttmPropRMark==rhs.dttmPropRMark &&
8244 lhs.dxtCharSpace==rhs.dxtCharSpace &&
8245 lhs.dyaLinePitch==rhs.dyaLinePitch &&
8246 lhs.clm==rhs.clm &&
8247 lhs.unused62==rhs.unused62 &&
8248 lhs.dmOrientPage==rhs.dmOrientPage &&
8249 lhs.iHeadingPgn==rhs.iHeadingPgn &&
8250 lhs.pgnStart==rhs.pgnStart &&
8251 lhs.lnnMin==rhs.lnnMin &&
8252 lhs.wTextFlow==rhs.wTextFlow &&
8253 lhs.unused72==rhs.unused72 &&
8254 lhs.pgbApplyTo==rhs.pgbApplyTo &&
8255 lhs.pgbPageDepth==rhs.pgbPageDepth &&
8256 lhs.pgbOffsetFrom==rhs.pgbOffsetFrom &&
8257 lhs.unused74_8==rhs.unused74_8 &&
8258 lhs.xaPage==rhs.xaPage &&
8259 lhs.yaPage==rhs.yaPage &&
8260 lhs.xaPageNUp==rhs.xaPageNUp &&
8261 lhs.yaPageNUp==rhs.yaPageNUp &&
8262 lhs.dxaLeft==rhs.dxaLeft &&
8263 lhs.dxaRight==rhs.dxaRight &&
8264 lhs.dyaTop==rhs.dyaTop &&
8265 lhs.dyaBottom==rhs.dyaBottom &&
8266 lhs.dzaGutter==rhs.dzaGutter &&
8267 lhs.dyaHdrTop==rhs.dyaHdrTop &&
8268 lhs.dyaHdrBottom==rhs.dyaHdrBottom &&
8269 lhs.ccolM1==rhs.ccolM1 &&
8270 lhs.fEvenlySpaced==rhs.fEvenlySpaced &&
8271 lhs.unused123==rhs.unused123 &&
8272 lhs.dxaColumns==rhs.dxaColumns &&
8273 lhs.rgdxaColumnWidthSpacing==rhs.rgdxaColumnWidthSpacing &&
8274 lhs.dxaColumnWidth==rhs.dxaColumnWidth &&
8275 lhs.dmOrientFirst==rhs.dmOrientFirst &&
8276 lhs.fLayout==rhs.fLayout &&
8277 lhs.unused490==rhs.unused490 &&
8278 lhs.olstAnm==rhs.olstAnm;
8279 }
8280
operator !=(const SEP & lhs,const SEP & rhs)8281 bool operator!=(const SEP &lhs, const SEP &rhs) {
8282 return !(lhs==rhs);
8283 }
8284
8285
8286 // SEPX implementation
8287
SEPX()8288 SEPX::SEPX() {
8289 clearInternal();
8290 }
8291
SEPX(OLEStreamReader * stream,bool preservePos)8292 SEPX::SEPX(OLEStreamReader *stream, bool preservePos) {
8293 clearInternal();
8294 read(stream, preservePos);
8295 }
8296
SEPX(const SEPX & rhs)8297 SEPX::SEPX(const SEPX &rhs) {
8298 cb=rhs.cb;
8299 grpprl=rhs.grpprl;
8300 }
8301
~SEPX()8302 SEPX::~SEPX() {
8303 delete [] grpprl;
8304 }
8305
operator =(const SEPX & rhs)8306 SEPX &SEPX::operator=(const SEPX &rhs) {
8307
8308 // Check for assignment to self
8309 if(this==&rhs)
8310 return *this;
8311
8312 cb=rhs.cb;
8313 grpprl=rhs.grpprl;
8314
8315 return *this;
8316 }
8317
read(OLEStreamReader * stream,bool preservePos)8318 bool SEPX::read(OLEStreamReader *stream, bool preservePos) {
8319
8320 if(preservePos)
8321 stream->push();
8322
8323 cb=stream->readU16();
8324 // Attention: I don't know how to read grpprl - U8[]
8325 #ifdef __GNUC__
8326 #warning "Couldn't generate reading code for SEPX::grpprl"
8327 #endif
8328
8329 if(preservePos)
8330 stream->pop();
8331 return true;
8332 }
8333
write(OLEStreamWriter * stream,bool preservePos) const8334 bool SEPX::write(OLEStreamWriter *stream, bool preservePos) const {
8335
8336 if(preservePos)
8337 stream->push();
8338
8339 stream->write(cb);
8340 // Attention: I don't know how to write grpprl - U8[]
8341 #ifdef __GNUC__
8342 #warning "Couldn't generate writing code for SEPX::grpprl"
8343 #endif
8344
8345 if(preservePos)
8346 stream->pop();
8347 return true;
8348 }
8349
clear()8350 void SEPX::clear() {
8351 delete [] grpprl;
8352 clearInternal();
8353 }
8354
clearInternal()8355 void SEPX::clearInternal() {
8356 cb=0;
8357 grpprl=0;
8358 }
8359
operator ==(const SEPX & lhs,const SEPX & rhs)8360 bool operator==(const SEPX &lhs, const SEPX &rhs) {
8361 // Attention: I don't know how to compare grpprl - U8[]
8362 #ifdef __GNUC__
8363 #warning "Can't compare SEPX::grpprl items"
8364 #endif
8365
8366 return lhs.cb==rhs.cb;
8367 }
8368
operator !=(const SEPX & lhs,const SEPX & rhs)8369 bool operator!=(const SEPX &lhs, const SEPX &rhs) {
8370 return !(lhs==rhs);
8371 }
8372
8373
8374 // STSHI implementation
8375
8376 const unsigned int STSHI::sizeOf = 18;
8377
STSHI()8378 STSHI::STSHI() {
8379 clear();
8380 }
8381
STSHI(OLEStreamReader * stream,bool preservePos)8382 STSHI::STSHI(OLEStreamReader *stream, bool preservePos) {
8383 clear();
8384 read(stream, preservePos);
8385 }
8386
read(OLEStreamReader * stream,bool preservePos)8387 bool STSHI::read(OLEStreamReader *stream, bool preservePos) {
8388
8389 U16 shifterU16;
8390
8391 if(preservePos)
8392 stream->push();
8393
8394 cstd=stream->readU16();
8395 cbSTDBaseInFile=stream->readU16();
8396 shifterU16=stream->readU16();
8397 fStdStylenamesWritten=shifterU16;
8398 shifterU16>>=1;
8399 unused4_2=shifterU16;
8400 stiMaxWhenSaved=stream->readU16();
8401 istdMaxFixedWhenSaved=stream->readU16();
8402 nVerBuiltInNamesWhenSaved=stream->readU16();
8403 for(int _i=0; _i<(3); ++_i)
8404 rgftcStandardChpStsh[_i]=stream->readU16();
8405
8406 if(preservePos)
8407 stream->pop();
8408 return true;
8409 }
8410
write(OLEStreamWriter * stream,bool preservePos) const8411 bool STSHI::write(OLEStreamWriter *stream, bool preservePos) const {
8412
8413 U16 shifterU16;
8414
8415 if(preservePos)
8416 stream->push();
8417
8418 stream->write(cstd);
8419 stream->write(cbSTDBaseInFile);
8420 shifterU16=fStdStylenamesWritten;
8421 shifterU16|=unused4_2 << 1;
8422 stream->write(shifterU16);
8423 stream->write(stiMaxWhenSaved);
8424 stream->write(istdMaxFixedWhenSaved);
8425 stream->write(nVerBuiltInNamesWhenSaved);
8426 for(int _i=0; _i<(3); ++_i)
8427 stream->write(rgftcStandardChpStsh[_i]);
8428
8429 if(preservePos)
8430 stream->pop();
8431 return true;
8432 }
8433
clear()8434 void STSHI::clear() {
8435 cstd=0;
8436 cbSTDBaseInFile=0;
8437 fStdStylenamesWritten=0;
8438 unused4_2=0;
8439 stiMaxWhenSaved=0;
8440 istdMaxFixedWhenSaved=0;
8441 nVerBuiltInNamesWhenSaved=0;
8442 for(int _i=0; _i<(3); ++_i)
8443 rgftcStandardChpStsh[_i]=0;
8444 }
8445
operator ==(const STSHI & lhs,const STSHI & rhs)8446 bool operator==(const STSHI &lhs, const STSHI &rhs) {
8447
8448 for(int _i=0; _i<(3); ++_i) {
8449 if(lhs.rgftcStandardChpStsh[_i]!=rhs.rgftcStandardChpStsh[_i])
8450 return false;
8451 }
8452
8453 return lhs.cstd==rhs.cstd &&
8454 lhs.cbSTDBaseInFile==rhs.cbSTDBaseInFile &&
8455 lhs.fStdStylenamesWritten==rhs.fStdStylenamesWritten &&
8456 lhs.unused4_2==rhs.unused4_2 &&
8457 lhs.stiMaxWhenSaved==rhs.stiMaxWhenSaved &&
8458 lhs.istdMaxFixedWhenSaved==rhs.istdMaxFixedWhenSaved &&
8459 lhs.nVerBuiltInNamesWhenSaved==rhs.nVerBuiltInNamesWhenSaved;
8460 }
8461
operator !=(const STSHI & lhs,const STSHI & rhs)8462 bool operator!=(const STSHI &lhs, const STSHI &rhs) {
8463 return !(lhs==rhs);
8464 }
8465
8466
8467 // WKB implementation
8468
WKB()8469 WKB::WKB() {
8470 clear();
8471 }
8472
WKB(OLEStreamReader * stream,bool preservePos)8473 WKB::WKB(OLEStreamReader *stream, bool preservePos) {
8474 clear();
8475 read(stream, preservePos);
8476 }
8477
read(OLEStreamReader * stream,bool preservePos)8478 bool WKB::read(OLEStreamReader *stream, bool preservePos) {
8479
8480 U16 shifterU16;
8481
8482 if(preservePos)
8483 stream->push();
8484
8485 fn=stream->readS16();
8486 grfwkb=stream->readU16();
8487 lvl=stream->readS16();
8488 shifterU16=stream->readU16();
8489 fnpt=shifterU16;
8490 shifterU16>>=4;
8491 fnpd=shifterU16;
8492 doc=stream->readS32();
8493
8494 if(preservePos)
8495 stream->pop();
8496 return true;
8497 }
8498
write(OLEStreamWriter * stream,bool preservePos) const8499 bool WKB::write(OLEStreamWriter *stream, bool preservePos) const {
8500
8501 U16 shifterU16;
8502
8503 if(preservePos)
8504 stream->push();
8505
8506 stream->write(fn);
8507 stream->write(grfwkb);
8508 stream->write(lvl);
8509 shifterU16=fnpt;
8510 shifterU16|=fnpd << 4;
8511 stream->write(shifterU16);
8512 stream->write(doc);
8513
8514 if(preservePos)
8515 stream->pop();
8516 return true;
8517 }
8518
clear()8519 void WKB::clear() {
8520 fn=0;
8521 grfwkb=0;
8522 lvl=0;
8523 fnpt=0;
8524 fnpd=0;
8525 doc=0;
8526 }
8527
operator ==(const WKB & lhs,const WKB & rhs)8528 bool operator==(const WKB &lhs, const WKB &rhs) {
8529
8530 return lhs.fn==rhs.fn &&
8531 lhs.grfwkb==rhs.grfwkb &&
8532 lhs.lvl==rhs.lvl &&
8533 lhs.fnpt==rhs.fnpt &&
8534 lhs.fnpd==rhs.fnpd &&
8535 lhs.doc==rhs.doc;
8536 }
8537
operator !=(const WKB & lhs,const WKB & rhs)8538 bool operator!=(const WKB &lhs, const WKB &rhs) {
8539 return !(lhs==rhs);
8540 }
8541
8542
8543
8544 } // namespace Word97
8545
8546 } // namespace wvWare
8547