1 // Copyright (c) 1996 James Clark
2 // See the file copying.txt for copying permission.
4 #ifndef SosofoObj_INCLUDED
5 #define SosofoObj_INCLUDED 1
9 #include "FOTBuilder.h"
11 #include "CopyOwner.h"
14 #ifdef DSSSL_NAMESPACE
15 namespace DSSSL_NAMESPACE {
21 class SosofoObj : public ELObj {
23 virtual void process(ProcessContext &) = 0;
24 SosofoObj *asSosofo();
25 virtual bool tableBorderStyle(StyleObj *&);
26 virtual bool ruleStyle(ProcessContext &, StyleObj *&);
27 virtual bool isRule();
28 virtual bool characterStyle(ProcessContext &, StyleObj *&, FOTBuilder::CharacterNIC &);
29 virtual bool isCharacter();
32 class NextMatchSosofoObj : public SosofoObj {
34 NextMatchSosofoObj(StyleObj *);
35 void process(ProcessContext &);
40 class EmptySosofoObj : public SosofoObj {
42 void process(ProcessContext &);
47 class ProcessNodeSosofoObj : public SosofoObj {
49 void *operator new(size_t, Collector &c) {
50 return c.allocateObject(1);
52 ProcessNodeSosofoObj(const NodePtr &node, const ProcessingMode *mode);
53 void process(ProcessContext &);
56 const ProcessingMode *mode_;
59 class ProcessNodeListSosofoObj : public SosofoObj {
61 ProcessNodeListSosofoObj(NodeListObj *, const ProcessingMode *);
62 void process(ProcessContext &);
63 void traceSubObjects(Collector &) const;
65 NodeListObj *nodeList_;
66 const ProcessingMode *mode_;
69 class AppendSosofoObj : public SosofoObj {
71 void *operator new(size_t, Collector &c) {
72 return c.allocateObject(1);
74 AppendSosofoObj() { hasSubObjects_ = 1; }
75 AppendSosofoObj *asAppendSosofo();
76 void process(ProcessContext &);
77 void append(SosofoObj *);
78 void traceSubObjects(Collector &) const;
80 Vector<SosofoObj *> v_;
83 class LiteralSosofoObj : public SosofoObj {
85 LiteralSosofoObj(ELObj *str) : str_(str) { hasSubObjects_ = 1; }
86 void process(ProcessContext &);
87 void traceSubObjects(Collector &) const;
92 class CurrentNodePageNumberSosofoObj : public SosofoObj {
94 void *operator new(size_t, Collector &c) {
95 return c.allocateObject(1);
97 CurrentNodePageNumberSosofoObj(const NodePtr &node) : node_(node) { }
98 void process(ProcessContext &);
103 class PageNumberSosofoObj : public SosofoObj {
105 PageNumberSosofoObj() { }
106 void process(ProcessContext &);
109 class CompoundFlowObj;
111 class FlowObj : public SosofoObj {
114 virtual FlowObj *copy(Collector &) const = 0;
115 virtual CompoundFlowObj *asCompoundFlowObj();
116 virtual bool hasNonInheritedC(const Identifier *) const;
117 virtual bool hasPseudoNonInheritedC(const Identifier *) const;
118 virtual void setNonInheritedC(const Identifier *, ELObj *, const Location &, Interpreter &);
119 virtual bool setImplicitChar(ELObj *, const Location &, Interpreter &);
120 void traceSubObjects(Collector &) const;
121 void setStyle(StyleObj *);
122 void process(ProcessContext &);
123 virtual void pushStyle(ProcessContext &, unsigned &);
124 virtual void popStyle(ProcessContext &, unsigned);
125 virtual void processInner(ProcessContext &) = 0;
128 bool setDisplayNIC(FOTBuilder::DisplayNIC &,
129 const Identifier *, ELObj *,
130 const Location &, Interpreter &);
131 static bool isDisplayNIC(const Identifier *);
135 class CompoundFlowObj : public FlowObj {
137 CompoundFlowObj() : content_(0) { }
138 void processInner(ProcessContext &);
139 void traceSubObjects(Collector &) const;
140 void setContent(SosofoObj *content) { content_ = content; }
141 CompoundFlowObj *asCompoundFlowObj();
143 SosofoObj *content() const;
148 class SequenceFlowObj : public CompoundFlowObj {
150 SequenceFlowObj() { }
151 void processInner(ProcessContext &);
152 FlowObj *copy(Collector &) const;
155 class ProcessingMode;
157 class ProcessChildrenSosofoObj : public SosofoObj {
159 ProcessChildrenSosofoObj(const ProcessingMode *mode) : mode_(mode) { }
160 void process(ProcessContext &);
162 const ProcessingMode *mode_;
165 class ProcessChildrenTrimSosofoObj : public SosofoObj {
167 ProcessChildrenTrimSosofoObj(const ProcessingMode *mode) : mode_(mode) { }
168 void process(ProcessContext &);
170 const ProcessingMode *mode_;
173 class SetNonInheritedCsSosofoObj : public SosofoObj {
175 void *operator new(size_t, Collector &c) {
176 return c.allocateObject(1);
178 SetNonInheritedCsSosofoObj(FlowObj *, const InsnPtr &, ELObj **, const NodePtr &);
179 ~SetNonInheritedCsSosofoObj();
180 void process(ProcessContext &);
181 void traceSubObjects(Collector &) const;
182 bool characterStyle(ProcessContext &, StyleObj *&, FOTBuilder::CharacterNIC &);
184 bool ruleStyle(ProcessContext &, StyleObj *&);
187 ELObj *resolve(ProcessContext &);
197 // This wraps a flow object that has a label:.
198 class LabelSosofoObj : public SosofoObj {
200 void *operator new(size_t, Collector &c) {
201 return c.allocateObject(1);
203 LabelSosofoObj(SymbolObj *, const Location &, SosofoObj *content);
204 void process(ProcessContext &);
205 void traceSubObjects(Collector &) const;
208 Owner<Location> locp_;
212 // This wraps the content of a sosofo with a content-map:.
214 class ContentMapSosofoObj : public SosofoObj {
216 ContentMapSosofoObj(ELObj *, const Location *, SosofoObj *content);
217 void process(ProcessContext &);
218 void traceSubObjects(Collector &) const;
221 const Location *locp_;
225 class DiscardLabeledSosofoObj : public SosofoObj {
227 DiscardLabeledSosofoObj(SymbolObj *, SosofoObj *);
228 void process(ProcessContext &);
229 void traceSubObjects(Collector &) const;
235 class PageTypeSosofoObj : public SosofoObj {
237 PageTypeSosofoObj(unsigned, SosofoObj *, SosofoObj *);
238 void process(ProcessContext &);
239 void traceSubObjects(Collector &) const;
241 unsigned pageTypeFlag_;
247 void FlowObj::setStyle(StyleObj *style)
253 void AppendSosofoObj::append(SosofoObj *obj)
259 SosofoObj *CompoundFlowObj::content() const
264 #ifdef DSSSL_NAMESPACE
268 #endif /* not SosofoObj_INCLUDED */