jeremias    2005/01/17 02:38:02

  Modified:    src/java/org/apache/fop/layoutmgr
                        BlockContainerLayoutManager.java
               src/java/org/apache/fop/fo/properties
                        CorrespondingPropertyMaker.java
                        IndentPropertyMaker.java
               src/java/org/apache/fop/render AbstractRenderer.java
               src/java/org/apache/fop/render/pdf PDFRenderer.java
  Log:
  block-containers improved/fixed. The following features are implemented and 
testcases exist:
  left, right, top, bottom, width, height, block-progression-dimension 
(partial), inline-progression-dimension (partial), borders, padding, indents, 
reference-orientation.
  autoheight works only for in-flow BCs ATM.
  
  start-indent calculation fixed: uses inherited value if rules in 5.3.2 don't 
apply.
  
  Revision  Changes    Path
  1.29      +186 -103  
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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- BlockContainerLayoutManager.java  12 Jan 2005 12:03:00 -0000      1.28
  +++ BlockContainerLayoutManager.java  17 Jan 2005 10:38:02 -0000      1.29
  @@ -19,16 +19,16 @@
   package org.apache.fop.layoutmgr;
   
   import java.util.List;
  +import java.awt.Point;
   import java.awt.geom.Rectangle2D;
   
   import org.apache.fop.area.Area;
   import org.apache.fop.area.BlockViewport;
   import org.apache.fop.area.Block;
   import org.apache.fop.area.PageViewport;
  -import org.apache.fop.fo.Constants;
  +import org.apache.fop.area.Trait;
   import org.apache.fop.fo.flow.BlockContainer;
   import org.apache.fop.fo.properties.CommonAbsolutePosition;
  -import org.apache.fop.fo.properties.FixedLength;
   import org.apache.fop.area.CTM;
   import org.apache.fop.datatypes.FODimension;
   import org.apache.fop.datatypes.Length;
  @@ -52,6 +52,8 @@
       private boolean clip = false;
       private Length width;
       private Length height;
  +    private int vpContentIPD;
  +    private int vpContentBPD;
   
       // When viewport should grow with the content.
       private boolean autoHeight = true; 
  @@ -67,6 +69,9 @@
           fobj = node;
       }
       
  +    /**
  +     * @return the currently applicable page viewport
  +     */
       protected PageViewport getPageViewport() {
           LayoutManager lm = this;
           while (lm != null && !(lm instanceof PageSequenceLayoutManager)) {
  @@ -83,74 +88,14 @@
        * @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
        */
       protected void initProperties() {
  -        log.debug(fobj.getBlockProgressionDimension().getOptimum());
  -        log.debug(fobj.getInlineProgressionDimension().getOptimum());
           abProps = fobj.getCommonAbsolutePosition();
  -        log.debug(abProps);
  -        
  -        int iIndents = fobj.getCommonMarginBlock().startIndent.getValue();
  -        iIndents += fobj.getCommonMarginBlock().endIndent.getValue();
  -        int bIndents = 
fobj.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
  -
  -        
  -        if (abProps.absolutePosition == EN_ABSOLUTE && false) {
  -            Rectangle2D rect = new 
Rectangle2D.Double(abProps.left.getValue(),
  -                                abProps.top.getValue(), 
  -                                abProps.right.getValue() - 
abProps.left.getValue(),
  -                                abProps.bottom.getValue() - 
abProps.top.getValue());
  -            relDims = new FODimension(0, 0);
  -            absoluteCTM = 
CTM.getCTMandRelDims(fobj.getReferenceOrientation(),
  -                fobj.getWritingMode(), rect, relDims);
  -        } else if (abProps.absolutePosition == EN_FIXED
  -                || abProps.absolutePosition == EN_ABSOLUTE) {
  -            Rectangle2D viewArea = getPageViewport().getViewArea();
  -            double x = viewArea.getX() + abProps.left.getValue();
  -            double y = viewArea.getY() + abProps.top.getValue();
  -            double w = 0.0;
  -            if (abProps.right.getEnum() == Constants.EN_AUTO) {
  -                if (fobj.getWidth().getEnum() == Constants.EN_AUTO) {
  -                    w = viewArea.getWidth() - x;
  -                } else {
  -                    if (fobj.getReferenceOrientation() % 180 == 0) {
  -                        w = 
fobj.getInlineProgressionDimension().getOptimum().getLength().getValue();
  -                    } else {
  -                        w = 
fobj.getBlockProgressionDimension().getOptimum().getLength().getValue();
  -                    }
  -                }
  -            } else {
  -                w = viewArea.getWidth() - x - abProps.right.getValue();
  -            }
  -            double h = 0.0;
  -            if (abProps.bottom.getEnum() == Constants.EN_AUTO) {
  -                if (fobj.getHeight().getEnum() == Constants.EN_AUTO) {
  -                    h = viewArea.getHeight() - y;
  -                } else {
  -                    if (fobj.getReferenceOrientation() % 180 == 0) {
  -                        h = 
fobj.getBlockProgressionDimension().getOptimum().getLength().getValue();
  -                    } else {
  -                        h = 
fobj.getInlineProgressionDimension().getOptimum().getLength().getValue();
  -                    }
  -                }
  -            } else {
  -                h = viewArea.getHeight() - y - abProps.bottom.getValue();
  -            }
  -            log.debug("x=" + x + " y=" + y + " w=" + w + " h=" + h + " 
orient=" + fobj.getReferenceOrientation());
  -            if (w != 0) {
  -                this.width = new FixedLength((int)w);
  -            }
  -            if (h != 0) {
  -                this.height = new FixedLength((int)h);
  -            }
  -            Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
  -            relDims = new FODimension(0, 0);
  -            absoluteCTM = 
CTM.getCTMandRelDims(fobj.getReferenceOrientation(),
  -                fobj.getWritingMode(), rect, relDims);
  -        }
    
  -        if (height == null) {
  +        boolean rotated = (fobj.getReferenceOrientation() % 180 != 0);
  +        if (rotated) {
  +            height = 
fobj.getInlineProgressionDimension().getOptimum().getLength();
  +            width = 
fobj.getBlockProgressionDimension().getOptimum().getLength();
  +        } else {
               height = 
fobj.getBlockProgressionDimension().getOptimum().getLength();
  -        }
  -        if (width == null) {
               width = 
fobj.getInlineProgressionDimension().getOptimum().getLength();
           }
       }
  @@ -159,6 +104,19 @@
           return 
fobj.getInlineProgressionDimension().getOptimum().getLength().getValue();
       }
   
  +    private int getSpaceBefore() {
  +        return fobj.getCommonMarginBlock().spaceBefore
  +                .getOptimum().getLength().getValue();
  +    }
  +    
  +    private int getBPIndents() {
  +        int indents = 0;
  +        indents += 
fobj.getCommonMarginBlock().spaceBefore.getOptimum().getLength().getValue();
  +        indents += 
fobj.getCommonMarginBlock().spaceAfter.getOptimum().getLength().getValue();
  +        indents += 
fobj.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
  +        return indents;
  +    }
  +    
       private int getIPIndents() {
           int iIndents = 0;
           iIndents += fobj.getCommonMarginBlock().startIndent.getValue();
  @@ -166,48 +124,83 @@
           return iIndents;
       }
       
  +    private boolean isAbsoluteOrFixed() {
  +        return (abProps.absolutePosition == EN_ABSOLUTE) 
  +                || (abProps.absolutePosition == EN_FIXED);
  +    }
  +
  +    private boolean isFixed() {
  +        return (abProps.absolutePosition == EN_FIXED);
  +    }
  +    
  +    /**
  +     * @see 
org.apache.fop.layoutmgr.LayoutManager#getNextBreakPoss(org.apache.fop.layoutmgr.LayoutContext)
  +     */
       public BreakPoss getNextBreakPoss(LayoutContext context) {
   
  -        if (abProps.absolutePosition == EN_ABSOLUTE) {
  -            return getAbsoluteBreakPoss(context);
  -        } else if (abProps.absolutePosition == EN_FIXED) {
  +        if (isAbsoluteOrFixed()) {
               return getAbsoluteBreakPoss(context);
           }
   
  +        boolean rotated = (fobj.getReferenceOrientation() % 180 != 0); 
//vals[0] == 0.0;
           referenceIPD = context.getRefIPD();
  -        int bpd = context.getStackLimit().opt;
  -        if (width.getEnum() != EN_AUTO) {
  -            referenceIPD = width.getValue();
  -        }
  +        int maxbpd = context.getStackLimit().opt;
  +        int allocBPD, allocIPD;
           if (height.getEnum() != EN_AUTO) {
  -            bpd = height.getValue();
  +            allocBPD = height.getValue(); //this is the content-height
  +            allocBPD += getBPIndents();
  +        } else {
  +            allocBPD = maxbpd;
  +        }
  +        if (width.getEnum() != EN_AUTO) {
  +            allocIPD = width.getValue(); //this is the content-width
  +            allocIPD += getIPIndents();
  +        } else {
  +            allocIPD = referenceIPD;
           }
  -        int contentIPD = referenceIPD - getIPIndents();
  +
  +        vpContentBPD = allocBPD - getBPIndents();
  +        vpContentIPD = allocIPD - getIPIndents();
  +        
  +        double contentRectOffsetX = 0;
  +        contentRectOffsetX += 
fobj.getCommonMarginBlock().startIndent.getValue();
  +        double contentRectOffsetY = 0;
  +        //contentRectOffsetY += 
fobj.getCommonMarginBlock().startIndent.getValue();
  +        contentRectOffsetY += getSpaceBefore();
  +        contentRectOffsetY += 
fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
  +        contentRectOffsetY += 
fobj.getCommonBorderPaddingBackground().getPaddingBefore(false);
           
  -        Rectangle2D rect = new Rectangle2D.Double(0, 0, contentIPD, bpd);
  +        Rectangle2D rect = new Rectangle2D.Double(
  +                contentRectOffsetX, contentRectOffsetY, 
  +                vpContentIPD, vpContentBPD);
           relDims = new FODimension(0, 0);
           absoluteCTM = CTM.getCTMandRelDims(fobj.getReferenceOrientation(),
                   fobj.getWritingMode(), rect, relDims);
           double[] vals = absoluteCTM.toArray();
   
           MinOptMax stackLimit;
  -        boolean rotated = vals[0] == 0.0;
           if (rotated) {
               // rotated 90 degrees
  +            /*
               if (relDims.ipd > context.getRefIPD()) {
                   relDims.ipd = context.getRefIPD();
  -            }
  -            stackLimit = new MinOptMax(relDims.ipd);
  +            }*/
  +            //stackLimit = new MinOptMax(relDims.ipd);
  +            /*
               if (width.getEnum() == EN_AUTO) {
                   relDims.bpd = context.getStackLimit().opt;
               }
               absoluteCTM = new CTM(vals[0], vals[1], vals[2], vals[3], 0, 0);
  +            */
  +            //absoluteCTM = new CTM(vals[0], vals[1], vals[2], vals[3], 
vals[5], vals[4]);
           } else {
  +            /*
               if (vals[0] == -1.0) {
                   absoluteCTM = new CTM(vals[0], vals[1], vals[2], vals[3], 0, 
0);
  -            }
  -            stackLimit = context.getStackLimit();
  +            }*/
  +            //stackLimit = context.getStackLimit();
           }
  +        stackLimit = new MinOptMax(relDims.bpd);
   
           LayoutManager curLM; // currently active LM
   
  @@ -216,10 +209,11 @@
           // stackSize.add(spaceBefore);
           BreakPoss lastPos = null;
   
  -        fobj.setLayoutDimension(PercentBase.BLOCK_IPD, contentIPD);
  -        fobj.setLayoutDimension(PercentBase.BLOCK_BPD, bpd);
  -        fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, contentIPD);
  -        fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, bpd);
  +        //TODO fix layout dimensions!
  +        fobj.setLayoutDimension(PercentBase.BLOCK_IPD, allocIPD);
  +        fobj.setLayoutDimension(PercentBase.BLOCK_BPD, allocBPD);
  +        fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, relDims.ipd);
  +        fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, relDims.bpd);
   
           while ((curLM = getChildLM()) != null) {
               // Make break positions and return blocks!
  @@ -230,7 +224,7 @@
                   childLC.setStackLimit(
                     MinOptMax.subtract(stackLimit,
                                        stackSize));
  -                childLC.setRefIPD(contentIPD);
  +                childLC.setRefIPD(relDims.ipd);
   
               boolean over = false;
               while (!curLM.isFinished()) {
  @@ -274,20 +268,94 @@
               BreakPoss breakPoss;
               breakPoss = new BreakPoss(new LeafPosition(this,
                                                  childBreaks.size() - 1));
  -            breakPoss.setStackingSize(new MinOptMax(contentIPD));
  +            breakPoss.setStackingSize(new MinOptMax(relDims.ipd));
               return breakPoss;
           }
           return null;
       }
   
  +    private Point getAbsOffset() {
  +        int x = 0;
  +        int y = 0;
  +        if (abProps.left.getEnum() != EN_AUTO) {
  +            x = abProps.left.getValue();
  +        }
  +        if (abProps.top.getEnum() != EN_AUTO) {
  +            y = abProps.top.getValue();
  +        }
  +        return new Point(x, y);
  +    }
  +    
  +    /**
  +     * Generate and return the next break possibility for absolutely 
positioned
  +     * block-containers.
  +     * @param context LayoutContext to work with
  +     * @return the next break position
  +     * @see 
org.apache.fop.layoutmgr.LayoutManager#getNextBreakPoss(org.apache.fop.layoutmgr.LayoutContext)
  +     */
       public BreakPoss getAbsoluteBreakPoss(LayoutContext context) {
   
           LayoutManager curLM ; // currently active LM
   
           MinOptMax stackSize = new MinOptMax();
   
  -        int ipd = relDims.ipd;
  +        Point offset = getAbsOffset();
  +        int allocBPD, allocIPD;
  +        if (height.getEnum() != EN_AUTO) {
  +            allocBPD = height.getValue(); //this is the content-height
  +            allocBPD += getBPIndents();
  +        } else {
  +            allocBPD = 0;
  +            if (abProps.bottom.getEnum() != EN_AUTO) {
  +                if (isFixed()) {
  +                    allocBPD = 
(int)getPageViewport().getViewArea().getHeight();
  +                } else {
  +                    allocBPD = context.getStackLimit().opt; 
  +                }
  +                allocBPD -= offset.y;
  +                if (abProps.bottom.getEnum() != EN_AUTO) {
  +                    allocBPD -= abProps.bottom.getValue();
  +                }
  +            }
  +        }
  +        if (width.getEnum() != EN_AUTO) {
  +            allocIPD = width.getValue(); //this is the content-width
  +            allocIPD += getIPIndents();
  +        } else {
  +            if (isFixed()) {
  +                allocIPD = (int)getPageViewport().getViewArea().getWidth(); 
  +            } else {
  +                allocIPD = context.getRefIPD();
  +            }
  +            if (abProps.left.getEnum() != EN_AUTO) {
  +                allocIPD -= abProps.left.getValue();
  +            }
  +            if (abProps.right.getEnum() != EN_AUTO) {
  +                allocIPD -= abProps.right.getValue();
  +            }
  +        }
  +
  +        vpContentBPD = allocBPD - getBPIndents();
  +        vpContentIPD = allocIPD - getIPIndents();
  +        
  +        double contentRectOffsetX = offset.getX();
  +        contentRectOffsetX += 
fobj.getCommonMarginBlock().startIndent.getValue();
  +        double contentRectOffsetY = offset.getY();
  +        contentRectOffsetY += getSpaceBefore();
  +        contentRectOffsetY += 
fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
  +        contentRectOffsetY += 
fobj.getCommonBorderPaddingBackground().getPaddingBefore(false);
  +        
  +        Rectangle2D rect = new Rectangle2D.Double(
  +                contentRectOffsetX, contentRectOffsetY, 
  +                vpContentIPD, vpContentBPD);
  +        relDims = new FODimension(0, 0);
  +        absoluteCTM = CTM.getCTMandRelDims(
  +                fobj.getReferenceOrientation(),
  +                fobj.getWritingMode(), 
  +                rect, relDims);
  +        //referenceIPD = relDims.ipd + getIPIndents();
   
  +        
           while ((curLM = getChildLM()) != null) {
               // Make break positions and return blocks!
               // Set up a LayoutContext
  @@ -295,7 +363,7 @@
   
               LayoutContext childLC = new LayoutContext(0);
               childLC.setStackLimit(new MinOptMax(1000000));
  -            childLC.setRefIPD(ipd);
  +            childLC.setRefIPD(relDims.ipd);
   
               while (!curLM.isFinished()) {
                   if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
  @@ -364,26 +432,41 @@
       public Area getParentArea(Area childArea) {
           if (curBlockArea == null) {
               viewportBlockArea = new BlockViewport();
  +            viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
               TraitSetter.addBorders(viewportBlockArea, 
fobj.getCommonBorderPaddingBackground());
               TraitSetter.addBackground(viewportBlockArea, 
fobj.getCommonBorderPaddingBackground());
  +            TraitSetter.addMargins(viewportBlockArea, null, 
  +                    fobj.getCommonBorderPaddingBackground(),
  +                    fobj.getCommonMarginBlock());
               
  +            viewportBlockArea.setCTM(absoluteCTM);
  +            viewportBlockArea.setIPD(vpContentIPD);
  +            viewportBlockArea.setBPD(vpContentBPD);
  +            viewportBlockArea.setClip(clip);
  +            viewportBlockArea.addTrait(Trait.SPACE_BEFORE, new 
Integer(getSpaceBefore()));
  +
               if (abProps.absolutePosition == EN_ABSOLUTE 
                       || abProps.absolutePosition == EN_FIXED) {
  -                viewportBlockArea.setXOffset(abProps.left.getValue());
  -                viewportBlockArea.setYOffset(abProps.top.getValue());
  -                viewportBlockArea.setIPD(width.getValue());
  -                viewportBlockArea.setBPD(height.getValue());
  -
  -                viewportBlockArea.setCTM(absoluteCTM);
  -                viewportBlockArea.setClip(clip);
  +                Point offset = getAbsOffset();
  +                viewportBlockArea.setXOffset(offset.x);
  +                viewportBlockArea.setYOffset(offset.y);
                   autoHeight = false;
               } else {
  -                double[] vals = absoluteCTM.toArray();
  +                //double[] vals = absoluteCTM.toArray();
  +                boolean rotated = (fobj.getReferenceOrientation() % 180 != 
0); //vals[0] == 0.0;
  +                if (rotated) {
  +                    autoHeight = false;
  +                } else {
  +                    autoHeight = (height.getEnum() == EN_AUTO);
  +                    if (autoHeight) {
  +                        viewportBlockArea.setBPD(0);
  +                    }
  +                }
  +                /*
                   boolean rotated = vals[0] == 0.0;
                   if (rotated) {
  -                    viewportBlockArea.setIPD(relDims.ipd);
  -                    viewportBlockArea.setBPD(relDims.bpd);
  -                    viewportBlockArea.setCTM(absoluteCTM);
  +                    viewportBlockArea.setIPD(vpContentIPD);
  +                    viewportBlockArea.setBPD(vpContentBPD);
                       viewportBlockArea.setClip(clip);
                       autoHeight = false;
                   } else if (vals[0] == -1.0) {
  @@ -394,7 +477,6 @@
                           viewportBlockArea.setBPD(relDims.bpd);
                           autoHeight = false;
                       }
  -                    viewportBlockArea.setCTM(absoluteCTM);
                       viewportBlockArea.setClip(clip);
                   } else {
                       viewportBlockArea.setIPD(relDims.ipd);
  @@ -402,10 +484,11 @@
                           viewportBlockArea.setBPD(relDims.bpd);
                           autoHeight = false;
                       }
  -                }
  +                }*/
               }
   
               curBlockArea = new Block();
  +            curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
   
               if (abProps.absolutePosition == EN_ABSOLUTE) {
                   viewportBlockArea.setPositioning(Block.ABSOLUTE);
  
  
  
  1.8       +8 -7      
xml-fop/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java
  
  Index: CorrespondingPropertyMaker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CorrespondingPropertyMaker.java   28 Oct 2004 10:00:24 -0000      1.7
  +++ CorrespondingPropertyMaker.java   17 Jan 2005 10:38:02 -0000      1.8
  @@ -76,13 +76,14 @@
           }
           
           PropertyList pList = getWMPropertyList(propertyList);
  -        int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
  +        if (pList != null) {
  +            int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
           
  -        if (pList.getExplicit(correspondingId) != null) {
  -            return true;
  -        } else {
  -            return false;
  -        }
  +            if (pList.getExplicit(correspondingId) != null) {
  +                return true;
  +            }
  +        } 
  +        return false;
       }
       
       /**
  
  
  
  1.11      +21 -5     
xml-fop/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
  
  Index: IndentPropertyMaker.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- IndentPropertyMaker.java  12 Jan 2005 11:38:00 -0000      1.10
  +++ IndentPropertyMaker.java  17 Jan 2005 10:38:02 -0000      1.11
  @@ -69,6 +69,9 @@
        */
       public Property compute(PropertyList propertyList) throws 
PropertyException {
           PropertyList pList = getWMPropertyList(propertyList);
  +        if (pList == null) {
  +            return null;
  +        }
           // Calculate the values as described in 5.3.2.
   
           Numeric padding = getCorresponding(paddingCorresponding, 
propertyList).getNumeric();
  @@ -80,7 +83,14 @@
           if (propertyList.getExplicitOrShorthand(marginProp) == null) {
               Property indent = propertyList.getExplicit(baseMaker.propId);
               if (indent == null) {
  -                margin = new FixedLength(0);
  +                //Neither start-indent nor margin is specified, use inherited
  +                //margin = new FixedLength(0);
  +                /*
  +                Numeric v = new FixedLength(0);
  +                v = NumericOp.addition(v, 
propertyList.getInherited(baseMaker.propId).getNumeric());
  +                return (Property)v;
  +                */
  +                return null;
               } else {
                   margin = 
propertyList.getExplicit(baseMaker.propId).getNumeric();
                   margin = NumericOp.subtraction(margin, 
  @@ -95,7 +105,9 @@
           Numeric v = new FixedLength(0);
           if (!propertyList.getFObj().generatesReferenceAreas()) {
               // The inherited_value_of([start|end]-indent)
  -            v = NumericOp.addition(v, 
propertyList.getInherited(baseMaker.propId).getNumeric());
  +            //if (!propertyList.getParentFObj().generatesReferenceAreas()) {
  +                v = NumericOp.addition(v, 
propertyList.getInherited(baseMaker.propId).getNumeric());
  +            //}
           }
           // The corresponding absolute margin-[right|left}.
           v = NumericOp.addition(v, margin);
  @@ -107,7 +119,11 @@
       private Property getCorresponding(int[] corresponding, PropertyList 
propertyList)
                   throws PropertyException {
           PropertyList pList = getWMPropertyList(propertyList);
  -        int wmcorr = pList.getWritingMode(corresponding[0], 
corresponding[1], corresponding[2]);
  -        return propertyList.get(wmcorr);
  +        if (pList != null) {
  +            int wmcorr = pList.getWritingMode(corresponding[0], 
corresponding[1], corresponding[2]);
  +            return propertyList.get(wmcorr);
  +        } else {
  +            return null;
  +        }
       }
   }
  
  
  
  1.41      +1 -1      
xml-fop/src/java/org/apache/fop/render/AbstractRenderer.java
  
  Index: AbstractRenderer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/AbstractRenderer.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- AbstractRenderer.java     12 Jan 2005 12:03:00 -0000      1.40
  +++ AbstractRenderer.java     17 Jan 2005 10:38:02 -0000      1.41
  @@ -466,7 +466,7 @@
           int saveBP = currentBPPosition;
   
           // Calculate the position of the content rectangle.
  -        if (parent != null) {
  +        if (parent != null && 
!Boolean.TRUE.equals(parent.getTrait(Trait.IS_VIEWPORT_AREA))) {
               currentBPPosition += parent.getBorderAndPaddingWidthBefore();
               /* This is unnecessary now as we're going to use the *-indent 
traits
               currentIPPosition += parent.getBorderAndPaddingWidthStart();
  
  
  
  1.68      +37 -15    
xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- PDFRenderer.java  13 Jan 2005 00:06:25 -0000      1.67
  +++ PDFRenderer.java  17 Jan 2005 10:38:02 -0000      1.68
  @@ -675,6 +675,11 @@
           String saveFontName = currentFontName;
   
           CTM ctm = bv.getCTM();
  +        int borderPaddingStart = bv.getBorderAndPaddingWidthStart();
  +        int borderPaddingBefore = bv.getBorderAndPaddingWidthBefore();
  +        float x,y;
  +        x = (float)(bv.getXOffset() + containingIPPosition) / 1000f;
  +        y = (float)(bv.getYOffset() + containingBPPosition) / 1000f;
   
           if (bv.getPositioning() == Block.ABSOLUTE
                   || bv.getPositioning() == Block.FIXED) {
  @@ -684,28 +689,30 @@
               ctm = tempctm.multiply(ctm);
               getLogger().debug("tempctm=" + tempctm + " ctm=" + ctm);
   
  -            float x,y;
  -            x = (float)(bv.getXOffset() + containingIPPosition) / 1000f;
  -            y = (float)(bv.getYOffset() + containingBPPosition) / 1000f;
  +            //This is the content-rect
               float width = (float)bv.getIPD() / 1000f;
               float height = (float)bv.getBPD() / 1000f;
               getLogger().debug("renderBlockViewport: x=" + x + " y=" + y + " 
width=" + width + " height=" + height);
               
  -            int borderPaddingStart = bv.getBorderAndPaddingWidthStart();
  -            int borderPaddingBefore = bv.getBorderAndPaddingWidthBefore();
  -
  +            //Adjust for spaces (from margin or indirectly by start-indent 
etc.
               Integer spaceStart = (Integer) bv.getTrait(Trait.SPACE_START);
               if (spaceStart != null) {
                   x += spaceStart.floatValue() / 1000;
               }
  +            Integer spaceBefore = (Integer) bv.getTrait(Trait.SPACE_BEFORE);
  +            if (spaceBefore != null) {
  +                y += spaceBefore.floatValue() / 1000;
  +            }
   
  -            width += borderPaddingStart / 1000f;
  -            width += bv.getBorderAndPaddingWidthEnd() / 1000f;
  -            height += borderPaddingBefore / 1000f;
  -            height += bv.getBorderAndPaddingWidthAfter() / 1000f;
  +            float bpwidth = (borderPaddingStart + 
bv.getBorderAndPaddingWidthEnd()) / 1000f;
  +            float bpheight = (borderPaddingBefore + 
bv.getBorderAndPaddingWidthAfter()) / 1000f;
   
  -            drawBackAndBorders(bv, x, y, width, height);
  +            drawBackAndBorders(bv, x, y, width + bpwidth, height + bpheight);
   
  +            //Now adjust for border/padding
  +            x += borderPaddingStart / 1000f;
  +            y += borderPaddingBefore / 1000f;
  +            
               if (bv.getClip()) {
                   saveGraphicsState();
                   clip(x, y, width, height);
  @@ -729,6 +736,17 @@
               currentBPPosition = saveBP;
           } else {
   
  +            Integer spaceBefore = (Integer)bv.getTrait(Trait.SPACE_BEFORE);
  +            if (spaceBefore != null) {
  +                currentBPPosition += spaceBefore.intValue();
  +            }
  +
  +            //borders and background in the old coordinate system
  +            handleBlockTraits(bv);
  +
  +            CTM tempctm = new CTM(containingIPPosition, currentBPPosition + 
containingBPPosition);
  +            ctm = tempctm.multiply(ctm);
  +            /*
               if (ctm != null) {
                   double[] vals = ctm.toArray();
                   //boolean aclock = vals[2] == 1.0;
  @@ -737,21 +755,25 @@
                   } else if (vals[0] == -1.0) {
                       ctm = ctm.translate(-saveIP - bv.getIPD(), -saveBP - 
bv.getBPD());
                   } else {
  -                    ctm = ctm.translate(saveBP, saveIP - bv.getIPD());
  +                    //ctm = ctm.translate(saveBP, saveIP - bv.getIPD());
  +                    //ctm = ctm.translate(saveIP, saveBP);
                   }
               }
  +            ctm = new CTM().translate(saveIP, saveBP).multiply(ctm);
  +            */
  +            
  +            //Now adjust for border/padding
  +            x += borderPaddingStart / 1000f;
  +            y += borderPaddingBefore / 1000f;
   
               // clip if necessary
               if (bv.getClip()) {
                   saveGraphicsState();
  -                float x = (float)bv.getXOffset() / 1000f;
  -                float y = (float)bv.getYOffset() / 1000f;
                   float width = (float)bv.getIPD() / 1000f;
                   float height = (float)bv.getBPD() / 1000f;
                   clip(x, y, width, height);
               }
   
  -            handleBlockTraits(bv);
               if (ctm != null) {
                   startVParea(ctm);
                   currentIPPosition = 0;
  
  
  

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

Reply via email to