jeremias    2005/01/26 07:00:04

  Modified:    src/java/org/apache/fop/layoutmgr
                        BlockContainerLayoutManager.java
  Log:
  Bugfix for layout of block-containers with fixed BPD. They weren't properly 
broken over to the next page if they didn't fit.
  If autoHeight is false, the whole block-container is considered a 
non-breakable block. Seems to match the behaviour of other implementations but 
I still haven't found the right place in the spec.
  
  Revision  Changes    Path
  1.34      +27 -6     
xml-fop/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
  
  Index: BlockContainerLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- BlockContainerLayoutManager.java  25 Jan 2005 12:29:57 -0000      1.33
  +++ BlockContainerLayoutManager.java  26 Jan 2005 15:00:04 -0000      1.34
  @@ -234,6 +234,19 @@
           fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, relDims.bpd);
   
           while ((curLM = getChildLM()) != null) {
  +            //Treat bc with fixed BPD as non-breakable
  +            if (!autoHeight && (stackLimit.max > context.stackLimit.max)) {
  +                if (log.isDebugEnabled()) {
  +                    log.debug("block-container does not fit in the available 
area "
  +                            + "(available: " + context.stackLimit.max
  +                            + ", needed: " + stackLimit.max + ")");
  +                }
  +                BreakPoss breakPoss = new BreakPoss(new LeafPosition(this, 
-1));
  +                breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
  +                breakPoss.setStackingSize(new MinOptMax());
  +                return breakPoss;
  +            }
  +
               // Make break positions and return blocks!
               // Set up a LayoutContext
               BreakPoss bp;
  @@ -247,8 +260,7 @@
               boolean over = false;
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  -                    stackSize.add(bp.getStackingSize());
  -                    if (stackSize.opt > stackLimit.max) {
  +                    if (stackSize.opt + bp.getStackingSize().opt > 
stackLimit.max) {
                           // reset to last break
                           if (lastPos != null) {
                               reset(lastPos.getPosition());
  @@ -258,19 +270,20 @@
                           over = true;
                           break;
                       }
  -                    lastPos = bp;
  -                    childBreaks.add(bp);
  -
                       if (bp.nextBreakOverflows()) {
                           over = true;
                           break;
                       }                    
                       
  +                    stackSize.add(bp.getStackingSize());
  +                    lastPos = bp;
  +                    childBreaks.add(bp);
  +
                       childLC.setStackLimit(MinOptMax.subtract(
                                              stackLimit, stackSize));
                   }
               }
  -            if (!rotated) {
  +            if (!rotated && autoHeight) {
                   BreakPoss breakPoss;
                   breakPoss = new BreakPoss(new LeafPosition(this,
                                                      childBreaks.size() - 1));
  @@ -289,6 +302,14 @@
               breakPoss.setStackingSize(new MinOptMax(relDims.ipd));
               return breakPoss;
           }
  +        if (!rotated && !autoHeight) {
  +            //Treated as if all content is kept together
  +            BreakPoss breakPoss;
  +            breakPoss = new BreakPoss(new LeafPosition(this,
  +                                               childBreaks.size() - 1));
  +            breakPoss.setStackingSize(new MinOptMax(relDims.bpd));
  +            return breakPoss;
  +        }
           return null;
       }
   
  
  
  

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

Reply via email to