1 51 package org.apache.fop.fo.flow; 52 53 import org.apache.fop.fo.*; 55 import org.apache.fop.layout.*; 56 import org.apache.fop.apps.FOPException; 57 58 public class Marker extends FObjMixed { 59 60 private String markerClassName; 61 private Area registryArea; 62 private boolean isFirst; 63 private boolean isLast; 64 65 public static class Maker extends FObj.Maker { 66 public FObj make(FObj parent, PropertyList propertyList, 67 String systemId, int line, int column) 68 throws FOPException { 69 return new Marker(parent, propertyList, systemId, line, column); 70 } 71 72 } 73 74 public static FObj.Maker maker() { 75 return new Marker.Maker(); 76 } 77 78 public Marker(FObj parent, PropertyList propertyList, 79 String systemId, int line, int column) 80 throws FOPException { 81 super(parent, propertyList, systemId, line, column); 82 83 85 this.markerClassName = 86 this.properties.get("marker-class-name").getString(); 87 88 parent.addMarker(this.markerClassName); 91 } 92 93 public String getName() { 94 return "fo:marker"; 95 } 96 97 public int layout(Area area) throws FOPException { 98 this.registryArea = area; 100 area.getPage().registerMarker(this); 101 return Status.OK; 102 } 103 104 public int layoutMarker(Area area) throws FOPException { 105 if (this.marker == START) 106 this.marker = 0; 107 108 int numChildren = this.children.size(); 109 for (int i = this.marker; i < numChildren; i++) { 110 FONode fo = (FONode)children.get(i); 111 112 int status; 113 if (Status.isIncomplete((status = fo.layout(area)))) { 114 this.marker = i; 115 return status; 116 } 117 } 118 119 return Status.OK; 120 } 121 122 public String getMarkerClassName() { 123 return markerClassName; 124 } 125 126 public Area getRegistryArea() { 127 return registryArea; 128 } 129 130 public boolean mayPrecedeMarker() { 131 return true; 132 } 133 134 public void releaseRegistryArea() { 139 isFirst = registryArea.isFirst(); 140 isLast = registryArea.isLast(); 141 registryArea = null; 142 } 143 144 public void resetMarker() { 149 if (registryArea != null ) { 150 Page page=registryArea.getPage(); 151 if (page != null) { 152 page.unregisterMarker(this); 153 } 154 } 155 } 156 157 public void resetMarkerContent() { 160 super.resetMarker(); 161 } 162 } 163 | Popular Tags |