aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java115
1 files changed, 7 insertions, 108 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
index b4941d418..d5949f4a2 100644
--- a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
@@ -21,10 +21,6 @@ package org.apache.fop.layoutmgr;
import java.util.LinkedList;
import java.util.List;
-import java.util.ListIterator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
@@ -35,10 +31,7 @@ import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.SideRegion;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.layoutmgr.PageBreakingAlgorithm.PageBreakingLayoutListener;
-import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
import org.apache.fop.layoutmgr.inline.TextLayoutManager;
-import org.apache.fop.traits.MinOptMax;
-import org.apache.fop.util.ListUtil;
/**
* LayoutManager for an fo:flow object.
@@ -48,11 +41,6 @@ import org.apache.fop.util.ListUtil;
*/
public class StaticContentLayoutManager extends BlockStackingLayoutManager {
- /**
- * logging instance
- */
- private static Log log = LogFactory.getLog(StaticContentLayoutManager.class);
-
private RegionReference targetRegion;
private Block targetBlock;
private SideRegion regionFO;
@@ -89,96 +77,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
/** {@inheritDoc} */
public List getNextKnuthElements(LayoutContext context, int alignment) {
- if (true) {
- throw new UnsupportedOperationException(
- "Shouldn't this method be emptied because it's never called at all?");
- }
- //TODO Empty this method?!?
- // set layout dimensions
- setContentAreaIPD(context.getRefIPD());
- setContentAreaBPD(context.getStackLimitBP().opt);
-
- //TODO Copied from elsewhere. May be worthwhile to factor out the common parts.
- // currently active LM
- BlockLevelLayoutManager curLM;
- BlockLevelLayoutManager prevLM = null;
- MinOptMax stackSize = new MinOptMax();
- List returnedList;
- List returnList = new LinkedList();
-
- while ((curLM = ((BlockLevelLayoutManager) getChildLM())) != null) {
- if (curLM instanceof InlineLevelLayoutManager) {
- log.error("inline area not allowed under flow - ignoring");
- curLM.setFinished(true);
- continue;
- }
-
- // Set up a LayoutContext
- MinOptMax bpd = context.getStackLimitBP();
-
- LayoutContext childLC = new LayoutContext(0);
- childLC.setStackLimitBP(MinOptMax.subtract(bpd, stackSize));
- childLC.setRefIPD(context.getRefIPD());
-
- // get elements from curLM
- returnedList = curLM.getNextKnuthElements(childLC, alignment);
- //log.debug("FLM.getNextKnuthElements> returnedList.size() = "
- // + returnedList.size());
-
- // "wrap" the Position inside each element
- List tempList = returnedList;
- KnuthElement tempElement;
- returnedList = new LinkedList();
- ListIterator listIter = tempList.listIterator();
- while (listIter.hasNext()) {
- tempElement = (KnuthElement)listIter.next();
- tempElement.setPosition(new NonLeafPosition(this, tempElement.getPosition()));
- returnedList.add(tempElement);
- }
-
- if (returnedList.size() == 1
- && ((KnuthElement)returnedList.get(0)).isPenalty()
- && ((KnuthPenalty)returnedList.get(0)).getP() == -KnuthElement.INFINITE) {
- // a descendant of this flow has break-before
- returnList.addAll(returnedList);
- return returnList;
- } else {
- if (!returnList.isEmpty()) {
- // there is a block before this one
- if (prevLM.mustKeepWithNext()
- || curLM.mustKeepWithPrevious()) {
- // add an infinite penalty to forbid a break between blocks
- returnList.add(new KnuthPenalty(0,
- KnuthElement.INFINITE, false,
- new Position(this), false));
- } else if (!((KnuthElement) ListUtil.getLast(returnList))
- .isGlue()) {
- // add a null penalty to allow a break between blocks
- returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
- }
- }
-/*LF*/ if (!returnedList.isEmpty()) { // controllare!
- returnList.addAll(returnedList);
- final KnuthElement last = (KnuthElement) ListUtil
- .getLast(returnedList);
- if (last.isPenalty()
- && ((KnuthPenalty) last).getP() == -KnuthElement.INFINITE) {
- // a descendant of this flow has break-after
-/*LF*/ //log.debug("FLM - break after!!");
- return returnList;
- }
-/*LF*/ }
- }
- prevLM = curLM;
- }
-
- setFinished(true);
-
- if (returnList.isEmpty()) {
- return null;
- } else {
- return returnList;
- }
+ throw new IllegalStateException();
}
/**
@@ -415,18 +314,18 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
}
/** {@inheritDoc} */
- public int getKeepTogetherStrength() {
- return KEEP_AUTO;
+ public Keep getKeepTogether() {
+ return Keep.KEEP_AUTO;
}
/** {@inheritDoc} */
- public int getKeepWithNextStrength() {
- return KEEP_AUTO;
+ public Keep getKeepWithNext() {
+ return Keep.KEEP_AUTO;
}
/** {@inheritDoc} */
- public int getKeepWithPreviousStrength() {
- return KEEP_AUTO;
+ public Keep getKeepWithPrevious() {
+ return Keep.KEEP_AUTO;
}
}