1 51 package org.apache.fop.layout; 52 53 import org.apache.fop.render.Renderer; 55 import org.apache.fop.fo.flow.*; 56 import org.apache.fop.datatypes.IDReferences; 57 import org.apache.fop.fo.pagination.PageSequence; 58 59 import java.util.ArrayList ; 61 62 66 67 public class Page { 68 69 private int height; 70 private int width; 71 72 private BodyAreaContainer body; 73 private AreaContainer before; 74 private AreaContainer after; 75 private AreaContainer start; 76 private AreaContainer end; 77 78 private AreaTree areaTree; 79 80 private ArrayList rootExtensions; 81 82 private PageSequence pageSequence; 83 84 protected int pageNumber = 0; 85 protected String formattedPageNumber; 86 87 protected ArrayList linkSets = new ArrayList (); 88 89 private ArrayList idList = new ArrayList (); 90 91 private ArrayList footnotes = null; 92 93 private ArrayList markers = null; 94 95 Page(AreaTree areaTree, int height, int width) { 96 this.areaTree = areaTree; 97 this.height = height; 98 this.width = width; 99 markers = new ArrayList (); 100 } 101 102 public IDReferences getIDReferences() { 103 return areaTree.getIDReferences(); 104 } 105 106 public void setPageSequence(PageSequence pageSequence) { 107 this.pageSequence = pageSequence; 108 } 109 110 public PageSequence getPageSequence() { 111 return pageSequence; 112 } 113 114 public AreaTree getAreaTree() { 115 return areaTree; 116 } 117 118 public void setNumber(int number) { 119 this.pageNumber = number; 120 } 121 122 public int getNumber() { 123 return this.pageNumber; 124 } 125 126 public void setFormattedNumber(String number) { 127 this.formattedPageNumber = number; 128 } 129 130 public String getFormattedNumber() { 131 return this.formattedPageNumber; 132 } 133 134 void addAfter(AreaContainer area) { 135 this.after = area; 136 area.setPage(this); 137 } 138 139 void addBefore(AreaContainer area) { 140 this.before = area; 141 area.setPage(this); 142 } 143 144 149 public void addBody(BodyAreaContainer area) { 150 this.body = area; 151 area.setPage(this); 152 ((BodyAreaContainer)area).getMainReferenceArea().setPage(this); 153 ((BodyAreaContainer)area).getBeforeFloatReferenceArea().setPage(this); 154 ((BodyAreaContainer)area).getFootnoteReferenceArea().setPage(this); 155 } 156 157 void addEnd(AreaContainer area) { 158 this.end = area; 159 area.setPage(this); 160 } 161 162 void addStart(AreaContainer area) { 163 this.start = area; 164 area.setPage(this); 165 } 166 167 public void render(Renderer renderer) { 168 renderer.renderPage(this); 169 } 170 171 public AreaContainer getAfter() { 172 return this.after; 173 } 174 175 public AreaContainer getBefore() { 176 return this.before; 177 } 178 179 public AreaContainer getStart() { 180 return this.start; 181 } 182 183 public AreaContainer getEnd() { 184 return this.end; 185 } 186 187 public BodyAreaContainer getBody() { 188 return this.body; 189 } 190 191 public int getHeight() { 192 return this.height; 193 } 194 195 public int getWidth() { 196 return this.width; 197 } 198 199 public FontInfo getFontInfo() { 200 return this.areaTree.getFontInfo(); 201 } 202 203 public void addLinkSet(LinkSet linkSet) { 204 this.linkSets.add(linkSet); 205 } 206 207 public ArrayList getLinkSets() { 208 return this.linkSets; 209 } 210 211 public boolean hasLinks() { 212 return (!this.linkSets.isEmpty()); 213 } 214 215 public void addToIDList(String id) { 216 idList.add(id); 217 } 218 219 public ArrayList getIDList() { 220 return idList; 221 } 222 223 public ArrayList getPendingFootnotes() { 224 return footnotes; 225 } 226 227 public ArrayList getExtensions() { 228 return rootExtensions; 229 } 230 231 public void setExtensions(ArrayList extensions) { 232 this.rootExtensions = extensions; 233 } 234 235 public void setPendingFootnotes(ArrayList v) { 236 footnotes = v; 237 if (footnotes != null) { 238 for (int i = 0; i < footnotes.size(); i++ ) { 239 FootnoteBody fb = (FootnoteBody)footnotes.get(i); 240 if (!Footnote.layoutFootnote(this, fb, null)) { 241 } 243 244 } 245 footnotes = null; 246 } 247 } 248 249 public void addPendingFootnote(FootnoteBody fb) { 250 if (footnotes == null) { 251 footnotes = new ArrayList (); 252 } 253 footnotes.add(fb); 254 } 255 256 public void registerMarker(Marker marker) { 257 markers.add(marker); 258 } 259 260 public void unregisterMarker(Marker marker) { 261 markers.remove(marker); 262 } 263 264 public ArrayList getMarkers() { 265 return this.markers; 266 } 267 268 } 269 | Popular Tags |