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