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

« back to all changes in this revision

Viewing changes to filters/kword/mswrite/structures_generated.h

  • 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:
41
41
 
42
42
namespace MSWrite
43
43
{
44
 
        // 
45
 
        //    This file is part of the LibMSWrite project
46
 
        //    Copyright (c) 2001-2003, 2007 Clarence Dang <clarencedang@users.sf.net>
47
 
        //    All rights reserved.
48
 
        // 
49
 
        //    Redistribution and use in source and binary forms, with or without
50
 
        //    modification, are permitted provided that the following conditions
51
 
        //    are met:
52
 
        // 
53
 
        //    1. Redistributions of source code must retain the above copyright
54
 
        //       notice, this list of conditions and the following disclaimer.
55
 
        //    2. Redistributions in binary form must reproduce the above copyright
56
 
        //       notice, this list of conditions and the following disclaimer in the
57
 
        //       documentation and/or other materials provided with the distribution.
58
 
        // 
59
 
        //    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
60
 
        //    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
61
 
        //    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
62
 
        //    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
63
 
        //    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
64
 
        //    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
65
 
        //    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
66
 
        //    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
67
 
        //    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
68
 
        //    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69
 
        // 
70
 
        //    LibMSWrite Project Website:
71
 
        //    http://sourceforge.net/projects/libmswrite/
72
 
        // 
73
 
        // DESCRIPTION
74
 
        // 
75
 
        // format.xml describes the basic structures that can be found in Microsoft(r)
76
 
        // Windows(r) Write files.  The majority of the information in format.xml
77
 
        // (excluding the Windows(r) BMP and WMF structures) is the result of
78
 
        // investigative file format work but a few portions of format.xml are derived
79
 
        // from a specification freely available from http://www.wotsit.org/.  The BMP
80
 
        // & WMF structures are from somewhere on the Internet (they are freely and
81
 
        // readily available) and can also be found in many programming books.
82
 
        // 
83
 
        // The data types and numbers in this document are intended to be interpreted
84
 
        // in the way they would be in Win3.x (Little Endian, 16-bit).
85
 
        // 
86
 
        // 
87
 
        //      Structure Fields:
88
 
        // 
89
 
        //              name #REQUIRED
90
 
        //              type #IMPLIED "Word"
91
 
        //              default #IMPLIED ""
92
 
        //              description #IMPLIED "" (also valid for Structures)
93
 
        //              verify #IMPLIED ""
94
 
        //              failVerify #IMPLIED "InvalidFormat"
95
 
        //              rep #IMPLIED "1"
96
 
        //              useThisMuch #IMPLIED "0"
97
 
        //              provideMethod #IMPLIED "0"
98
 
        //              protected #IMPLIED "0"  (also valid for Structures)
99
 
        // 
100
 
        //      All structure names will be automatically postfixed with "Generated".
101
 
        //      Derive structures from "Generated" structures (in structures*.cpp) e.g.
102
 
        // 
103
 
        //              class Header : public HeaderGenerated
104
 
        //              {
105
 
        //              }
106
 
        // 
107
 
        //      All fields will be automatically prefixed with "m_" to signify that
108
 
        //      they are member variables.
109
 
        // 
110
 
        //      Note that there are some limitations with make_structures_generated,
111
 
        //      most importantly:
112
 
        // 
113
 
        //              * any field of type Bit, must have
114
 
        //                      - rep <=8
115
 
        //                      - default = 0
116
 
        //                      - may not cross a byte boundary!
117
 
        
118
 
        // Write file header (mostly from wotsit)
119
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
120
 
        class HeaderGenerated : public NeedsDevice
121
 
        {
122
 
        public:
123
 
                static const int s_size = 98;
124
 
        
125
 
        private:
126
 
                HeaderGenerated (const HeaderGenerated &rhs);   //TODO: copy constructor
127
 
        
128
 
        protected:
129
 
                Byte m_data [98];       // raw data from .wri file
130
 
                
131
 
                Word m_magic;                                                   // must be 0xBE31 (v3.0) or 0xBE32 (v3.1 because the file contains OLE)
132
 
                Word m_zero;
133
 
                Word m_magic2;                                                  // Magic number2 (must be 0xAB00)
134
 
                Word m_zero2 [4];
135
 
                DWord m_numCharBytesPlus128;            // #bytes of text,images & OLE (starting from Byte 128/Page 1)
136
 
                Word m_pageParaInfo;
137
 
                Word m_pageFootnoteTable;
138
 
                Word m_pageSectionProperty;             // I call it "Page Layout"
139
 
                Word m_pageSectionTable;
140
 
                Word m_pagePageTable;
141
 
                Word m_pageFontTable;
142
 
                Word m_zero3 [33];
143
 
                Word m_numPages;                                                // (where a page is 128 bytes)
144
 
                
145
 
                HeaderGenerated &operator= (const HeaderGenerated &rhs);
146
 
                
147
 
                virtual bool verifyVariables (void);
148
 
                virtual bool writeToArray (void);
149
 
                
150
 
                static const Word magicDefault = Word (0xBE31/*Write 3.0*/);
151
 
                static const Word zeroDefault = Word (0);
152
 
                static const Word magic2Default = Word (0xAB00);
153
 
                // cannot provide default for zero2 (is an array or of a non-internal type)
154
 
                // no default for numCharBytesPlus128
155
 
                // no default for pageParaInfo
156
 
                // no default for pageFootnoteTable
157
 
                // no default for pageSectionProperty
158
 
                // no default for pageSectionTable
159
 
                // no default for pagePageTable
160
 
                // no default for pageFontTable
161
 
                // cannot provide default for zero3 (is an array or of a non-internal type)
162
 
                // no default for numPages
163
 
        
164
 
        public:
165
 
                // [PRIVATE] do not call!
166
 
                virtual bool readFromDevice (void);
167
 
                virtual bool writeToDevice (void);
168
 
                
169
 
                HeaderGenerated ();
170
 
                virtual ~HeaderGenerated ();
171
 
                
172
 
                
173
 
                //
174
 
                // get and set functions
175
 
                //
176
 
                
177
 
                Word getMagic (void) const      {       return m_magic; }
178
 
                void setMagic (const Word val)  {       m_magic = val;  }
179
 
                
180
 
                Word getPageParaInfo (void) const       {       return m_pageParaInfo;  }
181
 
                void setPageParaInfo (const Word val)   {       m_pageParaInfo = val;   }
182
 
                
183
 
                Word getPageFootnoteTable (void) const  {       return m_pageFootnoteTable;     }
184
 
                void setPageFootnoteTable (const Word val)      {       m_pageFootnoteTable = val;      }
185
 
                
186
 
                Word getPageSectionProperty (void) const        {       return m_pageSectionProperty;   }
187
 
                void setPageSectionProperty (const Word val)    {       m_pageSectionProperty = val;    }
188
 
                
189
 
                Word getPageSectionTable (void) const   {       return m_pageSectionTable;      }
190
 
                void setPageSectionTable (const Word val)       {       m_pageSectionTable = val;       }
191
 
                
192
 
                Word getPagePageTable (void) const      {       return m_pagePageTable; }
193
 
                void setPagePageTable (const Word val)  {       m_pagePageTable = val;  }
194
 
                
195
 
                Word getPageFontTable (void) const      {       return m_pageFontTable; }
196
 
                void setPageFontTable (const Word val)  {       m_pageFontTable = val;  }
197
 
                
198
 
                Word getNumPages (void) const   {       return m_numPages;      }
199
 
                void setNumPages (const Word val)       {       m_numPages = val;       }
200
 
        };
201
 
        
202
 
        // Page layout information (margins, dimensions, ...)
203
 
        class PageLayoutGenerated : public NeedsDevice
204
 
        {
205
 
        public:
206
 
                static const int s_size = 33;
207
 
        
208
 
        private:
209
 
                PageLayoutGenerated (const PageLayoutGenerated &rhs);   //TODO: copy constructor
210
 
        
211
 
        protected:
212
 
                Byte m_data [33];       // raw data from .wri file
213
 
                
214
 
                Byte m_magic102;                                                // =102?
215
 
                Word m_magic512;                                                // =512?
216
 
                Word m_pageHeight;
217
 
                Word m_pageWidth;
218
 
                Word m_pageNumberStart;                         // start counting page numbers from this value (0xFFFF means ignore, set to 1 I guess)
219
 
                Word m_topMargin;
220
 
                Word m_textHeight;
221
 
                Word m_leftMargin;
222
 
                Word m_textWidth;
223
 
                
224
 
                Word m_magic256;                                                // =256?
225
 
                
226
 
                Word m_headerFromTop;                           // distance header is from top of page
227
 
                Word m_footerFromTop;                           // distance footer is from top of page
228
 
                
229
 
                Word m_magic720;                                                // 720
230
 
                Word m_zero;                                                    // 0
231
 
                Word m_magic1080;                                               // 1080
232
 
                Word m_unknown;                                         // ? (let's not be random and default to 0)
233
 
                Word m_zero2;                                                   // 0
234
 
                
235
 
                PageLayoutGenerated &operator= (const PageLayoutGenerated &rhs);
236
 
                
237
 
                virtual bool verifyVariables (void);
238
 
                virtual bool writeToArray (void);
239
 
                
240
 
                static const Byte magic102Default = Byte (102);
241
 
                static const Word magic512Default = Word (512);
242
 
                static const Word pageHeightDefault = Word (Inch2Twip (11));
243
 
                static const Word pageWidthDefault = Word (Inch2Twip (8.5));
244
 
                static const Word pageNumberStartDefault = Word (1);
245
 
                static const Word topMarginDefault = Word (Inch2Twip (1));
246
 
                static const Word textHeightDefault = Word (Inch2Twip (9));
247
 
                static const Word leftMarginDefault = Word (Inch2Twip (1.25));
248
 
                static const Word textWidthDefault = Word (Inch2Twip (6));
249
 
                static const Word magic256Default = Word (256);
250
 
                static const Word headerFromTopDefault = Word (Inch2Twip (0.75));
251
 
                static const Word footerFromTopDefault = Word (Inch2Twip (10.25 /*11.0 (m_pageHeight) - 0.75*/));
252
 
                static const Word magic720Default = Word (720);
253
 
                static const Word zeroDefault = Word (0);
254
 
                static const Word magic1080Default = Word (1080);
255
 
                static const Word unknownDefault = Word (0);
256
 
                static const Word zero2Default = Word (0);
257
 
        
258
 
        public:
259
 
                // [PRIVATE] do not call!
260
 
                virtual bool readFromDevice (void);
261
 
                virtual bool writeToDevice (void);
262
 
                
263
 
                PageLayoutGenerated ();
264
 
                virtual ~PageLayoutGenerated ();
265
 
                
266
 
        };
267
 
        
268
 
        // No idea what this is supposed to do (from wotsit)
269
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
270
 
        class SectionDescriptorGenerated : public NeedsDevice
271
 
        {
272
 
        public:
273
 
                static const int s_size = 10;
274
 
        
275
 
        private:
276
 
                SectionDescriptorGenerated (const SectionDescriptorGenerated &rhs);     //TODO: copy constructor
277
 
        
278
 
        protected:
279
 
                Byte m_data [10];       // raw data from .wri file
280
 
                
281
 
                DWord m_afterEndCharByte;                       // byte of character just after end of section
282
 
                Word m_undefined;
283
 
                DWord m_sectionPropertyLocation;        // byte address of corresponding sectionProperty (I call it a "Page Layout" which is more obvious IMHO)
284
 
                
285
 
                SectionDescriptorGenerated &operator= (const SectionDescriptorGenerated &rhs);
286
 
                
287
 
                virtual bool verifyVariables (void);
288
 
                virtual bool writeToArray (void);
289
 
                
290
 
                // no default for afterEndCharByte
291
 
                static const Word undefinedDefault = Word (0);
292
 
                // no default for sectionPropertyLocation
293
 
        
294
 
        public:
295
 
                // [PRIVATE] do not call!
296
 
                virtual bool readFromDevice (void);
297
 
                virtual bool writeToDevice (void);
298
 
                
299
 
                SectionDescriptorGenerated ();
300
 
                virtual ~SectionDescriptorGenerated ();
301
 
                
302
 
                
303
 
                //
304
 
                // get and set functions
305
 
                //
306
 
                
307
 
                DWord getAfterEndCharByte (void) const  {       return m_afterEndCharByte;      }
308
 
                void setAfterEndCharByte (const DWord val)      {       m_afterEndCharByte = val;       }
309
 
                
310
 
                DWord getSectionPropertyLocation (void) const   {       return m_sectionPropertyLocation;       }
311
 
                void setSectionPropertyLocation (const DWord val)       {       m_sectionPropertyLocation = val;        }
312
 
        };
313
 
        
314
 
        // (from wotsit)
315
 
        class SectionDescriptor;
316
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
317
 
        class SectionTableGenerated : public NeedsDevice
318
 
        {
319
 
        public:
320
 
                static const int s_size = 24;
321
 
        
322
 
        private:
323
 
                SectionTableGenerated (const SectionTableGenerated &rhs);       //TODO: copy constructor
324
 
        
325
 
        protected:
326
 
                Byte m_data [24];       // raw data from .wri file
327
 
                
328
 
                Word m_numSectionDescriptors;
329
 
                Word m_undefined;
330
 
                SectionDescriptor *m_sed [2];
331
 
                
332
 
                SectionTableGenerated &operator= (const SectionTableGenerated &rhs);
333
 
                
334
 
                virtual bool verifyVariables (void);
335
 
                virtual bool writeToArray (void);
336
 
                
337
 
                static const Word numSectionDescriptorsDefault = Word (2);
338
 
                static const Word undefinedDefault = Word (0);
339
 
                // no default for sed
340
 
        
341
 
        public:
342
 
                // [PRIVATE] do not call!
343
 
                virtual bool readFromDevice (void);
344
 
                virtual bool writeToDevice (void);
345
 
                
346
 
                SectionTableGenerated ();
347
 
                virtual ~SectionTableGenerated ();
348
 
                
349
 
        };
350
 
        
351
 
        class FontGenerated : public NeedsDevice
352
 
        {
353
 
        public:
354
 
                static const int s_size = 3;
355
 
        
356
 
        private:
357
 
                FontGenerated (const FontGenerated &rhs);       //TODO: copy constructor
358
 
        
359
 
        protected:
360
 
                Byte m_data [3];        // raw data from .wri file
361
 
                
362
 
                Word m_numDataBytes;                                    // number of bytes that follow
363
 
                Byte m_family;
364
 
                
365
 
                // - - - followed by Byte *fontName - - - 
366
 
                
367
 
                FontGenerated &operator= (const FontGenerated &rhs);
368
 
                
369
 
                virtual bool verifyVariables (void);
370
 
                virtual bool writeToArray (void);
371
 
                
372
 
                static const Word numDataBytesDefault = Word (0);
373
 
                static const Byte familyDefault = Byte (0);
374
 
        
375
 
        public:
376
 
                // [PRIVATE] do not call!
377
 
                virtual bool readFromDevice (void);
378
 
                virtual bool writeToDevice (void);
379
 
                
380
 
                FontGenerated ();
381
 
                virtual ~FontGenerated ();
382
 
                
383
 
                
384
 
                //
385
 
                // get and set functions
386
 
                //
387
 
                
388
 
                // [PRIVATE] these are private libmswrite methods, do not call them!
389
 
                Word getNumDataBytes (void) const       {       return m_numDataBytes;  }
390
 
                void setNumDataBytes (const Word val)   {       m_numDataBytes = val;   }
391
 
                
392
 
                Byte getFamily (void) const     {       return m_family;        }
393
 
                void setFamily (const Byte val) {       m_family = val; }
394
 
        };
395
 
        
396
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
397
 
        class FontTableGenerated : public NeedsDevice
398
 
        {
399
 
        public:
400
 
                static const int s_size = 2;
401
 
        
402
 
        private:
403
 
                FontTableGenerated (const FontTableGenerated &rhs);     //TODO: copy constructor
404
 
        
405
 
        protected:
406
 
                Byte m_data [2];        // raw data from .wri file
407
 
                
408
 
                Word m_numFonts;
409
 
                
410
 
                // - - - followed by a list of Font(s) - - - 
411
 
                
412
 
                FontTableGenerated &operator= (const FontTableGenerated &rhs);
413
 
                
414
 
                virtual bool verifyVariables (void);
415
 
                virtual bool writeToArray (void);
416
 
                
417
 
                static const Word numFontsDefault = Word (0);
418
 
        
419
 
        public:
420
 
                // [PRIVATE] do not call!
421
 
                virtual bool readFromDevice (void);
422
 
                virtual bool writeToDevice (void);
423
 
                
424
 
                FontTableGenerated ();
425
 
                virtual ~FontTableGenerated ();
426
 
                
427
 
                
428
 
                //
429
 
                // get and set functions
430
 
                //
431
 
                
432
 
                Word getNumFonts (void) const   {       return m_numFonts;      }
433
 
                void setNumFonts (const Word val)       {       m_numFonts = val;       }
434
 
        };
435
 
        
436
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
437
 
        class PagePointerGenerated : public NeedsDevice
438
 
        {
439
 
        public:
440
 
                static const int s_size = 6;
441
 
        
442
 
        private:
443
 
                PagePointerGenerated (const PagePointerGenerated &rhs); //TODO: copy constructor
444
 
        
445
 
        protected:
446
 
                Byte m_data [6];        // raw data from .wri file
447
 
                
448
 
                Word m_pageNumber;
449
 
                DWord m_firstCharByte;                          // first character on page
450
 
                
451
 
                PagePointerGenerated &operator= (const PagePointerGenerated &rhs);
452
 
                
453
 
                virtual bool verifyVariables (void);
454
 
                virtual bool writeToArray (void);
455
 
                
456
 
                // no default for pageNumber
457
 
                // no default for firstCharByte
458
 
        
459
 
        public:
460
 
                // [PRIVATE] do not call!
461
 
                virtual bool readFromDevice (void);
462
 
                virtual bool writeToDevice (void);
463
 
                
464
 
                PagePointerGenerated ();
465
 
                virtual ~PagePointerGenerated ();
466
 
                
467
 
                
468
 
                //
469
 
                // get and set functions
470
 
                //
471
 
                
472
 
                Word getPageNumber (void) const {       return m_pageNumber;    }
473
 
                void setPageNumber (const Word val)     {       m_pageNumber = val;     }
474
 
                
475
 
                DWord getFirstCharByte (void) const     {       return m_firstCharByte; }
476
 
                void setFirstCharByte (const DWord val) {       m_firstCharByte = val;  }
477
 
        };
478
 
        
479
 
        // File/Repaginate function
480
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
481
 
        class PageTableGenerated : public NeedsDevice
482
 
        {
483
 
        public:
484
 
                static const int s_size = 4;
485
 
        
486
 
        private:
487
 
                PageTableGenerated (const PageTableGenerated &rhs);     //TODO: copy constructor
488
 
        
489
 
        protected:
490
 
                Byte m_data [4];        // raw data from .wri file
491
 
                
492
 
                Word m_numPagePointers;
493
 
                Word m_zero;
494
 
                
495
 
                // - - - followed by a list of PagePointer(s) - - - 
496
 
                
497
 
                PageTableGenerated &operator= (const PageTableGenerated &rhs);
498
 
                
499
 
                virtual bool verifyVariables (void);
500
 
                virtual bool writeToArray (void);
501
 
                
502
 
                static const Word numPagePointersDefault = Word (0);
503
 
                static const Word zeroDefault = Word (0);
504
 
        
505
 
        public:
506
 
                // [PRIVATE] do not call!
507
 
                virtual bool readFromDevice (void);
508
 
                virtual bool writeToDevice (void);
509
 
                
510
 
                PageTableGenerated ();
511
 
                virtual ~PageTableGenerated ();
512
 
                
513
 
        };
514
 
        
515
 
        // A pointer to the actual formatting properties (formatting properties are shared to save space)
516
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
517
 
        class FormatPointerGenerated : public NeedsDevice
518
 
        {
519
 
        public:
520
 
                static const int s_size = 6;
521
 
        
522
 
        private:
523
 
                FormatPointerGenerated (const FormatPointerGenerated &rhs);     //TODO: copy constructor
524
 
        
525
 
        protected:
526
 
                Byte m_data [6];        // raw data from .wri file
527
 
                
528
 
                DWord m_afterEndCharBytePlus128;        // last character it points to + 1
529
 
                Word m_formatPropertyOffset;            // location of relevant FormatProperty (or 0xFFFF for defaults)
530
 
                
531
 
                FormatPointerGenerated &operator= (const FormatPointerGenerated &rhs);
532
 
                
533
 
                virtual bool verifyVariables (void);
534
 
                virtual bool writeToArray (void);
535
 
                
536
 
                // no default for afterEndCharBytePlus128
537
 
                // no default for formatPropertyOffset
538
 
        
539
 
        public:
540
 
                // [PRIVATE] do not call!
541
 
                virtual bool readFromDevice (void);
542
 
                virtual bool writeToDevice (void);
543
 
                
544
 
                FormatPointerGenerated ();
545
 
                virtual ~FormatPointerGenerated ();
546
 
                
547
 
                
548
 
                //
549
 
                // get and set functions
550
 
                //
551
 
                
552
 
                DWord getAfterEndCharBytePlus128 (void) const   {       return m_afterEndCharBytePlus128;       }
553
 
                void setAfterEndCharBytePlus128 (const DWord val)       {       m_afterEndCharBytePlus128 = val;        }
554
 
                
555
 
                Word getFormatPropertyOffset (void) const       {       return m_formatPropertyOffset;  }
556
 
                void setFormatPropertyOffset (const Word val)   {       m_formatPropertyOffset = val;   }
557
 
        };
558
 
        
559
 
        // Character Properties
560
 
        class FormatCharPropertyGenerated : public NeedsDevice, public UseThisMuch
561
 
        {
562
 
        public:
563
 
                static const int s_size = 7;
564
 
        
565
 
        private:
566
 
                FormatCharPropertyGenerated (const FormatCharPropertyGenerated &rhs);   //TODO: copy constructor
567
 
        
568
 
        protected:
569
 
                Byte m_data [7];        // raw data from .wri file
570
 
                
571
 
                // Byte 0 
572
 
                Byte m_numDataBytes;                                    // number of bytes that follow
573
 
                
574
 
                // Byte 1 
575
 
                Byte m_unknown;                                         // =0? or =1?
576
 
                
577
 
                // Byte 2 
578
 
                unsigned m_isBold       :       1;
579
 
                unsigned m_isItalic     :       1;
580
 
                unsigned m_fontCodeLow  :       6;
581
 
                
582
 
                // Byte 3 
583
 
                Byte m_fontSize;                                                // half the fontSize?
584
 
                
585
 
                // Byte 4 
586
 
                unsigned m_isUnderlined :       1;
587
 
                unsigned m_zero :       5;
588
 
                unsigned m_isPageNumber :       1;              // seems to be set for '(page)' number variables - only in headers/footers?
589
 
                unsigned m_zero2        :       1;
590
 
                
591
 
                // Byte 5 
592
 
                unsigned m_fontCodeHigh :       3;              // not sure if this is true
593
 
                unsigned m_zero3        :       5;
594
 
                
595
 
                // Byte 6 
596
 
                Byte m_position;                                                // 0=normal, 1-127=superscript, 128-255=subscript (I tested mainly boundary values so I don't know if it's this is totally true)
597
 
                
598
 
                FormatCharPropertyGenerated &operator= (const FormatCharPropertyGenerated &rhs);
599
 
                
600
 
                Word getNumDataBytes (void) const       {       return UseThisMuch::getNeedNumDataBytes ();     }
601
 
                // note: you cannot set numDataBytes
602
 
                void updateNumDataBytes (void)  {       m_numDataBytes = UseThisMuch::getNeedNumDataBytes ();   }
603
 
                
604
 
                virtual bool verifyVariables (void);
605
 
                virtual bool writeToArray (void);
606
 
                
607
 
                static const Byte numDataBytesDefault = Byte (0);
608
 
                static const Byte unknownDefault = Byte (1);
609
 
                static const unsigned isBoldDefault = unsigned (0);
610
 
                static const unsigned isItalicDefault = unsigned (0);
611
 
                // cannot provide default for fontCodeLow (is an array or of a non-internal type)
612
 
                static const Byte fontSizeDefault = Byte (24);
613
 
                static const unsigned isUnderlinedDefault = unsigned (0);
614
 
                // cannot provide default for zero (is an array or of a non-internal type)
615
 
                static const unsigned isPageNumberDefault = unsigned (0);
616
 
                static const unsigned zero2Default = unsigned (0);
617
 
                // cannot provide default for fontCodeHigh (is an array or of a non-internal type)
618
 
                // cannot provide default for zero3 (is an array or of a non-internal type)
619
 
                static const Byte positionDefault = Byte (0);
620
 
        
621
 
        public:
622
 
                // [PRIVATE] do not call!
623
 
                virtual bool readFromDevice (void);
624
 
                virtual bool writeToDevice (void);
625
 
                
626
 
                FormatCharPropertyGenerated ();
627
 
                virtual ~FormatCharPropertyGenerated ();
628
 
                
629
 
                
630
 
                //
631
 
                // get and set functions
632
 
                //
633
 
                
634
 
                bool getIsBold (void) const     {       return m_isBold;        }
635
 
                void setIsBold (const bool val) {       m_isBold = val; signalHaveSetData (m_isBold == bool (0), 8/*offset*/ + 1/*size*/);      }
636
 
                
637
 
                bool getIsItalic (void) const   {       return m_isItalic;      }
638
 
                void setIsItalic (const bool val)       {       m_isItalic = val;       signalHaveSetData (m_isItalic == bool (0), 9/*offset*/ + 1/*size*/);    }
639
 
                
640
 
                // [PRIVATE] these are private libmswrite methods, do not call them!
641
 
                unsigned getFontCodeLow (void) const    {       return m_fontCodeLow;   }
642
 
                void setFontCodeLow (const unsigned val)        {       m_fontCodeLow = val;    signalHaveSetData (m_fontCodeLow == unsigned (0), 10/*offset*/ + 6/*size*/);    }
643
 
                
644
 
                bool getIsUnderlined (void) const       {       return m_isUnderlined;  }
645
 
                void setIsUnderlined (const bool val)   {       m_isUnderlined = val;   signalHaveSetData (m_isUnderlined == bool (0), 24/*offset*/ + 1/*size*/);       }
646
 
                
647
 
                bool getIsPageNumber (void) const       {       return m_isPageNumber;  }
648
 
                void setIsPageNumber (const bool val)   {       m_isPageNumber = val;   signalHaveSetData (m_isPageNumber == bool (0), 30/*offset*/ + 1/*size*/);       }
649
 
                
650
 
                // [PRIVATE] these are private libmswrite methods, do not call them!
651
 
                unsigned getFontCodeHigh (void) const   {       return m_fontCodeHigh;  }
652
 
                void setFontCodeHigh (const unsigned val)       {       m_fontCodeHigh = val;   signalHaveSetData (m_fontCodeHigh == unsigned (0), 32/*offset*/ + 3/*size*/);   }
653
 
                
654
 
                // [PRIVATE] these are private libmswrite methods, do not call them!
655
 
                Byte getPosition (void) const   {       return m_position;      }
656
 
                void setPosition (const Byte val)       {       m_position = val;       signalHaveSetData (m_position == Byte (0), 40/*offset*/ + 8/*size*/);   }
657
 
        };
658
 
        
659
 
        // Paragraph Tabulator(s) Properties
660
 
        class FormatParaPropertyTabulatorGenerated : public NeedsDevice
661
 
        {
662
 
        public:
663
 
                static const int s_size = 4;
664
 
        
665
 
        private:
666
 
                FormatParaPropertyTabulatorGenerated (const FormatParaPropertyTabulatorGenerated &rhs); //TODO: copy constructor
667
 
        
668
 
        protected:
669
 
                Byte m_data [4];        // raw data from .wri file
670
 
                
671
 
                Word m_indent;
672
 
                Byte m_type;                                                    // 0=normal,3=decimal...all that the GUI allows
673
 
                Byte m_zero;
674
 
                
675
 
                FormatParaPropertyTabulatorGenerated &operator= (const FormatParaPropertyTabulatorGenerated &rhs);
676
 
                
677
 
                virtual bool verifyVariables (void);
678
 
                virtual bool writeToArray (void);
679
 
                
680
 
                static const Word indentDefault = Word (0);
681
 
                static const Byte typeDefault = Byte (0);
682
 
                static const Byte zeroDefault = Byte (0);
683
 
        
684
 
        public:
685
 
                // [PRIVATE] do not call!
686
 
                virtual bool readFromDevice (void);
687
 
                virtual bool writeToDevice (void);
688
 
                
689
 
                FormatParaPropertyTabulatorGenerated ();
690
 
                virtual ~FormatParaPropertyTabulatorGenerated ();
691
 
                
692
 
                
693
 
                //
694
 
                // get and set functions
695
 
                //
696
 
                
697
 
                Word getIndent (void) const     {       return m_indent;        }
698
 
                void setIndent (const Word val) {       m_indent = val; }
699
 
                
700
 
                // [PRIVATE] these are private libmswrite methods, do not call them!
701
 
                Byte getType (void) const       {       return m_type;  }
702
 
                void setType (const Byte val)   {       m_type = val;   }
703
 
        };
704
 
        
705
 
        // Paragraph Properties
706
 
        class FormatParaPropertyTabulator;
707
 
        class FormatParaPropertyGenerated : public NeedsDevice, public UseThisMuch
708
 
        {
709
 
        public:
710
 
                static const int s_size = 79;
711
 
        
712
 
        private:
713
 
                FormatParaPropertyGenerated (const FormatParaPropertyGenerated &rhs);   //TODO: copy constructor
714
 
        
715
 
        protected:
716
 
                Byte m_data [79];       // raw data from .wri file
717
 
                
718
 
                Byte m_numDataBytes;                                    // number of bytes that follow
719
 
                Byte m_magic0_60_or_61;                         // =0? =60? =61? 60 is the most common
720
 
                Byte m_alignment;
721
 
                Word m_magic30;                                         // =30?
722
 
                Word m_rightIndent;                                     // indent from right margin + right margin (if in header/footer)
723
 
                Word m_leftIndent;                                      // indent from left margin + left margin (if in header/footer)
724
 
                Short m_leftIndentFirstLine;            // indent of first line relative to leftIndent (may be negative for a "hanging indent")
725
 
                Word m_lineSpacing;                                     // measurement in twips?
726
 
                Word m_zero [2];
727
 
                
728
 
                // Type Byte 
729
 
                unsigned m_headerOrFooter       :       1;      // 0=header,1=footer (if not normal paragraph)
730
 
                unsigned m_isNotNormalParagraph :       2;// 0=normal paragraph;1,2?,3?=header/footer
731
 
                unsigned m_isOnFirstPage        :       1;      // again, valid only if not normal paragraph
732
 
                unsigned m_isObject     :       1;                      // 0=image/OLE,1=text
733
 
                unsigned m_zero2        :       3;
734
 
                
735
 
                Byte m_zero3 [5];
736
 
                FormatParaPropertyTabulator *m_tab [14];
737
 
                
738
 
                FormatParaPropertyGenerated &operator= (const FormatParaPropertyGenerated &rhs);
739
 
                
740
 
                Word getNumDataBytes (void) const       {       return UseThisMuch::getNeedNumDataBytes ();     }
741
 
                // note: you cannot set numDataBytes
742
 
                void updateNumDataBytes (void)  {       m_numDataBytes = UseThisMuch::getNeedNumDataBytes ();   }
743
 
                
744
 
                virtual bool verifyVariables (void);
745
 
                virtual bool writeToArray (void);
746
 
                
747
 
                static const Byte numDataBytesDefault = Byte (0);
748
 
                static const Byte magic0_60_or_61Default = Byte (60);
749
 
                static const Byte alignmentDefault = Byte (0);
750
 
                static const Word magic30Default = Word (30);
751
 
                static const Word rightIndentDefault = Word (0);
752
 
                static const Word leftIndentDefault = Word (0);
753
 
                static const Short leftIndentFirstLineDefault = Short (0);
754
 
                static const Word lineSpacingDefault = Word (240);
755
 
                // cannot provide default for zero (is an array or of a non-internal type)
756
 
                static const unsigned headerOrFooterDefault = unsigned (0);
757
 
                // cannot provide default for isNotNormalParagraph (is an array or of a non-internal type)
758
 
                static const unsigned isOnFirstPageDefault = unsigned (0);
759
 
                static const unsigned isObjectDefault = unsigned (0);
760
 
                // cannot provide default for zero2 (is an array or of a non-internal type)
761
 
                // cannot provide default for zero3 (is an array or of a non-internal type)
762
 
                // no default for tab
763
 
        
764
 
        public:
765
 
                // [PRIVATE] do not call!
766
 
                virtual bool readFromDevice (void);
767
 
                virtual bool writeToDevice (void);
768
 
                
769
 
                FormatParaPropertyGenerated ();
770
 
                virtual ~FormatParaPropertyGenerated ();
771
 
                
772
 
                
773
 
                //
774
 
                // get and set functions
775
 
                //
776
 
                
777
 
                Byte getAlignment (void) const  {       return m_alignment;     }
778
 
                void setAlignment (const Byte val)      {       m_alignment = val;      signalHaveSetData (m_alignment == Byte (0), 8/*offset*/ + 8/*size*/);   }
779
 
                
780
 
                Word getRightIndent (void) const        {       return m_rightIndent;   }
781
 
                void setRightIndent (const Word val)    {       m_rightIndent = val;    signalHaveSetData (m_rightIndent == Word (0), 32/*offset*/ + 16/*size*/);       }
782
 
                
783
 
                Word getLeftIndent (void) const {       return m_leftIndent;    }
784
 
                void setLeftIndent (const Word val)     {       m_leftIndent = val;     signalHaveSetData (m_leftIndent == Word (0), 48/*offset*/ + 16/*size*/);        }
785
 
                
786
 
                Word getLineSpacing (void) const        {       return m_lineSpacing;   }
787
 
                void setLineSpacing (const Word val)    {       m_lineSpacing = val;    signalHaveSetData (m_lineSpacing == Word (240), 80/*offset*/ + 16/*size*/);     }
788
 
                
789
 
                bool getHeaderOrFooter (void) const     {       return m_headerOrFooter;        }
790
 
                void setHeaderOrFooter (const bool val) {       m_headerOrFooter = val; signalHaveSetData (m_headerOrFooter == bool (0), 128/*offset*/ + 1/*size*/);    }
791
 
                
792
 
                unsigned getIsNotNormalParagraph (void) const   {       return m_isNotNormalParagraph;  }
793
 
                void setIsNotNormalParagraph (const unsigned val)       {       m_isNotNormalParagraph = val;   signalHaveSetData (m_isNotNormalParagraph == unsigned (0), 129/*offset*/ + 2/*size*/);  }
794
 
                
795
 
                bool getIsOnFirstPage (void) const      {       return m_isOnFirstPage; }
796
 
                void setIsOnFirstPage (const bool val)  {       m_isOnFirstPage = val;  signalHaveSetData (m_isOnFirstPage == bool (0), 131/*offset*/ + 1/*size*/);     }
797
 
                
798
 
                bool getIsObject (void) const   {       return m_isObject;      }
799
 
                void setIsObject (const bool val)       {       m_isObject = val;       signalHaveSetData (m_isObject == bool (0), 132/*offset*/ + 1/*size*/);  }
800
 
        };
801
 
        
802
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
803
 
        class FormatInfoPageGenerated : public NeedsDevice
804
 
        {
805
 
        public:
806
 
                static const int s_size = 128;
807
 
        
808
 
        private:
809
 
                FormatInfoPageGenerated (const FormatInfoPageGenerated &rhs);   //TODO: copy constructor
810
 
        
811
 
        protected:
812
 
                Byte m_data [128];      // raw data from .wri file
813
 
                
814
 
                DWord m_firstCharBytePlus128;
815
 
                Byte m_packedStructs [123];             // array of FormatPointers and FormatCharProperties/FormatParaProperties
816
 
                Byte m_numFormatPointers;
817
 
                
818
 
                FormatInfoPageGenerated &operator= (const FormatInfoPageGenerated &rhs);
819
 
                
820
 
                virtual bool verifyVariables (void);
821
 
                virtual bool writeToArray (void);
822
 
                
823
 
                // no default for firstCharBytePlus128
824
 
                // cannot provide default for packedStructs (is an array or of a non-internal type)
825
 
                static const Byte numFormatPointersDefault = Byte (0);
826
 
        
827
 
        public:
828
 
                // [PRIVATE] do not call!
829
 
                virtual bool readFromDevice (void);
830
 
                virtual bool writeToDevice (void);
831
 
                
832
 
                FormatInfoPageGenerated ();
833
 
                virtual ~FormatInfoPageGenerated ();
834
 
                
835
 
        };
836
 
        
837
 
        // first header of a .BMP file (_not_ stored in .WRI)
838
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
839
 
        class BMP_BitmapFileHeaderGenerated : public NeedsDevice
840
 
        {
841
 
        public:
842
 
                static const int s_size = 14;
843
 
        
844
 
        private:
845
 
                BMP_BitmapFileHeaderGenerated (const BMP_BitmapFileHeaderGenerated &rhs);       //TODO: copy constructor
846
 
        
847
 
        protected:
848
 
                Byte m_data [14];       // raw data from .wri file
849
 
                
850
 
                Word m_magic;
851
 
                DWord m_totalBytes;
852
 
                Word m_zero [2];
853
 
                DWord m_actualImageOffset;
854
 
                
855
 
                BMP_BitmapFileHeaderGenerated &operator= (const BMP_BitmapFileHeaderGenerated &rhs);
856
 
                
857
 
                virtual bool verifyVariables (void);
858
 
                virtual bool writeToArray (void);
859
 
                
860
 
                static const Word magicDefault = Word (Word ('B') + (Word ('M') << 8));
861
 
                // no default for totalBytes
862
 
                // cannot provide default for zero (is an array or of a non-internal type)
863
 
                // no default for actualImageOffset
864
 
        
865
 
        public:
866
 
                // [PRIVATE] do not call!
867
 
                virtual bool readFromDevice (void);
868
 
                virtual bool writeToDevice (void);
869
 
                
870
 
                BMP_BitmapFileHeaderGenerated ();
871
 
                virtual ~BMP_BitmapFileHeaderGenerated ();
872
 
                
873
 
                
874
 
                //
875
 
                // get and set functions
876
 
                //
877
 
                
878
 
                DWord getTotalBytes (void) const        {       return m_totalBytes;    }
879
 
                void setTotalBytes (const DWord val)    {       m_totalBytes = val;     }
880
 
                
881
 
                DWord getActualImageOffset (void) const {       return m_actualImageOffset;     }
882
 
                void setActualImageOffset (const DWord val)     {       m_actualImageOffset = val;      }
883
 
        };
884
 
        
885
 
        // second header of a .BMP file (_not_ stored in .WRI)
886
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
887
 
        class BMP_BitmapInfoHeaderGenerated : public NeedsDevice
888
 
        {
889
 
        public:
890
 
                static const int s_size = 40;
891
 
        
892
 
        private:
893
 
                BMP_BitmapInfoHeaderGenerated (const BMP_BitmapInfoHeaderGenerated &rhs);       //TODO: copy constructor
894
 
        
895
 
        protected:
896
 
                Byte m_data [40];       // raw data from .wri file
897
 
                
898
 
                DWord m_numHeaderBytes;
899
 
                Long m_width;
900
 
                Long m_height;
901
 
                Word m_numPlanes;                                               // always==1
902
 
                Word m_bitsPerPixel;
903
 
                DWord m_compression;
904
 
                DWord m_sizeImage;
905
 
                Long m_xPixelsPerMeter;
906
 
                Long m_yPixelsPerMeter;
907
 
                DWord m_colorsUsed;
908
 
                DWord m_colorsImportant;
909
 
                
910
 
                BMP_BitmapInfoHeaderGenerated &operator= (const BMP_BitmapInfoHeaderGenerated &rhs);
911
 
                
912
 
                virtual bool verifyVariables (void);
913
 
                virtual bool writeToArray (void);
914
 
                
915
 
                static const DWord numHeaderBytesDefault = DWord (s_size);
916
 
                // no default for width
917
 
                // no default for height
918
 
                static const Word numPlanesDefault = Word (1);
919
 
                // no default for bitsPerPixel
920
 
                static const DWord compressionDefault = DWord (0);
921
 
                static const DWord sizeImageDefault = DWord (0);
922
 
                static const Long xPixelsPerMeterDefault = Long (0);
923
 
                static const Long yPixelsPerMeterDefault = Long (0);
924
 
                static const DWord colorsUsedDefault = DWord (0);
925
 
                // no default for colorsImportant
926
 
        
927
 
        public:
928
 
                // [PRIVATE] do not call!
929
 
                virtual bool readFromDevice (void);
930
 
                virtual bool writeToDevice (void);
931
 
                
932
 
                BMP_BitmapInfoHeaderGenerated ();
933
 
                virtual ~BMP_BitmapInfoHeaderGenerated ();
934
 
                
935
 
                
936
 
                //
937
 
                // get and set functions
938
 
                //
939
 
                
940
 
                Long getWidth (void) const      {       return m_width; }
941
 
                void setWidth (const Long val)  {       m_width = val;  }
942
 
                
943
 
                Long getHeight (void) const     {       return m_height;        }
944
 
                void setHeight (const Long val) {       m_height = val; }
945
 
                
946
 
                Word getNumPlanes (void) const  {       return m_numPlanes;     }
947
 
                void setNumPlanes (const Word val)      {       m_numPlanes = val;      }
948
 
                
949
 
                Word getBitsPerPixel (void) const       {       return m_bitsPerPixel;  }
950
 
                void setBitsPerPixel (const Word val)   {       m_bitsPerPixel = val;   }
951
 
                
952
 
                DWord getCompression (void) const       {       return m_compression;   }
953
 
                void setCompression (const DWord val)   {       m_compression = val;    }
954
 
                
955
 
                DWord getSizeImage (void) const {       return m_sizeImage;     }
956
 
                void setSizeImage (const DWord val)     {       m_sizeImage = val;      }
957
 
                
958
 
                Long getXPixelsPerMeter (void) const    {       return m_xPixelsPerMeter;       }
959
 
                void setXPixelsPerMeter (const Long val)        {       m_xPixelsPerMeter = val;        }
960
 
                
961
 
                Long getYPixelsPerMeter (void) const    {       return m_yPixelsPerMeter;       }
962
 
                void setYPixelsPerMeter (const Long val)        {       m_yPixelsPerMeter = val;        }
963
 
                
964
 
                DWord getColorsUsed (void) const        {       return m_colorsUsed;    }
965
 
                void setColorsUsed (const DWord val)    {       m_colorsUsed = val;     }
966
 
                
967
 
                DWord getColorsImportant (void) const   {       return m_colorsImportant;       }
968
 
                void setColorsImportant (const DWord val)       {       m_colorsImportant = val;        }
969
 
        };
970
 
        
971
 
        // element of colorTable, triad of RGB
972
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
973
 
        class BMP_BitmapColorIndexGenerated : public NeedsDevice
974
 
        {
975
 
        public:
976
 
                static const int s_size = 4;
977
 
        
978
 
        private:
979
 
                BMP_BitmapColorIndexGenerated (const BMP_BitmapColorIndexGenerated &rhs);       //TODO: copy constructor
980
 
        
981
 
        protected:
982
 
                Byte m_data [4];        // raw data from .wri file
983
 
                
984
 
                Byte m_blue;
985
 
                Byte m_green;
986
 
                Byte m_red;
987
 
                Byte m_reserved;
988
 
                
989
 
                BMP_BitmapColorIndexGenerated &operator= (const BMP_BitmapColorIndexGenerated &rhs);
990
 
                
991
 
                virtual bool verifyVariables (void);
992
 
                virtual bool writeToArray (void);
993
 
                
994
 
                // no default for blue
995
 
                // no default for green
996
 
                // no default for red
997
 
                static const Byte reservedDefault = Byte (0);
998
 
        
999
 
        public:
1000
 
                // [PRIVATE] do not call!
1001
 
                virtual bool readFromDevice (void);
1002
 
                virtual bool writeToDevice (void);
1003
 
                
1004
 
                BMP_BitmapColorIndexGenerated ();
1005
 
                virtual ~BMP_BitmapColorIndexGenerated ();
1006
 
                
1007
 
                
1008
 
                //
1009
 
                // get and set functions
1010
 
                //
1011
 
                
1012
 
                Byte getBlue (void) const       {       return m_blue;  }
1013
 
                void setBlue (const Byte val)   {       m_blue = val;   }
1014
 
                
1015
 
                Byte getGreen (void) const      {       return m_green; }
1016
 
                void setGreen (const Byte val)  {       m_green = val;  }
1017
 
                
1018
 
                Byte getRed (void) const        {       return m_red;   }
1019
 
                void setRed (const Byte val)    {       m_red = val;    }
1020
 
        };
1021
 
        
1022
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
1023
 
        class BitmapHeaderGenerated : public NeedsDevice
1024
 
        {
1025
 
        public:
1026
 
                static const int s_size = 14;
1027
 
        
1028
 
        private:
1029
 
                BitmapHeaderGenerated (const BitmapHeaderGenerated &rhs);       //TODO: copy constructor
1030
 
        
1031
 
        protected:
1032
 
                Byte m_data [14];       // raw data from .wri file
1033
 
                
1034
 
                Word m_zero;
1035
 
                Word m_width;
1036
 
                Word m_height;
1037
 
                Word m_widthBytes;
1038
 
                Byte m_numPlanes;                                               // always 1 for mono BMP or the entire struct is 0 for WMF
1039
 
                Byte m_bitsPerPixel;
1040
 
                DWord m_zero2;
1041
 
                
1042
 
                BitmapHeaderGenerated &operator= (const BitmapHeaderGenerated &rhs);
1043
 
                
1044
 
                virtual bool verifyVariables (void);
1045
 
                virtual bool writeToArray (void);
1046
 
                
1047
 
                static const Word zeroDefault = Word (0);
1048
 
                static const Word widthDefault = Word (0);
1049
 
                static const Word heightDefault = Word (0);
1050
 
                static const Word widthBytesDefault = Word (0);
1051
 
                static const Byte numPlanesDefault = Byte (0);
1052
 
                static const Byte bitsPerPixelDefault = Byte (0);
1053
 
                static const DWord zero2Default = DWord (0);
1054
 
        
1055
 
        public:
1056
 
                // [PRIVATE] do not call!
1057
 
                virtual bool readFromDevice (void);
1058
 
                virtual bool writeToDevice (void);
1059
 
                
1060
 
                BitmapHeaderGenerated ();
1061
 
                virtual ~BitmapHeaderGenerated ();
1062
 
                
1063
 
                
1064
 
                //
1065
 
                // get and set functions
1066
 
                //
1067
 
                
1068
 
                Word getWidth (void) const      {       return m_width; }
1069
 
                void setWidth (const Word val)  {       m_width = val;  }
1070
 
                
1071
 
                Word getHeight (void) const     {       return m_height;        }
1072
 
                void setHeight (const Word val) {       m_height = val; }
1073
 
                
1074
 
                Word getWidthBytes (void) const {       return m_widthBytes;    }
1075
 
                void setWidthBytes (const Word val)     {       m_widthBytes = val;     }
1076
 
                
1077
 
                Byte getNumPlanes (void) const  {       return m_numPlanes;     }
1078
 
                void setNumPlanes (const Byte val)      {       m_numPlanes = val;      }
1079
 
                
1080
 
                Byte getBitsPerPixel (void) const       {       return m_bitsPerPixel;  }
1081
 
                void setBitsPerPixel (const Byte val)   {       m_bitsPerPixel = val;   }
1082
 
        };
1083
 
        
1084
 
        // 'Standard WMF' Header
1085
 
        // [PRIVATE] this is a private libmswrite class, do not use it!
1086
 
        class WMFHeaderGenerated : public NeedsDevice
1087
 
        {
1088
 
        public:
1089
 
                static const int s_size = 18;
1090
 
        
1091
 
        private:
1092
 
                WMFHeaderGenerated (const WMFHeaderGenerated &rhs);     //TODO: copy constructor
1093
 
        
1094
 
        protected:
1095
 
                Byte m_data [18];       // raw data from .wri file
1096
 
                
1097
 
                Word m_fieldType;                                               // 0=memory WMF,1=file WMF; so will never be 0
1098
 
                Word m_headerSize;                                      // (in Words)
1099
 
                Word m_winVersion;                                      // correct for Win>=3.0
1100
 
                DWord m_fileSize;                                               // (in Words)
1101
 
                Word m_numObjects;                                      // ?
1102
 
                DWord m_maxRecordSize;                          // (in Words)
1103
 
                Word m_zero;
1104
 
                
1105
 
                WMFHeaderGenerated &operator= (const WMFHeaderGenerated &rhs);
1106
 
                
1107
 
                virtual bool verifyVariables (void);
1108
 
                virtual bool writeToArray (void);
1109
 
                
1110
 
                static const Word fieldTypeDefault = Word (1);
1111
 
                static const Word headerSizeDefault = Word (9);
1112
 
                static const Word winVersionDefault = Word (0x0300);
1113
 
                // no default for fileSize
1114
 
                static const Word numObjectsDefault = Word (0);
1115
 
                // no default for maxRecordSize
1116
 
                static const Word zeroDefault = Word (0);
1117
 
        
1118
 
        public:
1119
 
                // [PRIVATE] do not call!
1120
 
                virtual bool readFromDevice (void);
1121
 
                virtual bool writeToDevice (void);
1122
 
                
1123
 
                WMFHeaderGenerated ();
1124
 
                virtual ~WMFHeaderGenerated ();
1125
 
                
1126
 
                
1127
 
                //
1128
 
                // get and set functions
1129
 
                //
1130
 
                
1131
 
                DWord getFileSize (void) const  {       return m_fileSize;      }
1132
 
                void setFileSize (const DWord val)      {       m_fileSize = val;       }
1133
 
                
1134
 
                DWord getMaxRecordSize (void) const     {       return m_maxRecordSize; }
1135
 
                void setMaxRecordSize (const DWord val) {       m_maxRecordSize = val;  }
1136
 
        };
1137
 
        
1138
 
        class BitmapHeader;
1139
 
        class ImageGenerated : public NeedsDevice
1140
 
        {
1141
 
        public:
1142
 
                static const int s_size = 40;
1143
 
        
1144
 
        private:
1145
 
                ImageGenerated (const ImageGenerated &rhs);     //TODO: copy constructor
1146
 
        
1147
 
        protected:
1148
 
                Byte m_data [40];       // raw data from .wri file
1149
 
                
1150
 
                // - - - METAFILEPICT begin - - - 
1151
 
                
1152
 
                Word m_mappingMode;                                     // type of image: 0xE3 for mono bitmap, != 0xE3 for WMF (usually 0x88)
1153
 
                Word m_MFP_width;
1154
 
                Word m_MFP_height;
1155
 
                Word m_MFP_unknown;
1156
 
                
1157
 
                // - - - METAFILEPICT end - - - 
1158
 
                
1159
 
                Word m_indent;                                                  // horizontal position from left margin
1160
 
                Word m_width;                                                   // WMF width only, use m_bmh for bitmaps
1161
 
                Word m_height;                                                  // WMF height only, use m_bmh for bitmaps
1162
 
                Word m_zero;                                                    // ??? varies too much, default to 0
1163
 
                
1164
 
                BitmapHeader *m_bmh;                                    // only valid for mono BMPs i.e. when mappingMode == 0xe3
1165
 
                
1166
 
                Word m_numHeaderBytes;                          // size of this header? (why isn't it the first element?)
1167
 
                DWord m_numDataBytes;                           // number of image bytes
1168
 
                Word m_horizontalScalingRel1000;        // horizontal scaling (/1000)*100% (BMPs only)
1169
 
                Word m_verticalScalingRel1000;  // vertical scaling (/1000)*100% (BMPs only)
1170
 
                
1171
 
                // - - - Followed by either a strangely packed monochrome bitmap or a Standard WMF (with WMFHeader, of course) - - - 
1172
 
                
1173
 
                ImageGenerated &operator= (const ImageGenerated &rhs);
1174
 
                
1175
 
                virtual bool verifyVariables (void);
1176
 
                virtual bool writeToArray (void);
1177
 
                
1178
 
                // no default for mappingMode
1179
 
                // no default for MFP_width
1180
 
                // no default for MFP_height
1181
 
                static const Word MFP_unknownDefault = Word (0);
1182
 
                static const Word indentDefault = Word (0);
1183
 
                // no default for width
1184
 
                // no default for height
1185
 
                static const Word zeroDefault = Word (0);
1186
 
                // no default for bmh
1187
 
                static const Word numHeaderBytesDefault = Word (s_size);
1188
 
                // no default for numDataBytes
1189
 
                static const Word horizontalScalingRel1000Default = Word (1000);
1190
 
                static const Word verticalScalingRel1000Default = Word (1000);
1191
 
        
1192
 
        public:
1193
 
                // [PRIVATE] do not call!
1194
 
                virtual bool readFromDevice (void);
1195
 
                virtual bool writeToDevice (void);
1196
 
                
1197
 
                ImageGenerated ();
1198
 
                virtual ~ImageGenerated ();
1199
 
                
1200
 
                
1201
 
                //
1202
 
                // get and set functions
1203
 
                //
1204
 
                
1205
 
                Word getIndent (void) const     {       return m_indent;        }
1206
 
                void setIndent (const Word val) {       m_indent = val; }
1207
 
                
1208
 
                // [PRIVATE] these are private libmswrite methods, do not call them!
1209
 
                Word getNumHeaderBytes (void) const     {       return m_numHeaderBytes;        }
1210
 
                void setNumHeaderBytes (const Word val) {       m_numHeaderBytes = val; }
1211
 
                
1212
 
                // [PRIVATE] these are private libmswrite methods, do not call them!
1213
 
                DWord getNumDataBytes (void) const      {       return m_numDataBytes;  }
1214
 
                void setNumDataBytes (const DWord val)  {       m_numDataBytes = val;   }
1215
 
        };
1216
 
        
1217
 
        class OLEGenerated : public NeedsDevice
1218
 
        {
1219
 
        public:
1220
 
                static const int s_size = 40;
1221
 
        
1222
 
        private:
1223
 
                OLEGenerated (const OLEGenerated &rhs); //TODO: copy constructor
1224
 
        
1225
 
        protected:
1226
 
                Byte m_data [40];       // raw data from .wri file
1227
 
                
1228
 
                Word m_mappingMode;
1229
 
                DWord m_zero;
1230
 
                Word m_objectType;                                      // 1=static, 2=embedded, 3=link
1231
 
                
1232
 
                Word m_indent;                                                  // horizontal position from left margin
1233
 
                Word m_width;
1234
 
                Word m_height;
1235
 
                Word m_zero2;
1236
 
                DWord m_numDataBytes;                           // number of OLE bytes
1237
 
                DWord m_zero3;
1238
 
                DWord m_objectName;                                     // name of the object in hex
1239
 
                Word m_zero4;
1240
 
                Word m_numHeaderBytes;                          // size of this header
1241
 
                DWord m_zero5;
1242
 
                Word m_widthScaledRel1000;                      // horizontal scaling (/1000)*100% (same as Image?)
1243
 
                Word m_heightScaledRel1000;             // vertical scaling (/1000)*100% (same as Image?)
1244
 
                
1245
 
                // - - - Followed by OLE data - - - 
1246
 
                
1247
 
                OLEGenerated &operator= (const OLEGenerated &rhs);
1248
 
                
1249
 
                virtual bool verifyVariables (void);
1250
 
                virtual bool writeToArray (void);
1251
 
                
1252
 
                // no default for mappingMode
1253
 
                static const DWord zeroDefault = DWord (0);
1254
 
                // no default for objectType
1255
 
                // no default for indent
1256
 
                // no default for width
1257
 
                // no default for height
1258
 
                static const Word zero2Default = Word (0);
1259
 
                // no default for numDataBytes
1260
 
                static const DWord zero3Default = DWord (0);
1261
 
                // no default for objectName
1262
 
                static const Word zero4Default = Word (0);
1263
 
                // no default for numHeaderBytes
1264
 
                static const DWord zero5Default = DWord (0);
1265
 
                // no default for widthScaledRel1000
1266
 
                // no default for heightScaledRel1000
1267
 
        
1268
 
        public:
1269
 
                // [PRIVATE] do not call!
1270
 
                virtual bool readFromDevice (void);
1271
 
                virtual bool writeToDevice (void);
1272
 
                
1273
 
                OLEGenerated ();
1274
 
                virtual ~OLEGenerated ();
1275
 
                
1276
 
                
1277
 
                //
1278
 
                // get and set functions
1279
 
                //
1280
 
                
1281
 
                Word getObjectType (void) const {       return m_objectType;    }
1282
 
                void setObjectType (const Word val)     {       m_objectType = val;     }
1283
 
                
1284
 
                Word getIndent (void) const     {       return m_indent;        }
1285
 
                void setIndent (const Word val) {       m_indent = val; }
1286
 
                
1287
 
                Word getWidth (void) const      {       return m_width; }
1288
 
                void setWidth (const Word val)  {       m_width = val;  }
1289
 
                
1290
 
                Word getHeight (void) const     {       return m_height;        }
1291
 
                void setHeight (const Word val) {       m_height = val; }
1292
 
                
1293
 
                // [PRIVATE] these are private libmswrite methods, do not call them!
1294
 
                DWord getNumDataBytes (void) const      {       return m_numDataBytes;  }
1295
 
                void setNumDataBytes (const DWord val)  {       m_numDataBytes = val;   }
1296
 
                
1297
 
                DWord getObjectName (void) const        {       return m_objectName;    }
1298
 
                void setObjectName (const DWord val)    {       m_objectName = val;     }
1299
 
                
1300
 
                Word getWidthScaledRel1000 (void) const {       return m_widthScaledRel1000;    }
1301
 
                void setWidthScaledRel1000 (const Word val)     {       m_widthScaledRel1000 = val;     }
1302
 
                
1303
 
                Word getHeightScaledRel1000 (void) const        {       return m_heightScaledRel1000;   }
1304
 
                void setHeightScaledRel1000 (const Word val)    {       m_heightScaledRel1000 = val;    }
1305
 
        };
1306
 
}       // namespace MSWrite    {
1307
 
 
1308
 
#endif  // __STRUCTURES_GENERATED_H__
 
44
//
 
45
//    This file is part of the LibMSWrite project
 
46
//    Copyright (c) 2001-2003, 2007 Clarence Dang <clarencedang@users.sf.net>
 
47
//    All rights reserved.
 
48
//
 
49
//    Redistribution and use in source and binary forms, with or without
 
50
//    modification, are permitted provided that the following conditions
 
51
//    are met:
 
52
//
 
53
//    1. Redistributions of source code must retain the above copyright
 
54
//       notice, this list of conditions and the following disclaimer.
 
55
//    2. Redistributions in binary form must reproduce the above copyright
 
56
//       notice, this list of conditions and the following disclaimer in the
 
57
//       documentation and/or other materials provided with the distribution.
 
58
//
 
59
//    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 
60
//    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 
61
//    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 
62
//    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 
63
//    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 
64
//    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
65
//    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
66
//    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
67
//    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 
68
//    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
69
//
 
70
//    LibMSWrite Project Website:
 
71
//    http://sourceforge.net/projects/libmswrite/
 
72
//
 
73
// DESCRIPTION
 
74
//
 
75
// format.xml describes the basic structures that can be found in Microsoft(r)
 
76
// Windows(r) Write files.  The majority of the information in format.xml
 
77
// (excluding the Windows(r) BMP and WMF structures) is the result of
 
78
// investigative file format work but a few portions of format.xml are derived
 
79
// from a specification freely available from http://www.wotsit.org/.  The BMP
 
80
// & WMF structures are from somewhere on the Internet (they are freely and
 
81
// readily available) and can also be found in many programming books.
 
82
//
 
83
// The data types and numbers in this document are intended to be interpreted
 
84
// in the way they would be in Win3.x (Little Endian, 16-bit).
 
85
//
 
86
//
 
87
//  Structure Fields:
 
88
//
 
89
//   name #REQUIRED
 
90
//   type #IMPLIED "Word"
 
91
//   default #IMPLIED ""
 
92
//   description #IMPLIED "" (also valid for Structures)
 
93
//   verify #IMPLIED ""
 
94
//   failVerify #IMPLIED "InvalidFormat"
 
95
//   rep #IMPLIED "1"
 
96
//   useThisMuch #IMPLIED "0"
 
97
//   provideMethod #IMPLIED "0"
 
98
//   protected #IMPLIED "0" (also valid for Structures)
 
99
//
 
100
//  All structure names will be automatically postfixed with "Generated".
 
101
//  Derive structures from "Generated" structures (in structures*.cpp) e.g.
 
102
//
 
103
//   class Header : public HeaderGenerated
 
104
//   {
 
105
//   }
 
106
//
 
107
//  All fields will be automatically prefixed with "m_" to signify that
 
108
//  they are member variables.
 
109
//
 
110
//  Note that there are some limitations with make_structures_generated,
 
111
//  most importantly:
 
112
//
 
113
//   * any field of type Bit, must have
 
114
//    - rep <=8
 
115
//    - default = 0
 
116
//    - may not cross a byte boundary!
 
117
 
 
118
// Write file header (mostly from wotsit)
 
119
// [PRIVATE] this is a private libmswrite class, do not use it!
 
120
class HeaderGenerated : public NeedsDevice
 
121
{
 
122
public:
 
123
    static const int s_size = 98;
 
124
 
 
125
private:
 
126
    HeaderGenerated(const HeaderGenerated &rhs);  //TODO: copy constructor
 
127
 
 
128
protected:
 
129
    Byte m_data [98]; // raw data from .wri file
 
130
 
 
131
    Word m_magic;       // must be 0xBE31 (v3.0) or 0xBE32 (v3.1 because the file contains OLE)
 
132
    Word m_zero;
 
133
    Word m_magic2;       // Magic number2 (must be 0xAB00)
 
134
    Word m_zero2 [4];
 
135
    DWord m_numCharBytesPlus128;  // #bytes of text,images & OLE (starting from Byte 128/Page 1)
 
136
    Word m_pageParaInfo;
 
137
    Word m_pageFootnoteTable;
 
138
    Word m_pageSectionProperty;  // I call it "Page Layout"
 
139
    Word m_pageSectionTable;
 
140
    Word m_pagePageTable;
 
141
    Word m_pageFontTable;
 
142
    Word m_zero3 [33];
 
143
    Word m_numPages;      // (where a page is 128 bytes)
 
144
 
 
145
    HeaderGenerated &operator= (const HeaderGenerated &rhs);
 
146
 
 
147
    virtual bool verifyVariables(void);
 
148
    virtual bool writeToArray(void);
 
149
 
 
150
    static const Word magicDefault = Word(0xBE31/*Write 3.0*/);
 
151
    static const Word zeroDefault = Word(0);
 
152
    static const Word magic2Default = Word(0xAB00);
 
153
    // cannot provide default for zero2 (is an array or of a non-internal type)
 
154
    // no default for numCharBytesPlus128
 
155
    // no default for pageParaInfo
 
156
    // no default for pageFootnoteTable
 
157
    // no default for pageSectionProperty
 
158
    // no default for pageSectionTable
 
159
    // no default for pagePageTable
 
160
    // no default for pageFontTable
 
161
    // cannot provide default for zero3 (is an array or of a non-internal type)
 
162
    // no default for numPages
 
163
 
 
164
public:
 
165
    // [PRIVATE] do not call!
 
166
    virtual bool readFromDevice(void);
 
167
    virtual bool writeToDevice(void);
 
168
 
 
169
    HeaderGenerated();
 
170
    virtual ~HeaderGenerated();
 
171
 
 
172
 
 
173
    //
 
174
    // get and set functions
 
175
    //
 
176
 
 
177
    Word getMagic(void) const {
 
178
        return m_magic;
 
179
    }
 
180
    void setMagic(const Word val) {
 
181
        m_magic = val;
 
182
    }
 
183
 
 
184
    Word getPageParaInfo(void) const {
 
185
        return m_pageParaInfo;
 
186
    }
 
187
    void setPageParaInfo(const Word val) {
 
188
        m_pageParaInfo = val;
 
189
    }
 
190
 
 
191
    Word getPageFootnoteTable(void) const {
 
192
        return m_pageFootnoteTable;
 
193
    }
 
194
    void setPageFootnoteTable(const Word val) {
 
195
        m_pageFootnoteTable = val;
 
196
    }
 
197
 
 
198
    Word getPageSectionProperty(void) const {
 
199
        return m_pageSectionProperty;
 
200
    }
 
201
    void setPageSectionProperty(const Word val) {
 
202
        m_pageSectionProperty = val;
 
203
    }
 
204
 
 
205
    Word getPageSectionTable(void) const {
 
206
        return m_pageSectionTable;
 
207
    }
 
208
    void setPageSectionTable(const Word val) {
 
209
        m_pageSectionTable = val;
 
210
    }
 
211
 
 
212
    Word getPagePageTable(void) const {
 
213
        return m_pagePageTable;
 
214
    }
 
215
    void setPagePageTable(const Word val) {
 
216
        m_pagePageTable = val;
 
217
    }
 
218
 
 
219
    Word getPageFontTable(void) const {
 
220
        return m_pageFontTable;
 
221
    }
 
222
    void setPageFontTable(const Word val) {
 
223
        m_pageFontTable = val;
 
224
    }
 
225
 
 
226
    Word getNumPages(void) const {
 
227
        return m_numPages;
 
228
    }
 
229
    void setNumPages(const Word val) {
 
230
        m_numPages = val;
 
231
    }
 
232
};
 
233
 
 
234
// Page layout information (margins, dimensions, ...)
 
235
class PageLayoutGenerated : public NeedsDevice
 
236
{
 
237
public:
 
238
    static const int s_size = 33;
 
239
 
 
240
private:
 
241
    PageLayoutGenerated(const PageLayoutGenerated &rhs);  //TODO: copy constructor
 
242
 
 
243
protected:
 
244
    Byte m_data [33]; // raw data from .wri file
 
245
 
 
246
    Byte m_magic102;      // =102?
 
247
    Word m_magic512;      // =512?
 
248
    Word m_pageHeight;
 
249
    Word m_pageWidth;
 
250
    Word m_pageNumberStart;    // start counting page numbers from this value (0xFFFF means ignore, set to 1 I guess)
 
251
    Word m_topMargin;
 
252
    Word m_textHeight;
 
253
    Word m_leftMargin;
 
254
    Word m_textWidth;
 
255
 
 
256
    Word m_magic256;      // =256?
 
257
 
 
258
    Word m_headerFromTop;    // distance header is from top of page
 
259
    Word m_footerFromTop;    // distance footer is from top of page
 
260
 
 
261
    Word m_magic720;      // 720
 
262
    Word m_zero;       // 0
 
263
    Word m_magic1080;      // 1080
 
264
    Word m_unknown;      // ? (let's not be random and default to 0)
 
265
    Word m_zero2;       // 0
 
266
 
 
267
    PageLayoutGenerated &operator= (const PageLayoutGenerated &rhs);
 
268
 
 
269
    virtual bool verifyVariables(void);
 
270
    virtual bool writeToArray(void);
 
271
 
 
272
    static const Byte magic102Default = Byte(102);
 
273
    static const Word magic512Default = Word(512);
 
274
    static const Word pageHeightDefault = Word(Inch2Twip(11));
 
275
    static const Word pageWidthDefault = Word(Inch2Twip(8.5));
 
276
    static const Word pageNumberStartDefault = Word(1);
 
277
    static const Word topMarginDefault = Word(Inch2Twip(1));
 
278
    static const Word textHeightDefault = Word(Inch2Twip(9));
 
279
    static const Word leftMarginDefault = Word(Inch2Twip(1.25));
 
280
    static const Word textWidthDefault = Word(Inch2Twip(6));
 
281
    static const Word magic256Default = Word(256);
 
282
    static const Word headerFromTopDefault = Word(Inch2Twip(0.75));
 
283
    static const Word footerFromTopDefault = Word(Inch2Twip(10.25 /*11.0 (m_pageHeight) - 0.75*/));
 
284
    static const Word magic720Default = Word(720);
 
285
    static const Word zeroDefault = Word(0);
 
286
    static const Word magic1080Default = Word(1080);
 
287
    static const Word unknownDefault = Word(0);
 
288
    static const Word zero2Default = Word(0);
 
289
 
 
290
public:
 
291
    // [PRIVATE] do not call!
 
292
    virtual bool readFromDevice(void);
 
293
    virtual bool writeToDevice(void);
 
294
 
 
295
    PageLayoutGenerated();
 
296
    virtual ~PageLayoutGenerated();
 
297
 
 
298
};
 
299
 
 
300
// No idea what this is supposed to do (from wotsit)
 
301
// [PRIVATE] this is a private libmswrite class, do not use it!
 
302
class SectionDescriptorGenerated : public NeedsDevice
 
303
{
 
304
public:
 
305
    static const int s_size = 10;
 
306
 
 
307
private:
 
308
    SectionDescriptorGenerated(const SectionDescriptorGenerated &rhs);  //TODO: copy constructor
 
309
 
 
310
protected:
 
311
    Byte m_data [10]; // raw data from .wri file
 
312
 
 
313
    DWord m_afterEndCharByte;   // byte of character just after end of section
 
314
    Word m_undefined;
 
315
    DWord m_sectionPropertyLocation; // byte address of corresponding sectionProperty (I call it a "Page Layout" which is more obvious IMHO)
 
316
 
 
317
    SectionDescriptorGenerated &operator= (const SectionDescriptorGenerated &rhs);
 
318
 
 
319
    virtual bool verifyVariables(void);
 
320
    virtual bool writeToArray(void);
 
321
 
 
322
    // no default for afterEndCharByte
 
323
    static const Word undefinedDefault = Word(0);
 
324
    // no default for sectionPropertyLocation
 
325
 
 
326
public:
 
327
    // [PRIVATE] do not call!
 
328
    virtual bool readFromDevice(void);
 
329
    virtual bool writeToDevice(void);
 
330
 
 
331
    SectionDescriptorGenerated();
 
332
    virtual ~SectionDescriptorGenerated();
 
333
 
 
334
 
 
335
    //
 
336
    // get and set functions
 
337
    //
 
338
 
 
339
    DWord getAfterEndCharByte(void) const {
 
340
        return m_afterEndCharByte;
 
341
    }
 
342
    void setAfterEndCharByte(const DWord val) {
 
343
        m_afterEndCharByte = val;
 
344
    }
 
345
 
 
346
    DWord getSectionPropertyLocation(void) const {
 
347
        return m_sectionPropertyLocation;
 
348
    }
 
349
    void setSectionPropertyLocation(const DWord val) {
 
350
        m_sectionPropertyLocation = val;
 
351
    }
 
352
};
 
353
 
 
354
// (from wotsit)
 
355
class SectionDescriptor;
 
356
// [PRIVATE] this is a private libmswrite class, do not use it!
 
357
class SectionTableGenerated : public NeedsDevice
 
358
{
 
359
public:
 
360
    static const int s_size = 24;
 
361
 
 
362
private:
 
363
    SectionTableGenerated(const SectionTableGenerated &rhs);  //TODO: copy constructor
 
364
 
 
365
protected:
 
366
    Byte m_data [24]; // raw data from .wri file
 
367
 
 
368
    Word m_numSectionDescriptors;
 
369
    Word m_undefined;
 
370
    SectionDescriptor *m_sed [2];
 
371
 
 
372
    SectionTableGenerated &operator= (const SectionTableGenerated &rhs);
 
373
 
 
374
    virtual bool verifyVariables(void);
 
375
    virtual bool writeToArray(void);
 
376
 
 
377
    static const Word numSectionDescriptorsDefault = Word(2);
 
378
    static const Word undefinedDefault = Word(0);
 
379
    // no default for sed
 
380
 
 
381
public:
 
382
    // [PRIVATE] do not call!
 
383
    virtual bool readFromDevice(void);
 
384
    virtual bool writeToDevice(void);
 
385
 
 
386
    SectionTableGenerated();
 
387
    virtual ~SectionTableGenerated();
 
388
 
 
389
};
 
390
 
 
391
class FontGenerated : public NeedsDevice
 
392
{
 
393
public:
 
394
    static const int s_size = 3;
 
395
 
 
396
private:
 
397
    FontGenerated(const FontGenerated &rhs);  //TODO: copy constructor
 
398
 
 
399
protected:
 
400
    Byte m_data [3]; // raw data from .wri file
 
401
 
 
402
    Word m_numDataBytes;     // number of bytes that follow
 
403
    Byte m_family;
 
404
 
 
405
    // - - - followed by Byte *fontName - - -
 
406
 
 
407
    FontGenerated &operator= (const FontGenerated &rhs);
 
408
 
 
409
    virtual bool verifyVariables(void);
 
410
    virtual bool writeToArray(void);
 
411
 
 
412
    static const Word numDataBytesDefault = Word(0);
 
413
    static const Byte familyDefault = Byte(0);
 
414
 
 
415
public:
 
416
    // [PRIVATE] do not call!
 
417
    virtual bool readFromDevice(void);
 
418
    virtual bool writeToDevice(void);
 
419
 
 
420
    FontGenerated();
 
421
    virtual ~FontGenerated();
 
422
 
 
423
 
 
424
    //
 
425
    // get and set functions
 
426
    //
 
427
 
 
428
    // [PRIVATE] these are private libmswrite methods, do not call them!
 
429
    Word getNumDataBytes(void) const {
 
430
        return m_numDataBytes;
 
431
    }
 
432
    void setNumDataBytes(const Word val) {
 
433
        m_numDataBytes = val;
 
434
    }
 
435
 
 
436
    Byte getFamily(void) const {
 
437
        return m_family;
 
438
    }
 
439
    void setFamily(const Byte val) {
 
440
        m_family = val;
 
441
    }
 
442
};
 
443
 
 
444
// [PRIVATE] this is a private libmswrite class, do not use it!
 
445
class FontTableGenerated : public NeedsDevice
 
446
{
 
447
public:
 
448
    static const int s_size = 2;
 
449
 
 
450
private:
 
451
    FontTableGenerated(const FontTableGenerated &rhs);  //TODO: copy constructor
 
452
 
 
453
protected:
 
454
    Byte m_data [2]; // raw data from .wri file
 
455
 
 
456
    Word m_numFonts;
 
457
 
 
458
    // - - - followed by a list of Font(s) - - -
 
459
 
 
460
    FontTableGenerated &operator= (const FontTableGenerated &rhs);
 
461
 
 
462
    virtual bool verifyVariables(void);
 
463
    virtual bool writeToArray(void);
 
464
 
 
465
    static const Word numFontsDefault = Word(0);
 
466
 
 
467
public:
 
468
    // [PRIVATE] do not call!
 
469
    virtual bool readFromDevice(void);
 
470
    virtual bool writeToDevice(void);
 
471
 
 
472
    FontTableGenerated();
 
473
    virtual ~FontTableGenerated();
 
474
 
 
475
 
 
476
    //
 
477
    // get and set functions
 
478
    //
 
479
 
 
480
    Word getNumFonts(void) const {
 
481
        return m_numFonts;
 
482
    }
 
483
    void setNumFonts(const Word val) {
 
484
        m_numFonts = val;
 
485
    }
 
486
};
 
487
 
 
488
// [PRIVATE] this is a private libmswrite class, do not use it!
 
489
class PagePointerGenerated : public NeedsDevice
 
490
{
 
491
public:
 
492
    static const int s_size = 6;
 
493
 
 
494
private:
 
495
    PagePointerGenerated(const PagePointerGenerated &rhs);  //TODO: copy constructor
 
496
 
 
497
protected:
 
498
    Byte m_data [6]; // raw data from .wri file
 
499
 
 
500
    Word m_pageNumber;
 
501
    DWord m_firstCharByte;    // first character on page
 
502
 
 
503
    PagePointerGenerated &operator= (const PagePointerGenerated &rhs);
 
504
 
 
505
    virtual bool verifyVariables(void);
 
506
    virtual bool writeToArray(void);
 
507
 
 
508
    // no default for pageNumber
 
509
    // no default for firstCharByte
 
510
 
 
511
public:
 
512
    // [PRIVATE] do not call!
 
513
    virtual bool readFromDevice(void);
 
514
    virtual bool writeToDevice(void);
 
515
 
 
516
    PagePointerGenerated();
 
517
    virtual ~PagePointerGenerated();
 
518
 
 
519
 
 
520
    //
 
521
    // get and set functions
 
522
    //
 
523
 
 
524
    Word getPageNumber(void) const {
 
525
        return m_pageNumber;
 
526
    }
 
527
    void setPageNumber(const Word val) {
 
528
        m_pageNumber = val;
 
529
    }
 
530
 
 
531
    DWord getFirstCharByte(void) const {
 
532
        return m_firstCharByte;
 
533
    }
 
534
    void setFirstCharByte(const DWord val) {
 
535
        m_firstCharByte = val;
 
536
    }
 
537
};
 
538
 
 
539
// File/Repaginate function
 
540
// [PRIVATE] this is a private libmswrite class, do not use it!
 
541
class PageTableGenerated : public NeedsDevice
 
542
{
 
543
public:
 
544
    static const int s_size = 4;
 
545
 
 
546
private:
 
547
    PageTableGenerated(const PageTableGenerated &rhs);  //TODO: copy constructor
 
548
 
 
549
protected:
 
550
    Byte m_data [4]; // raw data from .wri file
 
551
 
 
552
    Word m_numPagePointers;
 
553
    Word m_zero;
 
554
 
 
555
    // - - - followed by a list of PagePointer(s) - - -
 
556
 
 
557
    PageTableGenerated &operator= (const PageTableGenerated &rhs);
 
558
 
 
559
    virtual bool verifyVariables(void);
 
560
    virtual bool writeToArray(void);
 
561
 
 
562
    static const Word numPagePointersDefault = Word(0);
 
563
    static const Word zeroDefault = Word(0);
 
564
 
 
565
public:
 
566
    // [PRIVATE] do not call!
 
567
    virtual bool readFromDevice(void);
 
568
    virtual bool writeToDevice(void);
 
569
 
 
570
    PageTableGenerated();
 
571
    virtual ~PageTableGenerated();
 
572
 
 
573
};
 
574
 
 
575
// A pointer to the actual formatting properties (formatting properties are shared to save space)
 
576
// [PRIVATE] this is a private libmswrite class, do not use it!
 
577
class FormatPointerGenerated : public NeedsDevice
 
578
{
 
579
public:
 
580
    static const int s_size = 6;
 
581
 
 
582
private:
 
583
    FormatPointerGenerated(const FormatPointerGenerated &rhs);  //TODO: copy constructor
 
584
 
 
585
protected:
 
586
    Byte m_data [6]; // raw data from .wri file
 
587
 
 
588
    DWord m_afterEndCharBytePlus128; // last character it points to + 1
 
589
    Word m_formatPropertyOffset;  // location of relevant FormatProperty (or 0xFFFF for defaults)
 
590
 
 
591
    FormatPointerGenerated &operator= (const FormatPointerGenerated &rhs);
 
592
 
 
593
    virtual bool verifyVariables(void);
 
594
    virtual bool writeToArray(void);
 
595
 
 
596
    // no default for afterEndCharBytePlus128
 
597
    // no default for formatPropertyOffset
 
598
 
 
599
public:
 
600
    // [PRIVATE] do not call!
 
601
    virtual bool readFromDevice(void);
 
602
    virtual bool writeToDevice(void);
 
603
 
 
604
    FormatPointerGenerated();
 
605
    virtual ~FormatPointerGenerated();
 
606
 
 
607
 
 
608
    //
 
609
    // get and set functions
 
610
    //
 
611
 
 
612
    DWord getAfterEndCharBytePlus128(void) const {
 
613
        return m_afterEndCharBytePlus128;
 
614
    }
 
615
    void setAfterEndCharBytePlus128(const DWord val) {
 
616
        m_afterEndCharBytePlus128 = val;
 
617
    }
 
618
 
 
619
    Word getFormatPropertyOffset(void) const {
 
620
        return m_formatPropertyOffset;
 
621
    }
 
622
    void setFormatPropertyOffset(const Word val) {
 
623
        m_formatPropertyOffset = val;
 
624
    }
 
625
};
 
626
 
 
627
// Character Properties
 
628
class FormatCharPropertyGenerated : public NeedsDevice, public UseThisMuch
 
629
{
 
630
public:
 
631
    static const int s_size = 7;
 
632
 
 
633
private:
 
634
    FormatCharPropertyGenerated(const FormatCharPropertyGenerated &rhs);  //TODO: copy constructor
 
635
 
 
636
protected:
 
637
    Byte m_data [7]; // raw data from .wri file
 
638
 
 
639
    // Byte 0
 
640
    Byte m_numDataBytes;     // number of bytes that follow
 
641
 
 
642
    // Byte 1
 
643
    Byte m_unknown;      // =0? or =1?
 
644
 
 
645
    // Byte 2
 
646
unsigned m_isBold : 1;
 
647
unsigned m_isItalic : 1;
 
648
unsigned m_fontCodeLow : 6;
 
649
 
 
650
    // Byte 3
 
651
    Byte m_fontSize;      // half the fontSize?
 
652
 
 
653
    // Byte 4
 
654
unsigned m_isUnderlined : 1;
 
655
unsigned m_zero : 5;
 
656
unsigned m_isPageNumber : 1;  // seems to be set for '(page)' number variables - only in headers/footers?
 
657
unsigned m_zero2 : 1;
 
658
 
 
659
    // Byte 5
 
660
unsigned m_fontCodeHigh : 3;  // not sure if this is true
 
661
unsigned m_zero3 : 5;
 
662
 
 
663
    // Byte 6
 
664
    Byte m_position;      // 0=normal, 1-127=superscript, 128-255=subscript (I tested mainly boundary values so I don't know if it's this is totally true)
 
665
 
 
666
    FormatCharPropertyGenerated &operator= (const FormatCharPropertyGenerated &rhs);
 
667
 
 
668
    Word getNumDataBytes(void) const {
 
669
        return UseThisMuch::getNeedNumDataBytes();
 
670
    }
 
671
    // note: you cannot set numDataBytes
 
672
    void updateNumDataBytes(void) {
 
673
        m_numDataBytes = UseThisMuch::getNeedNumDataBytes();
 
674
    }
 
675
 
 
676
    virtual bool verifyVariables(void);
 
677
    virtual bool writeToArray(void);
 
678
 
 
679
    static const Byte numDataBytesDefault = Byte(0);
 
680
    static const Byte unknownDefault = Byte(1);
 
681
    static const unsigned isBoldDefault = unsigned(0);
 
682
    static const unsigned isItalicDefault = unsigned(0);
 
683
    // cannot provide default for fontCodeLow (is an array or of a non-internal type)
 
684
    static const Byte fontSizeDefault = Byte(24);
 
685
    static const unsigned isUnderlinedDefault = unsigned(0);
 
686
    // cannot provide default for zero (is an array or of a non-internal type)
 
687
    static const unsigned isPageNumberDefault = unsigned(0);
 
688
    static const unsigned zero2Default = unsigned(0);
 
689
    // cannot provide default for fontCodeHigh (is an array or of a non-internal type)
 
690
    // cannot provide default for zero3 (is an array or of a non-internal type)
 
691
    static const Byte positionDefault = Byte(0);
 
692
 
 
693
public:
 
694
    // [PRIVATE] do not call!
 
695
    virtual bool readFromDevice(void);
 
696
    virtual bool writeToDevice(void);
 
697
 
 
698
    FormatCharPropertyGenerated();
 
699
    virtual ~FormatCharPropertyGenerated();
 
700
 
 
701
 
 
702
    //
 
703
    // get and set functions
 
704
    //
 
705
 
 
706
    bool getIsBold(void) const {
 
707
        return m_isBold;
 
708
    }
 
709
    void setIsBold(const bool val) {
 
710
        m_isBold = val; signalHaveSetData(m_isBold == bool (0), 8/*offset*/ + 1/*size*/);
 
711
    }
 
712
 
 
713
    bool getIsItalic(void) const {
 
714
        return m_isItalic;
 
715
    }
 
716
    void setIsItalic(const bool val) {
 
717
        m_isItalic = val; signalHaveSetData(m_isItalic == bool (0), 9/*offset*/ + 1/*size*/);
 
718
    }
 
719
 
 
720
    // [PRIVATE] these are private libmswrite methods, do not call them!
 
721
    unsigned getFontCodeLow(void) const {
 
722
        return m_fontCodeLow;
 
723
    }
 
724
    void setFontCodeLow(const unsigned val) {
 
725
        m_fontCodeLow = val; signalHaveSetData(m_fontCodeLow == unsigned(0), 10/*offset*/ + 6/*size*/);
 
726
    }
 
727
 
 
728
    bool getIsUnderlined(void) const {
 
729
        return m_isUnderlined;
 
730
    }
 
731
    void setIsUnderlined(const bool val) {
 
732
        m_isUnderlined = val; signalHaveSetData(m_isUnderlined == bool (0), 24/*offset*/ + 1/*size*/);
 
733
    }
 
734
 
 
735
    bool getIsPageNumber(void) const {
 
736
        return m_isPageNumber;
 
737
    }
 
738
    void setIsPageNumber(const bool val) {
 
739
        m_isPageNumber = val; signalHaveSetData(m_isPageNumber == bool (0), 30/*offset*/ + 1/*size*/);
 
740
    }
 
741
 
 
742
    // [PRIVATE] these are private libmswrite methods, do not call them!
 
743
    unsigned getFontCodeHigh(void) const {
 
744
        return m_fontCodeHigh;
 
745
    }
 
746
    void setFontCodeHigh(const unsigned val) {
 
747
        m_fontCodeHigh = val; signalHaveSetData(m_fontCodeHigh == unsigned(0), 32/*offset*/ + 3/*size*/);
 
748
    }
 
749
 
 
750
    // [PRIVATE] these are private libmswrite methods, do not call them!
 
751
    Byte getPosition(void) const {
 
752
        return m_position;
 
753
    }
 
754
    void setPosition(const Byte val) {
 
755
        m_position = val; signalHaveSetData(m_position == Byte(0), 40/*offset*/ + 8/*size*/);
 
756
    }
 
757
};
 
758
 
 
759
// Paragraph Tabulator(s) Properties
 
760
class FormatParaPropertyTabulatorGenerated : public NeedsDevice
 
761
{
 
762
public:
 
763
    static const int s_size = 4;
 
764
 
 
765
private:
 
766
    FormatParaPropertyTabulatorGenerated(const FormatParaPropertyTabulatorGenerated &rhs);  //TODO: copy constructor
 
767
 
 
768
protected:
 
769
    Byte m_data [4]; // raw data from .wri file
 
770
 
 
771
    Word m_indent;
 
772
    Byte m_type;       // 0=normal,3=decimal...all that the GUI allows
 
773
    Byte m_zero;
 
774
 
 
775
    FormatParaPropertyTabulatorGenerated &operator= (const FormatParaPropertyTabulatorGenerated &rhs);
 
776
 
 
777
    virtual bool verifyVariables(void);
 
778
    virtual bool writeToArray(void);
 
779
 
 
780
    static const Word indentDefault = Word(0);
 
781
    static const Byte typeDefault = Byte(0);
 
782
    static const Byte zeroDefault = Byte(0);
 
783
 
 
784
public:
 
785
    // [PRIVATE] do not call!
 
786
    virtual bool readFromDevice(void);
 
787
    virtual bool writeToDevice(void);
 
788
 
 
789
    FormatParaPropertyTabulatorGenerated();
 
790
    virtual ~FormatParaPropertyTabulatorGenerated();
 
791
 
 
792
 
 
793
    //
 
794
    // get and set functions
 
795
    //
 
796
 
 
797
    Word getIndent(void) const {
 
798
        return m_indent;
 
799
    }
 
800
    void setIndent(const Word val) {
 
801
        m_indent = val;
 
802
    }
 
803
 
 
804
    // [PRIVATE] these are private libmswrite methods, do not call them!
 
805
    Byte getType(void) const {
 
806
        return m_type;
 
807
    }
 
808
    void setType(const Byte val) {
 
809
        m_type = val;
 
810
    }
 
811
};
 
812
 
 
813
// Paragraph Properties
 
814
class FormatParaPropertyTabulator;
 
815
class FormatParaPropertyGenerated : public NeedsDevice, public UseThisMuch
 
816
{
 
817
public:
 
818
    static const int s_size = 79;
 
819
 
 
820
private:
 
821
    FormatParaPropertyGenerated(const FormatParaPropertyGenerated &rhs);  //TODO: copy constructor
 
822
 
 
823
protected:
 
824
    Byte m_data [79]; // raw data from .wri file
 
825
 
 
826
    Byte m_numDataBytes;     // number of bytes that follow
 
827
    Byte m_magic0_60_or_61;    // =0? =60? =61? 60 is the most common
 
828
    Byte m_alignment;
 
829
    Word m_magic30;      // =30?
 
830
    Word m_rightIndent;     // indent from right margin + right margin (if in header/footer)
 
831
    Word m_leftIndent;     // indent from left margin + left margin (if in header/footer)
 
832
    Short m_leftIndentFirstLine;  // indent of first line relative to leftIndent (may be negative for a "hanging indent")
 
833
    Word m_lineSpacing;     // measurement in twips?
 
834
    Word m_zero [2];
 
835
 
 
836
    // Type Byte
 
837
unsigned m_headerOrFooter : 1; // 0=header,1=footer (if not normal paragraph)
 
838
unsigned m_isNotNormalParagraph : 2;// 0=normal paragraph;1,2?,3?=header/footer
 
839
unsigned m_isOnFirstPage : 1; // again, valid only if not normal paragraph
 
840
unsigned m_isObject : 1;   // 0=image/OLE,1=text
 
841
unsigned m_zero2 : 3;
 
842
 
 
843
    Byte m_zero3 [5];
 
844
    FormatParaPropertyTabulator *m_tab [14];
 
845
 
 
846
    FormatParaPropertyGenerated &operator= (const FormatParaPropertyGenerated &rhs);
 
847
 
 
848
    Word getNumDataBytes(void) const {
 
849
        return UseThisMuch::getNeedNumDataBytes();
 
850
    }
 
851
    // note: you cannot set numDataBytes
 
852
    void updateNumDataBytes(void) {
 
853
        m_numDataBytes = UseThisMuch::getNeedNumDataBytes();
 
854
    }
 
855
 
 
856
    virtual bool verifyVariables(void);
 
857
    virtual bool writeToArray(void);
 
858
 
 
859
    static const Byte numDataBytesDefault = Byte(0);
 
860
    static const Byte magic0_60_or_61Default = Byte(60);
 
861
    static const Byte alignmentDefault = Byte(0);
 
862
    static const Word magic30Default = Word(30);
 
863
    static const Word rightIndentDefault = Word(0);
 
864
    static const Word leftIndentDefault = Word(0);
 
865
    static const Short leftIndentFirstLineDefault = Short(0);
 
866
    static const Word lineSpacingDefault = Word(240);
 
867
    // cannot provide default for zero (is an array or of a non-internal type)
 
868
    static const unsigned headerOrFooterDefault = unsigned(0);
 
869
    // cannot provide default for isNotNormalParagraph (is an array or of a non-internal type)
 
870
    static const unsigned isOnFirstPageDefault = unsigned(0);
 
871
    static const unsigned isObjectDefault = unsigned(0);
 
872
    // cannot provide default for zero2 (is an array or of a non-internal type)
 
873
    // cannot provide default for zero3 (is an array or of a non-internal type)
 
874
    // no default for tab
 
875
 
 
876
public:
 
877
    // [PRIVATE] do not call!
 
878
    virtual bool readFromDevice(void);
 
879
    virtual bool writeToDevice(void);
 
880
 
 
881
    FormatParaPropertyGenerated();
 
882
    virtual ~FormatParaPropertyGenerated();
 
883
 
 
884
 
 
885
    //
 
886
    // get and set functions
 
887
    //
 
888
 
 
889
    Byte getAlignment(void) const {
 
890
        return m_alignment;
 
891
    }
 
892
    void setAlignment(const Byte val) {
 
893
        m_alignment = val; signalHaveSetData(m_alignment == Byte(0), 8/*offset*/ + 8/*size*/);
 
894
    }
 
895
 
 
896
    Word getRightIndent(void) const {
 
897
        return m_rightIndent;
 
898
    }
 
899
    void setRightIndent(const Word val) {
 
900
        m_rightIndent = val; signalHaveSetData(m_rightIndent == Word(0), 32/*offset*/ + 16/*size*/);
 
901
    }
 
902
 
 
903
    Word getLeftIndent(void) const {
 
904
        return m_leftIndent;
 
905
    }
 
906
    void setLeftIndent(const Word val) {
 
907
        m_leftIndent = val; signalHaveSetData(m_leftIndent == Word(0), 48/*offset*/ + 16/*size*/);
 
908
    }
 
909
 
 
910
    Word getLineSpacing(void) const {
 
911
        return m_lineSpacing;
 
912
    }
 
913
    void setLineSpacing(const Word val) {
 
914
        m_lineSpacing = val; signalHaveSetData(m_lineSpacing == Word(240), 80/*offset*/ + 16/*size*/);
 
915
    }
 
916
 
 
917
    bool getHeaderOrFooter(void) const {
 
918
        return m_headerOrFooter;
 
919
    }
 
920
    void setHeaderOrFooter(const bool val) {
 
921
        m_headerOrFooter = val; signalHaveSetData(m_headerOrFooter == bool (0), 128/*offset*/ + 1/*size*/);
 
922
    }
 
923
 
 
924
    unsigned getIsNotNormalParagraph(void) const {
 
925
        return m_isNotNormalParagraph;
 
926
    }
 
927
    void setIsNotNormalParagraph(const unsigned val) {
 
928
        m_isNotNormalParagraph = val; signalHaveSetData(m_isNotNormalParagraph == unsigned(0), 129/*offset*/ + 2/*size*/);
 
929
    }
 
930
 
 
931
    bool getIsOnFirstPage(void) const {
 
932
        return m_isOnFirstPage;
 
933
    }
 
934
    void setIsOnFirstPage(const bool val) {
 
935
        m_isOnFirstPage = val; signalHaveSetData(m_isOnFirstPage == bool (0), 131/*offset*/ + 1/*size*/);
 
936
    }
 
937
 
 
938
    bool getIsObject(void) const {
 
939
        return m_isObject;
 
940
    }
 
941
    void setIsObject(const bool val) {
 
942
        m_isObject = val; signalHaveSetData(m_isObject == bool (0), 132/*offset*/ + 1/*size*/);
 
943
    }
 
944
};
 
945
 
 
946
// [PRIVATE] this is a private libmswrite class, do not use it!
 
947
class FormatInfoPageGenerated : public NeedsDevice
 
948
{
 
949
public:
 
950
    static const int s_size = 128;
 
951
 
 
952
private:
 
953
    FormatInfoPageGenerated(const FormatInfoPageGenerated &rhs);  //TODO: copy constructor
 
954
 
 
955
protected:
 
956
    Byte m_data [128]; // raw data from .wri file
 
957
 
 
958
    DWord m_firstCharBytePlus128;
 
959
    Byte m_packedStructs [123];  // array of FormatPointers and FormatCharProperties/FormatParaProperties
 
960
    Byte m_numFormatPointers;
 
961
 
 
962
    FormatInfoPageGenerated &operator= (const FormatInfoPageGenerated &rhs);
 
963
 
 
964
    virtual bool verifyVariables(void);
 
965
    virtual bool writeToArray(void);
 
966
 
 
967
    // no default for firstCharBytePlus128
 
968
    // cannot provide default for packedStructs (is an array or of a non-internal type)
 
969
    static const Byte numFormatPointersDefault = Byte(0);
 
970
 
 
971
public:
 
972
    // [PRIVATE] do not call!
 
973
    virtual bool readFromDevice(void);
 
974
    virtual bool writeToDevice(void);
 
975
 
 
976
    FormatInfoPageGenerated();
 
977
    virtual ~FormatInfoPageGenerated();
 
978
 
 
979
};
 
980
 
 
981
// first header of a .BMP file (_not_ stored in .WRI)
 
982
// [PRIVATE] this is a private libmswrite class, do not use it!
 
983
class BMP_BitmapFileHeaderGenerated : public NeedsDevice
 
984
{
 
985
public:
 
986
    static const int s_size = 14;
 
987
 
 
988
private:
 
989
    BMP_BitmapFileHeaderGenerated(const BMP_BitmapFileHeaderGenerated &rhs);  //TODO: copy constructor
 
990
 
 
991
protected:
 
992
    Byte m_data [14]; // raw data from .wri file
 
993
 
 
994
    Word m_magic;
 
995
    DWord m_totalBytes;
 
996
    Word m_zero [2];
 
997
    DWord m_actualImageOffset;
 
998
 
 
999
    BMP_BitmapFileHeaderGenerated &operator= (const BMP_BitmapFileHeaderGenerated &rhs);
 
1000
 
 
1001
    virtual bool verifyVariables(void);
 
1002
    virtual bool writeToArray(void);
 
1003
 
 
1004
    static const Word magicDefault = Word(Word('B') + (Word('M') << 8));
 
1005
    // no default for totalBytes
 
1006
    // cannot provide default for zero (is an array or of a non-internal type)
 
1007
    // no default for actualImageOffset
 
1008
 
 
1009
public:
 
1010
    // [PRIVATE] do not call!
 
1011
    virtual bool readFromDevice(void);
 
1012
    virtual bool writeToDevice(void);
 
1013
 
 
1014
    BMP_BitmapFileHeaderGenerated();
 
1015
    virtual ~BMP_BitmapFileHeaderGenerated();
 
1016
 
 
1017
 
 
1018
    //
 
1019
    // get and set functions
 
1020
    //
 
1021
 
 
1022
    DWord getTotalBytes(void) const {
 
1023
        return m_totalBytes;
 
1024
    }
 
1025
    void setTotalBytes(const DWord val) {
 
1026
        m_totalBytes = val;
 
1027
    }
 
1028
 
 
1029
    DWord getActualImageOffset(void) const {
 
1030
        return m_actualImageOffset;
 
1031
    }
 
1032
    void setActualImageOffset(const DWord val) {
 
1033
        m_actualImageOffset = val;
 
1034
    }
 
1035
};
 
1036
 
 
1037
// second header of a .BMP file (_not_ stored in .WRI)
 
1038
// [PRIVATE] this is a private libmswrite class, do not use it!
 
1039
class BMP_BitmapInfoHeaderGenerated : public NeedsDevice
 
1040
{
 
1041
public:
 
1042
    static const int s_size = 40;
 
1043
 
 
1044
private:
 
1045
    BMP_BitmapInfoHeaderGenerated(const BMP_BitmapInfoHeaderGenerated &rhs);  //TODO: copy constructor
 
1046
 
 
1047
protected:
 
1048
    Byte m_data [40]; // raw data from .wri file
 
1049
 
 
1050
    DWord m_numHeaderBytes;
 
1051
    Long m_width;
 
1052
    Long m_height;
 
1053
    Word m_numPlanes;      // always==1
 
1054
    Word m_bitsPerPixel;
 
1055
    DWord m_compression;
 
1056
    DWord m_sizeImage;
 
1057
    Long m_xPixelsPerMeter;
 
1058
    Long m_yPixelsPerMeter;
 
1059
    DWord m_colorsUsed;
 
1060
    DWord m_colorsImportant;
 
1061
 
 
1062
    BMP_BitmapInfoHeaderGenerated &operator= (const BMP_BitmapInfoHeaderGenerated &rhs);
 
1063
 
 
1064
    virtual bool verifyVariables(void);
 
1065
    virtual bool writeToArray(void);
 
1066
 
 
1067
    static const DWord numHeaderBytesDefault = DWord(s_size);
 
1068
    // no default for width
 
1069
    // no default for height
 
1070
    static const Word numPlanesDefault = Word(1);
 
1071
    // no default for bitsPerPixel
 
1072
    static const DWord compressionDefault = DWord(0);
 
1073
    static const DWord sizeImageDefault = DWord(0);
 
1074
    static const Long xPixelsPerMeterDefault = Long(0);
 
1075
    static const Long yPixelsPerMeterDefault = Long(0);
 
1076
    static const DWord colorsUsedDefault = DWord(0);
 
1077
    // no default for colorsImportant
 
1078
 
 
1079
public:
 
1080
    // [PRIVATE] do not call!
 
1081
    virtual bool readFromDevice(void);
 
1082
    virtual bool writeToDevice(void);
 
1083
 
 
1084
    BMP_BitmapInfoHeaderGenerated();
 
1085
    virtual ~BMP_BitmapInfoHeaderGenerated();
 
1086
 
 
1087
 
 
1088
    //
 
1089
    // get and set functions
 
1090
    //
 
1091
 
 
1092
    Long getWidth(void) const {
 
1093
        return m_width;
 
1094
    }
 
1095
    void setWidth(const Long val) {
 
1096
        m_width = val;
 
1097
    }
 
1098
 
 
1099
    Long getHeight(void) const {
 
1100
        return m_height;
 
1101
    }
 
1102
    void setHeight(const Long val) {
 
1103
        m_height = val;
 
1104
    }
 
1105
 
 
1106
    Word getNumPlanes(void) const {
 
1107
        return m_numPlanes;
 
1108
    }
 
1109
    void setNumPlanes(const Word val) {
 
1110
        m_numPlanes = val;
 
1111
    }
 
1112
 
 
1113
    Word getBitsPerPixel(void) const {
 
1114
        return m_bitsPerPixel;
 
1115
    }
 
1116
    void setBitsPerPixel(const Word val) {
 
1117
        m_bitsPerPixel = val;
 
1118
    }
 
1119
 
 
1120
    DWord getCompression(void) const {
 
1121
        return m_compression;
 
1122
    }
 
1123
    void setCompression(const DWord val) {
 
1124
        m_compression = val;
 
1125
    }
 
1126
 
 
1127
    DWord getSizeImage(void) const {
 
1128
        return m_sizeImage;
 
1129
    }
 
1130
    void setSizeImage(const DWord val) {
 
1131
        m_sizeImage = val;
 
1132
    }
 
1133
 
 
1134
    Long getXPixelsPerMeter(void) const {
 
1135
        return m_xPixelsPerMeter;
 
1136
    }
 
1137
    void setXPixelsPerMeter(const Long val) {
 
1138
        m_xPixelsPerMeter = val;
 
1139
    }
 
1140
 
 
1141
    Long getYPixelsPerMeter(void) const {
 
1142
        return m_yPixelsPerMeter;
 
1143
    }
 
1144
    void setYPixelsPerMeter(const Long val) {
 
1145
        m_yPixelsPerMeter = val;
 
1146
    }
 
1147
 
 
1148
    DWord getColorsUsed(void) const {
 
1149
        return m_colorsUsed;
 
1150
    }
 
1151
    void setColorsUsed(const DWord val) {
 
1152
        m_colorsUsed = val;
 
1153
    }
 
1154
 
 
1155
    DWord getColorsImportant(void) const {
 
1156
        return m_colorsImportant;
 
1157
    }
 
1158
    void setColorsImportant(const DWord val) {
 
1159
        m_colorsImportant = val;
 
1160
    }
 
1161
};
 
1162
 
 
1163
// element of colorTable, triad of RGB
 
1164
// [PRIVATE] this is a private libmswrite class, do not use it!
 
1165
class BMP_BitmapColorIndexGenerated : public NeedsDevice
 
1166
{
 
1167
public:
 
1168
    static const int s_size = 4;
 
1169
 
 
1170
private:
 
1171
    BMP_BitmapColorIndexGenerated(const BMP_BitmapColorIndexGenerated &rhs);  //TODO: copy constructor
 
1172
 
 
1173
protected:
 
1174
    Byte m_data [4]; // raw data from .wri file
 
1175
 
 
1176
    Byte m_blue;
 
1177
    Byte m_green;
 
1178
    Byte m_red;
 
1179
    Byte m_reserved;
 
1180
 
 
1181
    BMP_BitmapColorIndexGenerated &operator= (const BMP_BitmapColorIndexGenerated &rhs);
 
1182
 
 
1183
    virtual bool verifyVariables(void);
 
1184
    virtual bool writeToArray(void);
 
1185
 
 
1186
    // no default for blue
 
1187
    // no default for green
 
1188
    // no default for red
 
1189
    static const Byte reservedDefault = Byte(0);
 
1190
 
 
1191
public:
 
1192
    // [PRIVATE] do not call!
 
1193
    virtual bool readFromDevice(void);
 
1194
    virtual bool writeToDevice(void);
 
1195
 
 
1196
    BMP_BitmapColorIndexGenerated();
 
1197
    virtual ~BMP_BitmapColorIndexGenerated();
 
1198
 
 
1199
 
 
1200
    //
 
1201
    // get and set functions
 
1202
    //
 
1203
 
 
1204
    Byte getBlue(void) const {
 
1205
        return m_blue;
 
1206
    }
 
1207
    void setBlue(const Byte val) {
 
1208
        m_blue = val;
 
1209
    }
 
1210
 
 
1211
    Byte getGreen(void) const {
 
1212
        return m_green;
 
1213
    }
 
1214
    void setGreen(const Byte val) {
 
1215
        m_green = val;
 
1216
    }
 
1217
 
 
1218
    Byte getRed(void) const {
 
1219
        return m_red;
 
1220
    }
 
1221
    void setRed(const Byte val) {
 
1222
        m_red = val;
 
1223
    }
 
1224
};
 
1225
 
 
1226
// [PRIVATE] this is a private libmswrite class, do not use it!
 
1227
class BitmapHeaderGenerated : public NeedsDevice
 
1228
{
 
1229
public:
 
1230
    static const int s_size = 14;
 
1231
 
 
1232
private:
 
1233
    BitmapHeaderGenerated(const BitmapHeaderGenerated &rhs);  //TODO: copy constructor
 
1234
 
 
1235
protected:
 
1236
    Byte m_data [14]; // raw data from .wri file
 
1237
 
 
1238
    Word m_zero;
 
1239
    Word m_width;
 
1240
    Word m_height;
 
1241
    Word m_widthBytes;
 
1242
    Byte m_numPlanes;      // always 1 for mono BMP or the entire struct is 0 for WMF
 
1243
    Byte m_bitsPerPixel;
 
1244
    DWord m_zero2;
 
1245
 
 
1246
    BitmapHeaderGenerated &operator= (const BitmapHeaderGenerated &rhs);
 
1247
 
 
1248
    virtual bool verifyVariables(void);
 
1249
    virtual bool writeToArray(void);
 
1250
 
 
1251
    static const Word zeroDefault = Word(0);
 
1252
    static const Word widthDefault = Word(0);
 
1253
    static const Word heightDefault = Word(0);
 
1254
    static const Word widthBytesDefault = Word(0);
 
1255
    static const Byte numPlanesDefault = Byte(0);
 
1256
    static const Byte bitsPerPixelDefault = Byte(0);
 
1257
    static const DWord zero2Default = DWord(0);
 
1258
 
 
1259
public:
 
1260
    // [PRIVATE] do not call!
 
1261
    virtual bool readFromDevice(void);
 
1262
    virtual bool writeToDevice(void);
 
1263
 
 
1264
    BitmapHeaderGenerated();
 
1265
    virtual ~BitmapHeaderGenerated();
 
1266
 
 
1267
 
 
1268
    //
 
1269
    // get and set functions
 
1270
    //
 
1271
 
 
1272
    Word getWidth(void) const {
 
1273
        return m_width;
 
1274
    }
 
1275
    void setWidth(const Word val) {
 
1276
        m_width = val;
 
1277
    }
 
1278
 
 
1279
    Word getHeight(void) const {
 
1280
        return m_height;
 
1281
    }
 
1282
    void setHeight(const Word val) {
 
1283
        m_height = val;
 
1284
    }
 
1285
 
 
1286
    Word getWidthBytes(void) const {
 
1287
        return m_widthBytes;
 
1288
    }
 
1289
    void setWidthBytes(const Word val) {
 
1290
        m_widthBytes = val;
 
1291
    }
 
1292
 
 
1293
    Byte getNumPlanes(void) const {
 
1294
        return m_numPlanes;
 
1295
    }
 
1296
    void setNumPlanes(const Byte val) {
 
1297
        m_numPlanes = val;
 
1298
    }
 
1299
 
 
1300
    Byte getBitsPerPixel(void) const {
 
1301
        return m_bitsPerPixel;
 
1302
    }
 
1303
    void setBitsPerPixel(const Byte val) {
 
1304
        m_bitsPerPixel = val;
 
1305
    }
 
1306
};
 
1307
 
 
1308
// 'Standard WMF' Header
 
1309
// [PRIVATE] this is a private libmswrite class, do not use it!
 
1310
class WMFHeaderGenerated : public NeedsDevice
 
1311
{
 
1312
public:
 
1313
    static const int s_size = 18;
 
1314
 
 
1315
private:
 
1316
    WMFHeaderGenerated(const WMFHeaderGenerated &rhs);  //TODO: copy constructor
 
1317
 
 
1318
protected:
 
1319
    Byte m_data [18]; // raw data from .wri file
 
1320
 
 
1321
    Word m_fieldType;      // 0=memory WMF,1=file WMF; so will never be 0
 
1322
    Word m_headerSize;     // (in Words)
 
1323
    Word m_winVersion;     // correct for Win>=3.0
 
1324
    DWord m_fileSize;      // (in Words)
 
1325
    Word m_numObjects;     // ?
 
1326
    DWord m_maxRecordSize;    // (in Words)
 
1327
    Word m_zero;
 
1328
 
 
1329
    WMFHeaderGenerated &operator= (const WMFHeaderGenerated &rhs);
 
1330
 
 
1331
    virtual bool verifyVariables(void);
 
1332
    virtual bool writeToArray(void);
 
1333
 
 
1334
    static const Word fieldTypeDefault = Word(1);
 
1335
    static const Word headerSizeDefault = Word(9);
 
1336
    static const Word winVersionDefault = Word(0x0300);
 
1337
    // no default for fileSize
 
1338
    static const Word numObjectsDefault = Word(0);
 
1339
    // no default for maxRecordSize
 
1340
    static const Word zeroDefault = Word(0);
 
1341
 
 
1342
public:
 
1343
    // [PRIVATE] do not call!
 
1344
    virtual bool readFromDevice(void);
 
1345
    virtual bool writeToDevice(void);
 
1346
 
 
1347
    WMFHeaderGenerated();
 
1348
    virtual ~WMFHeaderGenerated();
 
1349
 
 
1350
 
 
1351
    //
 
1352
    // get and set functions
 
1353
    //
 
1354
 
 
1355
    DWord getFileSize(void) const {
 
1356
        return m_fileSize;
 
1357
    }
 
1358
    void setFileSize(const DWord val) {
 
1359
        m_fileSize = val;
 
1360
    }
 
1361
 
 
1362
    DWord getMaxRecordSize(void) const {
 
1363
        return m_maxRecordSize;
 
1364
    }
 
1365
    void setMaxRecordSize(const DWord val) {
 
1366
        m_maxRecordSize = val;
 
1367
    }
 
1368
};
 
1369
 
 
1370
class BitmapHeader;
 
1371
class ImageGenerated : public NeedsDevice
 
1372
{
 
1373
public:
 
1374
    static const int s_size = 40;
 
1375
 
 
1376
private:
 
1377
    ImageGenerated(const ImageGenerated &rhs);  //TODO: copy constructor
 
1378
 
 
1379
protected:
 
1380
    Byte m_data [40]; // raw data from .wri file
 
1381
 
 
1382
    // - - - METAFILEPICT begin - - -
 
1383
 
 
1384
    Word m_mappingMode;     // type of image: 0xE3 for mono bitmap, != 0xE3 for WMF (usually 0x88)
 
1385
    Word m_MFP_width;
 
1386
    Word m_MFP_height;
 
1387
    Word m_MFP_unknown;
 
1388
 
 
1389
    // - - - METAFILEPICT end - - -
 
1390
 
 
1391
    Word m_indent;       // horizontal position from left margin
 
1392
    Word m_width;       // WMF width only, use m_bmh for bitmaps
 
1393
    Word m_height;       // WMF height only, use m_bmh for bitmaps
 
1394
    Word m_zero;       // ??? varies too much, default to 0
 
1395
 
 
1396
    BitmapHeader *m_bmh;     // only valid for mono BMPs i.e. when mappingMode == 0xe3
 
1397
 
 
1398
    Word m_numHeaderBytes;    // size of this header? (why isn't it the first element?)
 
1399
    DWord m_numDataBytes;    // number of image bytes
 
1400
    Word m_horizontalScalingRel1000; // horizontal scaling (/1000)*100% (BMPs only)
 
1401
    Word m_verticalScalingRel1000; // vertical scaling (/1000)*100% (BMPs only)
 
1402
 
 
1403
    // - - - Followed by either a strangely packed monochrome bitmap or a Standard WMF (with WMFHeader, of course) - - -
 
1404
 
 
1405
    ImageGenerated &operator= (const ImageGenerated &rhs);
 
1406
 
 
1407
    virtual bool verifyVariables(void);
 
1408
    virtual bool writeToArray(void);
 
1409
 
 
1410
    // no default for mappingMode
 
1411
    // no default for MFP_width
 
1412
    // no default for MFP_height
 
1413
    static const Word MFP_unknownDefault = Word(0);
 
1414
    static const Word indentDefault = Word(0);
 
1415
    // no default for width
 
1416
    // no default for height
 
1417
    static const Word zeroDefault = Word(0);
 
1418
    // no default for bmh
 
1419
    static const Word numHeaderBytesDefault = Word(s_size);
 
1420
    // no default for numDataBytes
 
1421
    static const Word horizontalScalingRel1000Default = Word(1000);
 
1422
    static const Word verticalScalingRel1000Default = Word(1000);
 
1423
 
 
1424
public:
 
1425
    // [PRIVATE] do not call!
 
1426
    virtual bool readFromDevice(void);
 
1427
    virtual bool writeToDevice(void);
 
1428
 
 
1429
    ImageGenerated();
 
1430
    virtual ~ImageGenerated();
 
1431
 
 
1432
 
 
1433
    //
 
1434
    // get and set functions
 
1435
    //
 
1436
 
 
1437
    Word getIndent(void) const {
 
1438
        return m_indent;
 
1439
    }
 
1440
    void setIndent(const Word val) {
 
1441
        m_indent = val;
 
1442
    }
 
1443
 
 
1444
    // [PRIVATE] these are private libmswrite methods, do not call them!
 
1445
    Word getNumHeaderBytes(void) const {
 
1446
        return m_numHeaderBytes;
 
1447
    }
 
1448
    void setNumHeaderBytes(const Word val) {
 
1449
        m_numHeaderBytes = val;
 
1450
    }
 
1451
 
 
1452
    // [PRIVATE] these are private libmswrite methods, do not call them!
 
1453
    DWord getNumDataBytes(void) const {
 
1454
        return m_numDataBytes;
 
1455
    }
 
1456
    void setNumDataBytes(const DWord val) {
 
1457
        m_numDataBytes = val;
 
1458
    }
 
1459
};
 
1460
 
 
1461
class OLEGenerated : public NeedsDevice
 
1462
{
 
1463
public:
 
1464
    static const int s_size = 40;
 
1465
 
 
1466
private:
 
1467
    OLEGenerated(const OLEGenerated &rhs);  //TODO: copy constructor
 
1468
 
 
1469
protected:
 
1470
    Byte m_data [40]; // raw data from .wri file
 
1471
 
 
1472
    Word m_mappingMode;
 
1473
    DWord m_zero;
 
1474
    Word m_objectType;     // 1=static, 2=embedded, 3=link
 
1475
 
 
1476
    Word m_indent;       // horizontal position from left margin
 
1477
    Word m_width;
 
1478
    Word m_height;
 
1479
    Word m_zero2;
 
1480
    DWord m_numDataBytes;    // number of OLE bytes
 
1481
    DWord m_zero3;
 
1482
    DWord m_objectName;     // name of the object in hex
 
1483
    Word m_zero4;
 
1484
    Word m_numHeaderBytes;    // size of this header
 
1485
    DWord m_zero5;
 
1486
    Word m_widthScaledRel1000;   // horizontal scaling (/1000)*100% (same as Image?)
 
1487
    Word m_heightScaledRel1000;  // vertical scaling (/1000)*100% (same as Image?)
 
1488
 
 
1489
    // - - - Followed by OLE data - - -
 
1490
 
 
1491
    OLEGenerated &operator= (const OLEGenerated &rhs);
 
1492
 
 
1493
    virtual bool verifyVariables(void);
 
1494
    virtual bool writeToArray(void);
 
1495
 
 
1496
    // no default for mappingMode
 
1497
    static const DWord zeroDefault = DWord(0);
 
1498
    // no default for objectType
 
1499
    // no default for indent
 
1500
    // no default for width
 
1501
    // no default for height
 
1502
    static const Word zero2Default = Word(0);
 
1503
    // no default for numDataBytes
 
1504
    static const DWord zero3Default = DWord(0);
 
1505
    // no default for objectName
 
1506
    static const Word zero4Default = Word(0);
 
1507
    // no default for numHeaderBytes
 
1508
    static const DWord zero5Default = DWord(0);
 
1509
    // no default for widthScaledRel1000
 
1510
    // no default for heightScaledRel1000
 
1511
 
 
1512
public:
 
1513
    // [PRIVATE] do not call!
 
1514
    virtual bool readFromDevice(void);
 
1515
    virtual bool writeToDevice(void);
 
1516
 
 
1517
    OLEGenerated();
 
1518
    virtual ~OLEGenerated();
 
1519
 
 
1520
 
 
1521
    //
 
1522
    // get and set functions
 
1523
    //
 
1524
 
 
1525
    Word getObjectType(void) const {
 
1526
        return m_objectType;
 
1527
    }
 
1528
    void setObjectType(const Word val) {
 
1529
        m_objectType = val;
 
1530
    }
 
1531
 
 
1532
    Word getIndent(void) const {
 
1533
        return m_indent;
 
1534
    }
 
1535
    void setIndent(const Word val) {
 
1536
        m_indent = val;
 
1537
    }
 
1538
 
 
1539
    Word getWidth(void) const {
 
1540
        return m_width;
 
1541
    }
 
1542
    void setWidth(const Word val) {
 
1543
        m_width = val;
 
1544
    }
 
1545
 
 
1546
    Word getHeight(void) const {
 
1547
        return m_height;
 
1548
    }
 
1549
    void setHeight(const Word val) {
 
1550
        m_height = val;
 
1551
    }
 
1552
 
 
1553
    // [PRIVATE] these are private libmswrite methods, do not call them!
 
1554
    DWord getNumDataBytes(void) const {
 
1555
        return m_numDataBytes;
 
1556
    }
 
1557
    void setNumDataBytes(const DWord val) {
 
1558
        m_numDataBytes = val;
 
1559
    }
 
1560
 
 
1561
    DWord getObjectName(void) const {
 
1562
        return m_objectName;
 
1563
    }
 
1564
    void setObjectName(const DWord val) {
 
1565
        m_objectName = val;
 
1566
    }
 
1567
 
 
1568
    Word getWidthScaledRel1000(void) const {
 
1569
        return m_widthScaledRel1000;
 
1570
    }
 
1571
    void setWidthScaledRel1000(const Word val) {
 
1572
        m_widthScaledRel1000 = val;
 
1573
    }
 
1574
 
 
1575
    Word getHeightScaledRel1000(void) const {
 
1576
        return m_heightScaledRel1000;
 
1577
    }
 
1578
    void setHeightScaledRel1000(const Word val) {
 
1579
        m_heightScaledRel1000 = val;
 
1580
    }
 
1581
};
 
1582
} // namespace MSWrite {
 
1583
 
 
1584
#endif // __STRUCTURES_GENERATED_H__
1309
1585
 
1310
1586
// end of structures_generated.h