diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2007-07-06 13:49:12 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2007-07-06 13:49:12 +0000 |
commit | 93f234a71eaa409c01ee3927725a3da0bb6c4ee7 (patch) | |
tree | 784b2be5b182de5f460ee36744f84a4e1ba94712 | |
parent | 0aea7bcc8ab382a920c7b133fba5fce8694da5c8 (diff) | |
download | xmlgraphics-fop-93f234a71eaa409c01ee3927725a3da0bb6c4ee7.tar.gz xmlgraphics-fop-93f234a71eaa409c01ee3927725a3da0bb6c4ee7.zip |
Add a signalMinStep method in ActiveCell
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@553878 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/table/TableStepper.java | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java index 52ad362c6..8cecb7946 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java @@ -184,6 +184,19 @@ public class TableStepper { } } + boolean signalMinStep(int minStep) { + int len = baseWidth + width + borderBefore + borderAfter + paddingBefore + paddingAfter + + 2 * tableLM.getHalfBorderSeparationBPD(); + if (len > minStep) { + width = backupWidth; + end = start - 1; + return baseWidth + borderBefore + borderAfter + paddingBefore + + paddingAfter + 2 * tableLM.getHalfBorderSeparationBPD() + width > minStep; + } else { + return false; + } + } + int getLastPenaltyLength() { return lastPenaltyLength; } @@ -499,23 +512,16 @@ public class TableStepper { skippedStep = false; for (Iterator iter = activeCells.iterator(); iter.hasNext();) { ActiveCell activeCell = (ActiveCell) iter.next(); - int len = activeCell.baseWidth + activeCell.width + activeCell.borderBefore + activeCell.borderAfter + activeCell.paddingBefore - + activeCell.paddingAfter + 2 * getTableLM().getHalfBorderSeparationBPD(); - if (len > minStep) { - activeCell.width = activeCell.backupWidth; - activeCell.end = activeCell.start - 1; - if (activeCell.baseWidth + activeCell.borderBefore + activeCell.borderAfter + activeCell.paddingBefore - + activeCell.paddingAfter + 2 * getTableLM().getHalfBorderSeparationBPD() + activeCell.width > minStep) { - if (activeRowIndex == 0) { - log.debug(" First row. Skip this step."); - skippedStep = true; - } else { - log.debug(" row-span situation: backtracking to last row"); - //Stay on the previous row for another step because borders and padding on - //columns may make their contribution to the step bigger than the addition - //of the next element for this step would make the step to grow. - rowBacktrackForLastStep = true; - } + if (activeCell.signalMinStep(minStep)) { + if (activeRowIndex == 0) { + log.debug(" First row. Skip this step."); + skippedStep = true; + } else { + log.debug(" row-span situation: backtracking to last row"); + //Stay on the previous row for another step because borders and padding on + //columns may make their contribution to the step bigger than the addition + //of the next element for this step would make the step to grow. + rowBacktrackForLastStep = true; } } } @@ -532,7 +538,7 @@ public class TableStepper { } } - private void goToNextRowIfCurrentFinished() { + private void goToNextRowIfCurrentFinished() { // We assume that the current grid row is finished. If this is not the case this // boolean will be reset (see below) boolean currentGridRowFinished = true; |