1 51 package org.apache.fop.fo.pagination; 52 53 import org.apache.fop.fo.*; 55 import org.apache.fop.layout.RegionArea; 56 import org.apache.fop.layout.BorderAndPadding; 57 import org.apache.fop.layout.BackgroundProps; 58 import org.apache.fop.apps.FOPException; 59 60 67 public class RegionEnd extends Region { 68 69 public static class Maker extends FObj.Maker { 70 public FObj make(FObj parent, PropertyList propertyList, 71 String systemId, int line, int column) 72 throws FOPException { 73 return new RegionEnd(parent, propertyList, 74 systemId, line, column); 75 } 76 77 } 78 79 public static FObj.Maker maker() { 80 return new RegionEnd.Maker(); 81 } 82 83 public static final String REGION_CLASS = "end"; 84 85 86 protected RegionEnd(FObj parent, PropertyList propertyList, 87 String systemId, int line, int column) 88 throws FOPException { 89 super(parent, propertyList, systemId, line, column); 90 } 91 92 public String getName() { 93 return "fo:region-end"; 94 } 95 96 RegionArea makeRegionArea(int allocationRectangleXPosition, 97 int allocationRectangleYPosition, 98 int allocationRectangleWidth, 99 int allocationRectangleHeight, 100 boolean beforePrecedence, 101 boolean afterPrecedence, int beforeExtent, 102 int afterExtent) { 103 int extent = this.properties.get("extent").getLength().mvalue(); 104 105 int startY = allocationRectangleYPosition; 106 int startH = allocationRectangleHeight; 107 if (beforePrecedence) { 108 startY -= beforeExtent; 109 startH -= beforeExtent; 110 } 111 if (afterPrecedence) 112 startH -= afterExtent; 113 RegionArea area = new RegionArea(allocationRectangleXPosition 114 + allocationRectangleWidth - extent, 115 startY, extent, startH); 116 area.setBackground(propMgr.getBackgroundProps()); 117 return area; 118 119 } 120 121 RegionArea makeRegionArea(int allocationRectangleXPosition, 122 int allocationRectangleYPosition, 123 int allocationRectangleWidth, 124 int allocationRectangleHeight) { 125 126 BorderAndPadding bap = propMgr.getBorderAndPadding(); 128 BackgroundProps bProps = propMgr.getBackgroundProps(); 129 130 int extent = this.properties.get("extent").getLength().mvalue(); 133 138 return makeRegionArea(allocationRectangleXPosition, 139 allocationRectangleYPosition, 140 allocationRectangleWidth, extent, false, false, 141 0, 0); 142 } 143 144 protected String getDefaultRegionName() { 145 return "xsl-region-end"; 146 } 147 148 public String getRegionClass() { 149 return REGION_CLASS; 150 } 151 152 public int getExtent() { 153 return properties.get("extent").getLength().mvalue(); 154 } 155 } 156 | Popular Tags |