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.
49
// Redistribution and use in source and binary forms, with or without
50
// modification, are permitted provided that the following conditions
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.
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.
70
// LibMSWrite Project Website:
71
// http://sourceforge.net/projects/libmswrite/
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.
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).
90
// type #IMPLIED "Word"
91
// default #IMPLIED ""
92
// description #IMPLIED "" (also valid for Structures)
94
// failVerify #IMPLIED "InvalidFormat"
96
// useThisMuch #IMPLIED "0"
97
// provideMethod #IMPLIED "0"
98
// protected #IMPLIED "0" (also valid for Structures)
100
// All structure names will be automatically postfixed with "Generated".
101
// Derive structures from "Generated" structures (in structures*.cpp) e.g.
103
// class Header : public HeaderGenerated
107
// All fields will be automatically prefixed with "m_" to signify that
108
// they are member variables.
110
// Note that there are some limitations with make_structures_generated,
113
// * any field of type Bit, must have
116
// - may not cross a byte boundary!
118
// Write file header (mostly from wotsit)
119
// [PRIVATE] this is a private libmswrite class, do not use it!
120
class HeaderGenerated : public NeedsDevice
123
static const int s_size = 98;
126
HeaderGenerated (const HeaderGenerated &rhs); //TODO: copy constructor
129
Byte m_data [98]; // raw data from .wri file
131
Word m_magic; // must be 0xBE31 (v3.0) or 0xBE32 (v3.1 because the file contains OLE)
133
Word m_magic2; // Magic number2 (must be 0xAB00)
135
DWord m_numCharBytesPlus128; // #bytes of text,images & OLE (starting from Byte 128/Page 1)
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;
143
Word m_numPages; // (where a page is 128 bytes)
145
HeaderGenerated &operator= (const HeaderGenerated &rhs);
147
virtual bool verifyVariables (void);
148
virtual bool writeToArray (void);
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
165
// [PRIVATE] do not call!
166
virtual bool readFromDevice (void);
167
virtual bool writeToDevice (void);
170
virtual ~HeaderGenerated ();
174
// get and set functions
177
Word getMagic (void) const { return m_magic; }
178
void setMagic (const Word val) { m_magic = val; }
180
Word getPageParaInfo (void) const { return m_pageParaInfo; }
181
void setPageParaInfo (const Word val) { m_pageParaInfo = val; }
183
Word getPageFootnoteTable (void) const { return m_pageFootnoteTable; }
184
void setPageFootnoteTable (const Word val) { m_pageFootnoteTable = val; }
186
Word getPageSectionProperty (void) const { return m_pageSectionProperty; }
187
void setPageSectionProperty (const Word val) { m_pageSectionProperty = val; }
189
Word getPageSectionTable (void) const { return m_pageSectionTable; }
190
void setPageSectionTable (const Word val) { m_pageSectionTable = val; }
192
Word getPagePageTable (void) const { return m_pagePageTable; }
193
void setPagePageTable (const Word val) { m_pagePageTable = val; }
195
Word getPageFontTable (void) const { return m_pageFontTable; }
196
void setPageFontTable (const Word val) { m_pageFontTable = val; }
198
Word getNumPages (void) const { return m_numPages; }
199
void setNumPages (const Word val) { m_numPages = val; }
202
// Page layout information (margins, dimensions, ...)
203
class PageLayoutGenerated : public NeedsDevice
206
static const int s_size = 33;
209
PageLayoutGenerated (const PageLayoutGenerated &rhs); //TODO: copy constructor
212
Byte m_data [33]; // raw data from .wri file
214
Byte m_magic102; // =102?
215
Word m_magic512; // =512?
218
Word m_pageNumberStart; // start counting page numbers from this value (0xFFFF means ignore, set to 1 I guess)
224
Word m_magic256; // =256?
226
Word m_headerFromTop; // distance header is from top of page
227
Word m_footerFromTop; // distance footer is from top of page
229
Word m_magic720; // 720
231
Word m_magic1080; // 1080
232
Word m_unknown; // ? (let's not be random and default to 0)
235
PageLayoutGenerated &operator= (const PageLayoutGenerated &rhs);
237
virtual bool verifyVariables (void);
238
virtual bool writeToArray (void);
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);
259
// [PRIVATE] do not call!
260
virtual bool readFromDevice (void);
261
virtual bool writeToDevice (void);
263
PageLayoutGenerated ();
264
virtual ~PageLayoutGenerated ();
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
273
static const int s_size = 10;
276
SectionDescriptorGenerated (const SectionDescriptorGenerated &rhs); //TODO: copy constructor
279
Byte m_data [10]; // raw data from .wri file
281
DWord m_afterEndCharByte; // byte of character just after end of section
283
DWord m_sectionPropertyLocation; // byte address of corresponding sectionProperty (I call it a "Page Layout" which is more obvious IMHO)
285
SectionDescriptorGenerated &operator= (const SectionDescriptorGenerated &rhs);
287
virtual bool verifyVariables (void);
288
virtual bool writeToArray (void);
290
// no default for afterEndCharByte
291
static const Word undefinedDefault = Word (0);
292
// no default for sectionPropertyLocation
295
// [PRIVATE] do not call!
296
virtual bool readFromDevice (void);
297
virtual bool writeToDevice (void);
299
SectionDescriptorGenerated ();
300
virtual ~SectionDescriptorGenerated ();
304
// get and set functions
307
DWord getAfterEndCharByte (void) const { return m_afterEndCharByte; }
308
void setAfterEndCharByte (const DWord val) { m_afterEndCharByte = val; }
310
DWord getSectionPropertyLocation (void) const { return m_sectionPropertyLocation; }
311
void setSectionPropertyLocation (const DWord val) { m_sectionPropertyLocation = val; }
315
class SectionDescriptor;
316
// [PRIVATE] this is a private libmswrite class, do not use it!
317
class SectionTableGenerated : public NeedsDevice
320
static const int s_size = 24;
323
SectionTableGenerated (const SectionTableGenerated &rhs); //TODO: copy constructor
326
Byte m_data [24]; // raw data from .wri file
328
Word m_numSectionDescriptors;
330
SectionDescriptor *m_sed [2];
332
SectionTableGenerated &operator= (const SectionTableGenerated &rhs);
334
virtual bool verifyVariables (void);
335
virtual bool writeToArray (void);
337
static const Word numSectionDescriptorsDefault = Word (2);
338
static const Word undefinedDefault = Word (0);
339
// no default for sed
342
// [PRIVATE] do not call!
343
virtual bool readFromDevice (void);
344
virtual bool writeToDevice (void);
346
SectionTableGenerated ();
347
virtual ~SectionTableGenerated ();
351
class FontGenerated : public NeedsDevice
354
static const int s_size = 3;
357
FontGenerated (const FontGenerated &rhs); //TODO: copy constructor
360
Byte m_data [3]; // raw data from .wri file
362
Word m_numDataBytes; // number of bytes that follow
365
// - - - followed by Byte *fontName - - -
367
FontGenerated &operator= (const FontGenerated &rhs);
369
virtual bool verifyVariables (void);
370
virtual bool writeToArray (void);
372
static const Word numDataBytesDefault = Word (0);
373
static const Byte familyDefault = Byte (0);
376
// [PRIVATE] do not call!
377
virtual bool readFromDevice (void);
378
virtual bool writeToDevice (void);
381
virtual ~FontGenerated ();
385
// get and set functions
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; }
392
Byte getFamily (void) const { return m_family; }
393
void setFamily (const Byte val) { m_family = val; }
396
// [PRIVATE] this is a private libmswrite class, do not use it!
397
class FontTableGenerated : public NeedsDevice
400
static const int s_size = 2;
403
FontTableGenerated (const FontTableGenerated &rhs); //TODO: copy constructor
406
Byte m_data [2]; // raw data from .wri file
410
// - - - followed by a list of Font(s) - - -
412
FontTableGenerated &operator= (const FontTableGenerated &rhs);
414
virtual bool verifyVariables (void);
415
virtual bool writeToArray (void);
417
static const Word numFontsDefault = Word (0);
420
// [PRIVATE] do not call!
421
virtual bool readFromDevice (void);
422
virtual bool writeToDevice (void);
424
FontTableGenerated ();
425
virtual ~FontTableGenerated ();
429
// get and set functions
432
Word getNumFonts (void) const { return m_numFonts; }
433
void setNumFonts (const Word val) { m_numFonts = val; }
436
// [PRIVATE] this is a private libmswrite class, do not use it!
437
class PagePointerGenerated : public NeedsDevice
440
static const int s_size = 6;
443
PagePointerGenerated (const PagePointerGenerated &rhs); //TODO: copy constructor
446
Byte m_data [6]; // raw data from .wri file
449
DWord m_firstCharByte; // first character on page
451
PagePointerGenerated &operator= (const PagePointerGenerated &rhs);
453
virtual bool verifyVariables (void);
454
virtual bool writeToArray (void);
456
// no default for pageNumber
457
// no default for firstCharByte
460
// [PRIVATE] do not call!
461
virtual bool readFromDevice (void);
462
virtual bool writeToDevice (void);
464
PagePointerGenerated ();
465
virtual ~PagePointerGenerated ();
469
// get and set functions
472
Word getPageNumber (void) const { return m_pageNumber; }
473
void setPageNumber (const Word val) { m_pageNumber = val; }
475
DWord getFirstCharByte (void) const { return m_firstCharByte; }
476
void setFirstCharByte (const DWord val) { m_firstCharByte = val; }
479
// File/Repaginate function
480
// [PRIVATE] this is a private libmswrite class, do not use it!
481
class PageTableGenerated : public NeedsDevice
484
static const int s_size = 4;
487
PageTableGenerated (const PageTableGenerated &rhs); //TODO: copy constructor
490
Byte m_data [4]; // raw data from .wri file
492
Word m_numPagePointers;
495
// - - - followed by a list of PagePointer(s) - - -
497
PageTableGenerated &operator= (const PageTableGenerated &rhs);
499
virtual bool verifyVariables (void);
500
virtual bool writeToArray (void);
502
static const Word numPagePointersDefault = Word (0);
503
static const Word zeroDefault = Word (0);
506
// [PRIVATE] do not call!
507
virtual bool readFromDevice (void);
508
virtual bool writeToDevice (void);
510
PageTableGenerated ();
511
virtual ~PageTableGenerated ();
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
520
static const int s_size = 6;
523
FormatPointerGenerated (const FormatPointerGenerated &rhs); //TODO: copy constructor
526
Byte m_data [6]; // raw data from .wri file
528
DWord m_afterEndCharBytePlus128; // last character it points to + 1
529
Word m_formatPropertyOffset; // location of relevant FormatProperty (or 0xFFFF for defaults)
531
FormatPointerGenerated &operator= (const FormatPointerGenerated &rhs);
533
virtual bool verifyVariables (void);
534
virtual bool writeToArray (void);
536
// no default for afterEndCharBytePlus128
537
// no default for formatPropertyOffset
540
// [PRIVATE] do not call!
541
virtual bool readFromDevice (void);
542
virtual bool writeToDevice (void);
544
FormatPointerGenerated ();
545
virtual ~FormatPointerGenerated ();
549
// get and set functions
552
DWord getAfterEndCharBytePlus128 (void) const { return m_afterEndCharBytePlus128; }
553
void setAfterEndCharBytePlus128 (const DWord val) { m_afterEndCharBytePlus128 = val; }
555
Word getFormatPropertyOffset (void) const { return m_formatPropertyOffset; }
556
void setFormatPropertyOffset (const Word val) { m_formatPropertyOffset = val; }
559
// Character Properties
560
class FormatCharPropertyGenerated : public NeedsDevice, public UseThisMuch
563
static const int s_size = 7;
566
FormatCharPropertyGenerated (const FormatCharPropertyGenerated &rhs); //TODO: copy constructor
569
Byte m_data [7]; // raw data from .wri file
572
Byte m_numDataBytes; // number of bytes that follow
575
Byte m_unknown; // =0? or =1?
578
unsigned m_isBold : 1;
579
unsigned m_isItalic : 1;
580
unsigned m_fontCodeLow : 6;
583
Byte m_fontSize; // half the fontSize?
586
unsigned m_isUnderlined : 1;
588
unsigned m_isPageNumber : 1; // seems to be set for '(page)' number variables - only in headers/footers?
589
unsigned m_zero2 : 1;
592
unsigned m_fontCodeHigh : 3; // not sure if this is true
593
unsigned m_zero3 : 5;
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)
598
FormatCharPropertyGenerated &operator= (const FormatCharPropertyGenerated &rhs);
600
Word getNumDataBytes (void) const { return UseThisMuch::getNeedNumDataBytes (); }
601
// note: you cannot set numDataBytes
602
void updateNumDataBytes (void) { m_numDataBytes = UseThisMuch::getNeedNumDataBytes (); }
604
virtual bool verifyVariables (void);
605
virtual bool writeToArray (void);
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);
622
// [PRIVATE] do not call!
623
virtual bool readFromDevice (void);
624
virtual bool writeToDevice (void);
626
FormatCharPropertyGenerated ();
627
virtual ~FormatCharPropertyGenerated ();
631
// get and set functions
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*/); }
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*/); }
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*/); }
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*/); }
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*/); }
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*/); }
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*/); }
659
// Paragraph Tabulator(s) Properties
660
class FormatParaPropertyTabulatorGenerated : public NeedsDevice
663
static const int s_size = 4;
666
FormatParaPropertyTabulatorGenerated (const FormatParaPropertyTabulatorGenerated &rhs); //TODO: copy constructor
669
Byte m_data [4]; // raw data from .wri file
672
Byte m_type; // 0=normal,3=decimal...all that the GUI allows
675
FormatParaPropertyTabulatorGenerated &operator= (const FormatParaPropertyTabulatorGenerated &rhs);
677
virtual bool verifyVariables (void);
678
virtual bool writeToArray (void);
680
static const Word indentDefault = Word (0);
681
static const Byte typeDefault = Byte (0);
682
static const Byte zeroDefault = Byte (0);
685
// [PRIVATE] do not call!
686
virtual bool readFromDevice (void);
687
virtual bool writeToDevice (void);
689
FormatParaPropertyTabulatorGenerated ();
690
virtual ~FormatParaPropertyTabulatorGenerated ();
694
// get and set functions
697
Word getIndent (void) const { return m_indent; }
698
void setIndent (const Word val) { m_indent = val; }
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; }
705
// Paragraph Properties
706
class FormatParaPropertyTabulator;
707
class FormatParaPropertyGenerated : public NeedsDevice, public UseThisMuch
710
static const int s_size = 79;
713
FormatParaPropertyGenerated (const FormatParaPropertyGenerated &rhs); //TODO: copy constructor
716
Byte m_data [79]; // raw data from .wri file
718
Byte m_numDataBytes; // number of bytes that follow
719
Byte m_magic0_60_or_61; // =0? =60? =61? 60 is the most common
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?
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;
736
FormatParaPropertyTabulator *m_tab [14];
738
FormatParaPropertyGenerated &operator= (const FormatParaPropertyGenerated &rhs);
740
Word getNumDataBytes (void) const { return UseThisMuch::getNeedNumDataBytes (); }
741
// note: you cannot set numDataBytes
742
void updateNumDataBytes (void) { m_numDataBytes = UseThisMuch::getNeedNumDataBytes (); }
744
virtual bool verifyVariables (void);
745
virtual bool writeToArray (void);
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
765
// [PRIVATE] do not call!
766
virtual bool readFromDevice (void);
767
virtual bool writeToDevice (void);
769
FormatParaPropertyGenerated ();
770
virtual ~FormatParaPropertyGenerated ();
774
// get and set functions
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*/); }
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*/); }
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*/); }
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*/); }
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*/); }
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*/); }
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*/); }
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*/); }
802
// [PRIVATE] this is a private libmswrite class, do not use it!
803
class FormatInfoPageGenerated : public NeedsDevice
806
static const int s_size = 128;
809
FormatInfoPageGenerated (const FormatInfoPageGenerated &rhs); //TODO: copy constructor
812
Byte m_data [128]; // raw data from .wri file
814
DWord m_firstCharBytePlus128;
815
Byte m_packedStructs [123]; // array of FormatPointers and FormatCharProperties/FormatParaProperties
816
Byte m_numFormatPointers;
818
FormatInfoPageGenerated &operator= (const FormatInfoPageGenerated &rhs);
820
virtual bool verifyVariables (void);
821
virtual bool writeToArray (void);
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);
828
// [PRIVATE] do not call!
829
virtual bool readFromDevice (void);
830
virtual bool writeToDevice (void);
832
FormatInfoPageGenerated ();
833
virtual ~FormatInfoPageGenerated ();
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
842
static const int s_size = 14;
845
BMP_BitmapFileHeaderGenerated (const BMP_BitmapFileHeaderGenerated &rhs); //TODO: copy constructor
848
Byte m_data [14]; // raw data from .wri file
853
DWord m_actualImageOffset;
855
BMP_BitmapFileHeaderGenerated &operator= (const BMP_BitmapFileHeaderGenerated &rhs);
857
virtual bool verifyVariables (void);
858
virtual bool writeToArray (void);
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
866
// [PRIVATE] do not call!
867
virtual bool readFromDevice (void);
868
virtual bool writeToDevice (void);
870
BMP_BitmapFileHeaderGenerated ();
871
virtual ~BMP_BitmapFileHeaderGenerated ();
875
// get and set functions
878
DWord getTotalBytes (void) const { return m_totalBytes; }
879
void setTotalBytes (const DWord val) { m_totalBytes = val; }
881
DWord getActualImageOffset (void) const { return m_actualImageOffset; }
882
void setActualImageOffset (const DWord val) { m_actualImageOffset = val; }
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
890
static const int s_size = 40;
893
BMP_BitmapInfoHeaderGenerated (const BMP_BitmapInfoHeaderGenerated &rhs); //TODO: copy constructor
896
Byte m_data [40]; // raw data from .wri file
898
DWord m_numHeaderBytes;
901
Word m_numPlanes; // always==1
905
Long m_xPixelsPerMeter;
906
Long m_yPixelsPerMeter;
908
DWord m_colorsImportant;
910
BMP_BitmapInfoHeaderGenerated &operator= (const BMP_BitmapInfoHeaderGenerated &rhs);
912
virtual bool verifyVariables (void);
913
virtual bool writeToArray (void);
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
928
// [PRIVATE] do not call!
929
virtual bool readFromDevice (void);
930
virtual bool writeToDevice (void);
932
BMP_BitmapInfoHeaderGenerated ();
933
virtual ~BMP_BitmapInfoHeaderGenerated ();
937
// get and set functions
940
Long getWidth (void) const { return m_width; }
941
void setWidth (const Long val) { m_width = val; }
943
Long getHeight (void) const { return m_height; }
944
void setHeight (const Long val) { m_height = val; }
946
Word getNumPlanes (void) const { return m_numPlanes; }
947
void setNumPlanes (const Word val) { m_numPlanes = val; }
949
Word getBitsPerPixel (void) const { return m_bitsPerPixel; }
950
void setBitsPerPixel (const Word val) { m_bitsPerPixel = val; }
952
DWord getCompression (void) const { return m_compression; }
953
void setCompression (const DWord val) { m_compression = val; }
955
DWord getSizeImage (void) const { return m_sizeImage; }
956
void setSizeImage (const DWord val) { m_sizeImage = val; }
958
Long getXPixelsPerMeter (void) const { return m_xPixelsPerMeter; }
959
void setXPixelsPerMeter (const Long val) { m_xPixelsPerMeter = val; }
961
Long getYPixelsPerMeter (void) const { return m_yPixelsPerMeter; }
962
void setYPixelsPerMeter (const Long val) { m_yPixelsPerMeter = val; }
964
DWord getColorsUsed (void) const { return m_colorsUsed; }
965
void setColorsUsed (const DWord val) { m_colorsUsed = val; }
967
DWord getColorsImportant (void) const { return m_colorsImportant; }
968
void setColorsImportant (const DWord val) { m_colorsImportant = val; }
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
976
static const int s_size = 4;
979
BMP_BitmapColorIndexGenerated (const BMP_BitmapColorIndexGenerated &rhs); //TODO: copy constructor
982
Byte m_data [4]; // raw data from .wri file
989
BMP_BitmapColorIndexGenerated &operator= (const BMP_BitmapColorIndexGenerated &rhs);
991
virtual bool verifyVariables (void);
992
virtual bool writeToArray (void);
994
// no default for blue
995
// no default for green
996
// no default for red
997
static const Byte reservedDefault = Byte (0);
1000
// [PRIVATE] do not call!
1001
virtual bool readFromDevice (void);
1002
virtual bool writeToDevice (void);
1004
BMP_BitmapColorIndexGenerated ();
1005
virtual ~BMP_BitmapColorIndexGenerated ();
1009
// get and set functions
1012
Byte getBlue (void) const { return m_blue; }
1013
void setBlue (const Byte val) { m_blue = val; }
1015
Byte getGreen (void) const { return m_green; }
1016
void setGreen (const Byte val) { m_green = val; }
1018
Byte getRed (void) const { return m_red; }
1019
void setRed (const Byte val) { m_red = val; }
1022
// [PRIVATE] this is a private libmswrite class, do not use it!
1023
class BitmapHeaderGenerated : public NeedsDevice
1026
static const int s_size = 14;
1029
BitmapHeaderGenerated (const BitmapHeaderGenerated &rhs); //TODO: copy constructor
1032
Byte m_data [14]; // raw data from .wri file
1038
Byte m_numPlanes; // always 1 for mono BMP or the entire struct is 0 for WMF
1039
Byte m_bitsPerPixel;
1042
BitmapHeaderGenerated &operator= (const BitmapHeaderGenerated &rhs);
1044
virtual bool verifyVariables (void);
1045
virtual bool writeToArray (void);
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);
1056
// [PRIVATE] do not call!
1057
virtual bool readFromDevice (void);
1058
virtual bool writeToDevice (void);
1060
BitmapHeaderGenerated ();
1061
virtual ~BitmapHeaderGenerated ();
1065
// get and set functions
1068
Word getWidth (void) const { return m_width; }
1069
void setWidth (const Word val) { m_width = val; }
1071
Word getHeight (void) const { return m_height; }
1072
void setHeight (const Word val) { m_height = val; }
1074
Word getWidthBytes (void) const { return m_widthBytes; }
1075
void setWidthBytes (const Word val) { m_widthBytes = val; }
1077
Byte getNumPlanes (void) const { return m_numPlanes; }
1078
void setNumPlanes (const Byte val) { m_numPlanes = val; }
1080
Byte getBitsPerPixel (void) const { return m_bitsPerPixel; }
1081
void setBitsPerPixel (const Byte val) { m_bitsPerPixel = val; }
1084
// 'Standard WMF' Header
1085
// [PRIVATE] this is a private libmswrite class, do not use it!
1086
class WMFHeaderGenerated : public NeedsDevice
1089
static const int s_size = 18;
1092
WMFHeaderGenerated (const WMFHeaderGenerated &rhs); //TODO: copy constructor
1095
Byte m_data [18]; // raw data from .wri file
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)
1105
WMFHeaderGenerated &operator= (const WMFHeaderGenerated &rhs);
1107
virtual bool verifyVariables (void);
1108
virtual bool writeToArray (void);
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);
1119
// [PRIVATE] do not call!
1120
virtual bool readFromDevice (void);
1121
virtual bool writeToDevice (void);
1123
WMFHeaderGenerated ();
1124
virtual ~WMFHeaderGenerated ();
1128
// get and set functions
1131
DWord getFileSize (void) const { return m_fileSize; }
1132
void setFileSize (const DWord val) { m_fileSize = val; }
1134
DWord getMaxRecordSize (void) const { return m_maxRecordSize; }
1135
void setMaxRecordSize (const DWord val) { m_maxRecordSize = val; }
1139
class ImageGenerated : public NeedsDevice
1142
static const int s_size = 40;
1145
ImageGenerated (const ImageGenerated &rhs); //TODO: copy constructor
1148
Byte m_data [40]; // raw data from .wri file
1150
// - - - METAFILEPICT begin - - -
1152
Word m_mappingMode; // type of image: 0xE3 for mono bitmap, != 0xE3 for WMF (usually 0x88)
1157
// - - - METAFILEPICT end - - -
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
1164
BitmapHeader *m_bmh; // only valid for mono BMPs i.e. when mappingMode == 0xe3
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)
1171
// - - - Followed by either a strangely packed monochrome bitmap or a Standard WMF (with WMFHeader, of course) - - -
1173
ImageGenerated &operator= (const ImageGenerated &rhs);
1175
virtual bool verifyVariables (void);
1176
virtual bool writeToArray (void);
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);
1193
// [PRIVATE] do not call!
1194
virtual bool readFromDevice (void);
1195
virtual bool writeToDevice (void);
1198
virtual ~ImageGenerated ();
1202
// get and set functions
1205
Word getIndent (void) const { return m_indent; }
1206
void setIndent (const Word val) { m_indent = val; }
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; }
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; }
1217
class OLEGenerated : public NeedsDevice
1220
static const int s_size = 40;
1223
OLEGenerated (const OLEGenerated &rhs); //TODO: copy constructor
1226
Byte m_data [40]; // raw data from .wri file
1230
Word m_objectType; // 1=static, 2=embedded, 3=link
1232
Word m_indent; // horizontal position from left margin
1236
DWord m_numDataBytes; // number of OLE bytes
1238
DWord m_objectName; // name of the object in hex
1240
Word m_numHeaderBytes; // size of this header
1242
Word m_widthScaledRel1000; // horizontal scaling (/1000)*100% (same as Image?)
1243
Word m_heightScaledRel1000; // vertical scaling (/1000)*100% (same as Image?)
1245
// - - - Followed by OLE data - - -
1247
OLEGenerated &operator= (const OLEGenerated &rhs);
1249
virtual bool verifyVariables (void);
1250
virtual bool writeToArray (void);
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
1269
// [PRIVATE] do not call!
1270
virtual bool readFromDevice (void);
1271
virtual bool writeToDevice (void);
1274
virtual ~OLEGenerated ();
1278
// get and set functions
1281
Word getObjectType (void) const { return m_objectType; }
1282
void setObjectType (const Word val) { m_objectType = val; }
1284
Word getIndent (void) const { return m_indent; }
1285
void setIndent (const Word val) { m_indent = val; }
1287
Word getWidth (void) const { return m_width; }
1288
void setWidth (const Word val) { m_width = val; }
1290
Word getHeight (void) const { return m_height; }
1291
void setHeight (const Word val) { m_height = val; }
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; }
1297
DWord getObjectName (void) const { return m_objectName; }
1298
void setObjectName (const DWord val) { m_objectName = val; }
1300
Word getWidthScaledRel1000 (void) const { return m_widthScaledRel1000; }
1301
void setWidthScaledRel1000 (const Word val) { m_widthScaledRel1000 = val; }
1303
Word getHeightScaledRel1000 (void) const { return m_heightScaledRel1000; }
1304
void setHeightScaledRel1000 (const Word val) { m_heightScaledRel1000 = val; }
1306
} // namespace MSWrite {
1308
#endif // __STRUCTURES_GENERATED_H__
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.
49
// Redistribution and use in source and binary forms, with or without
50
// modification, are permitted provided that the following conditions
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.
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.
70
// LibMSWrite Project Website:
71
// http://sourceforge.net/projects/libmswrite/
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.
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).
90
// type #IMPLIED "Word"
91
// default #IMPLIED ""
92
// description #IMPLIED "" (also valid for Structures)
94
// failVerify #IMPLIED "InvalidFormat"
96
// useThisMuch #IMPLIED "0"
97
// provideMethod #IMPLIED "0"
98
// protected #IMPLIED "0" (also valid for Structures)
100
// All structure names will be automatically postfixed with "Generated".
101
// Derive structures from "Generated" structures (in structures*.cpp) e.g.
103
// class Header : public HeaderGenerated
107
// All fields will be automatically prefixed with "m_" to signify that
108
// they are member variables.
110
// Note that there are some limitations with make_structures_generated,
113
// * any field of type Bit, must have
116
// - may not cross a byte boundary!
118
// Write file header (mostly from wotsit)
119
// [PRIVATE] this is a private libmswrite class, do not use it!
120
class HeaderGenerated : public NeedsDevice
123
static const int s_size = 98;
126
HeaderGenerated(const HeaderGenerated &rhs); //TODO: copy constructor
129
Byte m_data [98]; // raw data from .wri file
131
Word m_magic; // must be 0xBE31 (v3.0) or 0xBE32 (v3.1 because the file contains OLE)
133
Word m_magic2; // Magic number2 (must be 0xAB00)
135
DWord m_numCharBytesPlus128; // #bytes of text,images & OLE (starting from Byte 128/Page 1)
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;
143
Word m_numPages; // (where a page is 128 bytes)
145
HeaderGenerated &operator= (const HeaderGenerated &rhs);
147
virtual bool verifyVariables(void);
148
virtual bool writeToArray(void);
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
165
// [PRIVATE] do not call!
166
virtual bool readFromDevice(void);
167
virtual bool writeToDevice(void);
170
virtual ~HeaderGenerated();
174
// get and set functions
177
Word getMagic(void) const {
180
void setMagic(const Word val) {
184
Word getPageParaInfo(void) const {
185
return m_pageParaInfo;
187
void setPageParaInfo(const Word val) {
188
m_pageParaInfo = val;
191
Word getPageFootnoteTable(void) const {
192
return m_pageFootnoteTable;
194
void setPageFootnoteTable(const Word val) {
195
m_pageFootnoteTable = val;
198
Word getPageSectionProperty(void) const {
199
return m_pageSectionProperty;
201
void setPageSectionProperty(const Word val) {
202
m_pageSectionProperty = val;
205
Word getPageSectionTable(void) const {
206
return m_pageSectionTable;
208
void setPageSectionTable(const Word val) {
209
m_pageSectionTable = val;
212
Word getPagePageTable(void) const {
213
return m_pagePageTable;
215
void setPagePageTable(const Word val) {
216
m_pagePageTable = val;
219
Word getPageFontTable(void) const {
220
return m_pageFontTable;
222
void setPageFontTable(const Word val) {
223
m_pageFontTable = val;
226
Word getNumPages(void) const {
229
void setNumPages(const Word val) {
234
// Page layout information (margins, dimensions, ...)
235
class PageLayoutGenerated : public NeedsDevice
238
static const int s_size = 33;
241
PageLayoutGenerated(const PageLayoutGenerated &rhs); //TODO: copy constructor
244
Byte m_data [33]; // raw data from .wri file
246
Byte m_magic102; // =102?
247
Word m_magic512; // =512?
250
Word m_pageNumberStart; // start counting page numbers from this value (0xFFFF means ignore, set to 1 I guess)
256
Word m_magic256; // =256?
258
Word m_headerFromTop; // distance header is from top of page
259
Word m_footerFromTop; // distance footer is from top of page
261
Word m_magic720; // 720
263
Word m_magic1080; // 1080
264
Word m_unknown; // ? (let's not be random and default to 0)
267
PageLayoutGenerated &operator= (const PageLayoutGenerated &rhs);
269
virtual bool verifyVariables(void);
270
virtual bool writeToArray(void);
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);
291
// [PRIVATE] do not call!
292
virtual bool readFromDevice(void);
293
virtual bool writeToDevice(void);
295
PageLayoutGenerated();
296
virtual ~PageLayoutGenerated();
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
305
static const int s_size = 10;
308
SectionDescriptorGenerated(const SectionDescriptorGenerated &rhs); //TODO: copy constructor
311
Byte m_data [10]; // raw data from .wri file
313
DWord m_afterEndCharByte; // byte of character just after end of section
315
DWord m_sectionPropertyLocation; // byte address of corresponding sectionProperty (I call it a "Page Layout" which is more obvious IMHO)
317
SectionDescriptorGenerated &operator= (const SectionDescriptorGenerated &rhs);
319
virtual bool verifyVariables(void);
320
virtual bool writeToArray(void);
322
// no default for afterEndCharByte
323
static const Word undefinedDefault = Word(0);
324
// no default for sectionPropertyLocation
327
// [PRIVATE] do not call!
328
virtual bool readFromDevice(void);
329
virtual bool writeToDevice(void);
331
SectionDescriptorGenerated();
332
virtual ~SectionDescriptorGenerated();
336
// get and set functions
339
DWord getAfterEndCharByte(void) const {
340
return m_afterEndCharByte;
342
void setAfterEndCharByte(const DWord val) {
343
m_afterEndCharByte = val;
346
DWord getSectionPropertyLocation(void) const {
347
return m_sectionPropertyLocation;
349
void setSectionPropertyLocation(const DWord val) {
350
m_sectionPropertyLocation = val;
355
class SectionDescriptor;
356
// [PRIVATE] this is a private libmswrite class, do not use it!
357
class SectionTableGenerated : public NeedsDevice
360
static const int s_size = 24;
363
SectionTableGenerated(const SectionTableGenerated &rhs); //TODO: copy constructor
366
Byte m_data [24]; // raw data from .wri file
368
Word m_numSectionDescriptors;
370
SectionDescriptor *m_sed [2];
372
SectionTableGenerated &operator= (const SectionTableGenerated &rhs);
374
virtual bool verifyVariables(void);
375
virtual bool writeToArray(void);
377
static const Word numSectionDescriptorsDefault = Word(2);
378
static const Word undefinedDefault = Word(0);
379
// no default for sed
382
// [PRIVATE] do not call!
383
virtual bool readFromDevice(void);
384
virtual bool writeToDevice(void);
386
SectionTableGenerated();
387
virtual ~SectionTableGenerated();
391
class FontGenerated : public NeedsDevice
394
static const int s_size = 3;
397
FontGenerated(const FontGenerated &rhs); //TODO: copy constructor
400
Byte m_data [3]; // raw data from .wri file
402
Word m_numDataBytes; // number of bytes that follow
405
// - - - followed by Byte *fontName - - -
407
FontGenerated &operator= (const FontGenerated &rhs);
409
virtual bool verifyVariables(void);
410
virtual bool writeToArray(void);
412
static const Word numDataBytesDefault = Word(0);
413
static const Byte familyDefault = Byte(0);
416
// [PRIVATE] do not call!
417
virtual bool readFromDevice(void);
418
virtual bool writeToDevice(void);
421
virtual ~FontGenerated();
425
// get and set functions
428
// [PRIVATE] these are private libmswrite methods, do not call them!
429
Word getNumDataBytes(void) const {
430
return m_numDataBytes;
432
void setNumDataBytes(const Word val) {
433
m_numDataBytes = val;
436
Byte getFamily(void) const {
439
void setFamily(const Byte val) {
444
// [PRIVATE] this is a private libmswrite class, do not use it!
445
class FontTableGenerated : public NeedsDevice
448
static const int s_size = 2;
451
FontTableGenerated(const FontTableGenerated &rhs); //TODO: copy constructor
454
Byte m_data [2]; // raw data from .wri file
458
// - - - followed by a list of Font(s) - - -
460
FontTableGenerated &operator= (const FontTableGenerated &rhs);
462
virtual bool verifyVariables(void);
463
virtual bool writeToArray(void);
465
static const Word numFontsDefault = Word(0);
468
// [PRIVATE] do not call!
469
virtual bool readFromDevice(void);
470
virtual bool writeToDevice(void);
472
FontTableGenerated();
473
virtual ~FontTableGenerated();
477
// get and set functions
480
Word getNumFonts(void) const {
483
void setNumFonts(const Word val) {
488
// [PRIVATE] this is a private libmswrite class, do not use it!
489
class PagePointerGenerated : public NeedsDevice
492
static const int s_size = 6;
495
PagePointerGenerated(const PagePointerGenerated &rhs); //TODO: copy constructor
498
Byte m_data [6]; // raw data from .wri file
501
DWord m_firstCharByte; // first character on page
503
PagePointerGenerated &operator= (const PagePointerGenerated &rhs);
505
virtual bool verifyVariables(void);
506
virtual bool writeToArray(void);
508
// no default for pageNumber
509
// no default for firstCharByte
512
// [PRIVATE] do not call!
513
virtual bool readFromDevice(void);
514
virtual bool writeToDevice(void);
516
PagePointerGenerated();
517
virtual ~PagePointerGenerated();
521
// get and set functions
524
Word getPageNumber(void) const {
527
void setPageNumber(const Word val) {
531
DWord getFirstCharByte(void) const {
532
return m_firstCharByte;
534
void setFirstCharByte(const DWord val) {
535
m_firstCharByte = val;
539
// File/Repaginate function
540
// [PRIVATE] this is a private libmswrite class, do not use it!
541
class PageTableGenerated : public NeedsDevice
544
static const int s_size = 4;
547
PageTableGenerated(const PageTableGenerated &rhs); //TODO: copy constructor
550
Byte m_data [4]; // raw data from .wri file
552
Word m_numPagePointers;
555
// - - - followed by a list of PagePointer(s) - - -
557
PageTableGenerated &operator= (const PageTableGenerated &rhs);
559
virtual bool verifyVariables(void);
560
virtual bool writeToArray(void);
562
static const Word numPagePointersDefault = Word(0);
563
static const Word zeroDefault = Word(0);
566
// [PRIVATE] do not call!
567
virtual bool readFromDevice(void);
568
virtual bool writeToDevice(void);
570
PageTableGenerated();
571
virtual ~PageTableGenerated();
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
580
static const int s_size = 6;
583
FormatPointerGenerated(const FormatPointerGenerated &rhs); //TODO: copy constructor
586
Byte m_data [6]; // raw data from .wri file
588
DWord m_afterEndCharBytePlus128; // last character it points to + 1
589
Word m_formatPropertyOffset; // location of relevant FormatProperty (or 0xFFFF for defaults)
591
FormatPointerGenerated &operator= (const FormatPointerGenerated &rhs);
593
virtual bool verifyVariables(void);
594
virtual bool writeToArray(void);
596
// no default for afterEndCharBytePlus128
597
// no default for formatPropertyOffset
600
// [PRIVATE] do not call!
601
virtual bool readFromDevice(void);
602
virtual bool writeToDevice(void);
604
FormatPointerGenerated();
605
virtual ~FormatPointerGenerated();
609
// get and set functions
612
DWord getAfterEndCharBytePlus128(void) const {
613
return m_afterEndCharBytePlus128;
615
void setAfterEndCharBytePlus128(const DWord val) {
616
m_afterEndCharBytePlus128 = val;
619
Word getFormatPropertyOffset(void) const {
620
return m_formatPropertyOffset;
622
void setFormatPropertyOffset(const Word val) {
623
m_formatPropertyOffset = val;
627
// Character Properties
628
class FormatCharPropertyGenerated : public NeedsDevice, public UseThisMuch
631
static const int s_size = 7;
634
FormatCharPropertyGenerated(const FormatCharPropertyGenerated &rhs); //TODO: copy constructor
637
Byte m_data [7]; // raw data from .wri file
640
Byte m_numDataBytes; // number of bytes that follow
643
Byte m_unknown; // =0? or =1?
646
unsigned m_isBold : 1;
647
unsigned m_isItalic : 1;
648
unsigned m_fontCodeLow : 6;
651
Byte m_fontSize; // half the fontSize?
654
unsigned m_isUnderlined : 1;
656
unsigned m_isPageNumber : 1; // seems to be set for '(page)' number variables - only in headers/footers?
657
unsigned m_zero2 : 1;
660
unsigned m_fontCodeHigh : 3; // not sure if this is true
661
unsigned m_zero3 : 5;
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)
666
FormatCharPropertyGenerated &operator= (const FormatCharPropertyGenerated &rhs);
668
Word getNumDataBytes(void) const {
669
return UseThisMuch::getNeedNumDataBytes();
671
// note: you cannot set numDataBytes
672
void updateNumDataBytes(void) {
673
m_numDataBytes = UseThisMuch::getNeedNumDataBytes();
676
virtual bool verifyVariables(void);
677
virtual bool writeToArray(void);
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);
694
// [PRIVATE] do not call!
695
virtual bool readFromDevice(void);
696
virtual bool writeToDevice(void);
698
FormatCharPropertyGenerated();
699
virtual ~FormatCharPropertyGenerated();
703
// get and set functions
706
bool getIsBold(void) const {
709
void setIsBold(const bool val) {
710
m_isBold = val; signalHaveSetData(m_isBold == bool (0), 8/*offset*/ + 1/*size*/);
713
bool getIsItalic(void) const {
716
void setIsItalic(const bool val) {
717
m_isItalic = val; signalHaveSetData(m_isItalic == bool (0), 9/*offset*/ + 1/*size*/);
720
// [PRIVATE] these are private libmswrite methods, do not call them!
721
unsigned getFontCodeLow(void) const {
722
return m_fontCodeLow;
724
void setFontCodeLow(const unsigned val) {
725
m_fontCodeLow = val; signalHaveSetData(m_fontCodeLow == unsigned(0), 10/*offset*/ + 6/*size*/);
728
bool getIsUnderlined(void) const {
729
return m_isUnderlined;
731
void setIsUnderlined(const bool val) {
732
m_isUnderlined = val; signalHaveSetData(m_isUnderlined == bool (0), 24/*offset*/ + 1/*size*/);
735
bool getIsPageNumber(void) const {
736
return m_isPageNumber;
738
void setIsPageNumber(const bool val) {
739
m_isPageNumber = val; signalHaveSetData(m_isPageNumber == bool (0), 30/*offset*/ + 1/*size*/);
742
// [PRIVATE] these are private libmswrite methods, do not call them!
743
unsigned getFontCodeHigh(void) const {
744
return m_fontCodeHigh;
746
void setFontCodeHigh(const unsigned val) {
747
m_fontCodeHigh = val; signalHaveSetData(m_fontCodeHigh == unsigned(0), 32/*offset*/ + 3/*size*/);
750
// [PRIVATE] these are private libmswrite methods, do not call them!
751
Byte getPosition(void) const {
754
void setPosition(const Byte val) {
755
m_position = val; signalHaveSetData(m_position == Byte(0), 40/*offset*/ + 8/*size*/);
759
// Paragraph Tabulator(s) Properties
760
class FormatParaPropertyTabulatorGenerated : public NeedsDevice
763
static const int s_size = 4;
766
FormatParaPropertyTabulatorGenerated(const FormatParaPropertyTabulatorGenerated &rhs); //TODO: copy constructor
769
Byte m_data [4]; // raw data from .wri file
772
Byte m_type; // 0=normal,3=decimal...all that the GUI allows
775
FormatParaPropertyTabulatorGenerated &operator= (const FormatParaPropertyTabulatorGenerated &rhs);
777
virtual bool verifyVariables(void);
778
virtual bool writeToArray(void);
780
static const Word indentDefault = Word(0);
781
static const Byte typeDefault = Byte(0);
782
static const Byte zeroDefault = Byte(0);
785
// [PRIVATE] do not call!
786
virtual bool readFromDevice(void);
787
virtual bool writeToDevice(void);
789
FormatParaPropertyTabulatorGenerated();
790
virtual ~FormatParaPropertyTabulatorGenerated();
794
// get and set functions
797
Word getIndent(void) const {
800
void setIndent(const Word val) {
804
// [PRIVATE] these are private libmswrite methods, do not call them!
805
Byte getType(void) const {
808
void setType(const Byte val) {
813
// Paragraph Properties
814
class FormatParaPropertyTabulator;
815
class FormatParaPropertyGenerated : public NeedsDevice, public UseThisMuch
818
static const int s_size = 79;
821
FormatParaPropertyGenerated(const FormatParaPropertyGenerated &rhs); //TODO: copy constructor
824
Byte m_data [79]; // raw data from .wri file
826
Byte m_numDataBytes; // number of bytes that follow
827
Byte m_magic0_60_or_61; // =0? =60? =61? 60 is the most common
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?
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;
844
FormatParaPropertyTabulator *m_tab [14];
846
FormatParaPropertyGenerated &operator= (const FormatParaPropertyGenerated &rhs);
848
Word getNumDataBytes(void) const {
849
return UseThisMuch::getNeedNumDataBytes();
851
// note: you cannot set numDataBytes
852
void updateNumDataBytes(void) {
853
m_numDataBytes = UseThisMuch::getNeedNumDataBytes();
856
virtual bool verifyVariables(void);
857
virtual bool writeToArray(void);
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
877
// [PRIVATE] do not call!
878
virtual bool readFromDevice(void);
879
virtual bool writeToDevice(void);
881
FormatParaPropertyGenerated();
882
virtual ~FormatParaPropertyGenerated();
886
// get and set functions
889
Byte getAlignment(void) const {
892
void setAlignment(const Byte val) {
893
m_alignment = val; signalHaveSetData(m_alignment == Byte(0), 8/*offset*/ + 8/*size*/);
896
Word getRightIndent(void) const {
897
return m_rightIndent;
899
void setRightIndent(const Word val) {
900
m_rightIndent = val; signalHaveSetData(m_rightIndent == Word(0), 32/*offset*/ + 16/*size*/);
903
Word getLeftIndent(void) const {
906
void setLeftIndent(const Word val) {
907
m_leftIndent = val; signalHaveSetData(m_leftIndent == Word(0), 48/*offset*/ + 16/*size*/);
910
Word getLineSpacing(void) const {
911
return m_lineSpacing;
913
void setLineSpacing(const Word val) {
914
m_lineSpacing = val; signalHaveSetData(m_lineSpacing == Word(240), 80/*offset*/ + 16/*size*/);
917
bool getHeaderOrFooter(void) const {
918
return m_headerOrFooter;
920
void setHeaderOrFooter(const bool val) {
921
m_headerOrFooter = val; signalHaveSetData(m_headerOrFooter == bool (0), 128/*offset*/ + 1/*size*/);
924
unsigned getIsNotNormalParagraph(void) const {
925
return m_isNotNormalParagraph;
927
void setIsNotNormalParagraph(const unsigned val) {
928
m_isNotNormalParagraph = val; signalHaveSetData(m_isNotNormalParagraph == unsigned(0), 129/*offset*/ + 2/*size*/);
931
bool getIsOnFirstPage(void) const {
932
return m_isOnFirstPage;
934
void setIsOnFirstPage(const bool val) {
935
m_isOnFirstPage = val; signalHaveSetData(m_isOnFirstPage == bool (0), 131/*offset*/ + 1/*size*/);
938
bool getIsObject(void) const {
941
void setIsObject(const bool val) {
942
m_isObject = val; signalHaveSetData(m_isObject == bool (0), 132/*offset*/ + 1/*size*/);
946
// [PRIVATE] this is a private libmswrite class, do not use it!
947
class FormatInfoPageGenerated : public NeedsDevice
950
static const int s_size = 128;
953
FormatInfoPageGenerated(const FormatInfoPageGenerated &rhs); //TODO: copy constructor
956
Byte m_data [128]; // raw data from .wri file
958
DWord m_firstCharBytePlus128;
959
Byte m_packedStructs [123]; // array of FormatPointers and FormatCharProperties/FormatParaProperties
960
Byte m_numFormatPointers;
962
FormatInfoPageGenerated &operator= (const FormatInfoPageGenerated &rhs);
964
virtual bool verifyVariables(void);
965
virtual bool writeToArray(void);
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);
972
// [PRIVATE] do not call!
973
virtual bool readFromDevice(void);
974
virtual bool writeToDevice(void);
976
FormatInfoPageGenerated();
977
virtual ~FormatInfoPageGenerated();
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
986
static const int s_size = 14;
989
BMP_BitmapFileHeaderGenerated(const BMP_BitmapFileHeaderGenerated &rhs); //TODO: copy constructor
992
Byte m_data [14]; // raw data from .wri file
997
DWord m_actualImageOffset;
999
BMP_BitmapFileHeaderGenerated &operator= (const BMP_BitmapFileHeaderGenerated &rhs);
1001
virtual bool verifyVariables(void);
1002
virtual bool writeToArray(void);
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
1010
// [PRIVATE] do not call!
1011
virtual bool readFromDevice(void);
1012
virtual bool writeToDevice(void);
1014
BMP_BitmapFileHeaderGenerated();
1015
virtual ~BMP_BitmapFileHeaderGenerated();
1019
// get and set functions
1022
DWord getTotalBytes(void) const {
1023
return m_totalBytes;
1025
void setTotalBytes(const DWord val) {
1029
DWord getActualImageOffset(void) const {
1030
return m_actualImageOffset;
1032
void setActualImageOffset(const DWord val) {
1033
m_actualImageOffset = val;
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
1042
static const int s_size = 40;
1045
BMP_BitmapInfoHeaderGenerated(const BMP_BitmapInfoHeaderGenerated &rhs); //TODO: copy constructor
1048
Byte m_data [40]; // raw data from .wri file
1050
DWord m_numHeaderBytes;
1053
Word m_numPlanes; // always==1
1054
Word m_bitsPerPixel;
1055
DWord m_compression;
1057
Long m_xPixelsPerMeter;
1058
Long m_yPixelsPerMeter;
1060
DWord m_colorsImportant;
1062
BMP_BitmapInfoHeaderGenerated &operator= (const BMP_BitmapInfoHeaderGenerated &rhs);
1064
virtual bool verifyVariables(void);
1065
virtual bool writeToArray(void);
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
1080
// [PRIVATE] do not call!
1081
virtual bool readFromDevice(void);
1082
virtual bool writeToDevice(void);
1084
BMP_BitmapInfoHeaderGenerated();
1085
virtual ~BMP_BitmapInfoHeaderGenerated();
1089
// get and set functions
1092
Long getWidth(void) const {
1095
void setWidth(const Long val) {
1099
Long getHeight(void) const {
1102
void setHeight(const Long val) {
1106
Word getNumPlanes(void) const {
1109
void setNumPlanes(const Word val) {
1113
Word getBitsPerPixel(void) const {
1114
return m_bitsPerPixel;
1116
void setBitsPerPixel(const Word val) {
1117
m_bitsPerPixel = val;
1120
DWord getCompression(void) const {
1121
return m_compression;
1123
void setCompression(const DWord val) {
1124
m_compression = val;
1127
DWord getSizeImage(void) const {
1130
void setSizeImage(const DWord val) {
1134
Long getXPixelsPerMeter(void) const {
1135
return m_xPixelsPerMeter;
1137
void setXPixelsPerMeter(const Long val) {
1138
m_xPixelsPerMeter = val;
1141
Long getYPixelsPerMeter(void) const {
1142
return m_yPixelsPerMeter;
1144
void setYPixelsPerMeter(const Long val) {
1145
m_yPixelsPerMeter = val;
1148
DWord getColorsUsed(void) const {
1149
return m_colorsUsed;
1151
void setColorsUsed(const DWord val) {
1155
DWord getColorsImportant(void) const {
1156
return m_colorsImportant;
1158
void setColorsImportant(const DWord val) {
1159
m_colorsImportant = val;
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
1168
static const int s_size = 4;
1171
BMP_BitmapColorIndexGenerated(const BMP_BitmapColorIndexGenerated &rhs); //TODO: copy constructor
1174
Byte m_data [4]; // raw data from .wri file
1181
BMP_BitmapColorIndexGenerated &operator= (const BMP_BitmapColorIndexGenerated &rhs);
1183
virtual bool verifyVariables(void);
1184
virtual bool writeToArray(void);
1186
// no default for blue
1187
// no default for green
1188
// no default for red
1189
static const Byte reservedDefault = Byte(0);
1192
// [PRIVATE] do not call!
1193
virtual bool readFromDevice(void);
1194
virtual bool writeToDevice(void);
1196
BMP_BitmapColorIndexGenerated();
1197
virtual ~BMP_BitmapColorIndexGenerated();
1201
// get and set functions
1204
Byte getBlue(void) const {
1207
void setBlue(const Byte val) {
1211
Byte getGreen(void) const {
1214
void setGreen(const Byte val) {
1218
Byte getRed(void) const {
1221
void setRed(const Byte val) {
1226
// [PRIVATE] this is a private libmswrite class, do not use it!
1227
class BitmapHeaderGenerated : public NeedsDevice
1230
static const int s_size = 14;
1233
BitmapHeaderGenerated(const BitmapHeaderGenerated &rhs); //TODO: copy constructor
1236
Byte m_data [14]; // raw data from .wri file
1242
Byte m_numPlanes; // always 1 for mono BMP or the entire struct is 0 for WMF
1243
Byte m_bitsPerPixel;
1246
BitmapHeaderGenerated &operator= (const BitmapHeaderGenerated &rhs);
1248
virtual bool verifyVariables(void);
1249
virtual bool writeToArray(void);
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);
1260
// [PRIVATE] do not call!
1261
virtual bool readFromDevice(void);
1262
virtual bool writeToDevice(void);
1264
BitmapHeaderGenerated();
1265
virtual ~BitmapHeaderGenerated();
1269
// get and set functions
1272
Word getWidth(void) const {
1275
void setWidth(const Word val) {
1279
Word getHeight(void) const {
1282
void setHeight(const Word val) {
1286
Word getWidthBytes(void) const {
1287
return m_widthBytes;
1289
void setWidthBytes(const Word val) {
1293
Byte getNumPlanes(void) const {
1296
void setNumPlanes(const Byte val) {
1300
Byte getBitsPerPixel(void) const {
1301
return m_bitsPerPixel;
1303
void setBitsPerPixel(const Byte val) {
1304
m_bitsPerPixel = val;
1308
// 'Standard WMF' Header
1309
// [PRIVATE] this is a private libmswrite class, do not use it!
1310
class WMFHeaderGenerated : public NeedsDevice
1313
static const int s_size = 18;
1316
WMFHeaderGenerated(const WMFHeaderGenerated &rhs); //TODO: copy constructor
1319
Byte m_data [18]; // raw data from .wri file
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)
1329
WMFHeaderGenerated &operator= (const WMFHeaderGenerated &rhs);
1331
virtual bool verifyVariables(void);
1332
virtual bool writeToArray(void);
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);
1343
// [PRIVATE] do not call!
1344
virtual bool readFromDevice(void);
1345
virtual bool writeToDevice(void);
1347
WMFHeaderGenerated();
1348
virtual ~WMFHeaderGenerated();
1352
// get and set functions
1355
DWord getFileSize(void) const {
1358
void setFileSize(const DWord val) {
1362
DWord getMaxRecordSize(void) const {
1363
return m_maxRecordSize;
1365
void setMaxRecordSize(const DWord val) {
1366
m_maxRecordSize = val;
1371
class ImageGenerated : public NeedsDevice
1374
static const int s_size = 40;
1377
ImageGenerated(const ImageGenerated &rhs); //TODO: copy constructor
1380
Byte m_data [40]; // raw data from .wri file
1382
// - - - METAFILEPICT begin - - -
1384
Word m_mappingMode; // type of image: 0xE3 for mono bitmap, != 0xE3 for WMF (usually 0x88)
1389
// - - - METAFILEPICT end - - -
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
1396
BitmapHeader *m_bmh; // only valid for mono BMPs i.e. when mappingMode == 0xe3
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)
1403
// - - - Followed by either a strangely packed monochrome bitmap or a Standard WMF (with WMFHeader, of course) - - -
1405
ImageGenerated &operator= (const ImageGenerated &rhs);
1407
virtual bool verifyVariables(void);
1408
virtual bool writeToArray(void);
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);
1425
// [PRIVATE] do not call!
1426
virtual bool readFromDevice(void);
1427
virtual bool writeToDevice(void);
1430
virtual ~ImageGenerated();
1434
// get and set functions
1437
Word getIndent(void) const {
1440
void setIndent(const Word val) {
1444
// [PRIVATE] these are private libmswrite methods, do not call them!
1445
Word getNumHeaderBytes(void) const {
1446
return m_numHeaderBytes;
1448
void setNumHeaderBytes(const Word val) {
1449
m_numHeaderBytes = val;
1452
// [PRIVATE] these are private libmswrite methods, do not call them!
1453
DWord getNumDataBytes(void) const {
1454
return m_numDataBytes;
1456
void setNumDataBytes(const DWord val) {
1457
m_numDataBytes = val;
1461
class OLEGenerated : public NeedsDevice
1464
static const int s_size = 40;
1467
OLEGenerated(const OLEGenerated &rhs); //TODO: copy constructor
1470
Byte m_data [40]; // raw data from .wri file
1474
Word m_objectType; // 1=static, 2=embedded, 3=link
1476
Word m_indent; // horizontal position from left margin
1480
DWord m_numDataBytes; // number of OLE bytes
1482
DWord m_objectName; // name of the object in hex
1484
Word m_numHeaderBytes; // size of this header
1486
Word m_widthScaledRel1000; // horizontal scaling (/1000)*100% (same as Image?)
1487
Word m_heightScaledRel1000; // vertical scaling (/1000)*100% (same as Image?)
1489
// - - - Followed by OLE data - - -
1491
OLEGenerated &operator= (const OLEGenerated &rhs);
1493
virtual bool verifyVariables(void);
1494
virtual bool writeToArray(void);
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
1513
// [PRIVATE] do not call!
1514
virtual bool readFromDevice(void);
1515
virtual bool writeToDevice(void);
1518
virtual ~OLEGenerated();
1522
// get and set functions
1525
Word getObjectType(void) const {
1526
return m_objectType;
1528
void setObjectType(const Word val) {
1532
Word getIndent(void) const {
1535
void setIndent(const Word val) {
1539
Word getWidth(void) const {
1542
void setWidth(const Word val) {
1546
Word getHeight(void) const {
1549
void setHeight(const Word val) {
1553
// [PRIVATE] these are private libmswrite methods, do not call them!
1554
DWord getNumDataBytes(void) const {
1555
return m_numDataBytes;
1557
void setNumDataBytes(const DWord val) {
1558
m_numDataBytes = val;
1561
DWord getObjectName(void) const {
1562
return m_objectName;
1564
void setObjectName(const DWord val) {
1568
Word getWidthScaledRel1000(void) const {
1569
return m_widthScaledRel1000;
1571
void setWidthScaledRel1000(const Word val) {
1572
m_widthScaledRel1000 = val;
1575
Word getHeightScaledRel1000(void) const {
1576
return m_heightScaledRel1000;
1578
void setHeightScaledRel1000(const Word val) {
1579
m_heightScaledRel1000 = val;
1582
} // namespace MSWrite {
1584
#endif // __STRUCTURES_GENERATED_H__
1310
1586
// end of structures_generated.h