1 // Copyright (c) 1996, 1997 James Clark
2 // See the file copying.txt for copying permission.
4 #ifndef FOTBuilder_INCLUDED
5 #define FOTBuilder_INCLUDED 1
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.
26 #include "ExternalId.h"
31 #define STYLE_API SP_DLLEXPORT
33 #define STYLE_API SP_DLLIMPORT
35 #else /* not SP_USE_DLL */
36 #define STYLE_API /* as nothing */
37 #endif /* not SP_USE_DLL */
39 #ifdef DSSSL_NAMESPACE
40 namespace DSSSL_NAMESPACE {
45 class STYLE_API FOTBuilder {
51 // These are guaranteed to be in increasing order of weight,
72 symbolBackSlantedOblique,
74 symbolBackSlantedItalic,
100 symbolLineProgression,
156 enum { nSymbols = symbolColumnMajor + 1 };
157 typedef const char *PublicId;
159 GlyphId() : publicId(0), suffix(0) { }
160 GlyphId(const char *s, unsigned long n = 0) : publicId(s), suffix(n) { }
162 // If suffix is non-zero, then add a double-colon plus
163 // the suffix in decimal onto publicId to get the complete
164 // public identifier of the glyph id.
165 unsigned long suffix;
167 struct GlyphSubstTable : public Resource {
169 Vector<GlyphId> pairs;
170 GlyphId subst(const GlyphId &) const;
172 // SP_LETTER2('U', 'K')
173 #define SP_LETTER2(c1, c2) (((c1) << 8) | (c2))
174 typedef unsigned Letter2;
177 LengthSpec(long len = 0) : length(len), displaySizeFactor(0.0) { }
179 double displaySizeFactor;
180 operator bool() const { return length != 0 || displaySizeFactor != 0.0; }
182 struct TableLengthSpec : LengthSpec {
183 TableLengthSpec() : tableUnitFactor(0.0) { }
184 double tableUnitFactor;
186 struct OptLengthSpec {
187 OptLengthSpec() : hasLength(0) { }
191 struct DisplaySpace {
192 DisplaySpace() : priority(0), conditional(1), force(0) { }
205 struct OptInlineSpace {
206 OptInlineSpace() : hasSpace(0) { }
210 // non-inherited characteristics for all displayed flow objects
213 DisplaySpace spaceBefore;
214 DisplaySpace spaceAfter;
215 Symbol positionPreference;
219 bool keepWithPrevious;
221 bool mayViolateKeepBefore;
222 bool mayViolateKeepAfter;
226 long breakBeforePriority;
227 long breakAfterPriority;
229 struct DisplayGroupNIC : DisplayNIC {
234 struct ExternalGraphicNIC : DisplayNIC, InlineNIC {
235 ExternalGraphicNIC();
237 Symbol scaleType; // symbolFalse if not a symbol
238 double scale[2]; // if scaleType == symbolFalse
239 StringC entitySystemId;
240 StringC notationSystemId;
244 LengthSpec maxHeight;
245 // These apply only if !isDisplay
246 // symbolFalse if no escapementDirection
247 Symbol escapementDirection;
248 LengthSpec positionPointX;
249 LengthSpec positionPointY;
251 struct BoxNIC : DisplayNIC, InlineNIC {
255 struct RuleNIC : DisplayNIC, InlineNIC {
261 struct LeaderNIC : InlineNIC {
266 // A paragraph has the same non-inherited characteristics
267 // as a display-group.
268 typedef DisplayNIC ParagraphNIC;
269 struct CharacterNIC {
272 cIsDropAfterLineBreak,
273 cIsDropUnlessBeforeLineBreak,
284 cBreakBeforePriority,
291 long breakBeforePriority;
292 long breakAfterPriority;
294 Symbol mathFontPosture;
296 bool isDropAfterLineBreak;
297 bool isDropUnlessBeforeLineBreak;
299 bool isInputWhitespace;
303 // This doesn't have a flag in specifiedC,
304 // because it has a fixed default.
305 double stretchFactor;
307 typedef InlineNIC LineFieldNIC;
308 struct TableNIC : public DisplayNIC {
318 typedef DisplayNIC TablePartNIC;
319 struct TableColumnNIC {
321 unsigned columnIndex; // zero-based
322 unsigned nColumnsSpanned;
324 TableLengthSpec width;
326 struct TableCellNIC {
328 // If true, this isn't a real table cell.
329 // Rather it's one that can be used to fill in cells missing in this row.
331 unsigned columnIndex; // zero-based
332 unsigned nColumnsSpanned;
333 unsigned nRowsSpanned;
335 struct DeviceRGBColor {
350 // An address that was resolved by the front-end to a node
351 // Only the node member is valid.
353 // node contains current node, params[0] is string.
362 // Gives current node or resolved node.
366 virtual SaveFOTBuilder *asSaveFOTBuilder();
367 virtual ~FOTBuilder();
368 // Default for compound flow objects
369 virtual void start();
371 // Default for atomic flow objects: defaults to start(); end();
372 virtual void atomic();
373 // Atomic flow objects
374 virtual void characters(const Char *, size_t);
375 // Like characters(), but data comes from charChunk() on a NodePtr.
376 // If you are building a tree, then the NodePtr can be saved instead
377 // of the data. The default implementation calls characters().
378 virtual void charactersFromNode(const NodePtr &, const Char *, size_t);
379 virtual void character(const CharacterNIC &);
380 virtual void paragraphBreak(const ParagraphNIC &);
381 virtual void externalGraphic(const ExternalGraphicNIC &);
382 virtual void rule(const RuleNIC &);
383 virtual void alignmentPoint();
384 // For flow object class public id
385 // "UNREGISTERED::James Clark//Flow Object Class::formatting-instruction"
386 virtual void formattingInstruction(const StringC &);
387 // Non-atomic flow objects
388 virtual void startSequence();
389 virtual void endSequence();
390 virtual void startLineField(const LineFieldNIC &);
391 virtual void endLineField();
392 virtual void startParagraph(const ParagraphNIC &);
393 virtual void endParagraph();
394 virtual void startDisplayGroup(const DisplayGroupNIC &);
395 virtual void endDisplayGroup();
396 virtual void startScroll();
397 virtual void endScroll();
398 virtual void startLink(const Address &);
399 virtual void endLink();
400 virtual void startMarginalia();
401 virtual void endMarginalia();
402 virtual void startMultiMode(const MultiMode *principalPort, // null if no principal port
403 const Vector<MultiMode> &namedPorts,
404 Vector<FOTBuilder *> &);
405 virtual void endMultiMode();
406 virtual void startScore(Char);
407 virtual void startScore(const LengthSpec &);
408 virtual void startScore(Symbol);
409 virtual void endScore();
410 virtual void startLeader(const LeaderNIC &);
411 virtual void endLeader();
412 virtual void startSideline();
413 virtual void endSideline();
414 virtual void startBox(const BoxNIC &);
415 virtual void endBox();
417 virtual void startTable(const TableNIC &);
418 virtual void endTable();
419 // A call for each border is made immediately
420 // after startTable(), each preceded by any appropriate set*() calls.
421 virtual void tableBeforeRowBorder();
422 virtual void tableAfterRowBorder();
423 virtual void tableBeforeColumnBorder();
424 virtual void tableAfterColumnBorder();
425 virtual void startTablePart(const TablePartNIC &, FOTBuilder *&header, FOTBuilder *&footer);
426 virtual void endTablePart();
427 virtual void tableColumn(const TableColumnNIC &);
428 virtual void startTableRow();
429 virtual void endTableRow();
430 virtual void startTableCell(const TableCellNIC &);
431 virtual void endTableCell();
432 virtual void tableCellBeforeRowBorder();
433 virtual void tableCellAfterRowBorder();
434 virtual void tableCellBeforeColumnBorder();
435 virtual void tableCellAfterColumnBorder();
436 // Implementation must set numerator and denominator
437 // must be set to non-null values.
438 virtual void startMathSequence();
439 virtual void endMathSequence();
440 virtual void startFraction(FOTBuilder *&numerator, FOTBuilder *&denominator);
441 // startFraction is followed by call to fractionBar with set...() calls
443 virtual void fractionBar();
444 virtual void endFraction();
445 virtual void startUnmath();
446 virtual void endUnmath();
447 virtual void startSuperscript();
448 virtual void endSuperscript();
449 virtual void startSubscript();
450 virtual void endSubscript();
451 virtual void startScript(FOTBuilder *&preSup,
453 FOTBuilder *&postSup,
454 FOTBuilder *&postSub,
456 FOTBuilder *&midSub);
457 virtual void endScript();
458 virtual void startMark(FOTBuilder *&overMark, FOTBuilder *&underMark);
459 virtual void endMark();
460 virtual void startFence(FOTBuilder *&open, FOTBuilder *&close);
461 virtual void endFence();
462 virtual void startRadical(FOTBuilder *°ree);
463 // startRadical is followed by one of the following
464 virtual void radicalRadical(const CharacterNIC &);
465 virtual void radicalRadicalDefaulted();
466 virtual void endRadical();
467 virtual void startMathOperator(FOTBuilder *&oper,
468 FOTBuilder *&lowerLimit,
469 FOTBuilder *&upperLimit);
470 virtual void endMathOperator();
477 virtual void startGrid(const GridNIC &);
478 virtual void endGrid();
482 unsigned columnNumber;
485 virtual void startGridCell(const GridCellNIC &);
486 virtual void endGridCell();
489 // Headers and footers are treated like a separate port.
490 // There are 24 different parts to the headers and footers
491 // numbered 0 to 027; the numbers are computed by or'ing the
494 // first page or other page
497 // front page or back page
503 // left, center or right part of header
507 // number of different HF calls
510 virtual void startSimplePageSequence(FOTBuilder* headerFooter[nHF]);
511 virtual void endSimplePageSequenceHeaderFooter();
512 virtual void endSimplePageSequence();
514 // page-number sosofo
515 virtual void pageNumber();
516 // Inherited characteristics
517 // Set the value of the characteristic for the next flow object.
518 // Inherited characteristics that are not explicitly set have
519 // the same value as the parent flow object.
520 virtual void setFontSize(Length);
521 virtual void setFontFamilyName(const StringC &);
522 virtual void setFontWeight(Symbol);
523 virtual void setFontPosture(Symbol);
524 virtual void setStartIndent(const LengthSpec &);
525 virtual void setEndIndent(const LengthSpec &);
526 virtual void setFirstLineStartIndent(const LengthSpec &);
527 virtual void setLastLineEndIndent(const LengthSpec &);
528 virtual void setLineSpacing(const LengthSpec &);
529 virtual void setFieldWidth(const LengthSpec &);
530 virtual void setMarginaliaSep(const LengthSpec &);
531 virtual void setLines(Symbol);
532 virtual void setQuadding(Symbol);
533 virtual void setDisplayAlignment(Symbol);
534 virtual void setFieldAlign(Symbol);
535 virtual void setColor(const DeviceRGBColor &);
536 virtual void setBackgroundColor(); // background of #f
537 virtual void setBackgroundColor(const DeviceRGBColor &);
538 virtual void setBorderPresent(bool);
539 virtual void setLineThickness(Length);
540 virtual void setCellBeforeRowMargin(Length);
541 virtual void setCellAfterRowMargin(Length);
542 virtual void setCellBeforeColumnMargin(Length);
543 virtual void setCellAfterColumnMargin(Length);
544 virtual void setLineSep(Length);
545 virtual void setBoxSizeBefore(Length);
546 virtual void setBoxSizeAfter(Length);
547 virtual void setPositionPointShift(const LengthSpec &);
548 virtual void setStartMargin(const LengthSpec &);
549 virtual void setEndMargin(const LengthSpec &);
550 virtual void setSidelineSep(const LengthSpec &);
551 virtual void setAsisWrapIndent(const LengthSpec &);
552 virtual void setLineNumberSep(const LengthSpec &);
553 virtual void setLastLineJustifyLimit(const LengthSpec &);
554 virtual void setJustifyGlyphSpaceMaxAdd(const LengthSpec &);
555 virtual void setJustifyGlyphSpaceMaxRemove(const LengthSpec &);
556 virtual void setTableCornerRadius(const LengthSpec &);
557 virtual void setBoxCornerRadius(const LengthSpec &);
558 virtual void setMinPreLineSpacing(const OptLengthSpec &);
559 virtual void setMinPostLineSpacing(const OptLengthSpec &);
560 virtual void setMinLeading(const OptLengthSpec &);
561 virtual void setInhibitLineBreaks(bool);
562 virtual void setHyphenate(bool);
563 virtual void setKern(bool);
564 virtual void setLigature(bool);
565 virtual void setScoreSpaces(bool);
566 virtual void setFloatOutMarginalia(bool);
567 virtual void setFloatOutSidelines(bool);
568 virtual void setFloatOutLineNumbers(bool);
569 virtual void setCellBackground(bool);
570 virtual void setSpanWeak(bool);
571 virtual void setIgnoreRecordEnd(bool);
572 virtual void setNumberedLines(bool);
573 virtual void setHangingPunct(bool);
574 virtual void setBoxOpenEnd(bool);
575 virtual void setTruncateLeader(bool);
576 virtual void setAlignLeader(bool);
577 virtual void setTablePartOmitMiddleHeader(bool);
578 virtual void setTablePartOmitMiddleFooter(bool);
579 virtual void setBorderOmitAtBreak(bool);
580 virtual void setPrincipalModeSimultaneous(bool);
581 virtual void setMarginaliaKeepWithPrevious(bool);
582 virtual void setGridEquidistantRows(bool);
583 virtual void setGridEquidistantColumns(bool);
584 virtual void setLineJoin(Symbol);
585 virtual void setLineCap(Symbol);
586 virtual void setLineNumberSide(Symbol);
587 virtual void setKernMode(Symbol);
588 virtual void setInputWhitespaceTreatment(Symbol);
589 virtual void setFillingDirection(Symbol);
590 virtual void setWritingMode(Symbol);
591 virtual void setLastLineQuadding(Symbol);
592 virtual void setMathDisplayMode(Symbol);
593 virtual void setScriptPreAlign(Symbol);
594 virtual void setScriptPostAlign(Symbol);
595 virtual void setScriptMidSupAlign(Symbol);
596 virtual void setScriptMidSubAlign(Symbol);
597 virtual void setNumeratorAlign(Symbol);
598 virtual void setDenominatorAlign(Symbol);
599 virtual void setGridPositionCellType(Symbol);
600 virtual void setGridColumnAlignment(Symbol);
601 virtual void setGridRowAlignment(Symbol);
602 virtual void setBoxType(Symbol);
603 virtual void setGlyphAlignmentMode(Symbol);
604 virtual void setBoxBorderAlignment(Symbol);
605 virtual void setCellRowAlignment(Symbol);
606 virtual void setBorderAlignment(Symbol);
607 virtual void setSidelineSide(Symbol);
608 virtual void setHyphenationKeep(Symbol);
609 virtual void setFontStructure(Symbol);
610 virtual void setFontProportionateWidth(Symbol);
611 virtual void setCellCrossed(Symbol);
612 virtual void setMarginaliaSide(Symbol);
613 virtual void setLayer(long);
614 virtual void setBackgroundLayer(long);
615 virtual void setBorderPriority(long);
616 virtual void setLineRepeat(long);
617 virtual void setSpan(long);
618 virtual void setMinLeaderRepeat(long);
619 virtual void setHyphenationRemainCharCount(long);
620 virtual void setHyphenationPushCharCount(long);
621 virtual void setWidowCount(long);
622 virtual void setOrphanCount(long);
624 virtual void setExpandTabs(long);
625 virtual void setHyphenationLadderCount(long);
627 virtual void setBackgroundTile(PublicId);
628 virtual void setLineBreakingMethod(PublicId);
629 virtual void setLineCompositionMethod(PublicId);
630 virtual void setImplicitBidiMethod(PublicId);
631 virtual void setGlyphSubstMethod(PublicId);
632 virtual void setGlyphReorderMethod(PublicId);
633 virtual void setHyphenationMethod(PublicId);
634 virtual void setTableAutoWidthMethod(PublicId);
635 virtual void setFontName(PublicId);
637 virtual void setLanguage(Letter2);
638 virtual void setCountry(Letter2);
639 virtual void setEscapementSpaceBefore(const InlineSpace &);
640 virtual void setEscapementSpaceAfter(const InlineSpace &);
641 virtual void setInlineSpaceSpace(const OptInlineSpace &);
642 // For simple page sequence
643 virtual void setPageWidth(Length);
644 virtual void setPageHeight(Length);
645 virtual void setLeftMargin(Length);
646 virtual void setRightMargin(Length);
647 virtual void setTopMargin(Length);
648 virtual void setBottomMargin(Length);
649 virtual void setHeaderMargin(Length);
650 virtual void setFooterMargin(Length);
652 virtual void setGlyphSubstTable(const Vector<ConstPtr<GlyphSubstTable> > &);
654 // processingMode is empty for initial processing mode.
655 virtual void startNode(const NodePtr &, const StringC &processingMode);
656 virtual void endNode();
657 virtual void currentNodePageNumber(const NodePtr &);
659 class CompoundExtensionFlowObj;
660 class STYLE_API ExtensionFlowObj {
662 virtual ~ExtensionFlowObj();
665 virtual bool convertString(StringC &) const = 0;
666 virtual bool convertStringPairList(Vector<StringC> &) const = 0;
667 virtual bool convertStringList(Vector<StringC> &) const = 0;
668 virtual bool convertBoolean(bool &) const = 0;
670 virtual CompoundExtensionFlowObj *asCompoundExtensionFlowObj();
671 virtual const CompoundExtensionFlowObj *asCompoundExtensionFlowObj() const;
672 virtual bool hasNIC(const StringC &) const;
673 virtual void setNIC(const StringC &, const Value &);
674 virtual ExtensionFlowObj *copy() const = 0;
676 class STYLE_API CompoundExtensionFlowObj : public ExtensionFlowObj {
678 CompoundExtensionFlowObj *asCompoundExtensionFlowObj();
679 const CompoundExtensionFlowObj *asCompoundExtensionFlowObj() const;
680 virtual bool hasPrincipalPort() const;
681 virtual void portNames(Vector<StringC> &) const;
684 // extension inherited characteristics
686 virtual void extensionSet(void (FOTBuilder::*)(bool), bool);
687 virtual void extensionSet(void (FOTBuilder::*)(const StringC &), const StringC &);
688 virtual void extensionSet(void (FOTBuilder::*)(long), long);
690 // extension flow objects
691 virtual void extension(const ExtensionFlowObj &, const NodePtr &);
692 virtual void startExtension(const CompoundExtensionFlowObj &,
694 Vector<FOTBuilder *> &ports);
695 virtual void endExtension(const CompoundExtensionFlowObj &);
699 void (FOTBuilder::*boolSetter)(bool);
700 void (FOTBuilder::*stringSetter)(const StringC &);
701 void (FOTBuilder::*integerSetter)(long);
702 void (FOTBuilder::*lengthSetter)(Length);
703 const ExtensionFlowObj *flowObj;
706 static const char *symbolName(Symbol);
709 class STYLE_API SaveFOTBuilder : public Link, public FOTBuilder {
712 SaveFOTBuilder(const NodePtr &, const StringC &processingMode);
714 SaveFOTBuilder *asSaveFOTBuilder();
715 void emit(FOTBuilder &);
716 void characters(const Char *, size_t);
717 void charactersFromNode(const NodePtr &, const Char *, size_t);
718 void character(const CharacterNIC &);
719 void paragraphBreak(const ParagraphNIC &);
720 void externalGraphic(const ExternalGraphicNIC &);
721 void rule(const RuleNIC &);
722 void alignmentPoint();
723 void formattingInstruction(const StringC &);
724 void startSequence();
726 void startLineField(const LineFieldNIC &);
728 void startParagraph(const ParagraphNIC &);
730 void startDisplayGroup(const DisplayGroupNIC &);
731 void endDisplayGroup();
734 void startLink(const Address &);
736 void startMultiMode(const MultiMode *principalPort,
737 const Vector<MultiMode> &namedPorts,
738 Vector<FOTBuilder *> &);
740 void startMarginalia();
741 void endMarginalia();
742 void startScore(Char);
743 void startScore(const LengthSpec &);
744 void startScore(Symbol);
746 void startLeader(const LeaderNIC &);
748 void startSideline();
750 void startBox(const BoxNIC &);
752 void startSimplePageSequence(FOTBuilder* headerFooter[nHF]);
753 void endSimplePageSequenceHeaderFooter();
754 void endSimplePageSequence();
755 // page-number sosofo
758 void startMathSequence();
759 void endMathSequence();
760 void startFraction(FOTBuilder *&numerator, FOTBuilder *&denominator);
765 void startSuperscript();
766 void endSuperscript();
767 void startSubscript();
769 void startScript(FOTBuilder *&preSup,
771 FOTBuilder *&postSup,
772 FOTBuilder *&postSub,
774 FOTBuilder *&midSub);
776 void startMark(FOTBuilder *&overMark, FOTBuilder *&underMark);
778 void startFence(FOTBuilder *&open, FOTBuilder *&close);
780 void startRadical(FOTBuilder *°ree);
782 void radicalRadical(const CharacterNIC &);
783 void radicalRadicalDefaulted();
784 void startMathOperator(FOTBuilder *&oper,
785 FOTBuilder *&lowerLimit,
786 FOTBuilder *&upperLimit);
787 void endMathOperator();
788 void startGrid(const GridNIC &);
790 void startGridCell(const GridCellNIC &);
794 void startTable(const TableNIC &);
796 void tableBeforeRowBorder();
797 void tableAfterRowBorder();
798 void tableBeforeColumnBorder();
799 void tableAfterColumnBorder();
800 void startTablePart(const TablePartNIC &, FOTBuilder *&header, FOTBuilder *&footer);
802 void tableColumn(const TableColumnNIC &);
803 void startTableRow();
805 void startTableCell(const TableCellNIC &);
807 void tableCellBeforeRowBorder();
808 void tableCellAfterRowBorder();
809 void tableCellBeforeColumnBorder();
810 void tableCellAfterColumnBorder();
811 // Inherited characteristics
812 void setFontSize(Length);
813 void setFontFamilyName(const StringC &);
814 void setFontWeight(Symbol);
815 void setFontPosture(Symbol);
816 void setStartIndent(const LengthSpec &);
817 void setEndIndent(const LengthSpec &);
818 void setFirstLineStartIndent(const LengthSpec &);
819 void setLastLineEndIndent(const LengthSpec &);
820 void setLineSpacing(const LengthSpec &);
821 void setFieldWidth(const LengthSpec &);
822 void setLines(Symbol);
823 void setQuadding(Symbol);
824 void setDisplayAlignment(Symbol);
825 void setFieldAlign(Symbol);
826 void setColor(const DeviceRGBColor &);
827 void setBackgroundColor(const DeviceRGBColor &);
828 void setBackgroundColor();
829 void setPageWidth(Length);
830 void setPageHeight(Length);
831 void setLeftMargin(Length);
832 void setRightMargin(Length);
833 void setTopMargin(Length);
834 void setBottomMargin(Length);
835 void setHeaderMargin(Length);
836 void setFooterMargin(Length);
837 void setBorderPresent(bool);
838 void setLineThickness(Length);
839 void setCellBeforeRowMargin(Length);
840 void setCellAfterRowMargin(Length);
841 void setCellBeforeColumnMargin(Length);
842 void setCellAfterColumnMargin(Length);
843 void setLineSep(Length);
844 void setBoxSizeBefore(Length);
845 void setBoxSizeAfter(Length);
846 void setPositionPointShift(const LengthSpec &);
847 void setStartMargin(const LengthSpec &);
848 void setEndMargin(const LengthSpec &);
849 void setSidelineSep(const LengthSpec &);
850 void setAsisWrapIndent(const LengthSpec &);
851 void setLineNumberSep(const LengthSpec &);
852 void setLastLineJustifyLimit(const LengthSpec &);
853 void setJustifyGlyphSpaceMaxAdd(const LengthSpec &);
854 void setJustifyGlyphSpaceMaxRemove(const LengthSpec &);
855 void setTableCornerRadius(const LengthSpec &);
856 void setBoxCornerRadius(const LengthSpec &);
857 void setMarginaliaSep(const LengthSpec &);
858 void setMinPreLineSpacing(const OptLengthSpec &);
859 void setMinPostLineSpacing(const OptLengthSpec &);
860 void setMinLeading(const OptLengthSpec &);
861 void setInhibitLineBreaks(bool);
862 void setHyphenate(bool);
864 void setLigature(bool);
865 void setScoreSpaces(bool);
866 void setFloatOutMarginalia(bool);
867 void setFloatOutSidelines(bool);
868 void setFloatOutLineNumbers(bool);
869 void setCellBackground(bool);
870 void setSpanWeak(bool);
871 void setIgnoreRecordEnd(bool);
872 void setNumberedLines(bool);
873 void setHangingPunct(bool);
874 void setBoxOpenEnd(bool);
875 void setTruncateLeader(bool);
876 void setAlignLeader(bool);
877 void setTablePartOmitMiddleHeader(bool);
878 void setTablePartOmitMiddleFooter(bool);
879 void setBorderOmitAtBreak(bool);
880 void setPrincipalModeSimultaneous(bool);
881 void setMarginaliaKeepWithPrevious(bool);
882 void setGridEquidistantRows(bool);
883 void setGridEquidistantColumns(bool);
884 void setLineJoin(Symbol);
885 void setLineCap(Symbol);
886 void setLineNumberSide(Symbol);
887 void setKernMode(Symbol);
888 void setInputWhitespaceTreatment(Symbol);
889 void setFillingDirection(Symbol);
890 void setWritingMode(Symbol);
891 void setLastLineQuadding(Symbol);
892 void setMathDisplayMode(Symbol);
893 void setScriptPreAlign(Symbol);
894 void setScriptPostAlign(Symbol);
895 void setScriptMidSupAlign(Symbol);
896 void setScriptMidSubAlign(Symbol);
897 void setNumeratorAlign(Symbol);
898 void setDenominatorAlign(Symbol);
899 void setGridPositionCellType(Symbol);
900 void setGridColumnAlignment(Symbol);
901 void setGridRowAlignment(Symbol);
902 void setBoxType(Symbol);
903 void setGlyphAlignmentMode(Symbol);
904 void setBoxBorderAlignment(Symbol);
905 void setCellRowAlignment(Symbol);
906 void setBorderAlignment(Symbol);
907 void setSidelineSide(Symbol);
908 void setHyphenationKeep(Symbol);
909 void setFontStructure(Symbol);
910 void setFontProportionateWidth(Symbol);
911 void setCellCrossed(Symbol);
912 void setMarginaliaSide(Symbol);
914 void setBackgroundLayer(long);
915 void setBorderPriority(long);
916 void setLineRepeat(long);
918 void setMinLeaderRepeat(long);
919 void setHyphenationRemainCharCount(long);
920 void setHyphenationPushCharCount(long);
921 void setWidowCount(long);
922 void setOrphanCount(long);
923 void setExpandTabs(long);
924 void setHyphenationLadderCount(long);
925 void setBackgroundTile(PublicId);
926 void setLineBreakingMethod(PublicId);
927 void setLineCompositionMethod(PublicId);
928 void setImplicitBidiMethod(PublicId);
929 void setGlyphSubstMethod(PublicId);
930 void setGlyphReorderMethod(PublicId);
931 void setHyphenationMethod(PublicId);
932 void setTableAutoWidthMethod(PublicId);
933 void setFontName(PublicId);
934 void setLanguage(Letter2);
935 void setCountry(Letter2);
936 void setEscapementSpaceBefore(const InlineSpace &);
937 void setEscapementSpaceAfter(const InlineSpace &);
938 void setGlyphSubstTable(const Vector<ConstPtr<GlyphSubstTable> > &);
939 void startNode(const NodePtr &, const StringC &processingMode);
941 void currentNodePageNumber(const NodePtr &);
942 void extensionSet(void (FOTBuilder::*)(bool), bool);
943 void extensionSet(void (FOTBuilder::*)(const StringC &), const StringC &);
944 void extensionSet(void (FOTBuilder::*)(long), long);
945 void extension(const ExtensionFlowObj &, const NodePtr &);
946 void startExtension(const CompoundExtensionFlowObj &,
948 Vector<FOTBuilder *> &ports);
949 void endExtension(const CompoundExtensionFlowObj &);
953 virtual void emit(FOTBuilder &) = 0;
957 SaveFOTBuilder(const SaveFOTBuilder &); // undefined
958 void operator=(const SaveFOTBuilder &); // undefined
959 struct NoArgCall : Call {
960 typedef void (FOTBuilder::*FuncPtr)();
961 NoArgCall(FuncPtr f) : func(f) { }
962 void emit(FOTBuilder &);
965 struct LongArgCall : Call {
966 typedef void (FOTBuilder::*FuncPtr)(long);
967 LongArgCall(FuncPtr f, long n) : func(f), arg(n) { }
968 void emit(FOTBuilder &);
972 struct ExtensionLongArgCall : Call {
973 typedef void (FOTBuilder::*FuncPtr)(long);
974 ExtensionLongArgCall(FuncPtr f, long n) : func(f), arg(n) { }
975 void emit(FOTBuilder &);
979 struct LengthSpecArgCall : Call {
980 typedef void (FOTBuilder::*FuncPtr)(const LengthSpec &);
981 LengthSpecArgCall(FuncPtr f, const LengthSpec &ls) : func(f), arg(ls) { }
982 void emit(FOTBuilder &);
986 struct OptLengthSpecArgCall : Call {
987 typedef void (FOTBuilder::*FuncPtr)(const OptLengthSpec &);
988 OptLengthSpecArgCall(FuncPtr f, const OptLengthSpec &ols) : func(f), arg(ols) { }
989 void emit(FOTBuilder &);
993 struct NodePtrArgCall : Call {
994 typedef void (FOTBuilder::*FuncPtr)(const NodePtr &);
995 NodePtrArgCall(FuncPtr f, const NodePtr &nd) : func(f), arg(nd) { }
996 void emit(FOTBuilder &);
1000 struct StringArgCall : Call {
1001 typedef void (FOTBuilder::*FuncPtr)(const StringC &);
1002 StringArgCall(FuncPtr f, const StringC &s) : func(f), arg(s) { }
1003 void emit(FOTBuilder &);
1007 struct ExtensionStringArgCall : Call {
1008 typedef void (FOTBuilder::*FuncPtr)(const StringC &);
1009 ExtensionStringArgCall(FuncPtr f, const StringC &s) : func(f), arg(s) { }
1010 void emit(FOTBuilder &);
1014 struct CharArgCall : Call {
1015 typedef void (FOTBuilder::*FuncPtr)(Char);
1016 CharArgCall(FuncPtr f, Char c) : func(f), arg(c) { }
1017 void emit(FOTBuilder &);
1021 struct BoolArgCall : Call {
1022 typedef void (FOTBuilder::*FuncPtr)(bool);
1023 BoolArgCall(FuncPtr f, bool b) : func(f), arg(b) { }
1024 void emit(FOTBuilder &);
1028 struct ExtensionBoolArgCall : Call {
1029 typedef void (FOTBuilder::*FuncPtr)(bool);
1030 ExtensionBoolArgCall(FuncPtr f, bool b) : func(f), arg(b) { }
1031 void emit(FOTBuilder &);
1035 struct SymbolArgCall : Call {
1036 typedef void (FOTBuilder::*FuncPtr)(Symbol);
1037 SymbolArgCall(FuncPtr f, Symbol sym) : func(f), arg(sym) { }
1038 void emit(FOTBuilder &);
1042 struct PublicIdArgCall : Call {
1043 typedef void (FOTBuilder::*FuncPtr)(PublicId);
1044 PublicIdArgCall(FuncPtr f, PublicId pubid) : func(f), arg(pubid) { }
1045 void emit(FOTBuilder &);
1049 struct UnsignedArgCall : Call {
1050 typedef void (FOTBuilder::*FuncPtr)(unsigned);
1051 UnsignedArgCall(FuncPtr f, unsigned n) : func(f), arg(n) { }
1052 void emit(FOTBuilder &);
1056 struct DeviceRGBColorArgCall : Call {
1057 typedef void (FOTBuilder::*FuncPtr)(const DeviceRGBColor &);
1058 DeviceRGBColorArgCall(FuncPtr f, const DeviceRGBColor &color) : func(f), arg(color) { }
1059 void emit(FOTBuilder &);
1063 struct InlineSpaceArgCall : Call {
1064 typedef void (FOTBuilder::*FuncPtr)(const InlineSpace &);
1065 InlineSpaceArgCall(FuncPtr f, InlineSpace is) : func(f), arg(is) { }
1066 void emit(FOTBuilder &);
1070 struct CharactersFromNodeCall : Call {
1071 CharactersFromNodeCall(const NodePtr &, const Char *, size_t);
1072 void emit(FOTBuilder &);
1077 struct CharactersCall : Call {
1078 CharactersCall(const Char *, size_t);
1079 void emit(FOTBuilder &);
1082 struct CharacterCall : Call {
1083 CharacterCall(const CharacterNIC &nic) : arg(nic) { }
1084 void emit(FOTBuilder &);
1087 struct StartNodeCall : Call {
1088 StartNodeCall(const NodePtr &, const StringC &);
1089 void emit(FOTBuilder &);
1093 struct StartParagraphCall : Call {
1094 StartParagraphCall(const ParagraphNIC &nic);
1095 void emit(FOTBuilder &);
1098 struct ParagraphBreakCall : Call {
1099 ParagraphBreakCall(const ParagraphNIC &nic);
1100 void emit(FOTBuilder &);
1103 struct StartDisplayGroupCall : Call {
1104 StartDisplayGroupCall(const DisplayGroupNIC &nic);
1105 void emit(FOTBuilder &);
1106 DisplayGroupNIC arg;
1108 struct StartBoxCall : Call {
1109 StartBoxCall(const BoxNIC &nic) : arg(nic) { }
1110 void emit(FOTBuilder &);
1113 struct StartLineFieldCall : Call {
1114 StartLineFieldCall(const LineFieldNIC &nic) : arg(nic) { }
1115 void emit(FOTBuilder &);
1118 struct ExternalGraphicCall : Call {
1119 ExternalGraphicCall(const ExternalGraphicNIC &nic) : arg(nic) { }
1120 void emit(FOTBuilder &);
1121 ExternalGraphicNIC arg;
1123 struct RuleCall : Call {
1124 RuleCall(const RuleNIC &nic) : arg(nic) { }
1125 void emit(FOTBuilder &);
1128 struct StartLeaderCall : Call {
1129 StartLeaderCall(const LeaderNIC &nic) : arg(nic) { }
1130 void emit(FOTBuilder &);
1133 struct StartTableCall : Call {
1134 StartTableCall(const TableNIC &nic) : arg(nic) { }
1135 void emit(FOTBuilder &);
1138 struct TableColumnCall : Call {
1139 TableColumnCall(const TableColumnNIC &nic) : arg(nic) { }
1140 void emit(FOTBuilder &);
1143 struct StartTableCellCall : Call {
1144 StartTableCellCall(const TableCellNIC &nic) : arg(nic) { }
1145 void emit(FOTBuilder &);
1148 struct StartLinkCall : Call {
1149 StartLinkCall(const Address &addr) : arg(addr) { }
1150 void emit(FOTBuilder &);
1153 struct SetGlyphSubstTableCall : Call {
1154 SetGlyphSubstTableCall(const Vector<ConstPtr<GlyphSubstTable> > &tables) : arg(tables) { }
1155 void emit(FOTBuilder &);
1156 Vector<ConstPtr<GlyphSubstTable> > arg;
1158 struct StartGridCall : Call {
1159 StartGridCall(const GridNIC &nic) : arg(nic) { }
1160 void emit(FOTBuilder &);
1163 struct StartGridCellCall : Call {
1164 StartGridCellCall(const GridCellNIC &nic) : arg(nic) { }
1165 void emit(FOTBuilder &);
1168 struct RadicalRadicalCall : Call {
1169 RadicalRadicalCall(const CharacterNIC &nic) : arg(nic) { }
1170 void emit(FOTBuilder &);
1173 struct ExtensionCall : Call {
1174 ExtensionCall(const ExtensionFlowObj &fo, const NodePtr &nd)
1175 : arg(fo.copy()), node(nd) { }
1176 void emit(FOTBuilder &);
1177 Owner<ExtensionFlowObj> arg;
1180 struct EndExtensionCall : Call {
1181 EndExtensionCall(const CompoundExtensionFlowObj &fo)
1182 : arg(fo.copy()->asCompoundExtensionFlowObj()) { }
1183 void emit(FOTBuilder &);
1184 Owner<CompoundExtensionFlowObj> arg;
1188 NodePtr currentNode_;
1189 StringC processingMode_;
1192 // Would like to make this a member of SaveFOTBuilder, but can't because
1193 // it has members that are instances of SaveFOTBuilder.
1195 struct StartSimplePageSequenceCall : SaveFOTBuilder::Call {
1196 StartSimplePageSequenceCall(FOTBuilder* headerFooter[FOTBuilder::nHF]);
1197 void emit(FOTBuilder&);
1198 SaveFOTBuilder headerFooter[FOTBuilder::nHF];
1201 struct StartFractionCall : SaveFOTBuilder::Call {
1202 StartFractionCall(FOTBuilder *&numerator, FOTBuilder *&denominator);
1203 void emit(FOTBuilder &);
1204 SaveFOTBuilder numerator;
1205 SaveFOTBuilder denominator;
1208 struct StartScriptCall : SaveFOTBuilder::Call {
1209 StartScriptCall(FOTBuilder *&preSup,
1210 FOTBuilder *&preSub,
1211 FOTBuilder *&postSup,
1212 FOTBuilder *&postSub,
1213 FOTBuilder *&midSup,
1214 FOTBuilder *&midSub);
1215 void emit(FOTBuilder &);
1216 SaveFOTBuilder preSup;
1217 SaveFOTBuilder preSub;
1218 SaveFOTBuilder postSup;
1219 SaveFOTBuilder postSub;
1220 SaveFOTBuilder midSup;
1221 SaveFOTBuilder midSub;
1224 struct StartMarkCall : public SaveFOTBuilder::Call {
1225 StartMarkCall(FOTBuilder *&overMark, FOTBuilder *&underMark);
1226 void emit(FOTBuilder &);
1227 SaveFOTBuilder overMark;
1228 SaveFOTBuilder underMark;
1231 struct StartFenceCall : public SaveFOTBuilder::Call {
1232 StartFenceCall(FOTBuilder *&open, FOTBuilder *&close);
1233 void emit(FOTBuilder &);
1234 SaveFOTBuilder open;
1235 SaveFOTBuilder close;
1238 struct StartRadicalCall : public SaveFOTBuilder::Call {
1239 StartRadicalCall(FOTBuilder *°ree);
1240 void emit(FOTBuilder &);
1241 SaveFOTBuilder degree;
1244 struct StartMathOperatorCall : public SaveFOTBuilder::Call {
1245 StartMathOperatorCall(FOTBuilder *&oper,
1246 FOTBuilder *&lowerLimit,
1247 FOTBuilder *&upperLimit);
1248 void emit(FOTBuilder &);
1249 SaveFOTBuilder oper;
1250 SaveFOTBuilder lowerLimit;
1251 SaveFOTBuilder upperLimit;
1254 struct StartTablePartCall : SaveFOTBuilder::Call {
1255 StartTablePartCall(const FOTBuilder::TablePartNIC &nic, FOTBuilder *&header, FOTBuilder *&footer);
1256 void emit(FOTBuilder &);
1257 FOTBuilder::TablePartNIC arg;
1258 SaveFOTBuilder header;
1259 SaveFOTBuilder footer;
1262 struct StartMultiModeCall : SaveFOTBuilder::Call {
1263 StartMultiModeCall(const FOTBuilder::MultiMode *principalMode,
1264 const Vector<FOTBuilder::MultiMode> &namedModes,
1265 Vector<FOTBuilder *> &ports);
1266 void emit(FOTBuilder &);
1267 FOTBuilder::MultiMode principalMode;
1268 bool hasPrincipalMode;
1269 Vector<FOTBuilder::MultiMode> namedModes;
1270 IList<SaveFOTBuilder> ports;
1273 struct StartExtensionCall : SaveFOTBuilder::Call {
1274 StartExtensionCall(const FOTBuilder::CompoundExtensionFlowObj &,
1276 Vector<FOTBuilder *> &);
1277 void emit(FOTBuilder &);
1278 IList<SaveFOTBuilder> ports;
1280 Owner<FOTBuilder::CompoundExtensionFlowObj> flowObj;
1283 // This uses SaveFOTBuilder to provide a serial view of multi-port objects.
1285 class STYLE_API SerialFOTBuilder : public FOTBuilder {
1288 // Instead of overriding these
1289 void startSimplePageSequence(FOTBuilder* headerFooter[nHF]);
1290 void endSimplePageSequenceHeaderFooter();
1291 void endSimplePageSequence();
1292 void startTablePart(const TablePartNIC &,
1293 FOTBuilder *&header, FOTBuilder *&footer);
1294 void endTablePart();
1295 void startFraction(FOTBuilder *&numerator, FOTBuilder *&denominator);
1297 void startScript(FOTBuilder *&preSup,
1298 FOTBuilder *&preSub,
1299 FOTBuilder *&postSup,
1300 FOTBuilder *&postSub,
1301 FOTBuilder *&midSup,
1302 FOTBuilder *&midSub);
1304 void startMark(FOTBuilder *&overMark, FOTBuilder *&underMark);
1306 void startFence(FOTBuilder *&open, FOTBuilder *&close);
1308 void startRadical(FOTBuilder *°ree);
1310 void startMathOperator(FOTBuilder *&oper,
1311 FOTBuilder *&lowerLimit,
1312 FOTBuilder *&upperLimit);
1313 void endMathOperator();
1314 void startMultiMode(const MultiMode *,
1315 const Vector<MultiMode> &,
1316 Vector<FOTBuilder *> &);
1317 void endMultiMode();
1318 void startExtension(const CompoundExtensionFlowObj &,
1320 Vector<FOTBuilder *> &ports);
1321 void endExtension(const CompoundExtensionFlowObj &);
1323 virtual void startSimplePageSequenceSerial();
1324 virtual void endSimplePageSequenceSerial();
1325 virtual void startSimplePageSequenceHeaderFooter(unsigned);
1326 virtual void endSimplePageSequenceHeaderFooter(unsigned);
1327 virtual void endAllSimplePageSequenceHeaderFooter();
1328 virtual void startFractionSerial();
1329 virtual void endFractionSerial();
1330 virtual void startFractionNumerator();
1331 virtual void endFractionNumerator();
1332 virtual void startFractionDenominator();
1333 virtual void endFractionDenominator();
1334 virtual void startScriptSerial();
1335 virtual void endScriptSerial();
1336 virtual void startScriptPreSup();
1337 virtual void endScriptPreSup();
1338 virtual void startScriptPreSub();
1339 virtual void endScriptPreSub();
1340 virtual void startScriptPostSup();
1341 virtual void endScriptPostSup();
1342 virtual void startScriptPostSub();
1343 virtual void endScriptPostSub();
1344 virtual void startScriptMidSup();
1345 virtual void endScriptMidSup();
1346 virtual void startScriptMidSub();
1347 virtual void endScriptMidSub();
1348 virtual void startMarkSerial();
1349 virtual void endMarkSerial();
1350 virtual void startMarkOver();
1351 virtual void endMarkOver();
1352 virtual void startMarkUnder();
1353 virtual void endMarkUnder();
1354 virtual void startFenceSerial();
1355 virtual void endFenceSerial();
1356 virtual void startFenceOpen();
1357 virtual void endFenceOpen();
1358 virtual void startFenceClose();
1359 virtual void endFenceClose();
1360 virtual void startRadicalSerial();
1361 virtual void endRadicalSerial();
1362 virtual void startRadicalDegree();
1363 virtual void endRadicalDegree();
1364 virtual void startMathOperatorSerial();
1365 virtual void endMathOperatorSerial();
1366 virtual void startMathOperatorOperator();
1367 virtual void endMathOperatorOperator();
1368 virtual void startMathOperatorLowerLimit();
1369 virtual void endMathOperatorLowerLimit();
1370 virtual void startMathOperatorUpperLimit();
1371 virtual void endMathOperatorUpperLimit();
1372 virtual void startTablePartSerial(const TablePartNIC &);
1373 virtual void endTablePartSerial();
1374 virtual void startTablePartHeader();
1375 virtual void endTablePartHeader();
1376 virtual void startTablePartFooter();
1377 virtual void endTablePartFooter();
1378 virtual void startMultiModeSerial(const MultiMode *);
1379 virtual void endMultiModeSerial();
1380 virtual void startMultiModeMode(const MultiMode &);
1381 virtual void endMultiModeMode();
1382 virtual void startExtensionSerial(const CompoundExtensionFlowObj &, const NodePtr &);
1383 virtual void endExtensionSerial(const CompoundExtensionFlowObj &);
1384 virtual void startExtensionStream(const StringC &);
1385 virtual void endExtensionStream(const StringC &);
1387 IList<SaveFOTBuilder> save_;
1388 Vector<Vector<MultiMode> > multiModeStack_;
1392 bool operator==(const FOTBuilder::GlyphId &g1, const FOTBuilder::GlyphId &g2)
1394 return g1.publicId == g2.publicId && g1.suffix == g2.suffix;
1397 bool STYLE_API operator==(const StringC &, const char *);
1399 #ifdef DSSSL_NAMESPACE
1403 #endif /* not FOTBuilder_INCLUDED */