PropertyList colPList = new StaticPropertyList(defaultColumn, pList);
colPList.setWritingMode();
defaultColumn.bind(colPList);
+
+ if (borderCollapse != EN_SEPARATE && commonBorderPaddingBackground.hasPadding()) {
+ //See "17.6.2 The collapsing border model" in CSS2
+ getLogger().error("Table may not have padding when using the collapsing border model.");
+ }
}
/**
return borderCollapse;
}
+ /** @return true if the separate border model is active */
+ public boolean isSeparateBorderModel() {
+ return (getBorderCollapse() == EN_SEPARATE);
+ }
+
/** @return the "border-separation" property. */
public LengthPairProperty getBorderSeparation() {
return borderSeparation;
// private ToBeImplementedProperty borderEndPrecedence;
// private ToBeImplementedProperty borderStartPrecedence;
private LengthRangeProperty blockProgressionDimension;
- private int borderCollapse;
- private LengthPairProperty borderSeparation;
+ private int borderCollapse; //inherited from fo:table
+ private LengthPairProperty borderSeparation; //inherited from fo:table
private Numeric columnNumber;
private int displayAlign;
private int relativeAlign;
return (this.emptyCells == EN_SHOW);
}
+ /** @return the "border-collapse" property (inherited from fo:table). */
+ public int getBorderCollapse() {
+ return borderCollapse;
+ }
+
+ /** @return true if the separate border model is active */
+ public boolean isSeparateBorderModel() {
+ return (getBorderCollapse() == EN_SEPARATE);
+ }
+
+ /** @return the "border-separation" property (inherited from fo:table). */
+ public LengthPairProperty getBorderSeparation() {
+ return borderSeparation;
+ }
+
/**
* @return the "id" property.
*/
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.StaticPropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
public boolean hasBackground() {
return ((backgroundColor != null || getFopImage() != null));
}
+
+ /** @return true if padding is non-zero. */
+ public boolean hasPadding() {
+ return ((getPaddingBefore(false) + getPaddingAfter(false)
+ + getPaddingStart(false) + getPaddingEnd(false)) > 0);
+ }
}
referenceIPD = context.getRefIPD();
cellIPD = referenceIPD;
cellIPD -= getIPIndents();
- if (getTable().getBorderCollapse() == EN_SEPARATE) {
- int borderSep = getTable().getBorderSeparation().getLengthPair()
+ if (fobj.isSeparateBorderModel()) {
+ int borderSep = fobj.getBorderSeparation().getLengthPair()
.getIPD().getLength().getValue();
cellIPD -= borderSep;
}
addID(fobj.getId());
}
- if (!emptyCell || (getTable().getBorderCollapse() == EN_SEPARATE
- && fobj.showEmptyCells())) {
+ if (!emptyCell
+ || (fobj.isSeparateBorderModel() && fobj.showEmptyCells())) {
TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
}
indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
// set position
int halfBorderSep = 0;
- if (getTable().getBorderCollapse() == EN_SEPARATE) {
- halfBorderSep = getTable().getBorderSeparation().getLengthPair()
+ if (fobj.isSeparateBorderModel()) {
+ halfBorderSep = fobj.getBorderSeparation().getLengthPair()
.getIPD().getLength().getValue() / 2;
}
curBlockArea.setXOffset(xoffset + inRowIPDOffset + halfBorderSep + indent);
curBlockArea.setBPD(tableHeight);
- TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ if (fobj.isSeparateBorderModel()) {
+ TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ }
TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
TraitSetter.addMargins(curBlockArea,
fobj.getCommonBorderPaddingBackground(),