diff options
author | Keiron Liddle <keiron@apache.org> | 2002-11-13 10:25:58 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2002-11-13 10:25:58 +0000 |
commit | afaedf22bc8d5c604de306765bb9f43ac6d2c766 (patch) | |
tree | 1cf3e7829ac610b136d0e75a4160c46d72bf918d /src/org | |
parent | 166214c4697af1e074757f44afe693db2b1d3523 (diff) | |
download | xmlgraphics-fop-afaedf22bc8d5c604de306765bb9f43ac6d2c766.tar.gz xmlgraphics-fop-afaedf22bc8d5c604de306765bb9f43ac6d2c766.zip |
cleanup of lms
attempt at fixing some block layout problems
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195516 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org')
30 files changed, 413 insertions, 431 deletions
diff --git a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java index 53cfdaa34..0a57777bd 100644 --- a/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java @@ -28,10 +28,10 @@ public abstract class AbstractLayoutManager implements LayoutManager { protected String foID = null; /** True if this LayoutManager has handled all of its content. */ - private boolean m_bFinished = false; - protected LayoutManager m_curChildLM = null; - protected ListIterator m_childLMiter; - protected boolean m_bInited = false; + private boolean bFinished = false; + protected LayoutManager curChildLM = null; + protected ListIterator childLMiter; + protected boolean bInited = false; protected LayoutPos curPos = new LayoutPos(); @@ -48,7 +48,7 @@ public abstract class AbstractLayoutManager implements LayoutManager { this.fobj = fobj; foID = fobj.getID(); this.parentLM = null; - m_childLMiter = lmIter; + childLMiter = lmIter; } public void setParentLM(LayoutManager lm) { @@ -104,26 +104,26 @@ public abstract class AbstractLayoutManager implements LayoutManager { * and print a warning. */ protected LayoutManager getChildLM() { - if (m_curChildLM != null && !m_curChildLM.isFinished()) { - return m_curChildLM; + if (curChildLM != null && !curChildLM.isFinished()) { + return curChildLM; } - while (m_childLMiter.hasNext()) { - m_curChildLM = (LayoutManager) m_childLMiter.next(); - m_curChildLM.setParentLM(this); - m_curChildLM.init(); - return m_curChildLM; + while (childLMiter.hasNext()) { + curChildLM = (LayoutManager) childLMiter.next(); + curChildLM.setParentLM(this); + curChildLM.init(); + return curChildLM; } return null; } protected boolean hasMoreLM(LayoutManager prevLM) { - // prevLM should = m_curChildLM - if (prevLM != m_curChildLM) { + // prevLM should = curChildLM + if (prevLM != curChildLM) { //log.debug("AbstractLayoutManager.peekNextLM: " + // "passed LM is not current child LM!"); return false; } - return !m_childLMiter.hasNext(); + return !childLMiter.hasNext(); } @@ -138,20 +138,20 @@ public abstract class AbstractLayoutManager implements LayoutManager { protected void reset(Position pos) { //if (lm == null) return; LayoutManager lm = (pos != null) ? pos.getLM() : null; - if (m_curChildLM != lm) { - // ASSERT m_curChildLM == (LayoutManager)m_childLMiter.previous() - if (m_childLMiter.hasPrevious() && m_curChildLM != - (LayoutManager) m_childLMiter.previous()) { + if (curChildLM != lm) { + // ASSERT curChildLM == (LayoutManager)childLMiter.previous() + if (childLMiter.hasPrevious() && curChildLM != + (LayoutManager) childLMiter.previous()) { //log.error("LMiter problem!"); } - while (m_curChildLM != lm && m_childLMiter.hasPrevious()) { - m_curChildLM.resetPosition(null); - m_curChildLM = (LayoutManager) m_childLMiter.previous(); + while (curChildLM != lm && childLMiter.hasPrevious()) { + curChildLM.resetPosition(null); + curChildLM = (LayoutManager) childLMiter.previous(); } - m_childLMiter.next(); // Otherwise next returns same object + childLMiter.next(); // Otherwise next returns same object } - if(m_curChildLM != null) { - m_curChildLM.resetPosition(pos); + if(curChildLM != null) { + curChildLM.resetPosition(pos); } if (isFinished()) { setFinished(false); @@ -170,9 +170,9 @@ public abstract class AbstractLayoutManager implements LayoutManager { * for the areas it will create, based on Properties set on its FO. */ public void init() { - if (fobj != null && m_bInited == false) { + if (fobj != null && bInited == false) { initProperties(fobj.getPropertyManager()); - m_bInited = true; + bInited = true; } } @@ -191,11 +191,11 @@ public abstract class AbstractLayoutManager implements LayoutManager { * ie. the last one returned represents the end of the content. */ public boolean isFinished() { - return m_bFinished; + return bFinished; } - public void setFinished(boolean bFinished) { - m_bFinished = bFinished; + public void setFinished(boolean fin) { + bFinished = fin; } @@ -243,12 +243,10 @@ public abstract class AbstractLayoutManager implements LayoutManager { return null; } - protected boolean flush() { - return false; + protected void flush() { } - public boolean addChild(Area childArea) { - return false; + public void addChild(Area childArea) { } /** diff --git a/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 3550798df..f30ad2970 100644 --- a/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -37,7 +37,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { private BlockViewport viewportBlockArea; private Block curBlockArea; - ArrayList childBreaks = new ArrayList(); + List childBreaks = new ArrayList(); AbsolutePositionProps abProps; FODimension relDims; @@ -275,12 +275,10 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { } - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (curBlockArea != null) { curBlockArea.addBlock((Block) childArea); - //return super.addChild(childArea); } - return false; } public void resetPosition(Position resetPos) { diff --git a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java index f384842b6..0ad730170 100644 --- a/src/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -41,7 +41,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { int lineHeight = 14000; int follow = 2000; - ArrayList childBreaks = new ArrayList(); + protected List childBreaks = new ArrayList(); /** * Iterator for Block layout. @@ -63,11 +63,11 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { LayoutManager lm = (LayoutManager) proxy.next(); if(lm.generatesInlineAreas()) { LineLayoutManager lineLM = createLineManager(lm); - m_listLMs.add(lineLM); + listLMs.add(lineLM); } else { - m_listLMs.add(lm); + listLMs.add(lm); } - if (m_curPos < m_listLMs.size()) { + if (curPos < listLMs.size()) { return true; } } @@ -77,7 +77,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { protected LineLayoutManager createLineManager( LayoutManager firstlm) { LayoutManager lm; - ArrayList inlines = new ArrayList(); + List inlines = new ArrayList(); inlines.add(firstlm); while (proxy.hasNext()) { lm = (LayoutManager) proxy.next(); @@ -98,7 +98,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { public BlockLayoutManager(FObj fobj) { super(fobj); - m_childLMiter = new BlockLMiter(m_childLMiter); + childLMiter = new BlockLMiter(childLMiter); } public void setBlockTextInfo(TextInfo ti) { @@ -118,7 +118,9 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { } public BreakPoss getNextBreakPoss(LayoutContext context) { - LayoutManager curLM ; // currently active LM + LayoutManager curLM; // currently active LM + + int ipd = context.getRefIPD(); MinOptMax stackSize = new MinOptMax(); // if starting add space before @@ -129,7 +131,6 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { while ((curLM = getChildLM()) != null) { // Make break positions and return blocks! // Set up a LayoutContext - int ipd = context.getRefIPD(); BreakPoss bp; LayoutContext childLC = new LayoutContext(0); @@ -137,7 +138,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { // line LM actually generates a LineArea which is a block if (curLM.generatesInlineAreas()) { // set stackLimit for lines - childLC.setStackLimit(new MinOptMax(ipd/* - m_iIndents - m_iTextIndent*/)); + childLC.setStackLimit(new MinOptMax(ipd/* - iIndents - iTextIndent*/)); childLC.setRefIPD(ipd); } else { childLC.setStackLimit( @@ -145,7 +146,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { stackSize)); childLC.setRefIPD(ipd); } - + boolean over = false; while (!curLM.isFinished()) { if ((bp = curLM.getNextBreakPoss(childLC)) != null) { stackSize.add(bp.getStackingSize()); @@ -156,6 +157,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { } else { curLM.resetPosition(null); } + over = true; break; } lastPos = bp; @@ -163,23 +165,28 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { if (curLM.generatesInlineAreas()) { // Reset stackLimit for non-first lines - childLC.setStackLimit(new MinOptMax(ipd/* - m_iIndents*/)); + childLC.setStackLimit(new MinOptMax(ipd/* - iIndents*/)); } else { - childLC.setStackLimit( MinOptMax.subtract( + childLC.setStackLimit(MinOptMax.subtract( context.getStackLimit(), stackSize)); } } } - if(getChildLM() == null) { - stackSize.add(layoutProps.spaceAfter.space); - } - BreakPoss breakPoss = new BreakPoss( + if(getChildLM() == null || over) { + if(getChildLM() == null) { + setFinished(true); + stackSize.add(layoutProps.spaceAfter.space); + } + BreakPoss breakPoss = new BreakPoss( new LeafPosition(this, childBreaks.size() - 1)); - breakPoss.setStackingSize(stackSize); - return breakPoss; + breakPoss.setStackingSize(stackSize); + return breakPoss; + } } setFinished(true); - return null; + BreakPoss breakPoss = new BreakPoss(new LeafPosition(this, -2)); + breakPoss.setStackingSize(stackSize); + return breakPoss; } public void addAreas(PositionIterator parentIter, @@ -197,6 +204,12 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { LeafPosition lfp = (LeafPosition) parentIter.next(); + if (lfp.getLeafPos() == -2) { + childBreaks.clear(); + curBlockArea = null; + flush(); + return; + } // Add the block areas to Area PositionIterator breakPosIter = new BreakPossPosIter(childBreaks, iStartPos, @@ -246,24 +259,23 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { return curBlockArea; } - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (curBlockArea != null) { if (childArea instanceof LineArea) { curBlockArea.addLineArea((LineArea) childArea); - - return false; } else { curBlockArea.addBlock((Block) childArea); - - return false; } } - return false; } public void resetPosition(Position resetPos) { if (resetPos == null) { reset(null); + childBreaks.clear(); + } else { + //reset(resetPos); + LayoutManager lm = resetPos.getLM(); } } } diff --git a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java index 89a7cbb26..7a8310325 100644 --- a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java @@ -89,19 +89,16 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager { * @param childArea the area to add: will be some block-stacked Area. * @param parentArea the area in which to add the childArea */ - protected boolean addChildToArea(Area childArea, + protected void addChildToArea(Area childArea, BlockParent parentArea) { // This should be a block-level Area (Block in the generic sense) if (!(childArea instanceof Block)) { //log.error("Child not a Block in BlockStackingLM!"); - return false; } MinOptMax spaceBefore = resolveSpaceSpecifier(childArea); parentArea.addBlock((Block) childArea); flush(); // hand off current area to parent - - return true; } @@ -113,18 +110,17 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager { * If so, add it. Otherwise initiate breaking. * @param childArea the area to add: will be some block-stacked Area. */ - public boolean addChild(Area childArea) { - return addChildToArea(childArea, getCurrentArea()); + public void addChild(Area childArea) { + addChildToArea(childArea, getCurrentArea()); } /** * Force current area to be added to parent area. */ - protected boolean flush() { + protected void flush() { if (getCurrentArea() != null) { - return parentLM.addChild(getCurrentArea()); + parentLM.addChild(getCurrentArea()); } - return false; } } diff --git a/src/org/apache/fop/layoutmgr/BreakPoss.java b/src/org/apache/fop/layoutmgr/BreakPoss.java index 004e8970b..2f9a01d11 100644 --- a/src/org/apache/fop/layoutmgr/BreakPoss.java +++ b/src/org/apache/fop/layoutmgr/BreakPoss.java @@ -38,6 +38,10 @@ public class BreakPoss { * in the lowest level text LM will be suppressed. */ public static final int REST_ARE_SUPPRESS_AT_LB = 0x200; + /** + * Next area for LM overflows + */ + public static final int NEXT_OVERFLOWS = 0x400; /** The opaque position object used by m_lm to record its * break position. diff --git a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java index 957d6edf5..3432c953f 100644 --- a/src/org/apache/fop/layoutmgr/ContentLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/ContentLayoutManager.java @@ -6,13 +6,15 @@ */ package org.apache.fop.layoutmgr; -import java.util.List; - import org.apache.fop.area.Area; import org.apache.fop.area.MinOptMax; import org.apache.fop.area.Resolveable; import org.apache.fop.area.PageViewport; +import java.util.List; +import java.util.ArrayList; + + /** * Content Layout Manager. * For use with objects that contain inline areas such as @@ -35,7 +37,7 @@ public class ContentLayoutManager implements LayoutManager { public void fillArea(LayoutManager curLM) { - List childBreaks = new java.util.ArrayList(); + List childBreaks = new ArrayList(); MinOptMax stack = new MinOptMax(); int ipd = 1000000; BreakPoss bp; @@ -116,9 +118,8 @@ public class ContentLayoutManager implements LayoutManager { } /** @see org.apache.fop.layoutmgr.LayoutManager */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { holder.addChild(childArea); - return true; } /** @see org.apache.fop.layoutmgr.LayoutManager */ diff --git a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java index 57b7e123f..f8011f033 100644 --- a/src/org/apache/fop/layoutmgr/FlowLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/FlowLayoutManager.java @@ -23,7 +23,7 @@ import java.util.List; */ public class FlowLayoutManager extends BlockStackingLayoutManager { - ArrayList blockBreaks = new ArrayList(); + protected List blockBreaks = new ArrayList(); /** Array of areas currently being filled stored by area class */ private BlockParent[] currentAreas = new BlockParent[Area.CLASS_MAX]; @@ -119,9 +119,9 @@ public class FlowLayoutManager extends BlockStackingLayoutManager { * area class. A Flow can fill at most one area container of any class * at any one time. The actual work is done by BlockStackingLM. */ - public boolean addChild(Area childArea) { - return addChildToArea(childArea, - this.currentAreas[childArea.getAreaClass()]); + public void addChild(Area childArea) { + addChildToArea(childArea, + this.currentAreas[childArea.getAreaClass()]); } public Area getParentArea(Area childArea) { diff --git a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java index ad98097be..1554a3d1e 100644 --- a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java @@ -511,8 +511,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager { currentArea = area; } - - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { // Make sure childArea is inline area if (childArea instanceof InlineArea) { Area parent = getCurrentArea(); @@ -523,7 +522,6 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager { } parent.addChild(childArea); } - return false; } protected void setChildContext(LayoutContext lc) { diff --git a/src/org/apache/fop/layoutmgr/LMiter.java b/src/org/apache/fop/layoutmgr/LMiter.java index d872727ad..1c0baafad 100644 --- a/src/org/apache/fop/layoutmgr/LMiter.java +++ b/src/org/apache/fop/layoutmgr/LMiter.java @@ -10,35 +10,36 @@ package org.apache.fop.layoutmgr; import org.apache.fop.fo.FObj; import java.util.ArrayList; +import java.util.List; import java.util.ListIterator; import java.util.NoSuchElementException; public class LMiter implements ListIterator { - private ListIterator m_baseIter; - private FObj m_curFO; - protected ArrayList m_listLMs; - protected int m_curPos = 0; + private ListIterator baseIter; + private FObj curFO; + protected List listLMs; + protected int curPos = 0; - public LMiter(ListIterator baseIter) { - m_baseIter = baseIter; - m_listLMs = new ArrayList(10); + public LMiter(ListIterator bIter) { + baseIter = bIter; + listLMs = new ArrayList(10); } public boolean hasNext() { - return (m_curPos < m_listLMs.size()) ? true : preLoadNext(); + return (curPos < listLMs.size()) ? true : preLoadNext(); } protected boolean preLoadNext() { // skip over child FObj's that don't add lms - while (m_baseIter.hasNext()) { - Object theobj = m_baseIter.next(); + while (baseIter.hasNext()) { + Object theobj = baseIter.next(); if(theobj instanceof FObj) { FObj fobj = (FObj) theobj; - //m_listLMs.add(fobj.getLayoutManager()); - fobj.addLayoutManager(m_listLMs); - if(m_curPos < m_listLMs.size()) { + //listLMs.add(fobj.getLayoutManager()); + fobj.addLayoutManager(listLMs); + if(curPos < listLMs.size()) { return true; } } @@ -47,26 +48,26 @@ public class LMiter implements ListIterator { } public boolean hasPrevious() { - return (m_curPos > 0); + return (curPos > 0); } public Object previous() throws NoSuchElementException { - if (m_curPos > 0) { - return m_listLMs.get(--m_curPos); + if (curPos > 0) { + return listLMs.get(--curPos); } else throw new NoSuchElementException(); } public Object next() throws NoSuchElementException { - if (m_curPos < m_listLMs.size()) { - return m_listLMs.get(m_curPos++); + if (curPos < listLMs.size()) { + return listLMs.get(curPos++); } else throw new NoSuchElementException(); } public void remove() throws NoSuchElementException { - if (m_curPos > 0) { - m_listLMs.remove(--m_curPos); + if (curPos > 0) { + listLMs.remove(--curPos); // Note: doesn't actually remove it from the base! } else throw new NoSuchElementException(); @@ -83,11 +84,11 @@ public class LMiter implements ListIterator { } public int nextIndex() { - return m_curPos; + return curPos; } public int previousIndex() { - return m_curPos - 1; + return curPos - 1; } } diff --git a/src/org/apache/fop/layoutmgr/LayoutContext.java b/src/org/apache/fop/layoutmgr/LayoutContext.java index bc0976fa8..c70cab3b3 100644 --- a/src/org/apache/fop/layoutmgr/LayoutContext.java +++ b/src/org/apache/fop/layoutmgr/LayoutContext.java @@ -48,7 +48,7 @@ public class LayoutContext { * These LM <b>may</b> wish to pass this information down to lower * level LM to allow them to optimize returned break possibilities. */ - MinOptMax m_stackLimit; + MinOptMax stackLimit; /** True if current top-level reference area is spanning. */ @@ -58,42 +58,42 @@ public class LayoutContext { int refIPD; /** Current pending space-after or space-end from preceding area */ - SpaceSpecifier m_trailingSpace; + SpaceSpecifier trailingSpace; /** Current pending space-before or space-start from ancestor areas */ - SpaceSpecifier m_leadingSpace; + SpaceSpecifier leadingSpace; /** Current hyphenation context. May be null. */ - private HyphContext m_hyphContext = null; + private HyphContext hyphContext = null; /** Stretch or shrink value when making areas. */ private double ipdAdjust = 0.0; /** Stretch or shrink value when adding spaces. */ - private double m_dSpaceAdjust = 0.0; + private double dSpaceAdjust = 0.0; - private int m_iLineHeight; - private int m_iBaseline; + private int iLineHeight; + private int iBaseline; public LayoutContext(LayoutContext parentLC) { this.flags = parentLC.flags; this.refIPD = parentLC.refIPD; - this.m_stackLimit = null; // Don't reference parent MinOptMax! - this.m_leadingSpace = parentLC.m_leadingSpace; //??? - this.m_trailingSpace = parentLC.m_trailingSpace; //??? - this.m_hyphContext = parentLC.m_hyphContext; - this.m_dSpaceAdjust = parentLC.m_dSpaceAdjust; - this.m_iLineHeight = parentLC.m_iLineHeight; - this.m_iBaseline = parentLC.m_iBaseline; + this.stackLimit = null; // Don't reference parent MinOptMax! + this.leadingSpace = parentLC.leadingSpace; //??? + this.trailingSpace = parentLC.trailingSpace; //??? + this.hyphContext = parentLC.hyphContext; + this.dSpaceAdjust = parentLC.dSpaceAdjust; + this.iLineHeight = parentLC.iLineHeight; + this.iBaseline = parentLC.iBaseline; // Copy other fields as necessary. Use clone??? } public LayoutContext(int flags) { this.flags = flags; this.refIPD = 0; - m_stackLimit = new MinOptMax(0); - m_leadingSpace = null; - m_trailingSpace = null; + stackLimit = new MinOptMax(0); + leadingSpace = null; + trailingSpace = null; } public void setFlags(int flags) { @@ -117,7 +117,7 @@ public class LayoutContext { } public boolean startsNewArea() { - return ((this.flags & NEW_AREA) != 0 && m_leadingSpace != null); + return ((this.flags & NEW_AREA) != 0 && leadingSpace != null); } public boolean isFirstArea() { @@ -133,11 +133,11 @@ public class LayoutContext { } public void setLeadingSpace(SpaceSpecifier space) { - m_leadingSpace = space; + leadingSpace = space; } public SpaceSpecifier getLeadingSpace() { - return m_leadingSpace; + return leadingSpace; } public boolean resolveLeadingSpace() { @@ -145,19 +145,19 @@ public class LayoutContext { } public void setTrailingSpace(SpaceSpecifier space) { - m_trailingSpace = space; + trailingSpace = space; } public SpaceSpecifier getTrailingSpace() { - return m_trailingSpace; + return trailingSpace; } - public void setStackLimit(MinOptMax stackLimit) { - m_stackLimit = stackLimit; + public void setStackLimit(MinOptMax limit) { + stackLimit = limit; } public MinOptMax getStackLimit() { - return m_stackLimit; + return stackLimit; } public void setRefIPD(int ipd) { @@ -168,24 +168,24 @@ public class LayoutContext { return refIPD; } - public void setHyphContext(HyphContext hyphContext) { - m_hyphContext = hyphContext; + public void setHyphContext(HyphContext hyph) { + hyphContext = hyph; } public HyphContext getHyphContext() { - return m_hyphContext; + return hyphContext; } public boolean tryHyphenate() { return ((this.flags & TRY_HYPHENATE) != 0); } - public void setSpaceAdjust(double dSpaceAdjust) { - m_dSpaceAdjust = dSpaceAdjust ; + public void setSpaceAdjust(double adjust) { + dSpaceAdjust = adjust; } public double getSpaceAdjust() { - return m_dSpaceAdjust; + return dSpaceAdjust; } public void setIPDAdjust(double ipdA) { @@ -197,19 +197,19 @@ public class LayoutContext { } public void setLineHeight(int lh) { - m_iLineHeight = lh; + iLineHeight = lh; } public int getLineHeight() { - return m_iLineHeight; + return iLineHeight; } public void setBaseline(int bl) { - m_iBaseline = bl; + iBaseline = bl; } public int getBaseline() { - return m_iBaseline; + return iBaseline; } } diff --git a/src/org/apache/fop/layoutmgr/LayoutManager.java b/src/org/apache/fop/layoutmgr/LayoutManager.java index 664730fd9..ab3b3fc62 100644 --- a/src/org/apache/fop/layoutmgr/LayoutManager.java +++ b/src/org/apache/fop/layoutmgr/LayoutManager.java @@ -18,7 +18,7 @@ import org.apache.fop.area.PageViewport; public interface LayoutManager { public boolean generatesInlineAreas(); public Area getParentArea (Area childArea); - public boolean addChild (Area childArea); + public void addChild (Area childArea); public void setParentLM(LayoutManager lm); /** diff --git a/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java b/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java index 17df76309..5e8d1d113 100644 --- a/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java @@ -96,8 +96,7 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager { * @param childArea the childArea to add * @return not used */ - public boolean addChild(Area childArea) { - return false; + public void addChild(Area childArea) { } /** diff --git a/src/org/apache/fop/layoutmgr/LeafPosition.java b/src/org/apache/fop/layoutmgr/LeafPosition.java index 95f4dbd9e..72d3edac4 100644 --- a/src/org/apache/fop/layoutmgr/LeafPosition.java +++ b/src/org/apache/fop/layoutmgr/LeafPosition.java @@ -9,15 +9,15 @@ package org.apache.fop.layoutmgr; public class LeafPosition extends Position { - private int m_iLeafPos; + private int iLeafPos; - public LeafPosition(LayoutManager lm, int iLeafPos) { + public LeafPosition(LayoutManager lm, int pos) { super(lm); - m_iLeafPos = iLeafPos; + iLeafPos = pos; } public int getLeafPos() { - return m_iLeafPos; + return iLeafPos; } } diff --git a/src/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/org/apache/fop/layoutmgr/LineLayoutManager.java index ad79b552f..0a057d7e3 100644 --- a/src/org/apache/fop/layoutmgr/LineLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/LineLayoutManager.java @@ -52,19 +52,19 @@ public class LineLayoutManager extends InlineStackingLayoutManager { * inline break positions. */ private static class LineBreakPosition extends LeafPosition { - // int m_iPos; - double m_dAdjust; // Percentage to adjust (stretch or shrink) + // int iPos; + double dAdjust; // Percentage to adjust (stretch or shrink) double ipdAdjust; // Percentage to adjust (stretch or shrink) int startIndent; int lineHeight; int baseline; LineBreakPosition(LayoutManager lm, int iBreakIndex, - double ipdA, double dAdjust, int ind, int lh, int bl) { + double ipdA, double adjust, int ind, int lh, int bl) { super(lm, iBreakIndex); - // m_iPos = iBreakIndex; + // iPos = iBreakIndex; ipdAdjust = ipdA; - m_dAdjust = dAdjust; + dAdjust = adjust; startIndent = ind; lineHeight = lh; baseline = bl; @@ -73,13 +73,13 @@ public class LineLayoutManager extends InlineStackingLayoutManager { /** Break positions returned by inline content. */ - private ArrayList m_vecInlineBreaks = new ArrayList(); + private List vecInlineBreaks = new ArrayList(); - private BreakPoss m_prevBP = null; // Last confirmed break position + private BreakPoss prevBP = null; // Last confirmed break position private int bTextAlignment = TextAlign.JUSTIFY; - private int m_iTextIndent = 0; - private int m_iIndents = 0; - private HyphenationProps m_hyphProps; + private int iTextIndent = 0; + private int iIndents = 0; + private HyphenationProps hyphProps; private int lineHeight; private int lead; @@ -113,11 +113,11 @@ public class LineLayoutManager extends InlineStackingLayoutManager { */ protected void initProperties(PropertyManager propMgr) { MarginProps marginProps = propMgr.getMarginProps(); - m_iIndents = marginProps.startIndent + marginProps.endIndent; + iIndents = marginProps.startIndent + marginProps.endIndent; BlockProps blockProps = propMgr.getBlockProps(); bTextAlignment = blockProps.textAlign; - m_iTextIndent = blockProps.firstIndent; - m_hyphProps = propMgr.getHyphenationProps(); + iTextIndent = blockProps.firstIndent; + hyphProps = propMgr.getHyphenationProps(); } /** @@ -132,7 +132,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { // Set up constraints for inline level managers LayoutManager curLM ; // currently active LM - BreakPoss prevBP = null; + BreakPoss prev = null; BreakPoss bp = null; // proposed BreakPoss ArrayList vecPossEnd = new ArrayList(); @@ -146,22 +146,22 @@ public class LineLayoutManager extends InlineStackingLayoutManager { LayoutContext inlineLC = new LayoutContext(context); clearPrevIPD(); - int iPrevLineEnd = m_vecInlineBreaks.size(); + int iPrevLineEnd = vecInlineBreaks.size(); - m_prevBP = null; + prevBP = null; while ((curLM = getChildLM()) != null) { // INITIALIZE LAYOUT CONTEXT FOR CALL TO CHILD LM // First break for the child LM in each of its areas - boolean bFirstBPforLM = (m_vecInlineBreaks.isEmpty() || - (((BreakPoss) m_vecInlineBreaks.get(m_vecInlineBreaks.size() - 1)). + boolean bFirstBPforLM = (vecInlineBreaks.isEmpty() || + (((BreakPoss) vecInlineBreaks.get(vecInlineBreaks.size() - 1)). getLayoutManager() != curLM)); // Need previous breakpoint! ATTENTION when backing up for hyphenation! - prevBP = (m_vecInlineBreaks.isEmpty()) ? null : - (BreakPoss) m_vecInlineBreaks.get(m_vecInlineBreaks.size() - 1); - initChildLC(inlineLC, prevBP, - (m_vecInlineBreaks.size() == iPrevLineEnd), + prev = (vecInlineBreaks.isEmpty()) ? null : + (BreakPoss) vecInlineBreaks.get(vecInlineBreaks.size() - 1); + initChildLC(inlineLC, prev, + (vecInlineBreaks.size() == iPrevLineEnd), bFirstBPforLM, new SpaceSpecifier(true)); @@ -170,17 +170,17 @@ public class LineLayoutManager extends InlineStackingLayoutManager { * then set the SUPPRESS_LEADING_SPACE flag. */ inlineLC.setFlags(LayoutContext.SUPPRESS_LEADING_SPACE, - (m_vecInlineBreaks.size() == iPrevLineEnd && - !m_vecInlineBreaks.isEmpty() && - ((BreakPoss) m_vecInlineBreaks.get(m_vecInlineBreaks.size() - 1)). + (vecInlineBreaks.size() == iPrevLineEnd && + !vecInlineBreaks.isEmpty() && + ((BreakPoss) vecInlineBreaks.get(vecInlineBreaks.size() - 1)). isForcedBreak() == false)); // GET NEXT POSSIBLE BREAK FROM CHILD LM // prevBP = bp; if ((bp = curLM.getNextBreakPoss(inlineLC)) != null) { // Add any space before and previous content dimension - MinOptMax prevIPD = updatePrevIPD(bp, prevBP, - (m_vecInlineBreaks.size() == iPrevLineEnd), + MinOptMax prevIPD = updatePrevIPD(bp, prev, + (vecInlineBreaks.size() == iPrevLineEnd), inlineLC.isFirstArea()); MinOptMax bpDim = MinOptMax.add(bp.getStackingSize(), prevIPD); @@ -206,7 +206,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { // This break position doesn't fit // TODO: If we are in nowrap, we use it as is! - if (bTextAlignment == TextAlign.JUSTIFY || m_prevBP == null) { + if (bTextAlignment == TextAlign.JUSTIFY || prevBP == null) { // If we are already in a hyphenation loop, then stop. if (inlineLC.tryHyphenate()) { @@ -215,12 +215,12 @@ public class LineLayoutManager extends InlineStackingLayoutManager { // Otherwise, prepare to try hyphenation if (!bBreakOK) { // Make sure we collect the entire word! - m_vecInlineBreaks.add(bp); + vecInlineBreaks.add(bp); continue; } inlineLC.setHyphContext( - getHyphenContext(m_prevBP, bp)); + getHyphenContext(prevBP, bp)); if (inlineLC.getHyphContext() == null) break; inlineLC.setFlags(LayoutContext.TRY_HYPHENATE, @@ -236,10 +236,10 @@ public class LineLayoutManager extends InlineStackingLayoutManager { } } else { // Add the BP to the list whether or not we can break - m_vecInlineBreaks.add(bp); + vecInlineBreaks.add(bp); // Handle end of this LM's areas if (bBreakOK) { - m_prevBP = bp; // Save reference to this BP + prevBP = bp; // Save reference to this BP if (bp.isForcedBreak()) { break; } @@ -279,22 +279,22 @@ public class LineLayoutManager extends InlineStackingLayoutManager { if (bp == null) return null; - if (m_prevBP == null) - m_prevBP = bp; + if (prevBP == null) + prevBP = bp; // Choose the best break if (!bp.isForcedBreak() && vecPossEnd.size() > 0) { - m_prevBP = getBestBP(vecPossEnd); + prevBP = getBestBP(vecPossEnd); } // Backup child LM if necessary - if (bp != m_prevBP && !bp.couldEndLine()) { + if (bp != prevBP && !bp.couldEndLine()) { reset(); } // Don't justify last line in the sequence or if forced line-end int talign = bTextAlignment; if ((bTextAlignment == TextAlign.JUSTIFY - && (m_prevBP.isForcedBreak() + && (prevBP.isForcedBreak() || isFinished()))) { talign = TextAlign.START; } @@ -303,10 +303,10 @@ public class LineLayoutManager extends InlineStackingLayoutManager { private void reset() { - while (m_vecInlineBreaks.get(m_vecInlineBreaks.size() - 1) != m_prevBP) { - m_vecInlineBreaks.remove(m_vecInlineBreaks.size() - 1); + while (vecInlineBreaks.get(vecInlineBreaks.size() - 1) != prevBP) { + vecInlineBreaks.remove(vecInlineBreaks.size() - 1); } - reset(m_prevBP.getPosition()); + reset(prevBP.getPosition()); } protected boolean couldEndLine(BreakPoss bp) { @@ -354,34 +354,34 @@ public class LineLayoutManager extends InlineStackingLayoutManager { return true; } - private HyphContext getHyphenContext(BreakPoss prevBP, + private HyphContext getHyphenContext(BreakPoss prev, BreakPoss newBP) { // Get a "word" to hyphenate by getting characters from all - // pending break poss which are in m_vecInlineBreaks, starting - // with the position just AFTER prevBP.getPosition() + // pending break poss which are in vecInlineBreaks, starting + // with the position just AFTER prev.getPosition() - m_vecInlineBreaks.add(newBP); + vecInlineBreaks.add(newBP); ListIterator bpIter = - m_vecInlineBreaks. listIterator(m_vecInlineBreaks.size()); - while (bpIter.hasPrevious() && bpIter.previous() != prevBP) - ; - if (bpIter.next() != prevBP) { + vecInlineBreaks. listIterator(vecInlineBreaks.size()); + while (bpIter.hasPrevious() && bpIter.previous() != prev) { + } + if (bpIter.next() != prev) { //log.error("findHyphenPoss: problem!"); return null; } StringBuffer sbChars = new StringBuffer(30); while (bpIter.hasNext()) { BreakPoss bp = (BreakPoss) bpIter.next(); - if (bp.getLayoutManager() == prevBP.getLayoutManager()) { + if (bp.getLayoutManager() == prev.getLayoutManager()) { bp.getLayoutManager().getWordChars(sbChars, - prevBP.getPosition(), bp.getPosition()); + prev.getPosition(), bp.getPosition()); } else { bp.getLayoutManager().getWordChars(sbChars, null, bp.getPosition()); } - prevBP = bp; + prev = bp; } - m_vecInlineBreaks.remove(m_vecInlineBreaks.size() - 1); // remove last + vecInlineBreaks.remove(vecInlineBreaks.size() - 1); // remove last //log.debug("Word to hyphenate: " + sbChars.toString()); // Now find all hyphenation points in this word (get in an array of offsets) @@ -393,12 +393,12 @@ public class LineLayoutManager extends InlineStackingLayoutManager { // TextLM which generate the hyphenation buffer, since these properties // inherit and could be specified on an inline or wrapper below the block // level. - Hyphenation hyph = Hyphenator.hyphenate(m_hyphProps.language, - m_hyphProps.country, sbChars.toString(), - m_hyphProps.hyphenationRemainCharacterCount, - m_hyphProps.hyphenationPushCharacterCount); + Hyphenation hyph = Hyphenator.hyphenate(hyphProps.language, + hyphProps.country, sbChars.toString(), + hyphProps.hyphenationRemainCharacterCount, + hyphProps.hyphenationPushCharacterCount); // They hyph structure contains the information we need - // Now start from prevBP: reset to that position, ask that LM to get + // Now start from prev: reset to that position, ask that LM to get // a Position for the first hyphenation offset. If the offset isn't in // its characters, it returns null, but must tell how many chars it had. // Keep looking at currentBP using next hyphenation point until the @@ -442,7 +442,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { MinOptMax actual = new MinOptMax(); BreakPoss lastBP = null; LayoutManager lastLM = null; - for(Iterator iter = m_vecInlineBreaks.listIterator(prevLineEnd); + for(Iterator iter = vecInlineBreaks.listIterator(prevLineEnd); iter.hasNext(); ) { BreakPoss bp = (BreakPoss)iter.next(); if (bp.getLead() > lineLead) { @@ -530,7 +530,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { LineBreakPosition lbp; lbp = new LineBreakPosition(this, - m_vecInlineBreaks.size() - 1, + vecInlineBreaks.size() - 1, ipdAdjust, dAdjust, indent, lineLead + middlefollow, lineLead); BreakPoss curLineBP = new BreakPoss(lbp); @@ -549,15 +549,15 @@ public class LineLayoutManager extends InlineStackingLayoutManager { if (resetPos == null) { iStartPos = 0; reset(null); - m_vecInlineBreaks.clear(); - m_prevBP = null; + vecInlineBreaks.clear(); + prevBP = null; } else { - m_prevBP = (BreakPoss)m_vecInlineBreaks.get(((LineBreakPosition)resetPos).getLeafPos()); - while (m_vecInlineBreaks.get(m_vecInlineBreaks.size() - 1) != m_prevBP) + prevBP = (BreakPoss)vecInlineBreaks.get(((LineBreakPosition)resetPos).getLeafPos()); + while (vecInlineBreaks.get(vecInlineBreaks.size() - 1) != prevBP) { - m_vecInlineBreaks.remove(m_vecInlineBreaks.size() - 1); + vecInlineBreaks.remove(vecInlineBreaks.size() - 1); } - reset(m_prevBP.getPosition()); + reset(prevBP.getPosition()); } } @@ -571,8 +571,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager { LayoutContext context) { addAreas(parentIter, 0.0); - //m_vecInlineBreaks.clear(); - m_prevBP = null; + //vecInlineBreaks.clear(); + prevBP = null; } // Generate and add areas to parent area @@ -598,10 +598,10 @@ public class LineLayoutManager extends InlineStackingLayoutManager { setCurrentArea(lineArea); // Add the inline areas to lineArea PositionIterator inlinePosIter = - new BreakPossPosIter(m_vecInlineBreaks, iStartPos, + new BreakPossPosIter(vecInlineBreaks, iStartPos, lbp.getLeafPos() + 1); iStartPos = lbp.getLeafPos() + 1; - lc.setSpaceAdjust(lbp.m_dAdjust); + lc.setSpaceAdjust(lbp.dAdjust); lc.setIPDAdjust(lbp.ipdAdjust); lc.setLeadingSpace(new SpaceSpecifier(true)); lc.setFlags(LayoutContext.RESOLVE_LEADING_SPACE, true); diff --git a/src/org/apache/fop/layoutmgr/NonLeafPosition.java b/src/org/apache/fop/layoutmgr/NonLeafPosition.java index 38ed0e227..6b91c940e 100644 --- a/src/org/apache/fop/layoutmgr/NonLeafPosition.java +++ b/src/org/apache/fop/layoutmgr/NonLeafPosition.java @@ -9,15 +9,15 @@ package org.apache.fop.layoutmgr; public class NonLeafPosition extends Position { - private Position m_subPos ; + private Position subPos; - public NonLeafPosition(LayoutManager lm, Position subPos) { + public NonLeafPosition(LayoutManager lm, Position sub) { super(lm); - m_subPos = subPos; + subPos = sub; } public Position getPosition() { - return m_subPos; + return subPos; } } diff --git a/src/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/org/apache/fop/layoutmgr/PageLayoutManager.java index dcb73e4c7..6f1c1a8b8 100644 --- a/src/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -293,16 +293,15 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable * * @param childArea the child area to add */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (childArea == null) { - return false; + return; } if (childArea.getAreaClass() == Area.CLASS_NORMAL) { placeFlowRefArea(childArea); } else { ; // todo: all the others! } - return false; } /** @@ -399,7 +398,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable while (!lm.isFinished()) { BreakPoss bp = lm.getNextBreakPoss(childLC); if (bp != null) { - ArrayList vecBreakPoss = new ArrayList(); + List vecBreakPoss = new ArrayList(); vecBreakPoss.add(bp); lm.addAreas(new BreakPossPosIter(vecBreakPoss, 0, vecBreakPoss.size()), null); @@ -614,9 +613,8 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable } // See finishPage... - protected boolean flush() { + protected void flush() { finishPage(); - return false; } } diff --git a/src/org/apache/fop/layoutmgr/Position.java b/src/org/apache/fop/layoutmgr/Position.java index 35b173b91..0eee55ee1 100644 --- a/src/org/apache/fop/layoutmgr/Position.java +++ b/src/org/apache/fop/layoutmgr/Position.java @@ -8,14 +8,14 @@ package org.apache.fop.layoutmgr; public class Position { - private LayoutManager m_lm; + private LayoutManager layoutManager; public Position(LayoutManager lm) { - m_lm = lm; + layoutManager = lm; } public LayoutManager getLM() { - return m_lm; + return layoutManager; } /** diff --git a/src/org/apache/fop/layoutmgr/PositionIterator.java b/src/org/apache/fop/layoutmgr/PositionIterator.java index 5032f50a4..2c014b23e 100644 --- a/src/org/apache/fop/layoutmgr/PositionIterator.java +++ b/src/org/apache/fop/layoutmgr/PositionIterator.java @@ -12,24 +12,24 @@ import java.util.Iterator; import java.util.NoSuchElementException; public abstract class PositionIterator implements Iterator { - Iterator m_parentIter; - Object m_nextObj; - LayoutManager m_childLM; - boolean m_bHasNext; + Iterator parentIter; + Object nextObj; + LayoutManager childLM; + boolean bHasNext; - PositionIterator(Iterator parentIter) { - m_parentIter = parentIter; + PositionIterator(Iterator pIter) { + parentIter = pIter; lookAhead(); //checkNext(); } public LayoutManager getNextChildLM() { // Move to next "segment" of iterator, ie: new childLM - if (m_childLM == null && m_nextObj != null) { - m_childLM = getLM(m_nextObj); - m_bHasNext = true; + if (childLM == null && nextObj != null) { + childLM = getLM(nextObj); + bHasNext = true; } - return m_childLM; + return childLM; } protected abstract LayoutManager getLM(Object nextObj); @@ -37,41 +37,41 @@ public abstract class PositionIterator implements Iterator { protected abstract Position getPos(Object nextObj); private void lookAhead() { - if (m_parentIter.hasNext()) { - m_bHasNext = true; - m_nextObj = m_parentIter.next(); + if (parentIter.hasNext()) { + bHasNext = true; + nextObj = parentIter.next(); } else { endIter(); } } protected boolean checkNext() { - LayoutManager lm = getLM(m_nextObj); - if (m_childLM == null) { - m_childLM = lm; - } else if (m_childLM != lm) { + LayoutManager lm = getLM(nextObj); + if (childLM == null) { + childLM = lm; + } else if (childLM != lm) { // End of this sub-sequence with same child LM - m_bHasNext = false; - m_childLM = null; + bHasNext = false; + childLM = null; return false; } return true; } protected void endIter() { - m_bHasNext = false; - m_nextObj = null; - m_childLM = null; + bHasNext = false; + nextObj = null; + childLM = null; } public boolean hasNext() { - return (m_bHasNext && checkNext()); + return (bHasNext && checkNext()); } public Object next() throws NoSuchElementException { - if (m_bHasNext) { - Object retObj = getPos(m_nextObj); + if (bHasNext) { + Object retObj = getPos(nextObj); lookAhead(); return retObj; } else { @@ -80,7 +80,7 @@ public abstract class PositionIterator implements Iterator { } protected Object peekNext() { - return m_nextObj; + return nextObj; } public void remove() throws UnsupportedOperationException { diff --git a/src/org/apache/fop/layoutmgr/SpaceSpecifier.java b/src/org/apache/fop/layoutmgr/SpaceSpecifier.java index 676611f1f..a454f2f01 100644 --- a/src/org/apache/fop/layoutmgr/SpaceSpecifier.java +++ b/src/org/apache/fop/layoutmgr/SpaceSpecifier.java @@ -10,6 +10,7 @@ package org.apache.fop.layoutmgr; import org.apache.fop.area.MinOptMax; import org.apache.fop.traits.SpaceVal; import java.util.ArrayList; +import java.util.List; /** * Accumulate a sequence of space-specifiers (XSL space type) on @@ -19,21 +20,21 @@ import java.util.ArrayList; public class SpaceSpecifier implements Cloneable { - private boolean m_bStartsRefArea; - private boolean m_bHasForcing = false; - private ArrayList m_vecSpaceVals = new ArrayList(); + private boolean bStartsRefArea; + private boolean bHasForcing = false; + private List vecSpaceVals = new ArrayList(); - public SpaceSpecifier(boolean bStartsRefArea) { - m_bStartsRefArea = bStartsRefArea; + public SpaceSpecifier(boolean bStarts) { + bStartsRefArea = bStarts; } public Object clone() { try { SpaceSpecifier ss = (SpaceSpecifier) super.clone(); // Clone the vector, but share the objects in it! - ss.m_vecSpaceVals = new ArrayList(); - ss.m_vecSpaceVals.addAll(this.m_vecSpaceVals); + ss.vecSpaceVals = new ArrayList(); + ss.vecSpaceVals.addAll(this.vecSpaceVals); return ss; } catch (CloneNotSupportedException cnse) { return null; @@ -45,14 +46,14 @@ public class SpaceSpecifier implements Cloneable { * Clear all space specifiers */ public void clear() { - m_bHasForcing = false; - m_vecSpaceVals.clear(); + bHasForcing = false; + vecSpaceVals.clear(); } /** Return true if any space-specifiers have been added. */ public boolean hasSpaces() { - return (m_vecSpaceVals.size() > 0); + return (vecSpaceVals.size() > 0); } /** @@ -62,20 +63,20 @@ public class SpaceSpecifier implements Cloneable { * add it to the sequence. */ public void addSpace(SpaceVal moreSpace) { - if (!m_bStartsRefArea || !moreSpace.bConditional || - !m_vecSpaceVals.isEmpty()) { + if (!bStartsRefArea || !moreSpace.bConditional || + !vecSpaceVals.isEmpty()) { if (moreSpace.bForcing) { - if (m_bHasForcing == false) { + if (bHasForcing == false) { // Remove all other values (must all be non-forcing) - m_vecSpaceVals.clear(); - m_bHasForcing = true; + vecSpaceVals.clear(); + bHasForcing = true; } - m_vecSpaceVals.add(moreSpace); - } else if (m_bHasForcing == false) { + vecSpaceVals.add(moreSpace); + } else if (bHasForcing == false) { // Don't bother adding all 0 space-specifier if not forcing if (moreSpace.space.min != 0 || moreSpace.space.opt != 0 || moreSpace.space.max != 0) { - m_vecSpaceVals.add(moreSpace); + vecSpaceVals.add(moreSpace); } } } @@ -90,12 +91,12 @@ public class SpaceSpecifier implements Cloneable { * @return The resolved value as a min/opt/max triple. */ public MinOptMax resolve(boolean bEndsReferenceArea) { - int lastIndex = m_vecSpaceVals.size(); + int lastIndex = vecSpaceVals.size(); if (bEndsReferenceArea) { // Start from the end and count conditional specifiers // Stop at first non-conditional for (; lastIndex > 0; --lastIndex) { - SpaceVal sval = (SpaceVal) m_vecSpaceVals.get( + SpaceVal sval = (SpaceVal) vecSpaceVals.get( lastIndex - 1); if (!sval.bConditional) { break; @@ -105,8 +106,8 @@ public class SpaceSpecifier implements Cloneable { MinOptMax resSpace = new MinOptMax(0); int iMaxPrec = -1; for (int index = 0; index < lastIndex; index++) { - SpaceVal sval = (SpaceVal) m_vecSpaceVals.get(index); - if (m_bHasForcing) { + SpaceVal sval = (SpaceVal) vecSpaceVals.get(index); + if (bHasForcing) { resSpace.add(sval.space); } else if (sval.iPrecedence > iMaxPrec) { iMaxPrec = sval.iPrecedence; diff --git a/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java index b4c673e74..280d2ef8a 100644 --- a/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java @@ -13,6 +13,7 @@ import org.apache.fop.area.Area; import org.apache.fop.area.Block; import java.util.ArrayList; +import java.util.List; /** * LayoutManager for an fo:flow object. @@ -23,7 +24,7 @@ import java.util.ArrayList; public class StaticContentLayoutManager extends BlockStackingLayoutManager { private RegionReference region; - private ArrayList blockBreaks = new ArrayList(); + private List blockBreaks = new ArrayList(); public StaticContentLayoutManager(FObj fobj) { super(fobj); @@ -88,9 +89,8 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { * area class. A Flow can fill at most one area container of any class * at any one time. The actual work is done by BlockStackingLM. */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { region.addBlock((Block)childArea); - return true; } public Area getParentArea(Area childArea) { diff --git a/src/org/apache/fop/layoutmgr/TextLayoutManager.java b/src/org/apache/fop/layoutmgr/TextLayoutManager.java index 967e24ef5..f3fdc9ae2 100644 --- a/src/org/apache/fop/layoutmgr/TextLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/TextLayoutManager.java @@ -23,6 +23,7 @@ import org.apache.fop.fo.properties.VerticalAlign; //import org.apache.fop.fo.properties.*; import java.util.ArrayList; +import java.util.List; /** * LayoutManager for text (a sequence of characters) which generates one @@ -37,22 +38,22 @@ public class TextLayoutManager extends AbstractLayoutManager { * Number of word-spaces? */ private class AreaInfo { - short m_iStartIndex; - short m_iBreakIndex; - short m_iWScount; - MinOptMax m_ipdArea; - AreaInfo(short iStartIndex, short iBreakIndex, short iWScount, - MinOptMax ipdArea) { - m_iStartIndex = iStartIndex; - m_iBreakIndex = iBreakIndex; - m_iWScount = iWScount; - m_ipdArea = ipdArea; + short iStartIndex; + short iBreakIndex; + short iWScount; + MinOptMax ipdArea; + AreaInfo(short iSIndex, short iBIndex, short iWS, + MinOptMax ipd) { + iStartIndex = iSIndex; + iBreakIndex = iBIndex; + iWScount = iWS; + ipdArea = ipd; } } // Hold all possible breaks for the text in this LM's FO. - private ArrayList m_vecAreaInfo; + private ArrayList vecAreaInfo; /** Non-space characters on which we can end a line. */ private static final String s_breakChars = "-/" ; @@ -69,21 +70,21 @@ public class TextLayoutManager extends AbstractLayoutManager { private static final char ZERO_WIDTH_NOBREAK_SPACE = '\uFEFF'; /** Start index of first character in this parent Area */ - private short m_iAreaStart = 0; + private short iAreaStart = 0; /** Start index of next "word" */ - private short m_iNextStart = 0; + private short iNextStart = 0; /** Size since last makeArea call, except for last break */ - private MinOptMax m_ipdTotal ; + private MinOptMax ipdTotal; /** Size including last break possibility returned */ - // private MinOptMax m_nextIPD= new MinOptMax(0); + // private MinOptMax nextIPD = new MinOptMax(0); /** size of a space character (U+0020) glyph in current font */ - private int m_spaceIPD; + private int spaceCharIPD; /** size of the hyphen character glyph in current font */ - private int m_hyphIPD; + private int hyphIPD; /** 1/2 of word-spacing value */ - private SpaceVal m_halfWS; + private SpaceVal halfWS; /** Number of space characters after previous possible break position. */ - private int m_iNbSpacesPending; + private int iNbSpacesPending; /** * Create a Text layout manager. @@ -96,15 +97,15 @@ public class TextLayoutManager extends AbstractLayoutManager { super(fobj); this.chars = chars; this.textInfo = textInfo; - this.m_vecAreaInfo = new ArrayList(); + this.vecAreaInfo = new ArrayList(); // With CID fonts, space isn't neccesary currentFontState.width(32) - m_spaceIPD = CharUtilities.getCharWidth(' ', textInfo.fs); + spaceCharIPD = CharUtilities.getCharWidth(' ', textInfo.fs); // Use hyphenationChar property - m_hyphIPD = CharUtilities.getCharWidth('-', textInfo.fs); + hyphIPD = CharUtilities.getCharWidth('-', textInfo.fs); // Make half-space: <space> on either side of a word-space) SpaceVal ws = textInfo.wordSpacing; - m_halfWS = new SpaceVal(MinOptMax.multiply(ws.space, 0.5), + halfWS = new SpaceVal(MinOptMax.multiply(ws.space, 0.5), ws.bConditional, ws.bForcing, ws.iPrecedence); } @@ -129,13 +130,13 @@ public class TextLayoutManager extends AbstractLayoutManager { Position bp2) { LeafPosition endPos = (LeafPosition) bp2; AreaInfo ai = - (AreaInfo) m_vecAreaInfo.get(endPos.getLeafPos()); + (AreaInfo) vecAreaInfo.get(endPos.getLeafPos()); // Skip all leading spaces for hyphenation int i; - for (i = ai.m_iStartIndex; i < ai.m_iBreakIndex && + for (i = ai.iStartIndex; i < ai.iBreakIndex && CharUtilities.isAnySpace(chars[i]) == true ; i++) ; - sbChars.append(new String(chars, i, ai.m_iBreakIndex - i)); + sbChars.append(new String(chars, i, ai.iBreakIndex - i)); } /** @@ -148,7 +149,7 @@ public class TextLayoutManager extends AbstractLayoutManager { * @return true if can break before this text */ public boolean canBreakBefore(LayoutContext context) { - char c = chars[m_iNextStart]; + char c = chars[iNextStart]; return ((c == NEWLINE) || (textInfo.bWrap && (CharUtilities.isSpace(c) || s_breakChars.indexOf(c) >= 0))); @@ -168,19 +169,19 @@ public class TextLayoutManager extends AbstractLayoutManager { } LeafPosition tbp = (LeafPosition) prevPos; AreaInfo ai = - (AreaInfo) m_vecAreaInfo.get(tbp.getLeafPos()); - if (ai.m_iBreakIndex != m_iNextStart) { - m_iNextStart = ai.m_iBreakIndex; - m_vecAreaInfo.ensureCapacity(tbp.getLeafPos() + 1); + (AreaInfo) vecAreaInfo.get(tbp.getLeafPos()); + if (ai.iBreakIndex != iNextStart) { + iNextStart = ai.iBreakIndex; + vecAreaInfo.ensureCapacity(tbp.getLeafPos() + 1); // TODO: reset or recalculate total IPD = sum of all word IPD // up to the break position - m_ipdTotal = ai.m_ipdArea; + ipdTotal = ai.ipdArea; setFinished(false); } } else { // Reset to beginning! - m_vecAreaInfo.clear(); - m_iNextStart = 0; + vecAreaInfo.clear(); + iNextStart = 0; setFinished(false); } } @@ -190,16 +191,16 @@ public class TextLayoutManager extends AbstractLayoutManager { private boolean getHyphenIPD(HyphContext hc, MinOptMax hyphIPD) { // Skip leading word-space before calculating count? boolean bCanHyphenate = true; - int iStopIndex = m_iNextStart + hc.getNextHyphPoint(); + int iStopIndex = iNextStart + hc.getNextHyphPoint(); if (chars.length < iStopIndex || textInfo.bCanHyphenate == false) { iStopIndex = chars.length; bCanHyphenate = false; } - hc.updateOffset(iStopIndex - m_iNextStart); + hc.updateOffset(iStopIndex - iNextStart); - for (; m_iNextStart < iStopIndex; m_iNextStart++) { - char c = chars[m_iNextStart]; + for (; iNextStart < iStopIndex; iNextStart++) { + char c = chars[iNextStart]; hyphIPD.opt += CharUtilities.getCharWidth(c, textInfo.fs); // letter-space? } @@ -235,7 +236,7 @@ public class TextLayoutManager extends AbstractLayoutManager { /* This could be first call on this LM, or the first call * in a new (possible) LineArea. */ - m_ipdTotal = new MinOptMax(0); + ipdTotal = new MinOptMax(0); iFlags |= BreakPoss.ISFIRST; } @@ -248,11 +249,11 @@ public class TextLayoutManager extends AbstractLayoutManager { * retained. */ if (context.suppressLeadingSpace()) { - for (; m_iNextStart < chars.length && - chars[m_iNextStart] == SPACE; m_iNextStart++) - ; + for (; iNextStart < chars.length + && chars[iNextStart] == SPACE; iNextStart++) { + } // If now at end, nothing to compose here! - if (m_iNextStart >= chars.length) { + if (iNextStart >= chars.length) { setFinished(true); return null; // Or an "empty" BreakPoss? } @@ -266,37 +267,37 @@ public class TextLayoutManager extends AbstractLayoutManager { */ SpaceSpecifier pendingSpace = new SpaceSpecifier(false); - short iThisStart = m_iNextStart; // Index of first character counted + short iThisStart = iNextStart; // Index of first character counted MinOptMax spaceIPD = new MinOptMax(0); // Extra IPD from word-spacing // Sum of glyph IPD of all characters in a word, inc. leading space int wordIPD = 0; short iWScount = 0; // Count of word spaces boolean bSawNonSuppressible = false; - for (; m_iNextStart < chars.length; m_iNextStart++) { - char c = chars[m_iNextStart]; + for (; iNextStart < chars.length; iNextStart++) { + char c = chars[iNextStart]; if (CharUtilities.isAnySpace(c) == false) break; if (c == SPACE || c == NBSPACE) { ++iWScount; // Counted as word-space - if (m_iNextStart == iThisStart && + if (iNextStart == iThisStart && (iFlags & BreakPoss.ISFIRST) != 0) { // If possible, treat as normal inter-word space if (context.getLeadingSpace().hasSpaces()) { - context.getLeadingSpace().addSpace(m_halfWS); + context.getLeadingSpace().addSpace(halfWS); } else { // Doesn't combine with any other leading spaces // from ancestors - spaceIPD.add(m_halfWS.space); + spaceIPD.add(halfWS.space); } } else { - pendingSpace.addSpace(m_halfWS); + pendingSpace.addSpace(halfWS); spaceIPD.add(pendingSpace.resolve(false)); } - wordIPD += m_spaceIPD; // Space glyph IPD + wordIPD += spaceCharIPD; // Space glyph IPD pendingSpace.clear(); - pendingSpace.addSpace(m_halfWS); + pendingSpace.addSpace(halfWS); if (c == NBSPACE) { bSawNonSuppressible = true; } @@ -310,7 +311,7 @@ public class TextLayoutManager extends AbstractLayoutManager { } } - if (m_iNextStart < chars.length) { + if (iNextStart < chars.length) { spaceIPD.add(pendingSpace.resolve(false)); } else { // This FO ended with spaces. Return the BP @@ -334,15 +335,15 @@ public class TextLayoutManager extends AbstractLayoutManager { // Look for a legal line-break: breakable white-space and certain // characters such as '-' which can serve as word breaks. // Don't look for hyphenation points here though - for (; m_iNextStart < chars.length; m_iNextStart++) { - char c = chars[m_iNextStart]; + for (; iNextStart < chars.length; iNextStart++) { + char c = chars[iNextStart]; if ((c == NEWLINE) || // Include any breakable white-space as break char // even if fixed width (textInfo.bWrap && (CharUtilities.isSpace(c) || s_breakChars.indexOf(c) >= 0))) { iFlags |= BreakPoss.CAN_BREAK_AFTER; if (c != SPACE) { - m_iNextStart++; + iNextStart++; if (c != NEWLINE) { wordIPD += CharUtilities.getCharWidth(c, textInfo.fs); @@ -353,7 +354,7 @@ public class TextLayoutManager extends AbstractLayoutManager { // If all remaining characters would be suppressed at // line-end, set a flag for parent LM. int iLastChar; - for (iLastChar = m_iNextStart; + for (iLastChar = iNextStart; iLastChar < chars.length && chars[iLastChar] == SPACE; iLastChar++) ; @@ -379,21 +380,21 @@ public class TextLayoutManager extends AbstractLayoutManager { int flags, short iWScount) { MinOptMax ipd = new MinOptMax(wordDim); ipd.add(spaceIPD); - if (m_ipdTotal != null) { - ipd.add(m_ipdTotal); // sum of all words so far in line + if (ipdTotal != null) { + ipd.add(ipdTotal); // sum of all words so far in line } // Note: break position now stores total size to here // Position is the index of the info for this word in the vector - m_vecAreaInfo.add( - new AreaInfo(iWordStart, m_iNextStart, iWScount, ipd)); + vecAreaInfo.add( + new AreaInfo(iWordStart, iNextStart, iWScount, ipd)); BreakPoss bp = new BreakPoss( - new LeafPosition(this, m_vecAreaInfo.size() - 1)); - m_ipdTotal = ipd; + new LeafPosition(this, vecAreaInfo.size() - 1)); + ipdTotal = ipd; if ((flags & BreakPoss.HYPHENATED) != 0) { // Add the hyphen size, but don't change total IPD! bp.setStackingSize( - MinOptMax.add(ipd, new MinOptMax(m_hyphIPD))); + MinOptMax.add(ipd, new MinOptMax(hyphIPD))); } else { bp.setStackingSize(ipd); } @@ -406,7 +407,7 @@ public class TextLayoutManager extends AbstractLayoutManager { */ //bp.setDescender(textInfo.fs.getDescender()); //bp.setAscender(textInfo.fs.getAscender()); - if (m_iNextStart == chars.length) { + if (iNextStart == chars.length) { flags |= BreakPoss.ISLAST; setFinished(true); } @@ -447,11 +448,11 @@ public class TextLayoutManager extends AbstractLayoutManager { */ while (posIter.hasNext()) { LeafPosition tbpNext = (LeafPosition) posIter.next(); - ai = (AreaInfo) m_vecAreaInfo.get(tbpNext.getLeafPos()); + ai = (AreaInfo) vecAreaInfo.get(tbpNext.getLeafPos()); if (iStart == -1) { - iStart = ai.m_iStartIndex; + iStart = ai.iStartIndex; } - iWScount += ai.m_iWScount; + iWScount += ai.iWScount; } if(ai == null) { return; @@ -462,15 +463,15 @@ public class TextLayoutManager extends AbstractLayoutManager { if (dSpaceAdjust > 0.0) { // Stretch by factor // System.err.println("Potential stretch = " + - // (ai.m_ipdArea.max - ai.m_ipdArea.opt)); - iAdjust = (int)((double)(ai.m_ipdArea.max - - ai.m_ipdArea.opt) * dSpaceAdjust); + // (ai.ipdArea.max - ai.ipdArea.opt)); + iAdjust = (int)((double)(ai.ipdArea.max - + ai.ipdArea.opt) * dSpaceAdjust); } else if (dSpaceAdjust < 0.0) { // Shrink by factor // System.err.println("Potential shrink = " + - // (ai.m_ipdArea.opt - ai.m_ipdArea.min)); - iAdjust = (int)((double)(ai.m_ipdArea.opt - - ai.m_ipdArea.min) * dSpaceAdjust); + // (ai.ipdArea.opt - ai.ipdArea.min)); + iAdjust = (int)((double)(ai.ipdArea.opt - + ai.ipdArea.min) * dSpaceAdjust); } // System.err.println("Text adjustment factor = " + dSpaceAdjust + // " total=" + iAdjust); @@ -479,14 +480,14 @@ public class TextLayoutManager extends AbstractLayoutManager { Word word = null; int adjust = 0; // ingnore newline character - if(chars[ai.m_iBreakIndex - 1] == NEWLINE) { + if(chars[ai.iBreakIndex - 1] == NEWLINE) { adjust = 1; } - String str = new String(chars, iStart, ai.m_iBreakIndex - iStart - adjust); + String str = new String(chars, iStart, ai.iBreakIndex - iStart - adjust); //if(!"".equals(str.trim())) { word = createWord( str, - ai.m_ipdArea.opt + iAdjust, context.getBaseline()); + ai.ipdArea.opt + iAdjust, context.getBaseline()); if (iWScount > 0) { //log.error("Adjustment per word-space= " + // iAdjust / iWScount); @@ -495,11 +496,11 @@ public class TextLayoutManager extends AbstractLayoutManager { //} if ((chars[iStart] == SPACE || chars[iStart] == NBSPACE) && context.getLeadingSpace().hasSpaces()) { - context.getLeadingSpace().addSpace(m_halfWS); + context.getLeadingSpace().addSpace(halfWS); } // Set LAST flag if done making characters int iLastChar; - for (iLastChar = ai.m_iBreakIndex; + for (iLastChar = ai.iBreakIndex; iLastChar < chars.length && chars[iLastChar] == SPACE; iLastChar++) ; @@ -508,9 +509,9 @@ public class TextLayoutManager extends AbstractLayoutManager { // Can we have any trailing space? Yes, if last char was a space! context.setTrailingSpace(new SpaceSpecifier(false)); - if (chars[ai.m_iBreakIndex - 1] == SPACE || - chars[ai.m_iBreakIndex - 1] == NBSPACE) { - context.getTrailingSpace().addSpace(m_halfWS); + if (chars[ai.iBreakIndex - 1] == SPACE || + chars[ai.iBreakIndex - 1] == NBSPACE) { + context.getTrailingSpace().addSpace(halfWS); } if(word != null) { parentLM.addChild(word); diff --git a/src/org/apache/fop/layoutmgr/list/Item.java b/src/org/apache/fop/layoutmgr/list/Item.java index 0157a0227..579c08491 100644 --- a/src/org/apache/fop/layoutmgr/list/Item.java +++ b/src/org/apache/fop/layoutmgr/list/Item.java @@ -24,6 +24,7 @@ import org.apache.fop.layout.BorderAndPadding; import org.apache.fop.layout.BackgroundProps; import java.util.ArrayList; +import java.util.List; /** * LayoutManager for a table-cell FO. @@ -36,7 +37,7 @@ public class Item extends BlockStackingLayoutManager { private Block curBlockArea; - private ArrayList childBreaks = new ArrayList(); + private List childBreaks = new ArrayList(); private int xoffset; private int itemIPD; @@ -205,12 +206,10 @@ public class Item extends BlockStackingLayoutManager { * @param childArea the child to add to the cell * @return unused */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (curBlockArea != null) { curBlockArea.addBlock((Block) childArea); - return false; } - return false; } /** diff --git a/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java index 6965e08b2..36bb832f0 100644 --- a/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java @@ -27,22 +27,17 @@ import java.util.ArrayList; import java.util.List; /** - * LayoutManager for a table FO. - * A table consists of columns, table header, table footer and multiple - * table bodies. - * The header, footer and body add the areas created from the table cells. - * The table then creates areas for the columns, bodies and rows - * the render background. + * LayoutManager for a list-block FO. + * A list block contains list items which are stacked within + * the list block area.. */ public class ListBlockLayoutManager extends BlockStackingLayoutManager { - private List columns = null; - private BorderAndPadding borderProps = null; private BackgroundProps backgroundProps; private Block curBlockArea; - private ArrayList bodyBreaks = new ArrayList(); + private List bodyBreaks = new ArrayList(); private class SectionPosition extends LeafPosition { protected List list; @@ -75,14 +70,14 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { * @return the next break possibility */ public BreakPoss getNextBreakPoss(LayoutContext context) { - ListItemLayoutManager curLM; // currently active LM + LayoutManager curLM; // currently active LM MinOptMax stackSize = new MinOptMax(); // if starting add space before // stackSize.add(spaceBefore); BreakPoss lastPos = null; - while ((curLM = (ListItemLayoutManager)getChildLM()) != null) { + while ((curLM = (LayoutManager)getChildLM()) != null) { // Make break positions // Set up a LayoutContext int ipd = context.getRefIPD(); @@ -138,7 +133,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { int listHeight = 0; - ListItemLayoutManager childLM; + LayoutManager childLM; int iStartPos = 0; LayoutContext lc = new LayoutContext(0); while (parentIter.hasNext()) { @@ -148,16 +143,11 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { new BreakPossPosIter(bodyBreaks, iStartPos, lfp.getLeafPos() + 1); iStartPos = lfp.getLeafPos() + 1; - while ((childLM = (ListItemLayoutManager)breakPosIter.getNextChildLM()) != null) { + while ((childLM = (LayoutManager)breakPosIter.getNextChildLM()) != null) { childLM.addAreas(breakPosIter, lc); - listHeight += childLM.getListItemHeight(); } } - // add footer areas - - curBlockArea.setHeight(listHeight); - if(borderProps != null) { addBorders(curBlockArea, borderProps); } @@ -204,13 +194,10 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { * @param childArea the child area to add * @return unused */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (curBlockArea != null) { - curBlockArea.addBlock((Block) childArea); - - return false; + curBlockArea.addBlock((Block) childArea); } - return false; } /** @@ -220,6 +207,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { */ public void resetPosition(Position resetPos) { if (resetPos == null) { + bodyBreaks.clear(); reset(null); } } diff --git a/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java index a4422d7cd..dbff104dc 100644 --- a/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java @@ -85,7 +85,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { Item curLM; // currently active LM BreakPoss lastPos = null; - ArrayList breakList = new ArrayList(); + List breakList = new ArrayList(); int min = 0; int opt = 0; @@ -100,7 +100,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { } else { break; } - ArrayList childBreaks = new ArrayList(); + List childBreaks = new ArrayList(); MinOptMax stackSize = new MinOptMax(); // Set up a LayoutContext @@ -248,12 +248,10 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { * @param childArea the child area * @return unused */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (curBlockArea != null) { curBlockArea.addBlock((Block) childArea); - return false; } - return false; } /** diff --git a/src/org/apache/fop/layoutmgr/table/Body.java b/src/org/apache/fop/layoutmgr/table/Body.java index e80ad30a6..7ca0079d3 100644 --- a/src/org/apache/fop/layoutmgr/table/Body.java +++ b/src/org/apache/fop/layoutmgr/table/Body.java @@ -42,7 +42,7 @@ public class Body extends BlockStackingLayoutManager { private Block curBlockArea; - private ArrayList childBreaks = new ArrayList(); + private List childBreaks = new ArrayList(); /** * Create a new body layout manager. @@ -212,8 +212,8 @@ public class Body extends BlockStackingLayoutManager { * @param childArea the child area to add * @return unused */ - public boolean addChild(Area childArea) { - return parentLM.addChild(childArea); + public void addChild(Area childArea) { + parentLM.addChild(childArea); } /** diff --git a/src/org/apache/fop/layoutmgr/table/Caption.java b/src/org/apache/fop/layoutmgr/table/Caption.java index d5a0223f7..6c111cd56 100644 --- a/src/org/apache/fop/layoutmgr/table/Caption.java +++ b/src/org/apache/fop/layoutmgr/table/Caption.java @@ -21,6 +21,7 @@ import org.apache.fop.area.Block; import org.apache.fop.area.MinOptMax; import java.util.ArrayList; +import java.util.List; /** * LayoutManager for a table-caption FO. @@ -31,7 +32,7 @@ public class Caption extends BlockStackingLayoutManager { private Block curBlockArea; - private ArrayList childBreaks = new ArrayList(); + private List childBreaks = new ArrayList(); /** * Create a new Caption layout manager. @@ -166,14 +167,10 @@ public class Caption extends BlockStackingLayoutManager { * @param childArea the child area to add * @return unused */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (curBlockArea != null) { curBlockArea.addBlock((Block) childArea); - //return super.addChild(childArea); - - return false; } - return false; } /** diff --git a/src/org/apache/fop/layoutmgr/table/Cell.java b/src/org/apache/fop/layoutmgr/table/Cell.java index fe52955e6..0c0dd1f5a 100644 --- a/src/org/apache/fop/layoutmgr/table/Cell.java +++ b/src/org/apache/fop/layoutmgr/table/Cell.java @@ -24,6 +24,7 @@ import org.apache.fop.layout.BorderAndPadding; import org.apache.fop.layout.BackgroundProps; import java.util.ArrayList; +import java.util.List; /** * LayoutManager for a table-cell FO. @@ -36,7 +37,7 @@ public class Cell extends BlockStackingLayoutManager { private Block curBlockArea; - private ArrayList childBreaks = new ArrayList(); + private List childBreaks = new ArrayList(); private int xoffset; private int yoffset; @@ -228,12 +229,10 @@ public class Cell extends BlockStackingLayoutManager { * @param childArea the child to add to the cell * @return unused */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (curBlockArea != null) { curBlockArea.addBlock((Block) childArea); - return false; } - return false; } /** diff --git a/src/org/apache/fop/layoutmgr/table/Row.java b/src/org/apache/fop/layoutmgr/table/Row.java index f325e4e2e..8c8d0a790 100644 --- a/src/org/apache/fop/layoutmgr/table/Row.java +++ b/src/org/apache/fop/layoutmgr/table/Row.java @@ -82,11 +82,11 @@ public class Row extends BlockStackingLayoutManager { private void setupCells() { cellList = new ArrayList(); // add cells to list - while (m_childLMiter.hasNext()) { - m_curChildLM = (LayoutManager) m_childLMiter.next(); - m_curChildLM.setParentLM(this); - m_curChildLM.init(); - cellList.add(m_curChildLM); + while (childLMiter.hasNext()) { + curChildLM = (LayoutManager) childLMiter.next(); + curChildLM.setParentLM(this); + curChildLM.init(); + cellList.add(curChildLM); } } @@ -118,7 +118,7 @@ public class Row extends BlockStackingLayoutManager { LayoutManager curLM; // currently active LM BreakPoss lastPos = null; - ArrayList breakList = new ArrayList(); + List breakList = new ArrayList(); int min = 0; int opt = 0; @@ -127,7 +127,7 @@ public class Row extends BlockStackingLayoutManager { int cellcount = 0; while ((curLM = getCellLM(cellcount++)) != null) { - ArrayList childBreaks = new ArrayList(); + List childBreaks = new ArrayList(); MinOptMax stackSize = new MinOptMax(); // Set up a LayoutContext @@ -289,8 +289,8 @@ public class Row extends BlockStackingLayoutManager { * @param childArea the child area * @return unused */ - public boolean addChild(Area childArea) { - return parentLM.addChild(childArea); + public void addChild(Area childArea) { + parentLM.addChild(childArea); } /** diff --git a/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java b/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java index 56af58346..920a72785 100644 --- a/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java @@ -21,6 +21,7 @@ import org.apache.fop.area.Block; import org.apache.fop.area.MinOptMax; import java.util.ArrayList; +import java.util.List; /** * LayoutManager for a table-and-caption FO. @@ -33,7 +34,7 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { private Block curBlockArea; - private ArrayList childBreaks = new ArrayList(); + private List childBreaks = new ArrayList(); /** * Create a new table and caption layout manager. @@ -168,14 +169,10 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { * @param childArea the area to add * @return unused */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (curBlockArea != null) { - curBlockArea.addBlock((Block) childArea); - //return super.addChild(childArea); - - return false; + curBlockArea.addBlock((Block) childArea); } - return false; } /** diff --git a/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java index 45ca47daa..c51c6061c 100644 --- a/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -44,7 +44,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager { private Block curBlockArea; - private ArrayList bodyBreaks = new ArrayList(); + private List bodyBreaks = new ArrayList(); private BreakPoss headerBreak; private BreakPoss footerBreak; @@ -186,7 +186,7 @@ public class TableLayoutManager extends BlockStackingLayoutManager { lm.setColumns(columns); - ArrayList breaks = new ArrayList(); + List breaks = new ArrayList(); while (!lm.isFinished()) { if ((bp = lm.getNextBreakPoss(childLC)) != null) { stackSize.add(bp.getStackingSize()); @@ -286,13 +286,10 @@ public class TableLayoutManager extends BlockStackingLayoutManager { * @param childArea the child area to add * @return unused */ - public boolean addChild(Area childArea) { + public void addChild(Area childArea) { if (curBlockArea != null) { - curBlockArea.addBlock((Block) childArea); - - return false; + curBlockArea.addBlock((Block) childArea); } - return false; } /** |