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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.fo;
import java.util.HashMap;
import java.util.Iterator;
import org.apache.fop.fo.flow.*;
import org.apache.fop.fo.pagination.*;
public class FOElementMapping implements ElementMapping {
private static HashMap foObjs = null;
private static synchronized void setupFO() {
if(foObjs == null) {
foObjs = new HashMap();
// Declarations and Pagination and Layout Formatting Objects
foObjs.put("root", new R());
foObjs.put("declarations", new Dec());
foObjs.put("color-profile", new CP());
foObjs.put("page-sequence", new PS());
foObjs.put("layout-master-set", new LMS());
foObjs.put("page-sequence-master",
new PSM());
foObjs.put("single-page-master-reference",
new SPMR());
foObjs.put("repeatable-page-master-reference",
new RPMR());
foObjs.put("repeatable-page-master-alternatives",
new RPMA());
foObjs.put("conditional-page-master-reference",
new CPMR());
foObjs.put("simple-page-master",
new SPM());
foObjs.put("region-body", new RB());
foObjs.put("region-before", new RBefore());
foObjs.put("region-after", new RA());
foObjs.put("region-start", new RS());
foObjs.put("region-end", new RE());
foObjs.put("flow", new Fl());
foObjs.put("static-content", new SC());
foObjs.put("title", new T());
// Block-level Formatting Objects
foObjs.put("block", new B());
foObjs.put("block-container", new BC());
// Inline-level Formatting Objects
foObjs.put("bidi-override", new BO());
foObjs.put("character",
new Ch());
foObjs.put("initial-property-set",
new IPS());
foObjs.put("external-graphic", new EG());
foObjs.put("instream-foreign-object",
new IFO());
foObjs.put("inline", new In());
foObjs.put("inline-container", new IC());
foObjs.put("leader", new L());
foObjs.put("page-number", new PN());
foObjs.put("page-number-citation",
new PNC());
// Formatting Objects for Tables
foObjs.put("table-and-caption", new TAC());
foObjs.put("table", new Ta());
foObjs.put("table-column", new TC());
foObjs.put("table-caption", new TCaption());
foObjs.put("table-header", new TB());
foObjs.put("table-footer", new TB());
foObjs.put("table-body", new TB());
foObjs.put("table-row", new TR());
foObjs.put("table-cell", new TCell());
// Formatting Objects for Lists
foObjs.put("list-block", new LB());
foObjs.put("list-item", new LI());
foObjs.put("list-item-body", new LIB());
foObjs.put("list-item-label", new LIL());
// Dynamic Effects: Link and Multi Formatting Objects
foObjs.put("basic-link", new BL());
foObjs.put("multi-switch", new MS());
foObjs.put("multi-case", new MC());
foObjs.put("multi-toggle", new MT());
foObjs.put("multi-properties", new MP());
foObjs.put("multi-property-set",
new MPS());
// Out-of-Line Formatting Objects
foObjs.put("float",
new F());
foObjs.put("footnote", new Foot());
foObjs.put("footnote-body", new FB());
// Other Formatting Objects
foObjs.put("wrapper", new W());
foObjs.put("marker", new M());
foObjs.put("retrieve-marker", new RM());
}
}
public void addToBuilder(FOTreeBuilder builder) {
setupFO();
String uri = "http://www.w3.org/1999/XSL/Format";
builder.addMapping(uri, foObjs);
}
static class R extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Root(parent);
}
}
static class Dec extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Declarations(parent);
}
}
static class CP extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new ColorProfile(parent);
}
}
static class PS extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new PageSequence(parent);
}
}
static class LMS extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new LayoutMasterSet(parent);
}
}
static class PSM extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new PageSequenceMaster(parent);
}
}
static class SPMR extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new SinglePageMasterReference(parent);
}
}
static class RPMR extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new RepeatablePageMasterReference(parent);
}
}
static class RPMA extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new RepeatablePageMasterAlternatives(parent);
}
}
static class CPMR extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new ConditionalPageMasterReference(parent);
}
}
static class SPM extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new SimplePageMaster(parent);
}
}
static class RB extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new RegionBody(parent);
}
}
static class RBefore extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new RegionBefore(parent);
}
}
static class RA extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new RegionAfter(parent);
}
}
static class RS extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new RegionStart(parent);
}
}
static class RE extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new RegionEnd(parent);
}
}
static class Fl extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Flow(parent);
}
}
static class SC extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new StaticContent(parent);
}
}
static class T extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Title(parent);
}
}
static class B extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Block(parent);
}
}
static class BC extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new BlockContainer(parent);
}
}
static class BO extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new BidiOverride(parent);
}
}
static class Ch extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new org.apache.fop.fo.flow.Character(parent);
}
}
static class IPS extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new InitialPropertySet(parent);
}
}
static class EG extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new ExternalGraphic(parent);
}
}
static class IFO extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new InstreamForeignObject(parent);
}
}
static class In extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Inline(parent);
}
}
static class IC extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new InlineContainer(parent);
}
}
static class L extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Leader(parent);
}
}
static class PN extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new PageNumber(parent);
}
}
static class PNC extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new PageNumberCitation(parent);
}
}
static class TAC extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new TableAndCaption(parent);
}
}
static class Ta extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Table(parent);
}
}
static class TC extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new TableColumn(parent);
}
}
static class TCaption extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new TableCaption(parent);
}
}
static class TB extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new TableBody(parent);
}
}
static class TR extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new TableRow(parent);
}
}
static class TCell extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new TableCell(parent);
}
}
static class LB extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new ListBlock(parent);
}
}
static class LI extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new ListItem(parent);
}
}
static class LIB extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new ListItemBody(parent);
}
}
static class LIL extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new ListItemLabel(parent);
}
}
static class BL extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new BasicLink(parent);
}
}
static class MS extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new MultiSwitch(parent);
}
}
static class MC extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new MultiCase(parent);
}
}
static class MT extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new MultiToggle(parent);
}
}
static class MP extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new MultiProperties(parent);
}
}
static class MPS extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new MultiPropertySet(parent);
}
}
static class F extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new org.apache.fop.fo.flow.Float(parent);
}
}
static class Foot extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Footnote(parent);
}
}
static class FB extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new FootnoteBody(parent);
}
}
static class W extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Wrapper(parent);
}
}
static class M extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new Marker(parent);
}
}
static class RM extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new RetrieveMarker(parent);
}
}
}
|