aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/table
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-02-16 10:15:45 +0000
committerJeremias Maerki <jeremias@apache.org>2005-02-16 10:15:45 +0000
commit7d80d3db61adb7b58afa6081fc67a0f54b395177 (patch)
tree7d1644eed4df96c354dba3c03b5804697c966071 /src/java/org/apache/fop/layoutmgr/table
parent4d22fe218d96ffd1783fd3f4b978ccceae5d15a3 (diff)
downloadxmlgraphics-fop-7d80d3db61adb7b58afa6081fc67a0f54b395177.tar.gz
xmlgraphics-fop-7d80d3db61adb7b58afa6081fc67a0f54b395177.zip
First step towards collapsing table borders:
- Mode on BorderProps controls painting behaviour. - Extended toString() on BorderProps - Painting the borders already works for all three modes (separate, collapsing-inner and collapsing-outer) - ATM only inner borders are painted. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198432 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/table')
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/Cell.java51
1 files changed, 41 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/table/Cell.java b/src/java/org/apache/fop/layoutmgr/table/Cell.java
index c5b0b0892..648528bf7 100644
--- a/src/java/org/apache/fop/layoutmgr/table/Cell.java
+++ b/src/java/org/apache/fop/layoutmgr/table/Cell.java
@@ -77,6 +77,21 @@ public class Cell extends BlockStackingLayoutManager {
}
/**
+ * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
+ */
+ protected void initProperties() {
+ super.initProperties();
+ borderAndPaddingBPD = 0;
+ borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
+ borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderAfterWidth(false);
+ if (!fobj.isSeparateBorderModel()) {
+ borderAndPaddingBPD /= 2;
+ }
+ borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingBefore(false);
+ borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingAfter(false);
+ }
+
+ /**
* @return the table owning this cell
*/
public Table getTable() {
@@ -89,7 +104,13 @@ public class Cell extends BlockStackingLayoutManager {
private int getIPIndents() {
int iIndents = 0;
- iIndents += fobj.getCommonBorderPaddingBackground().getIPPaddingAndBorder(false);
+ iIndents += fobj.getCommonBorderPaddingBackground().getBorderStartWidth(false);
+ iIndents += fobj.getCommonBorderPaddingBackground().getBorderEndWidth(false);
+ if (!fobj.isSeparateBorderModel()) {
+ iIndents /= 2;
+ }
+ iIndents += fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
+ iIndents += fobj.getCommonBorderPaddingBackground().getPaddingEnd(false);
return iIndents;
}
@@ -104,12 +125,7 @@ public class Cell extends BlockStackingLayoutManager {
public BreakPoss getNextBreakPoss(LayoutContext context) {
LayoutManager curLM; // currently active LM
- borderAndPaddingBPD = fobj.getCommonBorderPaddingBackground()
- .getBPPaddingAndBorder(false);
-
MinOptMax stackSize = new MinOptMax();
- // if starting add space before
- // stackSize.add(spaceBefore);
BreakPoss lastPos = null;
referenceIPD = context.getRefIPD();
@@ -252,10 +268,17 @@ public class Cell extends BlockStackingLayoutManager {
addID(fobj.getId());
}
- if (!emptyCell
- || (fobj.isSeparateBorderModel() && fobj.showEmptyCells())) {
- TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ if (fobj.isSeparateBorderModel()) {
+ if (!emptyCell || fobj.showEmptyCells()) {
+ TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ }
+ } else {
TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ //TODO Set these booleans right
+ boolean[] outer = new boolean[] {false, false, false, false};
+ TraitSetter.addCollapsingBorders(curBlockArea,
+ fobj.getCommonBorderPaddingBackground(), outer);
}
//Handle display-align
@@ -317,6 +340,9 @@ public class Cell extends BlockStackingLayoutManager {
curBlockArea.setPositioning(Block.ABSOLUTE);
int indent = 0;
indent += fobj.getCommonBorderPaddingBackground().getBorderStartWidth(false);
+ if (!fobj.isSeparateBorderModel()) {
+ indent /= 2;
+ }
indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
// set position
int halfBorderSep = 0;
@@ -324,8 +350,13 @@ public class Cell extends BlockStackingLayoutManager {
halfBorderSep = fobj.getBorderSeparation().getLengthPair()
.getIPD().getLength().getValue() / 2;
}
+ int halfCollapsingBorderHeight = 0;
+ if (!fobj.isSeparateBorderModel()) {
+ halfCollapsingBorderHeight +=
+ fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false) / 2;
+ }
curBlockArea.setXOffset(xoffset + inRowIPDOffset + halfBorderSep + indent);
- curBlockArea.setYOffset(yoffset);
+ curBlockArea.setYOffset(yoffset - halfCollapsingBorderHeight);
curBlockArea.setIPD(cellIPD);
//curBlockArea.setHeight();