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