Debian Codegraph @

style/FOTBuilder.h

raw
1 // Copyright (c) 1996, 1997 James Clark
2 // See the file copying.txt for copying permission.
3
4 #ifndef FOTBuilder_INCLUDED
5 #define FOTBuilder_INCLUDED 1
6
7 #include <OpenSP/types.h>
8 #include <OpenSP/StringC.h>
9 #include <OpenSP/Boolean.h>
10 #include "Node.h"
11 #include <OpenSP/Link.h>
12 #include <OpenSP/IList.h>
13 #include <OpenSP/Vector.h>
14 #include <OpenSP/Resource.h>
15 #include <OpenSP/Ptr.h>
16 #include <OpenSP/Owner.h>
17 #include <stddef.h>
18 #include <string.h>
19 #include "dsssl_ns.h"
20
21 // This is a work around for a bug in Sun C++ 4.1.
22 // The class local typedef of PublicId will cause it to reject a
23 // subsequent declaration of the class PublicId, but it's happy
24 // if it sees the class first.
25 #ifdef __SUNPRO_CC
26 #include <OpenSP/ExternalId.h>
27 #endif
28
29 #ifdef SP_USE_DLL
30 #ifdef BUILD_LIBSTYLE
31 #define STYLE_API SP_DLLEXPORT
32 #else
33 #define STYLE_API SP_DLLIMPORT
34 #endif
35 #else /* not SP_USE_DLL */
36 #define STYLE_API /* as nothing */
37 #endif /* not SP_USE_DLL */
38
39 #ifdef DSSSL_NAMESPACE
40 namespace DSSSL_NAMESPACE {
41 #endif
42
43 class SaveFOTBuilder;
44
45 class STYLE_API FOTBuilder {
46 public:
47 enum Symbol {
48 symbolFalse,
49 symbolTrue,
50 symbolNotApplicable,
51 // These are guaranteed to be in increasing order of weight,
52 // and expansion.
53 symbolUltraCondensed,
54 symbolExtraCondensed,
55 symbolCondensed,
56 symbolSemiCondensed,
57 symbolUltraLight,
58 symbolExtraLight,
59 symbolLight,
60 symbolSemiLight,
61 symbolMedium,
62 symbolSemiExpanded,
63 symbolExpanded,
64 symbolExtraExpanded,
65 symbolUltraExpanded,
66 symbolSemiBold,
67 symbolBold,
68 symbolExtraBold,
69 symbolUltraBold,
70 symbolUpright,
71 symbolOblique,
72 symbolBackSlantedOblique,
73 symbolItalic,
74 symbolBackSlantedItalic,
75 symbolStart,
76 symbolEnd,
77 symbolCenter,
78 symbolJustify,
79 symbolSpreadInside,
80 symbolSpreadOutside,
81 symbolPageInside,
82 symbolPageOutside,
83 symbolInitial,
84 symbolFinal,
85 symbolWrap,
86 symbolAsis,
87 symbolAsisWrap,
88 symbolAsisTruncate,
89 symbolNone,
90 symbolIndent,
91 symbolBefore,
92 symbolThrough,
93 symbolAfter,
94 symbolTopToBottom,
95 symbolLeftToRight,
96 symbolBottomToTop,
97 symbolRightToLeft,
98 symbolInside,
99 symbolOutside,
100 symbolHorizontal,
101 symbolVertical,
102 symbolEscapement,
103 symbolLineProgression,
104 symbolMath,
105 symbolOrdinary,
106 symbolOperator,
107 symbolBinary,
108 symbolRelation,
109 symbolOpening,
110 symbolClosing,
111 symbolPunctuation,
112 symbolInner,
113 symbolSpace,
114 symbolPage,
115 symbolPageRegion,
116 symbolColumnSet,
117 symbolColumn,
118 symbolMax,
119 symbolMaxUniform,
120 symbolMiter,
121 symbolRound,
122 symbolBevel,
123 symbolButt,
124 symbolSquare,
125 symbolLoose,
126 symbolNormal,
127 symbolKern,
128 symbolTight,
129 symbolTouch,
130 symbolPreserve,
131 symbolCollapse,
132 symbolIgnore,
133 symbolRelative,
134 symbolDisplay,
135 symbolInline,
136 symbolBorder,
137 symbolBackground,
138 symbolBoth,
139 symbolBase,
140 symbolFont,
141 symbolTop,
142 symbolBottom,
143 symbolSpread,
144 symbolSolid,
145 symbolOutline,
146 symbolWith,
147 symbolAgainst,
148 symbolForce,
149 symbolIndependent,
150 symbolPile,
151 symbolSupOut,
152 symbolSubOut,
153 symbolLeadEdge,
154 symbolTrailEdge,
155 symbolExplicit,
156 symbolRowMajor,
157 symbolColumnMajor,
158 symbolUppercase,
159 symbolLowercase,
160 symbolCapitalize
161 };
162 enum { nSymbols = symbolCapitalize + 1 };
163 typedef const char *PublicId;
164 struct STYLE_API GlyphId {
165 GlyphId() : publicId(0), suffix(0) { }
166 GlyphId(const char *s, unsigned long n = 0) : publicId(s), suffix(n) { }
167 PublicId publicId;
168 // If suffix is non-zero, then add a double-colon plus
169 // the suffix in decimal onto publicId to get the complete
170 // public identifier of the glyph id.
171 unsigned long suffix;
172 };
173 struct STYLE_API GlyphSubstTable : public Resource {
174 unsigned uniqueId;
175 Vector<GlyphId> pairs;
176 GlyphId subst(const GlyphId &) const;
177 };
178 // SP_LETTER2('U', 'K')
179 #define SP_LETTER2(c1, c2) (((c1) << 8) | (c2))
180 typedef unsigned Letter2;
181 typedef long Length;
182 struct LengthSpec {
183 LengthSpec(long len = 0) : length(len), displaySizeFactor(0.0) { }
184 long length;
185 double displaySizeFactor;
186 operator bool() const { return length != 0 || displaySizeFactor != 0.0; }
187 };
188 struct STYLE_API TableLengthSpec : LengthSpec {
189 TableLengthSpec() : tableUnitFactor(0.0) { }
190 double tableUnitFactor;
191 };
192 struct STYLE_API OptLengthSpec {
193 OptLengthSpec() : hasLength(0) { }
194 bool hasLength;
195 LengthSpec length;
196 };
197 struct STYLE_API DisplaySpace {
198 DisplaySpace() : priority(0), conditional(1), force(0) { }
199 LengthSpec nominal;
200 LengthSpec min;
201 LengthSpec max;
202 long priority;
203 bool conditional;
204 bool force;
205 };
206 struct STYLE_API InlineSpace {
207 LengthSpec nominal;
208 LengthSpec min;
209 LengthSpec max;
210 };
211 struct STYLE_API OptInlineSpace {
212 OptInlineSpace() : hasSpace(0) { }
213 bool hasSpace;
214 InlineSpace space;
215 };
216 // non-inherited characteristics for all displayed flow objects
217 struct STYLE_API DisplayNIC {
218 DisplayNIC();
219 DisplaySpace spaceBefore;
220 DisplaySpace spaceAfter;
221 Symbol positionPreference;
222 Symbol keep;
223 Symbol breakBefore;
224 Symbol breakAfter;
225 bool keepWithPrevious;
226 bool keepWithNext;
227 bool mayViolateKeepBefore;
228 bool mayViolateKeepAfter;
229 };
230 struct STYLE_API InlineNIC {
231 InlineNIC();
232 long breakBeforePriority;
233 long breakAfterPriority;
234 };
235 struct STYLE_API DisplayGroupNIC : DisplayNIC {
236 DisplayGroupNIC();
237 bool hasCoalesceId;
238 StringC coalesceId;
239 };
240 struct STYLE_API ExternalGraphicNIC : DisplayNIC, InlineNIC {
241 ExternalGraphicNIC();
242 bool isDisplay;
243 Symbol scaleType; // symbolFalse if not a symbol
244 double scale[2]; // if scaleType == symbolFalse
245 StringC entitySystemId;
246 StringC notationSystemId;
247 bool hasMaxWidth;
248 LengthSpec maxWidth;
249 bool hasMaxHeight;
250 LengthSpec maxHeight;
251 // These apply only if !isDisplay
252 // symbolFalse if no escapementDirection
253 Symbol escapementDirection;
254 LengthSpec positionPointX;
255 LengthSpec positionPointY;
256 };
257 struct STYLE_API BoxNIC : DisplayNIC, InlineNIC {
258 BoxNIC();
259 bool isDisplay;
260 };
261 struct STYLE_API RuleNIC : DisplayNIC, InlineNIC {
262 RuleNIC();
263 Symbol orientation;
264 bool hasLength;
265 LengthSpec length;
266 };
267 struct STYLE_API LeaderNIC : InlineNIC {
268 LeaderNIC();
269 bool hasLength;
270 LengthSpec length;
271 };
272 // A paragraph has the same non-inherited characteristics
273 // as a display-group.
274 typedef DisplayNIC ParagraphNIC;
275 struct STYLE_API CharacterNIC {
276 CharacterNIC();
277 enum {
278 cIsDropAfterLineBreak,
279 cIsDropUnlessBeforeLineBreak,
280 cIsPunct,
281 cIsInputWhitespace,
282 cIsInputTab,
283 cIsRecordEnd,
284 cIsSpace,
285 cChar,
286 cGlyphId,
287 cScript,
288 cMathClass,
289 cMathFontPosture,
290 cBreakBeforePriority,
291 cBreakAfterPriority
292 };
293 unsigned specifiedC;
294 Char ch;
295 GlyphId glyphId;
296 long breakBeforePriority;
297 long breakAfterPriority;
298 Symbol mathClass;
299 Symbol mathFontPosture;
300 PublicId script;
301 bool isDropAfterLineBreak;
302 bool isDropUnlessBeforeLineBreak;
303 bool isPunct;
304 bool isInputWhitespace;
305 bool isInputTab;
306 bool isRecordEnd;
307 bool isSpace;
308 // This doesn't have a flag in specifiedC,
309 // because it has a fixed default.
310 double stretchFactor;
311 };
312 typedef InlineNIC LineFieldNIC;
313 struct STYLE_API TableNIC : public DisplayNIC {
314 TableNIC();
315 enum WidthType {
316 widthFull,
317 widthMinimum,
318 widthExplicit
319 };
320 WidthType widthType;
321 LengthSpec width;
322 };
323 typedef DisplayNIC TablePartNIC;
324 struct STYLE_API TableColumnNIC {
325 TableColumnNIC();
326 unsigned columnIndex; // zero-based
327 unsigned nColumnsSpanned;
328 bool hasWidth;
329 TableLengthSpec width;
330 };
331 struct STYLE_API TableCellNIC {
332 TableCellNIC();
333 // If true, this isn't a real table cell.
334 // Rather it's one that can be used to fill in cells missing in this row.
335 bool missing;
336 unsigned columnIndex; // zero-based
337 unsigned nColumnsSpanned;
338 unsigned nRowsSpanned;
339 };
340 struct STYLE_API DeviceRGBColor {
341 unsigned char red;
342 unsigned char green;
343 unsigned char blue;
344 };
345 struct STYLE_API MultiMode {
346 MultiMode();
347 bool hasDesc;
348 StringC name;
349 StringC desc;
350 };
351 struct STYLE_API Address {
352 enum Type {
353 // An address of #f
354 none,
355 // An address that was resolved by the front-end to a node
356 // Only the node member is valid.
357 resolvedNode,
358 // node contains current node, params[0] is string.
359 idref,
360 entity,
361 sgmlDocument,
362 hytimeLinkend,
363 tei,
364 html
365 };
366 Type type;
367 // Gives current node or resolved node.
368 NodePtr node;
369 StringC params[3];
370 };
371 virtual SaveFOTBuilder *asSaveFOTBuilder();
372 virtual ~FOTBuilder();
373 // Default for compound flow objects
374 virtual void start();
375 virtual void end();
376 // Default for atomic flow objects: defaults to start(); end();
377 virtual void atomic();
378 // Atomic flow objects
379 virtual void characters(const Char *, size_t);
380 virtual void characters(const Vector<CharacterNIC> &);
381 // Like characters(), but data comes from charChunk() on a NodePtr.
382 // If you are building a tree, then the NodePtr can be saved instead
383 // of the data. The default implementation calls characters().
384 virtual void charactersFromNode(const NodePtr &, const Char *, size_t);
385 virtual void character(const CharacterNIC &);
386 virtual void paragraphBreak(const ParagraphNIC &);
387 virtual void externalGraphic(const ExternalGraphicNIC &);
388 virtual void rule(const RuleNIC &);
389 virtual void alignmentPoint();
390 // For flow object class public id
391 // "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction"
392 virtual void formattingInstruction(const StringC &);
393 // Non-atomic flow objects
394 virtual void startSequence();
395 virtual void endSequence();
396 virtual void startLineField(const LineFieldNIC &);
397 virtual void endLineField();
398 virtual void startParagraph(const ParagraphNIC &);
399 virtual void endParagraph();
400 virtual void startDisplayGroup(const DisplayGroupNIC &);
401 virtual void endDisplayGroup();
402 virtual void startScroll();
403 virtual void endScroll();
404 virtual void startLink(const Address &);
405 virtual void endLink();
406 virtual void startMarginalia();
407 virtual void endMarginalia();
408 virtual void startMultiMode(const MultiMode *principalPort, // null if no principal port
409 const Vector<MultiMode> &namedPorts,
410 Vector<FOTBuilder *> &);
411 virtual void endMultiMode();
412 virtual void startScore(Char);
413 virtual void startScore(const LengthSpec &);
414 virtual void startScore(Symbol);
415 virtual void endScore();
416 virtual void startLeader(const LeaderNIC &);
417 virtual void endLeader();
418 virtual void startSideline();
419 virtual void endSideline();
420 virtual void startBox(const BoxNIC &);
421 virtual void endBox();
422 virtual void startSideBySide(const DisplayNIC&);
423 virtual void endSideBySide();
424 virtual void startSideBySideItem();
425 virtual void endSideBySideItem();
426 // Tables
427 virtual void startTable(const TableNIC &);
428 virtual void endTable();
429 // A call for each border is made immediately
430 // after startTable(), each preceded by any appropriate set*() calls.
431 virtual void tableBeforeRowBorder();
432 virtual void tableAfterRowBorder();
433 virtual void tableBeforeColumnBorder();
434 virtual void tableAfterColumnBorder();
435 virtual void startTablePart(const TablePartNIC &, FOTBuilder *&header, FOTBuilder *&footer);
436 virtual void endTablePart();
437 virtual void tableColumn(const TableColumnNIC &);
438 virtual void startTableRow();
439 virtual void endTableRow();
440 virtual void startTableCell(const TableCellNIC &);
441 virtual void endTableCell();
442 virtual void tableCellBeforeRowBorder();
443 virtual void tableCellAfterRowBorder();
444 virtual void tableCellBeforeColumnBorder();
445 virtual void tableCellAfterColumnBorder();
446 // Implementation must set numerator and denominator
447 // must be set to non-null values.
448 virtual void startMathSequence();
449 virtual void endMathSequence();
450 virtual void startFraction(FOTBuilder *&numerator, FOTBuilder *&denominator);
451 // startFraction is followed by call to fractionBar with set...() calls
452 // intervening
453 virtual void fractionBar();
454 virtual void endFraction();
455 virtual void startUnmath();
456 virtual void endUnmath();
457 virtual void startSuperscript();
458 virtual void endSuperscript();
459 virtual void startSubscript();
460 virtual void endSubscript();
461 virtual void startScript(FOTBuilder *&preSup,
462 FOTBuilder *&preSub,
463 FOTBuilder *&postSup,
464 FOTBuilder *&postSub,
465 FOTBuilder *&midSup,
466 FOTBuilder *&midSub);
467 virtual void endScript();
468 virtual void startMark(FOTBuilder *&overMark, FOTBuilder *&underMark);
469 virtual void endMark();
470 virtual void startFence(FOTBuilder *&open, FOTBuilder *&close);
471 virtual void endFence();
472 virtual void startRadical(FOTBuilder *&degree);
473 // startRadical is followed by one of the following
474 virtual void radicalRadical(const CharacterNIC &);
475 virtual void radicalRadicalDefaulted();
476 virtual void endRadical();
477 virtual void startMathOperator(FOTBuilder *&oper,
478 FOTBuilder *&lowerLimit,
479 FOTBuilder *&upperLimit);
480 virtual void endMathOperator();
481
482 struct STYLE_API GridNIC {
483 GridNIC();
484 unsigned nColumns;
485 unsigned nRows;
486 };
487 virtual void startGrid(const GridNIC &);
488 virtual void endGrid();
489
490 struct STYLE_API GridCellNIC {
491 GridCellNIC();
492 unsigned columnNumber;
493 unsigned rowNumber;
494 };
495 virtual void startGridCell(const GridCellNIC &);
496 virtual void endGridCell();
497
498 // Simple page
499 // Headers and footers are treated like a separate port.
500 // There are 24 different parts to the headers and footers
501 // numbered 0 to 027; the numbers are computed by or'ing the
502 // following flags.
503 enum HF {
504 // first page or other page
505 firstHF = 01,
506 otherHF = 0,
507 // front page or back page
508 frontHF = 02,
509 backHF = 0,
510 // header or footer
511 headerHF = 04,
512 footerHF = 0,
513 // left, center or right part of header
514 leftHF = 0,
515 centerHF = 010,
516 rightHF = 020,
517 // number of different HF calls
518 nHF = 030
519 };
520 virtual void startSimplePageSequence(FOTBuilder* headerFooter[nHF]);
521 virtual void endSimplePageSequenceHeaderFooter();
522 virtual void endSimplePageSequence();
523
524 // page-number sosofo
525 virtual void pageNumber();
526 // Inherited characteristics
527 // Set the value of the characteristic for the next flow object.
528 // Inherited characteristics that are not explicitly set have
529 // the same value as the parent flow object.
530 virtual void setFontSize(Length);
531 virtual void setFontFamilyName(const StringC &);
532 virtual void setFontWeight(Symbol);
533 virtual void setFontPosture(Symbol);
534 virtual void setStartIndent(const LengthSpec &);
535 virtual void setEndIndent(const LengthSpec &);
536 virtual void setFirstLineStartIndent(const LengthSpec &);
537 virtual void setLastLineEndIndent(const LengthSpec &);
538 virtual void setLineSpacing(const LengthSpec &);
539 virtual void setFieldWidth(const LengthSpec &);
540 virtual void setMarginaliaSep(const LengthSpec &);
541 virtual void setLines(Symbol);
542 virtual void setQuadding(Symbol);
543 virtual void setDisplayAlignment(Symbol);
544 virtual void setFieldAlign(Symbol);
545 virtual void setColor(const DeviceRGBColor &);
546 virtual void setBackgroundColor(); // background of #f
547 virtual void setBackgroundColor(const DeviceRGBColor &);
548 virtual void setBorderPresent(bool);
549 virtual void setLineThickness(Length);
550 virtual void setCellBeforeRowMargin(Length);
551 virtual void setCellAfterRowMargin(Length);
552 virtual void setCellBeforeColumnMargin(Length);
553 virtual void setCellAfterColumnMargin(Length);
554 virtual void setLineSep(Length);
555 virtual void setBoxSizeBefore(Length);
556 virtual void setBoxSizeAfter(Length);
557 virtual void setSideBySideOverlapControl(Symbol);
558 virtual void setSideBySidePreAlign(Symbol);
559 virtual void setSideBySidePostAlign(Symbol);
560 virtual void setPositionPointShift(const LengthSpec &);
561 virtual void setStartMargin(const LengthSpec &);
562 virtual void setEndMargin(const LengthSpec &);
563 virtual void setSidelineSep(const LengthSpec &);
564 virtual void setAsisWrapIndent(const LengthSpec &);
565 virtual void setLineNumberSep(const LengthSpec &);
566 virtual void setLastLineJustifyLimit(const LengthSpec &);
567 virtual void setJustifyGlyphSpaceMaxAdd(const LengthSpec &);
568 virtual void setJustifyGlyphSpaceMaxRemove(const LengthSpec &);
569 virtual void setTableCornerRadius(const LengthSpec &);
570 virtual void setBoxCornerRadius(const LengthSpec &);
571 virtual void setMinPreLineSpacing(const OptLengthSpec &);
572 virtual void setMinPostLineSpacing(const OptLengthSpec &);
573 virtual void setMinLeading(const OptLengthSpec &);
574 virtual void setInhibitLineBreaks(bool);
575 virtual void setHyphenate(bool);
576 virtual void setKern(bool);
577 virtual void setLigature(bool);
578 virtual void setScoreSpaces(bool);
579 virtual void setFloatOutMarginalia(bool);
580 virtual void setFloatOutSidelines(bool);
581 virtual void setFloatOutLineNumbers(bool);
582 virtual void setCellBackground(bool);
583 virtual void setSpanWeak(bool);
584 virtual void setIgnoreRecordEnd(bool);
585 virtual void setNumberedLines(bool);
586 virtual void setHangingPunct(bool);
587 virtual void setBoxOpenEnd(bool);
588 virtual void setTruncateLeader(bool);
589 virtual void setAlignLeader(bool);
590 virtual void setTablePartOmitMiddleHeader(bool);
591 virtual void setTablePartOmitMiddleFooter(bool);
592 virtual void setBorderOmitAtBreak(bool);
593 virtual void setPrincipalModeSimultaneous(bool);
594 virtual void setMarginaliaKeepWithPrevious(bool);
595 virtual void setGridEquidistantRows(bool);
596 virtual void setGridEquidistantColumns(bool);
597 virtual void setLineJoin(Symbol);
598 virtual void setLineCap(Symbol);
599 virtual void setLineNumberSide(Symbol);
600 virtual void setKernMode(Symbol);
601 virtual void setInputWhitespaceTreatment(Symbol);
602 virtual void setFillingDirection(Symbol);
603 virtual void setWritingMode(Symbol);
604 virtual void setLastLineQuadding(Symbol);
605 virtual void setMathDisplayMode(Symbol);
606 virtual void setScriptPreAlign(Symbol);
607 virtual void setScriptPostAlign(Symbol);
608 virtual void setScriptMidSupAlign(Symbol);
609 virtual void setScriptMidSubAlign(Symbol);
610 virtual void setNumeratorAlign(Symbol);
611 virtual void setDenominatorAlign(Symbol);
612 virtual void setGridPositionCellType(Symbol);
613 virtual void setGridColumnAlignment(Symbol);
614 virtual void setGridRowAlignment(Symbol);
615 virtual void setBoxType(Symbol);
616 virtual void setGlyphAlignmentMode(Symbol);
617 virtual void setBoxBorderAlignment(Symbol);
618 virtual void setCellRowAlignment(Symbol);
619 virtual void setBorderAlignment(Symbol);
620 virtual void setSidelineSide(Symbol);
621 virtual void setHyphenationKeep(Symbol);
622 virtual void setFontStructure(Symbol);
623 virtual void setFontProportionateWidth(Symbol);
624 virtual void setCellCrossed(Symbol);
625 virtual void setMarginaliaSide(Symbol);
626 virtual void setLayer(long);
627 virtual void setBackgroundLayer(long);
628 virtual void setBorderPriority(long);
629 virtual void setLineRepeat(long);
630 virtual void setSpan(long);
631 virtual void setMinLeaderRepeat(long);
632 virtual void setHyphenationRemainCharCount(long);
633 virtual void setHyphenationPushCharCount(long);
634 virtual void setWidowCount(long);
635 virtual void setOrphanCount(long);
636 // 0 means #f
637 virtual void setExpandTabs(long);
638 virtual void setHyphenationLadderCount(long);
639 // public id or #f
640 virtual void setBackgroundTile(PublicId);
641 virtual void setLineBreakingMethod(PublicId);
642 virtual void setLineCompositionMethod(PublicId);
643 virtual void setImplicitBidiMethod(PublicId);
644 virtual void setGlyphSubstMethod(PublicId);
645 virtual void setGlyphReorderMethod(PublicId);
646 virtual void setHyphenationMethod(PublicId);
647 virtual void setTableAutoWidthMethod(PublicId);
648 virtual void setFontName(PublicId);
649 // Two-letter code
650 virtual void setLanguage(Letter2);
651 virtual void setCountry(Letter2);
652 virtual void setEscapementSpaceBefore(const InlineSpace &);
653 virtual void setEscapementSpaceAfter(const InlineSpace &);
654 virtual void setInlineSpaceSpace(const OptInlineSpace &);
655 // If a symbol or #f. (Set to #f if a procedure, since this case is handled
656 // by the engine.)
657 virtual void setCharMap(Symbol);
658 // For simple page sequence
659 virtual void setPageWidth(Length);
660 virtual void setPageHeight(Length);
661 virtual void setLeftMargin(Length);
662 virtual void setRightMargin(Length);
663 virtual void setTopMargin(Length);
664 virtual void setBottomMargin(Length);
665 virtual void setHeaderMargin(Length);
666 virtual void setFooterMargin(Length);
667 // Others
668 virtual void setGlyphSubstTable(const Vector<ConstPtr<GlyphSubstTable> > &);
669 // Backlinks
670 // processingMode is empty for initial processing mode.
671 virtual void startNode(const NodePtr &, const StringC &processingMode);
672 virtual void endNode();
673 virtual void currentNodePageNumber(const NodePtr &);
674
675 class CompoundExtensionFlowObj;
676 class STYLE_API ExtensionFlowObj {
677 public:
678 virtual ~ExtensionFlowObj();
679 class Value {
680 public:
681 virtual bool convertString(StringC &) const = 0;
682 virtual bool convertStringPairList(Vector<StringC> &) const = 0;
683 virtual bool convertStringList(Vector<StringC> &) const = 0;
684 virtual bool convertBoolean(bool &) const = 0;
685 };
686 virtual CompoundExtensionFlowObj *asCompoundExtensionFlowObj();
687 virtual const CompoundExtensionFlowObj *asCompoundExtensionFlowObj() const;
688 virtual bool hasNIC(const StringC &) const;
689 virtual void setNIC(const StringC &, const Value &);
690 virtual ExtensionFlowObj *copy() const = 0;
691 };
692 class STYLE_API CompoundExtensionFlowObj : public ExtensionFlowObj {
693 public:
694 CompoundExtensionFlowObj *asCompoundExtensionFlowObj();
695 const CompoundExtensionFlowObj *asCompoundExtensionFlowObj() const;
696 virtual bool hasPrincipalPort() const;
697 virtual void portNames(Vector<StringC> &) const;
698 };
699
700 // extension inherited characteristics
701
702 virtual void extensionSet(void (FOTBuilder::*)(bool), bool);
703 virtual void extensionSet(void (FOTBuilder::*)(const StringC &), const StringC &);
704 virtual void extensionSet(void (FOTBuilder::*)(long), long);
705
706 // extension flow objects
707 virtual void extension(const ExtensionFlowObj &, const NodePtr &);
708 virtual void startExtension(const CompoundExtensionFlowObj &,
709 const NodePtr &,
710 Vector<FOTBuilder *> &ports);
711 virtual void endExtension(const CompoundExtensionFlowObj &);
712
713 struct STYLE_API Extension {
714 const char *pubid;
715 void (FOTBuilder::*boolSetter)(bool);
716 void (FOTBuilder::*stringSetter)(const StringC &);
717 void (FOTBuilder::*integerSetter)(long);
718 void (FOTBuilder::*lengthSetter)(Length);
719 const ExtensionFlowObj *flowObj;
720 };
721
722 struct STYLE_API Feature {
723 const char *name;
724 bool partial;
725 };
726
727 struct STYLE_API Description {
728 // These must be zero-terminated lists
729 const Extension *extensions;
730 const Feature *features;
731 // Set this if you want character NICs whose default values are the values
732 // of character properties to be included correctly. This degrades per-
733 // formance, so if you don't care (i.e. the formatter has its own
734 // values), set to false.
735 bool wantCharPropertyNICs;
736 // A zero-terminated list of media type names according to
737 // HTML 4.0 Specification.
738 // Instead of putting "all" in there, leave the list empty
739 // to match any media type.
740 const char **media;
741 };
742
743 static const char *symbolName(Symbol);
744 };
745
746 class STYLE_API SaveFOTBuilder : public Link, public FOTBuilder {
747 public:
748 SaveFOTBuilder();
749 SaveFOTBuilder(const SaveFOTBuilder&);
750 ~SaveFOTBuilder();
751 SaveFOTBuilder& operator = ( const SaveFOTBuilder& );
752 void clear();
753 SaveFOTBuilder *asSaveFOTBuilder();
754 virtual void emit(FOTBuilder &) const;
755 class Emitter;
756
757 void characters(const Char *, size_t);
758 void characters(const Vector<CharacterNIC> &);
759 void charactersFromNode(const NodePtr &, const Char *, size_t);
760 void character(const CharacterNIC &);
761 void paragraphBreak(const ParagraphNIC &);
762 void externalGraphic(const ExternalGraphicNIC &);
763 void rule(const RuleNIC &);
764 void alignmentPoint();
765 void formattingInstruction(const StringC &);
766 void startSequence();
767 void endSequence();
768 void startLineField(const LineFieldNIC &);
769 void endLineField();
770 void startParagraph(const ParagraphNIC &);
771 void endParagraph();
772 void startDisplayGroup(const DisplayGroupNIC &);
773 void endDisplayGroup();
774 void startScroll();
775 void endScroll();
776 void startLink(const Address &);
777 void endLink();
778 void startMultiMode(const MultiMode *principalPort,
779 const Vector<MultiMode> &namedPorts,
780 Vector<FOTBuilder *> &);
781 void endMultiMode();
782 void startMarginalia();
783 void endMarginalia();
784 void startScore(Char);
785 void startScore(const LengthSpec &);
786 void startScore(Symbol);
787 void endScore();
788 void startLeader(const LeaderNIC &);
789 void endLeader();
790 void startSideline();
791 void endSideline();
792 void startBox(const BoxNIC &);
793 void endBox();
794 void startSideBySide(const DisplayNIC&);
795 void endSideBySide();
796 void startSideBySideItem();
797 void endSideBySideItem();
798 void startSimplePageSequence(FOTBuilder* headerFooter[nHF]);
799 void endSimplePageSequenceHeaderFooter();
800 void endSimplePageSequence();
801 // page-number sosofo
802 void pageNumber();
803 // math
804 void startMathSequence();
805 void endMathSequence();
806 void startFraction(FOTBuilder *&numerator, FOTBuilder *&denominator);
807 void fractionBar();
808 void endFraction();
809 void startUnmath();
810 void endUnmath();
811 void startSuperscript();
812 void endSuperscript();
813 void startSubscript();
814 void endSubscript();
815 void startScript(FOTBuilder *&preSup,
816 FOTBuilder *&preSub,
817 FOTBuilder *&postSup,
818 FOTBuilder *&postSub,
819 FOTBuilder *&midSup,
820 FOTBuilder *&midSub);
821 void endScript();
822 void startMark(FOTBuilder *&overMark, FOTBuilder *&underMark);
823 void endMark();
824 void startFence(FOTBuilder *&open, FOTBuilder *&close);
825 void endFence();
826 void startRadical(FOTBuilder *&degree);
827 void endRadical();
828 void radicalRadical(const CharacterNIC &);
829 void radicalRadicalDefaulted();
830 void startMathOperator(FOTBuilder *&oper,
831 FOTBuilder *&lowerLimit,
832 FOTBuilder *&upperLimit);
833 void endMathOperator();
834 void startGrid(const GridNIC &);
835 void endGrid();
836 void startGridCell(const GridCellNIC &);
837 void endGridCell();
838
839 // Tables
840 void startTable(const TableNIC &);
841 void endTable();
842 void tableBeforeRowBorder();
843 void tableAfterRowBorder();
844 void tableBeforeColumnBorder();
845 void tableAfterColumnBorder();
846 void startTablePart(const TablePartNIC &, FOTBuilder *&header, FOTBuilder *&footer);
847 void endTablePart();
848 void tableColumn(const TableColumnNIC &);
849 void startTableRow();
850 void endTableRow();
851 void startTableCell(const TableCellNIC &);
852 void endTableCell();
853 void tableCellBeforeRowBorder();
854 void tableCellAfterRowBorder();
855 void tableCellBeforeColumnBorder();
856 void tableCellAfterColumnBorder();
857 // Inherited characteristics
858 void setFontSize(Length);
859 void setFontFamilyName(const StringC &);
860 void setFontWeight(Symbol);
861 void setFontPosture(Symbol);
862 void setStartIndent(const LengthSpec &);
863 void setEndIndent(const LengthSpec &);
864 void setFirstLineStartIndent(const LengthSpec &);
865 void setLastLineEndIndent(const LengthSpec &);
866 void setLineSpacing(const LengthSpec &);
867 void setFieldWidth(const LengthSpec &);
868 void setLines(Symbol);
869 void setQuadding(Symbol);
870 void setDisplayAlignment(Symbol);
871 void setFieldAlign(Symbol);
872 void setColor(const DeviceRGBColor &);
873 void setBackgroundColor(const DeviceRGBColor &);
874 void setBackgroundColor();
875 void setPageWidth(Length);
876 void setPageHeight(Length);
877 void setLeftMargin(Length);
878 void setRightMargin(Length);
879 void setTopMargin(Length);
880 void setBottomMargin(Length);
881 void setHeaderMargin(Length);
882 void setFooterMargin(Length);
883 void setBorderPresent(bool);
884 void setLineThickness(Length);
885 void setCellBeforeRowMargin(Length);
886 void setCellAfterRowMargin(Length);
887 void setCellBeforeColumnMargin(Length);
888 void setCellAfterColumnMargin(Length);
889 void setLineSep(Length);
890 void setBoxSizeBefore(Length);
891 void setBoxSizeAfter(Length);
892 void setSideBySideOverlapControl(Symbol);
893 void setSideBySidePreAlign(Symbol);
894 void setSideBySidePostAlign(Symbol);
895 void setPositionPointShift(const LengthSpec &);
896 void setStartMargin(const LengthSpec &);
897 void setEndMargin(const LengthSpec &);
898 void setSidelineSep(const LengthSpec &);
899 void setAsisWrapIndent(const LengthSpec &);
900 void setLineNumberSep(const LengthSpec &);
901 void setLastLineJustifyLimit(const LengthSpec &);
902 void setJustifyGlyphSpaceMaxAdd(const LengthSpec &);
903 void setJustifyGlyphSpaceMaxRemove(const LengthSpec &);
904 void setTableCornerRadius(const LengthSpec &);
905 void setBoxCornerRadius(const LengthSpec &);
906 void setMarginaliaSep(const LengthSpec &);
907 void setMinPreLineSpacing(const OptLengthSpec &);
908 void setMinPostLineSpacing(const OptLengthSpec &);
909 void setMinLeading(const OptLengthSpec &);
910 void setInhibitLineBreaks(bool);
911 void setHyphenate(bool);
912 void setKern(bool);
913 void setLigature(bool);
914 void setScoreSpaces(bool);
915 void setFloatOutMarginalia(bool);
916 void setFloatOutSidelines(bool);
917 void setFloatOutLineNumbers(bool);
918 void setCellBackground(bool);
919 void setSpanWeak(bool);
920 void setIgnoreRecordEnd(bool);
921 void setNumberedLines(bool);
922 void setHangingPunct(bool);
923 void setBoxOpenEnd(bool);
924 void setTruncateLeader(bool);
925 void setAlignLeader(bool);
926 void setTablePartOmitMiddleHeader(bool);
927 void setTablePartOmitMiddleFooter(bool);
928 void setBorderOmitAtBreak(bool);
929 void setPrincipalModeSimultaneous(bool);
930 void setMarginaliaKeepWithPrevious(bool);
931 void setGridEquidistantRows(bool);
932 void setGridEquidistantColumns(bool);
933 void setLineJoin(Symbol);
934 void setLineCap(Symbol);
935 void setLineNumberSide(Symbol);
936 void setKernMode(Symbol);
937 void setInputWhitespaceTreatment(Symbol);
938 void setFillingDirection(Symbol);
939 void setWritingMode(Symbol);
940 void setLastLineQuadding(Symbol);
941 void setMathDisplayMode(Symbol);
942 void setScriptPreAlign(Symbol);
943 void setScriptPostAlign(Symbol);
944 void setScriptMidSupAlign(Symbol);
945 void setScriptMidSubAlign(Symbol);
946 void setNumeratorAlign(Symbol);
947 void setDenominatorAlign(Symbol);
948 void setGridPositionCellType(Symbol);
949 void setGridColumnAlignment(Symbol);
950 void setGridRowAlignment(Symbol);
951 void setBoxType(Symbol);
952 void setGlyphAlignmentMode(Symbol);
953 void setBoxBorderAlignment(Symbol);
954 void setCellRowAlignment(Symbol);
955 void setBorderAlignment(Symbol);
956 void setSidelineSide(Symbol);
957 void setHyphenationKeep(Symbol);
958 void setFontStructure(Symbol);
959 void setFontProportionateWidth(Symbol);
960 void setCellCrossed(Symbol);
961 void setMarginaliaSide(Symbol);
962 void setLayer(long);
963 void setBackgroundLayer(long);
964 void setBorderPriority(long);
965 void setLineRepeat(long);
966 void setSpan(long);
967 void setMinLeaderRepeat(long);
968 void setHyphenationRemainCharCount(long);
969 void setHyphenationPushCharCount(long);
970 void setWidowCount(long);
971 void setOrphanCount(long);
972 void setExpandTabs(long);
973 void setHyphenationLadderCount(long);
974 void setBackgroundTile(PublicId);
975 void setLineBreakingMethod(PublicId);
976 void setLineCompositionMethod(PublicId);
977 void setImplicitBidiMethod(PublicId);
978 void setGlyphSubstMethod(PublicId);
979 void setGlyphReorderMethod(PublicId);
980 void setHyphenationMethod(PublicId);
981 void setTableAutoWidthMethod(PublicId);
982 void setFontName(PublicId);
983 void setLanguage(Letter2);
984 void setCountry(Letter2);
985 void setEscapementSpaceBefore(const InlineSpace &);
986 void setEscapementSpaceAfter(const InlineSpace &);
987 void setInlineSpaceSpace(const OptInlineSpace &);
988 void setCharMap(Symbol);
989 void setGlyphSubstTable(const Vector<ConstPtr<GlyphSubstTable> > &);
990 void startNode(const NodePtr &, const StringC &processingMode);
991 void endNode();
992 void currentNodePageNumber(const NodePtr &);
993 void extensionSet(void (FOTBuilder::*)(bool), bool);
994 void extensionSet(void (FOTBuilder::*)(const StringC &), const StringC &);
995 void extensionSet(void (FOTBuilder::*)(long), long);
996 void extension(const ExtensionFlowObj &, const NodePtr &);
997 void startExtension(const CompoundExtensionFlowObj &,
998 const NodePtr &,
999 Vector<FOTBuilder *> &ports);
1000 void endExtension(const CompoundExtensionFlowObj &);
1001
1002 struct Call {
1003 Call() : next(0) {}
1004 virtual ~Call();
1005 virtual Call* clone() const = 0;
1006 virtual void emit(FOTBuilder &) const = 0;
1007 Call *next;
1008 };
1009 private:
1010 struct NoArgCall : Call {
1011 virtual Call* clone() const { return new NoArgCall(*this); }
1012 typedef void (FOTBuilder::*FuncPtr)();
1013 NoArgCall(FuncPtr f) : func(f) { }
1014 void emit(FOTBuilder &) const;
1015 FuncPtr func;
1016 };
1017 struct CharactersFromNodeCall : Call {
1018 CharactersFromNodeCall(const NodePtr &, const Char *, size_t);
1019 virtual Call* clone() const { return new CharactersFromNodeCall(*this); }
1020 void emit(FOTBuilder &) const;
1021 const Char *data;
1022 size_t size;
1023 NodePtr node;
1024 };
1025 struct CharactersCall : Call {
1026 CharactersCall(const Char *, size_t);
1027 virtual Call* clone() const { return new CharactersCall(*this); }
1028 void emit(FOTBuilder &) const;
1029 StringC str;
1030 };
1031 struct StartNodeCall : Call {
1032 StartNodeCall(const NodePtr &, const StringC &);
1033 virtual Call* clone() const { return new StartNodeCall(*this); }
1034 void emit(FOTBuilder &) const;
1035 NodePtr node;
1036 StringC mode;
1037 };
1038 struct ExtensionCall : Call {
1039 ExtensionCall(const ExtensionFlowObj &fo, const NodePtr &nd)
1040 : arg(fo.copy()), node(nd) { }
1041 ExtensionCall(const ExtensionCall& other);
1042 virtual Call* clone() const { return new ExtensionCall(*this); }
1043 void emit(FOTBuilder &) const;
1044 Owner<ExtensionFlowObj> arg;
1045 NodePtr node;
1046 };
1047 struct EndExtensionCall : Call {
1048 EndExtensionCall(const CompoundExtensionFlowObj &fo)
1049 : arg(fo.copy()->asCompoundExtensionFlowObj()) { }
1050 EndExtensionCall(const EndExtensionCall& other);
1051 virtual Call* clone() const { return new EndExtensionCall(*this); }
1052 void emit(FOTBuilder &) const;
1053 Owner<CompoundExtensionFlowObj> arg;
1054 };
1055 Call *calls_;
1056 Call **tail_;
1057 };
1058
1059 class STYLE_API NodeSaveFOTBuilder : public SaveFOTBuilder {
1060 public:
1061 NodeSaveFOTBuilder(const NodePtr &, const StringC &processingMode);
1062 virtual void emit(FOTBuilder&) const;
1063 private:
1064 NodePtr currentNode_;
1065 StringC processingMode_;
1066 };
1067
1068 class SaveFOTBuilder::Emitter {
1069 public:
1070 class Mark;
1071 Emitter(SaveFOTBuilder& source, FOTBuilder& sink);
1072 Emitter(Emitter& source, Mark from, Mark to, FOTBuilder& sink);
1073 void emit();
1074 Mark mark() const;
1075 private:
1076 SaveFOTBuilder& source_;
1077 FOTBuilder& sink_;
1078 Call* from_;
1079 Call* to_;
1080 Call* where_;
1081 };
1082
1083 class SaveFOTBuilder::Emitter::Mark {
1084 public:
1085 private:
1086 typedef SaveFOTBuilder::Call Call;
1087 Mark(Call* where) : where_(where) {}
1088 Call* where_;
1089 friend class SaveFOTBuilder::Emitter;
1090 };
1091
1092 // Would like to make this a member of SaveFOTBuilder, but can't because
1093 // they would be member templates which are poorly supported under most
1094 // compilers.
1095
1096 template <class Arg1>
1097 class OneArgCall : public SaveFOTBuilder::Call {
1098 public:
1099 typedef void (FOTBuilder::*FuncPtr)(Arg1);
1100 OneArgCall(FuncPtr f, Arg1 arg1) : func_(f), arg1_(arg1) {}
1101 virtual SaveFOTBuilder::Call* clone() const { return new OneArgCall(*this); }
1102 virtual void emit(FOTBuilder& fotb) const { (fotb.*func_)(arg1_); }
1103 private:
1104 FuncPtr func_;
1105 Arg1 arg1_;
1106 };
1107
1108 template <class Arg1>
1109 class OneRefArgCall : public SaveFOTBuilder::Call {
1110 public:
1111 typedef void (FOTBuilder::*FuncPtr)(const Arg1&);
1112 OneRefArgCall(FuncPtr f, const Arg1& arg1) : func_(f), arg1_(arg1) {}
1113 virtual SaveFOTBuilder::Call* clone() const { return new OneRefArgCall(*this); }
1114 virtual void emit(FOTBuilder& fotb) const { (fotb.*func_)(arg1_); }
1115 private:
1116 FuncPtr func_;
1117 Arg1 arg1_;
1118 };
1119
1120 // Would like to make this a member of SaveFOTBuilder, but can't because
1121 // it has members that are instances of SaveFOTBuilder.
1122
1123 struct StartSimplePageSequenceCall : SaveFOTBuilder::Call {
1124 StartSimplePageSequenceCall(FOTBuilder* headerFooter[FOTBuilder::nHF]);
1125 virtual SaveFOTBuilder::Call* clone() const { return new StartSimplePageSequenceCall(*this); }
1126 void emit(FOTBuilder&) const;
1127 SaveFOTBuilder headerFooter[FOTBuilder::nHF];
1128 };
1129
1130 struct StartFractionCall : SaveFOTBuilder::Call {
1131 StartFractionCall(FOTBuilder *&numerator, FOTBuilder *&denominator);
1132 virtual SaveFOTBuilder::Call* clone() const { return new StartFractionCall(*this); }
1133 void emit(FOTBuilder &) const;
1134 SaveFOTBuilder numerator;
1135 SaveFOTBuilder denominator;
1136 };
1137
1138 struct StartScriptCall : SaveFOTBuilder::Call {
1139 StartScriptCall(FOTBuilder *&preSup,
1140 FOTBuilder *&preSub,
1141 FOTBuilder *&postSup,
1142 FOTBuilder *&postSub,
1143 FOTBuilder *&midSup,
1144 FOTBuilder *&midSub);
1145 virtual SaveFOTBuilder::Call* clone() const { return new StartScriptCall(*this); }
1146 void emit(FOTBuilder &) const;
1147 SaveFOTBuilder preSup;
1148 SaveFOTBuilder preSub;
1149 SaveFOTBuilder postSup;
1150 SaveFOTBuilder postSub;
1151 SaveFOTBuilder midSup;
1152 SaveFOTBuilder midSub;
1153 };
1154
1155 struct StartMarkCall : public SaveFOTBuilder::Call {
1156 StartMarkCall(FOTBuilder *&overMark, FOTBuilder *&underMark);
1157 virtual SaveFOTBuilder::Call* clone() const { return new StartMarkCall(*this); }
1158 void emit(FOTBuilder &) const;
1159 SaveFOTBuilder overMark;
1160 SaveFOTBuilder underMark;
1161 };
1162
1163 struct StartFenceCall : public SaveFOTBuilder::Call {
1164 StartFenceCall(FOTBuilder *&open, FOTBuilder *&close);
1165 virtual SaveFOTBuilder::Call* clone() const { return new StartFenceCall(*this); }
1166 void emit(FOTBuilder &) const;
1167 SaveFOTBuilder open;
1168 SaveFOTBuilder close;
1169 };
1170
1171 struct StartRadicalCall : public SaveFOTBuilder::Call {
1172 StartRadicalCall(FOTBuilder *&degree);
1173 virtual SaveFOTBuilder::Call* clone() const { return new StartRadicalCall(*this); }
1174 void emit(FOTBuilder &) const;
1175 SaveFOTBuilder degree;
1176 };
1177
1178 struct StartMathOperatorCall : public SaveFOTBuilder::Call {
1179 StartMathOperatorCall(FOTBuilder *&oper,
1180 FOTBuilder *&lowerLimit,
1181 FOTBuilder *&upperLimit);
1182 virtual SaveFOTBuilder::Call* clone() const { return new StartMathOperatorCall(*this); }
1183 void emit(FOTBuilder &) const;
1184 SaveFOTBuilder oper;
1185 SaveFOTBuilder lowerLimit;
1186 SaveFOTBuilder upperLimit;
1187 };
1188
1189 struct StartTablePartCall : SaveFOTBuilder::Call {
1190 StartTablePartCall(const FOTBuilder::TablePartNIC &nic, FOTBuilder *&header, FOTBuilder *&footer);
1191 virtual SaveFOTBuilder::Call* clone() const { return new StartTablePartCall(*this); }
1192 void emit(FOTBuilder &) const;
1193 FOTBuilder::TablePartNIC arg;
1194 SaveFOTBuilder header;
1195 SaveFOTBuilder footer;
1196 };
1197
1198 struct StartMultiModeCall : SaveFOTBuilder::Call {
1199 StartMultiModeCall(const FOTBuilder::MultiMode *principalMode,
1200 const Vector<FOTBuilder::MultiMode> &namedModes,
1201 Vector<FOTBuilder *> &ports);
1202 StartMultiModeCall(const StartMultiModeCall& other);
1203 virtual SaveFOTBuilder::Call* clone() const { return new StartMultiModeCall(*this); }
1204 void emit(FOTBuilder &) const;
1205 FOTBuilder::MultiMode principalMode;
1206 bool hasPrincipalMode;
1207 Vector<FOTBuilder::MultiMode> namedModes;
1208 IList<SaveFOTBuilder> ports;
1209 };
1210
1211 struct StartExtensionCall : SaveFOTBuilder::Call {
1212 StartExtensionCall(const FOTBuilder::CompoundExtensionFlowObj &,
1213 const NodePtr &,
1214 Vector<FOTBuilder *> &);
1215 StartExtensionCall(const StartExtensionCall& other);
1216 virtual SaveFOTBuilder::Call* clone() const { return new StartExtensionCall(*this); }
1217 void emit(FOTBuilder &) const;
1218 IList<SaveFOTBuilder> ports;
1219 NodePtr node;
1220 Owner<FOTBuilder::CompoundExtensionFlowObj> flowObj;
1221 };
1222
1223 // This uses SaveFOTBuilder to provide a serial view of multi-port objects.
1224
1225 class STYLE_API SerialFOTBuilder : public FOTBuilder {
1226 public:
1227 SerialFOTBuilder();
1228 // Instead of overriding these
1229 void startSimplePageSequence(FOTBuilder* headerFooter[nHF]);
1230 void endSimplePageSequenceHeaderFooter();
1231 void endSimplePageSequence();
1232 void startTablePart(const TablePartNIC &,
1233 FOTBuilder *&header, FOTBuilder *&footer);
1234 void endTablePart();
1235 void startFraction(FOTBuilder *&numerator, FOTBuilder *&denominator);
1236 void endFraction();
1237 void startScript(FOTBuilder *&preSup,
1238 FOTBuilder *&preSub,
1239 FOTBuilder *&postSup,
1240 FOTBuilder *&postSub,
1241 FOTBuilder *&midSup,
1242 FOTBuilder *&midSub);
1243 void endScript();
1244 void startMark(FOTBuilder *&overMark, FOTBuilder *&underMark);
1245 void endMark();
1246 void startFence(FOTBuilder *&open, FOTBuilder *&close);
1247 void endFence();
1248 void startRadical(FOTBuilder *&degree);
1249 void endRadical();
1250 void startMathOperator(FOTBuilder *&oper,
1251 FOTBuilder *&lowerLimit,
1252 FOTBuilder *&upperLimit);
1253 void endMathOperator();
1254 void startMultiMode(const MultiMode *,
1255 const Vector<MultiMode> &,
1256 Vector<FOTBuilder *> &);
1257 void endMultiMode();
1258 void startExtension(const CompoundExtensionFlowObj &,
1259 const NodePtr &,
1260 Vector<FOTBuilder *> &ports);
1261 void endExtension(const CompoundExtensionFlowObj &);
1262 // Override these
1263 virtual void startSimplePageSequenceSerial();
1264 virtual void endSimplePageSequenceSerial();
1265 virtual void startSimplePageSequenceHeaderFooter(unsigned);
1266 virtual void endSimplePageSequenceHeaderFooter(unsigned);
1267 virtual void endAllSimplePageSequenceHeaderFooter();
1268 virtual void startFractionSerial();
1269 virtual void endFractionSerial();
1270 virtual void startFractionNumerator();
1271 virtual void endFractionNumerator();
1272 virtual void startFractionDenominator();
1273 virtual void endFractionDenominator();
1274 virtual void startScriptSerial();
1275 virtual void endScriptSerial();
1276 virtual void startScriptPreSup();
1277 virtual void endScriptPreSup();
1278 virtual void startScriptPreSub();
1279 virtual void endScriptPreSub();
1280 virtual void startScriptPostSup();
1281 virtual void endScriptPostSup();
1282 virtual void startScriptPostSub();
1283 virtual void endScriptPostSub();
1284 virtual void startScriptMidSup();
1285 virtual void endScriptMidSup();
1286 virtual void startScriptMidSub();
1287 virtual void endScriptMidSub();
1288 virtual void startMarkSerial();
1289 virtual void endMarkSerial();
1290 virtual void startMarkOver();
1291 virtual void endMarkOver();
1292 virtual void startMarkUnder();
1293 virtual void endMarkUnder();
1294 virtual void startFenceSerial();
1295 virtual void endFenceSerial();
1296 virtual void startFenceOpen();
1297 virtual void endFenceOpen();
1298 virtual void startFenceClose();
1299 virtual void endFenceClose();
1300 virtual void startRadicalSerial();
1301 virtual void endRadicalSerial();
1302 virtual void startRadicalDegree();
1303 virtual void endRadicalDegree();
1304 virtual void startMathOperatorSerial();
1305 virtual void endMathOperatorSerial();
1306 virtual void startMathOperatorOperator();
1307 virtual void endMathOperatorOperator();
1308 virtual void startMathOperatorLowerLimit();
1309 virtual void endMathOperatorLowerLimit();
1310 virtual void startMathOperatorUpperLimit();
1311 virtual void endMathOperatorUpperLimit();
1312 virtual void startTablePartSerial(const TablePartNIC &);
1313 virtual void endTablePartSerial();
1314 virtual void startTablePartHeader();
1315 virtual void endTablePartHeader();
1316 virtual void startTablePartFooter();
1317 virtual void endTablePartFooter();
1318 virtual void startMultiModeSerial(const MultiMode *);
1319 virtual void endMultiModeSerial();
1320 virtual void startMultiModeMode(const MultiMode &);
1321 virtual void endMultiModeMode();
1322 virtual void startExtensionSerial(const CompoundExtensionFlowObj &, const NodePtr &);
1323 virtual void endExtensionSerial(const CompoundExtensionFlowObj &);
1324 virtual void startExtensionStream(const StringC &);
1325 virtual void endExtensionStream(const StringC &);
1326 private:
1327 IList<SaveFOTBuilder> save_;
1328 Vector<Vector<MultiMode> > multiModeStack_;
1329 };
1330
1331 inline
1332 bool operator==(const FOTBuilder::GlyphId &g1, const FOTBuilder::GlyphId &g2)
1333 {
1334 return g1.publicId == g2.publicId && g1.suffix == g2.suffix;
1335 }
1336
1337 bool STYLE_API operator==(const StringC &, const char *);
1338
1339 #ifdef DSSSL_NAMESPACE
1340 }
1341 #endif
1342
1343 #endif /* not FOTBuilder_INCLUDED */
1344