46
bool m_hasHeaderOnFirstPage;
47
bool m_hasFooterOnFirstPage;
53
m_hasHeader = m_hasFooter = false;
54
m_hasHeaderOnFirstPage = m_hasFooterOnFirstPage = false;
57
Word getNumObjects (void) const { return m_numObjects; }
58
void setNumObjects (const Word numObjects) { m_numObjects = numObjects; }
60
bool getHasHeader (void) const { return m_hasHeader; }
61
void setHasHeader (const bool hasHeader) { m_hasHeader = hasHeader; }
63
bool getHasFooter (void) const { return m_hasFooter; }
64
void setHasFooter (const bool hasFooter) { m_hasFooter = hasFooter; }
66
bool getHasHeaderOnFirstPage (void) const { return m_hasHeaderOnFirstPage; }
67
void setHasHeaderOnFirstPage (const bool hasHeaderOnFirstPage) { m_hasHeader = hasHeaderOnFirstPage; }
69
bool getHasFooterOnFirstPage (void) const { return m_hasFooterOnFirstPage; }
70
void setHasFooterOnFirstPage (const bool hasFooterOnFirstPage) { m_hasFooterOnFirstPage = hasFooterOnFirstPage; }
46
bool m_hasHeaderOnFirstPage;
47
bool m_hasFooterOnFirstPage;
52
m_hasHeader = m_hasFooter = false;
53
m_hasHeaderOnFirstPage = m_hasFooterOnFirstPage = false;
56
Word getNumObjects(void) const {
59
void setNumObjects(const Word numObjects) {
60
m_numObjects = numObjects;
63
bool getHasHeader(void) const {
66
void setHasHeader(const bool hasHeader) {
67
m_hasHeader = hasHeader;
70
bool getHasFooter(void) const {
73
void setHasFooter(const bool hasFooter) {
74
m_hasFooter = hasFooter;
77
bool getHasHeaderOnFirstPage(void) const {
78
return m_hasHeaderOnFirstPage;
80
void setHasHeaderOnFirstPage(const bool hasHeaderOnFirstPage) {
81
m_hasHeader = hasHeaderOnFirstPage;
84
bool getHasFooterOnFirstPage(void) const {
85
return m_hasFooterOnFirstPage;
87
void setHasFooterOnFirstPage(const bool hasFooterOnFirstPage) {
88
m_hasFooterOnFirstPage = hasFooterOnFirstPage;
75
// [PRIVATE] don't use
76
class FormatInfo : public NeedsDevice, public NeedsHeader
79
List <FormatInfoPage> m_formatInfoPageList;
80
List <FormatInfoPage>::Iterator m_formatInfoPageIterator;
83
enum FormatInfoPageTypes m_type;
85
friend class InternalParser;
86
friend class InternalGenerator;
87
Word m_leftMargin, m_rightMargin; // for ParaType only
88
FontTable *m_fontTable; // for CharType only
89
void setMargins (const Word leftMargin, const Word rightMargin)
91
m_leftMargin = leftMargin, m_rightMargin = rightMargin;
93
void setFontTable (FontTable *fontTable) { m_fontTable = fontTable; }
95
FormatInfo &operator= (const FormatInfo &rhs); // TODO
98
virtual ~FormatInfo ();
100
void setType (const enum FormatInfoPageTypes t) { m_type = t; }
102
bool readFromDevice (void);
103
bool writeToDevice (const void *defaultProperty);
107
bool end (void) /*const*/;
109
bool add (const void *property, const bool force = false);
117
Generator *m_generator;
120
Parser (Generator *generator = NULL)
122
setGenerator (generator);
129
void setGenerator (Generator *generator)
131
m_generator = generator;
134
// Note: You aren't allowed to call parse() more than once.
135
// Create another Parser instance if you need to reparse.
137
// This permits subclasses implementations of parse() to defer
138
// uninitialization to the destructor, if desired.
139
virtual bool parse (void) = 0;
147
virtual ~Generator ();
151
* Document block (you must implement these signals)
154
virtual bool writeDocumentBegin (const Word format, const PageLayout *pageLayout) = 0;
155
virtual bool writeDocumentEnd (const Word format, const PageLayout *pageLayout) = 0;
159
* Various sections in the document
162
virtual bool writeFooterBegin (void) { return true; }
163
virtual bool writeFooterEnd (void) { return true; }
165
virtual bool writeHeaderBegin (void) { return true; }
166
virtual bool writeHeaderEnd (void) { return true; }
168
virtual bool writeBodyBegin (void) = 0;
169
virtual bool writeBodyEnd (void) = 0;
176
virtual bool writeParaInfoBegin (const FormatParaProperty * /*paraProperty*/,
177
const OLE * /*ole*/ = NULL,
178
const Image * /*image*/ = NULL) { return true; }
179
virtual bool writeParaInfoEnd (const FormatParaProperty * /*paraProperty*/,
180
const OLE * /*ole*/ = NULL,
181
const Image * /*image*/ = NULL) { return true; }
188
virtual bool writeCharInfoBegin (const FormatCharProperty * /*charProperty*/) { return true; }
189
virtual bool writeCharInfoEnd (const FormatCharProperty * /*charProperty*/,
190
const bool /*endOfParagraph*/ = false) { return true; }
198
virtual bool writeBinary (const Byte * /*buffer*/, const DWord /*length*/) { return true; }
210
* this calls writeText, newLineWrite etc...
212
bool processText (const Byte *string, bool willReachEndOfParagraph);
213
virtual bool writeText (const Byte *string) = 0;
218
* Miscellaneous special signals called by processText
221
virtual bool writePageNew (const int /*pageNumberClaimed*/ = 0)
225
virtual bool writePageBreak (void)
227
return writeText ((const Byte *) "\xc"); // i.e. (char)12
229
virtual bool writePageNumber (void)
231
return writeText ((const Byte *) "\x1"); // i.e. (char)1
233
virtual bool writeCarriageReturn (void)
235
return writeText ((const Byte *) "\xd"); // i.e. (char)13
237
virtual bool writeNewLine (const bool /*endOfParagraph*/ = true)
239
return writeText ((const Byte *) "\n"); // i.e. (char)10
241
virtual bool writeOptionalHyphen (void)
243
return writeText ((const Byte *) "-");
248
* implement this signal to show the progress of the conversion
249
* (0 <= value <= 100)
252
virtual void sigProgress (const int /*value*/) {}
256
class InternalParser : public Parser, public NeedsDevice
260
SectionTable *m_sectionTable;
261
PageLayout *m_pageLayout;
262
PageTable *m_pageTable;
263
FontTable *m_fontTable;
264
FormatInfo *m_paragraphInfo, *m_characterInfo;
271
virtual ~InternalParser ();
277
class InternalGenerator : public Generator, public NeedsDevice
281
SectionTable *m_sectionTable;
282
PageLayout *m_pageLayout;
283
PageTable *m_pageTable;
284
FontTable *m_fontTable;
285
FormatInfo *m_paragraphInfo, *m_characterInfo;
290
bool seekNextPage (void);
293
InternalGenerator ();
294
virtual ~InternalGenerator ();
296
bool writeDocumentBegin (const Word format, const PageLayout *pageLayout);
297
bool writeDocumentEnd (const Word format, const PageLayout *pageLayout);
299
bool writeFooterBegin (void)
304
bool writeFooterEnd(void)
310
bool writeHeaderBegin (void)
315
bool writeHeaderEnd (void)
321
bool writeBodyBegin (void)
327
bool writeBodyEnd (void)
339
bool writeParaInfoBegin (const FormatParaProperty *paraProperty,
340
const OLE *oleHeader = NULL,
341
const Image *imageHeader = NULL);
342
bool writeParaInfoEnd (const FormatParaProperty *paraProperty,
343
const OLE *oleHeader = NULL,
344
const Image *imageHeader = NULL);
346
bool writeCharInfoBegin (const FormatCharProperty *charProperty);
347
bool writeCharInfoEnd (const FormatCharProperty *charProperty,
348
const bool endOfParagraph = false);
351
bool writeBinary (const Byte *buffer, const DWord length);
354
bool writeText (const Byte *string);
357
bool writePageNew (const int pageNumberClaimed = 0);
359
bool writePageBreak (void)
361
return writeText ((const Byte *) "\xC"); // i.e. (char)12
363
bool writePageNumber (void)
365
return writeText ((const Byte *) "\x1"); // i.e. (char)1
367
bool writeCarriageReturn (void)
369
// it's DOS/Windows(r) which has \r\n newlines
370
return writeText ((const Byte *) "\xD"); // i.e. (char)13
372
bool writeNewLine (const bool)
374
return writeText ((const Byte *) "\n"); // i.e. (char)10
376
bool writeOptionalHyphen (void)
378
return writeText ((const Byte *) "\x1F"); // i.e. (char)31
381
void sigProgress (const int)
388
} // namespace MSWrite {
390
#endif // __LIBMSWRITE_H__
94
// [PRIVATE] don't use
95
class FormatInfo : public NeedsDevice, public NeedsHeader
98
List <FormatInfoPage> m_formatInfoPageList;
99
List <FormatInfoPage>::Iterator m_formatInfoPageIterator;
102
enum FormatInfoPageTypes m_type;
104
friend class InternalParser;
105
friend class InternalGenerator;
106
Word m_leftMargin, m_rightMargin; // for ParaType only
107
FontTable *m_fontTable; // for CharType only
108
void setMargins(const Word leftMargin, const Word rightMargin) {
109
m_leftMargin = leftMargin, m_rightMargin = rightMargin;
111
void setFontTable(FontTable *fontTable) {
112
m_fontTable = fontTable;
115
FormatInfo &operator= (const FormatInfo &rhs); // TODO
118
virtual ~FormatInfo();
120
void setType(const enum FormatInfoPageTypes t) {
124
bool readFromDevice(void);
125
bool writeToDevice(const void *defaultProperty);
129
bool end(void) /*const*/;
131
bool add(const void *property, const bool force = false);
139
Generator *m_generator;
142
Parser(Generator *generator = NULL) {
143
setGenerator(generator);
149
void setGenerator(Generator *generator) {
150
m_generator = generator;
153
// Note: You aren't allowed to call parse() more than once.
154
// Create another Parser instance if you need to reparse.
156
// This permits subclasses implementations of parse() to defer
157
// uninitialization to the destructor, if desired.
158
virtual bool parse(void) = 0;
166
virtual ~Generator();
170
* Document block (you must implement these signals)
173
virtual bool writeDocumentBegin(const Word format, const PageLayout *pageLayout) = 0;
174
virtual bool writeDocumentEnd(const Word format, const PageLayout *pageLayout) = 0;
178
* Various sections in the document
181
virtual bool writeFooterBegin(void) {
184
virtual bool writeFooterEnd(void) {
188
virtual bool writeHeaderBegin(void) {
191
virtual bool writeHeaderEnd(void) {
195
virtual bool writeBodyBegin(void) = 0;
196
virtual bool writeBodyEnd(void) = 0;
203
virtual bool writeParaInfoBegin(const FormatParaProperty * /*paraProperty*/,
204
const OLE * /*ole*/ = NULL,
205
const Image * /*image*/ = NULL) {
208
virtual bool writeParaInfoEnd(const FormatParaProperty * /*paraProperty*/,
209
const OLE * /*ole*/ = NULL,
210
const Image * /*image*/ = NULL) {
219
virtual bool writeCharInfoBegin(const FormatCharProperty * /*charProperty*/) {
222
virtual bool writeCharInfoEnd(const FormatCharProperty * /*charProperty*/,
223
const bool /*endOfParagraph*/ = false) {
233
virtual bool writeBinary(const Byte * /*buffer*/, const DWord /*length*/) {
247
* this calls writeText, newLineWrite etc...
249
bool processText(const Byte *string, bool willReachEndOfParagraph);
250
virtual bool writeText(const Byte *string) = 0;
255
* Miscellaneous special signals called by processText
258
virtual bool writePageNew(const int /*pageNumberClaimed*/ = 0) {
261
virtual bool writePageBreak(void) {
262
return writeText((const Byte *) "\xc"); // i.e. (char)12
264
virtual bool writePageNumber(void) {
265
return writeText((const Byte *) "\x1"); // i.e. (char)1
267
virtual bool writeCarriageReturn(void) {
268
return writeText((const Byte *) "\xd"); // i.e. (char)13
270
virtual bool writeNewLine(const bool /*endOfParagraph*/ = true) {
271
return writeText((const Byte *) "\n"); // i.e. (char)10
273
virtual bool writeOptionalHyphen(void) {
274
return writeText((const Byte *) "-");
279
* implement this signal to show the progress of the conversion
280
* (0 <= value <= 100)
283
virtual void sigProgress(const int /*value*/) {}
287
class InternalParser : public Parser, public NeedsDevice
291
SectionTable *m_sectionTable;
292
PageLayout *m_pageLayout;
293
PageTable *m_pageTable;
294
FontTable *m_fontTable;
295
FormatInfo *m_paragraphInfo, *m_characterInfo;
302
virtual ~InternalParser();
308
class InternalGenerator : public Generator, public NeedsDevice
312
SectionTable *m_sectionTable;
313
PageLayout *m_pageLayout;
314
PageTable *m_pageTable;
315
FontTable *m_fontTable;
316
FormatInfo *m_paragraphInfo, *m_characterInfo;
321
bool seekNextPage(void);
325
virtual ~InternalGenerator();
327
bool writeDocumentBegin(const Word format, const PageLayout *pageLayout);
328
bool writeDocumentEnd(const Word format, const PageLayout *pageLayout);
330
bool writeFooterBegin(void) {
334
bool writeFooterEnd(void) {
339
bool writeHeaderBegin(void) {
343
bool writeHeaderEnd(void) {
348
bool writeBodyBegin(void) {
353
bool writeBodyEnd(void) {
364
bool writeParaInfoBegin(const FormatParaProperty *paraProperty,
365
const OLE *oleHeader = NULL,
366
const Image *imageHeader = NULL);
367
bool writeParaInfoEnd(const FormatParaProperty *paraProperty,
368
const OLE *oleHeader = NULL,
369
const Image *imageHeader = NULL);
371
bool writeCharInfoBegin(const FormatCharProperty *charProperty);
372
bool writeCharInfoEnd(const FormatCharProperty *charProperty,
373
const bool endOfParagraph = false);
376
bool writeBinary(const Byte *buffer, const DWord length);
379
bool writeText(const Byte *string);
382
bool writePageNew(const int pageNumberClaimed = 0);
384
bool writePageBreak(void) {
385
return writeText((const Byte *) "\xC"); // i.e. (char)12
387
bool writePageNumber(void) {
388
return writeText((const Byte *) "\x1"); // i.e. (char)1
390
bool writeCarriageReturn(void) {
391
// it's DOS/Windows(r) which has \r\n newlines
392
return writeText((const Byte *) "\xD"); // i.e. (char)13
394
bool writeNewLine(const bool) {
395
return writeText((const Byte *) "\n"); // i.e. (char)10
397
bool writeOptionalHyphen(void) {
398
return writeText((const Byte *) "\x1F"); // i.e. (char)31
401
void sigProgress(const int) {
407
} // namespace MSWrite {
409
#endif // __LIBMSWRITE_H__
392
411
// end of libmswrite.h