xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r634267 [6/39] - in /xmlgraphics/fop/branches/Temp_ProcessingFeedback: ./ examples/embedding/ examples/embedding/java/embedding/ examples/embedding/java/embedding/intermediate/ examples/embedding/xml/xml/ examples/fo/ examples/fo/advanced/ ...
Date Thu, 06 Mar 2008 13:34:59 GMT
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java Thu Mar  6 05:33:44 2008
@@ -68,12 +68,9 @@
     /** Counter, increased every time a non-white-space is encountered */
     private int nonWhiteSpaceCount;
     
-    private Block currentBlock;
-    private FObj currentFO;
     private int linefeedTreatment;
     private int whiteSpaceTreatment;
     private int whiteSpaceCollapse;
-    private FONode nextChild;
     private boolean endOfBlock;
     private boolean nextChildIsBlockLevel;
     private RecursiveCharIterator charIter;
@@ -87,19 +84,28 @@
      * firstTextNode
      * @param fo    the FO for which to handle white-space
      * @param firstTextNode the node at which to start
+     * @param nextChild the node that will be added to the list
+     *                  after firstTextNode
      */
-    public void handleWhiteSpace(FObjMixed fo, FONode firstTextNode) {
+    public void handleWhiteSpace(FObjMixed fo, FONode firstTextNode, FONode nextChild) {
         
+        Block currentBlock = null;
         int foId = fo.getNameId();
         
         if (foId == Constants.FO_BLOCK) {
-            if (nextChild != null && currentBlock != null) {
-                /* if already in a block, push the current block 
-                 * onto the stack of nested blocks
-                 */
-                nestedBlockStack.push(currentBlock);
-            }
             currentBlock = (Block) fo;
+            if (nestedBlockStack.isEmpty() || fo != nestedBlockStack.peek()) {
+                if (nextChild != null) {
+                    /* if already in a block, push the current block 
+                     * onto the stack of nested blocks
+                     */
+                    nestedBlockStack.push(currentBlock);
+                }
+            } else {
+                if (nextChild == null) {
+                    nestedBlockStack.pop();
+                }
+            }
         } else if (foId == Constants.FO_RETRIEVE_MARKER) {
             /* look for the nearest block ancestor, if any */
             FONode ancestor = fo;
@@ -111,6 +117,8 @@
             if (ancestor.getNameId() == Constants.FO_BLOCK) {
                 currentBlock = (Block) ancestor;
             }
+        } else if (!nestedBlockStack.isEmpty()) {
+            currentBlock = (Block) nestedBlockStack.peek();
         }
         
         if (currentBlock != null) {
@@ -123,8 +131,6 @@
             whiteSpaceTreatment = Constants.EN_IGNORE_IF_SURROUNDING_LINEFEED;
         }
         
-        currentFO = fo;
-
         if (firstTextNode == null) {
             //nothing to do but initialize related properties
             return;
@@ -133,20 +139,20 @@
         charIter = new RecursiveCharIterator(fo, firstTextNode);
         inWhiteSpace = false;
         
-        if (currentFO == currentBlock
+        if (fo == currentBlock
                 || currentBlock == null
                 || (foId == Constants.FO_RETRIEVE_MARKER
-                        && currentFO.getParent() == currentBlock)) {
+                        && fo.getParent() == currentBlock)) {
             afterLinefeed = (
                     (firstTextNode == fo.firstChild)
                         || (firstTextNode.siblings[0].getNameId()
                                 == Constants.FO_BLOCK));
         }
         
-        endOfBlock = (nextChild == null && currentFO == currentBlock);
+        endOfBlock = (nextChild == null && fo == currentBlock);
         
         if (nextChild != null) {
-            int nextChildId = this.nextChild.getNameId();
+            int nextChildId = nextChild.getNameId();
             nextChildIsBlockLevel = (
                     nextChildId == Constants.FO_BLOCK
                     || nextChildId == Constants.FO_TABLE_AND_CAPTION
@@ -159,7 +165,7 @@
         
         handleWhiteSpace();
         
-        if (currentFO == currentBlock 
+        if (fo == currentBlock 
                 && pendingInlines != null 
                 && !pendingInlines.isEmpty()) {
             /* current FO is a block, and has pending inlines */
@@ -183,7 +189,7 @@
         }
         
         if (nextChild == null) {
-            if (currentFO != currentBlock) {
+            if (fo != currentBlock) {
                 /* current FO is not a block, and is about to end */
                 if (nonWhiteSpaceCount > 0 && pendingInlines != null) {
                     /* there is non-white-space text between the pending 
@@ -204,7 +210,6 @@
                 } else {
                     currentBlock = null;
                 }
-                currentFO = null;
                 charIter = null;
             }
         }
@@ -218,10 +223,8 @@
      * @param nextChild the child-node that will be added to the list after
      *                  the last text-node
      */
-    public void handleWhiteSpace(FObjMixed fo, FONode firstTextNode, FONode nextChild) {
-        this.nextChild = nextChild;
-        handleWhiteSpace(fo, firstTextNode);
-        this.nextChild = null;
+    public void handleWhiteSpace(FObjMixed fo, FONode firstTextNode) {
+        handleWhiteSpace(fo, firstTextNode, null);
     }
     
     private void handleWhiteSpace() {

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/CMYKcolorFunction.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/ICCColorFunction.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/ICCColorFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/ICCColorFunction.java Thu Mar  6 05:33:44 2008
@@ -18,7 +18,8 @@
 /* $Id$ */
  
 package org.apache.fop.fo.expr;
-import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.pagination.ColorProfile;
 import org.apache.fop.fo.pagination.Declarations;
 import org.apache.fop.fo.properties.ColorProperty;
@@ -39,39 +40,84 @@
     }
     
     /** {@inheritDoc} */
+    public PercentBase getPercentBase() {
+        return new ICCPercentBase();
+    }
+
+    /** {@inheritDoc} */
     public Property eval(Property[] args,
                          PropertyInfo pInfo) throws PropertyException {
-        StringBuffer sb = new StringBuffer();
-
         // Map color profile NCNAME to src from declarations/color-profile element
         String colorProfileName = args[3].getString();
         Declarations decls = pInfo.getFO().getRoot().getDeclarations();
-        ColorProfile cp = decls.getColorProfile(colorProfileName);
-        if (cp == null) {
-            PropertyException pe = new PropertyException("The " + colorProfileName 
-                    + " color profile was not declared");
-            pe.setPropertyInfo(pInfo);
-            throw pe;
+        ColorProfile cp = null;
+        if (decls == null) {
+            //function used in a color-specification 
+            //on a FO occurring:
+            //a) before the fo:declarations,
+            //b) or in a document without fo:declarations?
+            //=> return the sRGB fallback
+            Property[] rgbArgs = new Property[3];
+            System.arraycopy(args, 0, rgbArgs, 0, 3);
+            return new RGBColorFunction().eval(rgbArgs, pInfo);
+        } else {
+            cp = decls.getColorProfile(colorProfileName);
+            if (cp == null) {
+                PropertyException pe = new PropertyException("The " + colorProfileName 
+                        + " color profile was not declared");
+                pe.setPropertyInfo(pInfo);
+                throw pe;
+            }
         }
         String src = cp.getSrc();
         
+        float red = 0, green = 0, blue = 0;
+        red = args[0].getNumber().floatValue();
+        green = args[1].getNumber().floatValue();
+        blue = args[2].getNumber().floatValue();
+        /* Verify rgb replacement arguments */
+        if ((red < 0 || red > 255) 
+                || (green < 0 || green > 255) 
+                || (blue < 0 || blue > 255)) {
+            throw new PropertyException("Color values out of range. "
+                    + "Arguments to rgb-icc() must be [0..255] or [0%..100%]");
+        }
+        
         // rgb-icc is replaced with fop-rgb-icc which has an extra fifth argument containing the 
         // color profile src attribute as it is defined in the color-profile declarations element.
-        sb.append("fop-rgb-icc(" + args[0]);
-        for (int ix = 1; ix < args.length; ix++) {
+        StringBuffer sb = new StringBuffer();
+        sb.append("fop-rgb-icc(");
+        sb.append(red / 255f);
+        sb.append(',').append(green / 255f);
+        sb.append(',').append(blue / 255f);
+        for (int ix = 3; ix < args.length; ix++) {
             if (ix == 3) {
-                sb.append("," + colorProfileName); 
-                sb.append(",\"" + src + "\""); 
+                sb.append(',').append(colorProfileName); 
+                sb.append(',').append(src); 
             } else {
-                sb.append("," + args[ix]);
+                sb.append(',').append(args[ix]);
             }
         }
         sb.append(")");
-        FOUserAgent ua = (pInfo == null
-                ? null
-                : (pInfo.getFO() == null ? null : pInfo.getFO().getUserAgent()));
-        return ColorProperty.getInstance(ua, sb.toString());
+        
+        return ColorProperty.getInstance(pInfo.getUserAgent(), sb.toString());
     }
 
+    private static final class ICCPercentBase implements PercentBase {
+        
+        /** {@inheritDoc} */
+        public int getBaseLength(PercentBaseContext context) throws PropertyException {
+            return 0;
+        }
+
+        /** {@inheritDoc} */
+        public double getBaseValue() {
+            return 255f;
+        }
 
+        /** {@inheritDoc} */
+        public int getDimension() {
+            return 0;
+        }
+    }
 }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/NumericOp.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/NumericProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/NumericProperty.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/NumericProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/NumericProperty.java Thu Mar  6 05:33:44 2008
@@ -25,6 +25,7 @@
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.fo.properties.FixedLength;
 import org.apache.fop.fo.properties.Property;
 
 /**
@@ -121,7 +122,7 @@
     /** {@inheritDoc} */
     public String toString() {
         if (dim == 1) {
-            return (int) value + "mpt";
+            return (int) value + FixedLength.MPT;
         } else {
             return value + "^" + dim;
         }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java Thu Mar  6 05:33:44 2008
@@ -19,6 +19,8 @@
 
 package org.apache.fop.fo.expr;
 
+import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.flow.table.Table;
 import org.apache.fop.fo.properties.Property;
@@ -38,6 +40,13 @@
         return 1;
     }
 
+    /** 
+     * @return the {@link PercentBase} for the proportional-column-width() 
+     *         function
+     */
+    public PercentBase getPercentBase() {
+        return new PPColWidthPercentBase();
+    }
     /**
      *
      * @param args array of arguments for this function
@@ -69,4 +78,24 @@
         return new TableColLength(d.doubleValue(), pInfo.getFO());
     }
 
+    private static class PPColWidthPercentBase implements PercentBase {
+
+        /** {@inheritDoc} */
+        public int getBaseLength(PercentBaseContext context) throws PropertyException {
+            return 0;
+        }
+
+        /** {@inheritDoc} */
+        public double getBaseValue() {
+            //make sure percentage-arguments are interpreted
+            //as numerics (1% = 1 * 0.01)
+            return 1;
+        }
+
+        /** {@inheritDoc} */
+        public int getDimension() {
+            return 0;
+        }
+        
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyException.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyException.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyException.java Thu Mar  6 05:33:44 2008
@@ -36,11 +36,22 @@
     }
 
     /**
+     * Constructor
+     * @param the Exception causing this PropertyException
+     */
+    public PropertyException(Exception cause) {
+        super(cause);
+        if (cause instanceof PropertyException) {
+            this.propertyName = ((PropertyException)cause).propertyName;
+        }
+    }
+    
+    /**
      * Sets the property context information.
      * @param propInfo the property info instance
      */
     public void setPropertyInfo(PropertyInfo propInfo) {
-        setLocator(propInfo.getFO().getLocator());
+        setLocator(propInfo.getPropertyList().getFObj().getLocator());
         propertyName = propInfo.getPropertyMaker().getName();
     }
 

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyInfo.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyInfo.java Thu Mar  6 05:33:44 2008
@@ -21,6 +21,7 @@
 
 import java.util.Stack;
 
+import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.PercentBase;
 import org.apache.fop.fo.Constants;
@@ -114,6 +115,17 @@
         }
     }
 
+    /**
+     * Convenience shortcut to get a reference to the FOUserAgent
+     * 
+     * @return  the FOUserAgent
+     */
+    protected FOUserAgent getUserAgent() {
+        return (plist.getFObj() != null) 
+            ? plist.getFObj().getUserAgent() 
+                    : null;
+    }
+    
     private PercentBase getFunctionPercentBase() {
         if (stkFunction != null) {
             Function f = (Function)stkFunction.peek();

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyParser.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyParser.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/PropertyParser.java Thu Mar  6 05:33:44 2008
@@ -19,7 +19,8 @@
 
 package org.apache.fop.fo.expr;
 
-import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.LengthBase;
 import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.datatypes.PercentBase;
 import org.apache.fop.fo.properties.ColorProperty;
@@ -44,7 +45,7 @@
 
     private static final String RELUNIT = "em";
     private static final HashMap FUNCTION_TABLE = new HashMap();
-
+    
     static {
         // Initialize the HashMap of XSL-defined functions
         FUNCTION_TABLE.put("ceiling", new CeilingFunction());
@@ -266,13 +267,28 @@
              * Get the length base value object from the Maker. If null, then
              * this property can't have % values. Treat it as a real number.
              */
-            double pcval = new Double(currentTokenValue.substring(0,
-                        currentTokenValue.length() - 1)).doubleValue() / 100.0;
+            double pcval = Double.parseDouble(
+                    currentTokenValue.substring(0, currentTokenValue.length() - 1)) / 100.0;
             PercentBase pcBase = this.propInfo.getPercentBase();
             if (pcBase != null) {
                 if (pcBase.getDimension() == 0) {
                     prop = NumberProperty.getInstance(pcval * pcBase.getBaseValue());
                 } else if (pcBase.getDimension() == 1) {
+                    if (pcBase instanceof LengthBase) {
+                        if (pcval == 0.0) {
+                            prop = FixedLength.ZERO_FIXED_LENGTH;
+                            break;
+                        }
+
+                        //If the base of the percentage is known
+                        //and absolute, it can be resolved by the
+                        //parser
+                        Length base = ((LengthBase)pcBase).getBaseLength();
+                        if (base != null && base.isAbsolute()) {
+                            prop = FixedLength.getInstance(pcval * base.getValue());
+                            break;
+                        }
+                    }
                     prop = new PercentLength(pcval, pcBase);
                 } else {
                     throw new PropertyException("Illegal percent dimension value");
@@ -287,22 +303,28 @@
             // A number plus a valid unit name.
             int numLen = currentTokenValue.length() - currentUnitLength;
             String unitPart = currentTokenValue.substring(numLen);
-            Double numPart = new Double(currentTokenValue.substring(0,
-                    numLen));
-            if (unitPart.equals(RELUNIT)) {
+            double numPart = Double.parseDouble(currentTokenValue.substring(0, numLen));
+            if (RELUNIT.equals(unitPart)) {
                 prop = (Property) NumericOp.multiply(
-                                    NumberProperty.getInstance(numPart.doubleValue()),
+                                    NumberProperty.getInstance(numPart),
                                     propInfo.currentFontSize());
             } else {
-                prop = FixedLength.getInstance(numPart.doubleValue(), unitPart);
+                if ("px".equals(unitPart)) {
+                    //pass the ratio between source-resolution and 
+                    //the default resolution of 72dpi
+                    prop = FixedLength.getInstance(
+                            numPart, unitPart, 
+                            propInfo.getPropertyList().getFObj()
+                                    .getUserAgent().getSourceResolution() / 72.0f);
+                } else {
+                    //use default resolution of 72dpi
+                    prop = FixedLength.getInstance(numPart, unitPart);
+                }
             }
             break;
 
         case TOK_COLORSPEC:
-            FOUserAgent ua = (propInfo == null) 
-                ? null
-                : (propInfo.getFO() == null ? null : propInfo.getFO().getUserAgent());
-            prop = ColorProperty.getInstance(ua, currentTokenValue);
+            prop = ColorProperty.getInstance(propInfo.getUserAgent(), currentTokenValue);
             break;
 
         case TOK_FUNCTION_LPAR:

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/RGBColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/RGBColorFunction.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/RGBColorFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/RGBColorFunction.java Thu Mar  6 05:33:44 2008
@@ -19,7 +19,6 @@
  
 package org.apache.fop.fo.expr;
 
-import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.datatypes.PercentBase;
 import org.apache.fop.fo.properties.ColorProperty;
@@ -47,14 +46,13 @@
     /** {@inheritDoc} */
     public Property eval(Property[] args,
                          PropertyInfo pInfo) throws PropertyException {
-      FOUserAgent ua = (pInfo == null) 
-              ? null 
-              : (pInfo.getFO() == null ? null : pInfo.getFO().getUserAgent());
-      return ColorProperty.getInstance(ua, "rgb(" + args[0] + "," + args[1] + "," + args[2] + ")");
+      return ColorProperty.getInstance(pInfo.getUserAgent(), 
+                                       "rgb(" + args[0] + "," 
+                                       + args[1] + "," + args[2] + ")");
 
     }
 
-    static class RGBPercentBase implements PercentBase {
+    private static class RGBPercentBase implements PercentBase {
         public int getDimension() {
             return 0;
         }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/expr/SystemColorFunction.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/ExtensionObj.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/OldExtensionElementMapping.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/svg/SVGObj.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/xmp/AbstractMetadataElement.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/xmp/RDFElement.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/xmp/XMPContentHandlerFactory.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/xmp/XMPMetaElement.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/ExternalGraphic.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/ExternalGraphic.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/ExternalGraphic.java Thu Mar  6 05:33:44 2008
@@ -19,6 +19,7 @@
 
 package org.apache.fop.fo.flow;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 
 import org.xml.sax.Locator;
@@ -37,7 +38,8 @@
 import org.apache.fop.fo.properties.FixedLength;
 
 /**
- * Class modelling the fo:external-graphic object.
+ * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_external-graphic">
+ * <code>fo:external-graphic</code></a> object.
  * This FO node handles the external graphic. It creates an image
  * inline area that can be added to the area tree.
  */
@@ -63,9 +65,7 @@
         super(parent);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void bind(PropertyList pList) throws FOPException {
         super.bind(pList);
         src = pList.get(PR_SRC).getString();
@@ -79,6 +79,8 @@
             info = manager.getImageInfo(url, userAgent.getImageSessionContext());
         } catch (ImageException e) {
             log.error("Image not available: " + e.getMessage());
+        } catch (FileNotFoundException fnfe) {
+            log.error(fnfe.getMessage());
         } catch (IOException ioe) {
             log.error("I/O error while loading image: " + ioe.getMessage());
         }
@@ -87,15 +89,14 @@
             this.intrinsicHeight = info.getSize().getHeightMpt();
             int baseline = info.getSize().getBaselinePositionFromBottom();
             if (baseline != 0) {
-                this.intrinsicAlignmentAdjust = new FixedLength(-baseline);
+                this.intrinsicAlignmentAdjust
+                    = FixedLength.getInstance(-baseline);
             }
         }
         //TODO Report to caller so he can decide to throw an exception
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     protected void startOfNode() throws FOPException {
         super.startOfNode();
         getFOEventHandler().image(this);
@@ -103,23 +104,19 @@
 
     /**
      * {@inheritDoc}
-     * XSL Content Model: empty
+     * <br>XSL Content Model: empty
      */
     protected void validateChildNode(Locator loc, String nsURI, String localName) 
         throws ValidationException {
             invalidChildError(loc, nsURI, localName);
     }
 
-    /**
-     * @return the "src" property.
-     */
+    /** @return the "src" property */
     public String getSrc() {
         return src;
     }
 
-    /**
-     * @return Get the resulting URL based on the src property.
-     */
+    /** @return Get the resulting URL based on the src property */
     public String getURL() {
         return url;
     }
@@ -129,30 +126,22 @@
         return "external-graphic";
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public int getNameId() {
         return FO_EXTERNAL_GRAPHIC;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public int getIntrinsicWidth() {
         return this.intrinsicWidth;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public int getIntrinsicHeight() {
         return this.intrinsicHeight;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public Length getIntrinsicAlignmentAdjust() {
         return this.intrinsicAlignmentAdjust;
     }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/InlineLevel.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EffRow.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EffRow.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EffRow.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EffRow.java Thu Mar  6 05:33:44 2008
@@ -22,8 +22,10 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.fop.fo.Constants;
 import org.apache.fop.layoutmgr.table.TableRowIterator;
 import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.BreakUtil;
 
 /**
  * This class represents an effective row in a table and holds a list of grid units occupying
@@ -159,7 +161,108 @@
             throw new IllegalArgumentException("Illegal flag queried: " +  which);
         }
     }
-    
+
+    /**
+     * Returns true if the enclosing (if any) fo:table-row element of this row, or if any
+     * of the cells starting on this row, have keep-with-previous set.
+     * 
+     * @return true if this row must be kept with the previous content
+     */
+    public boolean mustKeepWithPrevious() {
+        boolean keepWithPrevious = false;
+        TableRow row = getTableRow();
+        if (row != null) {
+            keepWithPrevious = row.mustKeepWithPrevious();
+        }
+        for (Iterator iter = gridUnits.iterator(); iter.hasNext();) {
+            GridUnit gu = (GridUnit) iter.next();
+            if (gu.isPrimary()) {
+                keepWithPrevious |= gu.getPrimary().mustKeepWithPrevious();
+            }
+        }
+        return keepWithPrevious;
+    }
+
+    /**
+     * Returns true if the enclosing (if any) fo:table-row element of this row, or if any
+     * of the cells ending on this row, have keep-with-next set.
+     * 
+     * @return true if this row must be kept with the next content
+     */
+    public boolean mustKeepWithNext() {
+        boolean keepWithNext = false;
+        TableRow row = getTableRow();
+        if (row != null) {
+            keepWithNext = row.mustKeepWithNext();
+        }
+        for (Iterator iter = gridUnits.iterator(); iter.hasNext();) {
+            GridUnit gu = (GridUnit) iter.next();
+            if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) {
+                keepWithNext |= gu.getPrimary().mustKeepWithNext();
+            }
+        }
+        return keepWithNext;
+    }
+
+    /**
+     * Returns true if this row is enclosed by an fo:table-row element that has
+     * keep-together set.
+     * 
+     * @return true if this row must be kept together
+     */
+    public boolean mustKeepTogether() {
+        TableRow row = getTableRow();
+        return row != null && row.mustKeepTogether();
+    }
+
+    /**
+     * Returns the break class for this row. This is a combination of break-before set on
+     * the first children of any cells starting on this row.
+     * <p><strong>Note:</strong> this method doesn't take into account break-before set on
+     * the enclosing fo:table-row element, if any, as it must be ignored if the row
+     * belongs to a group of spanned rows (see XSL-FO 1.1, 7.20.2).
+     * <p><strong>Note:</strong> this works only after getNextKuthElements on the
+     * corresponding TableCellLM have been called!</p>
+     * 
+     * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
+     * Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
+     */
+    public int getBreakBefore() {
+        int breakBefore = Constants.EN_AUTO;
+        for (Iterator iter = gridUnits.iterator(); iter.hasNext();) {
+            GridUnit gu = (GridUnit) iter.next();
+            if (gu.isPrimary()) {
+                breakBefore = BreakUtil.compareBreakClasses(breakBefore,
+                        gu.getPrimary().getBreakBefore());
+            }
+        }
+        return breakBefore;
+    }
+
+    /**
+     * Returns the break class for this row. This is a combination of break-after set on
+     * the last children of any cells ending on this row.
+     * <p><strong>Note:</strong> this method doesn't take into account break-after set on
+     * the enclosing fo:table-row element, if any, as it must be ignored if the row
+     * belongs to a group of spanned rows (see XSL-FO 1.1, 7.20.1).
+     * <p><strong>Note:</strong> this works only after getNextKuthElements on the
+     * corresponding TableCellLM have been called!</p>
+     * 
+     * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
+     * Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
+     */
+    public int getBreakAfter() {
+        int breakAfter = Constants.EN_AUTO;
+        for (Iterator iter = gridUnits.iterator(); iter.hasNext();) {
+            GridUnit gu = (GridUnit) iter.next();
+            if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) {
+                breakAfter = BreakUtil.compareBreakClasses(breakAfter,
+                        gu.getPrimary().getBreakAfter());
+            }
+        }
+        return breakAfter;
+    }
+
     /** {@inheritDoc} */
     public String toString() {
         StringBuffer sb = new StringBuffer("EffRow {");

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EffRow.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java Thu Mar  6 05:33:44 2008
@@ -25,15 +25,14 @@
  */
 public class EmptyGridUnit extends GridUnit {
 
-    private TableBody body;
-
     /**
      * @param table the containing table
      * @param row the table-row element this grid unit belongs to (if any)
      * @param colIndex column index, 0-based
      */
     EmptyGridUnit(Table table, TableRow row, int colIndex) {
-        super(table, row, 0, 0);
+        super(table, 0, 0);
+        setRow(row);
     }
 
     /** {@inheritDoc} */
@@ -52,12 +51,7 @@
 
     /** {@inheritDoc} */
     public boolean isPrimary() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public TableBody getBody() {
-        return this.body;
+        return false;
     }
 
     /** {@inheritDoc} */

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/EmptyGridUnit.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java Thu Mar  6 05:33:44 2008
@@ -20,9 +20,11 @@
 package org.apache.fop.fo.flow.table;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
 
+import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.ValidationException;
 
 
@@ -79,14 +81,14 @@
             rows.add(effRow);
         }
         int columnIndex = cell.getColumnNumber() - 1;
-        PrimaryGridUnit pgu = new PrimaryGridUnit(cell, currentTableRow, columnIndex);
+        PrimaryGridUnit pgu = new PrimaryGridUnit(cell, columnIndex);
         List row = (List) rows.get(currentRowIndex);
         row.set(columnIndex, pgu);
         // TODO
         GridUnit[] cellRow = new GridUnit[cell.getNumberColumnsSpanned()];
         cellRow[0] = pgu;
         for (int j = 1; j < cell.getNumberColumnsSpanned(); j++) {
-            GridUnit gu = new GridUnit(pgu, currentTableRow, j, 0);
+            GridUnit gu = new GridUnit(pgu, j, 0);
             row.set(columnIndex + j, gu);
             cellRow[j] = gu;
         }
@@ -95,7 +97,7 @@
             row = (List) rows.get(currentRowIndex + i);
             cellRow = new GridUnit[cell.getNumberColumnsSpanned()];
             for (int j = 0; j < cell.getNumberColumnsSpanned(); j++) {
-                GridUnit gu = new GridUnit(pgu, currentTableRow, j, i);
+                GridUnit gu = new GridUnit(pgu, j, i);
                 row.set(columnIndex + j, gu);
                 cellRow[j] = gu;
             }
@@ -110,12 +112,38 @@
     }
 
     /** {@inheritDoc} */
-    void startRow(TableRow tableRow) {
+    void startTableRow(TableRow tableRow) {
         currentTableRow = tableRow;
     }
 
     /** {@inheritDoc} */
-    void endRow(TableCellContainer container) {
+    void endTableRow() {
+        assert currentTableRow != null;
+        if (currentRowIndex > 0 && currentTableRow.getBreakBefore() != Constants.EN_AUTO) {
+            currentTableRow.attributeWarning("break-before ignored because of row spanning "
+                    + "in progress (See XSL 1.1, 7.20.2)");
+        }
+        if (currentRowIndex < rows.size() - 1
+                && currentTableRow.getBreakAfter() != Constants.EN_AUTO) {
+            currentTableRow.attributeWarning("break-after ignored because of row spanning "
+                    + "in progress (See XSL 1.1, 7.20.1)");
+        }
+        for (Iterator iter = ((List) rows.get(currentRowIndex)).iterator(); iter.hasNext();) {
+            GridUnit gu = (GridUnit) iter.next();
+            // The row hasn't been filled with empty grid units yet
+            if (gu != null) {
+                gu.setRow(currentTableRow);
+            }
+        }
+        handleRowEnd(currentTableRow);
+    }
+
+    /** {@inheritDoc} */
+    void endRow(TableBody body) {
+        handleRowEnd(body);
+    }
+
+    private void handleRowEnd(TableCellContainer container) {
         List currentRow = (List) rows.get(currentRowIndex);
         lastRow = currentRow;
         // Fill gaps with empty grid units
@@ -156,7 +184,7 @@
     }
 
     /** {@inheritDoc} */
-    void endTable(TableBody lastTablePart) {
+    void endTable() {
         borderResolver.endTable();
     }
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/GridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/GridUnit.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/GridUnit.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/GridUnit.java Thu Mar  6 05:33:44 2008
@@ -19,7 +19,6 @@
 
 package org.apache.fop.fo.flow.table;
 
-import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo;
 import org.apache.fop.layoutmgr.table.CollapsingBorderModel;
@@ -76,12 +75,11 @@
      * Creates a new grid unit.
      * 
      * @param table the containing table
-     * @param row the table-row element this grid unit belongs to (if any)
      * @param colSpanIndex index of this grid unit in the span, in column direction
      * @param rowSpanIndex index of this grid unit in the span, in row direction
      */
-    protected GridUnit(Table table, TableRow row, int colSpanIndex, int rowSpanIndex) {
-        this(row, colSpanIndex, rowSpanIndex);
+    protected GridUnit(Table table, int colSpanIndex, int rowSpanIndex) {
+        this(colSpanIndex, rowSpanIndex);
         setBorders(table);
     }
 
@@ -89,12 +87,11 @@
      * Creates a new grid unit.
      * 
      * @param cell table cell which occupies this grid unit
-     * @param row the table-row element this grid unit belongs to (if any)
      * @param colSpanIndex index of this grid unit in the span, in column direction
      * @param rowSpanIndex index of this grid unit in the span, in row direction
      */
-    protected GridUnit(TableCell cell, TableRow row, int colSpanIndex, int rowSpanIndex) {
-        this(row, colSpanIndex, rowSpanIndex);
+    protected GridUnit(TableCell cell, int colSpanIndex, int rowSpanIndex) {
+        this(colSpanIndex, rowSpanIndex);
         this.cell = cell;
         setBorders(cell.getTable());
     }
@@ -103,17 +100,15 @@
      * Creates a new grid unit.
      * 
      * @param primary the before-start grid unit of the cell containing this grid unit
-     * @param row the table-row element this grid unit belongs to (if any)
      * @param colSpanIndex index of this grid unit in the span, in column direction
      * @param rowSpanIndex index of this grid unit in the span, in row direction
      */
-    GridUnit(PrimaryGridUnit primary, TableRow row, int colSpanIndex, int rowSpanIndex) {
-        this(primary.getCell(), row, colSpanIndex, rowSpanIndex);
+    GridUnit(PrimaryGridUnit primary, int colSpanIndex, int rowSpanIndex) {
+        this(primary.getCell(), colSpanIndex, rowSpanIndex);
         this.primary = primary;
     }
 
-    private GridUnit(TableRow row, int colSpanIndex, int rowSpanIndex) {
-        this.row = row;
+    private GridUnit(int colSpanIndex, int rowSpanIndex) {
         this.colSpanIndex = colSpanIndex;
         this.rowSpanIndex = rowSpanIndex;
     }
@@ -165,12 +160,8 @@
         return row;
     }
 
-    public TableBody getBody() {
-        FONode node = getCell();
-        while (node != null && !(node instanceof TableBody)) {
-            node = node.getParent();
-        }
-        return (TableBody) node;
+    void setRow(TableRow row) {
+        this.row = row;
     }
 
     /**

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/GridUnit.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java Thu Mar  6 05:33:44 2008
@@ -22,6 +22,8 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
 import org.apache.fop.layoutmgr.ElementListUtils;
 import org.apache.fop.layoutmgr.table.TableCellLayoutManager;
@@ -51,21 +53,38 @@
     private boolean isSeparateBorderModel;
     private int halfBorderSeparationBPD;
 
+    private boolean keepWithPrevious;
+    private boolean keepWithNext;
+    private int breakBefore = Constants.EN_AUTO;
+    private int breakAfter = Constants.EN_AUTO;
+
     /**
      * Creates a new primary grid unit.
      *
      * @param cell table cell which occupies this grid unit
-     * @param row the table-row element this grid unit belongs to (if any)
      * @param colIndex index of the column this grid unit belongs to, zero-based
      */
-    PrimaryGridUnit(TableCell cell, TableRow row, int colIndex) {
-        super(cell, row, 0, 0);
+    PrimaryGridUnit(TableCell cell, int colIndex) {
+        super(cell, 0, 0);
         this.colIndex = colIndex;
         this.isSeparateBorderModel = cell.getTable().isSeparateBorderModel(); // TODO
         this.halfBorderSeparationBPD = cell.getTable().getBorderSeparation().getBPD().getLength()
                 .getValue() / 2;  // TODO
     }
 
+    /**
+     * Returns the fo:table-header/footer/body element containing this cell.
+     * 
+     * @return the enclosing table part
+     */
+    public TableBody getTableBody() {
+        FONode node = cell.getParent();
+        if (node instanceof TableRow) {
+            node = node.getParent();
+        }
+        return (TableBody) node;
+    }
+
     public TableCellLayoutManager getCellLM() {
         assert cellLM != null;
         return cellLM;
@@ -302,6 +321,7 @@
     public String toString() {
         StringBuffer sb = new StringBuffer(super.toString());
         sb.append(" rowIndex=").append(rowIndex);
+        sb.append(" colIndex=").append(colIndex);
         return sb.toString();
     }
 
@@ -317,6 +337,78 @@
      */
     public void createCellLM() {
         cellLM = new TableCellLayoutManager(cell, this);
+    }
+
+    /**
+     * Returns true if the first child block (or its descendants) of this cell has
+     * keep-with-previous.
+     * 
+     * @return the value of keep-with-previous
+     */
+    public boolean mustKeepWithPrevious() {
+        return keepWithPrevious;
+    }
+
+    /**
+     * Don't use, reserved for TableCellLM. TODO
+     */
+    public void setKeepWithPrevious() {
+        this.keepWithPrevious = true;
+    }
+
+    /**
+     * Returns true if the last child block (or its descendants) of this cell has
+     * keep-with-next.
+     * 
+     * @return the value of keep-with-next
+     */
+    public boolean mustKeepWithNext() {
+        return keepWithNext;
+    }
+
+    /**
+     * Don't use, reserved for TableCellLM. TODO
+     */
+    public void setKeepWithNext() {
+        this.keepWithNext = true;
+    }
+
+    /**
+     * Returns the class of the before break for the first child element of this cell.
+     * 
+     * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
+     * Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
+     */
+    public int getBreakBefore() {
+        return breakBefore;
+    }
+
+    /**
+     * Don't use, reserved for TableCellLM. TODO
+     * 
+     * @param breakBefore the breakBefore to set
+     */
+    public void setBreakBefore(int breakBefore) {
+        this.breakBefore = breakBefore;
+    }
+
+    /**
+     * Returns the class of the before after for the last child element of this cell.
+     * 
+     * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link
+     * Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}
+     */
+    public int getBreakAfter() {
+        return breakAfter;
+    }
+
+    /**
+     * Don't use, reserved for TableCellLM. TODO
+     * 
+     * @param breakAfter the breakAfter to set
+     */
+    public void setBreakAfter(int breakAfter) {
+        this.breakAfter = breakAfter;
     }
 
 }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java Thu Mar  6 05:33:44 2008
@@ -53,17 +53,26 @@
      * 
      * @param tableRow the row being started
      */
-    abstract void startRow(TableRow tableRow);
+    abstract void startTableRow(TableRow tableRow);
 
     /**
      * Receives notification of the end of the current row. If the current row finishes
      * the row group, the {@link TableBody#addRowGroup(List)} method of the parent table
-     * part (i.e., the given container itself or its parent if this is a table-row) will
-     * be called
+     * part will be called.
+     */
+    abstract void endTableRow();
+
+    /**
+     * Receives notification of the end of the current row, when the source contains no
+     * fo:table-row element. If the current row finishes the row group, the
+     * {@link TableBody#addRowGroup(List)} method of the given table part will be called.
+     * 
+     * <p>If the source does contain explicit fo:table-row elements, then the
+     * {@link #endTableRow()} method will be called instead.</p>
      * 
-     * @param container the parent element of the current row
+     * @param part the part containing the current row
      */
-    abstract void endRow(TableCellContainer container);
+    abstract void endRow(TableBody part);
 
     /**
      * Receives notification of the start of a table-header/footer/body.
@@ -84,8 +93,7 @@
     /**
      * Receives notification of the end of the table.
      * 
-     * @param lastTablePart the last part of the table
      * @throws ValidationException if a row-spanning cell overflows one of the table's parts
      */
-    abstract void endTable(TableBody lastTablePart) throws ValidationException;
+    abstract void endTable() throws ValidationException;
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/Table.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/Table.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/Table.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/Table.java Thu Mar  6 05:33:44 2008
@@ -229,11 +229,7 @@
             return;
         }
         if (!inMarker()) {
-            if (tableFooter != null) {
-                rowGroupBuilder.endTable(tableFooter);
-            } else {
-                rowGroupBuilder.endTable((TableBody) getChildNodes().lastNode());
-            }
+            rowGroupBuilder.endTable();
             /* clean up */
             for (int i = columns.size(); --i >= 0;) {
                 TableColumn col = (TableColumn) columns.get(i);
@@ -293,6 +289,7 @@
         }
     }
 
+    /** {@inheritDoc} */
     protected void setCollapsedBorders() {
         createBorder(CommonBorderPaddingBackground.START);
         createBorder(CommonBorderPaddingBackground.END);

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableBody.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableBody.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableBody.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/TableBody.java Thu Mar  6 05:33:44 2008
@@ -136,7 +136,7 @@
         if (!inMarker()) {
             RowGroupBuilder rowGroupBuilder = getTable().getRowGroupBuilder();
             if (tableRowsFound) {
-                rowGroupBuilder.endRow(lastRow);
+                rowGroupBuilder.endTableRow();
             } else if (!lastCellEndsRow) {
                 rowGroupBuilder.endRow(this);
             }
@@ -193,11 +193,11 @@
                     getTable().getRowGroupBuilder().startTablePart(this);
                 } else {
                     columnNumberManager.prepareForNextRow(pendingSpans);
-                    getTable().getRowGroupBuilder().endRow(lastRow);
+                    getTable().getRowGroupBuilder().endTableRow();
                 }
                 rowsStarted = true;
                 lastRow = (TableRow) child;
-                getTable().getRowGroupBuilder().startRow(lastRow);
+                getTable().getRowGroupBuilder().startTableRow(lastRow);
                 break;
             case FO_TABLE_CELL:
                 if (!rowsStarted) {
@@ -281,7 +281,6 @@
                 getTable().getRowGroupBuilder().endRow(this);
             }
         }
-        rowsStarted = true;
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java Thu Mar  6 05:33:44 2008
@@ -64,19 +64,28 @@
     }
 
     /** {@inheritDoc} */
-    void startRow(final TableRow tableRow) {
+    void startTableRow(final TableRow tableRow) {
         events.add(new Event() {
             public void play(RowGroupBuilder rowGroupBuilder) {
-                rowGroupBuilder.startRow(tableRow);
+                rowGroupBuilder.startTableRow(tableRow);
             }
         });
     }
 
     /** {@inheritDoc} */
-    void endRow(final TableCellContainer container) {
+    void endTableRow() {
         events.add(new Event() {
             public void play(RowGroupBuilder rowGroupBuilder) {
-                rowGroupBuilder.endRow(container);
+                rowGroupBuilder.endTableRow();
+            }
+        });
+    }
+
+    /** {@inheritDoc} */
+    void endRow(final TableBody part) {
+        events.add(new Event() {
+            public void play(RowGroupBuilder rowGroupBuilder) {
+                rowGroupBuilder.endRow(part);
             }
         });
     }
@@ -101,11 +110,11 @@
     }
 
     /** {@inheritDoc} */
-    void endTable(final TableBody lastTablePart) throws ValidationException {
+    void endTable() throws ValidationException {
         RowGroupBuilder delegate = new FixedColRowGroupBuilder(table);
         for (Iterator eventIter = events.iterator(); eventIter.hasNext();) {
             ((Event) eventIter.next()).play(delegate);
         }
-        delegate.endTable(lastTablePart);
+        delegate.endTable();
     }
 }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/ColorProfile.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/Declarations.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/Flow.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/SideRegion.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/StaticContent.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/Title.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/BorderSpacingShorthandParser.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java Thu Mar  6 05:33:44 2008
@@ -63,7 +63,7 @@
         // Calculate the values as described in 7.7.20.
         Property style = propertyList.get(borderStyleId);
         if (style.getEnum() == Constants.EN_NONE) {
-            return new FixedLength(0);
+            return FixedLength.ZERO_FIXED_LENGTH;
         }
         return p;
     }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/BorderWidthPropertyMaker.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/BoxPropShorthandParser.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CharacterProperty.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/ColorProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/ColorProperty.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/ColorProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/ColorProperty.java Thu Mar  6 05:33:44 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: ColorTypeProperty.java 377045 2006-02-11 20:23:47Z jeremias $ */
+/* $Id$ */
 
 package org.apache.fop.fo.properties;
 

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/ColorProperty.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonAbsolutePosition.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonAccessibility.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonAural.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonFont.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonHyphenation.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonMarginInline.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonRelativePosition.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CommonTextDecoration.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CompoundPropertyMaker.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CondLengthProperty.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/EnumLength.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/EnumNumber.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/EnumProperty.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/FixedLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/FixedLength.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/FixedLength.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/FixedLength.java Thu Mar  6 05:33:44 2008
@@ -26,24 +26,71 @@
  */
 public final class FixedLength extends LengthProperty {
     
+    /** Describes the unit pica. */
+    public static final String PICA = "pc";
+
+    /** Describes the unit point. */
+    public static final String POINT = "pt";
+
+    /** Describes the unit millimeter. */
+    public static final String MM = "mm";
+
+    /** Describes the unit centimeter. */
+    public static final String CM = "cm";
+
+    /** Describes the unit inch. */
+    public static final String INCH = "in";
+
+    /** Describes the unit millipoint. */
+    public static final String MPT = "mpt";
+
     /** cache holding all canonical FixedLength instances */
     private static final PropertyCache cache = new PropertyCache();
     
+    /** canonical zero-length instance */
+    public static final FixedLength ZERO_FIXED_LENGTH = new FixedLength(0, FixedLength.MPT, 1.0f);
+    
     private int millipoints;
 
     /**
-     * Set the length given a number of units and a unit name.
+     * Set the length given a number of units, a unit name and
+     * an assumed resolution (used in case the units are pixels)
      * 
-     * @param numUnits quantity of input units
-     * @param units input unit specifier (in, cm, etc.)
+     * @param numUnits  quantity of input units
+     * @param units     input unit specifier
+     * @param res       input/source resolution
+     */
+    private FixedLength(double numUnits, String units, float res) {
+        this.millipoints = convert(numUnits, units, res);
+    }
+    
+    /**
+     * Return the cached {@link FixedLength} instance corresponding
+     * to the computed value in base-units (millipoints).
+     * 
+     * @param numUnits  quantity of input units
+     * @param units     input unit specifier
+     * @param sourceResolution input/source resolution (= ratio of pixels per pt)
+     * @return  the canonical FixedLength instance corresponding
+     *          to the given number of units and unit specifier
+     *          in the given resolution
      */
-    private FixedLength(double numUnits, String units) {
-        convert(numUnits, units);
+    public static FixedLength getInstance(double numUnits, 
+                                          String units,
+                                          float sourceResolution) {
+        if (numUnits == 0.0) {
+            return ZERO_FIXED_LENGTH;
+        } else {
+            return (FixedLength)cache.fetch(
+                new FixedLength(numUnits, units, sourceResolution));
+        }
+        
     }
     
     /**
-     * Return the cached FixedLength instance corresponding
+     * Return the cached {@link FixedLength} instance corresponding
      * to the computed value
+     * This method assumes a source-resolution of 1 (1px = 1pt)
      * 
      * @param numUnits  input units
      * @param units     unit specifier
@@ -52,118 +99,103 @@
      */
     public static FixedLength getInstance(double numUnits, 
                                           String units) {
-        return (FixedLength) cache.fetch(new FixedLength(numUnits, units));
+        return getInstance(numUnits, units, 1.0f);
         
     }
     
     /**
-     * @param baseUnits the length as a number of base units (millipoints)
+     * Return the cached {@link FixedLength} instance corresponding
+     * to the computed value.
+     * This method assumes 'millipoints' (non-standard) as units, 
+     * and an implied source-resolution of 1 (1px = 1pt).
+     * 
+     * @param numUnits  input units
+     * @return  the canonical FixedLength instance corresponding
+     *          to the given number of units and unit specifier
      */
-    public FixedLength(int baseUnits) {
-        millipoints = baseUnits;
+    public static FixedLength getInstance(double numUnits) {
+        return getInstance(numUnits, FixedLength.MPT, 1.0f);
+        
     }
-
+    
     /**
      * Convert the given length to a dimensionless integer representing
      * a whole number of base units (milli-points).
+     * 
      * @param dvalue quantity of input units
      * @param unit input unit specifier (in, cm, etc.)
+     * @param res   the input/source resolution (in case the unit spec is "px")
      */
-    protected void convert(double dvalue, String unit) {
-        // TODO: the whole routine smells fishy.
+    private static int convert(double dvalue, String unit, float res) {
+        // TODO: Maybe this method has a better place in org.apache.fop.util.UnitConv?.
 
-        int assumedResolution = 1;    // points/pixel = 72dpi
-
-        if (unit.equals("in")) {
-            dvalue = dvalue * 72;
-        } else if (unit.equals("cm")) {
-            dvalue = dvalue * 28.3464567;
-        } else if (unit.equals("mm")) {
-            dvalue = dvalue * 2.83464567;
-        } else if (unit.equals("pt")) {
-            // Do nothing.
-            // dvalue = dvalue;
-        } else if (unit.equals("mpt")) { //mpt is non-standard!!! mpt=millipoints
-            // TODO: this seems to be wrong.
-            // Do nothing.
-            // dvalue = dvalue;
-        } else if (unit.equals("pc")) {
-            dvalue = dvalue * 12;
-            /*
-             * } else if (unit.equals("em")) {
-             * dvalue = dvalue * fontsize;
-             */
-        } else if (unit.equals("px")) {
-            // TODO: get resolution from user agent?
-            dvalue = dvalue * assumedResolution;
-        } else {
-            dvalue = 0;
-            log.error("Unknown length unit '" + unit + "'");
-        }
-        if (unit.equals("mpt")) {
-            millipoints = (int)dvalue;
+        if ("px".equals(unit)) {
+            //device-dependent units, take the resolution into account
+            dvalue *= (res * 1000);
         } else {
-            millipoints = (int)(dvalue * 1000);
+            if (FixedLength.INCH.equals(unit)) {
+                dvalue *= 72000;
+            } else if (FixedLength.CM.equals(unit)) {
+                dvalue *= 28346.4567;
+            } else if (FixedLength.MM.equals(unit)) {
+                dvalue *= 2834.64567;
+            } else if (FixedLength.POINT.equals(unit)) {
+                dvalue *= 1000;
+            } else if (FixedLength.PICA.equals(unit)) {
+                dvalue *= 12000;
+            } else if (!FixedLength.MPT.equals(unit)) {
+                dvalue = 0;
+                log.error("Unknown length unit '" + unit + "'");
+            }
         }
+        return (int)dvalue;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public int getValue() {
         return millipoints;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public int getValue(PercentBaseContext context) {
         return millipoints;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public double getNumericValue() {
         return millipoints;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public double getNumericValue(PercentBaseContext context) {
         return millipoints;
     }
 
     /**
-     * Return true since FixedLength are always absolute.
+     * Return true since a FixedLength is always absolute.
      * {@inheritDoc}
      */
     public boolean isAbsolute() {
         return true;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public String toString() {
-        return millipoints + "mpt";
+        return millipoints + FixedLength.MPT;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
         if (obj instanceof FixedLength) {
             return (((FixedLength)obj).millipoints == this.millipoints);
-        } else {
-            return false;
         }
+        return false;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public int hashCode() {
         return millipoints;
     }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/FixedLength.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java Thu Mar  6 05:33:44 2008
@@ -43,6 +43,24 @@
         super(propId);
     }
     
+    
+    /**
+     * {@inheritDoc}
+     * Contrary to basic lengths, percentages for font-size can be resolved
+     * here already: if the property evaluates to a {@link PercentLength}, 
+     * it is immediately replaced by the resolved {@link FixedLength}.
+     */
+    public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException {
+        Property p = super.make(propertyList, value, fo);
+        if (p instanceof PercentLength) {
+            Property pp = propertyList.getFromParent(this.propId);
+            p = FixedLength.getInstance(
+                    pp.getLength().getValue() * ((PercentLength)p).getPercentage() / 100);
+        }
+        return p;
+    }
+
+
     /**
      * {@inheritDoc}
      * Implements the parts of 7.8.4 relevant to relative font sizes
@@ -52,12 +70,14 @@
                                     FObj fo) throws PropertyException {
         if (p.getEnum() == EN_LARGER || p.getEnum() == EN_SMALLER) {
             // get the corresponding property from parent
-            Property pp = propertyList.getFromParent(this.getPropId());
+            Property pp = propertyList.getFromParent(this.propId);
             int baseFontSize = computeClosestAbsoluteFontSize(pp.getLength().getValue());
             if (p.getEnum() == EN_LARGER) {
-                return new FixedLength((int)Math.round((baseFontSize * FONT_SIZE_GROWTH_FACTOR)));
+                return FixedLength.getInstance(
+                        Math.round(baseFontSize * FONT_SIZE_GROWTH_FACTOR));
             } else {
-                return new FixedLength((int)Math.round((baseFontSize / FONT_SIZE_GROWTH_FACTOR)));
+                return FixedLength.getInstance(
+                        Math.round(baseFontSize / FONT_SIZE_GROWTH_FACTOR));
             }
         }
         return super.convertProperty(p, propertyList, fo);

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/GenericShorthandParser.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java Thu Mar  6 05:33:44 2008
@@ -108,7 +108,7 @@
             //Margin is used
             Numeric margin = propertyList.get(marginProp).getNumeric();
             
-            Numeric v = new FixedLength(0);
+            Numeric v = FixedLength.ZERO_FIXED_LENGTH;
             if (!propertyList.getFObj().generatesReferenceAreas()) {
                 // The inherited_value_of([start|end]-indent)
                 v = NumericOp.addition(v, propertyList.getInherited(baseMaker.propId).getNumeric());
@@ -173,7 +173,7 @@
                 if (isInherited(propertyList) || !marginNearest) {
                     return null;
                 } else {
-                    return new FixedLength(0);
+                    return FixedLength.ZERO_FIXED_LENGTH;
                 }
             } else {
                 return indent;
@@ -182,7 +182,7 @@
             //Margin is used
             Numeric margin = propertyList.get(marginProp).getNumeric();
             
-            Numeric v = new FixedLength(0);
+            Numeric v = FixedLength.ZERO_FIXED_LENGTH;
             if (isInherited(propertyList)) {
                 // The inherited_value_of([start|end]-indent)
                 v = NumericOp.addition(v, propertyList.getInherited(baseMaker.propId).getNumeric());

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/KeepProperty.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/LengthPairProperty.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/LengthProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/LengthProperty.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/LengthProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/LengthProperty.java Thu Mar  6 05:33:44 2008
@@ -45,9 +45,7 @@
             super(propId);
         }
 
-        /**
-         * {@inheritDoc}
-         */
+        /** {@inheritDoc} */
         public Property convertProperty(Property p,
                                         PropertyList propertyList,
                                         FObj fo) throws PropertyException {
@@ -59,7 +57,9 @@
             }
             if (p instanceof NumberProperty) {
                 //Assume pixels (like in HTML) when there's no unit
-                return FixedLength.getInstance(p.getNumeric().getNumericValue(), "px");
+                return FixedLength.getInstance(
+                        p.getNumeric().getNumericValue(), "px",
+                        propertyList.getFObj().getUserAgent().getSourceResolution() / 72.0f);
             }
             Length val = p.getLength();
             if (val != null) {
@@ -87,30 +87,22 @@
         return 0.0;
     }
 
-    /**
-     * @return the numeric dimension. Length always a dimension of 1.
-     */
+    /** @return the numeric dimension. Length always a dimension of 1 */
     public int getDimension() {
         return 1;
     }
 
-    /**
-     * @return this.length cast as a Numeric
-     */
+    /** @return this.length cast as a Numeric */
     public Numeric getNumeric() {
         return this;
     }
 
-    /**
-     * @return this.length
-     */
+    /** @return this.length */
     public Length getLength() {
         return this;
     }
 
-    /**
-     * @return this.length cast as an Object
-     */
+    /** @return this.length cast as an Object */
     public Object getObject() {
         return this;
     }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/properties/LengthProperty.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Thu Mar  6 05:33:44 2008
@@ -1 +1 @@
-Author Date Id Revision
+Id



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message