~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to filters/kword/msword-odf/wv2/src/word95_generated.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 <word95_generated.h>
 
32
#include <olestream.h>
 
33
#include <string.h>  // memset(), memcpy()
 
34
#include "wvlog.h"
 
35
 
 
36
namespace wvWare {
 
37
 
 
38
namespace Word95 {
 
39
 
 
40
 
 
41
// DTTM implementation
 
42
 
 
43
DTTM::DTTM() {
 
44
    clear();
 
45
}
 
46
 
 
47
DTTM::DTTM(OLEStreamReader *stream, bool preservePos) {
 
48
    clear();
 
49
    read(stream, preservePos);
 
50
}
 
51
 
 
52
DTTM::DTTM(const U8 *ptr) {
 
53
    clear();
 
54
    readPtr(ptr);
 
55
}
 
56
 
 
57
bool DTTM::read(OLEStreamReader *stream, bool preservePos) {
 
58
 
 
59
    U16 shifterU16;
 
60
 
 
61
    if(preservePos)
 
62
        stream->push();
 
63
 
 
64
    shifterU16=stream->readU16();
 
65
    mint=shifterU16;
 
66
    shifterU16>>=6;
 
67
    hr=shifterU16;
 
68
    shifterU16>>=5;
 
69
    dom=shifterU16;
 
70
    shifterU16=stream->readU16();
 
71
    mon=shifterU16;
 
72
    shifterU16>>=4;
 
73
    yr=shifterU16;
 
74
    shifterU16>>=9;
 
75
    wdy=shifterU16;
 
76
 
 
77
    if(preservePos)
 
78
        stream->pop();
 
79
    return true;
 
80
}
 
81
 
 
82
void DTTM::readPtr(const U8 *ptr) {
 
83
 
 
84
    U16 shifterU16;
 
85
 
 
86
    shifterU16=readU16(ptr);
 
87
    ptr+=sizeof(U16);
 
88
    mint=shifterU16;
 
89
    shifterU16>>=6;
 
90
    hr=shifterU16;
 
91
    shifterU16>>=5;
 
92
    dom=shifterU16;
 
93
    shifterU16=readU16(ptr);
 
94
    ptr+=sizeof(U16);
 
95
    mon=shifterU16;
 
96
    shifterU16>>=4;
 
97
    yr=shifterU16;
 
98
    shifterU16>>=9;
 
99
    wdy=shifterU16;
 
100
}
 
101
 
 
102
bool DTTM::write(OLEStreamWriter *stream, bool preservePos) const {
 
103
 
 
104
    U16 shifterU16;
 
105
 
 
106
    if(preservePos)
 
107
        stream->push();
 
108
 
 
109
    shifterU16=mint;
 
110
    shifterU16|=hr << 6;
 
111
    shifterU16|=dom << 11;
 
112
    stream->write(shifterU16);
 
113
    shifterU16=mon;
 
114
    shifterU16|=yr << 4;
 
115
    shifterU16|=wdy << 13;
 
116
    stream->write(shifterU16);
 
117
 
 
118
    if(preservePos)
 
119
        stream->pop();
 
120
    return true;
 
121
}
 
122
 
 
123
void DTTM::clear() {
 
124
    mint=0;
 
125
    hr=0;
 
126
    dom=0;
 
127
    mon=0;
 
128
    yr=0;
 
129
    wdy=0;
 
130
}
 
131
 
 
132
void DTTM::dump() const
 
133
{
 
134
    wvlog << "Dumping DTTM:" << endl;
 
135
    wvlog << toString().c_str() << endl;
 
136
    wvlog << "\nDumping DTTM done." << endl;
 
137
}
 
138
 
 
139
std::string DTTM::toString() const
 
140
{
 
141
    std::string s( "DTTM:" );
 
142
    s += "\nmint=";
 
143
    s += uint2string( mint );
 
144
    s += "\nhr=";
 
145
    s += uint2string( hr );
 
146
    s += "\ndom=";
 
147
    s += uint2string( dom );
 
148
    s += "\nmon=";
 
149
    s += uint2string( mon );
 
150
    s += "\nyr=";
 
151
    s += uint2string( yr );
 
152
    s += "\nwdy=";
 
153
    s += uint2string( wdy );
 
154
    s += "\nDTTM Done.";
 
155
    return s;
 
156
}
 
157
 
 
158
bool operator==(const DTTM &lhs, const DTTM &rhs) {
 
159
 
 
160
    return lhs.mint==rhs.mint &&
 
161
           lhs.hr==rhs.hr &&
 
162
           lhs.dom==rhs.dom &&
 
163
           lhs.mon==rhs.mon &&
 
164
           lhs.yr==rhs.yr &&
 
165
           lhs.wdy==rhs.wdy;
 
166
}
 
167
 
 
168
bool operator!=(const DTTM &lhs, const DTTM &rhs) {
 
169
    return !(lhs==rhs);
 
170
}
 
171
 
 
172
 
 
173
// PRM2 implementation
 
174
 
 
175
PRM2::PRM2() {
 
176
    clear();
 
177
}
 
178
 
 
179
PRM2::PRM2(OLEStreamReader *stream, bool preservePos) {
 
180
    clear();
 
181
    read(stream, preservePos);
 
182
}
 
183
 
 
184
bool PRM2::read(OLEStreamReader *stream, bool preservePos) {
 
185
 
 
186
    U16 shifterU16;
 
187
 
 
188
    if(preservePos)
 
189
        stream->push();
 
190
 
 
191
    shifterU16=stream->readU16();
 
192
    fComplex=shifterU16;
 
193
    shifterU16>>=1;
 
194
    igrpprl=shifterU16;
 
195
 
 
196
    if(preservePos)
 
197
        stream->pop();
 
198
    return true;
 
199
}
 
200
 
 
201
bool PRM2::write(OLEStreamWriter *stream, bool preservePos) const {
 
202
 
 
203
    U16 shifterU16;
 
204
 
 
205
    if(preservePos)
 
206
        stream->push();
 
207
 
 
208
    shifterU16=fComplex;
 
209
    shifterU16|=igrpprl << 1;
 
210
    stream->write(shifterU16);
 
211
 
 
212
    if(preservePos)
 
213
        stream->pop();
 
214
    return true;
 
215
}
 
216
 
 
217
void PRM2::clear() {
 
218
    fComplex=0;
 
219
    igrpprl=0;
 
220
}
 
221
 
 
222
bool operator==(const PRM2 &lhs, const PRM2 &rhs) {
 
223
 
 
224
    return lhs.fComplex==rhs.fComplex &&
 
225
           lhs.igrpprl==rhs.igrpprl;
 
226
}
 
227
 
 
228
bool operator!=(const PRM2 &lhs, const PRM2 &rhs) {
 
229
    return !(lhs==rhs);
 
230
}
 
231
 
 
232
 
 
233
// PRM implementation
 
234
 
 
235
const unsigned int PRM::sizeOf = 2;
 
236
 
 
237
PRM::PRM() {
 
238
    clear();
 
239
}
 
240
 
 
241
PRM::PRM(OLEStreamReader *stream, bool preservePos) {
 
242
    clear();
 
243
    read(stream, preservePos);
 
244
}
 
245
 
 
246
PRM::PRM(const U8 *ptr) {
 
247
    clear();
 
248
    readPtr(ptr);
 
249
}
 
250
 
 
251
bool PRM::read(OLEStreamReader *stream, bool preservePos) {
 
252
 
 
253
    U8 shifterU8;
 
254
 
 
255
    if(preservePos)
 
256
        stream->push();
 
257
 
 
258
    shifterU8=stream->readU8();
 
259
    fComplex=shifterU8;
 
260
    shifterU8>>=1;
 
261
    sprm=shifterU8;
 
262
    val=stream->readU8();
 
263
 
 
264
    if(preservePos)
 
265
        stream->pop();
 
266
    return true;
 
267
}
 
268
 
 
269
void PRM::readPtr(const U8 *ptr) {
 
270
 
 
271
    U8 shifterU8;
 
272
 
 
273
    shifterU8=readU8(ptr);
 
274
    ptr+=sizeof(U8);
 
275
    fComplex=shifterU8;
 
276
    shifterU8>>=1;
 
277
    sprm=shifterU8;
 
278
    val=readU8(ptr);
 
279
    ptr+=sizeof(U8);
 
280
}
 
281
 
 
282
bool PRM::write(OLEStreamWriter *stream, bool preservePos) const {
 
283
 
 
284
    U8 shifterU8;
 
285
 
 
286
    if(preservePos)
 
287
        stream->push();
 
288
 
 
289
    shifterU8=fComplex;
 
290
    shifterU8|=sprm << 1;
 
291
    stream->write(shifterU8);
 
292
    stream->write(val);
 
293
 
 
294
    if(preservePos)
 
295
        stream->pop();
 
296
    return true;
 
297
}
 
298
 
 
299
void PRM::clear() {
 
300
    fComplex=0;
 
301
    sprm=0;
 
302
    val=0;
 
303
}
 
304
 
 
305
bool operator==(const PRM &lhs, const PRM &rhs) {
 
306
 
 
307
    return lhs.fComplex==rhs.fComplex &&
 
308
           lhs.sprm==rhs.sprm &&
 
309
           lhs.val==rhs.val;
 
310
}
 
311
 
 
312
bool operator!=(const PRM &lhs, const PRM &rhs) {
 
313
    return !(lhs==rhs);
 
314
}
 
315
 
 
316
 
 
317
// SHD implementation
 
318
 
 
319
SHD::SHD() {
 
320
    clear();
 
321
}
 
322
 
 
323
SHD::SHD(OLEStreamReader *stream, bool preservePos) {
 
324
    clear();
 
325
    read(stream, preservePos);
 
326
}
 
327
 
 
328
SHD::SHD(const U8 *ptr) {
 
329
    clear();
 
330
    readPtr(ptr);
 
331
}
 
332
 
 
333
bool SHD::read(OLEStreamReader *stream, bool preservePos) {
 
334
 
 
335
    U16 shifterU16;
 
336
 
 
337
    if(preservePos)
 
338
        stream->push();
 
339
 
 
340
    shifterU16=stream->readU16();
 
341
    icoFore=shifterU16;
 
342
    shifterU16>>=5;
 
343
    icoBack=shifterU16;
 
344
    shifterU16>>=5;
 
345
    ipat=shifterU16;
 
346
 
 
347
    if(preservePos)
 
348
        stream->pop();
 
349
    return true;
 
350
}
 
351
 
 
352
void SHD::readPtr(const U8 *ptr) {
 
353
 
 
354
    U16 shifterU16;
 
355
 
 
356
    shifterU16=readU16(ptr);
 
357
    ptr+=sizeof(U16);
 
358
    icoFore=shifterU16;
 
359
    shifterU16>>=5;
 
360
    icoBack=shifterU16;
 
361
    shifterU16>>=5;
 
362
    ipat=shifterU16;
 
363
}
 
364
 
 
365
bool SHD::write(OLEStreamWriter *stream, bool preservePos) const {
 
366
 
 
367
    U16 shifterU16;
 
368
 
 
369
    if(preservePos)
 
370
        stream->push();
 
371
 
 
372
    shifterU16=icoFore;
 
373
    shifterU16|=icoBack << 5;
 
374
    shifterU16|=ipat << 10;
 
375
    stream->write(shifterU16);
 
376
 
 
377
    if(preservePos)
 
378
        stream->pop();
 
379
    return true;
 
380
}
 
381
 
 
382
void SHD::clear() {
 
383
    icoFore=0;
 
384
    icoBack=0;
 
385
    ipat=0;
 
386
}
 
387
 
 
388
void SHD::dump() const
 
389
{
 
390
    wvlog << "Dumping SHD:" << endl;
 
391
    wvlog << toString().c_str() << endl;
 
392
    wvlog << "\nDumping SHD done." << endl;
 
393
}
 
394
 
 
395
std::string SHD::toString() const
 
396
{
 
397
    std::string s( "SHD:" );
 
398
    s += "\nicoFore=";
 
399
    s += uint2string( icoFore );
 
400
    s += "\nicoBack=";
 
401
    s += uint2string( icoBack );
 
402
    s += "\nipat=";
 
403
    s += uint2string( ipat );
 
404
    s += "\nSHD Done.";
 
405
    return s;
 
406
}
 
407
 
 
408
bool operator==(const SHD &lhs, const SHD &rhs) {
 
409
 
 
410
    return lhs.icoFore==rhs.icoFore &&
 
411
           lhs.icoBack==rhs.icoBack &&
 
412
           lhs.ipat==rhs.ipat;
 
413
}
 
414
 
 
415
bool operator!=(const SHD &lhs, const SHD &rhs) {
 
416
    return !(lhs==rhs);
 
417
}
 
418
 
 
419
 
 
420
// PHE implementation
 
421
 
 
422
const unsigned int PHE::sizeOf = 6;
 
423
 
 
424
PHE::PHE() {
 
425
    clear();
 
426
}
 
427
 
 
428
PHE::PHE(OLEStreamReader *stream, bool preservePos) {
 
429
    clear();
 
430
    read(stream, preservePos);
 
431
}
 
432
 
 
433
PHE::PHE(const U8 *ptr) {
 
434
    clear();
 
435
    readPtr(ptr);
 
436
}
 
437
 
 
438
bool PHE::read(OLEStreamReader *stream, bool preservePos) {
 
439
 
 
440
    U16 shifterU16;
 
441
 
 
442
    if(preservePos)
 
443
        stream->push();
 
444
 
 
445
    shifterU16=stream->readU16();
 
446
    fSpare=shifterU16;
 
447
    shifterU16>>=1;
 
448
    fUnk=shifterU16;
 
449
    shifterU16>>=1;
 
450
    fDiffLines=shifterU16;
 
451
    shifterU16>>=1;
 
452
    unused0_3=shifterU16;
 
453
    shifterU16>>=5;
 
454
    clMac=shifterU16;
 
455
    dxaCol=stream->readU16();
 
456
    dylLine_dylHeight=stream->readU16();
 
457
 
 
458
    if(preservePos)
 
459
        stream->pop();
 
460
    return true;
 
461
}
 
462
 
 
463
void PHE::readPtr(const U8 *ptr) {
 
464
 
 
465
    U16 shifterU16;
 
466
 
 
467
    shifterU16=readU16(ptr);
 
468
    ptr+=sizeof(U16);
 
469
    fSpare=shifterU16;
 
470
    shifterU16>>=1;
 
471
    fUnk=shifterU16;
 
472
    shifterU16>>=1;
 
473
    fDiffLines=shifterU16;
 
474
    shifterU16>>=1;
 
475
    unused0_3=shifterU16;
 
476
    shifterU16>>=5;
 
477
    clMac=shifterU16;
 
478
    dxaCol=readU16(ptr);
 
479
    ptr+=sizeof(U16);
 
480
    dylLine_dylHeight=readU16(ptr);
 
481
    ptr+=sizeof(U16);
 
482
}
 
483
 
 
484
bool PHE::write(OLEStreamWriter *stream, bool preservePos) const {
 
485
 
 
486
    U16 shifterU16;
 
487
 
 
488
    if(preservePos)
 
489
        stream->push();
 
490
 
 
491
    shifterU16=fSpare;
 
492
    shifterU16|=fUnk << 1;
 
493
    shifterU16|=fDiffLines << 2;
 
494
    shifterU16|=unused0_3 << 3;
 
495
    shifterU16|=clMac << 8;
 
496
    stream->write(shifterU16);
 
497
    stream->write(dxaCol);
 
498
    stream->write(dylLine_dylHeight);
 
499
 
 
500
    if(preservePos)
 
501
        stream->pop();
 
502
    return true;
 
503
}
 
504
 
 
505
void PHE::clear() {
 
506
    fSpare=0;
 
507
    fUnk=0;
 
508
    fDiffLines=0;
 
509
    unused0_3=0;
 
510
    clMac=0;
 
511
    dxaCol=0;
 
512
    dylLine_dylHeight=0;
 
513
}
 
514
 
 
515
void PHE::dump() const
 
516
{
 
517
    wvlog << "Dumping PHE:" << endl;
 
518
    wvlog << toString().c_str() << endl;
 
519
    wvlog << "\nDumping PHE done." << endl;
 
520
}
 
521
 
 
522
std::string PHE::toString() const
 
523
{
 
524
    std::string s( "PHE:" );
 
525
    s += "\nfSpare=";
 
526
    s += uint2string( fSpare );
 
527
    s += "\nfUnk=";
 
528
    s += uint2string( fUnk );
 
529
    s += "\nfDiffLines=";
 
530
    s += uint2string( fDiffLines );
 
531
    s += "\nunused0_3=";
 
532
    s += uint2string( unused0_3 );
 
533
    s += "\nclMac=";
 
534
    s += uint2string( clMac );
 
535
    s += "\ndxaCol=";
 
536
    s += uint2string( dxaCol );
 
537
    s += "\ndylLine_dylHeight=";
 
538
    s += uint2string( dylLine_dylHeight );
 
539
    s += "\nPHE Done.";
 
540
    return s;
 
541
}
 
542
 
 
543
bool operator==(const PHE &lhs, const PHE &rhs) {
 
544
 
 
545
    return lhs.fSpare==rhs.fSpare &&
 
546
           lhs.fUnk==rhs.fUnk &&
 
547
           lhs.fDiffLines==rhs.fDiffLines &&
 
548
           lhs.unused0_3==rhs.unused0_3 &&
 
549
           lhs.clMac==rhs.clMac &&
 
550
           lhs.dxaCol==rhs.dxaCol &&
 
551
           lhs.dylLine_dylHeight==rhs.dylLine_dylHeight;
 
552
}
 
553
 
 
554
bool operator!=(const PHE &lhs, const PHE &rhs) {
 
555
    return !(lhs==rhs);
 
556
}
 
557
 
 
558
 
 
559
// BRC implementation
 
560
 
 
561
const unsigned int BRC::sizeOf = 2;
 
562
 
 
563
BRC::BRC() {
 
564
    clear();
 
565
}
 
566
 
 
567
BRC::BRC(OLEStreamReader *stream, bool preservePos) {
 
568
    clear();
 
569
    read(stream, preservePos);
 
570
}
 
571
 
 
572
BRC::BRC(const U8 *ptr) {
 
573
    clear();
 
574
    readPtr(ptr);
 
575
}
 
576
 
 
577
bool BRC::read(OLEStreamReader *stream, bool preservePos) {
 
578
 
 
579
    U16 shifterU16;
 
580
 
 
581
    if(preservePos)
 
582
        stream->push();
 
583
 
 
584
    shifterU16=stream->readU16();
 
585
    dxpLineWidth=shifterU16;
 
586
    shifterU16>>=3;
 
587
    brcType=shifterU16;
 
588
    shifterU16>>=2;
 
589
    fShadow=shifterU16;
 
590
    shifterU16>>=1;
 
591
    ico=shifterU16;
 
592
    shifterU16>>=5;
 
593
    dxpSpace=shifterU16;
 
594
 
 
595
    if(preservePos)
 
596
        stream->pop();
 
597
    return true;
 
598
}
 
599
 
 
600
void BRC::readPtr(const U8 *ptr) {
 
601
 
 
602
    U16 shifterU16;
 
603
 
 
604
    shifterU16=readU16(ptr);
 
605
    ptr+=sizeof(U16);
 
606
    dxpLineWidth=shifterU16;
 
607
    shifterU16>>=3;
 
608
    brcType=shifterU16;
 
609
    shifterU16>>=2;
 
610
    fShadow=shifterU16;
 
611
    shifterU16>>=1;
 
612
    ico=shifterU16;
 
613
    shifterU16>>=5;
 
614
    dxpSpace=shifterU16;
 
615
}
 
616
 
 
617
bool BRC::write(OLEStreamWriter *stream, bool preservePos) const {
 
618
 
 
619
    U16 shifterU16;
 
620
 
 
621
    if(preservePos)
 
622
        stream->push();
 
623
 
 
624
    shifterU16=dxpLineWidth;
 
625
    shifterU16|=brcType << 3;
 
626
    shifterU16|=fShadow << 5;
 
627
    shifterU16|=ico << 6;
 
628
    shifterU16|=dxpSpace << 11;
 
629
    stream->write(shifterU16);
 
630
 
 
631
    if(preservePos)
 
632
        stream->pop();
 
633
    return true;
 
634
}
 
635
 
 
636
void BRC::clear() {
 
637
    dxpLineWidth=0;
 
638
    brcType=0;
 
639
    fShadow=0;
 
640
    ico=0;
 
641
    dxpSpace=0;
 
642
}
 
643
 
 
644
void BRC::dump() const
 
645
{
 
646
    wvlog << "Dumping BRC:" << endl;
 
647
    wvlog << toString().c_str() << endl;
 
648
    wvlog << "\nDumping BRC done." << endl;
 
649
}
 
650
 
 
651
std::string BRC::toString() const
 
652
{
 
653
    std::string s( "BRC:" );
 
654
    s += "\ndxpLineWidth=";
 
655
    s += uint2string( dxpLineWidth );
 
656
    s += "\nbrcType=";
 
657
    s += uint2string( brcType );
 
658
    s += "\nfShadow=";
 
659
    s += uint2string( fShadow );
 
660
    s += "\nico=";
 
661
    s += uint2string( ico );
 
662
    s += "\ndxpSpace=";
 
663
    s += uint2string( dxpSpace );
 
664
    s += "\nBRC Done.";
 
665
    return s;
 
666
}
 
667
 
 
668
bool operator==(const BRC &lhs, const BRC &rhs) {
 
669
 
 
670
    return lhs.dxpLineWidth==rhs.dxpLineWidth &&
 
671
           lhs.brcType==rhs.brcType &&
 
672
           lhs.fShadow==rhs.fShadow &&
 
673
           lhs.ico==rhs.ico &&
 
674
           lhs.dxpSpace==rhs.dxpSpace;
 
675
}
 
676
 
 
677
bool operator!=(const BRC &lhs, const BRC &rhs) {
 
678
    return !(lhs==rhs);
 
679
}
 
680
 
 
681
 
 
682
// TLP implementation
 
683
 
 
684
TLP::TLP() {
 
685
    clear();
 
686
}
 
687
 
 
688
TLP::TLP(OLEStreamReader *stream, bool preservePos) {
 
689
    clear();
 
690
    read(stream, preservePos);
 
691
}
 
692
 
 
693
TLP::TLP(const U8 *ptr) {
 
694
    clear();
 
695
    readPtr(ptr);
 
696
}
 
697
 
 
698
bool TLP::read(OLEStreamReader *stream, bool preservePos) {
 
699
 
 
700
    U16 shifterU16;
 
701
 
 
702
    if(preservePos)
 
703
        stream->push();
 
704
 
 
705
    itl=stream->readU16();
 
706
    shifterU16=stream->readU16();
 
707
    fBorders=shifterU16;
 
708
    shifterU16>>=1;
 
709
    fShading=shifterU16;
 
710
    shifterU16>>=1;
 
711
    fFont=shifterU16;
 
712
    shifterU16>>=1;
 
713
    fColor=shifterU16;
 
714
    shifterU16>>=1;
 
715
    fBestFit=shifterU16;
 
716
    shifterU16>>=1;
 
717
    fHdrRows=shifterU16;
 
718
    shifterU16>>=1;
 
719
    fLastRow=shifterU16;
 
720
    shifterU16>>=1;
 
721
    fHdrCols=shifterU16;
 
722
    shifterU16>>=1;
 
723
    fLastCol=shifterU16;
 
724
    shifterU16>>=1;
 
725
    unused2_9=shifterU16;
 
726
 
 
727
    if(preservePos)
 
728
        stream->pop();
 
729
    return true;
 
730
}
 
731
 
 
732
void TLP::readPtr(const U8 *ptr) {
 
733
 
 
734
    U16 shifterU16;
 
735
 
 
736
    itl=readU16(ptr);
 
737
    ptr+=sizeof(U16);
 
738
    shifterU16=readU16(ptr);
 
739
    ptr+=sizeof(U16);
 
740
    fBorders=shifterU16;
 
741
    shifterU16>>=1;
 
742
    fShading=shifterU16;
 
743
    shifterU16>>=1;
 
744
    fFont=shifterU16;
 
745
    shifterU16>>=1;
 
746
    fColor=shifterU16;
 
747
    shifterU16>>=1;
 
748
    fBestFit=shifterU16;
 
749
    shifterU16>>=1;
 
750
    fHdrRows=shifterU16;
 
751
    shifterU16>>=1;
 
752
    fLastRow=shifterU16;
 
753
    shifterU16>>=1;
 
754
    fHdrCols=shifterU16;
 
755
    shifterU16>>=1;
 
756
    fLastCol=shifterU16;
 
757
    shifterU16>>=1;
 
758
    unused2_9=shifterU16;
 
759
}
 
760
 
 
761
bool TLP::write(OLEStreamWriter *stream, bool preservePos) const {
 
762
 
 
763
    U16 shifterU16;
 
764
 
 
765
    if(preservePos)
 
766
        stream->push();
 
767
 
 
768
    stream->write(itl);
 
769
    shifterU16=fBorders;
 
770
    shifterU16|=fShading << 1;
 
771
    shifterU16|=fFont << 2;
 
772
    shifterU16|=fColor << 3;
 
773
    shifterU16|=fBestFit << 4;
 
774
    shifterU16|=fHdrRows << 5;
 
775
    shifterU16|=fLastRow << 6;
 
776
    shifterU16|=fHdrCols << 7;
 
777
    shifterU16|=fLastCol << 8;
 
778
    shifterU16|=unused2_9 << 9;
 
779
    stream->write(shifterU16);
 
780
 
 
781
    if(preservePos)
 
782
        stream->pop();
 
783
    return true;
 
784
}
 
785
 
 
786
void TLP::clear() {
 
787
    itl=0;
 
788
    fBorders=0;
 
789
    fShading=0;
 
790
    fFont=0;
 
791
    fColor=0;
 
792
    fBestFit=0;
 
793
    fHdrRows=0;
 
794
    fLastRow=0;
 
795
    fHdrCols=0;
 
796
    fLastCol=0;
 
797
    unused2_9=0;
 
798
}
 
799
 
 
800
void TLP::dump() const
 
801
{
 
802
    wvlog << "Dumping TLP:" << endl;
 
803
    wvlog << toString().c_str() << endl;
 
804
    wvlog << "\nDumping TLP done." << endl;
 
805
}
 
806
 
 
807
std::string TLP::toString() const
 
808
{
 
809
    std::string s( "TLP:" );
 
810
    s += "\nitl=";
 
811
    s += uint2string( itl );
 
812
    s += "\nfBorders=";
 
813
    s += uint2string( fBorders );
 
814
    s += "\nfShading=";
 
815
    s += uint2string( fShading );
 
816
    s += "\nfFont=";
 
817
    s += uint2string( fFont );
 
818
    s += "\nfColor=";
 
819
    s += uint2string( fColor );
 
820
    s += "\nfBestFit=";
 
821
    s += uint2string( fBestFit );
 
822
    s += "\nfHdrRows=";
 
823
    s += uint2string( fHdrRows );
 
824
    s += "\nfLastRow=";
 
825
    s += uint2string( fLastRow );
 
826
    s += "\nfHdrCols=";
 
827
    s += uint2string( fHdrCols );
 
828
    s += "\nfLastCol=";
 
829
    s += uint2string( fLastCol );
 
830
    s += "\nunused2_9=";
 
831
    s += uint2string( unused2_9 );
 
832
    s += "\nTLP Done.";
 
833
    return s;
 
834
}
 
835
 
 
836
bool operator==(const TLP &lhs, const TLP &rhs) {
 
837
 
 
838
    return lhs.itl==rhs.itl &&
 
839
           lhs.fBorders==rhs.fBorders &&
 
840
           lhs.fShading==rhs.fShading &&
 
841
           lhs.fFont==rhs.fFont &&
 
842
           lhs.fColor==rhs.fColor &&
 
843
           lhs.fBestFit==rhs.fBestFit &&
 
844
           lhs.fHdrRows==rhs.fHdrRows &&
 
845
           lhs.fLastRow==rhs.fLastRow &&
 
846
           lhs.fHdrCols==rhs.fHdrCols &&
 
847
           lhs.fLastCol==rhs.fLastCol &&
 
848
           lhs.unused2_9==rhs.unused2_9;
 
849
}
 
850
 
 
851
bool operator!=(const TLP &lhs, const TLP &rhs) {
 
852
    return !(lhs==rhs);
 
853
}
 
854
 
 
855
 
 
856
// TC implementation
 
857
 
 
858
const unsigned int TC::sizeOf = 10;
 
859
 
 
860
TC::TC() {
 
861
    clear();
 
862
}
 
863
 
 
864
TC::TC(OLEStreamReader *stream, bool preservePos) {
 
865
    clear();
 
866
    read(stream, preservePos);
 
867
}
 
868
 
 
869
TC::TC(const U8 *ptr) {
 
870
    clear();
 
871
    readPtr(ptr);
 
872
}
 
873
 
 
874
bool TC::read(OLEStreamReader *stream, bool preservePos) {
 
875
 
 
876
    U16 shifterU16;
 
877
 
 
878
    if(preservePos)
 
879
        stream->push();
 
880
 
 
881
    shifterU16=stream->readU16();
 
882
    fFirstMerged=shifterU16;
 
883
    shifterU16>>=1;
 
884
    fMerged=shifterU16;
 
885
    shifterU16>>=1;
 
886
    fUnused=shifterU16;
 
887
    brcTop.read(stream, false);
 
888
    brcLeft.read(stream, false);
 
889
    brcBottom.read(stream, false);
 
890
    brcRight.read(stream, false);
 
891
 
 
892
    if(preservePos)
 
893
        stream->pop();
 
894
    return true;
 
895
}
 
896
 
 
897
void TC::readPtr(const U8 *ptr) {
 
898
 
 
899
    U16 shifterU16;
 
900
 
 
901
    shifterU16=readU16(ptr);
 
902
    ptr+=sizeof(U16);
 
903
    fFirstMerged=shifterU16;
 
904
    shifterU16>>=1;
 
905
    fMerged=shifterU16;
 
906
    shifterU16>>=1;
 
907
    fUnused=shifterU16;
 
908
    brcTop.readPtr(ptr);
 
909
    ptr+=BRC::sizeOf;
 
910
    brcLeft.readPtr(ptr);
 
911
    ptr+=BRC::sizeOf;
 
912
    brcBottom.readPtr(ptr);
 
913
    ptr+=BRC::sizeOf;
 
914
    brcRight.readPtr(ptr);
 
915
    ptr+=BRC::sizeOf;
 
916
}
 
917
 
 
918
bool TC::write(OLEStreamWriter *stream, bool preservePos) const {
 
919
 
 
920
    U16 shifterU16;
 
921
 
 
922
    if(preservePos)
 
923
        stream->push();
 
924
 
 
925
    shifterU16=fFirstMerged;
 
926
    shifterU16|=fMerged << 1;
 
927
    shifterU16|=fUnused << 2;
 
928
    stream->write(shifterU16);
 
929
    brcTop.write(stream, false);
 
930
    brcLeft.write(stream, false);
 
931
    brcBottom.write(stream, false);
 
932
    brcRight.write(stream, false);
 
933
 
 
934
    if(preservePos)
 
935
        stream->pop();
 
936
    return true;
 
937
}
 
938
 
 
939
void TC::clear() {
 
940
    fFirstMerged=0;
 
941
    fMerged=0;
 
942
    fUnused=0;
 
943
    brcTop.clear();
 
944
    brcLeft.clear();
 
945
    brcBottom.clear();
 
946
    brcRight.clear();
 
947
}
 
948
 
 
949
void TC::dump() const
 
950
{
 
951
    wvlog << "Dumping TC:" << endl;
 
952
    wvlog << toString().c_str() << endl;
 
953
    wvlog << "\nDumping TC done." << endl;
 
954
}
 
955
 
 
956
std::string TC::toString() const
 
957
{
 
958
    std::string s( "TC:" );
 
959
    s += "\nfFirstMerged=";
 
960
    s += uint2string( fFirstMerged );
 
961
    s += "\nfMerged=";
 
962
    s += uint2string( fMerged );
 
963
    s += "\nfUnused=";
 
964
    s += uint2string( fUnused );
 
965
    s += "\nbrcTop=";
 
966
    s += "\n{" + brcTop.toString() + "}\n";
 
967
    s += "\nbrcLeft=";
 
968
    s += "\n{" + brcLeft.toString() + "}\n";
 
969
    s += "\nbrcBottom=";
 
970
    s += "\n{" + brcBottom.toString() + "}\n";
 
971
    s += "\nbrcRight=";
 
972
    s += "\n{" + brcRight.toString() + "}\n";
 
973
    s += "\nTC Done.";
 
974
    return s;
 
975
}
 
976
 
 
977
bool operator==(const TC &lhs, const TC &rhs) {
 
978
 
 
979
    return lhs.fFirstMerged==rhs.fFirstMerged &&
 
980
           lhs.fMerged==rhs.fMerged &&
 
981
           lhs.fUnused==rhs.fUnused &&
 
982
           lhs.brcTop==rhs.brcTop &&
 
983
           lhs.brcLeft==rhs.brcLeft &&
 
984
           lhs.brcBottom==rhs.brcBottom &&
 
985
           lhs.brcRight==rhs.brcRight;
 
986
}
 
987
 
 
988
bool operator!=(const TC &lhs, const TC &rhs) {
 
989
    return !(lhs==rhs);
 
990
}
 
991
 
 
992
 
 
993
// DPHEAD implementation
 
994
 
 
995
DPHEAD::DPHEAD() {
 
996
    clear();
 
997
}
 
998
 
 
999
DPHEAD::DPHEAD(OLEStreamReader *stream, bool preservePos) {
 
1000
    clear();
 
1001
    read(stream, preservePos);
 
1002
}
 
1003
 
 
1004
bool DPHEAD::read(OLEStreamReader *stream, bool preservePos) {
 
1005
 
 
1006
    if(preservePos)
 
1007
        stream->push();
 
1008
 
 
1009
    dpk=stream->readU16();
 
1010
    cb=stream->readU16();
 
1011
    xa=stream->readU16();
 
1012
    ya=stream->readU16();
 
1013
    dxa=stream->readU16();
 
1014
    dya=stream->readU16();
 
1015
 
 
1016
    if(preservePos)
 
1017
        stream->pop();
 
1018
    return true;
 
1019
}
 
1020
 
 
1021
bool DPHEAD::write(OLEStreamWriter *stream, bool preservePos) const {
 
1022
 
 
1023
    if(preservePos)
 
1024
        stream->push();
 
1025
 
 
1026
    stream->write(dpk);
 
1027
    stream->write(cb);
 
1028
    stream->write(xa);
 
1029
    stream->write(ya);
 
1030
    stream->write(dxa);
 
1031
    stream->write(dya);
 
1032
 
 
1033
    if(preservePos)
 
1034
        stream->pop();
 
1035
    return true;
 
1036
}
 
1037
 
 
1038
void DPHEAD::clear() {
 
1039
    dpk=0;
 
1040
    cb=0;
 
1041
    xa=0;
 
1042
    ya=0;
 
1043
    dxa=0;
 
1044
    dya=0;
 
1045
}
 
1046
 
 
1047
bool operator==(const DPHEAD &lhs, const DPHEAD &rhs) {
 
1048
 
 
1049
    return lhs.dpk==rhs.dpk &&
 
1050
           lhs.cb==rhs.cb &&
 
1051
           lhs.xa==rhs.xa &&
 
1052
           lhs.ya==rhs.ya &&
 
1053
           lhs.dxa==rhs.dxa &&
 
1054
           lhs.dya==rhs.dya;
 
1055
}
 
1056
 
 
1057
bool operator!=(const DPHEAD &lhs, const DPHEAD &rhs) {
 
1058
    return !(lhs==rhs);
 
1059
}
 
1060
 
 
1061
 
 
1062
// DPTXBX implementation
 
1063
 
 
1064
DPTXBX::DPTXBX() {
 
1065
    clear();
 
1066
}
 
1067
 
 
1068
DPTXBX::DPTXBX(OLEStreamReader *stream, bool preservePos) {
 
1069
    clear();
 
1070
    read(stream, preservePos);
 
1071
}
 
1072
 
 
1073
bool DPTXBX::read(OLEStreamReader *stream, bool preservePos) {
 
1074
 
 
1075
    U16 shifterU16;
 
1076
 
 
1077
    if(preservePos)
 
1078
        stream->push();
 
1079
 
 
1080
    dphead.read(stream, false);
 
1081
    lnpc=stream->readU32();
 
1082
    lnpw=stream->readU16();
 
1083
    lnps=stream->readU16();
 
1084
    dlpcFg=stream->readU32();
 
1085
    dlpcBg=stream->readU32();
 
1086
    flpp=stream->readU16();
 
1087
    shdwpi=stream->readU16();
 
1088
    xaOffset=stream->readU16();
 
1089
    yaOffset=stream->readU16();
 
1090
    shifterU16=stream->readU16();
 
1091
    fRoundCorners=shifterU16;
 
1092
    shifterU16>>=1;
 
1093
    zaShape=shifterU16;
 
1094
    dzaInternalMargin=stream->readU16();
 
1095
 
 
1096
    if(preservePos)
 
1097
        stream->pop();
 
1098
    return true;
 
1099
}
 
1100
 
 
1101
bool DPTXBX::write(OLEStreamWriter *stream, bool preservePos) const {
 
1102
 
 
1103
    U16 shifterU16;
 
1104
 
 
1105
    if(preservePos)
 
1106
        stream->push();
 
1107
 
 
1108
    dphead.write(stream, false);
 
1109
    stream->write(lnpc);
 
1110
    stream->write(lnpw);
 
1111
    stream->write(lnps);
 
1112
    stream->write(dlpcFg);
 
1113
    stream->write(dlpcBg);
 
1114
    stream->write(flpp);
 
1115
    stream->write(shdwpi);
 
1116
    stream->write(xaOffset);
 
1117
    stream->write(yaOffset);
 
1118
    shifterU16=fRoundCorners;
 
1119
    shifterU16|=zaShape << 1;
 
1120
    stream->write(shifterU16);
 
1121
    stream->write(dzaInternalMargin);
 
1122
 
 
1123
    if(preservePos)
 
1124
        stream->pop();
 
1125
    return true;
 
1126
}
 
1127
 
 
1128
void DPTXBX::clear() {
 
1129
    dphead.clear();
 
1130
    lnpc=0;
 
1131
    lnpw=0;
 
1132
    lnps=0;
 
1133
    dlpcFg=0;
 
1134
    dlpcBg=0;
 
1135
    flpp=0;
 
1136
    shdwpi=0;
 
1137
    xaOffset=0;
 
1138
    yaOffset=0;
 
1139
    fRoundCorners=0;
 
1140
    zaShape=0;
 
1141
    dzaInternalMargin=0;
 
1142
}
 
1143
 
 
1144
bool operator==(const DPTXBX &lhs, const DPTXBX &rhs) {
 
1145
 
 
1146
    return lhs.dphead==rhs.dphead &&
 
1147
           lhs.lnpc==rhs.lnpc &&
 
1148
           lhs.lnpw==rhs.lnpw &&
 
1149
           lhs.lnps==rhs.lnps &&
 
1150
           lhs.dlpcFg==rhs.dlpcFg &&
 
1151
           lhs.dlpcBg==rhs.dlpcBg &&
 
1152
           lhs.flpp==rhs.flpp &&
 
1153
           lhs.shdwpi==rhs.shdwpi &&
 
1154
           lhs.xaOffset==rhs.xaOffset &&
 
1155
           lhs.yaOffset==rhs.yaOffset &&
 
1156
           lhs.fRoundCorners==rhs.fRoundCorners &&
 
1157
           lhs.zaShape==rhs.zaShape &&
 
1158
           lhs.dzaInternalMargin==rhs.dzaInternalMargin;
 
1159
}
 
1160
 
 
1161
bool operator!=(const DPTXBX &lhs, const DPTXBX &rhs) {
 
1162
    return !(lhs==rhs);
 
1163
}
 
1164
 
 
1165
 
 
1166
// DPPOLYLINE implementation
 
1167
 
 
1168
DPPOLYLINE::DPPOLYLINE() {
 
1169
    clearInternal();
 
1170
}
 
1171
 
 
1172
DPPOLYLINE::DPPOLYLINE(OLEStreamReader *stream, bool preservePos) {
 
1173
    clearInternal();
 
1174
    read(stream, preservePos);
 
1175
}
 
1176
 
 
1177
DPPOLYLINE::DPPOLYLINE(const DPPOLYLINE &rhs) {
 
1178
    dphead=rhs.dphead;
 
1179
    lnpc=rhs.lnpc;
 
1180
    lnpw=rhs.lnpw;
 
1181
    lnps=rhs.lnps;
 
1182
    dlpcFg=rhs.dlpcFg;
 
1183
    dlpcBg=rhs.dlpcBg;
 
1184
    flpp=rhs.flpp;
 
1185
    eppsStart=rhs.eppsStart;
 
1186
    eppwStart=rhs.eppwStart;
 
1187
    epplStart=rhs.epplStart;
 
1188
    unused30_6=rhs.unused30_6;
 
1189
    eppsEnd=rhs.eppsEnd;
 
1190
    eppwEnd=rhs.eppwEnd;
 
1191
    epplEnd=rhs.epplEnd;
 
1192
    unused32_6=rhs.unused32_6;
 
1193
    shdwpi=rhs.shdwpi;
 
1194
    xaOffset=rhs.xaOffset;
 
1195
    yaOffset=rhs.yaOffset;
 
1196
    fPolygon=rhs.fPolygon;
 
1197
    cpt=rhs.cpt;
 
1198
    xaFirst=rhs.xaFirst;
 
1199
    yaFirst=rhs.yaFirst;
 
1200
    xaEnd=rhs.xaEnd;
 
1201
    yaEnd=rhs.yaEnd;
 
1202
    rgpta=rhs.rgpta;
 
1203
}
 
1204
 
 
1205
DPPOLYLINE::~DPPOLYLINE() {
 
1206
    delete [] rgpta;
 
1207
}
 
1208
 
 
1209
DPPOLYLINE &DPPOLYLINE::operator=(const DPPOLYLINE &rhs) {
 
1210
 
 
1211
    // Check for assignment to self
 
1212
    if(this==&rhs)
 
1213
        return *this;
 
1214
 
 
1215
    dphead=rhs.dphead;
 
1216
    lnpc=rhs.lnpc;
 
1217
    lnpw=rhs.lnpw;
 
1218
    lnps=rhs.lnps;
 
1219
    dlpcFg=rhs.dlpcFg;
 
1220
    dlpcBg=rhs.dlpcBg;
 
1221
    flpp=rhs.flpp;
 
1222
    eppsStart=rhs.eppsStart;
 
1223
    eppwStart=rhs.eppwStart;
 
1224
    epplStart=rhs.epplStart;
 
1225
    unused30_6=rhs.unused30_6;
 
1226
    eppsEnd=rhs.eppsEnd;
 
1227
    eppwEnd=rhs.eppwEnd;
 
1228
    epplEnd=rhs.epplEnd;
 
1229
    unused32_6=rhs.unused32_6;
 
1230
    shdwpi=rhs.shdwpi;
 
1231
    xaOffset=rhs.xaOffset;
 
1232
    yaOffset=rhs.yaOffset;
 
1233
    fPolygon=rhs.fPolygon;
 
1234
    cpt=rhs.cpt;
 
1235
    xaFirst=rhs.xaFirst;
 
1236
    yaFirst=rhs.yaFirst;
 
1237
    xaEnd=rhs.xaEnd;
 
1238
    yaEnd=rhs.yaEnd;
 
1239
    rgpta=rhs.rgpta;
 
1240
 
 
1241
    return *this;
 
1242
}
 
1243
 
 
1244
bool DPPOLYLINE::read(OLEStreamReader *stream, bool preservePos) {
 
1245
 
 
1246
    U16 shifterU16;
 
1247
 
 
1248
    if(preservePos)
 
1249
        stream->push();
 
1250
 
 
1251
    dphead.read(stream, false);
 
1252
    lnpc=stream->readU32();
 
1253
    lnpw=stream->readU16();
 
1254
    lnps=stream->readU16();
 
1255
    dlpcFg=stream->readU32();
 
1256
    dlpcBg=stream->readU32();
 
1257
    flpp=stream->readU16();
 
1258
    shifterU16=stream->readU16();
 
1259
    eppsStart=shifterU16;
 
1260
    shifterU16>>=2;
 
1261
    eppwStart=shifterU16;
 
1262
    shifterU16>>=2;
 
1263
    epplStart=shifterU16;
 
1264
    shifterU16>>=2;
 
1265
    unused30_6=shifterU16;
 
1266
    shifterU16=stream->readU16();
 
1267
    eppsEnd=shifterU16;
 
1268
    shifterU16>>=2;
 
1269
    eppwEnd=shifterU16;
 
1270
    shifterU16>>=2;
 
1271
    epplEnd=shifterU16;
 
1272
    shifterU16>>=2;
 
1273
    unused32_6=shifterU16;
 
1274
    shdwpi=stream->readU16();
 
1275
    xaOffset=stream->readU16();
 
1276
    yaOffset=stream->readU16();
 
1277
    shifterU16=stream->readU16();
 
1278
    fPolygon=shifterU16;
 
1279
    shifterU16>>=1;
 
1280
    cpt=shifterU16;
 
1281
    xaFirst=stream->readU16();
 
1282
    yaFirst=stream->readU16();
 
1283
    xaEnd=stream->readU16();
 
1284
    yaEnd=stream->readU16();
 
1285
    // Attention: I don't know how to read rgpta - U16[]
 
1286
#ifdef __GNUC__
 
1287
#warning "Couldn't generate reading code for DPPOLYLINE::rgpta"
 
1288
#endif
 
1289
 
 
1290
    if(preservePos)
 
1291
        stream->pop();
 
1292
    return true;
 
1293
}
 
1294
 
 
1295
bool DPPOLYLINE::write(OLEStreamWriter *stream, bool preservePos) const {
 
1296
 
 
1297
    U16 shifterU16;
 
1298
 
 
1299
    if(preservePos)
 
1300
        stream->push();
 
1301
 
 
1302
    dphead.write(stream, false);
 
1303
    stream->write(lnpc);
 
1304
    stream->write(lnpw);
 
1305
    stream->write(lnps);
 
1306
    stream->write(dlpcFg);
 
1307
    stream->write(dlpcBg);
 
1308
    stream->write(flpp);
 
1309
    shifterU16=eppsStart;
 
1310
    shifterU16|=eppwStart << 2;
 
1311
    shifterU16|=epplStart << 4;
 
1312
    shifterU16|=unused30_6 << 6;
 
1313
    stream->write(shifterU16);
 
1314
    shifterU16=eppsEnd;
 
1315
    shifterU16|=eppwEnd << 2;
 
1316
    shifterU16|=epplEnd << 4;
 
1317
    shifterU16|=unused32_6 << 6;
 
1318
    stream->write(shifterU16);
 
1319
    stream->write(shdwpi);
 
1320
    stream->write(xaOffset);
 
1321
    stream->write(yaOffset);
 
1322
    shifterU16=fPolygon;
 
1323
    shifterU16|=cpt << 1;
 
1324
    stream->write(shifterU16);
 
1325
    stream->write(xaFirst);
 
1326
    stream->write(yaFirst);
 
1327
    stream->write(xaEnd);
 
1328
    stream->write(yaEnd);
 
1329
    // Attention: I don't know how to write rgpta - U16[]
 
1330
#ifdef __GNUC__
 
1331
#warning "Couldn't generate writing code for DPPOLYLINE::rgpta"
 
1332
#endif
 
1333
 
 
1334
    if(preservePos)
 
1335
        stream->pop();
 
1336
    return true;
 
1337
}
 
1338
 
 
1339
void DPPOLYLINE::clear() {
 
1340
    delete [] rgpta;
 
1341
    clearInternal();
 
1342
}
 
1343
 
 
1344
void DPPOLYLINE::clearInternal() {
 
1345
    dphead.clear();
 
1346
    lnpc=0;
 
1347
    lnpw=0;
 
1348
    lnps=0;
 
1349
    dlpcFg=0;
 
1350
    dlpcBg=0;
 
1351
    flpp=0;
 
1352
    eppsStart=0;
 
1353
    eppwStart=0;
 
1354
    epplStart=0;
 
1355
    unused30_6=0;
 
1356
    eppsEnd=0;
 
1357
    eppwEnd=0;
 
1358
    epplEnd=0;
 
1359
    unused32_6=0;
 
1360
    shdwpi=0;
 
1361
    xaOffset=0;
 
1362
    yaOffset=0;
 
1363
    fPolygon=0;
 
1364
    cpt=0;
 
1365
    xaFirst=0;
 
1366
    yaFirst=0;
 
1367
    xaEnd=0;
 
1368
    yaEnd=0;
 
1369
    rgpta=0;
 
1370
}
 
1371
 
 
1372
bool operator==(const DPPOLYLINE &lhs, const DPPOLYLINE &rhs) {
 
1373
    // Attention: I don't know how to compare rgpta - U16[]
 
1374
#ifdef __GNUC__
 
1375
#warning "Can't compare DPPOLYLINE::rgpta items"
 
1376
#endif
 
1377
 
 
1378
    return lhs.dphead==rhs.dphead &&
 
1379
           lhs.lnpc==rhs.lnpc &&
 
1380
           lhs.lnpw==rhs.lnpw &&
 
1381
           lhs.lnps==rhs.lnps &&
 
1382
           lhs.dlpcFg==rhs.dlpcFg &&
 
1383
           lhs.dlpcBg==rhs.dlpcBg &&
 
1384
           lhs.flpp==rhs.flpp &&
 
1385
           lhs.eppsStart==rhs.eppsStart &&
 
1386
           lhs.eppwStart==rhs.eppwStart &&
 
1387
           lhs.epplStart==rhs.epplStart &&
 
1388
           lhs.unused30_6==rhs.unused30_6 &&
 
1389
           lhs.eppsEnd==rhs.eppsEnd &&
 
1390
           lhs.eppwEnd==rhs.eppwEnd &&
 
1391
           lhs.epplEnd==rhs.epplEnd &&
 
1392
           lhs.unused32_6==rhs.unused32_6 &&
 
1393
           lhs.shdwpi==rhs.shdwpi &&
 
1394
           lhs.xaOffset==rhs.xaOffset &&
 
1395
           lhs.yaOffset==rhs.yaOffset &&
 
1396
           lhs.fPolygon==rhs.fPolygon &&
 
1397
           lhs.cpt==rhs.cpt &&
 
1398
           lhs.xaFirst==rhs.xaFirst &&
 
1399
           lhs.yaFirst==rhs.yaFirst &&
 
1400
           lhs.xaEnd==rhs.xaEnd &&
 
1401
           lhs.yaEnd==rhs.yaEnd;
 
1402
}
 
1403
 
 
1404
bool operator!=(const DPPOLYLINE &lhs, const DPPOLYLINE &rhs) {
 
1405
    return !(lhs==rhs);
 
1406
}
 
1407
 
 
1408
 
 
1409
// TAP implementation
 
1410
 
 
1411
TAP::TAP() : Shared() {
 
1412
    clearInternal();
 
1413
}
 
1414
 
 
1415
TAP::TAP(OLEStreamReader *stream, bool preservePos) : Shared() {
 
1416
    clearInternal();
 
1417
    read(stream, preservePos);
 
1418
}
 
1419
 
 
1420
TAP::TAP(const TAP &rhs) : Shared() {
 
1421
    jc=rhs.jc;
 
1422
    dxaGapHalf=rhs.dxaGapHalf;
 
1423
    dyaRowHeight=rhs.dyaRowHeight;
 
1424
    fCantSplit=rhs.fCantSplit;
 
1425
    fTableHeader=rhs.fTableHeader;
 
1426
    tlp=rhs.tlp;
 
1427
    fCaFull=rhs.fCaFull;
 
1428
    fFirstRow=rhs.fFirstRow;
 
1429
    fLastRow=rhs.fLastRow;
 
1430
    fOutline=rhs.fOutline;
 
1431
    unused12_4=rhs.unused12_4;
 
1432
    itcMac=rhs.itcMac;
 
1433
    dxaAdjust=rhs.dxaAdjust;
 
1434
    rgdxaCenter=new U16[itcMac + 1];
 
1435
    memcpy(rgdxaCenter, rhs.rgdxaCenter, sizeof(U16)*(itcMac + 1));
 
1436
    rgtc=new TC[itcMac];
 
1437
    memcpy(rgtc, rhs.rgtc, sizeof(TC)*(itcMac));
 
1438
    rgshd=new SHD[itcMac];
 
1439
    memcpy(rgshd, rhs.rgshd, sizeof(SHD)*(itcMac));
 
1440
    memcpy(&rgbrcTable, &rhs.rgbrcTable, sizeof(rgbrcTable));
 
1441
}
 
1442
 
 
1443
TAP::~TAP() {
 
1444
    delete [] rgdxaCenter;
 
1445
    delete [] rgtc;
 
1446
    delete [] rgshd;
 
1447
}
 
1448
 
 
1449
TAP &TAP::operator=(const TAP &rhs) {
 
1450
 
 
1451
    // Check for assignment to self
 
1452
    if(this==&rhs)
 
1453
        return *this;
 
1454
 
 
1455
    jc=rhs.jc;
 
1456
    dxaGapHalf=rhs.dxaGapHalf;
 
1457
    dyaRowHeight=rhs.dyaRowHeight;
 
1458
    fCantSplit=rhs.fCantSplit;
 
1459
    fTableHeader=rhs.fTableHeader;
 
1460
    tlp=rhs.tlp;
 
1461
    fCaFull=rhs.fCaFull;
 
1462
    fFirstRow=rhs.fFirstRow;
 
1463
    fLastRow=rhs.fLastRow;
 
1464
    fOutline=rhs.fOutline;
 
1465
    unused12_4=rhs.unused12_4;
 
1466
    itcMac=rhs.itcMac;
 
1467
    dxaAdjust=rhs.dxaAdjust;
 
1468
    delete [] rgdxaCenter;
 
1469
    rgdxaCenter=new U16[itcMac + 1];
 
1470
    memcpy(rgdxaCenter, rhs.rgdxaCenter, sizeof(U16)*(itcMac + 1));
 
1471
    delete [] rgtc;
 
1472
    rgtc=new TC[itcMac];
 
1473
    memcpy(rgtc, rhs.rgtc, sizeof(TC)*(itcMac));
 
1474
    delete [] rgshd;
 
1475
    rgshd=new SHD[itcMac];
 
1476
    memcpy(rgshd, rhs.rgshd, sizeof(SHD)*(itcMac));
 
1477
    memcpy(&rgbrcTable, &rhs.rgbrcTable, sizeof(rgbrcTable));
 
1478
 
 
1479
    return *this;
 
1480
}
 
1481
 
 
1482
bool TAP::read(OLEStreamReader *stream, bool preservePos) {
 
1483
 
 
1484
    U16 shifterU16;
 
1485
 
 
1486
    if(preservePos)
 
1487
        stream->push();
 
1488
 
 
1489
    jc=stream->readU16();
 
1490
    dxaGapHalf=stream->readU16();
 
1491
    dyaRowHeight=stream->readU16();
 
1492
    fCantSplit=stream->readU8();
 
1493
    fTableHeader=stream->readU8();
 
1494
    tlp.read(stream, false);
 
1495
    shifterU16=stream->readU16();
 
1496
    fCaFull=shifterU16;
 
1497
    shifterU16>>=1;
 
1498
    fFirstRow=shifterU16;
 
1499
    shifterU16>>=1;
 
1500
    fLastRow=shifterU16;
 
1501
    shifterU16>>=1;
 
1502
    fOutline=shifterU16;
 
1503
    shifterU16>>=1;
 
1504
    unused12_4=shifterU16;
 
1505
    itcMac=stream->readU16();
 
1506
    dxaAdjust=stream->readU16();
 
1507
    rgdxaCenter=new U16[itcMac + 1];
 
1508
    for(int _i=0; _i<(itcMac + 1); ++_i)
 
1509
        rgdxaCenter[_i]=stream->readU16();
 
1510
    rgtc=new TC[itcMac];
 
1511
    for(int _i=0; _i<(itcMac); ++_i)
 
1512
        rgtc[_i].read(stream, false);
 
1513
    rgshd=new SHD[itcMac];
 
1514
    for(int _i=0; _i<(itcMac); ++_i)
 
1515
        rgshd[_i].read(stream, false);
 
1516
    for(int _i=0; _i<(6); ++_i)
 
1517
        rgbrcTable[_i].read(stream, false);
 
1518
 
 
1519
    if(preservePos)
 
1520
        stream->pop();
 
1521
    return true;
 
1522
}
 
1523
 
 
1524
bool TAP::write(OLEStreamWriter *stream, bool preservePos) const {
 
1525
 
 
1526
    U16 shifterU16;
 
1527
 
 
1528
    if(preservePos)
 
1529
        stream->push();
 
1530
 
 
1531
    stream->write(jc);
 
1532
    stream->write(dxaGapHalf);
 
1533
    stream->write(dyaRowHeight);
 
1534
    stream->write(fCantSplit);
 
1535
    stream->write(fTableHeader);
 
1536
    tlp.write(stream, false);
 
1537
    shifterU16=fCaFull;
 
1538
    shifterU16|=fFirstRow << 1;
 
1539
    shifterU16|=fLastRow << 2;
 
1540
    shifterU16|=fOutline << 3;
 
1541
    shifterU16|=unused12_4 << 4;
 
1542
    stream->write(shifterU16);
 
1543
    stream->write(itcMac);
 
1544
    stream->write(dxaAdjust);
 
1545
    for(int _i=0; _i<(itcMac + 1); ++_i)
 
1546
        stream->write(rgdxaCenter[_i]);
 
1547
    for(int _i=0; _i<(itcMac); ++_i)
 
1548
        rgtc[_i].write(stream, false);
 
1549
    for(int _i=0; _i<(itcMac); ++_i)
 
1550
        rgshd[_i].write(stream, false);
 
1551
    for(int _i=0; _i<(6); ++_i)
 
1552
        rgbrcTable[_i].write(stream, false);
 
1553
 
 
1554
    if(preservePos)
 
1555
        stream->pop();
 
1556
    return true;
 
1557
}
 
1558
 
 
1559
void TAP::clear() {
 
1560
    delete [] rgdxaCenter;
 
1561
    delete [] rgtc;
 
1562
    delete [] rgshd;
 
1563
    clearInternal();
 
1564
}
 
1565
 
 
1566
void TAP::dump() const
 
1567
{
 
1568
    wvlog << "Dumping TAP:" << endl;
 
1569
    wvlog << toString().c_str() << endl;
 
1570
    wvlog << "\nDumping TAP done." << endl;
 
1571
}
 
1572
 
 
1573
std::string TAP::toString() const
 
1574
{
 
1575
    std::string s( "TAP:" );
 
1576
    s += "\njc=";
 
1577
    s += uint2string( jc );
 
1578
    s += "\ndxaGapHalf=";
 
1579
    s += uint2string( dxaGapHalf );
 
1580
    s += "\ndyaRowHeight=";
 
1581
    s += uint2string( dyaRowHeight );
 
1582
    s += "\nfCantSplit=";
 
1583
    s += uint2string( fCantSplit );
 
1584
    s += "\nfTableHeader=";
 
1585
    s += uint2string( fTableHeader );
 
1586
    s += "\ntlp=";
 
1587
    s += "\n{" + tlp.toString() + "}\n";
 
1588
    s += "\nfCaFull=";
 
1589
    s += uint2string( fCaFull );
 
1590
    s += "\nfFirstRow=";
 
1591
    s += uint2string( fFirstRow );
 
1592
    s += "\nfLastRow=";
 
1593
    s += uint2string( fLastRow );
 
1594
    s += "\nfOutline=";
 
1595
    s += uint2string( fOutline );
 
1596
    s += "\nunused12_4=";
 
1597
    s += uint2string( unused12_4 );
 
1598
    s += "\nitcMac=";
 
1599
    s += uint2string( itcMac );
 
1600
    s += "\ndxaAdjust=";
 
1601
    s += uint2string( dxaAdjust );
 
1602
    for(int _i=0; _i<(itcMac + 1); ++_i) {
 
1603
        s += "\nrgdxaCenter[" + int2string( _i ) + "]=";
 
1604
    s += uint2string( rgdxaCenter[_i] );
 
1605
    }
 
1606
    for(int _i=0; _i<(itcMac); ++_i) {
 
1607
        s += "\nrgtc[" + int2string( _i ) + "]=";
 
1608
    s += "\n{" + rgtc[_i].toString() + "}\n";
 
1609
    }
 
1610
    for(int _i=0; _i<(itcMac); ++_i) {
 
1611
        s += "\nrgshd[" + int2string( _i ) + "]=";
 
1612
    s += "\n{" + rgshd[_i].toString() + "}\n";
 
1613
    }
 
1614
    for(int _i=0; _i<(6); ++_i) {
 
1615
        s += "\nrgbrcTable[" + int2string( _i ) + "]=";
 
1616
    s += "\n{" + rgbrcTable[_i].toString() + "}\n";
 
1617
    }
 
1618
    s += "\nTAP Done.";
 
1619
    return s;
 
1620
}
 
1621
 
 
1622
void TAP::clearInternal() {
 
1623
    jc=0;
 
1624
    dxaGapHalf=0;
 
1625
    dyaRowHeight=0;
 
1626
    fCantSplit=0;
 
1627
    fTableHeader=0;
 
1628
    tlp.clear();
 
1629
    fCaFull=0;
 
1630
    fFirstRow=0;
 
1631
    fLastRow=0;
 
1632
    fOutline=0;
 
1633
    unused12_4=0;
 
1634
    itcMac=0;
 
1635
    dxaAdjust=0;
 
1636
    rgdxaCenter=0;
 
1637
    rgtc=0;
 
1638
    rgshd=0;
 
1639
    for(int _i=0; _i<(6); ++_i)
 
1640
        rgbrcTable[_i].clear();
 
1641
}
 
1642
 
 
1643
bool operator==(const TAP &lhs, const TAP &rhs) {
 
1644
 
 
1645
    if((lhs.itcMac)!=(rhs.itcMac))
 
1646
        return false;
 
1647
    for(int _i=0; _i<(lhs.itcMac); ++_i) {
 
1648
        if(lhs.rgdxaCenter[_i]!=rhs.rgdxaCenter[_i])
 
1649
            return false;
 
1650
    }
 
1651
 
 
1652
    if((lhs.itcMac)!=(rhs.itcMac))
 
1653
        return false;
 
1654
    for(int _i=0; _i<(lhs.itcMac); ++_i) {
 
1655
        if(lhs.rgtc[_i]!=rhs.rgtc[_i])
 
1656
            return false;
 
1657
    }
 
1658
 
 
1659
    if((lhs.itcMac)!=(rhs.itcMac))
 
1660
        return false;
 
1661
    for(int _i=0; _i<(lhs.itcMac); ++_i) {
 
1662
        if(lhs.rgshd[_i]!=rhs.rgshd[_i])
 
1663
            return false;
 
1664
    }
 
1665
 
 
1666
    for(int _i=0; _i<(6); ++_i) {
 
1667
        if(lhs.rgbrcTable[_i]!=rhs.rgbrcTable[_i])
 
1668
            return false;
 
1669
    }
 
1670
 
 
1671
    return lhs.jc==rhs.jc &&
 
1672
           lhs.dxaGapHalf==rhs.dxaGapHalf &&
 
1673
           lhs.dyaRowHeight==rhs.dyaRowHeight &&
 
1674
           lhs.fCantSplit==rhs.fCantSplit &&
 
1675
           lhs.fTableHeader==rhs.fTableHeader &&
 
1676
           lhs.tlp==rhs.tlp &&
 
1677
           lhs.fCaFull==rhs.fCaFull &&
 
1678
           lhs.fFirstRow==rhs.fFirstRow &&
 
1679
           lhs.fLastRow==rhs.fLastRow &&
 
1680
           lhs.fOutline==rhs.fOutline &&
 
1681
           lhs.unused12_4==rhs.unused12_4 &&
 
1682
           lhs.itcMac==rhs.itcMac &&
 
1683
           lhs.dxaAdjust==rhs.dxaAdjust;
 
1684
}
 
1685
 
 
1686
bool operator!=(const TAP &lhs, const TAP &rhs) {
 
1687
    return !(lhs==rhs);
 
1688
}
 
1689
 
 
1690
 
 
1691
// ANLD implementation
 
1692
 
 
1693
ANLD::ANLD() {
 
1694
    clear();
 
1695
}
 
1696
 
 
1697
ANLD::ANLD(OLEStreamReader *stream, bool preservePos) {
 
1698
    clear();
 
1699
    read(stream, preservePos);
 
1700
}
 
1701
 
 
1702
ANLD::ANLD(const U8 *ptr) {
 
1703
    clear();
 
1704
    readPtr(ptr);
 
1705
}
 
1706
 
 
1707
bool ANLD::read(OLEStreamReader *stream, bool preservePos) {
 
1708
 
 
1709
    U8 shifterU8;
 
1710
 
 
1711
    if(preservePos)
 
1712
        stream->push();
 
1713
 
 
1714
    nfc=stream->readU8();
 
1715
    cxchTextBefore=stream->readU8();
 
1716
    cxchTextAfter=stream->readU8();
 
1717
    shifterU8=stream->readU8();
 
1718
    jc=shifterU8;
 
1719
    shifterU8>>=2;
 
1720
    fPrev=shifterU8;
 
1721
    shifterU8>>=1;
 
1722
    fHang=shifterU8;
 
1723
    shifterU8>>=1;
 
1724
    fSetBold=shifterU8;
 
1725
    shifterU8>>=1;
 
1726
    fSetItalic=shifterU8;
 
1727
    shifterU8>>=1;
 
1728
    fSetSmallCaps=shifterU8;
 
1729
    shifterU8>>=1;
 
1730
    fSetCaps=shifterU8;
 
1731
    shifterU8=stream->readU8();
 
1732
    fSetStrike=shifterU8;
 
1733
    shifterU8>>=1;
 
1734
    fSetKul=shifterU8;
 
1735
    shifterU8>>=1;
 
1736
    fPrevSpace=shifterU8;
 
1737
    shifterU8>>=1;
 
1738
    fBold=shifterU8;
 
1739
    shifterU8>>=1;
 
1740
    fItalic=shifterU8;
 
1741
    shifterU8>>=1;
 
1742
    fSmallCaps=shifterU8;
 
1743
    shifterU8>>=1;
 
1744
    fCaps=shifterU8;
 
1745
    shifterU8>>=1;
 
1746
    fStrike=shifterU8;
 
1747
    shifterU8=stream->readU8();
 
1748
    kul=shifterU8;
 
1749
    shifterU8>>=3;
 
1750
    ico=shifterU8;
 
1751
    ftc=stream->readS16();
 
1752
    hps=stream->readU16();
 
1753
    iStartAt=stream->readU16();
 
1754
    dxaIndent=stream->readU16();
 
1755
    dxaSpace=stream->readU16();
 
1756
    fNumber1=stream->readU8();
 
1757
    fNumberAcross=stream->readU8();
 
1758
    fRestartHdn=stream->readU8();
 
1759
    fSpareX=stream->readU8();
 
1760
    for(int _i=0; _i<(32); ++_i)
 
1761
        rgchAnld[_i]=stream->readU8();
 
1762
 
 
1763
    if(preservePos)
 
1764
        stream->pop();
 
1765
    return true;
 
1766
}
 
1767
 
 
1768
void ANLD::readPtr(const U8 *ptr) {
 
1769
 
 
1770
    U8 shifterU8;
 
1771
 
 
1772
    nfc=readU8(ptr);
 
1773
    ptr+=sizeof(U8);
 
1774
    cxchTextBefore=readU8(ptr);
 
1775
    ptr+=sizeof(U8);
 
1776
    cxchTextAfter=readU8(ptr);
 
1777
    ptr+=sizeof(U8);
 
1778
    shifterU8=readU8(ptr);
 
1779
    ptr+=sizeof(U8);
 
1780
    jc=shifterU8;
 
1781
    shifterU8>>=2;
 
1782
    fPrev=shifterU8;
 
1783
    shifterU8>>=1;
 
1784
    fHang=shifterU8;
 
1785
    shifterU8>>=1;
 
1786
    fSetBold=shifterU8;
 
1787
    shifterU8>>=1;
 
1788
    fSetItalic=shifterU8;
 
1789
    shifterU8>>=1;
 
1790
    fSetSmallCaps=shifterU8;
 
1791
    shifterU8>>=1;
 
1792
    fSetCaps=shifterU8;
 
1793
    shifterU8=readU8(ptr);
 
1794
    ptr+=sizeof(U8);
 
1795
    fSetStrike=shifterU8;
 
1796
    shifterU8>>=1;
 
1797
    fSetKul=shifterU8;
 
1798
    shifterU8>>=1;
 
1799
    fPrevSpace=shifterU8;
 
1800
    shifterU8>>=1;
 
1801
    fBold=shifterU8;
 
1802
    shifterU8>>=1;
 
1803
    fItalic=shifterU8;
 
1804
    shifterU8>>=1;
 
1805
    fSmallCaps=shifterU8;
 
1806
    shifterU8>>=1;
 
1807
    fCaps=shifterU8;
 
1808
    shifterU8>>=1;
 
1809
    fStrike=shifterU8;
 
1810
    shifterU8=readU8(ptr);
 
1811
    ptr+=sizeof(U8);
 
1812
    kul=shifterU8;
 
1813
    shifterU8>>=3;
 
1814
    ico=shifterU8;
 
1815
    ftc=readS16(ptr);
 
1816
    ptr+=sizeof(S16);
 
1817
    hps=readU16(ptr);
 
1818
    ptr+=sizeof(U16);
 
1819
    iStartAt=readU16(ptr);
 
1820
    ptr+=sizeof(U16);
 
1821
    dxaIndent=readU16(ptr);
 
1822
    ptr+=sizeof(U16);
 
1823
    dxaSpace=readU16(ptr);
 
1824
    ptr+=sizeof(U16);
 
1825
    fNumber1=readU8(ptr);
 
1826
    ptr+=sizeof(U8);
 
1827
    fNumberAcross=readU8(ptr);
 
1828
    ptr+=sizeof(U8);
 
1829
    fRestartHdn=readU8(ptr);
 
1830
    ptr+=sizeof(U8);
 
1831
    fSpareX=readU8(ptr);
 
1832
    ptr+=sizeof(U8);
 
1833
    for(int _i=0; _i<(32); ++_i) {
 
1834
        rgchAnld[_i]=readU8(ptr);
 
1835
        ptr+=sizeof(U8);
 
1836
    }
 
1837
}
 
1838
 
 
1839
bool ANLD::write(OLEStreamWriter *stream, bool preservePos) const {
 
1840
 
 
1841
    U8 shifterU8;
 
1842
 
 
1843
    if(preservePos)
 
1844
        stream->push();
 
1845
 
 
1846
    stream->write(nfc);
 
1847
    stream->write(cxchTextBefore);
 
1848
    stream->write(cxchTextAfter);
 
1849
    shifterU8=jc;
 
1850
    shifterU8|=fPrev << 2;
 
1851
    shifterU8|=fHang << 3;
 
1852
    shifterU8|=fSetBold << 4;
 
1853
    shifterU8|=fSetItalic << 5;
 
1854
    shifterU8|=fSetSmallCaps << 6;
 
1855
    shifterU8|=fSetCaps << 7;
 
1856
    stream->write(shifterU8);
 
1857
    shifterU8=fSetStrike;
 
1858
    shifterU8|=fSetKul << 1;
 
1859
    shifterU8|=fPrevSpace << 2;
 
1860
    shifterU8|=fBold << 3;
 
1861
    shifterU8|=fItalic << 4;
 
1862
    shifterU8|=fSmallCaps << 5;
 
1863
    shifterU8|=fCaps << 6;
 
1864
    shifterU8|=fStrike << 7;
 
1865
    stream->write(shifterU8);
 
1866
    shifterU8=kul;
 
1867
    shifterU8|=ico << 3;
 
1868
    stream->write(shifterU8);
 
1869
    stream->write(ftc);
 
1870
    stream->write(hps);
 
1871
    stream->write(iStartAt);
 
1872
    stream->write(dxaIndent);
 
1873
    stream->write(dxaSpace);
 
1874
    stream->write(fNumber1);
 
1875
    stream->write(fNumberAcross);
 
1876
    stream->write(fRestartHdn);
 
1877
    stream->write(fSpareX);
 
1878
    for(int _i=0; _i<(32); ++_i)
 
1879
        stream->write(rgchAnld[_i]);
 
1880
 
 
1881
    if(preservePos)
 
1882
        stream->pop();
 
1883
    return true;
 
1884
}
 
1885
 
 
1886
void ANLD::clear() {
 
1887
    nfc=0;
 
1888
    cxchTextBefore=0;
 
1889
    cxchTextAfter=0;
 
1890
    jc=0;
 
1891
    fPrev=0;
 
1892
    fHang=0;
 
1893
    fSetBold=0;
 
1894
    fSetItalic=0;
 
1895
    fSetSmallCaps=0;
 
1896
    fSetCaps=0;
 
1897
    fSetStrike=0;
 
1898
    fSetKul=0;
 
1899
    fPrevSpace=0;
 
1900
    fBold=0;
 
1901
    fItalic=0;
 
1902
    fSmallCaps=0;
 
1903
    fCaps=0;
 
1904
    fStrike=0;
 
1905
    kul=0;
 
1906
    ico=0;
 
1907
    ftc=0;
 
1908
    hps=0;
 
1909
    iStartAt=0;
 
1910
    dxaIndent=0;
 
1911
    dxaSpace=0;
 
1912
    fNumber1=0;
 
1913
    fNumberAcross=0;
 
1914
    fRestartHdn=0;
 
1915
    fSpareX=0;
 
1916
    for(int _i=0; _i<(32); ++_i)
 
1917
        rgchAnld[_i]=0;
 
1918
}
 
1919
 
 
1920
void ANLD::dump() const
 
1921
{
 
1922
    wvlog << "Dumping ANLD:" << endl;
 
1923
    wvlog << toString().c_str() << endl;
 
1924
    wvlog << "\nDumping ANLD done." << endl;
 
1925
}
 
1926
 
 
1927
std::string ANLD::toString() const
 
1928
{
 
1929
    std::string s( "ANLD:" );
 
1930
    s += "\nnfc=";
 
1931
    s += uint2string( nfc );
 
1932
    s += "\ncxchTextBefore=";
 
1933
    s += uint2string( cxchTextBefore );
 
1934
    s += "\ncxchTextAfter=";
 
1935
    s += uint2string( cxchTextAfter );
 
1936
    s += "\njc=";
 
1937
    s += uint2string( jc );
 
1938
    s += "\nfPrev=";
 
1939
    s += uint2string( fPrev );
 
1940
    s += "\nfHang=";
 
1941
    s += uint2string( fHang );
 
1942
    s += "\nfSetBold=";
 
1943
    s += uint2string( fSetBold );
 
1944
    s += "\nfSetItalic=";
 
1945
    s += uint2string( fSetItalic );
 
1946
    s += "\nfSetSmallCaps=";
 
1947
    s += uint2string( fSetSmallCaps );
 
1948
    s += "\nfSetCaps=";
 
1949
    s += uint2string( fSetCaps );
 
1950
    s += "\nfSetStrike=";
 
1951
    s += uint2string( fSetStrike );
 
1952
    s += "\nfSetKul=";
 
1953
    s += uint2string( fSetKul );
 
1954
    s += "\nfPrevSpace=";
 
1955
    s += uint2string( fPrevSpace );
 
1956
    s += "\nfBold=";
 
1957
    s += uint2string( fBold );
 
1958
    s += "\nfItalic=";
 
1959
    s += uint2string( fItalic );
 
1960
    s += "\nfSmallCaps=";
 
1961
    s += uint2string( fSmallCaps );
 
1962
    s += "\nfCaps=";
 
1963
    s += uint2string( fCaps );
 
1964
    s += "\nfStrike=";
 
1965
    s += uint2string( fStrike );
 
1966
    s += "\nkul=";
 
1967
    s += uint2string( kul );
 
1968
    s += "\nico=";
 
1969
    s += uint2string( ico );
 
1970
    s += "\nftc=";
 
1971
    s += int2string( ftc );
 
1972
    s += "\nhps=";
 
1973
    s += uint2string( hps );
 
1974
    s += "\niStartAt=";
 
1975
    s += uint2string( iStartAt );
 
1976
    s += "\ndxaIndent=";
 
1977
    s += uint2string( dxaIndent );
 
1978
    s += "\ndxaSpace=";
 
1979
    s += uint2string( dxaSpace );
 
1980
    s += "\nfNumber1=";
 
1981
    s += uint2string( fNumber1 );
 
1982
    s += "\nfNumberAcross=";
 
1983
    s += uint2string( fNumberAcross );
 
1984
    s += "\nfRestartHdn=";
 
1985
    s += uint2string( fRestartHdn );
 
1986
    s += "\nfSpareX=";
 
1987
    s += uint2string( fSpareX );
 
1988
    for(int _i=0; _i<(32); ++_i) {
 
1989
        s += "\nrgchAnld[" + int2string( _i ) + "]=";
 
1990
    s += uint2string( rgchAnld[_i] );
 
1991
    }
 
1992
    s += "\nANLD Done.";
 
1993
    return s;
 
1994
}
 
1995
 
 
1996
bool operator==(const ANLD &lhs, const ANLD &rhs) {
 
1997
 
 
1998
    for(int _i=0; _i<(32); ++_i) {
 
1999
        if(lhs.rgchAnld[_i]!=rhs.rgchAnld[_i])
 
2000
            return false;
 
2001
    }
 
2002
 
 
2003
    return lhs.nfc==rhs.nfc &&
 
2004
           lhs.cxchTextBefore==rhs.cxchTextBefore &&
 
2005
           lhs.cxchTextAfter==rhs.cxchTextAfter &&
 
2006
           lhs.jc==rhs.jc &&
 
2007
           lhs.fPrev==rhs.fPrev &&
 
2008
           lhs.fHang==rhs.fHang &&
 
2009
           lhs.fSetBold==rhs.fSetBold &&
 
2010
           lhs.fSetItalic==rhs.fSetItalic &&
 
2011
           lhs.fSetSmallCaps==rhs.fSetSmallCaps &&
 
2012
           lhs.fSetCaps==rhs.fSetCaps &&
 
2013
           lhs.fSetStrike==rhs.fSetStrike &&
 
2014
           lhs.fSetKul==rhs.fSetKul &&
 
2015
           lhs.fPrevSpace==rhs.fPrevSpace &&
 
2016
           lhs.fBold==rhs.fBold &&
 
2017
           lhs.fItalic==rhs.fItalic &&
 
2018
           lhs.fSmallCaps==rhs.fSmallCaps &&
 
2019
           lhs.fCaps==rhs.fCaps &&
 
2020
           lhs.fStrike==rhs.fStrike &&
 
2021
           lhs.kul==rhs.kul &&
 
2022
           lhs.ico==rhs.ico &&
 
2023
           lhs.ftc==rhs.ftc &&
 
2024
           lhs.hps==rhs.hps &&
 
2025
           lhs.iStartAt==rhs.iStartAt &&
 
2026
           lhs.dxaIndent==rhs.dxaIndent &&
 
2027
           lhs.dxaSpace==rhs.dxaSpace &&
 
2028
           lhs.fNumber1==rhs.fNumber1 &&
 
2029
           lhs.fNumberAcross==rhs.fNumberAcross &&
 
2030
           lhs.fRestartHdn==rhs.fRestartHdn &&
 
2031
           lhs.fSpareX==rhs.fSpareX;
 
2032
}
 
2033
 
 
2034
bool operator!=(const ANLD &lhs, const ANLD &rhs) {
 
2035
    return !(lhs==rhs);
 
2036
}
 
2037
 
 
2038
 
 
2039
// ANLV implementation
 
2040
 
 
2041
const unsigned int ANLV::sizeOf = 16;
 
2042
 
 
2043
ANLV::ANLV() {
 
2044
    clear();
 
2045
}
 
2046
 
 
2047
ANLV::ANLV(OLEStreamReader *stream, bool preservePos) {
 
2048
    clear();
 
2049
    read(stream, preservePos);
 
2050
}
 
2051
 
 
2052
ANLV::ANLV(const U8 *ptr) {
 
2053
    clear();
 
2054
    readPtr(ptr);
 
2055
}
 
2056
 
 
2057
bool ANLV::read(OLEStreamReader *stream, bool preservePos) {
 
2058
 
 
2059
    U8 shifterU8;
 
2060
 
 
2061
    if(preservePos)
 
2062
        stream->push();
 
2063
 
 
2064
    nfc=stream->readU8();
 
2065
    cxchTextBefore=stream->readU8();
 
2066
    cxchTextAfter=stream->readU8();
 
2067
    shifterU8=stream->readU8();
 
2068
    jc=shifterU8;
 
2069
    shifterU8>>=2;
 
2070
    fPrev=shifterU8;
 
2071
    shifterU8>>=1;
 
2072
    fHang=shifterU8;
 
2073
    shifterU8>>=1;
 
2074
    fSetBold=shifterU8;
 
2075
    shifterU8>>=1;
 
2076
    fSetItalic=shifterU8;
 
2077
    shifterU8>>=1;
 
2078
    fSetSmallCaps=shifterU8;
 
2079
    shifterU8>>=1;
 
2080
    fSetCaps=shifterU8;
 
2081
    shifterU8=stream->readU8();
 
2082
    fSetStrike=shifterU8;
 
2083
    shifterU8>>=1;
 
2084
    fSetKul=shifterU8;
 
2085
    shifterU8>>=1;
 
2086
    fPrevSpace=shifterU8;
 
2087
    shifterU8>>=1;
 
2088
    fBold=shifterU8;
 
2089
    shifterU8>>=1;
 
2090
    fItalic=shifterU8;
 
2091
    shifterU8>>=1;
 
2092
    fSmallCaps=shifterU8;
 
2093
    shifterU8>>=1;
 
2094
    fCaps=shifterU8;
 
2095
    shifterU8>>=1;
 
2096
    fStrike=shifterU8;
 
2097
    shifterU8=stream->readU8();
 
2098
    kul=shifterU8;
 
2099
    shifterU8>>=3;
 
2100
    ico=shifterU8;
 
2101
    ftc=stream->readS16();
 
2102
    hps=stream->readU16();
 
2103
    iStartAt=stream->readU16();
 
2104
    dxaIndent=stream->readU16();
 
2105
    dxaSpace=stream->readU16();
 
2106
 
 
2107
    if(preservePos)
 
2108
        stream->pop();
 
2109
    return true;
 
2110
}
 
2111
 
 
2112
void ANLV::readPtr(const U8 *ptr) {
 
2113
 
 
2114
    U8 shifterU8;
 
2115
 
 
2116
    nfc=readU8(ptr);
 
2117
    ptr+=sizeof(U8);
 
2118
    cxchTextBefore=readU8(ptr);
 
2119
    ptr+=sizeof(U8);
 
2120
    cxchTextAfter=readU8(ptr);
 
2121
    ptr+=sizeof(U8);
 
2122
    shifterU8=readU8(ptr);
 
2123
    ptr+=sizeof(U8);
 
2124
    jc=shifterU8;
 
2125
    shifterU8>>=2;
 
2126
    fPrev=shifterU8;
 
2127
    shifterU8>>=1;
 
2128
    fHang=shifterU8;
 
2129
    shifterU8>>=1;
 
2130
    fSetBold=shifterU8;
 
2131
    shifterU8>>=1;
 
2132
    fSetItalic=shifterU8;
 
2133
    shifterU8>>=1;
 
2134
    fSetSmallCaps=shifterU8;
 
2135
    shifterU8>>=1;
 
2136
    fSetCaps=shifterU8;
 
2137
    shifterU8=readU8(ptr);
 
2138
    ptr+=sizeof(U8);
 
2139
    fSetStrike=shifterU8;
 
2140
    shifterU8>>=1;
 
2141
    fSetKul=shifterU8;
 
2142
    shifterU8>>=1;
 
2143
    fPrevSpace=shifterU8;
 
2144
    shifterU8>>=1;
 
2145
    fBold=shifterU8;
 
2146
    shifterU8>>=1;
 
2147
    fItalic=shifterU8;
 
2148
    shifterU8>>=1;
 
2149
    fSmallCaps=shifterU8;
 
2150
    shifterU8>>=1;
 
2151
    fCaps=shifterU8;
 
2152
    shifterU8>>=1;
 
2153
    fStrike=shifterU8;
 
2154
    shifterU8=readU8(ptr);
 
2155
    ptr+=sizeof(U8);
 
2156
    kul=shifterU8;
 
2157
    shifterU8>>=3;
 
2158
    ico=shifterU8;
 
2159
    ftc=readS16(ptr);
 
2160
    ptr+=sizeof(S16);
 
2161
    hps=readU16(ptr);
 
2162
    ptr+=sizeof(U16);
 
2163
    iStartAt=readU16(ptr);
 
2164
    ptr+=sizeof(U16);
 
2165
    dxaIndent=readU16(ptr);
 
2166
    ptr+=sizeof(U16);
 
2167
    dxaSpace=readU16(ptr);
 
2168
    ptr+=sizeof(U16);
 
2169
}
 
2170
 
 
2171
bool ANLV::write(OLEStreamWriter *stream, bool preservePos) const {
 
2172
 
 
2173
    U8 shifterU8;
 
2174
 
 
2175
    if(preservePos)
 
2176
        stream->push();
 
2177
 
 
2178
    stream->write(nfc);
 
2179
    stream->write(cxchTextBefore);
 
2180
    stream->write(cxchTextAfter);
 
2181
    shifterU8=jc;
 
2182
    shifterU8|=fPrev << 2;
 
2183
    shifterU8|=fHang << 3;
 
2184
    shifterU8|=fSetBold << 4;
 
2185
    shifterU8|=fSetItalic << 5;
 
2186
    shifterU8|=fSetSmallCaps << 6;
 
2187
    shifterU8|=fSetCaps << 7;
 
2188
    stream->write(shifterU8);
 
2189
    shifterU8=fSetStrike;
 
2190
    shifterU8|=fSetKul << 1;
 
2191
    shifterU8|=fPrevSpace << 2;
 
2192
    shifterU8|=fBold << 3;
 
2193
    shifterU8|=fItalic << 4;
 
2194
    shifterU8|=fSmallCaps << 5;
 
2195
    shifterU8|=fCaps << 6;
 
2196
    shifterU8|=fStrike << 7;
 
2197
    stream->write(shifterU8);
 
2198
    shifterU8=kul;
 
2199
    shifterU8|=ico << 3;
 
2200
    stream->write(shifterU8);
 
2201
    stream->write(ftc);
 
2202
    stream->write(hps);
 
2203
    stream->write(iStartAt);
 
2204
    stream->write(dxaIndent);
 
2205
    stream->write(dxaSpace);
 
2206
 
 
2207
    if(preservePos)
 
2208
        stream->pop();
 
2209
    return true;
 
2210
}
 
2211
 
 
2212
void ANLV::clear() {
 
2213
    nfc=0;
 
2214
    cxchTextBefore=0;
 
2215
    cxchTextAfter=0;
 
2216
    jc=0;
 
2217
    fPrev=0;
 
2218
    fHang=0;
 
2219
    fSetBold=0;
 
2220
    fSetItalic=0;
 
2221
    fSetSmallCaps=0;
 
2222
    fSetCaps=0;
 
2223
    fSetStrike=0;
 
2224
    fSetKul=0;
 
2225
    fPrevSpace=0;
 
2226
    fBold=0;
 
2227
    fItalic=0;
 
2228
    fSmallCaps=0;
 
2229
    fCaps=0;
 
2230
    fStrike=0;
 
2231
    kul=0;
 
2232
    ico=0;
 
2233
    ftc=0;
 
2234
    hps=0;
 
2235
    iStartAt=0;
 
2236
    dxaIndent=0;
 
2237
    dxaSpace=0;
 
2238
}
 
2239
 
 
2240
void ANLV::dump() const
 
2241
{
 
2242
    wvlog << "Dumping ANLV:" << endl;
 
2243
    wvlog << toString().c_str() << endl;
 
2244
    wvlog << "\nDumping ANLV done." << endl;
 
2245
}
 
2246
 
 
2247
std::string ANLV::toString() const
 
2248
{
 
2249
    std::string s( "ANLV:" );
 
2250
    s += "\nnfc=";
 
2251
    s += uint2string( nfc );
 
2252
    s += "\ncxchTextBefore=";
 
2253
    s += uint2string( cxchTextBefore );
 
2254
    s += "\ncxchTextAfter=";
 
2255
    s += uint2string( cxchTextAfter );
 
2256
    s += "\njc=";
 
2257
    s += uint2string( jc );
 
2258
    s += "\nfPrev=";
 
2259
    s += uint2string( fPrev );
 
2260
    s += "\nfHang=";
 
2261
    s += uint2string( fHang );
 
2262
    s += "\nfSetBold=";
 
2263
    s += uint2string( fSetBold );
 
2264
    s += "\nfSetItalic=";
 
2265
    s += uint2string( fSetItalic );
 
2266
    s += "\nfSetSmallCaps=";
 
2267
    s += uint2string( fSetSmallCaps );
 
2268
    s += "\nfSetCaps=";
 
2269
    s += uint2string( fSetCaps );
 
2270
    s += "\nfSetStrike=";
 
2271
    s += uint2string( fSetStrike );
 
2272
    s += "\nfSetKul=";
 
2273
    s += uint2string( fSetKul );
 
2274
    s += "\nfPrevSpace=";
 
2275
    s += uint2string( fPrevSpace );
 
2276
    s += "\nfBold=";
 
2277
    s += uint2string( fBold );
 
2278
    s += "\nfItalic=";
 
2279
    s += uint2string( fItalic );
 
2280
    s += "\nfSmallCaps=";
 
2281
    s += uint2string( fSmallCaps );
 
2282
    s += "\nfCaps=";
 
2283
    s += uint2string( fCaps );
 
2284
    s += "\nfStrike=";
 
2285
    s += uint2string( fStrike );
 
2286
    s += "\nkul=";
 
2287
    s += uint2string( kul );
 
2288
    s += "\nico=";
 
2289
    s += uint2string( ico );
 
2290
    s += "\nftc=";
 
2291
    s += int2string( ftc );
 
2292
    s += "\nhps=";
 
2293
    s += uint2string( hps );
 
2294
    s += "\niStartAt=";
 
2295
    s += uint2string( iStartAt );
 
2296
    s += "\ndxaIndent=";
 
2297
    s += uint2string( dxaIndent );
 
2298
    s += "\ndxaSpace=";
 
2299
    s += uint2string( dxaSpace );
 
2300
    s += "\nANLV Done.";
 
2301
    return s;
 
2302
}
 
2303
 
 
2304
bool operator==(const ANLV &lhs, const ANLV &rhs) {
 
2305
 
 
2306
    return lhs.nfc==rhs.nfc &&
 
2307
           lhs.cxchTextBefore==rhs.cxchTextBefore &&
 
2308
           lhs.cxchTextAfter==rhs.cxchTextAfter &&
 
2309
           lhs.jc==rhs.jc &&
 
2310
           lhs.fPrev==rhs.fPrev &&
 
2311
           lhs.fHang==rhs.fHang &&
 
2312
           lhs.fSetBold==rhs.fSetBold &&
 
2313
           lhs.fSetItalic==rhs.fSetItalic &&
 
2314
           lhs.fSetSmallCaps==rhs.fSetSmallCaps &&
 
2315
           lhs.fSetCaps==rhs.fSetCaps &&
 
2316
           lhs.fSetStrike==rhs.fSetStrike &&
 
2317
           lhs.fSetKul==rhs.fSetKul &&
 
2318
           lhs.fPrevSpace==rhs.fPrevSpace &&
 
2319
           lhs.fBold==rhs.fBold &&
 
2320
           lhs.fItalic==rhs.fItalic &&
 
2321
           lhs.fSmallCaps==rhs.fSmallCaps &&
 
2322
           lhs.fCaps==rhs.fCaps &&
 
2323
           lhs.fStrike==rhs.fStrike &&
 
2324
           lhs.kul==rhs.kul &&
 
2325
           lhs.ico==rhs.ico &&
 
2326
           lhs.ftc==rhs.ftc &&
 
2327
           lhs.hps==rhs.hps &&
 
2328
           lhs.iStartAt==rhs.iStartAt &&
 
2329
           lhs.dxaIndent==rhs.dxaIndent &&
 
2330
           lhs.dxaSpace==rhs.dxaSpace;
 
2331
}
 
2332
 
 
2333
bool operator!=(const ANLV &lhs, const ANLV &rhs) {
 
2334
    return !(lhs==rhs);
 
2335
}
 
2336
 
 
2337
 
 
2338
// BKF implementation
 
2339
 
 
2340
BKF::BKF() {
 
2341
    clear();
 
2342
}
 
2343
 
 
2344
BKF::BKF(OLEStreamReader *stream, bool preservePos) {
 
2345
    clear();
 
2346
    read(stream, preservePos);
 
2347
}
 
2348
 
 
2349
bool BKF::read(OLEStreamReader *stream, bool preservePos) {
 
2350
 
 
2351
    U16 shifterU16;
 
2352
 
 
2353
    if(preservePos)
 
2354
        stream->push();
 
2355
 
 
2356
    ibkl=stream->readS16();
 
2357
    shifterU16=stream->readU16();
 
2358
    itcFirst=shifterU16;
 
2359
    shifterU16>>=7;
 
2360
    fPub=shifterU16;
 
2361
    shifterU16>>=1;
 
2362
    itcLim=shifterU16;
 
2363
    shifterU16>>=7;
 
2364
    fCol=shifterU16;
 
2365
 
 
2366
    if(preservePos)
 
2367
        stream->pop();
 
2368
    return true;
 
2369
}
 
2370
 
 
2371
bool BKF::write(OLEStreamWriter *stream, bool preservePos) const {
 
2372
 
 
2373
    U16 shifterU16;
 
2374
 
 
2375
    if(preservePos)
 
2376
        stream->push();
 
2377
 
 
2378
    stream->write(ibkl);
 
2379
    shifterU16=itcFirst;
 
2380
    shifterU16|=fPub << 7;
 
2381
    shifterU16|=itcLim << 8;
 
2382
    shifterU16|=fCol << 15;
 
2383
    stream->write(shifterU16);
 
2384
 
 
2385
    if(preservePos)
 
2386
        stream->pop();
 
2387
    return true;
 
2388
}
 
2389
 
 
2390
void BKF::clear() {
 
2391
    ibkl=0;
 
2392
    itcFirst=0;
 
2393
    fPub=0;
 
2394
    itcLim=0;
 
2395
    fCol=0;
 
2396
}
 
2397
 
 
2398
bool operator==(const BKF &lhs, const BKF &rhs) {
 
2399
 
 
2400
    return lhs.ibkl==rhs.ibkl &&
 
2401
           lhs.itcFirst==rhs.itcFirst &&
 
2402
           lhs.fPub==rhs.fPub &&
 
2403
           lhs.itcLim==rhs.itcLim &&
 
2404
           lhs.fCol==rhs.fCol;
 
2405
}
 
2406
 
 
2407
bool operator!=(const BKF &lhs, const BKF &rhs) {
 
2408
    return !(lhs==rhs);
 
2409
}
 
2410
 
 
2411
 
 
2412
// BKL implementation
 
2413
 
 
2414
BKL::BKL() {
 
2415
    clear();
 
2416
}
 
2417
 
 
2418
BKL::BKL(OLEStreamReader *stream, bool preservePos) {
 
2419
    clear();
 
2420
    read(stream, preservePos);
 
2421
}
 
2422
 
 
2423
bool BKL::read(OLEStreamReader *stream, bool preservePos) {
 
2424
 
 
2425
    if(preservePos)
 
2426
        stream->push();
 
2427
 
 
2428
    ibkf=stream->readS16();
 
2429
 
 
2430
    if(preservePos)
 
2431
        stream->pop();
 
2432
    return true;
 
2433
}
 
2434
 
 
2435
bool BKL::write(OLEStreamWriter *stream, bool preservePos) const {
 
2436
 
 
2437
    if(preservePos)
 
2438
        stream->push();
 
2439
 
 
2440
    stream->write(ibkf);
 
2441
 
 
2442
    if(preservePos)
 
2443
        stream->pop();
 
2444
    return true;
 
2445
}
 
2446
 
 
2447
void BKL::clear() {
 
2448
    ibkf=0;
 
2449
}
 
2450
 
 
2451
bool operator==(const BKL &lhs, const BKL &rhs) {
 
2452
 
 
2453
    return lhs.ibkf==rhs.ibkf;
 
2454
}
 
2455
 
 
2456
bool operator!=(const BKL &lhs, const BKL &rhs) {
 
2457
    return !(lhs==rhs);
 
2458
}
 
2459
 
 
2460
 
 
2461
// BRC10 implementation
 
2462
 
 
2463
BRC10::BRC10() {
 
2464
    clear();
 
2465
}
 
2466
 
 
2467
BRC10::BRC10(OLEStreamReader *stream, bool preservePos) {
 
2468
    clear();
 
2469
    read(stream, preservePos);
 
2470
}
 
2471
 
 
2472
bool BRC10::read(OLEStreamReader *stream, bool preservePos) {
 
2473
 
 
2474
    U16 shifterU16;
 
2475
 
 
2476
    if(preservePos)
 
2477
        stream->push();
 
2478
 
 
2479
    shifterU16=stream->readU16();
 
2480
    dxpLine2Width=shifterU16;
 
2481
    shifterU16>>=3;
 
2482
    dxpSpaceBetween=shifterU16;
 
2483
    shifterU16>>=3;
 
2484
    dxpLine1Width=shifterU16;
 
2485
    shifterU16>>=3;
 
2486
    dxpSpace=shifterU16;
 
2487
    shifterU16>>=5;
 
2488
    fShadow=shifterU16;
 
2489
    shifterU16>>=1;
 
2490
    fSpare=shifterU16;
 
2491
 
 
2492
    if(preservePos)
 
2493
        stream->pop();
 
2494
    return true;
 
2495
}
 
2496
 
 
2497
bool BRC10::write(OLEStreamWriter *stream, bool preservePos) const {
 
2498
 
 
2499
    U16 shifterU16;
 
2500
 
 
2501
    if(preservePos)
 
2502
        stream->push();
 
2503
 
 
2504
    shifterU16=dxpLine2Width;
 
2505
    shifterU16|=dxpSpaceBetween << 3;
 
2506
    shifterU16|=dxpLine1Width << 6;
 
2507
    shifterU16|=dxpSpace << 9;
 
2508
    shifterU16|=fShadow << 14;
 
2509
    shifterU16|=fSpare << 15;
 
2510
    stream->write(shifterU16);
 
2511
 
 
2512
    if(preservePos)
 
2513
        stream->pop();
 
2514
    return true;
 
2515
}
 
2516
 
 
2517
void BRC10::clear() {
 
2518
    dxpLine2Width=0;
 
2519
    dxpSpaceBetween=0;
 
2520
    dxpLine1Width=0;
 
2521
    dxpSpace=0;
 
2522
    fShadow=0;
 
2523
    fSpare=0;
 
2524
}
 
2525
 
 
2526
bool operator==(const BRC10 &lhs, const BRC10 &rhs) {
 
2527
 
 
2528
    return lhs.dxpLine2Width==rhs.dxpLine2Width &&
 
2529
           lhs.dxpSpaceBetween==rhs.dxpSpaceBetween &&
 
2530
           lhs.dxpLine1Width==rhs.dxpLine1Width &&
 
2531
           lhs.dxpSpace==rhs.dxpSpace &&
 
2532
           lhs.fShadow==rhs.fShadow &&
 
2533
           lhs.fSpare==rhs.fSpare;
 
2534
}
 
2535
 
 
2536
bool operator!=(const BRC10 &lhs, const BRC10 &rhs) {
 
2537
    return !(lhs==rhs);
 
2538
}
 
2539
 
 
2540
 
 
2541
// BTE implementation
 
2542
 
 
2543
const unsigned int BTE::sizeOf = 2;
 
2544
 
 
2545
BTE::BTE() {
 
2546
    clear();
 
2547
}
 
2548
 
 
2549
BTE::BTE(OLEStreamReader *stream, bool preservePos) {
 
2550
    clear();
 
2551
    read(stream, preservePos);
 
2552
}
 
2553
 
 
2554
bool BTE::read(OLEStreamReader *stream, bool preservePos) {
 
2555
 
 
2556
    if(preservePos)
 
2557
        stream->push();
 
2558
 
 
2559
    pn=stream->readU16();
 
2560
 
 
2561
    if(preservePos)
 
2562
        stream->pop();
 
2563
    return true;
 
2564
}
 
2565
 
 
2566
bool BTE::write(OLEStreamWriter *stream, bool preservePos) const {
 
2567
 
 
2568
    if(preservePos)
 
2569
        stream->push();
 
2570
 
 
2571
    stream->write(pn);
 
2572
 
 
2573
    if(preservePos)
 
2574
        stream->pop();
 
2575
    return true;
 
2576
}
 
2577
 
 
2578
void BTE::clear() {
 
2579
    pn=0;
 
2580
}
 
2581
 
 
2582
bool operator==(const BTE &lhs, const BTE &rhs) {
 
2583
 
 
2584
    return lhs.pn==rhs.pn;
 
2585
}
 
2586
 
 
2587
bool operator!=(const BTE &lhs, const BTE &rhs) {
 
2588
    return !(lhs==rhs);
 
2589
}
 
2590
 
 
2591
 
 
2592
// CHP implementation
 
2593
 
 
2594
CHP::CHP() : Shared() {
 
2595
    clear();
 
2596
}
 
2597
 
 
2598
CHP::CHP(OLEStreamReader *stream, bool preservePos) : Shared() {
 
2599
    clear();
 
2600
    read(stream, preservePos);
 
2601
}
 
2602
 
 
2603
bool CHP::read(OLEStreamReader *stream, bool preservePos) {
 
2604
 
 
2605
    U8 shifterU8;
 
2606
 
 
2607
    if(preservePos)
 
2608
        stream->push();
 
2609
 
 
2610
    shifterU8=stream->readU8();
 
2611
    fBold=shifterU8;
 
2612
    shifterU8>>=1;
 
2613
    fItalic=shifterU8;
 
2614
    shifterU8>>=1;
 
2615
    fRMarkDel=shifterU8;
 
2616
    shifterU8>>=1;
 
2617
    fOutline=shifterU8;
 
2618
    shifterU8>>=1;
 
2619
    fFldVanish=shifterU8;
 
2620
    shifterU8>>=1;
 
2621
    fSmallCaps=shifterU8;
 
2622
    shifterU8>>=1;
 
2623
    fCaps=shifterU8;
 
2624
    shifterU8>>=1;
 
2625
    fVanish=shifterU8;
 
2626
    shifterU8=stream->readU8();
 
2627
    fRMark=shifterU8;
 
2628
    shifterU8>>=1;
 
2629
    fSpec=shifterU8;
 
2630
    shifterU8>>=1;
 
2631
    fStrike=shifterU8;
 
2632
    shifterU8>>=1;
 
2633
    fObj=shifterU8;
 
2634
    shifterU8>>=1;
 
2635
    fShadow=shifterU8;
 
2636
    shifterU8>>=1;
 
2637
    fLowerCase=shifterU8;
 
2638
    shifterU8>>=1;
 
2639
    fData=shifterU8;
 
2640
    shifterU8>>=1;
 
2641
    fOle2=shifterU8;
 
2642
    unused2=stream->readU16();
 
2643
    ftc=stream->readU16();
 
2644
    hps=stream->readU16();
 
2645
    dxaSpace=stream->readU16();
 
2646
    shifterU8=stream->readU8();
 
2647
    iss=shifterU8;
 
2648
    shifterU8>>=3;
 
2649
    unused10_3=shifterU8;
 
2650
    shifterU8>>=3;
 
2651
    fSysVanish=shifterU8;
 
2652
    shifterU8>>=1;
 
2653
    unused10_7=shifterU8;
 
2654
    shifterU8=stream->readU8();
 
2655
    ico=shifterU8;
 
2656
    shifterU8>>=5;
 
2657
    kul=shifterU8;
 
2658
    hpsPos=stream->readS16();
 
2659
    lid=stream->readU16();
 
2660
    fcPic_fcObj_lTagObj=stream->readU32();
 
2661
    ibstRMark=stream->readU16();
 
2662
    dttmRMark.read(stream, false);
 
2663
    unused26=stream->readU16();
 
2664
    istd=stream->readU16();
 
2665
    ftcSym=stream->readU16();
 
2666
    chSym=stream->readU8();
 
2667
    fChsDiff=stream->readU8();
 
2668
    idslRMReason=stream->readU16();
 
2669
    ysr=stream->readU8();
 
2670
    chYsr=stream->readU8();
 
2671
    chse=stream->readU16();
 
2672
    hpsKern=stream->readU16();
 
2673
 
 
2674
    if(preservePos)
 
2675
        stream->pop();
 
2676
    return true;
 
2677
}
 
2678
 
 
2679
bool CHP::write(OLEStreamWriter *stream, bool preservePos) const {
 
2680
 
 
2681
    U8 shifterU8;
 
2682
 
 
2683
    if(preservePos)
 
2684
        stream->push();
 
2685
 
 
2686
    shifterU8=fBold;
 
2687
    shifterU8|=fItalic << 1;
 
2688
    shifterU8|=fRMarkDel << 2;
 
2689
    shifterU8|=fOutline << 3;
 
2690
    shifterU8|=fFldVanish << 4;
 
2691
    shifterU8|=fSmallCaps << 5;
 
2692
    shifterU8|=fCaps << 6;
 
2693
    shifterU8|=fVanish << 7;
 
2694
    stream->write(shifterU8);
 
2695
    shifterU8=fRMark;
 
2696
    shifterU8|=fSpec << 1;
 
2697
    shifterU8|=fStrike << 2;
 
2698
    shifterU8|=fObj << 3;
 
2699
    shifterU8|=fShadow << 4;
 
2700
    shifterU8|=fLowerCase << 5;
 
2701
    shifterU8|=fData << 6;
 
2702
    shifterU8|=fOle2 << 7;
 
2703
    stream->write(shifterU8);
 
2704
    stream->write(unused2);
 
2705
    stream->write(ftc);
 
2706
    stream->write(hps);
 
2707
    stream->write(dxaSpace);
 
2708
    shifterU8=iss;
 
2709
    shifterU8|=unused10_3 << 3;
 
2710
    shifterU8|=fSysVanish << 6;
 
2711
    shifterU8|=unused10_7 << 7;
 
2712
    stream->write(shifterU8);
 
2713
    shifterU8=ico;
 
2714
    shifterU8|=kul << 5;
 
2715
    stream->write(shifterU8);
 
2716
    stream->write(hpsPos);
 
2717
    stream->write(lid);
 
2718
    stream->write(fcPic_fcObj_lTagObj);
 
2719
    stream->write(ibstRMark);
 
2720
    dttmRMark.write(stream, false);
 
2721
    stream->write(unused26);
 
2722
    stream->write(istd);
 
2723
    stream->write(ftcSym);
 
2724
    stream->write(chSym);
 
2725
    stream->write(fChsDiff);
 
2726
    stream->write(idslRMReason);
 
2727
    stream->write(ysr);
 
2728
    stream->write(chYsr);
 
2729
    stream->write(chse);
 
2730
    stream->write(hpsKern);
 
2731
 
 
2732
    if(preservePos)
 
2733
        stream->pop();
 
2734
    return true;
 
2735
}
 
2736
 
 
2737
void CHP::clear() {
 
2738
    fBold=0;
 
2739
    fItalic=0;
 
2740
    fRMarkDel=0;
 
2741
    fOutline=0;
 
2742
    fFldVanish=0;
 
2743
    fSmallCaps=0;
 
2744
    fCaps=0;
 
2745
    fVanish=0;
 
2746
    fRMark=0;
 
2747
    fSpec=0;
 
2748
    fStrike=0;
 
2749
    fObj=0;
 
2750
    fShadow=0;
 
2751
    fLowerCase=0;
 
2752
    fData=0;
 
2753
    fOle2=0;
 
2754
    unused2=0;
 
2755
    ftc=0;
 
2756
    hps=0;
 
2757
    dxaSpace=0;
 
2758
    iss=0;
 
2759
    unused10_3=0;
 
2760
    fSysVanish=0;
 
2761
    unused10_7=0;
 
2762
    ico=0;
 
2763
    kul=0;
 
2764
    hpsPos=0;
 
2765
    lid=0;
 
2766
    fcPic_fcObj_lTagObj=0;
 
2767
    ibstRMark=0;
 
2768
    dttmRMark.clear();
 
2769
    unused26=0;
 
2770
    istd=0;
 
2771
    ftcSym=0;
 
2772
    chSym=0;
 
2773
    fChsDiff=0;
 
2774
    idslRMReason=0;
 
2775
    ysr=0;
 
2776
    chYsr=0;
 
2777
    chse=0;
 
2778
    hpsKern=0;
 
2779
}
 
2780
 
 
2781
void CHP::dump() const
 
2782
{
 
2783
    wvlog << "Dumping CHP:" << endl;
 
2784
    wvlog << toString().c_str() << endl;
 
2785
    wvlog << "\nDumping CHP done." << endl;
 
2786
}
 
2787
 
 
2788
std::string CHP::toString() const
 
2789
{
 
2790
    std::string s( "CHP:" );
 
2791
    s += "\nfBold=";
 
2792
    s += uint2string( fBold );
 
2793
    s += "\nfItalic=";
 
2794
    s += uint2string( fItalic );
 
2795
    s += "\nfRMarkDel=";
 
2796
    s += uint2string( fRMarkDel );
 
2797
    s += "\nfOutline=";
 
2798
    s += uint2string( fOutline );
 
2799
    s += "\nfFldVanish=";
 
2800
    s += uint2string( fFldVanish );
 
2801
    s += "\nfSmallCaps=";
 
2802
    s += uint2string( fSmallCaps );
 
2803
    s += "\nfCaps=";
 
2804
    s += uint2string( fCaps );
 
2805
    s += "\nfVanish=";
 
2806
    s += uint2string( fVanish );
 
2807
    s += "\nfRMark=";
 
2808
    s += uint2string( fRMark );
 
2809
    s += "\nfSpec=";
 
2810
    s += uint2string( fSpec );
 
2811
    s += "\nfStrike=";
 
2812
    s += uint2string( fStrike );
 
2813
    s += "\nfObj=";
 
2814
    s += uint2string( fObj );
 
2815
    s += "\nfShadow=";
 
2816
    s += uint2string( fShadow );
 
2817
    s += "\nfLowerCase=";
 
2818
    s += uint2string( fLowerCase );
 
2819
    s += "\nfData=";
 
2820
    s += uint2string( fData );
 
2821
    s += "\nfOle2=";
 
2822
    s += uint2string( fOle2 );
 
2823
    s += "\nunused2=";
 
2824
    s += uint2string( unused2 );
 
2825
    s += "\nftc=";
 
2826
    s += uint2string( ftc );
 
2827
    s += "\nhps=";
 
2828
    s += uint2string( hps );
 
2829
    s += "\ndxaSpace=";
 
2830
    s += uint2string( dxaSpace );
 
2831
    s += "\niss=";
 
2832
    s += uint2string( iss );
 
2833
    s += "\nunused10_3=";
 
2834
    s += uint2string( unused10_3 );
 
2835
    s += "\nfSysVanish=";
 
2836
    s += uint2string( fSysVanish );
 
2837
    s += "\nunused10_7=";
 
2838
    s += uint2string( unused10_7 );
 
2839
    s += "\nico=";
 
2840
    s += uint2string( ico );
 
2841
    s += "\nkul=";
 
2842
    s += uint2string( kul );
 
2843
    s += "\nhpsPos=";
 
2844
    s += int2string( hpsPos );
 
2845
    s += "\nlid=";
 
2846
    s += uint2string( lid );
 
2847
    s += "\nfcPic_fcObj_lTagObj=";
 
2848
    s += uint2string( fcPic_fcObj_lTagObj );
 
2849
    s += "\nibstRMark=";
 
2850
    s += uint2string( ibstRMark );
 
2851
    s += "\ndttmRMark=";
 
2852
    s += "\n{" + dttmRMark.toString() + "}\n";
 
2853
    s += "\nunused26=";
 
2854
    s += uint2string( unused26 );
 
2855
    s += "\nistd=";
 
2856
    s += uint2string( istd );
 
2857
    s += "\nftcSym=";
 
2858
    s += uint2string( ftcSym );
 
2859
    s += "\nchSym=";
 
2860
    s += uint2string( chSym );
 
2861
    s += "\nfChsDiff=";
 
2862
    s += uint2string( fChsDiff );
 
2863
    s += "\nidslRMReason=";
 
2864
    s += uint2string( idslRMReason );
 
2865
    s += "\nysr=";
 
2866
    s += uint2string( ysr );
 
2867
    s += "\nchYsr=";
 
2868
    s += uint2string( chYsr );
 
2869
    s += "\nchse=";
 
2870
    s += uint2string( chse );
 
2871
    s += "\nhpsKern=";
 
2872
    s += uint2string( hpsKern );
 
2873
    s += "\nCHP Done.";
 
2874
    return s;
 
2875
}
 
2876
 
 
2877
bool operator==(const CHP &lhs, const CHP &rhs) {
 
2878
 
 
2879
    return lhs.fBold==rhs.fBold &&
 
2880
           lhs.fItalic==rhs.fItalic &&
 
2881
           lhs.fRMarkDel==rhs.fRMarkDel &&
 
2882
           lhs.fOutline==rhs.fOutline &&
 
2883
           lhs.fFldVanish==rhs.fFldVanish &&
 
2884
           lhs.fSmallCaps==rhs.fSmallCaps &&
 
2885
           lhs.fCaps==rhs.fCaps &&
 
2886
           lhs.fVanish==rhs.fVanish &&
 
2887
           lhs.fRMark==rhs.fRMark &&
 
2888
           lhs.fSpec==rhs.fSpec &&
 
2889
           lhs.fStrike==rhs.fStrike &&
 
2890
           lhs.fObj==rhs.fObj &&
 
2891
           lhs.fShadow==rhs.fShadow &&
 
2892
           lhs.fLowerCase==rhs.fLowerCase &&
 
2893
           lhs.fData==rhs.fData &&
 
2894
           lhs.fOle2==rhs.fOle2 &&
 
2895
           lhs.unused2==rhs.unused2 &&
 
2896
           lhs.ftc==rhs.ftc &&
 
2897
           lhs.hps==rhs.hps &&
 
2898
           lhs.dxaSpace==rhs.dxaSpace &&
 
2899
           lhs.iss==rhs.iss &&
 
2900
           lhs.unused10_3==rhs.unused10_3 &&
 
2901
           lhs.fSysVanish==rhs.fSysVanish &&
 
2902
           lhs.unused10_7==rhs.unused10_7 &&
 
2903
           lhs.ico==rhs.ico &&
 
2904
           lhs.kul==rhs.kul &&
 
2905
           lhs.hpsPos==rhs.hpsPos &&
 
2906
           lhs.lid==rhs.lid &&
 
2907
           lhs.fcPic_fcObj_lTagObj==rhs.fcPic_fcObj_lTagObj &&
 
2908
           lhs.ibstRMark==rhs.ibstRMark &&
 
2909
           lhs.dttmRMark==rhs.dttmRMark &&
 
2910
           lhs.unused26==rhs.unused26 &&
 
2911
           lhs.istd==rhs.istd &&
 
2912
           lhs.ftcSym==rhs.ftcSym &&
 
2913
           lhs.chSym==rhs.chSym &&
 
2914
           lhs.fChsDiff==rhs.fChsDiff &&
 
2915
           lhs.idslRMReason==rhs.idslRMReason &&
 
2916
           lhs.ysr==rhs.ysr &&
 
2917
           lhs.chYsr==rhs.chYsr &&
 
2918
           lhs.chse==rhs.chse &&
 
2919
           lhs.hpsKern==rhs.hpsKern;
 
2920
}
 
2921
 
 
2922
bool operator!=(const CHP &lhs, const CHP &rhs) {
 
2923
    return !(lhs==rhs);
 
2924
}
 
2925
 
 
2926
 
 
2927
// DCS implementation
 
2928
 
 
2929
DCS::DCS() {
 
2930
    clear();
 
2931
}
 
2932
 
 
2933
DCS::DCS(OLEStreamReader *stream, bool preservePos) {
 
2934
    clear();
 
2935
    read(stream, preservePos);
 
2936
}
 
2937
 
 
2938
DCS::DCS(const U8 *ptr) {
 
2939
    clear();
 
2940
    readPtr(ptr);
 
2941
}
 
2942
 
 
2943
bool DCS::read(OLEStreamReader *stream, bool preservePos) {
 
2944
 
 
2945
    U8 shifterU8;
 
2946
 
 
2947
    if(preservePos)
 
2948
        stream->push();
 
2949
 
 
2950
    shifterU8=stream->readU8();
 
2951
    fdct=shifterU8;
 
2952
    shifterU8>>=3;
 
2953
    lines=shifterU8;
 
2954
    unused1=stream->readU8();
 
2955
 
 
2956
    if(preservePos)
 
2957
        stream->pop();
 
2958
    return true;
 
2959
}
 
2960
 
 
2961
void DCS::readPtr(const U8 *ptr) {
 
2962
 
 
2963
    U8 shifterU8;
 
2964
 
 
2965
    shifterU8=readU8(ptr);
 
2966
    ptr+=sizeof(U8);
 
2967
    fdct=shifterU8;
 
2968
    shifterU8>>=3;
 
2969
    lines=shifterU8;
 
2970
    unused1=readU8(ptr);
 
2971
    ptr+=sizeof(U8);
 
2972
}
 
2973
 
 
2974
bool DCS::write(OLEStreamWriter *stream, bool preservePos) const {
 
2975
 
 
2976
    U8 shifterU8;
 
2977
 
 
2978
    if(preservePos)
 
2979
        stream->push();
 
2980
 
 
2981
    shifterU8=fdct;
 
2982
    shifterU8|=lines << 3;
 
2983
    stream->write(shifterU8);
 
2984
    stream->write(unused1);
 
2985
 
 
2986
    if(preservePos)
 
2987
        stream->pop();
 
2988
    return true;
 
2989
}
 
2990
 
 
2991
void DCS::clear() {
 
2992
    fdct=0;
 
2993
    lines=0;
 
2994
    unused1=0;
 
2995
}
 
2996
 
 
2997
void DCS::dump() const
 
2998
{
 
2999
    wvlog << "Dumping DCS:" << endl;
 
3000
    wvlog << toString().c_str() << endl;
 
3001
    wvlog << "\nDumping DCS done." << endl;
 
3002
}
 
3003
 
 
3004
std::string DCS::toString() const
 
3005
{
 
3006
    std::string s( "DCS:" );
 
3007
    s += "\nfdct=";
 
3008
    s += uint2string( fdct );
 
3009
    s += "\nlines=";
 
3010
    s += uint2string( lines );
 
3011
    s += "\nunused1=";
 
3012
    s += uint2string( unused1 );
 
3013
    s += "\nDCS Done.";
 
3014
    return s;
 
3015
}
 
3016
 
 
3017
bool operator==(const DCS &lhs, const DCS &rhs) {
 
3018
 
 
3019
    return lhs.fdct==rhs.fdct &&
 
3020
           lhs.lines==rhs.lines &&
 
3021
           lhs.unused1==rhs.unused1;
 
3022
}
 
3023
 
 
3024
bool operator!=(const DCS &lhs, const DCS &rhs) {
 
3025
    return !(lhs==rhs);
 
3026
}
 
3027
 
 
3028
 
 
3029
// DO implementation
 
3030
 
 
3031
DO::DO() {
 
3032
    clear();
 
3033
}
 
3034
 
 
3035
DO::DO(OLEStreamReader *stream, bool preservePos) {
 
3036
    clear();
 
3037
    read(stream, preservePos);
 
3038
}
 
3039
 
 
3040
bool DO::read(OLEStreamReader *stream, bool preservePos) {
 
3041
 
 
3042
    U16 shifterU16;
 
3043
 
 
3044
    if(preservePos)
 
3045
        stream->push();
 
3046
 
 
3047
    fc=stream->readU32();
 
3048
    dok=stream->readU16();
 
3049
    cb=stream->readU16();
 
3050
    bx=stream->readU8();
 
3051
    by=stream->readU8();
 
3052
    dhgt=stream->readU16();
 
3053
    shifterU16=stream->readU16();
 
3054
    fAnchorLock=shifterU16;
 
3055
    shifterU16>>=1;
 
3056
    unused8=shifterU16;
 
3057
    rgdp=stream->readU8();
 
3058
 
 
3059
    if(preservePos)
 
3060
        stream->pop();
 
3061
    return true;
 
3062
}
 
3063
 
 
3064
bool DO::write(OLEStreamWriter *stream, bool preservePos) const {
 
3065
 
 
3066
    U16 shifterU16;
 
3067
 
 
3068
    if(preservePos)
 
3069
        stream->push();
 
3070
 
 
3071
    stream->write(fc);
 
3072
    stream->write(dok);
 
3073
    stream->write(cb);
 
3074
    stream->write(bx);
 
3075
    stream->write(by);
 
3076
    stream->write(dhgt);
 
3077
    shifterU16=fAnchorLock;
 
3078
    shifterU16|=unused8 << 1;
 
3079
    stream->write(shifterU16);
 
3080
    stream->write(rgdp);
 
3081
 
 
3082
    if(preservePos)
 
3083
        stream->pop();
 
3084
    return true;
 
3085
}
 
3086
 
 
3087
void DO::clear() {
 
3088
    fc=0;
 
3089
    dok=0;
 
3090
    cb=0;
 
3091
    bx=0;
 
3092
    by=0;
 
3093
    dhgt=0;
 
3094
    fAnchorLock=0;
 
3095
    unused8=0;
 
3096
    rgdp=0;
 
3097
}
 
3098
 
 
3099
bool operator==(const DO &lhs, const DO &rhs) {
 
3100
 
 
3101
    return lhs.fc==rhs.fc &&
 
3102
           lhs.dok==rhs.dok &&
 
3103
           lhs.cb==rhs.cb &&
 
3104
           lhs.bx==rhs.bx &&
 
3105
           lhs.by==rhs.by &&
 
3106
           lhs.dhgt==rhs.dhgt &&
 
3107
           lhs.fAnchorLock==rhs.fAnchorLock &&
 
3108
           lhs.unused8==rhs.unused8 &&
 
3109
           lhs.rgdp==rhs.rgdp;
 
3110
}
 
3111
 
 
3112
bool operator!=(const DO &lhs, const DO &rhs) {
 
3113
    return !(lhs==rhs);
 
3114
}
 
3115
 
 
3116
 
 
3117
// DOP implementation
 
3118
 
 
3119
DOP::DOP() {
 
3120
    clear();
 
3121
}
 
3122
 
 
3123
DOP::DOP(OLEStreamReader *stream, bool preservePos) {
 
3124
    clear();
 
3125
    read(stream, preservePos);
 
3126
}
 
3127
 
 
3128
bool DOP::read(OLEStreamReader *stream, bool preservePos) {
 
3129
 
 
3130
    U8 shifterU8;
 
3131
    U16 shifterU16;
 
3132
 
 
3133
    if(preservePos)
 
3134
        stream->push();
 
3135
 
 
3136
    shifterU16=stream->readU16();
 
3137
    fFacingPages=shifterU16;
 
3138
    shifterU16>>=1;
 
3139
    fWidowControl=shifterU16;
 
3140
    shifterU16>>=1;
 
3141
    fPMHMainDoc=shifterU16;
 
3142
    shifterU16>>=1;
 
3143
    grfSuppression=shifterU16;
 
3144
    shifterU16>>=2;
 
3145
    fpc=shifterU16;
 
3146
    shifterU16>>=2;
 
3147
    unused0_7=shifterU16;
 
3148
    shifterU16>>=1;
 
3149
    grpfIhdt=shifterU16;
 
3150
    shifterU16=stream->readU16();
 
3151
    rncFtn=shifterU16;
 
3152
    shifterU16>>=2;
 
3153
    nFtn=shifterU16;
 
3154
    shifterU8=stream->readU8();
 
3155
    fOutlineDirtySave=shifterU8;
 
3156
    shifterU8>>=1;
 
3157
    unused4_1=shifterU8;
 
3158
    shifterU8=stream->readU8();
 
3159
    fOnlyMacPics=shifterU8;
 
3160
    shifterU8>>=1;
 
3161
    fOnlyWinPics=shifterU8;
 
3162
    shifterU8>>=1;
 
3163
    fLabelDoc=shifterU8;
 
3164
    shifterU8>>=1;
 
3165
    fHyphCapitals=shifterU8;
 
3166
    shifterU8>>=1;
 
3167
    fAutoHyphen=shifterU8;
 
3168
    shifterU8>>=1;
 
3169
    fFormNoFields=shifterU8;
 
3170
    shifterU8>>=1;
 
3171
    fLinkStyles=shifterU8;
 
3172
    shifterU8>>=1;
 
3173
    fRevMarking=shifterU8;
 
3174
    shifterU8=stream->readU8();
 
3175
    fBackup=shifterU8;
 
3176
    shifterU8>>=1;
 
3177
    fExactCWords=shifterU8;
 
3178
    shifterU8>>=1;
 
3179
    fPagHidden=shifterU8;
 
3180
    shifterU8>>=1;
 
3181
    fPagResults=shifterU8;
 
3182
    shifterU8>>=1;
 
3183
    fLockAtn=shifterU8;
 
3184
    shifterU8>>=1;
 
3185
    fMirrorMargins=shifterU8;
 
3186
    shifterU8>>=1;
 
3187
    fReadOnlyRecommended=shifterU8;
 
3188
    shifterU8>>=1;
 
3189
    fDfltTrueType=shifterU8;
 
3190
    shifterU8=stream->readU8();
 
3191
    fPagSuppressTopSpacing=shifterU8;
 
3192
    shifterU8>>=1;
 
3193
    fProtEnabled=shifterU8;
 
3194
    shifterU8>>=1;
 
3195
    fDispFormFldSel=shifterU8;
 
3196
    shifterU8>>=1;
 
3197
    fRMView=shifterU8;
 
3198
    shifterU8>>=1;
 
3199
    fRMPrint=shifterU8;
 
3200
    shifterU8>>=1;
 
3201
    fWriteReservation=shifterU8;
 
3202
    shifterU8>>=1;
 
3203
    fLockRev=shifterU8;
 
3204
    shifterU8>>=1;
 
3205
    fEmbedFonts=shifterU8;
 
3206
    shifterU16=stream->readU16();
 
3207
    copts_fNoTabForInd=shifterU16;
 
3208
    shifterU16>>=1;
 
3209
    copts_fNoSpaceRaiseLower=shifterU16;
 
3210
    shifterU16>>=1;
 
3211
    copts_fSuppressSpbfAfterPageBreak=shifterU16;
 
3212
    shifterU16>>=1;
 
3213
    copts_fWrapTrailSpaces=shifterU16;
 
3214
    shifterU16>>=1;
 
3215
    copts_fMapPrintTextColor=shifterU16;
 
3216
    shifterU16>>=1;
 
3217
    copts_fNoColumnBalance=shifterU16;
 
3218
    shifterU16>>=1;
 
3219
    copts_fConvMailMergeEsc=shifterU16;
 
3220
    shifterU16>>=1;
 
3221
    copts_fSupressTopSpacing=shifterU16;
 
3222
    shifterU16>>=1;
 
3223
    copts_fOrigWordTableRules=shifterU16;
 
3224
    shifterU16>>=1;
 
3225
    copts_fTransparentMetafiles=shifterU16;
 
3226
    shifterU16>>=1;
 
3227
    copts_fShowBreaksInFrames=shifterU16;
 
3228
    shifterU16>>=1;
 
3229
    copts_fSwapBordersFacingPgs=shifterU16;
 
3230
    shifterU16>>=1;
 
3231
    unused8_12=shifterU16;
 
3232
    dxaTab=stream->readU16();
 
3233
    wSpare=stream->readU16();
 
3234
    dxaHotZ=stream->readU16();
 
3235
    cConsecHypLim=stream->readU16();
 
3236
    wSpare2=stream->readU16();
 
3237
    dttmCreated.read(stream, false);
 
3238
    dttmRevised.read(stream, false);
 
3239
    dttmLastPrint.read(stream, false);
 
3240
    nRevision=stream->readU16();
 
3241
    tmEdited=stream->readU32();
 
3242
    cWords=stream->readU32();
 
3243
    cCh=stream->readU32();
 
3244
    cPg=stream->readU16();
 
3245
    cParas=stream->readU32();
 
3246
    shifterU16=stream->readU16();
 
3247
    rncEdn=shifterU16;
 
3248
    shifterU16>>=2;
 
3249
    nEdn=shifterU16;
 
3250
    shifterU16=stream->readU16();
 
3251
    epc=shifterU16;
 
3252
    shifterU16>>=2;
 
3253
    nfcFtnRef=shifterU16;
 
3254
    shifterU16>>=4;
 
3255
    nfcEdnRef=shifterU16;
 
3256
    shifterU16>>=4;
 
3257
    fPrintFormData=shifterU16;
 
3258
    shifterU16>>=1;
 
3259
    fSaveFormData=shifterU16;
 
3260
    shifterU16>>=1;
 
3261
    fShadeFormData=shifterU16;
 
3262
    shifterU16>>=1;
 
3263
    unused54_13=shifterU16;
 
3264
    shifterU16>>=2;
 
3265
    fWCFtnEdn=shifterU16;
 
3266
    cLines=stream->readU32();
 
3267
    cWordsFtnEnd=stream->readU32();
 
3268
    cChFtnEdn=stream->readU32();
 
3269
    cPgFtnEdn=stream->readU16();
 
3270
    cParasFtnEdn=stream->readU32();
 
3271
    cLinesFtnEdn=stream->readU32();
 
3272
    lKeyProtDoc=stream->readU32();
 
3273
    shifterU16=stream->readU16();
 
3274
    wvkSaved=shifterU16;
 
3275
    shifterU16>>=3;
 
3276
    wScaleSaved=shifterU16;
 
3277
    shifterU16>>=9;
 
3278
    zkSaved=shifterU16;
 
3279
    shifterU16>>=2;
 
3280
    unused82_14=shifterU16;
 
3281
 
 
3282
    if(preservePos)
 
3283
        stream->pop();
 
3284
    return true;
 
3285
}
 
3286
 
 
3287
bool DOP::write(OLEStreamWriter *stream, bool preservePos) const {
 
3288
 
 
3289
    U8 shifterU8;
 
3290
    U16 shifterU16;
 
3291
 
 
3292
    if(preservePos)
 
3293
        stream->push();
 
3294
 
 
3295
    shifterU16=fFacingPages;
 
3296
    shifterU16|=fWidowControl << 1;
 
3297
    shifterU16|=fPMHMainDoc << 2;
 
3298
    shifterU16|=grfSuppression << 3;
 
3299
    shifterU16|=fpc << 5;
 
3300
    shifterU16|=unused0_7 << 7;
 
3301
    shifterU16|=grpfIhdt << 8;
 
3302
    stream->write(shifterU16);
 
3303
    shifterU16=rncFtn;
 
3304
    shifterU16|=nFtn << 2;
 
3305
    stream->write(shifterU16);
 
3306
    shifterU8=fOutlineDirtySave;
 
3307
    shifterU8|=unused4_1 << 1;
 
3308
    stream->write(shifterU8);
 
3309
    shifterU8=fOnlyMacPics;
 
3310
    shifterU8|=fOnlyWinPics << 1;
 
3311
    shifterU8|=fLabelDoc << 2;
 
3312
    shifterU8|=fHyphCapitals << 3;
 
3313
    shifterU8|=fAutoHyphen << 4;
 
3314
    shifterU8|=fFormNoFields << 5;
 
3315
    shifterU8|=fLinkStyles << 6;
 
3316
    shifterU8|=fRevMarking << 7;
 
3317
    stream->write(shifterU8);
 
3318
    shifterU8=fBackup;
 
3319
    shifterU8|=fExactCWords << 1;
 
3320
    shifterU8|=fPagHidden << 2;
 
3321
    shifterU8|=fPagResults << 3;
 
3322
    shifterU8|=fLockAtn << 4;
 
3323
    shifterU8|=fMirrorMargins << 5;
 
3324
    shifterU8|=fReadOnlyRecommended << 6;
 
3325
    shifterU8|=fDfltTrueType << 7;
 
3326
    stream->write(shifterU8);
 
3327
    shifterU8=fPagSuppressTopSpacing;
 
3328
    shifterU8|=fProtEnabled << 1;
 
3329
    shifterU8|=fDispFormFldSel << 2;
 
3330
    shifterU8|=fRMView << 3;
 
3331
    shifterU8|=fRMPrint << 4;
 
3332
    shifterU8|=fWriteReservation << 5;
 
3333
    shifterU8|=fLockRev << 6;
 
3334
    shifterU8|=fEmbedFonts << 7;
 
3335
    stream->write(shifterU8);
 
3336
    shifterU16=copts_fNoTabForInd;
 
3337
    shifterU16|=copts_fNoSpaceRaiseLower << 1;
 
3338
    shifterU16|=copts_fSuppressSpbfAfterPageBreak << 2;
 
3339
    shifterU16|=copts_fWrapTrailSpaces << 3;
 
3340
    shifterU16|=copts_fMapPrintTextColor << 4;
 
3341
    shifterU16|=copts_fNoColumnBalance << 5;
 
3342
    shifterU16|=copts_fConvMailMergeEsc << 6;
 
3343
    shifterU16|=copts_fSupressTopSpacing << 7;
 
3344
    shifterU16|=copts_fOrigWordTableRules << 8;
 
3345
    shifterU16|=copts_fTransparentMetafiles << 9;
 
3346
    shifterU16|=copts_fShowBreaksInFrames << 10;
 
3347
    shifterU16|=copts_fSwapBordersFacingPgs << 11;
 
3348
    shifterU16|=unused8_12 << 12;
 
3349
    stream->write(shifterU16);
 
3350
    stream->write(dxaTab);
 
3351
    stream->write(wSpare);
 
3352
    stream->write(dxaHotZ);
 
3353
    stream->write(cConsecHypLim);
 
3354
    stream->write(wSpare2);
 
3355
    dttmCreated.write(stream, false);
 
3356
    dttmRevised.write(stream, false);
 
3357
    dttmLastPrint.write(stream, false);
 
3358
    stream->write(nRevision);
 
3359
    stream->write(tmEdited);
 
3360
    stream->write(cWords);
 
3361
    stream->write(cCh);
 
3362
    stream->write(cPg);
 
3363
    stream->write(cParas);
 
3364
    shifterU16=rncEdn;
 
3365
    shifterU16|=nEdn << 2;
 
3366
    stream->write(shifterU16);
 
3367
    shifterU16=epc;
 
3368
    shifterU16|=nfcFtnRef << 2;
 
3369
    shifterU16|=nfcEdnRef << 6;
 
3370
    shifterU16|=fPrintFormData << 10;
 
3371
    shifterU16|=fSaveFormData << 11;
 
3372
    shifterU16|=fShadeFormData << 12;
 
3373
    shifterU16|=unused54_13 << 13;
 
3374
    shifterU16|=fWCFtnEdn << 15;
 
3375
    stream->write(shifterU16);
 
3376
    stream->write(cLines);
 
3377
    stream->write(cWordsFtnEnd);
 
3378
    stream->write(cChFtnEdn);
 
3379
    stream->write(cPgFtnEdn);
 
3380
    stream->write(cParasFtnEdn);
 
3381
    stream->write(cLinesFtnEdn);
 
3382
    stream->write(lKeyProtDoc);
 
3383
    shifterU16=wvkSaved;
 
3384
    shifterU16|=wScaleSaved << 3;
 
3385
    shifterU16|=zkSaved << 12;
 
3386
    shifterU16|=unused82_14 << 14;
 
3387
    stream->write(shifterU16);
 
3388
 
 
3389
    if(preservePos)
 
3390
        stream->pop();
 
3391
    return true;
 
3392
}
 
3393
 
 
3394
void DOP::clear() {
 
3395
    fFacingPages=0;
 
3396
    fWidowControl=0;
 
3397
    fPMHMainDoc=0;
 
3398
    grfSuppression=0;
 
3399
    fpc=0;
 
3400
    unused0_7=0;
 
3401
    grpfIhdt=0;
 
3402
    rncFtn=0;
 
3403
    nFtn=0;
 
3404
    fOutlineDirtySave=0;
 
3405
    unused4_1=0;
 
3406
    fOnlyMacPics=0;
 
3407
    fOnlyWinPics=0;
 
3408
    fLabelDoc=0;
 
3409
    fHyphCapitals=0;
 
3410
    fAutoHyphen=0;
 
3411
    fFormNoFields=0;
 
3412
    fLinkStyles=0;
 
3413
    fRevMarking=0;
 
3414
    fBackup=0;
 
3415
    fExactCWords=0;
 
3416
    fPagHidden=0;
 
3417
    fPagResults=0;
 
3418
    fLockAtn=0;
 
3419
    fMirrorMargins=0;
 
3420
    fReadOnlyRecommended=0;
 
3421
    fDfltTrueType=0;
 
3422
    fPagSuppressTopSpacing=0;
 
3423
    fProtEnabled=0;
 
3424
    fDispFormFldSel=0;
 
3425
    fRMView=0;
 
3426
    fRMPrint=0;
 
3427
    fWriteReservation=0;
 
3428
    fLockRev=0;
 
3429
    fEmbedFonts=0;
 
3430
    copts_fNoTabForInd=0;
 
3431
    copts_fNoSpaceRaiseLower=0;
 
3432
    copts_fSuppressSpbfAfterPageBreak=0;
 
3433
    copts_fWrapTrailSpaces=0;
 
3434
    copts_fMapPrintTextColor=0;
 
3435
    copts_fNoColumnBalance=0;
 
3436
    copts_fConvMailMergeEsc=0;
 
3437
    copts_fSupressTopSpacing=0;
 
3438
    copts_fOrigWordTableRules=0;
 
3439
    copts_fTransparentMetafiles=0;
 
3440
    copts_fShowBreaksInFrames=0;
 
3441
    copts_fSwapBordersFacingPgs=0;
 
3442
    unused8_12=0;
 
3443
    dxaTab=0;
 
3444
    wSpare=0;
 
3445
    dxaHotZ=0;
 
3446
    cConsecHypLim=0;
 
3447
    wSpare2=0;
 
3448
    dttmCreated.clear();
 
3449
    dttmRevised.clear();
 
3450
    dttmLastPrint.clear();
 
3451
    nRevision=0;
 
3452
    tmEdited=0;
 
3453
    cWords=0;
 
3454
    cCh=0;
 
3455
    cPg=0;
 
3456
    cParas=0;
 
3457
    rncEdn=0;
 
3458
    nEdn=0;
 
3459
    epc=0;
 
3460
    nfcFtnRef=0;
 
3461
    nfcEdnRef=0;
 
3462
    fPrintFormData=0;
 
3463
    fSaveFormData=0;
 
3464
    fShadeFormData=0;
 
3465
    unused54_13=0;
 
3466
    fWCFtnEdn=0;
 
3467
    cLines=0;
 
3468
    cWordsFtnEnd=0;
 
3469
    cChFtnEdn=0;
 
3470
    cPgFtnEdn=0;
 
3471
    cParasFtnEdn=0;
 
3472
    cLinesFtnEdn=0;
 
3473
    lKeyProtDoc=0;
 
3474
    wvkSaved=0;
 
3475
    wScaleSaved=0;
 
3476
    zkSaved=0;
 
3477
    unused82_14=0;
 
3478
}
 
3479
 
 
3480
bool operator==(const DOP &lhs, const DOP &rhs) {
 
3481
 
 
3482
    return lhs.fFacingPages==rhs.fFacingPages &&
 
3483
           lhs.fWidowControl==rhs.fWidowControl &&
 
3484
           lhs.fPMHMainDoc==rhs.fPMHMainDoc &&
 
3485
           lhs.grfSuppression==rhs.grfSuppression &&
 
3486
           lhs.fpc==rhs.fpc &&
 
3487
           lhs.unused0_7==rhs.unused0_7 &&
 
3488
           lhs.grpfIhdt==rhs.grpfIhdt &&
 
3489
           lhs.rncFtn==rhs.rncFtn &&
 
3490
           lhs.nFtn==rhs.nFtn &&
 
3491
           lhs.fOutlineDirtySave==rhs.fOutlineDirtySave &&
 
3492
           lhs.unused4_1==rhs.unused4_1 &&
 
3493
           lhs.fOnlyMacPics==rhs.fOnlyMacPics &&
 
3494
           lhs.fOnlyWinPics==rhs.fOnlyWinPics &&
 
3495
           lhs.fLabelDoc==rhs.fLabelDoc &&
 
3496
           lhs.fHyphCapitals==rhs.fHyphCapitals &&
 
3497
           lhs.fAutoHyphen==rhs.fAutoHyphen &&
 
3498
           lhs.fFormNoFields==rhs.fFormNoFields &&
 
3499
           lhs.fLinkStyles==rhs.fLinkStyles &&
 
3500
           lhs.fRevMarking==rhs.fRevMarking &&
 
3501
           lhs.fBackup==rhs.fBackup &&
 
3502
           lhs.fExactCWords==rhs.fExactCWords &&
 
3503
           lhs.fPagHidden==rhs.fPagHidden &&
 
3504
           lhs.fPagResults==rhs.fPagResults &&
 
3505
           lhs.fLockAtn==rhs.fLockAtn &&
 
3506
           lhs.fMirrorMargins==rhs.fMirrorMargins &&
 
3507
           lhs.fReadOnlyRecommended==rhs.fReadOnlyRecommended &&
 
3508
           lhs.fDfltTrueType==rhs.fDfltTrueType &&
 
3509
           lhs.fPagSuppressTopSpacing==rhs.fPagSuppressTopSpacing &&
 
3510
           lhs.fProtEnabled==rhs.fProtEnabled &&
 
3511
           lhs.fDispFormFldSel==rhs.fDispFormFldSel &&
 
3512
           lhs.fRMView==rhs.fRMView &&
 
3513
           lhs.fRMPrint==rhs.fRMPrint &&
 
3514
           lhs.fWriteReservation==rhs.fWriteReservation &&
 
3515
           lhs.fLockRev==rhs.fLockRev &&
 
3516
           lhs.fEmbedFonts==rhs.fEmbedFonts &&
 
3517
           lhs.copts_fNoTabForInd==rhs.copts_fNoTabForInd &&
 
3518
           lhs.copts_fNoSpaceRaiseLower==rhs.copts_fNoSpaceRaiseLower &&
 
3519
           lhs.copts_fSuppressSpbfAfterPageBreak==rhs.copts_fSuppressSpbfAfterPageBreak &&
 
3520
           lhs.copts_fWrapTrailSpaces==rhs.copts_fWrapTrailSpaces &&
 
3521
           lhs.copts_fMapPrintTextColor==rhs.copts_fMapPrintTextColor &&
 
3522
           lhs.copts_fNoColumnBalance==rhs.copts_fNoColumnBalance &&
 
3523
           lhs.copts_fConvMailMergeEsc==rhs.copts_fConvMailMergeEsc &&
 
3524
           lhs.copts_fSupressTopSpacing==rhs.copts_fSupressTopSpacing &&
 
3525
           lhs.copts_fOrigWordTableRules==rhs.copts_fOrigWordTableRules &&
 
3526
           lhs.copts_fTransparentMetafiles==rhs.copts_fTransparentMetafiles &&
 
3527
           lhs.copts_fShowBreaksInFrames==rhs.copts_fShowBreaksInFrames &&
 
3528
           lhs.copts_fSwapBordersFacingPgs==rhs.copts_fSwapBordersFacingPgs &&
 
3529
           lhs.unused8_12==rhs.unused8_12 &&
 
3530
           lhs.dxaTab==rhs.dxaTab &&
 
3531
           lhs.wSpare==rhs.wSpare &&
 
3532
           lhs.dxaHotZ==rhs.dxaHotZ &&
 
3533
           lhs.cConsecHypLim==rhs.cConsecHypLim &&
 
3534
           lhs.wSpare2==rhs.wSpare2 &&
 
3535
           lhs.dttmCreated==rhs.dttmCreated &&
 
3536
           lhs.dttmRevised==rhs.dttmRevised &&
 
3537
           lhs.dttmLastPrint==rhs.dttmLastPrint &&
 
3538
           lhs.nRevision==rhs.nRevision &&
 
3539
           lhs.tmEdited==rhs.tmEdited &&
 
3540
           lhs.cWords==rhs.cWords &&
 
3541
           lhs.cCh==rhs.cCh &&
 
3542
           lhs.cPg==rhs.cPg &&
 
3543
           lhs.cParas==rhs.cParas &&
 
3544
           lhs.rncEdn==rhs.rncEdn &&
 
3545
           lhs.nEdn==rhs.nEdn &&
 
3546
           lhs.epc==rhs.epc &&
 
3547
           lhs.nfcFtnRef==rhs.nfcFtnRef &&
 
3548
           lhs.nfcEdnRef==rhs.nfcEdnRef &&
 
3549
           lhs.fPrintFormData==rhs.fPrintFormData &&
 
3550
           lhs.fSaveFormData==rhs.fSaveFormData &&
 
3551
           lhs.fShadeFormData==rhs.fShadeFormData &&
 
3552
           lhs.unused54_13==rhs.unused54_13 &&
 
3553
           lhs.fWCFtnEdn==rhs.fWCFtnEdn &&
 
3554
           lhs.cLines==rhs.cLines &&
 
3555
           lhs.cWordsFtnEnd==rhs.cWordsFtnEnd &&
 
3556
           lhs.cChFtnEdn==rhs.cChFtnEdn &&
 
3557
           lhs.cPgFtnEdn==rhs.cPgFtnEdn &&
 
3558
           lhs.cParasFtnEdn==rhs.cParasFtnEdn &&
 
3559
           lhs.cLinesFtnEdn==rhs.cLinesFtnEdn &&
 
3560
           lhs.lKeyProtDoc==rhs.lKeyProtDoc &&
 
3561
           lhs.wvkSaved==rhs.wvkSaved &&
 
3562
           lhs.wScaleSaved==rhs.wScaleSaved &&
 
3563
           lhs.zkSaved==rhs.zkSaved &&
 
3564
           lhs.unused82_14==rhs.unused82_14;
 
3565
}
 
3566
 
 
3567
bool operator!=(const DOP &lhs, const DOP &rhs) {
 
3568
    return !(lhs==rhs);
 
3569
}
 
3570
 
 
3571
 
 
3572
// DPARC implementation
 
3573
 
 
3574
DPARC::DPARC() {
 
3575
    clear();
 
3576
}
 
3577
 
 
3578
DPARC::DPARC(OLEStreamReader *stream, bool preservePos) {
 
3579
    clear();
 
3580
    read(stream, preservePos);
 
3581
}
 
3582
 
 
3583
bool DPARC::read(OLEStreamReader *stream, bool preservePos) {
 
3584
 
 
3585
    U16 shifterU16;
 
3586
 
 
3587
    if(preservePos)
 
3588
        stream->push();
 
3589
 
 
3590
    dphead.read(stream, false);
 
3591
    lnpc=stream->readU32();
 
3592
    lnpw=stream->readU16();
 
3593
    lnps=stream->readU16();
 
3594
    dlpcFg=stream->readU32();
 
3595
    dlpcBg=stream->readU32();
 
3596
    flpp=stream->readU16();
 
3597
    shdwpi=stream->readU16();
 
3598
    xaOffset=stream->readU16();
 
3599
    yaOffset=stream->readU16();
 
3600
    shifterU16=stream->readU16();
 
3601
    fLeft=shifterU16;
 
3602
    shifterU16>>=8;
 
3603
    fUp=shifterU16;
 
3604
 
 
3605
    if(preservePos)
 
3606
        stream->pop();
 
3607
    return true;
 
3608
}
 
3609
 
 
3610
bool DPARC::write(OLEStreamWriter *stream, bool preservePos) const {
 
3611
 
 
3612
    U16 shifterU16;
 
3613
 
 
3614
    if(preservePos)
 
3615
        stream->push();
 
3616
 
 
3617
    dphead.write(stream, false);
 
3618
    stream->write(lnpc);
 
3619
    stream->write(lnpw);
 
3620
    stream->write(lnps);
 
3621
    stream->write(dlpcFg);
 
3622
    stream->write(dlpcBg);
 
3623
    stream->write(flpp);
 
3624
    stream->write(shdwpi);
 
3625
    stream->write(xaOffset);
 
3626
    stream->write(yaOffset);
 
3627
    shifterU16=fLeft;
 
3628
    shifterU16|=fUp << 8;
 
3629
    stream->write(shifterU16);
 
3630
 
 
3631
    if(preservePos)
 
3632
        stream->pop();
 
3633
    return true;
 
3634
}
 
3635
 
 
3636
void DPARC::clear() {
 
3637
    dphead.clear();
 
3638
    lnpc=0;
 
3639
    lnpw=0;
 
3640
    lnps=0;
 
3641
    dlpcFg=0;
 
3642
    dlpcBg=0;
 
3643
    flpp=0;
 
3644
    shdwpi=0;
 
3645
    xaOffset=0;
 
3646
    yaOffset=0;
 
3647
    fLeft=0;
 
3648
    fUp=0;
 
3649
}
 
3650
 
 
3651
bool operator==(const DPARC &lhs, const DPARC &rhs) {
 
3652
 
 
3653
    return lhs.dphead==rhs.dphead &&
 
3654
           lhs.lnpc==rhs.lnpc &&
 
3655
           lhs.lnpw==rhs.lnpw &&
 
3656
           lhs.lnps==rhs.lnps &&
 
3657
           lhs.dlpcFg==rhs.dlpcFg &&
 
3658
           lhs.dlpcBg==rhs.dlpcBg &&
 
3659
           lhs.flpp==rhs.flpp &&
 
3660
           lhs.shdwpi==rhs.shdwpi &&
 
3661
           lhs.xaOffset==rhs.xaOffset &&
 
3662
           lhs.yaOffset==rhs.yaOffset &&
 
3663
           lhs.fLeft==rhs.fLeft &&
 
3664
           lhs.fUp==rhs.fUp;
 
3665
}
 
3666
 
 
3667
bool operator!=(const DPARC &lhs, const DPARC &rhs) {
 
3668
    return !(lhs==rhs);
 
3669
}
 
3670
 
 
3671
 
 
3672
// DPCALLOUT implementation
 
3673
 
 
3674
DPCALLOUT::DPCALLOUT() {
 
3675
    clear();
 
3676
}
 
3677
 
 
3678
DPCALLOUT::DPCALLOUT(OLEStreamReader *stream, bool preservePos) {
 
3679
    clear();
 
3680
    read(stream, preservePos);
 
3681
}
 
3682
 
 
3683
bool DPCALLOUT::read(OLEStreamReader *stream, bool preservePos) {
 
3684
 
 
3685
    if(preservePos)
 
3686
        stream->push();
 
3687
 
 
3688
    dphead.read(stream, false);
 
3689
    unused12=stream->readU16();
 
3690
    dzaOffset=stream->readU16();
 
3691
    dzaDescent=stream->readU16();
 
3692
    dzaLength=stream->readU16();
 
3693
    dptxbx.read(stream, false);
 
3694
    dpPolyLine.read(stream, false);
 
3695
 
 
3696
    if(preservePos)
 
3697
        stream->pop();
 
3698
    return true;
 
3699
}
 
3700
 
 
3701
bool DPCALLOUT::write(OLEStreamWriter *stream, bool preservePos) const {
 
3702
 
 
3703
    if(preservePos)
 
3704
        stream->push();
 
3705
 
 
3706
    dphead.write(stream, false);
 
3707
    stream->write(unused12);
 
3708
    stream->write(dzaOffset);
 
3709
    stream->write(dzaDescent);
 
3710
    stream->write(dzaLength);
 
3711
    dptxbx.write(stream, false);
 
3712
    dpPolyLine.write(stream, false);
 
3713
 
 
3714
    if(preservePos)
 
3715
        stream->pop();
 
3716
    return true;
 
3717
}
 
3718
 
 
3719
void DPCALLOUT::clear() {
 
3720
    dphead.clear();
 
3721
    unused12=0;
 
3722
    dzaOffset=0;
 
3723
    dzaDescent=0;
 
3724
    dzaLength=0;
 
3725
    dptxbx.clear();
 
3726
    dpPolyLine.clear();
 
3727
}
 
3728
 
 
3729
bool operator==(const DPCALLOUT &lhs, const DPCALLOUT &rhs) {
 
3730
 
 
3731
    return lhs.dphead==rhs.dphead &&
 
3732
           lhs.unused12==rhs.unused12 &&
 
3733
           lhs.dzaOffset==rhs.dzaOffset &&
 
3734
           lhs.dzaDescent==rhs.dzaDescent &&
 
3735
           lhs.dzaLength==rhs.dzaLength &&
 
3736
           lhs.dptxbx==rhs.dptxbx &&
 
3737
           lhs.dpPolyLine==rhs.dpPolyLine;
 
3738
}
 
3739
 
 
3740
bool operator!=(const DPCALLOUT &lhs, const DPCALLOUT &rhs) {
 
3741
    return !(lhs==rhs);
 
3742
}
 
3743
 
 
3744
 
 
3745
// DPELLIPSE implementation
 
3746
 
 
3747
DPELLIPSE::DPELLIPSE() {
 
3748
    clear();
 
3749
}
 
3750
 
 
3751
DPELLIPSE::DPELLIPSE(OLEStreamReader *stream, bool preservePos) {
 
3752
    clear();
 
3753
    read(stream, preservePos);
 
3754
}
 
3755
 
 
3756
bool DPELLIPSE::read(OLEStreamReader *stream, bool preservePos) {
 
3757
 
 
3758
    if(preservePos)
 
3759
        stream->push();
 
3760
 
 
3761
    dphead.read(stream, false);
 
3762
    lnpc=stream->readU32();
 
3763
    lnpw=stream->readU16();
 
3764
    lnps=stream->readU16();
 
3765
    dlpcFg=stream->readU32();
 
3766
    dlpcBg=stream->readU32();
 
3767
    flpp=stream->readU16();
 
3768
    shdwpi=stream->readU16();
 
3769
    xaOffset=stream->readU16();
 
3770
    yaOffset=stream->readU16();
 
3771
 
 
3772
    if(preservePos)
 
3773
        stream->pop();
 
3774
    return true;
 
3775
}
 
3776
 
 
3777
bool DPELLIPSE::write(OLEStreamWriter *stream, bool preservePos) const {
 
3778
 
 
3779
    if(preservePos)
 
3780
        stream->push();
 
3781
 
 
3782
    dphead.write(stream, false);
 
3783
    stream->write(lnpc);
 
3784
    stream->write(lnpw);
 
3785
    stream->write(lnps);
 
3786
    stream->write(dlpcFg);
 
3787
    stream->write(dlpcBg);
 
3788
    stream->write(flpp);
 
3789
    stream->write(shdwpi);
 
3790
    stream->write(xaOffset);
 
3791
    stream->write(yaOffset);
 
3792
 
 
3793
    if(preservePos)
 
3794
        stream->pop();
 
3795
    return true;
 
3796
}
 
3797
 
 
3798
void DPELLIPSE::clear() {
 
3799
    dphead.clear();
 
3800
    lnpc=0;
 
3801
    lnpw=0;
 
3802
    lnps=0;
 
3803
    dlpcFg=0;
 
3804
    dlpcBg=0;
 
3805
    flpp=0;
 
3806
    shdwpi=0;
 
3807
    xaOffset=0;
 
3808
    yaOffset=0;
 
3809
}
 
3810
 
 
3811
bool operator==(const DPELLIPSE &lhs, const DPELLIPSE &rhs) {
 
3812
 
 
3813
    return lhs.dphead==rhs.dphead &&
 
3814
           lhs.lnpc==rhs.lnpc &&
 
3815
           lhs.lnpw==rhs.lnpw &&
 
3816
           lhs.lnps==rhs.lnps &&
 
3817
           lhs.dlpcFg==rhs.dlpcFg &&
 
3818
           lhs.dlpcBg==rhs.dlpcBg &&
 
3819
           lhs.flpp==rhs.flpp &&
 
3820
           lhs.shdwpi==rhs.shdwpi &&
 
3821
           lhs.xaOffset==rhs.xaOffset &&
 
3822
           lhs.yaOffset==rhs.yaOffset;
 
3823
}
 
3824
 
 
3825
bool operator!=(const DPELLIPSE &lhs, const DPELLIPSE &rhs) {
 
3826
    return !(lhs==rhs);
 
3827
}
 
3828
 
 
3829
 
 
3830
// DPLINE implementation
 
3831
 
 
3832
DPLINE::DPLINE() {
 
3833
    clear();
 
3834
}
 
3835
 
 
3836
DPLINE::DPLINE(OLEStreamReader *stream, bool preservePos) {
 
3837
    clear();
 
3838
    read(stream, preservePos);
 
3839
}
 
3840
 
 
3841
bool DPLINE::read(OLEStreamReader *stream, bool preservePos) {
 
3842
 
 
3843
    U16 shifterU16;
 
3844
 
 
3845
    if(preservePos)
 
3846
        stream->push();
 
3847
 
 
3848
    dphead.read(stream, false);
 
3849
    xaStart=stream->readU16();
 
3850
    yaStart=stream->readU16();
 
3851
    xaEnd=stream->readU16();
 
3852
    yaEnd=stream->readU16();
 
3853
    lnpc=stream->readU32();
 
3854
    lnpw=stream->readU16();
 
3855
    lnps=stream->readU16();
 
3856
    shifterU16=stream->readU16();
 
3857
    eppsStart=shifterU16;
 
3858
    shifterU16>>=2;
 
3859
    eppwStart=shifterU16;
 
3860
    shifterU16>>=2;
 
3861
    epplStart=shifterU16;
 
3862
    shifterU16>>=2;
 
3863
    unused24_6=shifterU16;
 
3864
    shifterU16=stream->readU16();
 
3865
    eppsEnd=shifterU16;
 
3866
    shifterU16>>=2;
 
3867
    eppwEnd=shifterU16;
 
3868
    shifterU16>>=2;
 
3869
    epplEnd=shifterU16;
 
3870
    shifterU16>>=2;
 
3871
    unused26_6=shifterU16;
 
3872
    shdwpi=stream->readU16();
 
3873
    xaOffset=stream->readU16();
 
3874
    yaOffset=stream->readU16();
 
3875
 
 
3876
    if(preservePos)
 
3877
        stream->pop();
 
3878
    return true;
 
3879
}
 
3880
 
 
3881
bool DPLINE::write(OLEStreamWriter *stream, bool preservePos) const {
 
3882
 
 
3883
    U16 shifterU16;
 
3884
 
 
3885
    if(preservePos)
 
3886
        stream->push();
 
3887
 
 
3888
    dphead.write(stream, false);
 
3889
    stream->write(xaStart);
 
3890
    stream->write(yaStart);
 
3891
    stream->write(xaEnd);
 
3892
    stream->write(yaEnd);
 
3893
    stream->write(lnpc);
 
3894
    stream->write(lnpw);
 
3895
    stream->write(lnps);
 
3896
    shifterU16=eppsStart;
 
3897
    shifterU16|=eppwStart << 2;
 
3898
    shifterU16|=epplStart << 4;
 
3899
    shifterU16|=unused24_6 << 6;
 
3900
    stream->write(shifterU16);
 
3901
    shifterU16=eppsEnd;
 
3902
    shifterU16|=eppwEnd << 2;
 
3903
    shifterU16|=epplEnd << 4;
 
3904
    shifterU16|=unused26_6 << 6;
 
3905
    stream->write(shifterU16);
 
3906
    stream->write(shdwpi);
 
3907
    stream->write(xaOffset);
 
3908
    stream->write(yaOffset);
 
3909
 
 
3910
    if(preservePos)
 
3911
        stream->pop();
 
3912
    return true;
 
3913
}
 
3914
 
 
3915
void DPLINE::clear() {
 
3916
    dphead.clear();
 
3917
    xaStart=0;
 
3918
    yaStart=0;
 
3919
    xaEnd=0;
 
3920
    yaEnd=0;
 
3921
    lnpc=0;
 
3922
    lnpw=0;
 
3923
    lnps=0;
 
3924
    eppsStart=0;
 
3925
    eppwStart=0;
 
3926
    epplStart=0;
 
3927
    unused24_6=0;
 
3928
    eppsEnd=0;
 
3929
    eppwEnd=0;
 
3930
    epplEnd=0;
 
3931
    unused26_6=0;
 
3932
    shdwpi=0;
 
3933
    xaOffset=0;
 
3934
    yaOffset=0;
 
3935
}
 
3936
 
 
3937
bool operator==(const DPLINE &lhs, const DPLINE &rhs) {
 
3938
 
 
3939
    return lhs.dphead==rhs.dphead &&
 
3940
           lhs.xaStart==rhs.xaStart &&
 
3941
           lhs.yaStart==rhs.yaStart &&
 
3942
           lhs.xaEnd==rhs.xaEnd &&
 
3943
           lhs.yaEnd==rhs.yaEnd &&
 
3944
           lhs.lnpc==rhs.lnpc &&
 
3945
           lhs.lnpw==rhs.lnpw &&
 
3946
           lhs.lnps==rhs.lnps &&
 
3947
           lhs.eppsStart==rhs.eppsStart &&
 
3948
           lhs.eppwStart==rhs.eppwStart &&
 
3949
           lhs.epplStart==rhs.epplStart &&
 
3950
           lhs.unused24_6==rhs.unused24_6 &&
 
3951
           lhs.eppsEnd==rhs.eppsEnd &&
 
3952
           lhs.eppwEnd==rhs.eppwEnd &&
 
3953
           lhs.epplEnd==rhs.epplEnd &&
 
3954
           lhs.unused26_6==rhs.unused26_6 &&
 
3955
           lhs.shdwpi==rhs.shdwpi &&
 
3956
           lhs.xaOffset==rhs.xaOffset &&
 
3957
           lhs.yaOffset==rhs.yaOffset;
 
3958
}
 
3959
 
 
3960
bool operator!=(const DPLINE &lhs, const DPLINE &rhs) {
 
3961
    return !(lhs==rhs);
 
3962
}
 
3963
 
 
3964
 
 
3965
// DPRECT implementation
 
3966
 
 
3967
DPRECT::DPRECT() {
 
3968
    clear();
 
3969
}
 
3970
 
 
3971
DPRECT::DPRECT(OLEStreamReader *stream, bool preservePos) {
 
3972
    clear();
 
3973
    read(stream, preservePos);
 
3974
}
 
3975
 
 
3976
bool DPRECT::read(OLEStreamReader *stream, bool preservePos) {
 
3977
 
 
3978
    U16 shifterU16;
 
3979
 
 
3980
    if(preservePos)
 
3981
        stream->push();
 
3982
 
 
3983
    dphead.read(stream, false);
 
3984
    lnpc=stream->readU32();
 
3985
    lnpw=stream->readU16();
 
3986
    lnps=stream->readU16();
 
3987
    dlpcFg=stream->readU32();
 
3988
    dlpcBg=stream->readU32();
 
3989
    flpp=stream->readU16();
 
3990
    shdwpi=stream->readU16();
 
3991
    xaOffset=stream->readU16();
 
3992
    yaOffset=stream->readU16();
 
3993
    shifterU16=stream->readU16();
 
3994
    fRoundCorners=shifterU16;
 
3995
    shifterU16>>=1;
 
3996
    zaShape=shifterU16;
 
3997
 
 
3998
    if(preservePos)
 
3999
        stream->pop();
 
4000
    return true;
 
4001
}
 
4002
 
 
4003
bool DPRECT::write(OLEStreamWriter *stream, bool preservePos) const {
 
4004
 
 
4005
    U16 shifterU16;
 
4006
 
 
4007
    if(preservePos)
 
4008
        stream->push();
 
4009
 
 
4010
    dphead.write(stream, false);
 
4011
    stream->write(lnpc);
 
4012
    stream->write(lnpw);
 
4013
    stream->write(lnps);
 
4014
    stream->write(dlpcFg);
 
4015
    stream->write(dlpcBg);
 
4016
    stream->write(flpp);
 
4017
    stream->write(shdwpi);
 
4018
    stream->write(xaOffset);
 
4019
    stream->write(yaOffset);
 
4020
    shifterU16=fRoundCorners;
 
4021
    shifterU16|=zaShape << 1;
 
4022
    stream->write(shifterU16);
 
4023
 
 
4024
    if(preservePos)
 
4025
        stream->pop();
 
4026
    return true;
 
4027
}
 
4028
 
 
4029
void DPRECT::clear() {
 
4030
    dphead.clear();
 
4031
    lnpc=0;
 
4032
    lnpw=0;
 
4033
    lnps=0;
 
4034
    dlpcFg=0;
 
4035
    dlpcBg=0;
 
4036
    flpp=0;
 
4037
    shdwpi=0;
 
4038
    xaOffset=0;
 
4039
    yaOffset=0;
 
4040
    fRoundCorners=0;
 
4041
    zaShape=0;
 
4042
}
 
4043
 
 
4044
bool operator==(const DPRECT &lhs, const DPRECT &rhs) {
 
4045
 
 
4046
    return lhs.dphead==rhs.dphead &&
 
4047
           lhs.lnpc==rhs.lnpc &&
 
4048
           lhs.lnpw==rhs.lnpw &&
 
4049
           lhs.lnps==rhs.lnps &&
 
4050
           lhs.dlpcFg==rhs.dlpcFg &&
 
4051
           lhs.dlpcBg==rhs.dlpcBg &&
 
4052
           lhs.flpp==rhs.flpp &&
 
4053
           lhs.shdwpi==rhs.shdwpi &&
 
4054
           lhs.xaOffset==rhs.xaOffset &&
 
4055
           lhs.yaOffset==rhs.yaOffset &&
 
4056
           lhs.fRoundCorners==rhs.fRoundCorners &&
 
4057
           lhs.zaShape==rhs.zaShape;
 
4058
}
 
4059
 
 
4060
bool operator!=(const DPRECT &lhs, const DPRECT &rhs) {
 
4061
    return !(lhs==rhs);
 
4062
}
 
4063
 
 
4064
 
 
4065
// DPSAMPLE implementation
 
4066
 
 
4067
DPSAMPLE::DPSAMPLE() {
 
4068
    clear();
 
4069
}
 
4070
 
 
4071
DPSAMPLE::DPSAMPLE(OLEStreamReader *stream, bool preservePos) {
 
4072
    clear();
 
4073
    read(stream, preservePos);
 
4074
}
 
4075
 
 
4076
bool DPSAMPLE::read(OLEStreamReader *stream, bool preservePos) {
 
4077
 
 
4078
    U16 shifterU16;
 
4079
 
 
4080
    if(preservePos)
 
4081
        stream->push();
 
4082
 
 
4083
    dphead.read(stream, false);
 
4084
    lnpc=stream->readU32();
 
4085
    lnpw=stream->readU16();
 
4086
    lnps=stream->readU16();
 
4087
    dlpcFg=stream->readU32();
 
4088
    dlpcBg=stream->readU32();
 
4089
    flpp=stream->readU16();
 
4090
    shifterU16=stream->readU16();
 
4091
    eppsStart=shifterU16;
 
4092
    shifterU16>>=2;
 
4093
    eppwStart=shifterU16;
 
4094
    shifterU16>>=2;
 
4095
    epplStart=shifterU16;
 
4096
    shifterU16>>=2;
 
4097
    unused30_6=shifterU16;
 
4098
    shifterU16=stream->readU16();
 
4099
    eppsEnd=shifterU16;
 
4100
    shifterU16>>=2;
 
4101
    eppwEnd=shifterU16;
 
4102
    shifterU16>>=2;
 
4103
    epplEnd=shifterU16;
 
4104
    shifterU16>>=2;
 
4105
    unused32_6=shifterU16;
 
4106
    shdwpi=stream->readU16();
 
4107
    xaOffset=stream->readU16();
 
4108
    yaOffset=stream->readU16();
 
4109
    unused40=stream->readU16();
 
4110
    dzaOffset=stream->readU16();
 
4111
    dzaDescent=stream->readU16();
 
4112
    dzaLength=stream->readU16();
 
4113
    shifterU16=stream->readU16();
 
4114
    fRoundCorners=shifterU16;
 
4115
    shifterU16>>=1;
 
4116
    zaShape=shifterU16;
 
4117
    dzaInternalMargin=stream->readU16();
 
4118
 
 
4119
    if(preservePos)
 
4120
        stream->pop();
 
4121
    return true;
 
4122
}
 
4123
 
 
4124
bool DPSAMPLE::write(OLEStreamWriter *stream, bool preservePos) const {
 
4125
 
 
4126
    U16 shifterU16;
 
4127
 
 
4128
    if(preservePos)
 
4129
        stream->push();
 
4130
 
 
4131
    dphead.write(stream, false);
 
4132
    stream->write(lnpc);
 
4133
    stream->write(lnpw);
 
4134
    stream->write(lnps);
 
4135
    stream->write(dlpcFg);
 
4136
    stream->write(dlpcBg);
 
4137
    stream->write(flpp);
 
4138
    shifterU16=eppsStart;
 
4139
    shifterU16|=eppwStart << 2;
 
4140
    shifterU16|=epplStart << 4;
 
4141
    shifterU16|=unused30_6 << 6;
 
4142
    stream->write(shifterU16);
 
4143
    shifterU16=eppsEnd;
 
4144
    shifterU16|=eppwEnd << 2;
 
4145
    shifterU16|=epplEnd << 4;
 
4146
    shifterU16|=unused32_6 << 6;
 
4147
    stream->write(shifterU16);
 
4148
    stream->write(shdwpi);
 
4149
    stream->write(xaOffset);
 
4150
    stream->write(yaOffset);
 
4151
    stream->write(unused40);
 
4152
    stream->write(dzaOffset);
 
4153
    stream->write(dzaDescent);
 
4154
    stream->write(dzaLength);
 
4155
    shifterU16=fRoundCorners;
 
4156
    shifterU16|=zaShape << 1;
 
4157
    stream->write(shifterU16);
 
4158
    stream->write(dzaInternalMargin);
 
4159
 
 
4160
    if(preservePos)
 
4161
        stream->pop();
 
4162
    return true;
 
4163
}
 
4164
 
 
4165
void DPSAMPLE::clear() {
 
4166
    dphead.clear();
 
4167
    lnpc=0;
 
4168
    lnpw=0;
 
4169
    lnps=0;
 
4170
    dlpcFg=0;
 
4171
    dlpcBg=0;
 
4172
    flpp=0;
 
4173
    eppsStart=0;
 
4174
    eppwStart=0;
 
4175
    epplStart=0;
 
4176
    unused30_6=0;
 
4177
    eppsEnd=0;
 
4178
    eppwEnd=0;
 
4179
    epplEnd=0;
 
4180
    unused32_6=0;
 
4181
    shdwpi=0;
 
4182
    xaOffset=0;
 
4183
    yaOffset=0;
 
4184
    unused40=0;
 
4185
    dzaOffset=0;
 
4186
    dzaDescent=0;
 
4187
    dzaLength=0;
 
4188
    fRoundCorners=0;
 
4189
    zaShape=0;
 
4190
    dzaInternalMargin=0;
 
4191
}
 
4192
 
 
4193
bool operator==(const DPSAMPLE &lhs, const DPSAMPLE &rhs) {
 
4194
 
 
4195
    return lhs.dphead==rhs.dphead &&
 
4196
           lhs.lnpc==rhs.lnpc &&
 
4197
           lhs.lnpw==rhs.lnpw &&
 
4198
           lhs.lnps==rhs.lnps &&
 
4199
           lhs.dlpcFg==rhs.dlpcFg &&
 
4200
           lhs.dlpcBg==rhs.dlpcBg &&
 
4201
           lhs.flpp==rhs.flpp &&
 
4202
           lhs.eppsStart==rhs.eppsStart &&
 
4203
           lhs.eppwStart==rhs.eppwStart &&
 
4204
           lhs.epplStart==rhs.epplStart &&
 
4205
           lhs.unused30_6==rhs.unused30_6 &&
 
4206
           lhs.eppsEnd==rhs.eppsEnd &&
 
4207
           lhs.eppwEnd==rhs.eppwEnd &&
 
4208
           lhs.epplEnd==rhs.epplEnd &&
 
4209
           lhs.unused32_6==rhs.unused32_6 &&
 
4210
           lhs.shdwpi==rhs.shdwpi &&
 
4211
           lhs.xaOffset==rhs.xaOffset &&
 
4212
           lhs.yaOffset==rhs.yaOffset &&
 
4213
           lhs.unused40==rhs.unused40 &&
 
4214
           lhs.dzaOffset==rhs.dzaOffset &&
 
4215
           lhs.dzaDescent==rhs.dzaDescent &&
 
4216
           lhs.dzaLength==rhs.dzaLength &&
 
4217
           lhs.fRoundCorners==rhs.fRoundCorners &&
 
4218
           lhs.zaShape==rhs.zaShape &&
 
4219
           lhs.dzaInternalMargin==rhs.dzaInternalMargin;
 
4220
}
 
4221
 
 
4222
bool operator!=(const DPSAMPLE &lhs, const DPSAMPLE &rhs) {
 
4223
    return !(lhs==rhs);
 
4224
}
 
4225
 
 
4226
 
 
4227
// FDOA implementation
 
4228
 
 
4229
FDOA::FDOA() {
 
4230
    clear();
 
4231
}
 
4232
 
 
4233
FDOA::FDOA(OLEStreamReader *stream, bool preservePos) {
 
4234
    clear();
 
4235
    read(stream, preservePos);
 
4236
}
 
4237
 
 
4238
bool FDOA::read(OLEStreamReader *stream, bool preservePos) {
 
4239
 
 
4240
    if(preservePos)
 
4241
        stream->push();
 
4242
 
 
4243
    fc=stream->readU32();
 
4244
    ctxbx=stream->readU16();
 
4245
 
 
4246
    if(preservePos)
 
4247
        stream->pop();
 
4248
    return true;
 
4249
}
 
4250
 
 
4251
bool FDOA::write(OLEStreamWriter *stream, bool preservePos) const {
 
4252
 
 
4253
    if(preservePos)
 
4254
        stream->push();
 
4255
 
 
4256
    stream->write(fc);
 
4257
    stream->write(ctxbx);
 
4258
 
 
4259
    if(preservePos)
 
4260
        stream->pop();
 
4261
    return true;
 
4262
}
 
4263
 
 
4264
void FDOA::clear() {
 
4265
    fc=0;
 
4266
    ctxbx=0;
 
4267
}
 
4268
 
 
4269
bool operator==(const FDOA &lhs, const FDOA &rhs) {
 
4270
 
 
4271
    return lhs.fc==rhs.fc &&
 
4272
           lhs.ctxbx==rhs.ctxbx;
 
4273
}
 
4274
 
 
4275
bool operator!=(const FDOA &lhs, const FDOA &rhs) {
 
4276
    return !(lhs==rhs);
 
4277
}
 
4278
 
 
4279
 
 
4280
// FIB implementation
 
4281
 
 
4282
FIB::FIB() {
 
4283
    clear();
 
4284
}
 
4285
 
 
4286
FIB::FIB(OLEStreamReader *stream, bool preservePos) {
 
4287
    clear();
 
4288
    read(stream, preservePos);
 
4289
}
 
4290
 
 
4291
bool FIB::read(OLEStreamReader *stream, bool preservePos) {
 
4292
 
 
4293
    U16 shifterU16;
 
4294
 
 
4295
    if(preservePos)
 
4296
        stream->push();
 
4297
 
 
4298
    wIdent=stream->readU16();
 
4299
    nFib=stream->readU16();
 
4300
    nProduct=stream->readU16();
 
4301
    lid=stream->readU16();
 
4302
    pnNext=stream->readU16();
 
4303
    shifterU16=stream->readU16();
 
4304
    fDot=shifterU16;
 
4305
    shifterU16>>=1;
 
4306
    fGlsy=shifterU16;
 
4307
    shifterU16>>=1;
 
4308
    fComplex=shifterU16;
 
4309
    shifterU16>>=1;
 
4310
    fHasPic=shifterU16;
 
4311
    shifterU16>>=1;
 
4312
    cQuickSaves=shifterU16;
 
4313
    shifterU16>>=4;
 
4314
    fEncrypted=shifterU16;
 
4315
    shifterU16>>=1;
 
4316
    unused10_9=shifterU16;
 
4317
    shifterU16>>=1;
 
4318
    fReadOnlyRecommended=shifterU16;
 
4319
    shifterU16>>=1;
 
4320
    fWriteReservation=shifterU16;
 
4321
    shifterU16>>=1;
 
4322
    fExtChar=shifterU16;
 
4323
    shifterU16>>=1;
 
4324
    unused10_13=shifterU16;
 
4325
    nFibBack=stream->readU16();
 
4326
    lKey=stream->readU32();
 
4327
    envr=stream->readU8();
 
4328
    unused19=stream->readU8();
 
4329
    chse=stream->readU16();
 
4330
    chseTables=stream->readU16();
 
4331
    fcMin=stream->readU32();
 
4332
    fcMac=stream->readU32();
 
4333
    cbMac=stream->readU32();
 
4334
    fcSpare0=stream->readU32();
 
4335
    fcSpare1=stream->readU32();
 
4336
    fcSpare2=stream->readU32();
 
4337
    fcSpare3=stream->readU32();
 
4338
    ccpText=stream->readU32();
 
4339
    ccpFtn=stream->readU32();
 
4340
    ccpHdd=stream->readU32();
 
4341
    ccpMcr=stream->readU32();
 
4342
    ccpAtn=stream->readU32();
 
4343
    ccpEdn=stream->readU32();
 
4344
    ccpTxbx=stream->readU32();
 
4345
    ccpHdrTxbx=stream->readU32();
 
4346
    ccpSpare2=stream->readU32();
 
4347
    fcStshfOrig=stream->readU32();
 
4348
    lcbStshfOrig=stream->readU32();
 
4349
    fcStshf=stream->readU32();
 
4350
    lcbStshf=stream->readU32();
 
4351
    fcPlcffndRef=stream->readU32();
 
4352
    lcbPlcffndRef=stream->readU32();
 
4353
    fcPlcffndTxt=stream->readU32();
 
4354
    lcbPlcffndTxt=stream->readU32();
 
4355
    fcPlcfandRef=stream->readU32();
 
4356
    lcbPlcfandRef=stream->readU32();
 
4357
    fcPlcfandTxt=stream->readU32();
 
4358
    lcbPlcfandTxt=stream->readU32();
 
4359
    fcPlcfsed=stream->readU32();
 
4360
    lcbPlcfsed=stream->readU32();
 
4361
    fcPlcfpad=stream->readU32();
 
4362
    lcbPlcfpad=stream->readU32();
 
4363
    fcPlcfphe=stream->readU32();
 
4364
    lcbPlcfphe=stream->readU32();
 
4365
    fcSttbfglsy=stream->readU32();
 
4366
    lcbSttbfglsy=stream->readU32();
 
4367
    fcPlcfglsy=stream->readU32();
 
4368
    lcbPlcfglsy=stream->readU32();
 
4369
    fcPlcfhdd=stream->readU32();
 
4370
    lcbPlcfhdd=stream->readU32();
 
4371
    fcPlcfbteChpx=stream->readU32();
 
4372
    lcbPlcfbteChpx=stream->readU32();
 
4373
    fcPlcfbtePapx=stream->readU32();
 
4374
    lcbPlcfbtePapx=stream->readU32();
 
4375
    fcPlcfsea=stream->readU32();
 
4376
    lcbPlcfsea=stream->readU32();
 
4377
    fcSttbfffn=stream->readU32();
 
4378
    lcbSttbfffn=stream->readU32();
 
4379
    fcPlcffldMom=stream->readU32();
 
4380
    lcbPlcffldMom=stream->readU32();
 
4381
    fcPlcffldHdr=stream->readU32();
 
4382
    lcbPlcffldHdr=stream->readU32();
 
4383
    fcPlcffldFtn=stream->readU32();
 
4384
    lcbPlcffldFtn=stream->readU32();
 
4385
    fcPlcffldAtn=stream->readU32();
 
4386
    lcbPlcffldAtn=stream->readU32();
 
4387
    fcPlcffldMcr=stream->readU32();
 
4388
    lcbPlcffldMcr=stream->readU32();
 
4389
    fcSttbfbkmk=stream->readU32();
 
4390
    lcbSttbfbkmk=stream->readU32();
 
4391
    fcPlcfbkf=stream->readU32();
 
4392
    lcbPlcfbkf=stream->readU32();
 
4393
    fcPlcfbkl=stream->readU32();
 
4394
    lcbPlcfbkl=stream->readU32();
 
4395
    fcCmds=stream->readU32();
 
4396
    lcbCmds=stream->readU32();
 
4397
    fcPlcmcr=stream->readU32();
 
4398
    lcbPlcmcr=stream->readU32();
 
4399
    fcSttbfmcr=stream->readU32();
 
4400
    lcbSttbfmcr=stream->readU32();
 
4401
    fcPrDrvr=stream->readU32();
 
4402
    lcbPrDrvr=stream->readU32();
 
4403
    fcPrEnvPort=stream->readU32();
 
4404
    lcbPrEnvPort=stream->readU32();
 
4405
    fcPrEnvLand=stream->readU32();
 
4406
    lcbPrEnvLand=stream->readU32();
 
4407
    fcWss=stream->readU32();
 
4408
    lcbWss=stream->readU32();
 
4409
    fcDop=stream->readU32();
 
4410
    lcbDop=stream->readU32();
 
4411
    fcSttbfAssoc=stream->readU32();
 
4412
    lcbSttbfAssoc=stream->readU32();
 
4413
    fcClx=stream->readU32();
 
4414
    lcbClx=stream->readU32();
 
4415
    fcPlcfpgdFtn=stream->readU32();
 
4416
    lcbPlcfpgdFtn=stream->readU32();
 
4417
    fcAutosaveSource=stream->readU32();
 
4418
    lcbAutosaveSource=stream->readU32();
 
4419
    fcGrpStAtnOwners=stream->readU32();
 
4420
    lcbGrpStAtnOwners=stream->readU32();
 
4421
    fcSttbfAtnbkmk=stream->readU32();
 
4422
    lcbSttbfAtnbkmk=stream->readU32();
 
4423
    wSpare4Fib=stream->readU16();
 
4424
    pnChpFirst=stream->readU16();
 
4425
    pnPapFirst=stream->readU16();
 
4426
    cpnBteChp=stream->readU16();
 
4427
    cpnBtePap=stream->readU16();
 
4428
    fcPlcfdoaMom=stream->readU32();
 
4429
    lcbPlcfdoaMom=stream->readU32();
 
4430
    fcPlcfdoaHdr=stream->readU32();
 
4431
    lcbPlcfdoaHdr=stream->readU32();
 
4432
    fcUnused1=stream->readU32();
 
4433
    lcbUnused1=stream->readU32();
 
4434
    fcUnused2=stream->readU32();
 
4435
    lcbUnused2=stream->readU32();
 
4436
    fcPlcfAtnbkf=stream->readU32();
 
4437
    lcbPlcfAtnbkf=stream->readU32();
 
4438
    fcPlcfAtnbkl=stream->readU32();
 
4439
    lcbPlcfAtnbkl=stream->readU32();
 
4440
    fcPms=stream->readU32();
 
4441
    lcbPms=stream->readU32();
 
4442
    fcFormFldSttbf=stream->readU32();
 
4443
    lcbFormFldSttbf=stream->readU32();
 
4444
    fcPlcfendRef=stream->readU32();
 
4445
    lcbPlcfendRef=stream->readU32();
 
4446
    fcPlcfendTxt=stream->readU32();
 
4447
    lcbPlcfendTxt=stream->readU32();
 
4448
    fcPlcffldEdn=stream->readU32();
 
4449
    lcbPlcffldEdn=stream->readU32();
 
4450
    fcPlcfpgdEdn=stream->readU32();
 
4451
    lcbPlcfpgdEdn=stream->readU32();
 
4452
    fcUnused3=stream->readU32();
 
4453
    lcbUnused3=stream->readU32();
 
4454
    fcSttbfRMark=stream->readU32();
 
4455
    lcbSttbfRMark=stream->readU32();
 
4456
    fcSttbfCaption=stream->readU32();
 
4457
    lcbSttbfCaption=stream->readU32();
 
4458
    fcSttbfAutoCaption=stream->readU32();
 
4459
    lcbSttbfAutoCaption=stream->readU32();
 
4460
    fcPlcfwkb=stream->readU32();
 
4461
    lcbPlcfwkb=stream->readU32();
 
4462
    fcUnused4=stream->readU32();
 
4463
    lcbUnused4=stream->readU32();
 
4464
    fcPlcftxbxTxt=stream->readU32();
 
4465
    lcbPlcftxbxTxt=stream->readU32();
 
4466
    fcPlcffldTxbx=stream->readU32();
 
4467
    lcbPlcffldTxbx=stream->readU32();
 
4468
    fcPlcfHdrtxbxTxt=stream->readU32();
 
4469
    lcbPlcfHdrtxbxTxt=stream->readU32();
 
4470
    fcPlcffldHdrTxbx=stream->readU32();
 
4471
    lcbPlcffldHdrTxbx=stream->readU32();
 
4472
    fcStwUser=stream->readU32();
 
4473
    lcbStwUser=stream->readU32();
 
4474
    fcSttbttmbd=stream->readU32();
 
4475
    lcbSttbttmbd=stream->readU32();
 
4476
    fcUnused=stream->readU32();
 
4477
    lcbUnused=stream->readU32();
 
4478
    fcPgdMother=stream->readU32();
 
4479
    lcbPgdMother=stream->readU32();
 
4480
    fcBkdMother=stream->readU32();
 
4481
    lcbBkdMother=stream->readU32();
 
4482
    fcPgdFtn=stream->readU32();
 
4483
    lcbPgdFtn=stream->readU32();
 
4484
    fcBkdFtn=stream->readU32();
 
4485
    lcbBkdFtn=stream->readU32();
 
4486
    fcPgdEdn=stream->readU32();
 
4487
    lcbPgdEdn=stream->readU32();
 
4488
    fcBkdEdn=stream->readU32();
 
4489
    lcbBkdEdn=stream->readU32();
 
4490
    fcSttbfIntlFld=stream->readU32();
 
4491
    lcbSttbfIntlFld=stream->readU32();
 
4492
    fcRouteSlip=stream->readU32();
 
4493
    lcbRouteSlip=stream->readU32();
 
4494
    fcSttbSavedBy=stream->readU32();
 
4495
    lcbSttbSavedBy=stream->readU32();
 
4496
    fcSttbFnm=stream->readU32();
 
4497
    lcbSttbFnm=stream->readU32();
 
4498
 
 
4499
    if(preservePos)
 
4500
        stream->pop();
 
4501
    return true;
 
4502
}
 
4503
 
 
4504
bool FIB::write(OLEStreamWriter *stream, bool preservePos) const {
 
4505
 
 
4506
    U16 shifterU16;
 
4507
 
 
4508
    if(preservePos)
 
4509
        stream->push();
 
4510
 
 
4511
    stream->write(wIdent);
 
4512
    stream->write(nFib);
 
4513
    stream->write(nProduct);
 
4514
    stream->write(lid);
 
4515
    stream->write(pnNext);
 
4516
    shifterU16=fDot;
 
4517
    shifterU16|=fGlsy << 1;
 
4518
    shifterU16|=fComplex << 2;
 
4519
    shifterU16|=fHasPic << 3;
 
4520
    shifterU16|=cQuickSaves << 4;
 
4521
    shifterU16|=fEncrypted << 8;
 
4522
    shifterU16|=unused10_9 << 9;
 
4523
    shifterU16|=fReadOnlyRecommended << 10;
 
4524
    shifterU16|=fWriteReservation << 11;
 
4525
    shifterU16|=fExtChar << 12;
 
4526
    shifterU16|=unused10_13 << 13;
 
4527
    stream->write(shifterU16);
 
4528
    stream->write(nFibBack);
 
4529
    stream->write(lKey);
 
4530
    stream->write(envr);
 
4531
    stream->write(unused19);
 
4532
    stream->write(chse);
 
4533
    stream->write(chseTables);
 
4534
    stream->write(fcMin);
 
4535
    stream->write(fcMac);
 
4536
    stream->write(cbMac);
 
4537
    stream->write(fcSpare0);
 
4538
    stream->write(fcSpare1);
 
4539
    stream->write(fcSpare2);
 
4540
    stream->write(fcSpare3);
 
4541
    stream->write(ccpText);
 
4542
    stream->write(ccpFtn);
 
4543
    stream->write(ccpHdd);
 
4544
    stream->write(ccpMcr);
 
4545
    stream->write(ccpAtn);
 
4546
    stream->write(ccpEdn);
 
4547
    stream->write(ccpTxbx);
 
4548
    stream->write(ccpHdrTxbx);
 
4549
    stream->write(ccpSpare2);
 
4550
    stream->write(fcStshfOrig);
 
4551
    stream->write(lcbStshfOrig);
 
4552
    stream->write(fcStshf);
 
4553
    stream->write(lcbStshf);
 
4554
    stream->write(fcPlcffndRef);
 
4555
    stream->write(lcbPlcffndRef);
 
4556
    stream->write(fcPlcffndTxt);
 
4557
    stream->write(lcbPlcffndTxt);
 
4558
    stream->write(fcPlcfandRef);
 
4559
    stream->write(lcbPlcfandRef);
 
4560
    stream->write(fcPlcfandTxt);
 
4561
    stream->write(lcbPlcfandTxt);
 
4562
    stream->write(fcPlcfsed);
 
4563
    stream->write(lcbPlcfsed);
 
4564
    stream->write(fcPlcfpad);
 
4565
    stream->write(lcbPlcfpad);
 
4566
    stream->write(fcPlcfphe);
 
4567
    stream->write(lcbPlcfphe);
 
4568
    stream->write(fcSttbfglsy);
 
4569
    stream->write(lcbSttbfglsy);
 
4570
    stream->write(fcPlcfglsy);
 
4571
    stream->write(lcbPlcfglsy);
 
4572
    stream->write(fcPlcfhdd);
 
4573
    stream->write(lcbPlcfhdd);
 
4574
    stream->write(fcPlcfbteChpx);
 
4575
    stream->write(lcbPlcfbteChpx);
 
4576
    stream->write(fcPlcfbtePapx);
 
4577
    stream->write(lcbPlcfbtePapx);
 
4578
    stream->write(fcPlcfsea);
 
4579
    stream->write(lcbPlcfsea);
 
4580
    stream->write(fcSttbfffn);
 
4581
    stream->write(lcbSttbfffn);
 
4582
    stream->write(fcPlcffldMom);
 
4583
    stream->write(lcbPlcffldMom);
 
4584
    stream->write(fcPlcffldHdr);
 
4585
    stream->write(lcbPlcffldHdr);
 
4586
    stream->write(fcPlcffldFtn);
 
4587
    stream->write(lcbPlcffldFtn);
 
4588
    stream->write(fcPlcffldAtn);
 
4589
    stream->write(lcbPlcffldAtn);
 
4590
    stream->write(fcPlcffldMcr);
 
4591
    stream->write(lcbPlcffldMcr);
 
4592
    stream->write(fcSttbfbkmk);
 
4593
    stream->write(lcbSttbfbkmk);
 
4594
    stream->write(fcPlcfbkf);
 
4595
    stream->write(lcbPlcfbkf);
 
4596
    stream->write(fcPlcfbkl);
 
4597
    stream->write(lcbPlcfbkl);
 
4598
    stream->write(fcCmds);
 
4599
    stream->write(lcbCmds);
 
4600
    stream->write(fcPlcmcr);
 
4601
    stream->write(lcbPlcmcr);
 
4602
    stream->write(fcSttbfmcr);
 
4603
    stream->write(lcbSttbfmcr);
 
4604
    stream->write(fcPrDrvr);
 
4605
    stream->write(lcbPrDrvr);
 
4606
    stream->write(fcPrEnvPort);
 
4607
    stream->write(lcbPrEnvPort);
 
4608
    stream->write(fcPrEnvLand);
 
4609
    stream->write(lcbPrEnvLand);
 
4610
    stream->write(fcWss);
 
4611
    stream->write(lcbWss);
 
4612
    stream->write(fcDop);
 
4613
    stream->write(lcbDop);
 
4614
    stream->write(fcSttbfAssoc);
 
4615
    stream->write(lcbSttbfAssoc);
 
4616
    stream->write(fcClx);
 
4617
    stream->write(lcbClx);
 
4618
    stream->write(fcPlcfpgdFtn);
 
4619
    stream->write(lcbPlcfpgdFtn);
 
4620
    stream->write(fcAutosaveSource);
 
4621
    stream->write(lcbAutosaveSource);
 
4622
    stream->write(fcGrpStAtnOwners);
 
4623
    stream->write(lcbGrpStAtnOwners);
 
4624
    stream->write(fcSttbfAtnbkmk);
 
4625
    stream->write(lcbSttbfAtnbkmk);
 
4626
    stream->write(wSpare4Fib);
 
4627
    stream->write(pnChpFirst);
 
4628
    stream->write(pnPapFirst);
 
4629
    stream->write(cpnBteChp);
 
4630
    stream->write(cpnBtePap);
 
4631
    stream->write(fcPlcfdoaMom);
 
4632
    stream->write(lcbPlcfdoaMom);
 
4633
    stream->write(fcPlcfdoaHdr);
 
4634
    stream->write(lcbPlcfdoaHdr);
 
4635
    stream->write(fcUnused1);
 
4636
    stream->write(lcbUnused1);
 
4637
    stream->write(fcUnused2);
 
4638
    stream->write(lcbUnused2);
 
4639
    stream->write(fcPlcfAtnbkf);
 
4640
    stream->write(lcbPlcfAtnbkf);
 
4641
    stream->write(fcPlcfAtnbkl);
 
4642
    stream->write(lcbPlcfAtnbkl);
 
4643
    stream->write(fcPms);
 
4644
    stream->write(lcbPms);
 
4645
    stream->write(fcFormFldSttbf);
 
4646
    stream->write(lcbFormFldSttbf);
 
4647
    stream->write(fcPlcfendRef);
 
4648
    stream->write(lcbPlcfendRef);
 
4649
    stream->write(fcPlcfendTxt);
 
4650
    stream->write(lcbPlcfendTxt);
 
4651
    stream->write(fcPlcffldEdn);
 
4652
    stream->write(lcbPlcffldEdn);
 
4653
    stream->write(fcPlcfpgdEdn);
 
4654
    stream->write(lcbPlcfpgdEdn);
 
4655
    stream->write(fcUnused3);
 
4656
    stream->write(lcbUnused3);
 
4657
    stream->write(fcSttbfRMark);
 
4658
    stream->write(lcbSttbfRMark);
 
4659
    stream->write(fcSttbfCaption);
 
4660
    stream->write(lcbSttbfCaption);
 
4661
    stream->write(fcSttbfAutoCaption);
 
4662
    stream->write(lcbSttbfAutoCaption);
 
4663
    stream->write(fcPlcfwkb);
 
4664
    stream->write(lcbPlcfwkb);
 
4665
    stream->write(fcUnused4);
 
4666
    stream->write(lcbUnused4);
 
4667
    stream->write(fcPlcftxbxTxt);
 
4668
    stream->write(lcbPlcftxbxTxt);
 
4669
    stream->write(fcPlcffldTxbx);
 
4670
    stream->write(lcbPlcffldTxbx);
 
4671
    stream->write(fcPlcfHdrtxbxTxt);
 
4672
    stream->write(lcbPlcfHdrtxbxTxt);
 
4673
    stream->write(fcPlcffldHdrTxbx);
 
4674
    stream->write(lcbPlcffldHdrTxbx);
 
4675
    stream->write(fcStwUser);
 
4676
    stream->write(lcbStwUser);
 
4677
    stream->write(fcSttbttmbd);
 
4678
    stream->write(lcbSttbttmbd);
 
4679
    stream->write(fcUnused);
 
4680
    stream->write(lcbUnused);
 
4681
    stream->write(fcPgdMother);
 
4682
    stream->write(lcbPgdMother);
 
4683
    stream->write(fcBkdMother);
 
4684
    stream->write(lcbBkdMother);
 
4685
    stream->write(fcPgdFtn);
 
4686
    stream->write(lcbPgdFtn);
 
4687
    stream->write(fcBkdFtn);
 
4688
    stream->write(lcbBkdFtn);
 
4689
    stream->write(fcPgdEdn);
 
4690
    stream->write(lcbPgdEdn);
 
4691
    stream->write(fcBkdEdn);
 
4692
    stream->write(lcbBkdEdn);
 
4693
    stream->write(fcSttbfIntlFld);
 
4694
    stream->write(lcbSttbfIntlFld);
 
4695
    stream->write(fcRouteSlip);
 
4696
    stream->write(lcbRouteSlip);
 
4697
    stream->write(fcSttbSavedBy);
 
4698
    stream->write(lcbSttbSavedBy);
 
4699
    stream->write(fcSttbFnm);
 
4700
    stream->write(lcbSttbFnm);
 
4701
 
 
4702
    if(preservePos)
 
4703
        stream->pop();
 
4704
    return true;
 
4705
}
 
4706
 
 
4707
void FIB::clear() {
 
4708
    wIdent=0;
 
4709
    nFib=0;
 
4710
    nProduct=0;
 
4711
    lid=0;
 
4712
    pnNext=0;
 
4713
    fDot=0;
 
4714
    fGlsy=0;
 
4715
    fComplex=0;
 
4716
    fHasPic=0;
 
4717
    cQuickSaves=0;
 
4718
    fEncrypted=0;
 
4719
    unused10_9=0;
 
4720
    fReadOnlyRecommended=0;
 
4721
    fWriteReservation=0;
 
4722
    fExtChar=0;
 
4723
    unused10_13=0;
 
4724
    nFibBack=0;
 
4725
    lKey=0;
 
4726
    envr=0;
 
4727
    unused19=0;
 
4728
    chse=0;
 
4729
    chseTables=0;
 
4730
    fcMin=0;
 
4731
    fcMac=0;
 
4732
    cbMac=0;
 
4733
    fcSpare0=0;
 
4734
    fcSpare1=0;
 
4735
    fcSpare2=0;
 
4736
    fcSpare3=0;
 
4737
    ccpText=0;
 
4738
    ccpFtn=0;
 
4739
    ccpHdd=0;
 
4740
    ccpMcr=0;
 
4741
    ccpAtn=0;
 
4742
    ccpEdn=0;
 
4743
    ccpTxbx=0;
 
4744
    ccpHdrTxbx=0;
 
4745
    ccpSpare2=0;
 
4746
    fcStshfOrig=0;
 
4747
    lcbStshfOrig=0;
 
4748
    fcStshf=0;
 
4749
    lcbStshf=0;
 
4750
    fcPlcffndRef=0;
 
4751
    lcbPlcffndRef=0;
 
4752
    fcPlcffndTxt=0;
 
4753
    lcbPlcffndTxt=0;
 
4754
    fcPlcfandRef=0;
 
4755
    lcbPlcfandRef=0;
 
4756
    fcPlcfandTxt=0;
 
4757
    lcbPlcfandTxt=0;
 
4758
    fcPlcfsed=0;
 
4759
    lcbPlcfsed=0;
 
4760
    fcPlcfpad=0;
 
4761
    lcbPlcfpad=0;
 
4762
    fcPlcfphe=0;
 
4763
    lcbPlcfphe=0;
 
4764
    fcSttbfglsy=0;
 
4765
    lcbSttbfglsy=0;
 
4766
    fcPlcfglsy=0;
 
4767
    lcbPlcfglsy=0;
 
4768
    fcPlcfhdd=0;
 
4769
    lcbPlcfhdd=0;
 
4770
    fcPlcfbteChpx=0;
 
4771
    lcbPlcfbteChpx=0;
 
4772
    fcPlcfbtePapx=0;
 
4773
    lcbPlcfbtePapx=0;
 
4774
    fcPlcfsea=0;
 
4775
    lcbPlcfsea=0;
 
4776
    fcSttbfffn=0;
 
4777
    lcbSttbfffn=0;
 
4778
    fcPlcffldMom=0;
 
4779
    lcbPlcffldMom=0;
 
4780
    fcPlcffldHdr=0;
 
4781
    lcbPlcffldHdr=0;
 
4782
    fcPlcffldFtn=0;
 
4783
    lcbPlcffldFtn=0;
 
4784
    fcPlcffldAtn=0;
 
4785
    lcbPlcffldAtn=0;
 
4786
    fcPlcffldMcr=0;
 
4787
    lcbPlcffldMcr=0;
 
4788
    fcSttbfbkmk=0;
 
4789
    lcbSttbfbkmk=0;
 
4790
    fcPlcfbkf=0;
 
4791
    lcbPlcfbkf=0;
 
4792
    fcPlcfbkl=0;
 
4793
    lcbPlcfbkl=0;
 
4794
    fcCmds=0;
 
4795
    lcbCmds=0;
 
4796
    fcPlcmcr=0;
 
4797
    lcbPlcmcr=0;
 
4798
    fcSttbfmcr=0;
 
4799
    lcbSttbfmcr=0;
 
4800
    fcPrDrvr=0;
 
4801
    lcbPrDrvr=0;
 
4802
    fcPrEnvPort=0;
 
4803
    lcbPrEnvPort=0;
 
4804
    fcPrEnvLand=0;
 
4805
    lcbPrEnvLand=0;
 
4806
    fcWss=0;
 
4807
    lcbWss=0;
 
4808
    fcDop=0;
 
4809
    lcbDop=0;
 
4810
    fcSttbfAssoc=0;
 
4811
    lcbSttbfAssoc=0;
 
4812
    fcClx=0;
 
4813
    lcbClx=0;
 
4814
    fcPlcfpgdFtn=0;
 
4815
    lcbPlcfpgdFtn=0;
 
4816
    fcAutosaveSource=0;
 
4817
    lcbAutosaveSource=0;
 
4818
    fcGrpStAtnOwners=0;
 
4819
    lcbGrpStAtnOwners=0;
 
4820
    fcSttbfAtnbkmk=0;
 
4821
    lcbSttbfAtnbkmk=0;
 
4822
    wSpare4Fib=0;
 
4823
    pnChpFirst=0;
 
4824
    pnPapFirst=0;
 
4825
    cpnBteChp=0;
 
4826
    cpnBtePap=0;
 
4827
    fcPlcfdoaMom=0;
 
4828
    lcbPlcfdoaMom=0;
 
4829
    fcPlcfdoaHdr=0;
 
4830
    lcbPlcfdoaHdr=0;
 
4831
    fcUnused1=0;
 
4832
    lcbUnused1=0;
 
4833
    fcUnused2=0;
 
4834
    lcbUnused2=0;
 
4835
    fcPlcfAtnbkf=0;
 
4836
    lcbPlcfAtnbkf=0;
 
4837
    fcPlcfAtnbkl=0;
 
4838
    lcbPlcfAtnbkl=0;
 
4839
    fcPms=0;
 
4840
    lcbPms=0;
 
4841
    fcFormFldSttbf=0;
 
4842
    lcbFormFldSttbf=0;
 
4843
    fcPlcfendRef=0;
 
4844
    lcbPlcfendRef=0;
 
4845
    fcPlcfendTxt=0;
 
4846
    lcbPlcfendTxt=0;
 
4847
    fcPlcffldEdn=0;
 
4848
    lcbPlcffldEdn=0;
 
4849
    fcPlcfpgdEdn=0;
 
4850
    lcbPlcfpgdEdn=0;
 
4851
    fcUnused3=0;
 
4852
    lcbUnused3=0;
 
4853
    fcSttbfRMark=0;
 
4854
    lcbSttbfRMark=0;
 
4855
    fcSttbfCaption=0;
 
4856
    lcbSttbfCaption=0;
 
4857
    fcSttbfAutoCaption=0;
 
4858
    lcbSttbfAutoCaption=0;
 
4859
    fcPlcfwkb=0;
 
4860
    lcbPlcfwkb=0;
 
4861
    fcUnused4=0;
 
4862
    lcbUnused4=0;
 
4863
    fcPlcftxbxTxt=0;
 
4864
    lcbPlcftxbxTxt=0;
 
4865
    fcPlcffldTxbx=0;
 
4866
    lcbPlcffldTxbx=0;
 
4867
    fcPlcfHdrtxbxTxt=0;
 
4868
    lcbPlcfHdrtxbxTxt=0;
 
4869
    fcPlcffldHdrTxbx=0;
 
4870
    lcbPlcffldHdrTxbx=0;
 
4871
    fcStwUser=0;
 
4872
    lcbStwUser=0;
 
4873
    fcSttbttmbd=0;
 
4874
    lcbSttbttmbd=0;
 
4875
    fcUnused=0;
 
4876
    lcbUnused=0;
 
4877
    fcPgdMother=0;
 
4878
    lcbPgdMother=0;
 
4879
    fcBkdMother=0;
 
4880
    lcbBkdMother=0;
 
4881
    fcPgdFtn=0;
 
4882
    lcbPgdFtn=0;
 
4883
    fcBkdFtn=0;
 
4884
    lcbBkdFtn=0;
 
4885
    fcPgdEdn=0;
 
4886
    lcbPgdEdn=0;
 
4887
    fcBkdEdn=0;
 
4888
    lcbBkdEdn=0;
 
4889
    fcSttbfIntlFld=0;
 
4890
    lcbSttbfIntlFld=0;
 
4891
    fcRouteSlip=0;
 
4892
    lcbRouteSlip=0;
 
4893
    fcSttbSavedBy=0;
 
4894
    lcbSttbSavedBy=0;
 
4895
    fcSttbFnm=0;
 
4896
    lcbSttbFnm=0;
 
4897
}
 
4898
 
 
4899
bool operator==(const FIB &lhs, const FIB &rhs) {
 
4900
 
 
4901
    return lhs.wIdent==rhs.wIdent &&
 
4902
           lhs.nFib==rhs.nFib &&
 
4903
           lhs.nProduct==rhs.nProduct &&
 
4904
           lhs.lid==rhs.lid &&
 
4905
           lhs.pnNext==rhs.pnNext &&
 
4906
           lhs.fDot==rhs.fDot &&
 
4907
           lhs.fGlsy==rhs.fGlsy &&
 
4908
           lhs.fComplex==rhs.fComplex &&
 
4909
           lhs.fHasPic==rhs.fHasPic &&
 
4910
           lhs.cQuickSaves==rhs.cQuickSaves &&
 
4911
           lhs.fEncrypted==rhs.fEncrypted &&
 
4912
           lhs.unused10_9==rhs.unused10_9 &&
 
4913
           lhs.fReadOnlyRecommended==rhs.fReadOnlyRecommended &&
 
4914
           lhs.fWriteReservation==rhs.fWriteReservation &&
 
4915
           lhs.fExtChar==rhs.fExtChar &&
 
4916
           lhs.unused10_13==rhs.unused10_13 &&
 
4917
           lhs.nFibBack==rhs.nFibBack &&
 
4918
           lhs.lKey==rhs.lKey &&
 
4919
           lhs.envr==rhs.envr &&
 
4920
           lhs.unused19==rhs.unused19 &&
 
4921
           lhs.chse==rhs.chse &&
 
4922
           lhs.chseTables==rhs.chseTables &&
 
4923
           lhs.fcMin==rhs.fcMin &&
 
4924
           lhs.fcMac==rhs.fcMac &&
 
4925
           lhs.cbMac==rhs.cbMac &&
 
4926
           lhs.fcSpare0==rhs.fcSpare0 &&
 
4927
           lhs.fcSpare1==rhs.fcSpare1 &&
 
4928
           lhs.fcSpare2==rhs.fcSpare2 &&
 
4929
           lhs.fcSpare3==rhs.fcSpare3 &&
 
4930
           lhs.ccpText==rhs.ccpText &&
 
4931
           lhs.ccpFtn==rhs.ccpFtn &&
 
4932
           lhs.ccpHdd==rhs.ccpHdd &&
 
4933
           lhs.ccpMcr==rhs.ccpMcr &&
 
4934
           lhs.ccpAtn==rhs.ccpAtn &&
 
4935
           lhs.ccpEdn==rhs.ccpEdn &&
 
4936
           lhs.ccpTxbx==rhs.ccpTxbx &&
 
4937
           lhs.ccpHdrTxbx==rhs.ccpHdrTxbx &&
 
4938
           lhs.ccpSpare2==rhs.ccpSpare2 &&
 
4939
           lhs.fcStshfOrig==rhs.fcStshfOrig &&
 
4940
           lhs.lcbStshfOrig==rhs.lcbStshfOrig &&
 
4941
           lhs.fcStshf==rhs.fcStshf &&
 
4942
           lhs.lcbStshf==rhs.lcbStshf &&
 
4943
           lhs.fcPlcffndRef==rhs.fcPlcffndRef &&
 
4944
           lhs.lcbPlcffndRef==rhs.lcbPlcffndRef &&
 
4945
           lhs.fcPlcffndTxt==rhs.fcPlcffndTxt &&
 
4946
           lhs.lcbPlcffndTxt==rhs.lcbPlcffndTxt &&
 
4947
           lhs.fcPlcfandRef==rhs.fcPlcfandRef &&
 
4948
           lhs.lcbPlcfandRef==rhs.lcbPlcfandRef &&
 
4949
           lhs.fcPlcfandTxt==rhs.fcPlcfandTxt &&
 
4950
           lhs.lcbPlcfandTxt==rhs.lcbPlcfandTxt &&
 
4951
           lhs.fcPlcfsed==rhs.fcPlcfsed &&
 
4952
           lhs.lcbPlcfsed==rhs.lcbPlcfsed &&
 
4953
           lhs.fcPlcfpad==rhs.fcPlcfpad &&
 
4954
           lhs.lcbPlcfpad==rhs.lcbPlcfpad &&
 
4955
           lhs.fcPlcfphe==rhs.fcPlcfphe &&
 
4956
           lhs.lcbPlcfphe==rhs.lcbPlcfphe &&
 
4957
           lhs.fcSttbfglsy==rhs.fcSttbfglsy &&
 
4958
           lhs.lcbSttbfglsy==rhs.lcbSttbfglsy &&
 
4959
           lhs.fcPlcfglsy==rhs.fcPlcfglsy &&
 
4960
           lhs.lcbPlcfglsy==rhs.lcbPlcfglsy &&
 
4961
           lhs.fcPlcfhdd==rhs.fcPlcfhdd &&
 
4962
           lhs.lcbPlcfhdd==rhs.lcbPlcfhdd &&
 
4963
           lhs.fcPlcfbteChpx==rhs.fcPlcfbteChpx &&
 
4964
           lhs.lcbPlcfbteChpx==rhs.lcbPlcfbteChpx &&
 
4965
           lhs.fcPlcfbtePapx==rhs.fcPlcfbtePapx &&
 
4966
           lhs.lcbPlcfbtePapx==rhs.lcbPlcfbtePapx &&
 
4967
           lhs.fcPlcfsea==rhs.fcPlcfsea &&
 
4968
           lhs.lcbPlcfsea==rhs.lcbPlcfsea &&
 
4969
           lhs.fcSttbfffn==rhs.fcSttbfffn &&
 
4970
           lhs.lcbSttbfffn==rhs.lcbSttbfffn &&
 
4971
           lhs.fcPlcffldMom==rhs.fcPlcffldMom &&
 
4972
           lhs.lcbPlcffldMom==rhs.lcbPlcffldMom &&
 
4973
           lhs.fcPlcffldHdr==rhs.fcPlcffldHdr &&
 
4974
           lhs.lcbPlcffldHdr==rhs.lcbPlcffldHdr &&
 
4975
           lhs.fcPlcffldFtn==rhs.fcPlcffldFtn &&
 
4976
           lhs.lcbPlcffldFtn==rhs.lcbPlcffldFtn &&
 
4977
           lhs.fcPlcffldAtn==rhs.fcPlcffldAtn &&
 
4978
           lhs.lcbPlcffldAtn==rhs.lcbPlcffldAtn &&
 
4979
           lhs.fcPlcffldMcr==rhs.fcPlcffldMcr &&
 
4980
           lhs.lcbPlcffldMcr==rhs.lcbPlcffldMcr &&
 
4981
           lhs.fcSttbfbkmk==rhs.fcSttbfbkmk &&
 
4982
           lhs.lcbSttbfbkmk==rhs.lcbSttbfbkmk &&
 
4983
           lhs.fcPlcfbkf==rhs.fcPlcfbkf &&
 
4984
           lhs.lcbPlcfbkf==rhs.lcbPlcfbkf &&
 
4985
           lhs.fcPlcfbkl==rhs.fcPlcfbkl &&
 
4986
           lhs.lcbPlcfbkl==rhs.lcbPlcfbkl &&
 
4987
           lhs.fcCmds==rhs.fcCmds &&
 
4988
           lhs.lcbCmds==rhs.lcbCmds &&
 
4989
           lhs.fcPlcmcr==rhs.fcPlcmcr &&
 
4990
           lhs.lcbPlcmcr==rhs.lcbPlcmcr &&
 
4991
           lhs.fcSttbfmcr==rhs.fcSttbfmcr &&
 
4992
           lhs.lcbSttbfmcr==rhs.lcbSttbfmcr &&
 
4993
           lhs.fcPrDrvr==rhs.fcPrDrvr &&
 
4994
           lhs.lcbPrDrvr==rhs.lcbPrDrvr &&
 
4995
           lhs.fcPrEnvPort==rhs.fcPrEnvPort &&
 
4996
           lhs.lcbPrEnvPort==rhs.lcbPrEnvPort &&
 
4997
           lhs.fcPrEnvLand==rhs.fcPrEnvLand &&
 
4998
           lhs.lcbPrEnvLand==rhs.lcbPrEnvLand &&
 
4999
           lhs.fcWss==rhs.fcWss &&
 
5000
           lhs.lcbWss==rhs.lcbWss &&
 
5001
           lhs.fcDop==rhs.fcDop &&
 
5002
           lhs.lcbDop==rhs.lcbDop &&
 
5003
           lhs.fcSttbfAssoc==rhs.fcSttbfAssoc &&
 
5004
           lhs.lcbSttbfAssoc==rhs.lcbSttbfAssoc &&
 
5005
           lhs.fcClx==rhs.fcClx &&
 
5006
           lhs.lcbClx==rhs.lcbClx &&
 
5007
           lhs.fcPlcfpgdFtn==rhs.fcPlcfpgdFtn &&
 
5008
           lhs.lcbPlcfpgdFtn==rhs.lcbPlcfpgdFtn &&
 
5009
           lhs.fcAutosaveSource==rhs.fcAutosaveSource &&
 
5010
           lhs.lcbAutosaveSource==rhs.lcbAutosaveSource &&
 
5011
           lhs.fcGrpStAtnOwners==rhs.fcGrpStAtnOwners &&
 
5012
           lhs.lcbGrpStAtnOwners==rhs.lcbGrpStAtnOwners &&
 
5013
           lhs.fcSttbfAtnbkmk==rhs.fcSttbfAtnbkmk &&
 
5014
           lhs.lcbSttbfAtnbkmk==rhs.lcbSttbfAtnbkmk &&
 
5015
           lhs.wSpare4Fib==rhs.wSpare4Fib &&
 
5016
           lhs.pnChpFirst==rhs.pnChpFirst &&
 
5017
           lhs.pnPapFirst==rhs.pnPapFirst &&
 
5018
           lhs.cpnBteChp==rhs.cpnBteChp &&
 
5019
           lhs.cpnBtePap==rhs.cpnBtePap &&
 
5020
           lhs.fcPlcfdoaMom==rhs.fcPlcfdoaMom &&
 
5021
           lhs.lcbPlcfdoaMom==rhs.lcbPlcfdoaMom &&
 
5022
           lhs.fcPlcfdoaHdr==rhs.fcPlcfdoaHdr &&
 
5023
           lhs.lcbPlcfdoaHdr==rhs.lcbPlcfdoaHdr &&
 
5024
           lhs.fcUnused1==rhs.fcUnused1 &&
 
5025
           lhs.lcbUnused1==rhs.lcbUnused1 &&
 
5026
           lhs.fcUnused2==rhs.fcUnused2 &&
 
5027
           lhs.lcbUnused2==rhs.lcbUnused2 &&
 
5028
           lhs.fcPlcfAtnbkf==rhs.fcPlcfAtnbkf &&
 
5029
           lhs.lcbPlcfAtnbkf==rhs.lcbPlcfAtnbkf &&
 
5030
           lhs.fcPlcfAtnbkl==rhs.fcPlcfAtnbkl &&
 
5031
           lhs.lcbPlcfAtnbkl==rhs.lcbPlcfAtnbkl &&
 
5032
           lhs.fcPms==rhs.fcPms &&
 
5033
           lhs.lcbPms==rhs.lcbPms &&
 
5034
           lhs.fcFormFldSttbf==rhs.fcFormFldSttbf &&
 
5035
           lhs.lcbFormFldSttbf==rhs.lcbFormFldSttbf &&
 
5036
           lhs.fcPlcfendRef==rhs.fcPlcfendRef &&
 
5037
           lhs.lcbPlcfendRef==rhs.lcbPlcfendRef &&
 
5038
           lhs.fcPlcfendTxt==rhs.fcPlcfendTxt &&
 
5039
           lhs.lcbPlcfendTxt==rhs.lcbPlcfendTxt &&
 
5040
           lhs.fcPlcffldEdn==rhs.fcPlcffldEdn &&
 
5041
           lhs.lcbPlcffldEdn==rhs.lcbPlcffldEdn &&
 
5042
           lhs.fcPlcfpgdEdn==rhs.fcPlcfpgdEdn &&
 
5043
           lhs.lcbPlcfpgdEdn==rhs.lcbPlcfpgdEdn &&
 
5044
           lhs.fcUnused3==rhs.fcUnused3 &&
 
5045
           lhs.lcbUnused3==rhs.lcbUnused3 &&
 
5046
           lhs.fcSttbfRMark==rhs.fcSttbfRMark &&
 
5047
           lhs.lcbSttbfRMark==rhs.lcbSttbfRMark &&
 
5048
           lhs.fcSttbfCaption==rhs.fcSttbfCaption &&
 
5049
           lhs.lcbSttbfCaption==rhs.lcbSttbfCaption &&
 
5050
           lhs.fcSttbfAutoCaption==rhs.fcSttbfAutoCaption &&
 
5051
           lhs.lcbSttbfAutoCaption==rhs.lcbSttbfAutoCaption &&
 
5052
           lhs.fcPlcfwkb==rhs.fcPlcfwkb &&
 
5053
           lhs.lcbPlcfwkb==rhs.lcbPlcfwkb &&
 
5054
           lhs.fcUnused4==rhs.fcUnused4 &&
 
5055
           lhs.lcbUnused4==rhs.lcbUnused4 &&
 
5056
           lhs.fcPlcftxbxTxt==rhs.fcPlcftxbxTxt &&
 
5057
           lhs.lcbPlcftxbxTxt==rhs.lcbPlcftxbxTxt &&
 
5058
           lhs.fcPlcffldTxbx==rhs.fcPlcffldTxbx &&
 
5059
           lhs.lcbPlcffldTxbx==rhs.lcbPlcffldTxbx &&
 
5060
           lhs.fcPlcfHdrtxbxTxt==rhs.fcPlcfHdrtxbxTxt &&
 
5061
           lhs.lcbPlcfHdrtxbxTxt==rhs.lcbPlcfHdrtxbxTxt &&
 
5062
           lhs.fcPlcffldHdrTxbx==rhs.fcPlcffldHdrTxbx &&
 
5063
           lhs.lcbPlcffldHdrTxbx==rhs.lcbPlcffldHdrTxbx &&
 
5064
           lhs.fcStwUser==rhs.fcStwUser &&
 
5065
           lhs.lcbStwUser==rhs.lcbStwUser &&
 
5066
           lhs.fcSttbttmbd==rhs.fcSttbttmbd &&
 
5067
           lhs.lcbSttbttmbd==rhs.lcbSttbttmbd &&
 
5068
           lhs.fcUnused==rhs.fcUnused &&
 
5069
           lhs.lcbUnused==rhs.lcbUnused &&
 
5070
           lhs.fcPgdMother==rhs.fcPgdMother &&
 
5071
           lhs.lcbPgdMother==rhs.lcbPgdMother &&
 
5072
           lhs.fcBkdMother==rhs.fcBkdMother &&
 
5073
           lhs.lcbBkdMother==rhs.lcbBkdMother &&
 
5074
           lhs.fcPgdFtn==rhs.fcPgdFtn &&
 
5075
           lhs.lcbPgdFtn==rhs.lcbPgdFtn &&
 
5076
           lhs.fcBkdFtn==rhs.fcBkdFtn &&
 
5077
           lhs.lcbBkdFtn==rhs.lcbBkdFtn &&
 
5078
           lhs.fcPgdEdn==rhs.fcPgdEdn &&
 
5079
           lhs.lcbPgdEdn==rhs.lcbPgdEdn &&
 
5080
           lhs.fcBkdEdn==rhs.fcBkdEdn &&
 
5081
           lhs.lcbBkdEdn==rhs.lcbBkdEdn &&
 
5082
           lhs.fcSttbfIntlFld==rhs.fcSttbfIntlFld &&
 
5083
           lhs.lcbSttbfIntlFld==rhs.lcbSttbfIntlFld &&
 
5084
           lhs.fcRouteSlip==rhs.fcRouteSlip &&
 
5085
           lhs.lcbRouteSlip==rhs.lcbRouteSlip &&
 
5086
           lhs.fcSttbSavedBy==rhs.fcSttbSavedBy &&
 
5087
           lhs.lcbSttbSavedBy==rhs.lcbSttbSavedBy &&
 
5088
           lhs.fcSttbFnm==rhs.fcSttbFnm &&
 
5089
           lhs.lcbSttbFnm==rhs.lcbSttbFnm;
 
5090
}
 
5091
 
 
5092
bool operator!=(const FIB &lhs, const FIB &rhs) {
 
5093
    return !(lhs==rhs);
 
5094
}
 
5095
 
 
5096
 
 
5097
// LSPD implementation
 
5098
 
 
5099
LSPD::LSPD() {
 
5100
    clear();
 
5101
}
 
5102
 
 
5103
LSPD::LSPD(OLEStreamReader *stream, bool preservePos) {
 
5104
    clear();
 
5105
    read(stream, preservePos);
 
5106
}
 
5107
 
 
5108
bool LSPD::read(OLEStreamReader *stream, bool preservePos) {
 
5109
 
 
5110
    if(preservePos)
 
5111
        stream->push();
 
5112
 
 
5113
    dyaLine=stream->readU16();
 
5114
    fMultLinespace=stream->readU16();
 
5115
 
 
5116
    if(preservePos)
 
5117
        stream->pop();
 
5118
    return true;
 
5119
}
 
5120
 
 
5121
bool LSPD::write(OLEStreamWriter *stream, bool preservePos) const {
 
5122
 
 
5123
    if(preservePos)
 
5124
        stream->push();
 
5125
 
 
5126
    stream->write(dyaLine);
 
5127
    stream->write(fMultLinespace);
 
5128
 
 
5129
    if(preservePos)
 
5130
        stream->pop();
 
5131
    return true;
 
5132
}
 
5133
 
 
5134
void LSPD::clear() {
 
5135
    dyaLine=0;
 
5136
    fMultLinespace=0;
 
5137
}
 
5138
 
 
5139
void LSPD::dump() const
 
5140
{
 
5141
    wvlog << "Dumping LSPD:" << endl;
 
5142
    wvlog << toString().c_str() << endl;
 
5143
    wvlog << "\nDumping LSPD done." << endl;
 
5144
}
 
5145
 
 
5146
std::string LSPD::toString() const
 
5147
{
 
5148
    std::string s( "LSPD:" );
 
5149
    s += "\ndyaLine=";
 
5150
    s += uint2string( dyaLine );
 
5151
    s += "\nfMultLinespace=";
 
5152
    s += uint2string( fMultLinespace );
 
5153
    s += "\nLSPD Done.";
 
5154
    return s;
 
5155
}
 
5156
 
 
5157
bool operator==(const LSPD &lhs, const LSPD &rhs) {
 
5158
 
 
5159
    return lhs.dyaLine==rhs.dyaLine &&
 
5160
           lhs.fMultLinespace==rhs.fMultLinespace;
 
5161
}
 
5162
 
 
5163
bool operator!=(const LSPD &lhs, const LSPD &rhs) {
 
5164
    return !(lhs==rhs);
 
5165
}
 
5166
 
 
5167
 
 
5168
// METAFILEPICT implementation
 
5169
 
 
5170
METAFILEPICT::METAFILEPICT() {
 
5171
    clear();
 
5172
}
 
5173
 
 
5174
METAFILEPICT::METAFILEPICT(OLEStreamReader *stream, bool preservePos) {
 
5175
    clear();
 
5176
    read(stream, preservePos);
 
5177
}
 
5178
 
 
5179
bool METAFILEPICT::read(OLEStreamReader *stream, bool preservePos) {
 
5180
 
 
5181
    if(preservePos)
 
5182
        stream->push();
 
5183
 
 
5184
    mm=stream->readU16();
 
5185
    xExt=stream->readU16();
 
5186
    yExt=stream->readU16();
 
5187
    hMF=stream->readU16();
 
5188
 
 
5189
    if(preservePos)
 
5190
        stream->pop();
 
5191
    return true;
 
5192
}
 
5193
 
 
5194
bool METAFILEPICT::write(OLEStreamWriter *stream, bool preservePos) const {
 
5195
 
 
5196
    if(preservePos)
 
5197
        stream->push();
 
5198
 
 
5199
    stream->write(mm);
 
5200
    stream->write(xExt);
 
5201
    stream->write(yExt);
 
5202
    stream->write(hMF);
 
5203
 
 
5204
    if(preservePos)
 
5205
        stream->pop();
 
5206
    return true;
 
5207
}
 
5208
 
 
5209
void METAFILEPICT::clear() {
 
5210
    mm=0;
 
5211
    xExt=0;
 
5212
    yExt=0;
 
5213
    hMF=0;
 
5214
}
 
5215
 
 
5216
void METAFILEPICT::dump() const
 
5217
{
 
5218
    wvlog << "Dumping METAFILEPICT:" << endl;
 
5219
    wvlog << toString().c_str() << endl;
 
5220
    wvlog << "\nDumping METAFILEPICT done." << endl;
 
5221
}
 
5222
 
 
5223
std::string METAFILEPICT::toString() const
 
5224
{
 
5225
    std::string s( "METAFILEPICT:" );
 
5226
    s += "\nmm=";
 
5227
    s += uint2string( mm );
 
5228
    s += "\nxExt=";
 
5229
    s += uint2string( xExt );
 
5230
    s += "\nyExt=";
 
5231
    s += uint2string( yExt );
 
5232
    s += "\nhMF=";
 
5233
    s += uint2string( hMF );
 
5234
    s += "\nMETAFILEPICT Done.";
 
5235
    return s;
 
5236
}
 
5237
 
 
5238
bool operator==(const METAFILEPICT &lhs, const METAFILEPICT &rhs) {
 
5239
 
 
5240
    return lhs.mm==rhs.mm &&
 
5241
           lhs.xExt==rhs.xExt &&
 
5242
           lhs.yExt==rhs.yExt &&
 
5243
           lhs.hMF==rhs.hMF;
 
5244
}
 
5245
 
 
5246
bool operator!=(const METAFILEPICT &lhs, const METAFILEPICT &rhs) {
 
5247
    return !(lhs==rhs);
 
5248
}
 
5249
 
 
5250
 
 
5251
// OBJHEADER implementation
 
5252
 
 
5253
OBJHEADER::OBJHEADER() {
 
5254
    clear();
 
5255
}
 
5256
 
 
5257
OBJHEADER::OBJHEADER(OLEStreamReader *stream, bool preservePos) {
 
5258
    clear();
 
5259
    read(stream, preservePos);
 
5260
}
 
5261
 
 
5262
bool OBJHEADER::read(OLEStreamReader *stream, bool preservePos) {
 
5263
 
 
5264
    if(preservePos)
 
5265
        stream->push();
 
5266
 
 
5267
    lcb=stream->readU32();
 
5268
    cbHeader=stream->readU16();
 
5269
    icf=stream->readU16();
 
5270
 
 
5271
    if(preservePos)
 
5272
        stream->pop();
 
5273
    return true;
 
5274
}
 
5275
 
 
5276
bool OBJHEADER::write(OLEStreamWriter *stream, bool preservePos) const {
 
5277
 
 
5278
    if(preservePos)
 
5279
        stream->push();
 
5280
 
 
5281
    stream->write(lcb);
 
5282
    stream->write(cbHeader);
 
5283
    stream->write(icf);
 
5284
 
 
5285
    if(preservePos)
 
5286
        stream->pop();
 
5287
    return true;
 
5288
}
 
5289
 
 
5290
void OBJHEADER::clear() {
 
5291
    lcb=0;
 
5292
    cbHeader=0;
 
5293
    icf=0;
 
5294
}
 
5295
 
 
5296
bool operator==(const OBJHEADER &lhs, const OBJHEADER &rhs) {
 
5297
 
 
5298
    return lhs.lcb==rhs.lcb &&
 
5299
           lhs.cbHeader==rhs.cbHeader &&
 
5300
           lhs.icf==rhs.icf;
 
5301
}
 
5302
 
 
5303
bool operator!=(const OBJHEADER &lhs, const OBJHEADER &rhs) {
 
5304
    return !(lhs==rhs);
 
5305
}
 
5306
 
 
5307
 
 
5308
// OLST implementation
 
5309
 
 
5310
const unsigned int OLST::sizeOf = 212;
 
5311
 
 
5312
OLST::OLST() {
 
5313
    clear();
 
5314
}
 
5315
 
 
5316
OLST::OLST(OLEStreamReader *stream, bool preservePos) {
 
5317
    clear();
 
5318
    read(stream, preservePos);
 
5319
}
 
5320
 
 
5321
OLST::OLST(const U8 *ptr) {
 
5322
    clear();
 
5323
    readPtr(ptr);
 
5324
}
 
5325
 
 
5326
bool OLST::read(OLEStreamReader *stream, bool preservePos) {
 
5327
 
 
5328
    if(preservePos)
 
5329
        stream->push();
 
5330
 
 
5331
    for(int _i=0; _i<(9); ++_i)
 
5332
        rganlv[_i].read(stream, false);
 
5333
    fRestartHdr=stream->readU8();
 
5334
    fSpareOlst2=stream->readU8();
 
5335
    fSpareOlst3=stream->readU8();
 
5336
    fSpareOlst4=stream->readU8();
 
5337
    for(int _i=0; _i<(64); ++_i)
 
5338
        rgch[_i]=stream->readU8();
 
5339
 
 
5340
    if(preservePos)
 
5341
        stream->pop();
 
5342
    return true;
 
5343
}
 
5344
 
 
5345
void OLST::readPtr(const U8 *ptr) {
 
5346
 
 
5347
    for(int _i=0; _i<(9); ++_i) {
 
5348
        rganlv[_i].readPtr(ptr);
 
5349
        ptr+=ANLV::sizeOf;
 
5350
    }
 
5351
    fRestartHdr=readU8(ptr);
 
5352
    ptr+=sizeof(U8);
 
5353
    fSpareOlst2=readU8(ptr);
 
5354
    ptr+=sizeof(U8);
 
5355
    fSpareOlst3=readU8(ptr);
 
5356
    ptr+=sizeof(U8);
 
5357
    fSpareOlst4=readU8(ptr);
 
5358
    ptr+=sizeof(U8);
 
5359
    for(int _i=0; _i<(64); ++_i) {
 
5360
        rgch[_i]=readU8(ptr);
 
5361
        ptr+=sizeof(U8);
 
5362
    }
 
5363
}
 
5364
 
 
5365
bool OLST::write(OLEStreamWriter *stream, bool preservePos) const {
 
5366
 
 
5367
    if(preservePos)
 
5368
        stream->push();
 
5369
 
 
5370
    for(int _i=0; _i<(9); ++_i)
 
5371
        rganlv[_i].write(stream, false);
 
5372
    stream->write(fRestartHdr);
 
5373
    stream->write(fSpareOlst2);
 
5374
    stream->write(fSpareOlst3);
 
5375
    stream->write(fSpareOlst4);
 
5376
    for(int _i=0; _i<(64); ++_i)
 
5377
        stream->write(rgch[_i]);
 
5378
 
 
5379
    if(preservePos)
 
5380
        stream->pop();
 
5381
    return true;
 
5382
}
 
5383
 
 
5384
void OLST::clear() {
 
5385
    for(int _i=0; _i<(9); ++_i)
 
5386
        rganlv[_i].clear();
 
5387
    fRestartHdr=0;
 
5388
    fSpareOlst2=0;
 
5389
    fSpareOlst3=0;
 
5390
    fSpareOlst4=0;
 
5391
    for(int _i=0; _i<(64); ++_i)
 
5392
        rgch[_i]=0;
 
5393
}
 
5394
 
 
5395
void OLST::dump() const
 
5396
{
 
5397
    wvlog << "Dumping OLST:" << endl;
 
5398
    wvlog << toString().c_str() << endl;
 
5399
    wvlog << "\nDumping OLST done." << endl;
 
5400
}
 
5401
 
 
5402
std::string OLST::toString() const
 
5403
{
 
5404
    std::string s( "OLST:" );
 
5405
    for(int _i=0; _i<(9); ++_i) {
 
5406
        s += "\nrganlv[" + int2string( _i ) + "]=";
 
5407
    s += "\n{" + rganlv[_i].toString() + "}\n";
 
5408
    }
 
5409
    s += "\nfRestartHdr=";
 
5410
    s += uint2string( fRestartHdr );
 
5411
    s += "\nfSpareOlst2=";
 
5412
    s += uint2string( fSpareOlst2 );
 
5413
    s += "\nfSpareOlst3=";
 
5414
    s += uint2string( fSpareOlst3 );
 
5415
    s += "\nfSpareOlst4=";
 
5416
    s += uint2string( fSpareOlst4 );
 
5417
    for(int _i=0; _i<(64); ++_i) {
 
5418
        s += "\nrgch[" + int2string( _i ) + "]=";
 
5419
    s += uint2string( rgch[_i] );
 
5420
    }
 
5421
    s += "\nOLST Done.";
 
5422
    return s;
 
5423
}
 
5424
 
 
5425
bool operator==(const OLST &lhs, const OLST &rhs) {
 
5426
 
 
5427
    for(int _i=0; _i<(9); ++_i) {
 
5428
        if(lhs.rganlv[_i]!=rhs.rganlv[_i])
 
5429
            return false;
 
5430
    }
 
5431
 
 
5432
    for(int _i=0; _i<(64); ++_i) {
 
5433
        if(lhs.rgch[_i]!=rhs.rgch[_i])
 
5434
            return false;
 
5435
    }
 
5436
 
 
5437
    return lhs.fRestartHdr==rhs.fRestartHdr &&
 
5438
           lhs.fSpareOlst2==rhs.fSpareOlst2 &&
 
5439
           lhs.fSpareOlst3==rhs.fSpareOlst3 &&
 
5440
           lhs.fSpareOlst4==rhs.fSpareOlst4;
 
5441
}
 
5442
 
 
5443
bool operator!=(const OLST &lhs, const OLST &rhs) {
 
5444
    return !(lhs==rhs);
 
5445
}
 
5446
 
 
5447
 
 
5448
// PAP implementation
 
5449
 
 
5450
PAP::PAP() : Shared() {
 
5451
    clearInternal();
 
5452
}
 
5453
 
 
5454
PAP::PAP(OLEStreamReader *stream, bool preservePos) : Shared() {
 
5455
    clearInternal();
 
5456
    read(stream, preservePos);
 
5457
}
 
5458
 
 
5459
PAP::PAP(const PAP &rhs) : Shared() {
 
5460
    istd=rhs.istd;
 
5461
    jc=rhs.jc;
 
5462
    fKeep=rhs.fKeep;
 
5463
    fKeepFollow=rhs.fKeepFollow;
 
5464
    fPageBreakBefore=rhs.fPageBreakBefore;
 
5465
    fBrLnAbove=rhs.fBrLnAbove;
 
5466
    fBrLnBelow=rhs.fBrLnBelow;
 
5467
    fUnused=rhs.fUnused;
 
5468
    pcVert=rhs.pcVert;
 
5469
    pcHorz=rhs.pcHorz;
 
5470
    brcp=rhs.brcp;
 
5471
    brcl=rhs.brcl;
 
5472
    unused9=rhs.unused9;
 
5473
    nLvlAnm=rhs.nLvlAnm;
 
5474
    fNoLnn=rhs.fNoLnn;
 
5475
    fSideBySide=rhs.fSideBySide;
 
5476
    dxaRight=rhs.dxaRight;
 
5477
    dxaLeft=rhs.dxaLeft;
 
5478
    dxaLeft1=rhs.dxaLeft1;
 
5479
    lspd=rhs.lspd;
 
5480
    dyaBefore=rhs.dyaBefore;
 
5481
    dyaAfter=rhs.dyaAfter;
 
5482
    phe=rhs.phe;
 
5483
    fAutoHyph=rhs.fAutoHyph;
 
5484
    fWidowControl=rhs.fWidowControl;
 
5485
    fInTable=rhs.fInTable;
 
5486
    fTtp=rhs.fTtp;
 
5487
    ptap=rhs.ptap;
 
5488
    dxaAbs=rhs.dxaAbs;
 
5489
    dyaAbs=rhs.dyaAbs;
 
5490
    dxaWidth=rhs.dxaWidth;
 
5491
    brcTop=rhs.brcTop;
 
5492
    brcLeft=rhs.brcLeft;
 
5493
    brcBottom=rhs.brcBottom;
 
5494
    brcRight=rhs.brcRight;
 
5495
    brcBetween=rhs.brcBetween;
 
5496
    brcBar=rhs.brcBar;
 
5497
    dxaFromText=rhs.dxaFromText;
 
5498
    dyaFromText=rhs.dyaFromText;
 
5499
    wr=rhs.wr;
 
5500
    fLocked=rhs.fLocked;
 
5501
    dyaHeight=rhs.dyaHeight;
 
5502
    fMinHeight=rhs.fMinHeight;
 
5503
    shd=rhs.shd;
 
5504
    dcs=rhs.dcs;
 
5505
    anld=rhs.anld;
 
5506
    itbdMac=rhs.itbdMac;
 
5507
    rgdxaTab=new U16[itbdMac];
 
5508
    memcpy(rgdxaTab, rhs.rgdxaTab, sizeof(U16)*(itbdMac));
 
5509
    rgtbd=new U8[itbdMac];
 
5510
    memcpy(rgtbd, rhs.rgtbd, sizeof(U8)*(itbdMac));
 
5511
}
 
5512
 
 
5513
PAP::~PAP() {
 
5514
    delete [] rgdxaTab;
 
5515
    delete [] rgtbd;
 
5516
}
 
5517
 
 
5518
PAP &PAP::operator=(const PAP &rhs) {
 
5519
 
 
5520
    // Check for assignment to self
 
5521
    if(this==&rhs)
 
5522
        return *this;
 
5523
 
 
5524
    istd=rhs.istd;
 
5525
    jc=rhs.jc;
 
5526
    fKeep=rhs.fKeep;
 
5527
    fKeepFollow=rhs.fKeepFollow;
 
5528
    fPageBreakBefore=rhs.fPageBreakBefore;
 
5529
    fBrLnAbove=rhs.fBrLnAbove;
 
5530
    fBrLnBelow=rhs.fBrLnBelow;
 
5531
    fUnused=rhs.fUnused;
 
5532
    pcVert=rhs.pcVert;
 
5533
    pcHorz=rhs.pcHorz;
 
5534
    brcp=rhs.brcp;
 
5535
    brcl=rhs.brcl;
 
5536
    unused9=rhs.unused9;
 
5537
    nLvlAnm=rhs.nLvlAnm;
 
5538
    fNoLnn=rhs.fNoLnn;
 
5539
    fSideBySide=rhs.fSideBySide;
 
5540
    dxaRight=rhs.dxaRight;
 
5541
    dxaLeft=rhs.dxaLeft;
 
5542
    dxaLeft1=rhs.dxaLeft1;
 
5543
    lspd=rhs.lspd;
 
5544
    dyaBefore=rhs.dyaBefore;
 
5545
    dyaAfter=rhs.dyaAfter;
 
5546
    phe=rhs.phe;
 
5547
    fAutoHyph=rhs.fAutoHyph;
 
5548
    fWidowControl=rhs.fWidowControl;
 
5549
    fInTable=rhs.fInTable;
 
5550
    fTtp=rhs.fTtp;
 
5551
    ptap=rhs.ptap;
 
5552
    dxaAbs=rhs.dxaAbs;
 
5553
    dyaAbs=rhs.dyaAbs;
 
5554
    dxaWidth=rhs.dxaWidth;
 
5555
    brcTop=rhs.brcTop;
 
5556
    brcLeft=rhs.brcLeft;
 
5557
    brcBottom=rhs.brcBottom;
 
5558
    brcRight=rhs.brcRight;
 
5559
    brcBetween=rhs.brcBetween;
 
5560
    brcBar=rhs.brcBar;
 
5561
    dxaFromText=rhs.dxaFromText;
 
5562
    dyaFromText=rhs.dyaFromText;
 
5563
    wr=rhs.wr;
 
5564
    fLocked=rhs.fLocked;
 
5565
    dyaHeight=rhs.dyaHeight;
 
5566
    fMinHeight=rhs.fMinHeight;
 
5567
    shd=rhs.shd;
 
5568
    dcs=rhs.dcs;
 
5569
    anld=rhs.anld;
 
5570
    itbdMac=rhs.itbdMac;
 
5571
    delete [] rgdxaTab;
 
5572
    rgdxaTab=new U16[itbdMac];
 
5573
    memcpy(rgdxaTab, rhs.rgdxaTab, sizeof(U16)*(itbdMac));
 
5574
    delete [] rgtbd;
 
5575
    rgtbd=new U8[itbdMac];
 
5576
    memcpy(rgtbd, rhs.rgtbd, sizeof(U8)*(itbdMac));
 
5577
 
 
5578
    return *this;
 
5579
}
 
5580
 
 
5581
bool PAP::read(OLEStreamReader *stream, bool preservePos) {
 
5582
 
 
5583
    U8 shifterU8;
 
5584
    U16 shifterU16;
 
5585
 
 
5586
    if(preservePos)
 
5587
        stream->push();
 
5588
 
 
5589
    istd=stream->readU16();
 
5590
    jc=stream->readU8();
 
5591
    fKeep=stream->readU8();
 
5592
    fKeepFollow=stream->readU8();
 
5593
    fPageBreakBefore=stream->readU8();
 
5594
    shifterU8=stream->readU8();
 
5595
    fBrLnAbove=shifterU8;
 
5596
    shifterU8>>=1;
 
5597
    fBrLnBelow=shifterU8;
 
5598
    shifterU8>>=1;
 
5599
    fUnused=shifterU8;
 
5600
    shifterU8>>=2;
 
5601
    pcVert=shifterU8;
 
5602
    shifterU8>>=2;
 
5603
    pcHorz=shifterU8;
 
5604
    brcp=stream->readU8();
 
5605
    brcl=stream->readU8();
 
5606
    unused9=stream->readU8();
 
5607
    nLvlAnm=stream->readU8();
 
5608
    fNoLnn=stream->readU8();
 
5609
    fSideBySide=stream->readU8();
 
5610
    dxaRight=stream->readS16();
 
5611
    dxaLeft=stream->readS16();
 
5612
    dxaLeft1=stream->readS16();
 
5613
    lspd.read(stream, false);
 
5614
    dyaBefore=stream->readU16();
 
5615
    dyaAfter=stream->readU16();
 
5616
    phe.read(stream, false);
 
5617
    fAutoHyph=stream->readU8();
 
5618
    fWidowControl=stream->readU8();
 
5619
    fInTable=stream->readU8();
 
5620
    fTtp=stream->readU8();
 
5621
    ptap=stream->readU16();
 
5622
    dxaAbs=stream->readS16();
 
5623
    dyaAbs=stream->readS16();
 
5624
    dxaWidth=stream->readU16();
 
5625
    brcTop.read(stream, false);
 
5626
    brcLeft.read(stream, false);
 
5627
    brcBottom.read(stream, false);
 
5628
    brcRight.read(stream, false);
 
5629
    brcBetween.read(stream, false);
 
5630
    brcBar.read(stream, false);
 
5631
    dxaFromText=stream->readU16();
 
5632
    dyaFromText=stream->readU16();
 
5633
    wr=stream->readU8();
 
5634
    fLocked=stream->readU8();
 
5635
    shifterU16=stream->readU16();
 
5636
    dyaHeight=shifterU16;
 
5637
    shifterU16>>=15;
 
5638
    fMinHeight=shifterU16;
 
5639
    shd.read(stream, false);
 
5640
    dcs.read(stream, false);
 
5641
    anld.read(stream, false);
 
5642
    itbdMac=stream->readU16();
 
5643
    rgdxaTab=new U16[itbdMac];
 
5644
    for(int _i=0; _i<(itbdMac); ++_i)
 
5645
        rgdxaTab[_i]=stream->readU16();
 
5646
    rgtbd=new U8[itbdMac];
 
5647
    for(int _i=0; _i<(itbdMac); ++_i)
 
5648
        rgtbd[_i]=stream->readU8();
 
5649
 
 
5650
    if(preservePos)
 
5651
        stream->pop();
 
5652
    return true;
 
5653
}
 
5654
 
 
5655
bool PAP::write(OLEStreamWriter *stream, bool preservePos) const {
 
5656
 
 
5657
    U8 shifterU8;
 
5658
    U16 shifterU16;
 
5659
 
 
5660
    if(preservePos)
 
5661
        stream->push();
 
5662
 
 
5663
    stream->write(istd);
 
5664
    stream->write(jc);
 
5665
    stream->write(fKeep);
 
5666
    stream->write(fKeepFollow);
 
5667
    stream->write(fPageBreakBefore);
 
5668
    shifterU8=fBrLnAbove;
 
5669
    shifterU8|=fBrLnBelow << 1;
 
5670
    shifterU8|=fUnused << 2;
 
5671
    shifterU8|=pcVert << 4;
 
5672
    shifterU8|=pcHorz << 6;
 
5673
    stream->write(shifterU8);
 
5674
    stream->write(brcp);
 
5675
    stream->write(brcl);
 
5676
    stream->write(unused9);
 
5677
    stream->write(nLvlAnm);
 
5678
    stream->write(fNoLnn);
 
5679
    stream->write(fSideBySide);
 
5680
    stream->write(dxaRight);
 
5681
    stream->write(dxaLeft);
 
5682
    stream->write(dxaLeft1);
 
5683
    lspd.write(stream, false);
 
5684
    stream->write(dyaBefore);
 
5685
    stream->write(dyaAfter);
 
5686
    phe.write(stream, false);
 
5687
    stream->write(fAutoHyph);
 
5688
    stream->write(fWidowControl);
 
5689
    stream->write(fInTable);
 
5690
    stream->write(fTtp);
 
5691
    stream->write(ptap);
 
5692
    stream->write(dxaAbs);
 
5693
    stream->write(dyaAbs);
 
5694
    stream->write(dxaWidth);
 
5695
    brcTop.write(stream, false);
 
5696
    brcLeft.write(stream, false);
 
5697
    brcBottom.write(stream, false);
 
5698
    brcRight.write(stream, false);
 
5699
    brcBetween.write(stream, false);
 
5700
    brcBar.write(stream, false);
 
5701
    stream->write(dxaFromText);
 
5702
    stream->write(dyaFromText);
 
5703
    stream->write(wr);
 
5704
    stream->write(fLocked);
 
5705
    shifterU16=dyaHeight;
 
5706
    shifterU16|=fMinHeight << 15;
 
5707
    stream->write(shifterU16);
 
5708
    shd.write(stream, false);
 
5709
    dcs.write(stream, false);
 
5710
    anld.write(stream, false);
 
5711
    stream->write(itbdMac);
 
5712
    for(int _i=0; _i<(itbdMac); ++_i)
 
5713
        stream->write(rgdxaTab[_i]);
 
5714
    for(int _i=0; _i<(itbdMac); ++_i)
 
5715
        stream->write(rgtbd[_i]);
 
5716
 
 
5717
    if(preservePos)
 
5718
        stream->pop();
 
5719
    return true;
 
5720
}
 
5721
 
 
5722
void PAP::clear() {
 
5723
    delete [] rgdxaTab;
 
5724
    delete [] rgtbd;
 
5725
    clearInternal();
 
5726
}
 
5727
 
 
5728
void PAP::dump() const
 
5729
{
 
5730
    wvlog << "Dumping PAP:" << endl;
 
5731
    wvlog << toString().c_str() << endl;
 
5732
    wvlog << "\nDumping PAP done." << endl;
 
5733
}
 
5734
 
 
5735
std::string PAP::toString() const
 
5736
{
 
5737
    std::string s( "PAP:" );
 
5738
    s += "\nistd=";
 
5739
    s += uint2string( istd );
 
5740
    s += "\njc=";
 
5741
    s += uint2string( jc );
 
5742
    s += "\nfKeep=";
 
5743
    s += uint2string( fKeep );
 
5744
    s += "\nfKeepFollow=";
 
5745
    s += uint2string( fKeepFollow );
 
5746
    s += "\nfPageBreakBefore=";
 
5747
    s += uint2string( fPageBreakBefore );
 
5748
    s += "\nfBrLnAbove=";
 
5749
    s += uint2string( fBrLnAbove );
 
5750
    s += "\nfBrLnBelow=";
 
5751
    s += uint2string( fBrLnBelow );
 
5752
    s += "\nfUnused=";
 
5753
    s += uint2string( fUnused );
 
5754
    s += "\npcVert=";
 
5755
    s += uint2string( pcVert );
 
5756
    s += "\npcHorz=";
 
5757
    s += uint2string( pcHorz );
 
5758
    s += "\nbrcp=";
 
5759
    s += uint2string( brcp );
 
5760
    s += "\nbrcl=";
 
5761
    s += uint2string( brcl );
 
5762
    s += "\nunused9=";
 
5763
    s += uint2string( unused9 );
 
5764
    s += "\nnLvlAnm=";
 
5765
    s += uint2string( nLvlAnm );
 
5766
    s += "\nfNoLnn=";
 
5767
    s += uint2string( fNoLnn );
 
5768
    s += "\nfSideBySide=";
 
5769
    s += uint2string( fSideBySide );
 
5770
    s += "\ndxaRight=";
 
5771
    s += int2string( dxaRight );
 
5772
    s += "\ndxaLeft=";
 
5773
    s += int2string( dxaLeft );
 
5774
    s += "\ndxaLeft1=";
 
5775
    s += int2string( dxaLeft1 );
 
5776
    s += "\nlspd=";
 
5777
    s += "\n{" + lspd.toString() + "}\n";
 
5778
    s += "\ndyaBefore=";
 
5779
    s += uint2string( dyaBefore );
 
5780
    s += "\ndyaAfter=";
 
5781
    s += uint2string( dyaAfter );
 
5782
    s += "\nphe=";
 
5783
    s += "\n{" + phe.toString() + "}\n";
 
5784
    s += "\nfAutoHyph=";
 
5785
    s += uint2string( fAutoHyph );
 
5786
    s += "\nfWidowControl=";
 
5787
    s += uint2string( fWidowControl );
 
5788
    s += "\nfInTable=";
 
5789
    s += uint2string( fInTable );
 
5790
    s += "\nfTtp=";
 
5791
    s += uint2string( fTtp );
 
5792
    s += "\nptap=";
 
5793
    s += uint2string( ptap );
 
5794
    s += "\ndxaAbs=";
 
5795
    s += int2string( dxaAbs );
 
5796
    s += "\ndyaAbs=";
 
5797
    s += int2string( dyaAbs );
 
5798
    s += "\ndxaWidth=";
 
5799
    s += uint2string( dxaWidth );
 
5800
    s += "\nbrcTop=";
 
5801
    s += "\n{" + brcTop.toString() + "}\n";
 
5802
    s += "\nbrcLeft=";
 
5803
    s += "\n{" + brcLeft.toString() + "}\n";
 
5804
    s += "\nbrcBottom=";
 
5805
    s += "\n{" + brcBottom.toString() + "}\n";
 
5806
    s += "\nbrcRight=";
 
5807
    s += "\n{" + brcRight.toString() + "}\n";
 
5808
    s += "\nbrcBetween=";
 
5809
    s += "\n{" + brcBetween.toString() + "}\n";
 
5810
    s += "\nbrcBar=";
 
5811
    s += "\n{" + brcBar.toString() + "}\n";
 
5812
    s += "\ndxaFromText=";
 
5813
    s += uint2string( dxaFromText );
 
5814
    s += "\ndyaFromText=";
 
5815
    s += uint2string( dyaFromText );
 
5816
    s += "\nwr=";
 
5817
    s += uint2string( wr );
 
5818
    s += "\nfLocked=";
 
5819
    s += uint2string( fLocked );
 
5820
    s += "\ndyaHeight=";
 
5821
    s += uint2string( dyaHeight );
 
5822
    s += "\nfMinHeight=";
 
5823
    s += uint2string( fMinHeight );
 
5824
    s += "\nshd=";
 
5825
    s += "\n{" + shd.toString() + "}\n";
 
5826
    s += "\ndcs=";
 
5827
    s += "\n{" + dcs.toString() + "}\n";
 
5828
    s += "\nanld=";
 
5829
    s += "\n{" + anld.toString() + "}\n";
 
5830
    s += "\nitbdMac=";
 
5831
    s += uint2string( itbdMac );
 
5832
    for(int _i=0; _i<(itbdMac); ++_i) {
 
5833
        s += "\nrgdxaTab[" + int2string( _i ) + "]=";
 
5834
    s += uint2string( rgdxaTab[_i] );
 
5835
    }
 
5836
    for(int _i=0; _i<(itbdMac); ++_i) {
 
5837
        s += "\nrgtbd[" + int2string( _i ) + "]=";
 
5838
    s += uint2string( rgtbd[_i] );
 
5839
    }
 
5840
    s += "\nPAP Done.";
 
5841
    return s;
 
5842
}
 
5843
 
 
5844
void PAP::clearInternal() {
 
5845
    istd=0;
 
5846
    jc=0;
 
5847
    fKeep=0;
 
5848
    fKeepFollow=0;
 
5849
    fPageBreakBefore=0;
 
5850
    fBrLnAbove=0;
 
5851
    fBrLnBelow=0;
 
5852
    fUnused=0;
 
5853
    pcVert=0;
 
5854
    pcHorz=0;
 
5855
    brcp=0;
 
5856
    brcl=0;
 
5857
    unused9=0;
 
5858
    nLvlAnm=0;
 
5859
    fNoLnn=0;
 
5860
    fSideBySide=0;
 
5861
    dxaRight=0;
 
5862
    dxaLeft=0;
 
5863
    dxaLeft1=0;
 
5864
    lspd.clear();
 
5865
    dyaBefore=0;
 
5866
    dyaAfter=0;
 
5867
    phe.clear();
 
5868
    fAutoHyph=0;
 
5869
    fWidowControl=0;
 
5870
    fInTable=0;
 
5871
    fTtp=0;
 
5872
    ptap=0;
 
5873
    dxaAbs=0;
 
5874
    dyaAbs=0;
 
5875
    dxaWidth=0;
 
5876
    brcTop.clear();
 
5877
    brcLeft.clear();
 
5878
    brcBottom.clear();
 
5879
    brcRight.clear();
 
5880
    brcBetween.clear();
 
5881
    brcBar.clear();
 
5882
    dxaFromText=0;
 
5883
    dyaFromText=0;
 
5884
    wr=0;
 
5885
    fLocked=0;
 
5886
    dyaHeight=0;
 
5887
    fMinHeight=0;
 
5888
    shd.clear();
 
5889
    dcs.clear();
 
5890
    anld.clear();
 
5891
    itbdMac=0;
 
5892
    rgdxaTab=0;
 
5893
    rgtbd=0;
 
5894
}
 
5895
 
 
5896
bool operator==(const PAP &lhs, const PAP &rhs) {
 
5897
 
 
5898
    if((lhs.itbdMac)!=(rhs.itbdMac))
 
5899
        return false;
 
5900
    for(int _i=0; _i<(lhs.itbdMac); ++_i) {
 
5901
        if(lhs.rgdxaTab[_i]!=rhs.rgdxaTab[_i])
 
5902
            return false;
 
5903
    }
 
5904
 
 
5905
    if((lhs.itbdMac)!=(rhs.itbdMac))
 
5906
        return false;
 
5907
    for(int _i=0; _i<(lhs.itbdMac); ++_i) {
 
5908
        if(lhs.rgtbd[_i]!=rhs.rgtbd[_i])
 
5909
            return false;
 
5910
    }
 
5911
 
 
5912
    return lhs.istd==rhs.istd &&
 
5913
           lhs.jc==rhs.jc &&
 
5914
           lhs.fKeep==rhs.fKeep &&
 
5915
           lhs.fKeepFollow==rhs.fKeepFollow &&
 
5916
           lhs.fPageBreakBefore==rhs.fPageBreakBefore &&
 
5917
           lhs.fBrLnAbove==rhs.fBrLnAbove &&
 
5918
           lhs.fBrLnBelow==rhs.fBrLnBelow &&
 
5919
           lhs.fUnused==rhs.fUnused &&
 
5920
           lhs.pcVert==rhs.pcVert &&
 
5921
           lhs.pcHorz==rhs.pcHorz &&
 
5922
           lhs.brcp==rhs.brcp &&
 
5923
           lhs.brcl==rhs.brcl &&
 
5924
           lhs.unused9==rhs.unused9 &&
 
5925
           lhs.nLvlAnm==rhs.nLvlAnm &&
 
5926
           lhs.fNoLnn==rhs.fNoLnn &&
 
5927
           lhs.fSideBySide==rhs.fSideBySide &&
 
5928
           lhs.dxaRight==rhs.dxaRight &&
 
5929
           lhs.dxaLeft==rhs.dxaLeft &&
 
5930
           lhs.dxaLeft1==rhs.dxaLeft1 &&
 
5931
           lhs.lspd==rhs.lspd &&
 
5932
           lhs.dyaBefore==rhs.dyaBefore &&
 
5933
           lhs.dyaAfter==rhs.dyaAfter &&
 
5934
           lhs.phe==rhs.phe &&
 
5935
           lhs.fAutoHyph==rhs.fAutoHyph &&
 
5936
           lhs.fWidowControl==rhs.fWidowControl &&
 
5937
           lhs.fInTable==rhs.fInTable &&
 
5938
           lhs.fTtp==rhs.fTtp &&
 
5939
           lhs.ptap==rhs.ptap &&
 
5940
           lhs.dxaAbs==rhs.dxaAbs &&
 
5941
           lhs.dyaAbs==rhs.dyaAbs &&
 
5942
           lhs.dxaWidth==rhs.dxaWidth &&
 
5943
           lhs.brcTop==rhs.brcTop &&
 
5944
           lhs.brcLeft==rhs.brcLeft &&
 
5945
           lhs.brcBottom==rhs.brcBottom &&
 
5946
           lhs.brcRight==rhs.brcRight &&
 
5947
           lhs.brcBetween==rhs.brcBetween &&
 
5948
           lhs.brcBar==rhs.brcBar &&
 
5949
           lhs.dxaFromText==rhs.dxaFromText &&
 
5950
           lhs.dyaFromText==rhs.dyaFromText &&
 
5951
           lhs.wr==rhs.wr &&
 
5952
           lhs.fLocked==rhs.fLocked &&
 
5953
           lhs.dyaHeight==rhs.dyaHeight &&
 
5954
           lhs.fMinHeight==rhs.fMinHeight &&
 
5955
           lhs.shd==rhs.shd &&
 
5956
           lhs.dcs==rhs.dcs &&
 
5957
           lhs.anld==rhs.anld &&
 
5958
           lhs.itbdMac==rhs.itbdMac;
 
5959
}
 
5960
 
 
5961
bool operator!=(const PAP &lhs, const PAP &rhs) {
 
5962
    return !(lhs==rhs);
 
5963
}
 
5964
 
 
5965
 
 
5966
// PCD implementation
 
5967
 
 
5968
const unsigned int PCD::sizeOf = 8;
 
5969
 
 
5970
PCD::PCD() {
 
5971
    clear();
 
5972
}
 
5973
 
 
5974
PCD::PCD(OLEStreamReader *stream, bool preservePos) {
 
5975
    clear();
 
5976
    read(stream, preservePos);
 
5977
}
 
5978
 
 
5979
PCD::PCD(const U8 *ptr) {
 
5980
    clear();
 
5981
    readPtr(ptr);
 
5982
}
 
5983
 
 
5984
bool PCD::read(OLEStreamReader *stream, bool preservePos) {
 
5985
 
 
5986
    U16 shifterU16;
 
5987
 
 
5988
    if(preservePos)
 
5989
        stream->push();
 
5990
 
 
5991
    shifterU16=stream->readU16();
 
5992
    fNoParaLast=shifterU16;
 
5993
    shifterU16>>=1;
 
5994
    fPaphNil=shifterU16;
 
5995
    shifterU16>>=1;
 
5996
    fCopied=shifterU16;
 
5997
    shifterU16>>=1;
 
5998
    unused0_3=shifterU16;
 
5999
    shifterU16>>=5;
 
6000
    fn=shifterU16;
 
6001
    fc=stream->readU32();
 
6002
    prm.read(stream, false);
 
6003
 
 
6004
    if(preservePos)
 
6005
        stream->pop();
 
6006
    return true;
 
6007
}
 
6008
 
 
6009
void PCD::readPtr(const U8 *ptr) {
 
6010
 
 
6011
    U16 shifterU16;
 
6012
 
 
6013
    shifterU16=readU16(ptr);
 
6014
    ptr+=sizeof(U16);
 
6015
    fNoParaLast=shifterU16;
 
6016
    shifterU16>>=1;
 
6017
    fPaphNil=shifterU16;
 
6018
    shifterU16>>=1;
 
6019
    fCopied=shifterU16;
 
6020
    shifterU16>>=1;
 
6021
    unused0_3=shifterU16;
 
6022
    shifterU16>>=5;
 
6023
    fn=shifterU16;
 
6024
    fc=readU32(ptr);
 
6025
    ptr+=sizeof(U32);
 
6026
    prm.readPtr(ptr);
 
6027
    ptr+=PRM::sizeOf;
 
6028
}
 
6029
 
 
6030
bool PCD::write(OLEStreamWriter *stream, bool preservePos) const {
 
6031
 
 
6032
    U16 shifterU16;
 
6033
 
 
6034
    if(preservePos)
 
6035
        stream->push();
 
6036
 
 
6037
    shifterU16=fNoParaLast;
 
6038
    shifterU16|=fPaphNil << 1;
 
6039
    shifterU16|=fCopied << 2;
 
6040
    shifterU16|=unused0_3 << 3;
 
6041
    shifterU16|=fn << 8;
 
6042
    stream->write(shifterU16);
 
6043
    stream->write(fc);
 
6044
    prm.write(stream, false);
 
6045
 
 
6046
    if(preservePos)
 
6047
        stream->pop();
 
6048
    return true;
 
6049
}
 
6050
 
 
6051
void PCD::clear() {
 
6052
    fNoParaLast=0;
 
6053
    fPaphNil=0;
 
6054
    fCopied=0;
 
6055
    unused0_3=0;
 
6056
    fn=0;
 
6057
    fc=0;
 
6058
    prm.clear();
 
6059
}
 
6060
 
 
6061
bool operator==(const PCD &lhs, const PCD &rhs) {
 
6062
 
 
6063
    return lhs.fNoParaLast==rhs.fNoParaLast &&
 
6064
           lhs.fPaphNil==rhs.fPaphNil &&
 
6065
           lhs.fCopied==rhs.fCopied &&
 
6066
           lhs.unused0_3==rhs.unused0_3 &&
 
6067
           lhs.fn==rhs.fn &&
 
6068
           lhs.fc==rhs.fc &&
 
6069
           lhs.prm==rhs.prm;
 
6070
}
 
6071
 
 
6072
bool operator!=(const PCD &lhs, const PCD &rhs) {
 
6073
    return !(lhs==rhs);
 
6074
}
 
6075
 
 
6076
 
 
6077
// PGD implementation
 
6078
 
 
6079
PGD::PGD() {
 
6080
    clear();
 
6081
}
 
6082
 
 
6083
PGD::PGD(OLEStreamReader *stream, bool preservePos) {
 
6084
    clear();
 
6085
    read(stream, preservePos);
 
6086
}
 
6087
 
 
6088
bool PGD::read(OLEStreamReader *stream, bool preservePos) {
 
6089
 
 
6090
    U16 shifterU16;
 
6091
 
 
6092
    if(preservePos)
 
6093
        stream->push();
 
6094
 
 
6095
    shifterU16=stream->readU16();
 
6096
    unused0_0=shifterU16;
 
6097
    shifterU16>>=5;
 
6098
    fGhost=shifterU16;
 
6099
    shifterU16>>=2;
 
6100
    unused0_7=shifterU16;
 
6101
    shifterU16=stream->readU16();
 
6102
    fContinue=shifterU16;
 
6103
    shifterU16>>=1;
 
6104
    fUnk=shifterU16;
 
6105
    shifterU16>>=1;
 
6106
    fRight=shifterU16;
 
6107
    shifterU16>>=1;
 
6108
    fPgnRestart=shifterU16;
 
6109
    shifterU16>>=1;
 
6110
    fEmptyPage=shifterU16;
 
6111
    shifterU16>>=1;
 
6112
    fAllFtn=shifterU16;
 
6113
    shifterU16>>=1;
 
6114
    fColOnly=shifterU16;
 
6115
    shifterU16>>=1;
 
6116
    fTableBreaks=shifterU16;
 
6117
    shifterU16>>=1;
 
6118
    fMarked=shifterU16;
 
6119
    shifterU16>>=1;
 
6120
    fColumnBreaks=shifterU16;
 
6121
    shifterU16>>=1;
 
6122
    fTableHeader=shifterU16;
 
6123
    shifterU16>>=1;
 
6124
    fNewPage=shifterU16;
 
6125
    shifterU16>>=1;
 
6126
    bkc=shifterU16;
 
6127
    lnn=stream->readU16();
 
6128
    pgn=stream->readU16();
 
6129
 
 
6130
    if(preservePos)
 
6131
        stream->pop();
 
6132
    return true;
 
6133
}
 
6134
 
 
6135
bool PGD::write(OLEStreamWriter *stream, bool preservePos) const {
 
6136
 
 
6137
    U16 shifterU16;
 
6138
 
 
6139
    if(preservePos)
 
6140
        stream->push();
 
6141
 
 
6142
    shifterU16=unused0_0;
 
6143
    shifterU16|=fGhost << 5;
 
6144
    shifterU16|=unused0_7 << 7;
 
6145
    stream->write(shifterU16);
 
6146
    shifterU16=fContinue;
 
6147
    shifterU16|=fUnk << 1;
 
6148
    shifterU16|=fRight << 2;
 
6149
    shifterU16|=fPgnRestart << 3;
 
6150
    shifterU16|=fEmptyPage << 4;
 
6151
    shifterU16|=fAllFtn << 5;
 
6152
    shifterU16|=fColOnly << 6;
 
6153
    shifterU16|=fTableBreaks << 7;
 
6154
    shifterU16|=fMarked << 8;
 
6155
    shifterU16|=fColumnBreaks << 9;
 
6156
    shifterU16|=fTableHeader << 10;
 
6157
    shifterU16|=fNewPage << 11;
 
6158
    shifterU16|=bkc << 12;
 
6159
    stream->write(shifterU16);
 
6160
    stream->write(lnn);
 
6161
    stream->write(pgn);
 
6162
 
 
6163
    if(preservePos)
 
6164
        stream->pop();
 
6165
    return true;
 
6166
}
 
6167
 
 
6168
void PGD::clear() {
 
6169
    unused0_0=0;
 
6170
    fGhost=0;
 
6171
    unused0_7=0;
 
6172
    fContinue=0;
 
6173
    fUnk=0;
 
6174
    fRight=0;
 
6175
    fPgnRestart=0;
 
6176
    fEmptyPage=0;
 
6177
    fAllFtn=0;
 
6178
    fColOnly=0;
 
6179
    fTableBreaks=0;
 
6180
    fMarked=0;
 
6181
    fColumnBreaks=0;
 
6182
    fTableHeader=0;
 
6183
    fNewPage=0;
 
6184
    bkc=0;
 
6185
    lnn=0;
 
6186
    pgn=0;
 
6187
}
 
6188
 
 
6189
bool operator==(const PGD &lhs, const PGD &rhs) {
 
6190
 
 
6191
    return lhs.unused0_0==rhs.unused0_0 &&
 
6192
           lhs.fGhost==rhs.fGhost &&
 
6193
           lhs.unused0_7==rhs.unused0_7 &&
 
6194
           lhs.fContinue==rhs.fContinue &&
 
6195
           lhs.fUnk==rhs.fUnk &&
 
6196
           lhs.fRight==rhs.fRight &&
 
6197
           lhs.fPgnRestart==rhs.fPgnRestart &&
 
6198
           lhs.fEmptyPage==rhs.fEmptyPage &&
 
6199
           lhs.fAllFtn==rhs.fAllFtn &&
 
6200
           lhs.fColOnly==rhs.fColOnly &&
 
6201
           lhs.fTableBreaks==rhs.fTableBreaks &&
 
6202
           lhs.fMarked==rhs.fMarked &&
 
6203
           lhs.fColumnBreaks==rhs.fColumnBreaks &&
 
6204
           lhs.fTableHeader==rhs.fTableHeader &&
 
6205
           lhs.fNewPage==rhs.fNewPage &&
 
6206
           lhs.bkc==rhs.bkc &&
 
6207
           lhs.lnn==rhs.lnn &&
 
6208
           lhs.pgn==rhs.pgn;
 
6209
}
 
6210
 
 
6211
bool operator!=(const PGD &lhs, const PGD &rhs) {
 
6212
    return !(lhs==rhs);
 
6213
}
 
6214
 
 
6215
 
 
6216
// PICF implementation
 
6217
 
 
6218
PICF::PICF() : Shared() {
 
6219
    clear();
 
6220
}
 
6221
 
 
6222
PICF::PICF(OLEStreamReader *stream, bool preservePos) : Shared() {
 
6223
    clear();
 
6224
    read(stream, preservePos);
 
6225
}
 
6226
 
 
6227
bool PICF::read(OLEStreamReader *stream, bool preservePos) {
 
6228
 
 
6229
    U16 shifterU16;
 
6230
 
 
6231
    if(preservePos)
 
6232
        stream->push();
 
6233
 
 
6234
    lcb=stream->readU32();
 
6235
    cbHeader=stream->readU16();
 
6236
    mfp.read(stream, false);
 
6237
    for(int _i=0; _i<(14); ++_i)
 
6238
        bm_rcWinMF[_i]=stream->readU8();
 
6239
    dxaGoal=stream->readU16();
 
6240
    dyaGoal=stream->readU16();
 
6241
    mx=stream->readU16();
 
6242
    my=stream->readU16();
 
6243
    dxaCropLeft=stream->readU16();
 
6244
    dyaCropTop=stream->readU16();
 
6245
    dxaCropRight=stream->readU16();
 
6246
    dyaCropBottom=stream->readU16();
 
6247
    shifterU16=stream->readU16();
 
6248
    brcl=shifterU16;
 
6249
    shifterU16>>=4;
 
6250
    fFrameEmpty=shifterU16;
 
6251
    shifterU16>>=1;
 
6252
    fBitmap=shifterU16;
 
6253
    shifterU16>>=1;
 
6254
    fDrawHatch=shifterU16;
 
6255
    shifterU16>>=1;
 
6256
    fError=shifterU16;
 
6257
    shifterU16>>=1;
 
6258
    bpp=shifterU16;
 
6259
    brcTop.read(stream, false);
 
6260
    brcLeft.read(stream, false);
 
6261
    brcBottom.read(stream, false);
 
6262
    brcRight.read(stream, false);
 
6263
    dxaOrigin=stream->readU16();
 
6264
    dyaOrigin=stream->readU16();
 
6265
 
 
6266
    if(preservePos)
 
6267
        stream->pop();
 
6268
    return true;
 
6269
}
 
6270
 
 
6271
bool PICF::write(OLEStreamWriter *stream, bool preservePos) const {
 
6272
 
 
6273
    U16 shifterU16;
 
6274
 
 
6275
    if(preservePos)
 
6276
        stream->push();
 
6277
 
 
6278
    stream->write(lcb);
 
6279
    stream->write(cbHeader);
 
6280
    mfp.write(stream, false);
 
6281
    for(int _i=0; _i<(14); ++_i)
 
6282
        stream->write(bm_rcWinMF[_i]);
 
6283
    stream->write(dxaGoal);
 
6284
    stream->write(dyaGoal);
 
6285
    stream->write(mx);
 
6286
    stream->write(my);
 
6287
    stream->write(dxaCropLeft);
 
6288
    stream->write(dyaCropTop);
 
6289
    stream->write(dxaCropRight);
 
6290
    stream->write(dyaCropBottom);
 
6291
    shifterU16=brcl;
 
6292
    shifterU16|=fFrameEmpty << 4;
 
6293
    shifterU16|=fBitmap << 5;
 
6294
    shifterU16|=fDrawHatch << 6;
 
6295
    shifterU16|=fError << 7;
 
6296
    shifterU16|=bpp << 8;
 
6297
    stream->write(shifterU16);
 
6298
    brcTop.write(stream, false);
 
6299
    brcLeft.write(stream, false);
 
6300
    brcBottom.write(stream, false);
 
6301
    brcRight.write(stream, false);
 
6302
    stream->write(dxaOrigin);
 
6303
    stream->write(dyaOrigin);
 
6304
 
 
6305
    if(preservePos)
 
6306
        stream->pop();
 
6307
    return true;
 
6308
}
 
6309
 
 
6310
void PICF::clear() {
 
6311
    lcb=0;
 
6312
    cbHeader=0;
 
6313
    mfp.clear();
 
6314
    for(int _i=0; _i<(14); ++_i)
 
6315
        bm_rcWinMF[_i]=0;
 
6316
    dxaGoal=0;
 
6317
    dyaGoal=0;
 
6318
    mx=0;
 
6319
    my=0;
 
6320
    dxaCropLeft=0;
 
6321
    dyaCropTop=0;
 
6322
    dxaCropRight=0;
 
6323
    dyaCropBottom=0;
 
6324
    brcl=0;
 
6325
    fFrameEmpty=0;
 
6326
    fBitmap=0;
 
6327
    fDrawHatch=0;
 
6328
    fError=0;
 
6329
    bpp=0;
 
6330
    brcTop.clear();
 
6331
    brcLeft.clear();
 
6332
    brcBottom.clear();
 
6333
    brcRight.clear();
 
6334
    dxaOrigin=0;
 
6335
    dyaOrigin=0;
 
6336
}
 
6337
 
 
6338
void PICF::dump() const
 
6339
{
 
6340
    wvlog << "Dumping PICF:" << endl;
 
6341
    wvlog << toString().c_str() << endl;
 
6342
    wvlog << "\nDumping PICF done." << endl;
 
6343
}
 
6344
 
 
6345
std::string PICF::toString() const
 
6346
{
 
6347
    std::string s( "PICF:" );
 
6348
    s += "\nlcb=";
 
6349
    s += uint2string( lcb );
 
6350
    s += "\ncbHeader=";
 
6351
    s += uint2string( cbHeader );
 
6352
    s += "\nmfp=";
 
6353
    s += "\n{" + mfp.toString() + "}\n";
 
6354
    for(int _i=0; _i<(14); ++_i) {
 
6355
        s += "\nbm_rcWinMF[" + int2string( _i ) + "]=";
 
6356
    s += uint2string( bm_rcWinMF[_i] );
 
6357
    }
 
6358
    s += "\ndxaGoal=";
 
6359
    s += uint2string( dxaGoal );
 
6360
    s += "\ndyaGoal=";
 
6361
    s += uint2string( dyaGoal );
 
6362
    s += "\nmx=";
 
6363
    s += uint2string( mx );
 
6364
    s += "\nmy=";
 
6365
    s += uint2string( my );
 
6366
    s += "\ndxaCropLeft=";
 
6367
    s += uint2string( dxaCropLeft );
 
6368
    s += "\ndyaCropTop=";
 
6369
    s += uint2string( dyaCropTop );
 
6370
    s += "\ndxaCropRight=";
 
6371
    s += uint2string( dxaCropRight );
 
6372
    s += "\ndyaCropBottom=";
 
6373
    s += uint2string( dyaCropBottom );
 
6374
    s += "\nbrcl=";
 
6375
    s += uint2string( brcl );
 
6376
    s += "\nfFrameEmpty=";
 
6377
    s += uint2string( fFrameEmpty );
 
6378
    s += "\nfBitmap=";
 
6379
    s += uint2string( fBitmap );
 
6380
    s += "\nfDrawHatch=";
 
6381
    s += uint2string( fDrawHatch );
 
6382
    s += "\nfError=";
 
6383
    s += uint2string( fError );
 
6384
    s += "\nbpp=";
 
6385
    s += uint2string( bpp );
 
6386
    s += "\nbrcTop=";
 
6387
    s += "\n{" + brcTop.toString() + "}\n";
 
6388
    s += "\nbrcLeft=";
 
6389
    s += "\n{" + brcLeft.toString() + "}\n";
 
6390
    s += "\nbrcBottom=";
 
6391
    s += "\n{" + brcBottom.toString() + "}\n";
 
6392
    s += "\nbrcRight=";
 
6393
    s += "\n{" + brcRight.toString() + "}\n";
 
6394
    s += "\ndxaOrigin=";
 
6395
    s += uint2string( dxaOrigin );
 
6396
    s += "\ndyaOrigin=";
 
6397
    s += uint2string( dyaOrigin );
 
6398
    s += "\nPICF Done.";
 
6399
    return s;
 
6400
}
 
6401
 
 
6402
bool operator==(const PICF &lhs, const PICF &rhs) {
 
6403
 
 
6404
    for(int _i=0; _i<(14); ++_i) {
 
6405
        if(lhs.bm_rcWinMF[_i]!=rhs.bm_rcWinMF[_i])
 
6406
            return false;
 
6407
    }
 
6408
 
 
6409
    return lhs.lcb==rhs.lcb &&
 
6410
           lhs.cbHeader==rhs.cbHeader &&
 
6411
           lhs.mfp==rhs.mfp &&
 
6412
           lhs.dxaGoal==rhs.dxaGoal &&
 
6413
           lhs.dyaGoal==rhs.dyaGoal &&
 
6414
           lhs.mx==rhs.mx &&
 
6415
           lhs.my==rhs.my &&
 
6416
           lhs.dxaCropLeft==rhs.dxaCropLeft &&
 
6417
           lhs.dyaCropTop==rhs.dyaCropTop &&
 
6418
           lhs.dxaCropRight==rhs.dxaCropRight &&
 
6419
           lhs.dyaCropBottom==rhs.dyaCropBottom &&
 
6420
           lhs.brcl==rhs.brcl &&
 
6421
           lhs.fFrameEmpty==rhs.fFrameEmpty &&
 
6422
           lhs.fBitmap==rhs.fBitmap &&
 
6423
           lhs.fDrawHatch==rhs.fDrawHatch &&
 
6424
           lhs.fError==rhs.fError &&
 
6425
           lhs.bpp==rhs.bpp &&
 
6426
           lhs.brcTop==rhs.brcTop &&
 
6427
           lhs.brcLeft==rhs.brcLeft &&
 
6428
           lhs.brcBottom==rhs.brcBottom &&
 
6429
           lhs.brcRight==rhs.brcRight &&
 
6430
           lhs.dxaOrigin==rhs.dxaOrigin &&
 
6431
           lhs.dyaOrigin==rhs.dyaOrigin;
 
6432
}
 
6433
 
 
6434
bool operator!=(const PICF &lhs, const PICF &rhs) {
 
6435
    return !(lhs==rhs);
 
6436
}
 
6437
 
 
6438
 
 
6439
// SED implementation
 
6440
 
 
6441
const unsigned int SED::sizeOf = 12;
 
6442
 
 
6443
SED::SED() {
 
6444
    clear();
 
6445
}
 
6446
 
 
6447
SED::SED(OLEStreamReader *stream, bool preservePos) {
 
6448
    clear();
 
6449
    read(stream, preservePos);
 
6450
}
 
6451
 
 
6452
bool SED::read(OLEStreamReader *stream, bool preservePos) {
 
6453
 
 
6454
    U16 shifterU16;
 
6455
 
 
6456
    if(preservePos)
 
6457
        stream->push();
 
6458
 
 
6459
    shifterU16=stream->readU16();
 
6460
    fSwap=shifterU16;
 
6461
    shifterU16>>=1;
 
6462
    fUnk=shifterU16;
 
6463
    shifterU16>>=1;
 
6464
    fn=shifterU16;
 
6465
    fcSepx=stream->readU32();
 
6466
    fnMpr=stream->readU16();
 
6467
    fcMpr=stream->readU32();
 
6468
 
 
6469
    if(preservePos)
 
6470
        stream->pop();
 
6471
    return true;
 
6472
}
 
6473
 
 
6474
bool SED::write(OLEStreamWriter *stream, bool preservePos) const {
 
6475
 
 
6476
    U16 shifterU16;
 
6477
 
 
6478
    if(preservePos)
 
6479
        stream->push();
 
6480
 
 
6481
    shifterU16=fSwap;
 
6482
    shifterU16|=fUnk << 1;
 
6483
    shifterU16|=fn << 2;
 
6484
    stream->write(shifterU16);
 
6485
    stream->write(fcSepx);
 
6486
    stream->write(fnMpr);
 
6487
    stream->write(fcMpr);
 
6488
 
 
6489
    if(preservePos)
 
6490
        stream->pop();
 
6491
    return true;
 
6492
}
 
6493
 
 
6494
void SED::clear() {
 
6495
    fSwap=0;
 
6496
    fUnk=0;
 
6497
    fn=0;
 
6498
    fcSepx=0;
 
6499
    fnMpr=0;
 
6500
    fcMpr=0;
 
6501
}
 
6502
 
 
6503
bool operator==(const SED &lhs, const SED &rhs) {
 
6504
 
 
6505
    return lhs.fSwap==rhs.fSwap &&
 
6506
           lhs.fUnk==rhs.fUnk &&
 
6507
           lhs.fn==rhs.fn &&
 
6508
           lhs.fcSepx==rhs.fcSepx &&
 
6509
           lhs.fnMpr==rhs.fnMpr &&
 
6510
           lhs.fcMpr==rhs.fcMpr;
 
6511
}
 
6512
 
 
6513
bool operator!=(const SED &lhs, const SED &rhs) {
 
6514
    return !(lhs==rhs);
 
6515
}
 
6516
 
 
6517
 
 
6518
// SEP implementation
 
6519
 
 
6520
SEP::SEP() : Shared() {
 
6521
    clear();
 
6522
}
 
6523
 
 
6524
SEP::SEP(OLEStreamReader *stream, bool preservePos) : Shared() {
 
6525
    clear();
 
6526
    read(stream, preservePos);
 
6527
}
 
6528
 
 
6529
bool SEP::read(OLEStreamReader *stream, bool preservePos) {
 
6530
 
 
6531
    if(preservePos)
 
6532
        stream->push();
 
6533
 
 
6534
    bkc=stream->readU8();
 
6535
    fTitlePage=stream->readU8();
 
6536
    ccolM1=stream->readU16();
 
6537
    dxaColumns=stream->readU16();
 
6538
    fAutoPgn=stream->readU8();
 
6539
    nfcPgn=stream->readU8();
 
6540
    pgnStart=stream->readU16();
 
6541
    fUnlocked=stream->readU8();
 
6542
    cnsPgn=stream->readU8();
 
6543
    fPgnRestart=stream->readU8();
 
6544
    fEndNote=stream->readU8();
 
6545
    lnc=stream->readU8();
 
6546
    grpfIhdt=stream->readU8();
 
6547
    nLnnMod=stream->readU16();
 
6548
    dxaLnn=stream->readU16();
 
6549
    dyaHdrTop=stream->readU16();
 
6550
    dyaHdrBottom=stream->readU16();
 
6551
    dxaPgn=stream->readU16();
 
6552
    dyaPgn=stream->readU16();
 
6553
    fLBetween=stream->readU8();
 
6554
    vjc=stream->readU8();
 
6555
    lnnMin=stream->readU16();
 
6556
    dmOrientPage=stream->readU8();
 
6557
    iHeadingPgn=stream->readU8();
 
6558
    xaPage=stream->readU16();
 
6559
    yaPage=stream->readU16();
 
6560
    dxaLeft=stream->readU16();
 
6561
    dxaRight=stream->readU16();
 
6562
    dyaTop=stream->readU16();
 
6563
    dyaBottom=stream->readU16();
 
6564
    dzaGutter=stream->readU16();
 
6565
    dmBinFirst=stream->readU16();
 
6566
    dmBinOther=stream->readU16();
 
6567
    dmPaperReq=stream->readU16();
 
6568
    fEvenlySpaced=stream->readU8();
 
6569
    unused55=stream->readU8();
 
6570
    dxaColumnWidth=stream->readU16();
 
6571
    for(int _i=0; _i<(89); ++_i)
 
6572
        rgdxaColumnWidthSpacing[_i]=stream->readU16();
 
6573
    olstAnm.read(stream, false);
 
6574
 
 
6575
    if(preservePos)
 
6576
        stream->pop();
 
6577
    return true;
 
6578
}
 
6579
 
 
6580
bool SEP::write(OLEStreamWriter *stream, bool preservePos) const {
 
6581
 
 
6582
    if(preservePos)
 
6583
        stream->push();
 
6584
 
 
6585
    stream->write(bkc);
 
6586
    stream->write(fTitlePage);
 
6587
    stream->write(ccolM1);
 
6588
    stream->write(dxaColumns);
 
6589
    stream->write(fAutoPgn);
 
6590
    stream->write(nfcPgn);
 
6591
    stream->write(pgnStart);
 
6592
    stream->write(fUnlocked);
 
6593
    stream->write(cnsPgn);
 
6594
    stream->write(fPgnRestart);
 
6595
    stream->write(fEndNote);
 
6596
    stream->write(lnc);
 
6597
    stream->write(grpfIhdt);
 
6598
    stream->write(nLnnMod);
 
6599
    stream->write(dxaLnn);
 
6600
    stream->write(dyaHdrTop);
 
6601
    stream->write(dyaHdrBottom);
 
6602
    stream->write(dxaPgn);
 
6603
    stream->write(dyaPgn);
 
6604
    stream->write(fLBetween);
 
6605
    stream->write(vjc);
 
6606
    stream->write(lnnMin);
 
6607
    stream->write(dmOrientPage);
 
6608
    stream->write(iHeadingPgn);
 
6609
    stream->write(xaPage);
 
6610
    stream->write(yaPage);
 
6611
    stream->write(dxaLeft);
 
6612
    stream->write(dxaRight);
 
6613
    stream->write(dyaTop);
 
6614
    stream->write(dyaBottom);
 
6615
    stream->write(dzaGutter);
 
6616
    stream->write(dmBinFirst);
 
6617
    stream->write(dmBinOther);
 
6618
    stream->write(dmPaperReq);
 
6619
    stream->write(fEvenlySpaced);
 
6620
    stream->write(unused55);
 
6621
    stream->write(dxaColumnWidth);
 
6622
    for(int _i=0; _i<(89); ++_i)
 
6623
        stream->write(rgdxaColumnWidthSpacing[_i]);
 
6624
    olstAnm.write(stream, false);
 
6625
 
 
6626
    if(preservePos)
 
6627
        stream->pop();
 
6628
    return true;
 
6629
}
 
6630
 
 
6631
void SEP::clear() {
 
6632
    bkc=2;
 
6633
    fTitlePage=0;
 
6634
    ccolM1=0;
 
6635
    dxaColumns=0;
 
6636
    fAutoPgn=0;
 
6637
    nfcPgn=0;
 
6638
    pgnStart=0;
 
6639
    fUnlocked=0;
 
6640
    cnsPgn=0;
 
6641
    fPgnRestart=0;
 
6642
    fEndNote=true;
 
6643
    lnc=0;
 
6644
    grpfIhdt=0;
 
6645
    nLnnMod=0;
 
6646
    dxaLnn=0;
 
6647
    dyaHdrTop=720;
 
6648
    dyaHdrBottom=720;
 
6649
    dxaPgn=720;
 
6650
    dyaPgn=720;
 
6651
    fLBetween=0;
 
6652
    vjc=0;
 
6653
    lnnMin=0;
 
6654
    dmOrientPage=1;
 
6655
    iHeadingPgn=0;
 
6656
    xaPage=12240;
 
6657
    yaPage=15840;
 
6658
    dxaLeft=0;
 
6659
    dxaRight=0;
 
6660
    dyaTop=0;
 
6661
    dyaBottom=0;
 
6662
    dzaGutter=0;
 
6663
    dmBinFirst=0;
 
6664
    dmBinOther=0;
 
6665
    dmPaperReq=0;
 
6666
    fEvenlySpaced=true;
 
6667
    unused55=0;
 
6668
    dxaColumnWidth=0;
 
6669
    for(int _i=0; _i<(89); ++_i)
 
6670
        rgdxaColumnWidthSpacing[_i]=0;
 
6671
    olstAnm.clear();
 
6672
}
 
6673
 
 
6674
void SEP::dump() const
 
6675
{
 
6676
    wvlog << "Dumping SEP:" << endl;
 
6677
    wvlog << toString().c_str() << endl;
 
6678
    wvlog << "\nDumping SEP done." << endl;
 
6679
}
 
6680
 
 
6681
std::string SEP::toString() const
 
6682
{
 
6683
    std::string s( "SEP:" );
 
6684
    s += "\nbkc=";
 
6685
    s += uint2string( bkc );
 
6686
    s += "\nfTitlePage=";
 
6687
    s += uint2string( fTitlePage );
 
6688
    s += "\nccolM1=";
 
6689
    s += uint2string( ccolM1 );
 
6690
    s += "\ndxaColumns=";
 
6691
    s += uint2string( dxaColumns );
 
6692
    s += "\nfAutoPgn=";
 
6693
    s += uint2string( fAutoPgn );
 
6694
    s += "\nnfcPgn=";
 
6695
    s += uint2string( nfcPgn );
 
6696
    s += "\npgnStart=";
 
6697
    s += uint2string( pgnStart );
 
6698
    s += "\nfUnlocked=";
 
6699
    s += uint2string( fUnlocked );
 
6700
    s += "\ncnsPgn=";
 
6701
    s += uint2string( cnsPgn );
 
6702
    s += "\nfPgnRestart=";
 
6703
    s += uint2string( fPgnRestart );
 
6704
    s += "\nfEndNote=";
 
6705
    s += uint2string( fEndNote );
 
6706
    s += "\nlnc=";
 
6707
    s += uint2string( lnc );
 
6708
    s += "\ngrpfIhdt=";
 
6709
    s += uint2string( grpfIhdt );
 
6710
    s += "\nnLnnMod=";
 
6711
    s += uint2string( nLnnMod );
 
6712
    s += "\ndxaLnn=";
 
6713
    s += uint2string( dxaLnn );
 
6714
    s += "\ndyaHdrTop=";
 
6715
    s += uint2string( dyaHdrTop );
 
6716
    s += "\ndyaHdrBottom=";
 
6717
    s += uint2string( dyaHdrBottom );
 
6718
    s += "\ndxaPgn=";
 
6719
    s += uint2string( dxaPgn );
 
6720
    s += "\ndyaPgn=";
 
6721
    s += uint2string( dyaPgn );
 
6722
    s += "\nfLBetween=";
 
6723
    s += uint2string( fLBetween );
 
6724
    s += "\nvjc=";
 
6725
    s += uint2string( vjc );
 
6726
    s += "\nlnnMin=";
 
6727
    s += uint2string( lnnMin );
 
6728
    s += "\ndmOrientPage=";
 
6729
    s += uint2string( dmOrientPage );
 
6730
    s += "\niHeadingPgn=";
 
6731
    s += uint2string( iHeadingPgn );
 
6732
    s += "\nxaPage=";
 
6733
    s += uint2string( xaPage );
 
6734
    s += "\nyaPage=";
 
6735
    s += uint2string( yaPage );
 
6736
    s += "\ndxaLeft=";
 
6737
    s += uint2string( dxaLeft );
 
6738
    s += "\ndxaRight=";
 
6739
    s += uint2string( dxaRight );
 
6740
    s += "\ndyaTop=";
 
6741
    s += uint2string( dyaTop );
 
6742
    s += "\ndyaBottom=";
 
6743
    s += uint2string( dyaBottom );
 
6744
    s += "\ndzaGutter=";
 
6745
    s += uint2string( dzaGutter );
 
6746
    s += "\ndmBinFirst=";
 
6747
    s += uint2string( dmBinFirst );
 
6748
    s += "\ndmBinOther=";
 
6749
    s += uint2string( dmBinOther );
 
6750
    s += "\ndmPaperReq=";
 
6751
    s += uint2string( dmPaperReq );
 
6752
    s += "\nfEvenlySpaced=";
 
6753
    s += uint2string( fEvenlySpaced );
 
6754
    s += "\nunused55=";
 
6755
    s += uint2string( unused55 );
 
6756
    s += "\ndxaColumnWidth=";
 
6757
    s += uint2string( dxaColumnWidth );
 
6758
    for(int _i=0; _i<(89); ++_i) {
 
6759
        s += "\nrgdxaColumnWidthSpacing[" + int2string( _i ) + "]=";
 
6760
    s += uint2string( rgdxaColumnWidthSpacing[_i] );
 
6761
    }
 
6762
    s += "\nolstAnm=";
 
6763
    s += "\n{" + olstAnm.toString() + "}\n";
 
6764
    s += "\nSEP Done.";
 
6765
    return s;
 
6766
}
 
6767
 
 
6768
bool operator==(const SEP &lhs, const SEP &rhs) {
 
6769
 
 
6770
    for(int _i=0; _i<(89); ++_i) {
 
6771
        if(lhs.rgdxaColumnWidthSpacing[_i]!=rhs.rgdxaColumnWidthSpacing[_i])
 
6772
            return false;
 
6773
    }
 
6774
 
 
6775
    return lhs.bkc==rhs.bkc &&
 
6776
           lhs.fTitlePage==rhs.fTitlePage &&
 
6777
           lhs.ccolM1==rhs.ccolM1 &&
 
6778
           lhs.dxaColumns==rhs.dxaColumns &&
 
6779
           lhs.fAutoPgn==rhs.fAutoPgn &&
 
6780
           lhs.nfcPgn==rhs.nfcPgn &&
 
6781
           lhs.pgnStart==rhs.pgnStart &&
 
6782
           lhs.fUnlocked==rhs.fUnlocked &&
 
6783
           lhs.cnsPgn==rhs.cnsPgn &&
 
6784
           lhs.fPgnRestart==rhs.fPgnRestart &&
 
6785
           lhs.fEndNote==rhs.fEndNote &&
 
6786
           lhs.lnc==rhs.lnc &&
 
6787
           lhs.grpfIhdt==rhs.grpfIhdt &&
 
6788
           lhs.nLnnMod==rhs.nLnnMod &&
 
6789
           lhs.dxaLnn==rhs.dxaLnn &&
 
6790
           lhs.dyaHdrTop==rhs.dyaHdrTop &&
 
6791
           lhs.dyaHdrBottom==rhs.dyaHdrBottom &&
 
6792
           lhs.dxaPgn==rhs.dxaPgn &&
 
6793
           lhs.dyaPgn==rhs.dyaPgn &&
 
6794
           lhs.fLBetween==rhs.fLBetween &&
 
6795
           lhs.vjc==rhs.vjc &&
 
6796
           lhs.lnnMin==rhs.lnnMin &&
 
6797
           lhs.dmOrientPage==rhs.dmOrientPage &&
 
6798
           lhs.iHeadingPgn==rhs.iHeadingPgn &&
 
6799
           lhs.xaPage==rhs.xaPage &&
 
6800
           lhs.yaPage==rhs.yaPage &&
 
6801
           lhs.dxaLeft==rhs.dxaLeft &&
 
6802
           lhs.dxaRight==rhs.dxaRight &&
 
6803
           lhs.dyaTop==rhs.dyaTop &&
 
6804
           lhs.dyaBottom==rhs.dyaBottom &&
 
6805
           lhs.dzaGutter==rhs.dzaGutter &&
 
6806
           lhs.dmBinFirst==rhs.dmBinFirst &&
 
6807
           lhs.dmBinOther==rhs.dmBinOther &&
 
6808
           lhs.dmPaperReq==rhs.dmPaperReq &&
 
6809
           lhs.fEvenlySpaced==rhs.fEvenlySpaced &&
 
6810
           lhs.unused55==rhs.unused55 &&
 
6811
           lhs.dxaColumnWidth==rhs.dxaColumnWidth &&
 
6812
           lhs.olstAnm==rhs.olstAnm;
 
6813
}
 
6814
 
 
6815
bool operator!=(const SEP &lhs, const SEP &rhs) {
 
6816
    return !(lhs==rhs);
 
6817
}
 
6818
 
 
6819
 
 
6820
// SEPX implementation
 
6821
 
 
6822
SEPX::SEPX() {
 
6823
    clearInternal();
 
6824
}
 
6825
 
 
6826
SEPX::SEPX(OLEStreamReader *stream, bool preservePos) {
 
6827
    clearInternal();
 
6828
    read(stream, preservePos);
 
6829
}
 
6830
 
 
6831
SEPX::SEPX(const SEPX &rhs) {
 
6832
    cb=rhs.cb;
 
6833
    grpprl=rhs.grpprl;
 
6834
}
 
6835
 
 
6836
SEPX::~SEPX() {
 
6837
    delete [] grpprl;
 
6838
}
 
6839
 
 
6840
SEPX &SEPX::operator=(const SEPX &rhs) {
 
6841
 
 
6842
    // Check for assignment to self
 
6843
    if(this==&rhs)
 
6844
        return *this;
 
6845
 
 
6846
    cb=rhs.cb;
 
6847
    grpprl=rhs.grpprl;
 
6848
 
 
6849
    return *this;
 
6850
}
 
6851
 
 
6852
bool SEPX::read(OLEStreamReader *stream, bool preservePos) {
 
6853
 
 
6854
    if(preservePos)
 
6855
        stream->push();
 
6856
 
 
6857
    cb=stream->readU8();
 
6858
    // Attention: I don't know how to read grpprl - U8[]
 
6859
#ifdef __GNUC__
 
6860
#warning "Couldn't generate reading code for SEPX::grpprl"
 
6861
#endif
 
6862
 
 
6863
    if(preservePos)
 
6864
        stream->pop();
 
6865
    return true;
 
6866
}
 
6867
 
 
6868
bool SEPX::write(OLEStreamWriter *stream, bool preservePos) const {
 
6869
 
 
6870
    if(preservePos)
 
6871
        stream->push();
 
6872
 
 
6873
    stream->write(cb);
 
6874
    // Attention: I don't know how to write grpprl - U8[]
 
6875
#ifdef __GNUC__
 
6876
#warning "Couldn't generate writing code for SEPX::grpprl"
 
6877
#endif
 
6878
 
 
6879
    if(preservePos)
 
6880
        stream->pop();
 
6881
    return true;
 
6882
}
 
6883
 
 
6884
void SEPX::clear() {
 
6885
    delete [] grpprl;
 
6886
    clearInternal();
 
6887
}
 
6888
 
 
6889
void SEPX::clearInternal() {
 
6890
    cb=0;
 
6891
    grpprl=0;
 
6892
}
 
6893
 
 
6894
bool operator==(const SEPX &lhs, const SEPX &rhs) {
 
6895
    // Attention: I don't know how to compare grpprl - U8[]
 
6896
#ifdef __GNUC__
 
6897
#warning "Can't compare SEPX::grpprl items"
 
6898
#endif
 
6899
 
 
6900
    return lhs.cb==rhs.cb;
 
6901
}
 
6902
 
 
6903
bool operator!=(const SEPX &lhs, const SEPX &rhs) {
 
6904
    return !(lhs==rhs);
 
6905
}
 
6906
 
 
6907
 
 
6908
// STSHI implementation
 
6909
 
 
6910
const unsigned int STSHI::sizeOf = 14;
 
6911
 
 
6912
STSHI::STSHI() {
 
6913
    clear();
 
6914
}
 
6915
 
 
6916
STSHI::STSHI(OLEStreamReader *stream, bool preservePos) {
 
6917
    clear();
 
6918
    read(stream, preservePos);
 
6919
}
 
6920
 
 
6921
bool STSHI::read(OLEStreamReader *stream, bool preservePos) {
 
6922
 
 
6923
    U16 shifterU16;
 
6924
 
 
6925
    if(preservePos)
 
6926
        stream->push();
 
6927
 
 
6928
    cstd=stream->readU16();
 
6929
    cbSTDBaseInFile=stream->readU16();
 
6930
    shifterU16=stream->readU16();
 
6931
    fStdStylenamesWritten=shifterU16;
 
6932
    shifterU16>>=1;
 
6933
    unused4_2=shifterU16;
 
6934
    stiMaxWhenSaved=stream->readU16();
 
6935
    istdMaxFixedWhenSaved=stream->readU16();
 
6936
    nVerBuiltInNamesWhenSaved=stream->readU16();
 
6937
    ftcStandardChpStsh=stream->readU16();
 
6938
 
 
6939
    if(preservePos)
 
6940
        stream->pop();
 
6941
    return true;
 
6942
}
 
6943
 
 
6944
bool STSHI::write(OLEStreamWriter *stream, bool preservePos) const {
 
6945
 
 
6946
    U16 shifterU16;
 
6947
 
 
6948
    if(preservePos)
 
6949
        stream->push();
 
6950
 
 
6951
    stream->write(cstd);
 
6952
    stream->write(cbSTDBaseInFile);
 
6953
    shifterU16=fStdStylenamesWritten;
 
6954
    shifterU16|=unused4_2 << 1;
 
6955
    stream->write(shifterU16);
 
6956
    stream->write(stiMaxWhenSaved);
 
6957
    stream->write(istdMaxFixedWhenSaved);
 
6958
    stream->write(nVerBuiltInNamesWhenSaved);
 
6959
    stream->write(ftcStandardChpStsh);
 
6960
 
 
6961
    if(preservePos)
 
6962
        stream->pop();
 
6963
    return true;
 
6964
}
 
6965
 
 
6966
void STSHI::clear() {
 
6967
    cstd=0;
 
6968
    cbSTDBaseInFile=0;
 
6969
    fStdStylenamesWritten=0;
 
6970
    unused4_2=0;
 
6971
    stiMaxWhenSaved=0;
 
6972
    istdMaxFixedWhenSaved=0;
 
6973
    nVerBuiltInNamesWhenSaved=0;
 
6974
    ftcStandardChpStsh=0;
 
6975
}
 
6976
 
 
6977
bool operator==(const STSHI &lhs, const STSHI &rhs) {
 
6978
 
 
6979
    return lhs.cstd==rhs.cstd &&
 
6980
           lhs.cbSTDBaseInFile==rhs.cbSTDBaseInFile &&
 
6981
           lhs.fStdStylenamesWritten==rhs.fStdStylenamesWritten &&
 
6982
           lhs.unused4_2==rhs.unused4_2 &&
 
6983
           lhs.stiMaxWhenSaved==rhs.stiMaxWhenSaved &&
 
6984
           lhs.istdMaxFixedWhenSaved==rhs.istdMaxFixedWhenSaved &&
 
6985
           lhs.nVerBuiltInNamesWhenSaved==rhs.nVerBuiltInNamesWhenSaved &&
 
6986
           lhs.ftcStandardChpStsh==rhs.ftcStandardChpStsh;
 
6987
}
 
6988
 
 
6989
bool operator!=(const STSHI &lhs, const STSHI &rhs) {
 
6990
    return !(lhs==rhs);
 
6991
}
 
6992
 
 
6993
 
 
6994
 
 
6995
} // namespace Word95
 
6996
 
 
6997
} // namespace wvWare