blob: 018356f7a782507cac24675e747497ea373a0af8 (
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
|
/*
* $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.pagination;
// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.PageMaster;
import org.apache.fop.apps.FOPException;
// Java
import java.util.*;
public class PageSequenceMaster extends FObj {
public static class Maker extends FObj.Maker {
public FObj make(FObj parent,
PropertyList propertyList) throws FOPException {
return new PageSequenceMaster(parent, propertyList);
}
}
public static FObj.Maker maker() {
return new PageSequenceMaster.Maker();
}
LayoutMasterSet layoutMasterSet;
Vector subSequenceSpecifiers;
// The terminology may be confusing. A 'page-sequence-master' consists
// of a sequence of what the XSL spec refers to as
// 'sub-sequence-specifiers'. These are, in fact, simple or complex
// references to page-masters. So the methods use the former
// terminology ('sub-sequence-specifiers', or SSS),
// but the actual FO's are MasterReferences.
protected PageSequenceMaster(FObj parent, PropertyList propertyList)
throws FOPException {
super(parent, propertyList);
this.name = "fo:page-sequence-master";
subSequenceSpecifiers = new Vector();
if (parent.getName().equals("fo:layout-master-set")) {
this.layoutMasterSet = (LayoutMasterSet)parent;
String pm = this.properties.get("master-name").getString();
if (pm == null) {
log.warn("page-sequence-master does not have "
+ "a page-master-name and so is being ignored");
} else {
this.layoutMasterSet.addPageSequenceMaster(pm, this);
}
} else {
throw new FOPException("fo:page-sequence-master must be child "
+ "of fo:layout-master-set, not "
+ parent.getName());
}
}
protected void addSubsequenceSpecifier(SubSequenceSpecifier pageMasterReference) {
subSequenceSpecifiers.addElement(pageMasterReference);
}
protected SubSequenceSpecifier getSubSequenceSpecifier(int sequenceNumber) {
if (sequenceNumber >= 0
&& sequenceNumber < getSubSequenceSpecifierCount()) {
return (SubSequenceSpecifier)subSequenceSpecifiers.elementAt(sequenceNumber);
}
return null;
}
protected int getSubSequenceSpecifierCount() {
return subSequenceSpecifiers.size();
}
public void reset() {
for (Enumeration e = subSequenceSpecifiers.elements();
e.hasMoreElements(); ) {
((SubSequenceSpecifier)e.nextElement()).reset();
}
}
}
|