aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/table
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-05-23 07:43:05 +0000
committerJeremias Maerki <jeremias@apache.org>2005-05-23 07:43:05 +0000
commit4b69173061fbac84b9fa44cca5db0b290ba5d864 (patch)
tree27dafd4a9210193845512ce52f5bd518078a69b4 /src/java/org/apache/fop/layoutmgr/table
parentd86c4ef2527ed656c5bba0cf71a5f9efafc857b9 (diff)
downloadxmlgraphics-fop-4b69173061fbac84b9fa44cca5db0b290ba5d864.tar.gz
xmlgraphics-fop-4b69173061fbac84b9fa44cca5db0b290ba5d864.zip
Fixes for a few minor problems in certain special cases.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198666 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/TableContentLayoutManager.java10
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java96
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/TableStepper.java4
3 files changed, 54 insertions, 56 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
index eae8a537f..79810d12d 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
@@ -196,10 +196,12 @@ public class TableContentLayoutManager {
returnList, rowGroup);
}
- //Remove last penalty
- KnuthElement last = (KnuthElement)returnList.getLast();
- if (last.isPenalty() && last.getP() == 0) {
- returnList.removeLast();
+ if (returnList.size() > 0) {
+ //Remove last penalty
+ KnuthElement last = (KnuthElement)returnList.getLast();
+ if (last.isPenalty() && last.getP() == 0) {
+ returnList.removeLast();
+ }
}
return returnList;
}
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
index 317a68447..533a5f809 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
@@ -184,56 +184,52 @@ public class TableLayoutManager extends BlockStackingLayoutManager
returnedList = contentLM.getNextKnuthElements(childLC, alignment);
log.debug(returnedList);
- if (returnedList.size() == 1
- && ((KnuthElement) returnedList.getFirst()).isPenalty()
- && ((KnuthPenalty) returnedList.getFirst()).getP() == -KnuthElement.INFINITE) {
- // a descendant of this block has break-before
- if (returnList.size() == 0) {
- // the first child (or its first child ...) has
- // break-before;
- // all this block, including space before, will be put in
- // the
- // following page
- //FIX ME
- //bSpaceBeforeServed = false;
+ if (returnedList.size() == 1
+ && ((KnuthElement) returnedList.getFirst()).isPenalty()
+ && ((KnuthPenalty) returnedList.getFirst()).getP() == -KnuthElement.INFINITE) {
+ // a descendant of this block has break-before
+ if (returnList.size() == 0) {
+ // the first child (or its first child ...) has
+ // break-before;
+ // all this block, including space before, will be put in
+ // the
+ // following page
+ //FIX ME
+ //bSpaceBeforeServed = false;
+ }
+ contentList.addAll(returnedList);
+
+ // "wrap" the Position inside each element
+ // moving the elements from contentList to returnList
+ returnedList = new LinkedList();
+ wrapPositionElements(contentList, returnList);
+
+ return returnList;
+ } else {
+ /*
+ if (prevLM != null) {
+ // there is a block handled by prevLM
+ // before the one handled by curLM
+ if (mustKeepTogether()
+ || prevLM.mustKeepWithNext()
+ || curLM.mustKeepWithPrevious()) {
+ // add an infinite penalty to forbid a break between
+ // blocks
+ contentList.add(new KnuthPenalty(0,
+ KnuthElement.INFINITE, false,
+ new Position(this), false));
+ } else if (!((KnuthElement) contentList.getLast()).isGlue()) {
+ // add a null penalty to allow a break between blocks
+ contentList.add(new KnuthPenalty(0, 0, false,
+ new Position(this), false));
+ } else {
+ // the last element in contentList is a glue;
+ // it is a feasible breakpoint, there is no need to add
+ // a penalty
}
- contentList.addAll(returnedList);
-
- // "wrap" the Position inside each element
- // moving the elements from contentList to returnList
- returnedList = new LinkedList();
- wrapPositionElements(contentList, returnList);
-
- return returnList;
- } else {
- /*
- if (prevLM != null) {
- // there is a block handled by prevLM
- // before the one handled by curLM
- if (mustKeepTogether()
- || prevLM.mustKeepWithNext()
- || curLM.mustKeepWithPrevious()) {
- // add an infinite penalty to forbid a break between
- // blocks
- contentList.add(new KnuthPenalty(0,
- KnuthElement.INFINITE, false,
- new Position(this), false));
- } else if (!((KnuthElement) contentList.getLast()).isGlue()) {
- // add a null penalty to allow a break between blocks
- contentList.add(new KnuthPenalty(0, 0, false,
- new Position(this), false));
- } else {
- // the last element in contentList is a glue;
- // it is a feasible breakpoint, there is no need to add
- // a penalty
- }
- }*/
- contentList.addAll(returnedList);
- /*
- if (returnedList.size() == 0) {
- //Avoid NoSuchElementException below (happens with empty blocks)
- continue;
- }*/
+ }*/
+ contentList.addAll(returnedList);
+ if (returnedList.size() > 0) {
if (((KnuthElement) returnedList.getLast()).isPenalty()
&& ((KnuthPenalty) returnedList.getLast()).getP() == -KnuthElement.INFINITE) {
// a descendant of this block has break-after
@@ -248,7 +244,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager
return returnList;
}
-
+ }
}
wrapPositionElements(contentList, returnList);
setFinished(true);
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
index 9600053ab..67427d169 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
@@ -185,7 +185,7 @@ public class TableStepper {
int step;
int addedBoxLen = 0;
LinkedList returnList = new LinkedList();
- while ((step = getNextStep(laststep)) > 0) {
+ while ((step = getNextStep(laststep)) >= 0) {
if (rowBacktrackForLastStep) {
//Even though we've already switched to the next row, we have to
//calculate as if we were still on the previous row
@@ -340,7 +340,7 @@ public class TableStepper {
log.debug("borders before=" + borderBefore[i] + " after=" + borderAfter[i]);
}
if (seqCount == 0) {
- return 0;
+ return -1;
}
//Determine smallest possible step