Debian Codegraph @

fop-core/src/main/codegen/fo/properties.dtd

raw
1 <!--
2 Licensed to the Apache Software Foundation (ASF) under one or more
3 contributor license agreements. See the NOTICE file distributed with
4 this work for additional information regarding copyright ownership.
5 The ASF licenses this file to You under the Apache License, Version 2.0
6 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 -->
17 <!-- $Id$ -->
18 <!--
19 DTD for foproperties.xml and svgproperties.xml
20 -->
21
22 <!DOCTYPE property-list [
23 <!ELEMENT property-list (generic-property-list?, element-property-list*) >
24
25 <!-- This defines properties which are generic: meaning they are valid for
26 any formatting object in the namespace associated with this properties
27 file.
28 -->
29 <!ELEMENT generic-property-list (property+) >
30
31 <!-- This defines properties which are specific to a particular element.
32 The elements are specified in one or more localname elements. This
33 will generate code which can be used to set up element-specific
34 mappings for the PropertyListBuilder object.
35 -->
36 <!ELEMENT element-property-list (localname+, property+) >
37 <!ELEMENT localname (#PCDATA) >
38
39 <!-- Define a single property in the current namespace -->
40 <!ELEMENT property (name, (use-generic | datatype), class-name?, inherited?,
41 default?, enumeration?, datatype-conversion*, compound?,
42 keyword-equiv*, percent-ok?, auto-ok?, derive?, corresponding? ) >
43
44 <!-- If type is set to "ref", then this is not a new property definition,
45 but rather a reference to a property allready defined (should be in
46 another namespace). The "family" attribute then indicates in which
47 other property family the referenced attribute is defined. This is
48 used to let SVG reuse font-related properties defined in FO.
49 The family attribute is ignored if type isn't "ref".
50 If type = "generic", this is not a "real" property but rather a
51 template on which one or usually several other properties are
52 based. This reduces typing in the properties files and can reduce the
53 number and size of property classes created.
54 -->
55 <!ATTLIST property
56 type (ref|generic|normal) "normal"
57 family (fo|svg) "fo"
58 >
59 <!-- Sub-elements of property. -->
60 <!-- This gives the name of the attribute used to specify values for this
61 property in input FO or SVG files. It MUST be specified.
62 -->
63 <!ELEMENT name (#PCDATA) >
64
65 <!-- This gives the class name of the Java class which will be created to
66 represent values for this property. It doesn't need to be specified if
67 it can be deduced from the "name". The rule is that the first letter
68 of the property name and any name following a "-" are capitalized and
69 the "-" characters are removed. If you want to force a name, use the
70 class-name sub-element.
71 -->
72 <!ELEMENT class-name (#PCDATA) >
73
74 <!-- This indicates that this property is based on a generic property
75 datatype. This may be one hand-coded, such as SVGLengthProperty, or it
76 may be one which is created by a generic property definition in the
77 properties.xml file being processed. The content of this element is
78 the CLASSNAME of the generic property (NOTE: not its name). A property
79 can be based on a generic property and still override certain aspects
80 such as the default value, simply by specifying the appropriate
81 sub-elements.
82 If the "ispropclass" attribute = "true", then the contents of the
83 use-generic element is the name of a hard-coded Property subclass
84 and not of a generated Property.Maker subclass. This is currently
85 only used for the SVG properties, because they don't have a
86 rule-based relationship between the actual Property class name
87 and the name of the datatype stored by objects of that class.
88 -->
89 <!ELEMENT use-generic (#PCDATA) >
90 <!ATTLIST use-generic
91 ispropclass (true | false ) "false"
92 >
93
94 <!-- This indicates whether the property is inherited or not. Use the value
95 true for inherited and false for non-inherited. If the attribute
96 "type" is set to "specified", the specified rather than the computed
97 value of the property is inherited. An example is line-height, which
98 if specified using relative units or a percent, is recalculated
99 relative to the FONTSIZE of the current FO.
100 -->
101 <!ELEMENT inherited (#PCDATA) >
102 <!ATTLIST inherited
103 type (specified | computed) "computed"
104 >
105
106 <!-- This gives the datatype of the stored property values. It shouldn't be
107 specified if the property has a use-generic element. The value of this
108 element should be the name of either a basic Java class (String,
109 Integer) or a class defined as a FOP or SVG datatype (eg. ColorType).
110 NOTE: the value "Enum" is special and indicates an enumerated
111 datatype, stored as a Java "int". There is an EnumProperty class, but
112 no corresponding Enum class.
113 -->
114 <!ELEMENT datatype (#PCDATA) >
115
116 <!-- This element is used to specify the allowable values for enumerated
117 datatypes (<datatype>Enum</datatype>). Each value sub-element
118 specifies a possible value for the property. The "const" attribute for
119 each value is used to generate a public static constant value in the
120 class which can be referenced in code to test the property value. It
121 must be a legal Java identifier. By convention, use all caps.
122 -->
123 <!ELEMENT enumeration (value+) >
124 <!ELEMENT value (#PCDATA) >
125 <!ATTLIST value
126 const CDATA #REQUIRED
127 >
128
129 <!-- This gives the default value for a property if it is not specified on
130 a given FO. (The spec calls this the "initial" value.)
131
132 It may also be used to specify a default value for a particular
133 component of a compound property. This is used to give each component
134 its initial value if components are only partially specified in the
135 FO file.
136
137 NOTE: It should be an expression which can be parsed to give a legal
138 value for the property! This can't be checked by the generating
139 script, so if there is a problem, it will only be seen at runtime.
140 If the attribute "contextdep" is present and set to "true", the
141 generated code for the Maker will create a new Property object each
142 time it is asked to make the default value. Otherwise (the usual
143 case), it will only make one Property object with the default value
144 and return it on each call. Context-dependent default values include
145 those specified with relative units (eg. 1em).
146
147 The "subproperty" attribute can be used on properties which are
148 based on generic property specifications to specify a default value
149 for a particular component. For example, the border-end-width property
150 is based on GenericCondBorderWidth and specifies a specific default
151 for the "conditionality" component.
152 -->
153 <!ELEMENT default (#PCDATA) >
154 <!ATTLIST default
155 contextdep (true | false) "false"
156 subproperty CDATA #IMPLIED
157 >
158
159
160 <!-- The datatype-conversion element(s) specify how to handle property
161 values which can be specified in several ways. For example, the
162 line-height property can be specified as a Length, or as a number or
163 as a percent, which are both interpreted as being a factor of the
164 current font-size. The datatype for this property is Length. The
165 datatype-conversion element is used to handle the cases in which the
166 Property parser returns a type which is not a Length. Each element
167 tests it against a possible property type. The content gives the
168 actual code which should be inserted in the generated class in order
169 to correctly initialize the property value.
170 NOTE: the use of this for Color properties is rather a hack. All color
171 properties can be specified by a large number of keywords. To be
172 consistent with my logic we should use the keyword-equiv element. But
173 that was a lot of work. So for now, if the value evaluates to a String
174 and not to a ColorType, the datatype-conversion just uses it to
175 directly initialize a ColorType object.
176 -->
177 <!ELEMENT datatype-conversion (#PCDATA) >
178
179 <!-- The attribute from-type gives a possible property datatype, such as
180 Number or String. The varname gives the name of a variable which can
181 be used in the content of the datatype-conversion element. If the type
182 of the variable is not the same as from-type, it may be specified with
183 the attribute vartype.
184
185 An example of usage is from the line-height property. This should be
186 a Length object, but may be specified as a Number, which is interpreted
187 as though it were a percentage of the current font-size.
188 -->
189 <!ATTLIST datatype-conversion
190 from-type CDATA #REQUIRED
191 vartype CDATA #IMPLIED
192 varname CDATA #REQUIRED
193 >
194
195 <!-- The compound element indicates that the property is a "compound"
196 property as defined in the XSL specification. It is specified as one
197 or more individual attributes whose names are built up from the base
198 property name and the name of a compoent. Each "subproperty" element
199 describes a component of a compound property.
200 An example is space-before.
201 -->
202 <!ELEMENT compound (subproperty+) >
203
204 <!-- Describe one component of a compound property. Only the name and the
205 datatype should be specified. For example, in the space-before
206 property, the optimum component has the name optimum and the datatype
207 Length.
208 -->
209 <!ELEMENT subproperty (name, datatype, auto-ok?, default?, corresponding?,
210 enumeration?, keyword-equiv? ) >
211
212 <!-- This element which may be repeated, specifies keyword shorthands for
213 non-enumerated properties. For example, the border-width family of
214 properties can be specified either by a Length (eg. 1pt) or by one of
215 the keywords "thin", "medium", or "thick", each of which corresponds
216 to a "user-agent specific value" (XSL Spec.) These values are defined
217 by the keyword-equiv element. The "match" attribute gives the string
218 keyword value and the content is the replacement value, which should
219 be able to be evaluated to produce an object of the property's
220 datatype (such as Length). An example is:
221 <keyword-equiv match="thin" eval="true">0.5pt</keyword-equiv>
222 The "eval" attribute indicates whether the specified value must be
223 "parsed" using the Property parser or whether it can be used to
224 directly construct an object of the appropriate datatype. The default
225 is to evaluate the specified value (like the default specification).
226 -->
227 <!ELEMENT keyword-equiv (#PCDATA) >
228 <!ATTLIST keyword-equiv
229 match CDATA #REQUIRED
230 eval (true|false) "true"
231 >
232
233 <!-- This element if present indicates that percent specifications are
234 allowed as property values. The attribute "base" indicates how the
235 actual value is calculated.
236 FONTSIZE - the value is a percent of the current font-size
237 INH-FONTSIZE - the value is a percent of the inherited
238 font-size. This is necessary because font-size itself can be specified
239 as a percent!
240 CONTAINING-BOX - the value is a percent of the appropriate
241 dimension of the containing box of this FO.
242 If none of these is specified, the content of the element is
243 assumed to be a Java expression which can be used to calculate an
244 absolute value. This expression can assume that the variables
245 propertyList and fo are in scope and refer to the FO on which the
246 property was specified as a percent.
247 -->
248 <!ELEMENT percent-ok (#PCDATA) >
249 <!ATTLIST percent-ok
250 base (FONTSIZE | INH-FONTSIZE | CONTAINING-BOX) #IMPLIED
251 >
252
253 <!-- This element if present indicates that a value of "auto" for a Length
254 specification is allowed. If "auto" is specified, a LengthProperty object
255 is created which holds a Length object of type "AUTO".
256 -->
257 <!ELEMENT auto-ok EMPTY >
258
259 <!-- This element if present indicates that the value of the property may
260 be computed (derived) from other properties if it isn't specified. It
261 assumes that the property is an Enum datatype. (Currently only used
262 for text-align-last.)
263 The "from" attribute gives the name of the property from which this
264 property is derived.
265 Each "if" sub-element specifies a possible value. The "match"
266 attribute is compared with the value of the "derive-from" property. If
267 it is equal, the value of the current property is set to the value
268 specified by the content of the "if" element.
269 -->
270 <!ELEMENT derive (if+) >
271 <!ATTLIST derive
272 from CDATA #REQUIRED
273 >
274 <!ELEMENT if (#PCDATA) >
275 <!ATTLIST if
276 match CDATA #REQUIRED
277 >
278
279 <!-- This element indicates that the value of the property is the same as
280 that of a "corresponding" absolute or writing-mode-relative property.
281 if the "use-if-specified" attribute has the value "true", then the
282 corresponding property value takes precedence over the property on
283 which it is specified. To be conformant to the specification, all the
284 the "absolute" versions of properties have precedence.
285 Example: if a get() call is made on padding-end for a FO using lr-tb
286 writing-mode, then the padding-right property will be used if it is
287 specified, even if padding-end is actually specified.
288 However, if a get() is made on padding-right, the value of padding-end
289 will only be used if padding-right isn't specified on the FO.
290 -->
291
292 <!ELEMENT corresponding (propval, propexpr?) >
293 <!ATTLIST corresponding
294 use-if-specified (true|false) "false"
295 >
296
297 <!-- If the value must be calculated using several other properties, the
298 propexpr element may be used. Then only example I know of are the
299 indent properties which are calculated based on the margin-* values
300 if those are specified, plus the corresponding padding and border-width
301 values.
302 -->
303 <!ELEMENT propexpr (propval | #PCDATA)+ >
304
305 <!-- The name of the corresponding property is given in the propval element.
306 The conversion between absolute and relative property names is
307 made using wmrel2abs or wm2bs2rel elements, intermixed with text.
308 For example, for the property "padding-left", the corresponding
309 property is "padding-start" if the inline progression direction is
310 left to right. This is expressed in the properties file with the
311 expression "padding-<wmabs2rel dir='LEFT'/>". The wmabs2rel element
312 is replaced by the writing-mode relative direction which corresponds
313 to the absolute direction LEFT using the writing-mode in effect for the
314 flow object where this property is specified.
315 -->
316 <!ELEMENT propval (wmrel2abs | wmabs2rel | #PCDATA)+ >
317
318 <!ELEMENT wmrel2abs EMPTY>
319 <!ATTLIST wmrel2abs
320 dir (BEFORE | AFTER | START | END | BLOCKPROGDIM | INLINEPROGDIM)
321 #REQUIRED
322 >
323
324 <!ELEMENT wmabs2rel EMPTY>
325 <!ATTLIST wmabs2rel
326 dir (TOP | BOTTOM | LEFT | RIGHT | HEIGHT | WIDTH ) #REQUIRED
327 >
328