From f99ca3094f7fabadb95d14bc53765b59293ef0c7 Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Mon, 19 Aug 2002 08:01:56 +0000 Subject: [PATCH] removed split context set ipd for static content git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195093 13f79535-47bb-0310-9956-ffa450edef68 --- .../layoutmgr/AbstractBPLayoutManager.java | 4 +- .../fop/layoutmgr/AbstractLayoutManager.java | 5 -- .../layoutmgr/BlockStackingLayoutManager.java | 67 ------------------- .../apache/fop/layoutmgr/LayoutManager.java | 1 - .../fop/layoutmgr/PageLayoutManager.java | 2 + .../apache/fop/layoutmgr/SplitContext.java | 23 ------- 6 files changed, 5 insertions(+), 97 deletions(-) delete mode 100644 src/org/apache/fop/layoutmgr/SplitContext.java diff --git a/src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java b/src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java index d63d1a66a..45499d909 100644 --- a/src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java @@ -100,7 +100,9 @@ public abstract class AbstractBPLayoutManager extends AbstractLayoutManager impl } m_childLMiter.next(); // Otherwise next returns same object } - m_curChildLM.resetPosition(pos); + if(m_curChildLM != null) { + m_curChildLM.resetPosition(pos); + } if (isFinished()) { setFinished(false); } diff --git a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java index ccb642863..79e12d33a 100644 --- a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -91,10 +91,5 @@ public abstract class AbstractLayoutManager implements LayoutManager { */ abstract public boolean addChild(Area childArea); - /** Do nothing */ - public boolean splitArea(Area areaToSplit, SplitContext context) { - context.nextArea = areaToSplit; - return false; - } } diff --git a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index b657b1005..b5433ea45 100644 --- a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -30,72 +30,6 @@ public abstract class BlockStackingLayoutManager extends AbstractBPLayoutManager super(fobj); } - public boolean splitArea(Area area, SplitContext splitContext) { - // Divide area so that it will be within targetLength if possible - // If not, it can be shorter, but not longer. - /* Iterate over contents of the area. * - - // Need to figure out if we can do this generically - // Logically a BlockStacking LM only handles Block-type areas - if (!(area instanceof BlockParent)) { - return false; - } - Iterator areaIter = ((BlockParent) area).getChildAreas().iterator(); - - - BreakCost minBreakCost = null; - MinOptMax remainBPD = splitContext.targetBPD; - splitContext.nextArea = area; - - while (areaIter.hasNext()) { - Area childArea = (Area) areaIter.next(); - if (remainBPD.max < childArea.getAllocationBPD().min) { - // Past the end point: try to break it - // TODO: get a LayoutManager to do the split of the child - // area, either Area => LM or Area => gen FO => LM - LayoutManager childLM = - childArea.getGeneratingFObj(). getLayoutManager(); - splitContext.targetBPD = remainBPD; - if (childLM.splitArea(childArea, splitContext) == false) { - // Can't split, so must split this area before childArea - // Can we pass the iter? - // If already saw several a potential break, use it - if (minBreakCost != null) { - /* Split 'area', placing all children after - * minBreakCost.getArea() into a new area, - * which we store in the splitContext. - * - // splitContext.nextArea = area.splitAfter(minBreakCost.getArea()); - } else { - /* This area will be shorter than the desired minimum. - * Split before the current childArea (which will be - * the first area in the newly created Area. - * - //splitContext.nextArea = area.splitBefore(childArea); - } - } else - return true; // childLM has done the work for us! - // Set cost, dimension ??? - break; - } else { - remainBPD.subtract(childArea.getAllocationBPD()); - if (remainBPD.min < 0) { - // Potential breakpoint: remember break Position and - // break "cost" (constraint violation) - BreakCost breakCost = - evaluateBreakCost(area, childArea); - minBreakCost = breakCost.chooseLowest(minBreakCost); - } - } - //Note: size of area when split can depend on conditional - // space, border and padding of the split area!!! - } - // True if some part of area can be placed, false if none is placed - return (splitContext.nextArea != area); - */ - return false; - } - private BreakCost evaluateBreakCost(Area parent, Area child) { return new BreakCost(child, 0); } @@ -157,7 +91,6 @@ public abstract class BlockStackingLayoutManager extends AbstractBPLayoutManager flush(); // hand off current area to parent // Probably need something like max BPD so we don't get into // infinite loops with large unbreakable chunks - //SplitContext splitContext = new SplitContext(targetDim); /*LayoutManager childLM = childArea.getGeneratingFObj(). getLayoutManager(); diff --git a/src/org/apache/fop/layoutmgr/LayoutManager.java b/src/org/apache/fop/layoutmgr/LayoutManager.java index 089b1493b..e547d01bf 100644 --- a/src/org/apache/fop/layoutmgr/LayoutManager.java +++ b/src/org/apache/fop/layoutmgr/LayoutManager.java @@ -17,7 +17,6 @@ public interface LayoutManager { public boolean generatesInlineAreas(); public Area getParentArea (Area childArea); public boolean addChild (Area childArea); - public boolean splitArea(Area areaToSplit, SplitContext context); public void setParentLM(LayoutManager lm); public int getContentIPD(); } diff --git a/src/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/org/apache/fop/layoutmgr/PageLayoutManager.java index 4bb7c1f60..095c83786 100644 --- a/src/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -239,6 +239,8 @@ public class PageLayoutManager extends AbstractBPLayoutManager implements Runnab lm.setParentLM(this); LayoutContext childLC = new LayoutContext(0); childLC.setStackLimit(new MinOptMax((int)curPage.getViewArea().getHeight())); + childLC.setRefIPD((int)reg.getViewArea().getWidth()); + while (!lm.isFinished()) { BreakPoss bp = lm.getNextBreakPoss(childLC, null); if (bp != null) { diff --git a/src/org/apache/fop/layoutmgr/SplitContext.java b/src/org/apache/fop/layoutmgr/SplitContext.java deleted file mode 100644 index 439c91024..000000000 --- a/src/org/apache/fop/layoutmgr/SplitContext.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources. - */ - -package org.apache.fop.layoutmgr; - -import org.apache.fop.area.Area; -import org.apache.fop.area.MinOptMax; - -public class SplitContext { - - Area nextArea; - MinOptMax targetBPD; - - public SplitContext(MinOptMax targetBPD) { - this.targetBPD = targetBPD; - nextArea = null; - } - -} -- 2.39.5