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 RegionStart 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 RegionStart(parent, propertyList, 74 systemId, line, column); 75 } 76 77 } 78 79 public static FObj.Maker maker() { 80 return new RegionStart.Maker(); 81 } 82 83 public static final String REGION_CLASS = "start"; 84 85 86 protected RegionStart(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-start"; 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 startY, extent, startH); 115 area.setBackground(propMgr.getBackgroundProps()); 116 return area; 117 } 118 119 RegionArea makeRegionArea(int allocationRectangleXPosition, 120 int allocationRectangleYPosition, 121 int allocationRectangleWidth, 122 int allocationRectangleHeight) { 123 124 BorderAndPadding bap = propMgr.getBorderAndPadding(); 126 BackgroundProps bProps = propMgr.getBackgroundProps(); 127 128 int extent = this.properties.get("extent").getLength().mvalue(); 131 136 return makeRegionArea(allocationRectangleXPosition, 137 allocationRectangleYPosition, 138 allocationRectangleWidth, extent, false, false, 139 0, 0); 140 } 141 142 protected String getDefaultRegionName() { 143 return "xsl-region-start"; 144 } 145 146 public String getRegionClass() { 147 return REGION_CLASS; 148 } 149 150 public int getExtent() { 151 return properties.get("extent").getLength().mvalue(); 152 } 153 } 154 | Popular Tags |