keiron      2002/11/18 07:54:16

  Modified:    src/org/apache/fop/fo FONode.java Title.java
               src/org/apache/fop/fo/flow Block.java Flow.java Leader.java
                        ListItem.java
               src/org/apache/fop/fo/pagination PageSequence.java
               src/org/apache/fop/layoutmgr AbstractLayoutManager.java
                        BlockContainerLayoutManager.java
                        BlockLayoutManager.java BreakPoss.java
                        ContentLayoutManager.java FlowLayoutManager.java
                        InlineStackingLayoutManager.java LayoutManager.java
                        LineLayoutManager.java PageLayoutManager.java
                        StaticContentLayoutManager.java
               src/org/apache/fop/layoutmgr/list Item.java
                        ListBlockLayoutManager.java
                        ListItemLayoutManager.java
               src/org/apache/fop/layoutmgr/table Body.java Caption.java
                        Cell.java Row.java
                        TableAndCaptionLayoutManager.java
                        TableLayoutManager.java
  Log:
  set user agent on layout managers for values and logging
  improved break handling so that it breaks before overflow
  
  Revision  Changes    Path
  1.33      +5 -1      xml-fop/src/org/apache/fop/fo/FONode.java
  
  Index: FONode.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FONode.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- FONode.java       15 Nov 2002 11:56:27 -0000      1.32
  +++ FONode.java       18 Nov 2002 15:54:13 -0000      1.33
  @@ -45,6 +45,10 @@
           userAgent = ua;
       }
   
  +    public FOUserAgent getUserAgent() {
  +        return userAgent;
  +    }
  +
       public void setStructHandler(StructureHandler st) {
       }
   
  
  
  
  1.12      +3 -1      xml-fop/src/org/apache/fop/fo/Title.java
  
  Index: Title.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Title.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Title.java        3 Sep 2002 11:45:13 -0000       1.11
  +++ Title.java        18 Nov 2002 15:54:14 -0000      1.12
  @@ -35,11 +35,13 @@
           InlineStackingLayoutManager lm;
           lm = new InlineStackingLayoutManager(this,
                        new LMiter(children.listIterator()));
  +        lm.setUserAgent(getUserAgent());
           lm.init();
   
           // get breaks then add areas to title
   
           ContentLayoutManager clm = new ContentLayoutManager(title);
  +        clm.setUserAgent(getUserAgent());
           lm.setParentLM(clm);
   
           clm.fillArea(lm);
  
  
  
  1.65      +2 -1      xml-fop/src/org/apache/fop/fo/flow/Block.java
  
  Index: Block.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Block.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- Block.java        15 Nov 2002 11:56:28 -0000      1.64
  +++ Block.java        18 Nov 2002 15:54:14 -0000      1.65
  @@ -176,6 +176,7 @@
   
       public void addLayoutManager(List list) {
           BlockLayoutManager blm = new BlockLayoutManager(this);
  +        blm.setUserAgent(getUserAgent());
           TextInfo ti = propMgr.getTextLayoutProps(fontInfo);
           blm.setBlockTextInfo(ti);
           list.add(blm);
  
  
  
  1.35      +4 -2      xml-fop/src/org/apache/fop/fo/flow/Flow.java
  
  Index: Flow.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Flow.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- Flow.java 20 Jun 2002 09:14:13 -0000      1.34
  +++ Flow.java 18 Nov 2002 15:54:14 -0000      1.35
  @@ -111,7 +111,9 @@
       }
   
       public void addLayoutManager(List list) {
  -        list.add(new FlowLayoutManager(this));
  +        FlowLayoutManager lm = new FlowLayoutManager(this);
  +        lm.setUserAgent(getUserAgent());
  +        list.add(lm);
       }
   
   }
  
  
  
  1.30      +3 -1      xml-fop/src/org/apache/fop/fo/flow/Leader.java
  
  Index: Leader.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Leader.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Leader.java       15 Nov 2002 11:56:28 -0000      1.29
  +++ Leader.java       18 Nov 2002 15:54:14 -0000      1.30
  @@ -123,12 +123,14 @@
               InlineStackingLayoutManager lm;
               lm = new InlineStackingLayoutManager(this,
                        new LMiter(children.listIterator()));
  +            lm.setUserAgent(getUserAgent());
               lm.init();
   
               // get breaks then add areas to FilledArea
               FilledArea fa = new FilledArea();
   
               ContentLayoutManager clm = new ContentLayoutManager(fa);
  +            clm.setUserAgent(getUserAgent());
               lm.setParentLM(clm);
   
               clm.fillArea(lm);
  
  
  
  1.26      +3 -1      xml-fop/src/org/apache/fop/fo/flow/ListItem.java
  
  Index: ListItem.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/ListItem.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ListItem.java     15 Nov 2002 11:56:28 -0000      1.25
  +++ ListItem.java     18 Nov 2002 15:54:14 -0000      1.26
  @@ -43,6 +43,8 @@
               blm.setLabel(label.getItemLayoutManager());
               blm.setBody(body.getItemLayoutManager());
               list.add(blm);
  +        } else {
  +            getLogger().error("list-item requires list-item-label and 
list-item-body");
           }
       }
   
  
  
  
  1.59      +2 -1      xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java
  
  Index: PageSequence.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- PageSequence.java 6 Nov 2002 10:02:29 -0000       1.58
  +++ PageSequence.java 18 Nov 2002 15:54:14 -0000      1.59
  @@ -339,6 +339,7 @@
   
           // This will layout pages and add them to the area tree
           PageLayoutManager pageLM = new PageLayoutManager(areaTree, this);
  +        pageLM.setUserAgent(getUserAgent());
           pageLM.setPageCounting(currentPageNumber, pageNumberGenerator);
   
           // For now, skip the threading and just call run directly.
  
  
  
  1.18      +23 -1     xml-fop/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
  
  Index: AbstractLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- AbstractLayoutManager.java        13 Nov 2002 10:25:48 -0000      1.17
  +++ AbstractLayoutManager.java        18 Nov 2002 15:54:14 -0000      1.18
  @@ -8,6 +8,7 @@
   package org.apache.fop.layoutmgr;
   
   import org.apache.fop.fo.FObj;
  +import org.apache.fop.fo.FOUserAgent;
   import org.apache.fop.area.Area;
   import org.apache.fop.area.Resolveable;
   import org.apache.fop.area.PageViewport;
  @@ -17,12 +18,15 @@
   import org.apache.fop.layout.BackgroundProps;
   import org.apache.fop.traits.BorderProps;
   
  +import org.apache.avalon.framework.logger.Logger;
  +
   import java.util.ListIterator;
   
   /**
    * The base class for all LayoutManagers.
    */
   public abstract class AbstractLayoutManager implements LayoutManager {
  +    protected FOUserAgent userAgent;
       protected LayoutManager parentLM;
       protected FObj fobj;
       protected String foID = null;
  @@ -51,6 +55,23 @@
           childLMiter = lmIter;
       }
   
  +    /**
  +     * Set the user agent.
  +     *
  +     * @param ua the user agent
  +     */
  +    public void setUserAgent(FOUserAgent ua) {
  +        userAgent = ua;
  +    }
  +
  +    public FOUserAgent getUserAgent() {
  +        return userAgent;
  +    }
  +
  +    protected Logger getLogger() {
  +        return userAgent.getLogger();
  +    }
  +
       public void setParentLM(LayoutManager lm) {
           this.parentLM = lm;
       }
  @@ -109,6 +130,7 @@
           }
           while (childLMiter.hasNext()) {
               curChildLM = (LayoutManager) childLMiter.next();
  +            curChildLM.setUserAgent(getUserAgent());
               curChildLM.setParentLM(this);
               curChildLM.init();
               return curChildLM;
  
  
  
  1.6       +2 -2      
xml-fop/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
  
  Index: BlockContainerLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BlockContainerLayoutManager.java  13 Nov 2002 10:25:48 -0000      1.5
  +++ BlockContainerLayoutManager.java  18 Nov 2002 15:54:15 -0000      1.6
  @@ -193,7 +193,7 @@
               if (overflow == Overflow.HIDDEN) {
                   clip = true;
               } else if (overflow == Overflow.ERROR_IF_OVERFLOW) {
  -                //log.error("contents overflows block-container viewport: 
clipping");
  +                getLogger().error("contents overflows block-container viewport: 
clipping");
                   clip = true;
               }
           }
  
  
  
  1.24      +20 -7     xml-fop/src/org/apache/fop/layoutmgr/BlockLayoutManager.java
  
  Index: BlockLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/BlockLayoutManager.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- BlockLayoutManager.java   13 Nov 2002 10:25:48 -0000      1.23
  +++ BlockLayoutManager.java   18 Nov 2002 15:54:15 -0000      1.24
  @@ -91,6 +91,7 @@
               LineLayoutManager child;
               child = new LineLayoutManager(fobj, inlines, lineHeight,
                                               lead, follow);
  +            child.setUserAgent(getUserAgent());
               return child;
   
           }
  @@ -149,20 +150,29 @@
               boolean over = false;
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            reset(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
                           over = true;
                           break;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       lastPos = bp;
                       childBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       if (curLM.generatesInlineAreas()) {
                           // Reset stackLimit for non-first lines
                           childLC.setStackLimit(new MinOptMax(ipd/* - iIndents*/));
  @@ -179,6 +189,9 @@
                   }
                   BreakPoss breakPoss = new BreakPoss(
                                       new LeafPosition(this, childBreaks.size() - 1));
  +                if (over) {
  +                    breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +                }
                   breakPoss.setStackingSize(stackSize);
                   return breakPoss;
               }
  @@ -189,6 +202,8 @@
           return breakPoss;
       }
   
  +    int iStartPos = 0;
  +
       public void addAreas(PositionIterator parentIter,
                            LayoutContext layoutContext) {
           getParentArea(null);
  @@ -200,12 +215,10 @@
           addID();
   
           LayoutManager childLM ;
  -        int iStartPos = 0;
           LayoutContext lc = new LayoutContext(0);
           while (parentIter.hasNext()) {
               LeafPosition lfp = (LeafPosition) parentIter.next();
               if (lfp.getLeafPos() == -2) {
  -                childBreaks.clear();
                   curBlockArea = null;
                   flush();
                   return;
  @@ -225,7 +238,6 @@
           // if adjusted space after
           addBlockSpacing(adjust, layoutProps.spaceAfter.space);
   
  -        childBreaks.clear();
           curBlockArea = null;
       }
   
  @@ -273,6 +285,7 @@
           if (resetPos == null) {
               reset(null);
               childBreaks.clear();
  +            iStartPos = 0;
           } else {
               //reset(resetPos);
               LayoutManager lm = resetPos.getLM();
  
  
  
  1.10      +5 -1      xml-fop/src/org/apache/fop/layoutmgr/BreakPoss.java
  
  Index: BreakPoss.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/BreakPoss.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- BreakPoss.java    13 Nov 2002 10:25:48 -0000      1.9
  +++ BreakPoss.java    18 Nov 2002 15:54:15 -0000      1.10
  @@ -162,6 +162,10 @@
           return ((m_flags & FORCE) != 0);
       }
   
  +    public boolean nextBreakOverflows() {
  +        return ((m_flags & NEXT_OVERFLOWS) != 0);
  +    }
  +
       public boolean isSuppressible() {
           return ((m_flags & ALL_ARE_SUPPRESS_AT_LB) != 0);
       }
  
  
  
  1.11      +22 -2     xml-fop/src/org/apache/fop/layoutmgr/ContentLayoutManager.java
  
  Index: ContentLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/ContentLayoutManager.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ContentLayoutManager.java 13 Nov 2002 10:25:48 -0000      1.10
  +++ ContentLayoutManager.java 18 Nov 2002 15:54:15 -0000      1.11
  @@ -6,11 +6,14 @@
    */
   package org.apache.fop.layoutmgr;
   
  +import org.apache.fop.fo.FOUserAgent;
   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 org.apache.avalon.framework.logger.Logger;
  +
   import java.util.List;
   import java.util.ArrayList;
   
  @@ -21,7 +24,7 @@
    * leader use-content and title.
    */
   public class ContentLayoutManager implements LayoutManager {
  -
  +    private FOUserAgent userAgent;
       private Area holder;
       private int stackSize;
       private LayoutManager parentLM;
  @@ -120,6 +123,23 @@
       /** @see org.apache.fop.layoutmgr.LayoutManager */
       public void addChild(Area childArea) {
           holder.addChild(childArea);
  +    }
  +
  +    /**
  +     * Set the user agent.
  +     *
  +     * @param ua the user agent
  +     */
  +    public void setUserAgent(FOUserAgent ua) {
  +        userAgent = ua;
  +    }
  +
  +    public FOUserAgent getUserAgent() {
  +        return userAgent;
  +    }
  +
  +    protected Logger getLogger() {
  +        return userAgent.getLogger();
       }
   
       /** @see org.apache.fop.layoutmgr.LayoutManager */
  
  
  
  1.16      +9 -9      xml-fop/src/org/apache/fop/layoutmgr/FlowLayoutManager.java
  
  Index: FlowLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/FlowLayoutManager.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- FlowLayoutManager.java    13 Nov 2002 10:25:48 -0000      1.15
  +++ FlowLayoutManager.java    18 Nov 2002 15:54:15 -0000      1.16
  @@ -38,12 +38,13 @@
   
       public BreakPoss getNextBreakPoss(LayoutContext context) {
   
  -        LayoutManager curLM ; // currently active LM
  +        // currently active LM
  +        LayoutManager curLM;
           MinOptMax stackSize = new MinOptMax();
   
           while ((curLM = getChildLM()) != null) {
               if (curLM.generatesInlineAreas()) {
  -                // problem
  +                getLogger().error("inline area not allowed under flow - ignoring");
                   curLM.setFinished(true);
                   continue;
               }
  @@ -65,9 +66,8 @@
                       // set stackLimit for remaining space
                       childLC.setStackLimit(MinOptMax.subtract(bpd, stackSize));
   
  -                    if (bp.isForcedBreak()) {
  +                    if (bp.isForcedBreak() || bp.nextBreakOverflows()) {
                           breakPage = true;
  -                        break;
                       }
                   }
               }
  @@ -91,10 +91,11 @@
           return null;
       }
   
  +    int iStartPos = 0;
  +
       public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) {
   
  -        LayoutManager childLM ;
  -        int iStartPos = 0;
  +        LayoutManager childLM;
           LayoutContext lc = new LayoutContext(0);
           while (parentIter.hasNext()) {
               LeafPosition lfp = (LeafPosition) parentIter.next();
  @@ -109,8 +110,6 @@
           }
   
           flush();
  -        // clear the breaks for the page to start for the next page
  -        blockBreaks.clear();
       }
   
   
  @@ -147,6 +146,7 @@
        */
       public LayoutManager retrieveMarker(String name, int pos, int boundary) {
           // error cannot retrieve markers in flow
  +        getLogger().error("Cannot retrieve a marker from the flow");
           return null;
       }
   }
  
  
  
  1.8       +4 -4      
xml-fop/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
  
  Index: InlineStackingLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- InlineStackingLayoutManager.java  13 Nov 2002 10:25:48 -0000      1.7
  +++ InlineStackingLayoutManager.java  18 Nov 2002 15:54:15 -0000      1.8
  @@ -149,7 +149,7 @@
           if (prevPos != null) {
               // ASSERT (prevPos.getLM() == this)
               if (prevPos.getLM() != this) {
  -                //log.error(
  +                //getLogger().error(
                   //  "InlineStackingLayoutManager.resetPosition: " +
                   //  "LM mismatch!!!");
               }
  @@ -239,7 +239,7 @@
   
               // ignore nested blocks for now
               if (!curLM.generatesInlineAreas()) {
  -                System.err.println("WARNING: ignoring block inside inline fo");
  +                getLogger().warn("ignoring block inside inline fo");
                   curLM.setFinished(true);
                   continue;
               }
  @@ -547,7 +547,7 @@
                                             spaceRange.min) * dSpaceAdjust);
               }
               if (iAdjust != 0) {
  -                //log.error("Add leading space: " + iAdjust);
  +                //getLogger().debug("Add leading space: " + iAdjust);
                   Space ls = new Space();
                   ls.setWidth(iAdjust);
                   parentArea.addChild(ls);
  
  
  
  1.13      +43 -11    xml-fop/src/org/apache/fop/layoutmgr/LayoutManager.java
  
  Index: LayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/LayoutManager.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- LayoutManager.java        13 Nov 2002 10:25:48 -0000      1.12
  +++ LayoutManager.java        18 Nov 2002 15:54:15 -0000      1.13
  @@ -7,6 +7,7 @@
   
   package org.apache.fop.layoutmgr;
   
  +import org.apache.fop.fo.FOUserAgent;
   
   import org.apache.fop.area.Area;
   import org.apache.fop.area.Resolveable;
  @@ -16,11 +17,40 @@
    * The interface for all LayoutManagers.
    */
   public interface LayoutManager {
  -    public boolean generatesInlineAreas();
  -    public Area getParentArea (Area childArea);
  -    public void addChild (Area childArea);
  +
  +    /**
  +     * Set the user agent.
  +     *
  +     * @param ua the user agent
  +     */
  +    public void setUserAgent(FOUserAgent ua);
  +
  +    /**
  +     * Get the user agent.
  +     *
  +     * @return the user agent
  +     */
  +    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);
   
  +    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).
  @@ -37,6 +67,11 @@
       public BreakPoss getNextBreakPoss(LayoutContext context);
   
   
  +    public void resetPosition(Position 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.)
  @@ -50,6 +85,9 @@
        */
       public void setFinished(boolean isFinished);
   
  +    public Area getParentArea(Area childArea);
  +    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
  @@ -57,13 +95,6 @@
        */
       public void addAreas(PositionIterator posIter, LayoutContext context);
   
  -    public void init();
  -
  -    public void resetPosition(Position position);
  -
  -    public void getWordChars(StringBuffer sbChars, Position bp1,
  -                             Position bp2);
  -
       /**
        * Get the string of the current page number.
        *
  @@ -121,3 +152,4 @@
       public LayoutManager retrieveMarker(String name, int pos, int boundary);
   
   }
  +
  
  
  
  1.18      +3 -4      xml-fop/src/org/apache/fop/layoutmgr/LineLayoutManager.java
  
  Index: LineLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/LineLayoutManager.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- LineLayoutManager.java    13 Nov 2002 10:25:48 -0000      1.17
  +++ LineLayoutManager.java    18 Nov 2002 15:54:15 -0000      1.18
  @@ -366,7 +366,7 @@
           while (bpIter.hasPrevious() && bpIter.previous() != prev) {
           }
           if (bpIter.next() != prev) {
  -            //log.error("findHyphenPoss: problem!");
  +            getLogger().error("findHyphenPoss: problem!");
               return null;
           }
           StringBuffer sbChars = new StringBuffer(30);
  @@ -382,7 +382,7 @@
               prev = bp;
           }
           vecInlineBreaks.remove(vecInlineBreaks.size() - 1); // remove last
  -        //log.debug("Word to hyphenate: " + sbChars.toString());
  +        getLogger().debug("Word to hyphenate: " + sbChars.toString());
   
           // Now find all hyphenation points in this word (get in an array of offsets)
           // hyphProps are from the block level?. Note that according to the spec,
  @@ -586,7 +586,6 @@
        */
       public void addAreas(PositionIterator parentIter, double dSpaceAdjust) {
           LayoutManager childLM;
  -        //int iStartPos = 0;
           LayoutContext lc = new LayoutContext(0);
           while (parentIter.hasNext()) {
               LineBreakPosition lbp = (LineBreakPosition) parentIter.next();
  
  
  
  1.25      +5 -4      xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java
  
  Index: PageLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- PageLayoutManager.java    13 Nov 2002 10:25:48 -0000      1.24
  +++ PageLayoutManager.java    18 Nov 2002 15:54:15 -0000      1.25
  @@ -328,7 +328,7 @@
           // end the page.
           getParentArea(area);
           // Alternatively the child LM indicates to parent that it's full?
  -        //System.out.println("size: " + area.getAllocationBPD().max +
  +        //getLogger().debug("size: " + area.getAllocationBPD().max +
           //                   ":" + curSpan.getMaxBPD().min);
           /*if (area.getAllocationBPD().max >= curSpan.getMaxBPD().min) {
               // Consider it filled
  @@ -385,9 +385,10 @@
                     .getRegion(regionClass);
                   reg.getRegion().setIPD((int)reg.getViewArea().getWidth());
                   if (reg == null) {
  -                    System.out.println("no region viewport: shouldn't happen");
  +                    getLogger().error("no region viewport: shouldn't happen");
                   }
                   StaticContentLayoutManager lm = flow.getLayoutManager();
  +                lm.setUserAgent(getUserAgent());
                   lm.init();
                   lm.setRegionReference(reg.getRegion());
                   lm.setParentLM(this);
  @@ -403,7 +404,7 @@
                           lm.addAreas(new BreakPossPosIter(vecBreakPoss, 0,
                                                             vecBreakPoss.size()), 
null);
                       } else {
  -                      System.out.println("bp==null  cls=" + regionClass);
  +                      getLogger().error("bp==null  cls=" + regionClass);
                       }
                   }
                   //lm.flush();
  
  
  
  1.6       +5 -5      
xml-fop/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
  
  Index: StaticContentLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/StaticContentLayoutManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StaticContentLayoutManager.java   13 Nov 2002 10:25:48 -0000      1.5
  +++ StaticContentLayoutManager.java   18 Nov 2002 15:54:15 -0000      1.6
  @@ -36,7 +36,8 @@
      
       public BreakPoss getNextBreakPoss(LayoutContext context) {
   
  -        LayoutManager curLM; // currently active LM
  +        // currently active LM
  +        LayoutManager curLM;
   
           while ((curLM = getChildLM()) != null) {
               // Make break positions and return page break
  @@ -47,7 +48,7 @@
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
                       blockBreaks.add(bp);
                       if (bp.isForcedBreak()) {
  -                        System.out.println("Forced breaks are not allowed in static 
content");
  +                        getLogger().error("Forced breaks are not allowed in static 
content - ignoring");
                           return null;
                       }
                   }
  @@ -79,8 +80,6 @@
           }
   
           flush();
  -        // clear the breaks for the page to start for the next page
  -        blockBreaks.clear();
       }
   
   
  @@ -105,6 +104,7 @@
        */
       public void addMarker(String name, LayoutManager lm, boolean start) {
           // error markers not allowed in static
  +        getLogger().error("Cannot add marker to static areas");
       }
   }
   
  
  
  
  1.4       +19 -4     xml-fop/src/org/apache/fop/layoutmgr/list/Item.java
  
  Index: Item.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/list/Item.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Item.java 13 Nov 2002 10:25:58 -0000      1.3
  +++ Item.java 18 Nov 2002 15:54:15 -0000      1.4
  @@ -88,27 +88,40 @@
                                        stackSize));
               childLC.setRefIPD(ipd);
   
  +            boolean over = false;
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            reset(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
                           break;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       lastPos = bp;
                       childBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                                context.getStackLimit(), stackSize));
                   }
               }
               BreakPoss breakPoss = new BreakPoss(
                                       new LeafPosition(this, childBreaks.size() - 1));
  +            if (over) { 
  +                breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +            }
               breakPoss.setStackingSize(stackSize);
               return breakPoss;
           }
  @@ -220,6 +233,8 @@
       public void resetPosition(Position resetPos) {
           if (resetPos == null) {
               reset(null);
  +        } else {
  +            //reset(resetPos);
           }
       }
   }
  
  
  
  1.4       +21 -5     
xml-fop/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
  
  Index: ListBlockLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ListBlockLayoutManager.java       13 Nov 2002 10:25:58 -0000      1.3
  +++ ListBlockLayoutManager.java       18 Nov 2002 15:54:15 -0000      1.4
  @@ -70,7 +70,8 @@
        * @return the next break possibility
        */
       public BreakPoss getNextBreakPoss(LayoutContext context) {
  -        LayoutManager curLM; // currently active LM
  +        // currently active LM
  +        LayoutManager curLM;
   
           MinOptMax stackSize = new MinOptMax();
           // if starting add space before
  @@ -89,27 +90,40 @@
                                        stackSize));
               childLC.setRefIPD(ipd);
   
  +            boolean over = false;
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            reset(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
                           break;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       lastPos = bp;
                       bodyBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                                context.getStackLimit(), stackSize));
                   }
               }
               BreakPoss breakPoss = new BreakPoss(
                                       new LeafPosition(this, bodyBreaks.size() - 1));
  +            if (over) { 
  +                breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +            }
               breakPoss.setStackingSize(stackSize);
               return breakPoss;
           }
  @@ -209,6 +223,8 @@
           if (resetPos == null) {
               bodyBreaks.clear();
               reset(null);
  +        } else {
  +            
           }
       }
   }
  
  
  
  1.4       +22 -5     
xml-fop/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
  
  Index: ListItemLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ListItemLayoutManager.java        13 Nov 2002 10:25:58 -0000      1.3
  +++ ListItemLayoutManager.java        18 Nov 2002 15:54:15 -0000      1.4
  @@ -82,7 +82,11 @@
        * @return the next break possibility
        */
       public BreakPoss getNextBreakPoss(LayoutContext context) {
  -        Item curLM; // currently active LM
  +        // currently active LM
  +        Item curLM;
  +
  +        label.setUserAgent(getUserAgent());
  +        body.setUserAgent(getUserAgent());
   
           BreakPoss lastPos = null;
           List breakList = new ArrayList();
  @@ -92,6 +96,7 @@
           int max = 0;
   
           int stage = 0;
  +        boolean over = false;
           while (true) {
               if(stage == 0) {
                   curLM = label;
  @@ -120,11 +125,14 @@
               stage++;
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            curLM.resetPosition(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
  @@ -132,8 +140,14 @@
                       } else {
                           lastPos = bp;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       childBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                                context.getStackLimit(), stackSize));
                   }
  @@ -160,6 +174,9 @@
           setFinished(true);
           ItemPosition rp = new ItemPosition(this, breakList.size() - 1, breakList);
           BreakPoss breakPoss = new BreakPoss(rp);
  +        if (over) { 
  +            breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +        }
           breakPoss.setStackingSize(itemSize);
           return breakPoss;
       }
  
  
  
  1.7       +20 -4     xml-fop/src/org/apache/fop/layoutmgr/table/Body.java
  
  Index: Body.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/Body.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Body.java 13 Nov 2002 10:25:58 -0000      1.6
  +++ Body.java 18 Nov 2002 15:54:15 -0000      1.7
  @@ -8,6 +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.BlockStackingLayoutManager;
   import org.apache.fop.layoutmgr.LeafPosition;
   import org.apache.fop.layoutmgr.BreakPoss;
  @@ -99,27 +100,42 @@
   
               curLM.setColumns(columns);
   
  +            boolean over = false;
  +
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            reset(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
  +                        over = true;
                           break;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       lastPos = bp;
                       childBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                                context.getStackLimit(), stackSize));
                   }
               }
               BreakPoss breakPoss = new BreakPoss(
                                       new LeafPosition(this, childBreaks.size() - 1));
  +            if (over) {
  +                breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +            }
               breakPoss.setStackingSize(stackSize);
               return breakPoss;
           }
  
  
  
  1.4       +19 -4     xml-fop/src/org/apache/fop/layoutmgr/table/Caption.java
  
  Index: Caption.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/Caption.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Caption.java      13 Nov 2002 10:25:58 -0000      1.3
  +++ Caption.java      18 Nov 2002 15:54:16 -0000      1.4
  @@ -74,27 +74,42 @@
                                        stackSize));
               childLC.setRefIPD(ipd);
   
  +            boolean over = false;
  +
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            reset(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
  +                        over = true;
                           break;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       lastPos = bp;
                       childBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                                context.getStackLimit(), stackSize));
                   }
               }
               BreakPoss breakPoss = new BreakPoss(
                                       new LeafPosition(this, childBreaks.size() - 1));
  +            if (over) {
  +                breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +            }
               breakPoss.setStackingSize(stackSize);
               return breakPoss;
           }
  
  
  
  1.7       +20 -5     xml-fop/src/org/apache/fop/layoutmgr/table/Cell.java
  
  Index: Cell.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/Cell.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Cell.java 13 Nov 2002 10:25:58 -0000      1.6
  +++ Cell.java 18 Nov 2002 15:54:16 -0000      1.7
  @@ -77,7 +77,7 @@
   
           while ((curLM = getChildLM()) != null) {
               if(curLM.generatesInlineAreas()) {
  -                // error
  +                getLogger().error("table-cell must contain block areas - ignoring");
                   curLM.setFinished(true);
                   continue;
               }
  @@ -90,27 +90,42 @@
                                        stackSize));
               childLC.setRefIPD(ipd);
   
  +            boolean over = false;
  +
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            reset(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
  +                        over = true;
                           break;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       lastPos = bp;
                       childBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                                context.getStackLimit(), stackSize));
                   }
               }
               BreakPoss breakPoss = new BreakPoss(
                                       new LeafPosition(this, childBreaks.size() - 1));
  +            if (over) {
  +                breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +            }
               breakPoss.setStackingSize(stackSize);
               return breakPoss;
           }
  
  
  
  1.7       +51 -4     xml-fop/src/org/apache/fop/layoutmgr/table/Row.java
  
  Index: Row.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/Row.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Row.java  13 Nov 2002 10:25:58 -0000      1.6
  +++ Row.java  18 Nov 2002 15:54:16 -0000      1.7
  @@ -84,6 +84,7 @@
           // add cells to list
           while (childLMiter.hasNext()) {
               curChildLM = (LayoutManager) childLMiter.next();
  +            curChildLM.setUserAgent(getUserAgent());
               curChildLM.setParentLM(this);
               curChildLM.init();
               cellList.add(curChildLM);
  @@ -125,6 +126,8 @@
           int max = 0;
   
           int cellcount = 0;
  +        boolean over = false;
  +
           while ((curLM = getCellLM(cellcount++)) != null) {
   
               List childBreaks = new ArrayList();
  @@ -151,19 +154,29 @@
   
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            reset(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
  +                        over = true;
                           break;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       lastPos = bp;
                       childBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                                context.getStackLimit(), stackSize));
                   }
  @@ -190,8 +203,42 @@
           setFinished(true);
           RowPosition rp = new RowPosition(this, breakList.size() - 1, breakList);
           BreakPoss breakPoss = new BreakPoss(rp);
  +        if (over) { 
  +            breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +        }
           breakPoss.setStackingSize(rowSize);
           return breakPoss;
  +    }
  +
  +    /**
  +     * Reset the layoutmanager "iterator" so that it will start
  +     * with the passed Position's generating LM
  +     * on the next call to getChildLM.
  +     * @param pos a Position returned by a child layout manager
  +     * representing a potential break decision.
  +     * If pos is null, then back up to the first child LM.
  +     */    
  +    protected void reset(Position pos) {
  +        LayoutManager curLM; // currently active LM
  +        int cellcount = 0;
  +
  +        if (pos == null) {
  +            while ((curLM = getCellLM(cellcount++)) != null) {
  +                curLM.resetPosition(null);
  +                cellcount++;
  +            }
  +        } else {
  +            RowPosition rpos = (RowPosition)pos;
  +            List breaks = rpos.cellBreaks;
  +
  +            while ((curLM = getCellLM(cellcount++)) != null) {
  +                List childbreaks = (List)breaks.get(cellcount);
  +                curLM.resetPosition((Position)childbreaks.get(childbreaks.size() - 
1));
  +                cellcount++;
  +            }
  +        }
  +
  +        setFinished(false);
       }
   
       /**
  
  
  
  1.4       +18 -4     
xml-fop/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
  
  Index: TableAndCaptionLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TableAndCaptionLayoutManager.java 13 Nov 2002 10:25:58 -0000      1.3
  +++ TableAndCaptionLayoutManager.java 18 Nov 2002 15:54:16 -0000      1.4
  @@ -76,27 +76,41 @@
                                        stackSize));
               childLC.setRefIPD(ipd);
   
  +            boolean over = false;
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            reset(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
  +                        over = true;
                           break;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       lastPos = bp;
                       childBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                                context.getStackLimit(), stackSize));
                   }
               }
               BreakPoss breakPoss = new BreakPoss(
                                       new LeafPosition(this, childBreaks.size() - 1));
  +            if (over) {
  +                breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +            }
               breakPoss.setStackingSize(stackSize);
               return breakPoss;
           }
  
  
  
  1.5       +18 -4     
xml-fop/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java
  
  Index: TableLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/layoutmgr/table/TableLayoutManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TableLayoutManager.java   13 Nov 2002 10:25:58 -0000      1.4
  +++ TableLayoutManager.java   18 Nov 2002 15:54:16 -0000      1.5
  @@ -139,27 +139,41 @@
   
               curLM.setColumns(columns);
   
  +            boolean over = false;
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > context.getStackLimit().max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
context.getStackLimit().max) {
                           // reset to last break
                           if (lastPos != null) {
  -                            reset(lastPos.getPosition());
  +                            LayoutManager lm = lastPos.getLayoutManager();
  +                            lm.resetPosition(lastPos.getPosition());
  +                            if (lm != curLM) {
  +                                curLM.resetPosition(null);
  +                            }
                           } else {
                               curLM.resetPosition(null);
                           }
  +                        over = true;
                           break;
                       }
  +                    stackSize.add(bp.getStackingSize());
                       lastPos = bp;
                       bodyBreaks.add(bp);
   
  +                    if (bp.nextBreakOverflows()) {
  +                        over = true;
  +                        break;
  +                    }
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                                context.getStackLimit(), stackSize));
                   }
               }
               BreakPoss breakPoss = new BreakPoss(
                                       new LeafPosition(this, bodyBreaks.size() - 1));
  +            if (over) {
  +                breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +            }
               breakPoss.setStackingSize(stackSize);
               return breakPoss;
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to