filters

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