1 17 18 19 20 package org.apache.fop.area; 21 22 import java.util.List ; 23 24 import org.apache.fop.fo.pagination.RegionBody; 25 26 32 public class BodyRegion extends RegionReference { 33 private BeforeFloat beforeFloat; private MainReference mainReference; private Footnote footnote; private int columnGap; 37 private int columnCount; 38 39 45 public BodyRegion(RegionBody rb, RegionViewport parent) { 46 this(rb.getNameId(), rb.getRegionName(), parent, rb.getColumnCount(), rb.getColumnGap()); 47 } 48 49 58 public BodyRegion(int regionClass, String regionName, RegionViewport parent, 59 int columnCount, int columnGap) { 60 super(regionClass, regionName, parent); 61 this.columnCount = columnCount; 62 this.columnGap = columnGap; 63 mainReference = new MainReference(this); 64 } 65 66 71 public int getColumnCount() { 72 return this.columnCount; 73 } 74 75 76 public int getColumnGap() { 77 return this.columnGap; 78 } 79 80 85 public MainReference getMainReference() { 86 return mainReference; 87 } 88 89 94 public boolean isEmpty() { 95 return (mainReference == null || mainReference.isEmpty()) 96 && (footnote == null || footnote.isEmpty()) 97 && (beforeFloat == null || beforeFloat.isEmpty()); 98 } 99 100 101 106 public BeforeFloat getBeforeFloat() { 107 if (beforeFloat == null) { 108 beforeFloat = new BeforeFloat(); 109 } 110 return beforeFloat; 111 } 112 113 118 public Footnote getFootnote() { 119 if (footnote == null) { 120 footnote = new Footnote(); 121 } 122 return footnote; 123 } 124 125 129 public int getRemainingBPD() { 130 int usedBPD = 0; 131 List spans = getMainReference().getSpans(); 132 int previousSpanCount = spans.size() - 1; 133 for (int i = 0; i < previousSpanCount; i++) { 134 usedBPD += ((Span)spans.get(i)).getHeight(); 135 } 136 return getBPD() - usedBPD; 137 } 138 139 144 public Object clone() { 145 BodyRegion br = new BodyRegion(getRegionClass(), getRegionName(), regionViewport, 146 getColumnCount(), getColumnGap()); 147 br.setCTM(getCTM()); 148 br.setIPD(getIPD()); 149 br.beforeFloat = beforeFloat; 150 br.mainReference = mainReference; 151 br.footnote = footnote; 152 return br; 153 } 154 } 155 | Popular Tags |