aboutsummaryrefslogtreecommitdiffstats
path: root/fop-core
diff options
context:
space:
mode:
Diffstat (limited to 'fop-core')
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/RestartAtLM.java15
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java4
-rw-r--r--fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentPosition.java2
3 files changed, 19 insertions, 2 deletions
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/RestartAtLM.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/RestartAtLM.java
index 08189cba9..80b1487a4 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/RestartAtLM.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/RestartAtLM.java
@@ -23,6 +23,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import org.apache.fop.events.EventBroadcaster;
+import org.apache.fop.layoutmgr.table.TableContentPosition;
/**
* Class to find the restart layoutmanager for changing IPD
@@ -39,6 +40,9 @@ class RestartAtLM {
optimalBreak = null;
}
int positionIndex = findPositionIndex(breaker, optimalBreak, alg, start);
+ if (breaker.positionAtBreak.getLM() instanceof BlockLayoutManager) {
+ positionIndex = findPositionIndex(breaker, optimalBreak, alg, 0);
+ }
if (ipdChangesOnNextPage || (breaker.positionAtBreak != null && breaker.positionAtBreak.getIndex() > -1)) {
breaker.firstElementsForRestart = Collections.EMPTY_LIST;
if (ipdChangesOnNextPage) {
@@ -112,9 +116,20 @@ class RestartAtLM {
if (onLastPageAndIPDChanges && !visitedBefore && breaker.positionAtBreak.getPosition() != null) {
restartAtLM = breaker.positionAtBreak.getPosition().getLM();
}
+ findLeafPosition(breaker);
return restartAtLM;
}
+ private void findLeafPosition(AbstractBreaker breaker) {
+ while (breaker.positionAtBreak instanceof NonLeafPosition) {
+ Position pos = breaker.positionAtBreak.getPosition();
+ if (pos instanceof TableContentPosition) {
+ break;
+ }
+ breaker.positionAtBreak = pos;
+ }
+ }
+
private int findPositionIndex(AbstractBreaker breaker, BreakingAlgorithm.KnuthNode optimalBreak,
PageBreakingAlgorithm alg, int start) {
int positionIndex = (optimalBreak != null) ? optimalBreak.position : start;
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
index ddffde3e1..2fff6c494 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
@@ -660,7 +660,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager
}
for (int i = 0; i < parIndex; i++) {
- knuthParagraphs.remove(0);
+ if (knuthParagraphs.size() > 1) {
+ knuthParagraphs.remove(0);
+ }
}
parIndex = 0;
diff --git a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentPosition.java b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentPosition.java
index 98d474f8e..3f1236d4d 100644
--- a/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentPosition.java
+++ b/fop-core/src/main/java/org/apache/fop/layoutmgr/table/TableContentPosition.java
@@ -30,7 +30,7 @@ import org.apache.fop.layoutmgr.Position;
* This class represents a Position specific to TableContentLayoutManager. Used for normal
* content cases.
*/
-class TableContentPosition extends Position {
+public class TableContentPosition extends Position {
/** The position is the first of the row group. */
public static final int FIRST_IN_ROWGROUP = 1;