aboutsummaryrefslogtreecommitdiffstats
path: root/src/codegen/properties.dtd
blob: abb98ff89cdb510442c33c6ad4e9831198dfa918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!--
  Copyright 1999-2004 The Apache Software Foundation

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- $Id$ -->
<!--
DTD for foproperties.xml and svgproperties.xml
-->

<!DOCTYPE property-list [
<!ELEMENT property-list (generic-property-list?,  element-property-list*) >

<!-- This defines properties which are generic: meaning they are valid for
     any formatting object in the namespace associated with this properties
     file.
-->
<!ELEMENT generic-property-list (property+) >

<!-- This defines properties which are specific to a particular element.
     The elements are specified in one or more localname elements. This
     will generate code which can be used to set up element-specific
     mappings for the PropertyListBuilder object.
-->
<!ELEMENT element-property-list (localname+, property+) >
<!ELEMENT localname (#PCDATA) >

<!-- Define a single property in the current namespace -->
<!ELEMENT property (name, (use-generic | datatype), class-name?, inherited?,
   default?, enumeration?, datatype-conversion*, compound?,
   keyword-equiv*, percent-ok?, auto-ok?, derive?, corresponding? ) >

<!-- If type is set to "ref", then this is not a new property definition,
     but rather a reference to a property allready defined (should be in
     another namespace). The "family" attribute then indicates in which
     other property family the referenced attribute is defined. This is
     used to let SVG reuse font-related properties defined in FO.
     The family attribute is ignored if type isn't "ref".
     If type = "generic", this is not a "real" property but rather a
     template on which one or usually several other properties are
     based. This reduces typing in the properties files and can reduce the
     number and size of property classes created.
-->
<!ATTLIST property
   type   (ref|generic|normal) "normal"
   family (fo|svg) "fo"
>
<!-- Sub-elements of property. -->
<!-- This gives the name of the attribute used to specify values for this
     property in input FO or SVG files. It MUST be specified.
-->
<!ELEMENT name (#PCDATA) >

<!-- This gives the class name of the Java class which will be created to
     represent values for this property. It doesn't need to be specified if
     it can be deduced from the "name". The rule is that the first letter
     of the property name and any name following a "-" are capitalized and
     the "-" characters are removed. If you want to force a name, use the
     class-name sub-element.
-->
<!ELEMENT class-name (#PCDATA) >

<!-- This indicates that this property is based on a generic property
     datatype. This may be one hand-coded, such as SVGLengthProperty, or it
     may be one which is created by a generic property definition in the
     properties.xml file being processed. The content of this element is
     the CLASSNAME of the generic property (NOTE: not its name). A property
     can be based on a generic property and still override certain aspects
     such as the default value, simply by specifying the appropriate
     sub-elements.
     If the "ispropclass" attribute = "true", then the contents of the
     use-generic element is the name of a hard-coded Property subclass
     and not of a generated Property.Maker subclass. This is currently
     only used for the SVG properties, because they don't have a
     rule-based relationship between the actual Property class name
     and the name of the datatype stored by objects of that class.
-->
<!ELEMENT use-generic (#PCDATA) >
<!ATTLIST use-generic
  ispropclass (true | false ) "false"
>

<!-- This indicates whether the property is inherited or not. Use the value
     true for inherited and false for non-inherited. If the attribute
     "type" is set to "specified", the specified rather than the computed
     value of the property is inherited. An example is line-height, which
     if specified using relative units or a percent, is recalculated
     relative to the FONTSIZE of the current FO.
-->
<!ELEMENT inherited (#PCDATA) >
<!ATTLIST inherited
  type  (specified | computed) "computed"
>

<!-- This gives the datatype of the stored property values. It shouldn't be
     specified if the property has a use-generic element. The value of this
     element should be the name of either a basic Java class (String,
     Integer) or a class defined as a FOP or SVG datatype (eg. ColorType).
     NOTE: the value "Enum" is special and indicates an enumerated
     datatype, stored as a Java "int". There is an EnumProperty class, but
     no corresponding Enum class.
-->
<!ELEMENT datatype (#PCDATA) >

<!-- This element is used to specify the allowable values for enumerated
     datatypes (<datatype>Enum</datatype>). Each value sub-element
     specifies a possible value for the property. The "const" attribute for
     each value is used to generate a public static constant value in the
     class which can be referenced in code to test the property value. It
     must be a legal Java identifier. By convention, use all caps.
-->
<!ELEMENT enumeration (value+) >
<!ELEMENT value (#PCDATA) >
<!ATTLIST value
  const  CDATA  #REQUIRED
>

<!-- This gives the default value for a property if it is not specified on
     a given FO. (The spec calls this the "initial" value.)

     It may also be used to specify a default value for a particular
     component of a compound property. This is used to give each component
     its initial value if components are only partially specified in the
     FO file.

     NOTE: It should be an expression which can be parsed to give a legal
     value for the property! This can't be checked by the generating
     script, so if there is a problem, it will only be seen at runtime.
     If the attribute "contextdep" is present and set to "true", the
     generated code for the Maker will create a new Property object each
     time it is asked to make the default value. Otherwise (the usual
     case), it will only make one Property object with the default value
     and return it on each call. Context-dependent default values include
     those specified with relative units (eg. 1em).

     The "subproperty" attribute can be used on properties which are
     based on generic property specifications to specify a default value
     for a particular component. For example, the border-end-width property
     is based on GenericCondBorderWidth and specifies a specific default
     for the "conditionality" component.
-->
<!ELEMENT default (#PCDATA) >
<!ATTLIST default
  contextdep  (true | false) "false"
  subproperty  CDATA #IMPLIED
>


<!-- The datatype-conversion element(s) specify how to handle property
     values which can be specified in several ways. For example, the
     line-height property can be specified as a Length, or as a number or
     as a percent, which are both interpreted as being a factor of the
     current font-size. The datatype for this property is Length. The
     datatype-conversion element is used to handle the cases in which the
     Property parser returns a type which is not a Length. Each element
     tests it against a possible property type. The content gives the
     actual code which should be inserted in the generated class in order
     to correctly initialize the property value.
     NOTE: the use of this for Color properties is rather a hack. All color
     properties can be specified by a large number of keywords. To be
     consistent with my logic we should use the keyword-equiv element. But
     that was a lot of work. So for now, if the value evaluates to a String
     and not to a ColorType, the datatype-conversion just uses it to
     directly initialize a ColorType object.
-->
<!ELEMENT datatype-conversion (#PCDATA) >

<!-- The attribute from-type gives a possible property datatype, such as
     Number or String. The varname gives the name of a variable which can
     be used in the content of the datatype-conversion element. If the type
     of the variable is not the same as from-type, it may be specified with
     the attribute vartype.

     An example of usage is from the line-height property. This should be
     a Length object, but may be specified as a Number, which is interpreted
     as though it were a percentage of the current font-size.
-->
<!ATTLIST datatype-conversion
    from-type    CDATA   #REQUIRED
    vartype      CDATA   #IMPLIED
    varname      CDATA   #REQUIRED
>

<!-- The compound element indicates that the property is a "compound"
     property as defined in the XSL specification. It is specified as one
     or more individual attributes whose names are built up from the base
     property name and the name of a compoent. Each "subproperty" element
     describes a component of a compound property.
     An example is space-before.
-->
<!ELEMENT compound (subproperty+) >

<!-- Describe one component of a compound property. Only the name and the
     datatype should be specified. For example, in the space-before
     property, the optimum component has the name optimum and the datatype
     Length.
-->
<!ELEMENT subproperty (name, datatype, auto-ok?, default?, corresponding?,
   enumeration?, keyword-equiv? ) >

<!-- This element which may be repeated, specifies keyword shorthands for
     non-enumerated properties. For example, the border-width family of
     properties can be specified either by a Length (eg. 1pt) or by one of
     the keywords "thin", "medium", or "thick", each of which corresponds
     to a "user-agent specific value" (XSL Spec.) These values are defined
     by the keyword-equiv element. The "match" attribute gives the string
     keyword value and the content is the replacement value, which should
     be able to be evaluated to produce an object of the property's
     datatype (such as Length). An example is:
        <keyword-equiv match="thin" eval="true">0.5pt</keyword-equiv>
     The "eval" attribute indicates whether the specified value must be
     "parsed" using the Property parser or whether it can be used to
     directly construct an object of the appropriate datatype. The default
     is to evaluate the specified value (like the default specification).
-->
<!ELEMENT keyword-equiv (#PCDATA) >
<!ATTLIST keyword-equiv
  match  CDATA   #REQUIRED
  eval  (true|false) "true"
>

<!-- This element if present indicates that percent specifications are
     allowed as property values. The attribute "base" indicates how the
     actual value is calculated.
     FONTSIZE - the value is a percent of the current font-size
     INH-FONTSIZE - the value is a percent of the inherited
     font-size. This is necessary because font-size itself can be specified
     as a percent!
     CONTAINING-BOX - the value is a percent of the appropriate
     dimension of the containing box of this FO.
     If none of these is specified, the content of the element is
     assumed to be a Java expression which can be used to calculate an
     absolute value. This expression can assume that the variables
     propertyList and fo are in scope and refer to the FO on which the
     property was specified as a percent.
-->
<!ELEMENT   percent-ok (#PCDATA) >
<!ATTLIST   percent-ok
   base  (FONTSIZE | INH-FONTSIZE | CONTAINING-BOX) #IMPLIED
>

<!-- This element if present indicates that a value of "auto" for a Length
     specification is allowed. If "auto" is specified, a LengthProperty object
     is created which holds a Length object of type "AUTO".
-->
<!ELEMENT   auto-ok EMPTY >

<!-- This element if present indicates that the value of the property may
     be computed (derived) from other properties if it isn't specified. It
     assumes that the property is an Enum datatype. (Currently only used
     for text-align-last.)
     The "from" attribute gives the name of the property from which this
     property is derived.
     Each "if" sub-element specifies a possible value. The "match"
     attribute is compared with the value of the "derive-from" property. If
     it is equal, the value of the current property is set to the value
     specified by the content of the "if" element.
-->
<!ELEMENT   derive (if+) >
<!ATTLIST   derive
  from  CDATA  #REQUIRED
>
<!ELEMENT   if (#PCDATA) >
<!ATTLIST   if
  match  CDATA  #REQUIRED
>

<!-- This element indicates that the value of the property is the same as
     that of a "corresponding" absolute or writing-mode-relative property.
     if the "use-if-specified" attribute has the value "true", then the
     corresponding property value takes precedence over the property on
     which it is specified. To be conformant to the specification, all the
     the "absolute" versions of properties have precedence.
     Example: if a get() call is made on padding-end for a FO using lr-tb
     writing-mode, then the padding-right property will be used if it is
     specified, even if padding-end is actually specified.
     However, if a get() is made on padding-right, the value of padding-end
     will only be used if padding-right isn't specified on the FO.
-->

<!ELEMENT   corresponding (propval, propexpr?) >
<!ATTLIST   corresponding
    use-if-specified (true|false) "false"
>

<!-- If the value must be calculated using several other properties, the
     propexpr element may be used. Then only example I know of are the
     indent properties which are calculated based on the margin-* values
     if those are specified, plus the corresponding padding and border-width
     values.
-->
<!ELEMENT   propexpr (propval | #PCDATA)+ >

<!-- The name of the corresponding property is given in the propval element.
     The conversion between absolute and relative property names is
     made using wmrel2abs or wm2bs2rel elements, intermixed with text.
     For example, for the property "padding-left", the corresponding
     property is "padding-start" if the inline progression direction is
     left to right. This is expressed in the properties file with the
     expression "padding-<wmabs2rel dir='LEFT'/>". The wmabs2rel element
     is replaced by the writing-mode relative direction which corresponds
     to the absolute direction LEFT using the writing-mode in effect for the
     flow object where this property is specified.
-->
<!ELEMENT   propval (wmrel2abs | wmabs2rel | #PCDATA)+ >

<!ELEMENT   wmrel2abs EMPTY>
<!ATTLIST   wmrel2abs
  dir (BEFORE | AFTER | START | END | BLOCKPROGDIM | INLINEPROGDIM)
  #REQUIRED
>

<!ELEMENT   wmabs2rel EMPTY>
<!ATTLIST   wmabs2rel
  dir (TOP | BOTTOM | LEFT | RIGHT | HEIGHT | WIDTH )  #REQUIRED
>