From: Keiron Liddle Date: Tue, 4 Mar 2003 03:48:09 +0000 (+0000) Subject: split LayoutManager interface so that the new LayoutProcessor X-Git-Tag: Alt-Design-integration-base~92 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=01178a3831dbaeb8c9cd3577e727926be75ed3a8;p=xmlgraphics-fop.git split LayoutManager interface so that the new LayoutProcessor interface is the local interface used by the implementation to do the layout git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196010 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java index 47ba39a85..7c095b03e 100644 --- a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -23,16 +23,16 @@ import java.util.Map; /** * The base class for all LayoutManagers. */ -public abstract class AbstractLayoutManager implements LayoutManager { +public abstract class AbstractLayoutManager implements LayoutProcessor { protected FOUserAgent userAgent; - protected LayoutManager parentLM = null; + protected LayoutProcessor parentLM = null; protected FObj fobj; protected String foID = null; protected Map markers = null; /** True if this LayoutManager has handled all of its content. */ private boolean bFinished = false; - protected LayoutManager curChildLM = null; + protected LayoutProcessor curChildLM = null; protected ListIterator childLMiter; protected boolean bInited = false; @@ -76,7 +76,7 @@ public abstract class AbstractLayoutManager implements LayoutManager { return userAgent.getLogger(); } - public void setParentLM(LayoutManager lm) { + public void setParent(LayoutProcessor lm) { this.parentLM = lm; } @@ -128,14 +128,14 @@ public abstract class AbstractLayoutManager implements LayoutManager { * Note: child must implement LayoutManager! If it doesn't, skip it * and print a warning. */ - protected LayoutManager getChildLM() { + protected LayoutProcessor getChildLM() { if (curChildLM != null && !curChildLM.isFinished()) { return curChildLM; } while (childLMiter.hasNext()) { - curChildLM = (LayoutManager) childLMiter.next(); + curChildLM = (LayoutProcessor) childLMiter.next(); curChildLM.setUserAgent(getUserAgent()); - curChildLM.setParentLM(this); + curChildLM.setParent(this); curChildLM.init(); return curChildLM; } @@ -172,7 +172,7 @@ public abstract class AbstractLayoutManager implements LayoutManager { } while (curChildLM != lm && childLMiter.hasPrevious()) { curChildLM.resetPosition(null); - curChildLM = (LayoutManager) childLMiter.previous(); + curChildLM = (LayoutProcessor) childLMiter.previous(); } // Otherwise next returns same object childLMiter.next(); diff --git a/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index fc265215b..301dd01c7 100644 --- a/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -98,7 +98,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { stackLimit = context.getStackLimit(); } - LayoutManager curLM ; // currently active LM + LayoutProcessor curLM ; // currently active LM MinOptMax stackSize = new MinOptMax(); // if starting add space before @@ -156,7 +156,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { public BreakPoss getAbsoluteBreakPoss(LayoutContext context) { - LayoutManager curLM ; // currently active LM + LayoutProcessor curLM ; // currently active LM MinOptMax stackSize = new MinOptMax(); @@ -204,7 +204,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { addID(); addMarkers(true, true); - LayoutManager childLM ; + LayoutProcessor childLM; int iStartPos = 0; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { diff --git a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java index b7a4ea511..c002874b3 100644 --- a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -57,8 +57,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { protected boolean preLoadNext() { while (proxy.hasNext()) { - LayoutManager lm = (LayoutManager) proxy.next(); - lm.setParentLM(BlockLayoutManager.this); + LayoutProcessor lm = (LayoutProcessor) proxy.next(); + lm.setParent(BlockLayoutManager.this); if(lm.generatesInlineAreas()) { LineLayoutManager lineLM = createLineManager(lm); listLMs.add(lineLM); @@ -74,12 +74,12 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { protected LineLayoutManager createLineManager( LayoutManager firstlm) { - LayoutManager lm; + LayoutProcessor lm; List inlines = new ArrayList(); inlines.add(firstlm); while (proxy.hasNext()) { - lm = (LayoutManager) proxy.next(); - lm.setParentLM(BlockLayoutManager.this); + lm = (LayoutProcessor) proxy.next(); + lm.setParent(BlockLayoutManager.this); if (lm.generatesInlineAreas()) { inlines.add(lm); } else { @@ -128,7 +128,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { } public BreakPoss getNextBreakPoss(LayoutContext context) { - LayoutManager curLM; // currently active LM + LayoutProcessor curLM; // currently active LM int ipd = context.getRefIPD(); @@ -162,7 +162,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null); @@ -222,7 +222,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { addID(); addMarkers(true, true); - LayoutManager childLM ; + LayoutProcessor childLM; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { LeafPosition lfp = (LeafPosition) parentIter.next(); diff --git a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index 36dcac7db..210464819 100644 --- a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -20,7 +20,7 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager { * Reference to FO whose areas it's managing or to the traits * of the FO. */ - protected LayoutManager curChildLM = null; + protected LayoutProcessor curChildLM = null; protected BlockParent parentArea = null; public BlockStackingLayoutManager() { diff --git a/src/org/apache/fop/layoutmgr/BreakPoss.java b/src/org/apache/fop/layoutmgr/BreakPoss.java index 7017a897a..a1875eea8 100644 --- a/src/org/apache/fop/layoutmgr/BreakPoss.java +++ b/src/org/apache/fop/layoutmgr/BreakPoss.java @@ -86,7 +86,7 @@ public class BreakPoss { /** * The top-level layout manager responsible for this break */ - public LayoutManager getLayoutManager() { + public LayoutProcessor getLayoutManager() { return m_position.getLM(); } diff --git a/src/org/apache/fop/layoutmgr/BreakPossPosIter.java b/src/org/apache/fop/layoutmgr/BreakPossPosIter.java index 1e1465794..9e307a49f 100644 --- a/src/org/apache/fop/layoutmgr/BreakPossPosIter.java +++ b/src/org/apache/fop/layoutmgr/BreakPossPosIter.java @@ -38,7 +38,7 @@ public class BreakPossPosIter extends PositionIterator { return (BreakPoss) peekNext(); } - protected LayoutManager getLM(Object nextObj) { + protected LayoutProcessor getLM(Object nextObj) { return ((BreakPoss) nextObj).getLayoutManager(); } diff --git a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java index 28a91e996..6a587fab9 100644 --- a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java @@ -24,11 +24,11 @@ import java.util.ArrayList; * For use with objects that contain inline areas such as * leader use-content and title. */ -public class ContentLayoutManager implements LayoutManager { +public class ContentLayoutManager implements LayoutProcessor { private FOUserAgent userAgent; private Area holder; private int stackSize; - private LayoutManager parentLM; + private LayoutProcessor parentLM; /** * Constructs a new ContentLayoutManager @@ -47,7 +47,7 @@ public class ContentLayoutManager implements LayoutManager { public void setFObj(FObj fo) { } - public void fillArea(LayoutManager curLM) { + public void fillArea(LayoutProcessor curLM) { List childBreaks = new ArrayList(); MinOptMax stack = new MinOptMax(); @@ -152,7 +152,7 @@ public class ContentLayoutManager implements LayoutManager { } /** @see org.apache.fop.layoutmgr.LayoutManager */ - public void setParentLM(LayoutManager lm) { + public void setParent(LayoutProcessor lm) { parentLM = lm; } diff --git a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java index 63947e49a..fc56f24dc 100644 --- a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java @@ -39,7 +39,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager { public BreakPoss getNextBreakPoss(LayoutContext context) { // currently active LM - LayoutManager curLM; + LayoutProcessor curLM; MinOptMax stackSize = new MinOptMax(); while ((curLM = getChildLM()) != null) { @@ -93,7 +93,7 @@ public class FlowLayoutManager extends BlockStackingLayoutManager { public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) { - LayoutManager childLM; + LayoutProcessor childLM; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { LeafPosition lfp = (LeafPosition) parentIter.next(); diff --git a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java index b1522bfa9..d18f58a39 100644 --- a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java @@ -34,7 +34,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager { super(parentIter); } - protected LayoutManager getLM(Object nextObj) { + protected LayoutProcessor getLM(Object nextObj) { return ((Position) nextObj).getPosition().getLM(); } @@ -202,7 +202,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager { hasLeadingFence(false)) { return true; } - LayoutManager lm = getChildLM(); + LayoutProcessor lm = getChildLM(); if (lm != null) { return lm.canBreakBefore(context); } else { @@ -232,7 +232,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager { public BreakPoss getNextBreakPoss(LayoutContext lc) { // Get a break from currently active child LM BreakPoss bp = null; - LayoutManager curLM ; + LayoutProcessor curLM; SpaceSpecifier leadingSpace = lc.getLeadingSpace(); if (lc.startsNewArea()) { @@ -470,8 +470,8 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager { // posIter iterates over positions returned by this LM StackingIter childPosIter = new StackingIter(parentIter); - LayoutManager prevLM = null; - LayoutManager childLM ; + LayoutProcessor prevLM = null; + LayoutProcessor childLM ; while ((childLM = childPosIter.getNextChildLM()) != null) { //getContext().setTrailingSpace(new SpaceSpecifier(false)); childLM.addAreas(childPosIter, getContext()); diff --git a/src/org/apache/fop/layoutmgr/LayoutManager.java b/src/org/apache/fop/layoutmgr/LayoutManager.java index bc50a0298..678e2b704 100644 --- a/src/org/apache/fop/layoutmgr/LayoutManager.java +++ b/src/org/apache/fop/layoutmgr/LayoutManager.java @@ -10,14 +10,6 @@ package org.apache.fop.layoutmgr; import org.apache.fop.fo.FOUserAgent; import org.apache.fop.fo.FObj; -import org.apache.fop.fo.flow.Marker; - -import org.apache.fop.area.Area; -import org.apache.fop.area.Resolveable; -import org.apache.fop.area.PageViewport; - -import java.util.Map; - /** * The interface for all LayoutManagers. */ @@ -47,166 +39,4 @@ public interface LayoutManager { */ public FOUserAgent getUserAgent(); - /** - * Set the parent layout manager. - * The parent layout manager is required for adding areas. - * - * @param lm the parent layout manager - */ - public void setParentLM(LayoutManager lm); - - /** - * Initialise this layout manager. - */ - public void init(); - - /** - * Generates inline areas. - * This is used to check if the layout manager generates inline - * areas. - * - * @return true if the layout manager generates inline areas - */ - public boolean generatesInlineAreas(); - - /** - * Return true if the next area which would be generated by this - * LayoutManager could start a new line (or flow for block-level FO). - * - * @param lc the layout context - * @return true if can break before - */ - public boolean canBreakBefore(LayoutContext lc); - - /** - * Generate and return the next break possibility. - * - * @param context The layout context contains information about pending - * space specifiers from ancestor areas or previous areas, reference - * area inline-progression-dimension and various other layout-related - * information. - * @return the next break position - */ - public BreakPoss getNextBreakPoss(LayoutContext context); - - /** - * Reset to the position. - * - * @param position - */ - public void resetPosition(Position position); - - /** - * Get the word chars between two positions and - * append to the string buffer. The positions could - * span multiple layout managers. - * - * @param sbChars the string buffer to append the word chars - * @param bp1 the start position - * @param bp2 the end position - */ - public void getWordChars(StringBuffer sbChars, Position bp1, - Position bp2); - - /** - * Return a value indicating whether this LayoutManager has laid out - * all its content (or generated BreakPossibilities for all content.) - * - * @return true if this layout manager is finished - */ - public boolean isFinished(); - - /** - * Set a flag indicating whether the LayoutManager has laid out all - * its content. This is generally called by the LM itself, but can - * be called by a parentLM when backtracking. - * - * @param isFinished the value to set the finished flag to - */ - public void setFinished(boolean isFinished); - - /** - * Get the parent area for an area. - * This should get the parent depending on the class of the - * area passed in. - * - * @param childArea the child area to get the parent for - * @return the parent Area - */ - public Area getParentArea(Area childArea); - - /** - * Add the area as a child of the current area. - * This is called by child layout managers to add their - * areas as children of the current area. - * - * @param childArea the child area to add - */ - public void addChild(Area childArea); - - /** - * Tell the layout manager to add all the child areas implied - * by Position objects which will be returned by the - * Iterator. - * - * @param posIter the position iterator - * @param context the context - */ - public void addAreas(PositionIterator posIter, LayoutContext context); - - /** - * Get the string of the current page number. - * - * @return the string for the current page number - */ - public String getCurrentPageNumber(); - - /** - * Resolve the id reference. - * This is called by an area looking for an id reference. - * If the id reference is not found then it should add a resolveable object. - * - * @param ref the id reference - * @return the page containing the id reference or null if not found - */ - public PageViewport resolveRefID(String ref); - - /** - * Add an id to the page. - * @todo add the location of the area on the page - * - * @param id the id reference to add. - */ - public void addIDToPage(String id); - - /** - * Add an unresolved area. - * The is used to add a resolveable object to the page for a given id. - * - * @param id the id reference this object needs for resolving - * @param res the resolveable object - */ - public void addUnresolvedArea(String id, Resolveable res); - - /** - * Add the marker. - * A number of formatting objects may contain markers. This - * method is used to add those markers to the page. - * - * @param name the marker class name - * @param start true if the formatting object is starting false is finishing - * @param isfirst a flag for is first - */ - public void addMarkerMap(Map marks, boolean start, boolean isfirst); - - /** - * Retrieve a marker. - * This method is used when retrieve a marker. - * - * @param name the class name of the marker - * @param pos the retrieve position - * @param boundary the boundary for retrieving the marker - * @return the layout manaager of the retrieved marker if any - */ - public Marker retrieveMarker(String name, int pos, int boundary); } diff --git a/src/org/apache/fop/layoutmgr/LayoutProcessor.java b/src/org/apache/fop/layoutmgr/LayoutProcessor.java new file mode 100755 index 000000000..4b344fbaa --- /dev/null +++ b/src/org/apache/fop/layoutmgr/LayoutProcessor.java @@ -0,0 +1,189 @@ +/* + * $Id$ + * Copyright (C) 2003 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.fo.flow.Marker; + +import org.apache.fop.area.Area; +import org.apache.fop.area.Resolveable; +import org.apache.fop.area.PageViewport; + +import java.util.Map; + +/** + * The interface for all LayoutProcessors. + * This interface is used by the layout implementation to + * do the layout and add the areas. + */ +public interface LayoutProcessor extends LayoutManager { + + /** + * Set the parent layout manager. + * The parent layout manager is required for adding areas. + * + * @param lm the parent layout manager + */ + public void setParent(LayoutProcessor lm); + + /** + * Initialise this layout manager. + */ + public void init(); + + /** + * Generates inline areas. + * This is used to check if the layout manager generates inline + * areas. + * + * @return true if the layout manager generates inline areas + */ + public boolean generatesInlineAreas(); + + /** + * Return true if the next area which would be generated by this + * LayoutManager could start a new line (or flow for block-level FO). + * + * @param lc the layout context + * @return true if can break before + */ + public boolean canBreakBefore(LayoutContext lc); + + /** + * Generate and return the next break possibility. + * + * @param context The layout context contains information about pending + * space specifiers from ancestor areas or previous areas, reference + * area inline-progression-dimension and various other layout-related + * information. + * @return the next break position + */ + public BreakPoss getNextBreakPoss(LayoutContext context); + + /** + * Reset to the position. + * + * @param position + */ + public void resetPosition(Position position); + + /** + * Get the word chars between two positions and + * append to the string buffer. The positions could + * span multiple layout managers. + * + * @param sbChars the string buffer to append the word chars + * @param bp1 the start position + * @param bp2 the end position + */ + public void getWordChars(StringBuffer sbChars, Position bp1, + Position bp2); + + /** + * Return a value indicating whether this LayoutManager has laid out + * all its content (or generated BreakPossibilities for all content.) + * + * @return true if this layout manager is finished + */ + public boolean isFinished(); + + /** + * Set a flag indicating whether the LayoutManager has laid out all + * its content. This is generally called by the LM itself, but can + * be called by a parentLM when backtracking. + * + * @param isFinished the value to set the finished flag to + */ + public void setFinished(boolean isFinished); + + /** + * Get the parent area for an area. + * This should get the parent depending on the class of the + * area passed in. + * + * @param childArea the child area to get the parent for + * @return the parent Area + */ + public Area getParentArea(Area childArea); + + /** + * Add the area as a child of the current area. + * This is called by child layout managers to add their + * areas as children of the current area. + * + * @param childArea the child area to add + */ + public void addChild(Area childArea); + + /** + * Tell the layout manager to add all the child areas implied + * by Position objects which will be returned by the + * Iterator. + * + * @param posIter the position iterator + * @param context the context + */ + public void addAreas(PositionIterator posIter, LayoutContext context); + + /** + * Get the string of the current page number. + * + * @return the string for the current page number + */ + public String getCurrentPageNumber(); + + /** + * Resolve the id reference. + * This is called by an area looking for an id reference. + * If the id reference is not found then it should add a resolveable object. + * + * @param ref the id reference + * @return the page containing the id reference or null if not found + */ + public PageViewport resolveRefID(String ref); + + /** + * Add an id to the page. + * @todo add the location of the area on the page + * + * @param id the id reference to add. + */ + public void addIDToPage(String id); + + /** + * Add an unresolved area. + * The is used to add a resolveable object to the page for a given id. + * + * @param id the id reference this object needs for resolving + * @param res the resolveable object + */ + public void addUnresolvedArea(String id, Resolveable res); + + /** + * Add the marker. + * A number of formatting objects may contain markers. This + * method is used to add those markers to the page. + * + * @param name the marker class name + * @param start true if the formatting object is starting false is finishing + * @param isfirst a flag for is first + */ + public void addMarkerMap(Map marks, boolean start, boolean isfirst); + + /** + * Retrieve a marker. + * This method is used when retrieve a marker. + * + * @param name the class name of the marker + * @param pos the retrieve position + * @param boundary the boundary for retrieving the marker + * @return the layout manaager of the retrieved marker if any + */ + public Marker retrieveMarker(String name, int pos, int boundary); + +} + diff --git a/src/org/apache/fop/layoutmgr/LeafPosition.java b/src/org/apache/fop/layoutmgr/LeafPosition.java index 72d3edac4..0ee5c9da9 100644 --- a/src/org/apache/fop/layoutmgr/LeafPosition.java +++ b/src/org/apache/fop/layoutmgr/LeafPosition.java @@ -11,7 +11,7 @@ public class LeafPosition extends Position { private int iLeafPos; - public LeafPosition(LayoutManager lm, int pos) { + public LeafPosition(LayoutProcessor lm, int pos) { super(lm); iLeafPos = pos; } diff --git a/src/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/org/apache/fop/layoutmgr/LineLayoutManager.java index 3b91ea810..9ec7bea54 100644 --- a/src/org/apache/fop/layoutmgr/LineLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/LineLayoutManager.java @@ -48,7 +48,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { int lineHeight; int baseline; - LineBreakPosition(LayoutManager lm, int iBreakIndex, + LineBreakPosition(LayoutProcessor lm, int iBreakIndex, double ipdA, double adjust, int ind, int lh, int bl) { super(lm, iBreakIndex); // iPos = iBreakIndex; @@ -119,7 +119,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { // Get a break from currently active child LM // Set up constraints for inline level managers - LayoutManager curLM ; // currently active LM + LayoutProcessor curLM ; // currently active LM BreakPoss prev = null; BreakPoss bp = null; // proposed BreakPoss @@ -309,7 +309,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { // See if could break before next area // TODO: do we need to set anything on the layout context? LayoutContext lc = new LayoutContext(0); - LayoutManager nextLM = getChildLM(); + LayoutProcessor nextLM = getChildLM(); return (nextLM == null || nextLM.canBreakBefore(lc)); } } @@ -573,7 +573,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { * @param dSpaceAdjust the space adjustment */ public void addAreas(PositionIterator parentIter, double dSpaceAdjust) { - LayoutManager childLM; + LayoutProcessor childLM; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { LineBreakPosition lbp = (LineBreakPosition) parentIter.next(); diff --git a/src/org/apache/fop/layoutmgr/NonLeafPosition.java b/src/org/apache/fop/layoutmgr/NonLeafPosition.java index 6b91c940e..0e1dea9c0 100644 --- a/src/org/apache/fop/layoutmgr/NonLeafPosition.java +++ b/src/org/apache/fop/layoutmgr/NonLeafPosition.java @@ -11,7 +11,7 @@ public class NonLeafPosition extends Position { private Position subPos; - public NonLeafPosition(LayoutManager lm, Position sub) { + public NonLeafPosition(LayoutProcessor lm, Position sub) { super(lm); subPos = sub; } diff --git a/src/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/org/apache/fop/layoutmgr/PageLayoutManager.java index 75b65f155..6bdea66d4 100644 --- a/src/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -43,7 +43,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable private static class BlockBreakPosition extends LeafPosition { protected BreakPoss breakps; - protected BlockBreakPosition(LayoutManager lm, BreakPoss bp) { + protected BlockBreakPosition(LayoutProcessor lm, BreakPoss bp) { super(lm, 0); breakps = bp; } @@ -170,7 +170,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable */ public BreakPoss getNextBreakPoss(LayoutContext context) { - LayoutManager curLM ; // currently active LM + LayoutProcessor curLM ; // currently active LM while ((curLM = getChildLM()) != null) { BreakPoss bp = null; @@ -415,7 +415,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable lm.setUserAgent(getUserAgent()); lm.init(); lm.setRegionReference(reg.getRegion()); - lm.setParentLM(this); + lm.setParent(this); LayoutContext childLC = new LayoutContext(0); childLC.setStackLimit(new MinOptMax((int)curPage.getViewArea().getHeight())); childLC.setRefIPD((int)reg.getViewArea().getWidth()); diff --git a/src/org/apache/fop/layoutmgr/Position.java b/src/org/apache/fop/layoutmgr/Position.java index 0eee55ee1..b6348209a 100644 --- a/src/org/apache/fop/layoutmgr/Position.java +++ b/src/org/apache/fop/layoutmgr/Position.java @@ -8,13 +8,13 @@ package org.apache.fop.layoutmgr; public class Position { - private LayoutManager layoutManager; + private LayoutProcessor layoutManager; - public Position(LayoutManager lm) { + public Position(LayoutProcessor lm) { layoutManager = lm; } - public LayoutManager getLM() { + public LayoutProcessor getLM() { return layoutManager; } diff --git a/src/org/apache/fop/layoutmgr/PositionIterator.java b/src/org/apache/fop/layoutmgr/PositionIterator.java index 2c014b23e..c173fd09e 100644 --- a/src/org/apache/fop/layoutmgr/PositionIterator.java +++ b/src/org/apache/fop/layoutmgr/PositionIterator.java @@ -14,7 +14,7 @@ import java.util.NoSuchElementException; public abstract class PositionIterator implements Iterator { Iterator parentIter; Object nextObj; - LayoutManager childLM; + LayoutProcessor childLM; boolean bHasNext; PositionIterator(Iterator pIter) { @@ -23,7 +23,7 @@ public abstract class PositionIterator implements Iterator { //checkNext(); } - public LayoutManager getNextChildLM() { + public LayoutProcessor getNextChildLM() { // Move to next "segment" of iterator, ie: new childLM if (childLM == null && nextObj != null) { childLM = getLM(nextObj); @@ -32,7 +32,7 @@ public abstract class PositionIterator implements Iterator { return childLM; } - protected abstract LayoutManager getLM(Object nextObj); + protected abstract LayoutProcessor getLM(Object nextObj); protected abstract Position getPos(Object nextObj); @@ -46,7 +46,7 @@ public abstract class PositionIterator implements Iterator { } protected boolean checkNext() { - LayoutManager lm = getLM(nextObj); + LayoutProcessor lm = getLM(nextObj); if (childLM == null) { childLM = lm; } else if (childLM != lm) { diff --git a/src/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java b/src/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java index 346ab4702..8c4305e5b 100644 --- a/src/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java @@ -17,7 +17,7 @@ import org.apache.fop.fo.flow.Marker; * LayoutManager for a block FO. */ public class RetrieveMarkerLayoutManager extends AbstractLayoutManager { - private LayoutManager replaceLM = null; + private LayoutProcessor replaceLM = null; private boolean loaded = false; private String name; private int position; @@ -82,8 +82,8 @@ public class RetrieveMarkerLayoutManager extends AbstractLayoutManager { if (marker != null) { marker.addLayoutManager(list); if (list.size() > 0) { - replaceLM = (LayoutManager)list.get(0); - replaceLM.setParentLM(this); + replaceLM = (LayoutProcessor)list.get(0); + replaceLM.setParent(this); replaceLM.init(); getLogger().debug("retrieved: " + replaceLM + ":" + list.size()); } else { @@ -119,7 +119,7 @@ public class RetrieveMarkerLayoutManager extends AbstractLayoutManager { reset(null); } if (replaceLM != null) { - replaceLM.resetPosition(resetPos); + replaceLM.resetPosition(null); } loaded = false; replaceLM = null; diff --git a/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java index 5789c8ef3..6ef79d36b 100644 --- a/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java @@ -36,7 +36,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { public BreakPoss getNextBreakPoss(LayoutContext context) { // currently active LM - LayoutManager curLM; + LayoutProcessor curLM; while ((curLM = getChildLM()) != null) { // Make break positions and return page break @@ -63,7 +63,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) { - LayoutManager childLM; + LayoutProcessor childLM; int iStartPos = 0; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { diff --git a/src/org/apache/fop/layoutmgr/list/Item.java b/src/org/apache/fop/layoutmgr/list/Item.java index 1d59a210d..7e15acd49 100644 --- a/src/org/apache/fop/layoutmgr/list/Item.java +++ b/src/org/apache/fop/layoutmgr/list/Item.java @@ -9,7 +9,7 @@ package org.apache.fop.layoutmgr.list; import org.apache.fop.fo.PropertyManager; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.BreakPoss; import org.apache.fop.layoutmgr.LayoutContext; @@ -63,7 +63,7 @@ public class Item extends BlockStackingLayoutManager { * @return the next break possibility */ public BreakPoss getNextBreakPoss(LayoutContext context) { - LayoutManager curLM; // currently active LM + LayoutProcessor curLM; // currently active LM MinOptMax stackSize = new MinOptMax(); // if starting add space before @@ -93,7 +93,7 @@ public class Item extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null); @@ -153,7 +153,7 @@ public class Item extends BlockStackingLayoutManager { getParentArea(null); addID(); - LayoutManager childLM; + LayoutProcessor childLM; int iStartPos = 0; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { diff --git a/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java index d22deee0f..781082781 100644 --- a/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java @@ -9,7 +9,7 @@ package org.apache.fop.layoutmgr.list; import org.apache.fop.fo.PropertyManager; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.BreakPoss; import org.apache.fop.layoutmgr.LayoutContext; @@ -41,7 +41,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { private class SectionPosition extends LeafPosition { protected List list; - protected SectionPosition(LayoutManager lm, int pos, List l) { + protected SectionPosition(LayoutProcessor lm, int pos, List l) { super(lm, pos); list = l; } @@ -69,14 +69,14 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { */ public BreakPoss getNextBreakPoss(LayoutContext context) { // currently active LM - LayoutManager curLM; + LayoutProcessor curLM; MinOptMax stackSize = new MinOptMax(); // if starting add space before // stackSize.add(spaceBefore); BreakPoss lastPos = null; - while ((curLM = (LayoutManager)getChildLM()) != null) { + while ((curLM = (LayoutProcessor)getChildLM()) != null) { // Make break positions // Set up a LayoutContext int ipd = context.getRefIPD(); @@ -94,7 +94,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null); @@ -146,7 +146,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { int listHeight = 0; - LayoutManager childLM; + LayoutProcessor childLM; int iStartPos = 0; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { @@ -156,7 +156,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { new BreakPossPosIter(bodyBreaks, iStartPos, lfp.getLeafPos() + 1); iStartPos = lfp.getLeafPos() + 1; - while ((childLM = (LayoutManager)breakPosIter.getNextChildLM()) != null) { + while ((childLM = (LayoutProcessor)breakPosIter.getNextChildLM()) != null) { childLM.addAreas(breakPosIter, lc); } } diff --git a/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index 4eb983d71..4535a0e84 100644 --- a/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -9,7 +9,7 @@ package org.apache.fop.layoutmgr.list; import org.apache.fop.fo.PropertyManager; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.BreakPoss; import org.apache.fop.layoutmgr.LayoutContext; @@ -43,7 +43,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { private class ItemPosition extends LeafPosition { protected List cellBreaks; - protected ItemPosition(LayoutManager lm, int pos, List l) { + protected ItemPosition(LayoutProcessor lm, int pos, List l) { super(lm, pos); cellBreaks = l; } @@ -63,12 +63,12 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { public void setLabel(Item item) { label = item; - label.setParentLM(this); + label.setParent(this); } public void setBody(Item item) { body = item; - body.setParentLM(this); + body.setParent(this); } /** @@ -124,7 +124,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null); diff --git a/src/org/apache/fop/layoutmgr/table/Body.java b/src/org/apache/fop/layoutmgr/table/Body.java index 39a4111fc..ad0f03651 100644 --- a/src/org/apache/fop/layoutmgr/table/Body.java +++ b/src/org/apache/fop/layoutmgr/table/Body.java @@ -8,7 +8,7 @@ package org.apache.fop.layoutmgr.table; import org.apache.fop.fo.PropertyManager; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.BreakPoss; @@ -112,7 +112,7 @@ public class Body extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null); diff --git a/src/org/apache/fop/layoutmgr/table/Caption.java b/src/org/apache/fop/layoutmgr/table/Caption.java index f795ed9d8..1e9fd95b5 100644 --- a/src/org/apache/fop/layoutmgr/table/Caption.java +++ b/src/org/apache/fop/layoutmgr/table/Caption.java @@ -8,7 +8,7 @@ package org.apache.fop.layoutmgr.table; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.BreakPoss; import org.apache.fop.layoutmgr.LayoutContext; @@ -47,7 +47,7 @@ public class Caption extends BlockStackingLayoutManager { * @return the next break possibility */ public BreakPoss getNextBreakPoss(LayoutContext context) { - LayoutManager curLM; // currently active LM + LayoutProcessor curLM; // currently active LM MinOptMax stackSize = new MinOptMax(); // if starting add space before @@ -78,7 +78,7 @@ public class Caption extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null); @@ -125,7 +125,7 @@ public class Caption extends BlockStackingLayoutManager { getParentArea(null); addID(); - LayoutManager childLM; + LayoutProcessor childLM; int iStartPos = 0; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { diff --git a/src/org/apache/fop/layoutmgr/table/Cell.java b/src/org/apache/fop/layoutmgr/table/Cell.java index 790f9eef2..9ad2c2166 100644 --- a/src/org/apache/fop/layoutmgr/table/Cell.java +++ b/src/org/apache/fop/layoutmgr/table/Cell.java @@ -9,7 +9,7 @@ package org.apache.fop.layoutmgr.table; import org.apache.fop.fo.PropertyManager; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.BreakPoss; import org.apache.fop.layoutmgr.LayoutContext; @@ -64,7 +64,7 @@ public class Cell extends BlockStackingLayoutManager { * @return the next break possibility */ public BreakPoss getNextBreakPoss(LayoutContext context) { - LayoutManager curLM; // currently active LM + LayoutProcessor curLM; // currently active LM MinOptMax stackSize = new MinOptMax(); // if starting add space before @@ -95,7 +95,7 @@ public class Cell extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null); @@ -173,7 +173,7 @@ public class Cell extends BlockStackingLayoutManager { getParentArea(null); addID(); - LayoutManager childLM; + LayoutProcessor childLM; int iStartPos = 0; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { diff --git a/src/org/apache/fop/layoutmgr/table/Row.java b/src/org/apache/fop/layoutmgr/table/Row.java index c703a29e0..c55fe8ab3 100644 --- a/src/org/apache/fop/layoutmgr/table/Row.java +++ b/src/org/apache/fop/layoutmgr/table/Row.java @@ -9,7 +9,7 @@ package org.apache.fop.layoutmgr.table; import org.apache.fop.fo.PropertyManager; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.BreakPoss; import org.apache.fop.layoutmgr.LayoutContext; @@ -45,7 +45,7 @@ public class Row extends BlockStackingLayoutManager { private class RowPosition extends LeafPosition { protected List cellBreaks; - protected RowPosition(LayoutManager lm, int pos, List l) { + protected RowPosition(LayoutProcessor lm, int pos, List l) { super(lm, pos); cellBreaks = l; } @@ -81,9 +81,9 @@ public class Row extends BlockStackingLayoutManager { cellList = new ArrayList(); // add cells to list while (childLMiter.hasNext()) { - curChildLM = (LayoutManager) childLMiter.next(); + curChildLM = (LayoutProcessor) childLMiter.next(); curChildLM.setUserAgent(getUserAgent()); - curChildLM.setParentLM(this); + curChildLM.setParent(this); curChildLM.init(); cellList.add(curChildLM); } @@ -114,7 +114,7 @@ public class Row extends BlockStackingLayoutManager { * @return the next break possibility */ public BreakPoss getNextBreakPoss(LayoutContext context) { - LayoutManager curLM; // currently active LM + LayoutProcessor curLM; // currently active LM BreakPoss lastPos = null; List breakList = new ArrayList(); @@ -155,7 +155,7 @@ public class Row extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null); @@ -226,7 +226,7 @@ public class Row extends BlockStackingLayoutManager { * If pos is null, then back up to the first child LM. */ protected void reset(Position pos) { - LayoutManager curLM; // currently active LM + LayoutProcessor curLM; // currently active LM int cellcount = 0; if (pos == null) { diff --git a/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java b/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java index d96273434..fe687652c 100644 --- a/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java @@ -8,7 +8,7 @@ package org.apache.fop.layoutmgr.table; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.BreakPoss; import org.apache.fop.layoutmgr.LayoutContext; @@ -49,7 +49,7 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { * @return the next break possibility */ public BreakPoss getNextBreakPoss(LayoutContext context) { - LayoutManager curLM; // currently active LM + LayoutProcessor curLM; // currently active LM MinOptMax stackSize = new MinOptMax(); // if starting add space before @@ -79,7 +79,7 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null); @@ -126,7 +126,7 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { getParentArea(null); addID(); - LayoutManager childLM; + LayoutProcessor childLM; int iStartPos = 0; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { diff --git a/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java index d3985ea35..d1879e3fb 100644 --- a/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -9,7 +9,7 @@ package org.apache.fop.layoutmgr.table; import org.apache.fop.fo.PropertyManager; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; -import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.LeafPosition; import org.apache.fop.layoutmgr.BreakPoss; import org.apache.fop.layoutmgr.LayoutContext; @@ -50,7 +50,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager { private class SectionPosition extends LeafPosition { protected List list; - protected SectionPosition(LayoutManager lm, int pos, List l) { + protected SectionPosition(LayoutProcessor lm, int pos, List l) { super(lm, pos); list = l; } @@ -84,7 +84,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager { */ public void setTableHeader(Body th) { tableHeader = th; - tableHeader.setParentLM(this); + tableHeader.setParent(this); } /** @@ -94,7 +94,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager { */ public void setTableFooter(Body tf) { tableFooter = tf; - tableFooter.setParentLM(this); + tableFooter.setParent(this); } /** @@ -159,7 +159,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager { if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) { // reset to last break if (lastPos != null) { - LayoutManager lm = lastPos.getLayoutManager(); + LayoutProcessor lm = lastPos.getLayoutManager(); lm.resetPosition(lastPos.getPosition()); if (lm != curLM) { curLM.resetPosition(null);