xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phanc...@apache.org
Subject svn commit: r1343285 [9/24] - in /xmlgraphics/fop/branches/Temp_URI_Unification: ./ conf/ examples/embedding/ examples/embedding/java/embedding/ examples/embedding/java/embedding/tools/ lib/ src/codegen/java/org/apache/fop/tools/ src/codegen/unicode/ja...
Date Mon, 28 May 2012 15:31:36 GMT
Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FOTreeBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FOTreeBuilder.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FOTreeBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FOTreeBuilder.java Mon May 28 15:30:46 2012
@@ -37,7 +37,6 @@ import org.apache.fop.accessibility.fo.F
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.apps.FormattingResults;
-import org.apache.fop.area.AreaTreeHandler;
 import org.apache.fop.fo.ElementMapping.Maker;
 import org.apache.fop.fo.extensions.ExtensionElementMapping;
 import org.apache.fop.fo.pagination.Root;
@@ -224,13 +223,7 @@ public class FOTreeBuilder extends Defau
      * @return the results of the rendering process.
      */
     public FormattingResults getResults() {
-        if (getEventHandler() instanceof AreaTreeHandler) {
-            return ((AreaTreeHandler) getEventHandler()).getResults();
-        } else {
-            //No formatting results available for output formats no
-            //involving the layout engine.
-            return null;
-        }
+        return getEventHandler().getResults();
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FObj.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FObj.java Mon May 28 15:30:46 2012
@@ -67,6 +67,8 @@ public abstract class FObj extends FONod
     /** Markers added to this element. */
     private Map markers = null;
 
+    private int bidiLevel = -1;
+
     // The value of properties relevant for all fo objects
     private String id = null;
     // End of property values
@@ -118,9 +120,7 @@ public abstract class FObj extends FONod
                     throws FOPException {
         setLocator(locator);
         pList.addAttributesToList(attlist);
-        if (!inMarker()
-                || "marker".equals(elementName)) {
-            pList.setWritingMode();
+        if (!inMarker() || "marker".equals(elementName)) {
             bind(pList);
         }
     }
@@ -501,7 +501,7 @@ public abstract class FObj extends FONod
      * @param lName local name (i.e., no prefix) of incoming node
      * @return true if a member, false if not
      */
-    boolean isNeutralItem(String nsURI, String lName) {
+    protected boolean isNeutralItem(String nsURI, String lName) {
         return (FO_URI.equals(nsURI)
                 && ("multi-switch".equals(lName)
                         || "multi-properties".equals(lName)
@@ -558,6 +558,63 @@ public abstract class FObj extends FONod
         return "fo";
     }
 
+    /** {@inheritDoc} */
+    public boolean isBidiRangeBlockItem() {
+        String ns = getNamespaceURI();
+        String ln = getLocalName();
+        return !isNeutralItem(ns, ln) && isBlockItem(ns, ln);
+    }
+
+    /**
+     * Recursively set resolved bidirectional level of FO (and its ancestors) if
+     * and only if it is non-negative and if either the current value is reset (-1)
+     * or the new value is less than the current value.
+     * @param bidiLevel a non-negative bidi embedding level
+     */
+    public void setBidiLevel(int bidiLevel) {
+        assert bidiLevel >= 0;
+        if ( bidiLevel >= 0 ) {
+            if ( ( this.bidiLevel < 0 ) || ( bidiLevel < this.bidiLevel ) ) {
+                this.bidiLevel = bidiLevel;
+                if ( parent != null ) {
+                    FObj foParent = (FObj) parent;
+                    int parentBidiLevel = foParent.getBidiLevel();
+                    if ( ( parentBidiLevel < 0 ) || ( bidiLevel < parentBidiLevel ) ) {
+                        foParent.setBidiLevel ( bidiLevel );
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Obtain resolved bidirectional level of FO.
+     * @return either a non-negative bidi embedding level or -1
+     * in case no bidi levels have been assigned
+     */
+    public int getBidiLevel() {
+        return bidiLevel;
+    }
+
+    /**
+     * Obtain resolved bidirectional level of FO or nearest FO
+     * ancestor that has a resolved level.
+     * @return either a non-negative bidi embedding level or -1
+     * in case no bidi levels have been assigned to this FO or
+     * any ancestor
+     */
+    public int getBidiLevelRecursive() {
+        for ( FONode fn = this; fn != null; fn = fn.getParent() ) {
+            if ( fn instanceof FObj ) {
+                int level = ( (FObj) fn).getBidiLevel();
+                if ( level >= 0 ) {
+                    return level;
+                }
+            }
+        }
+        return -1;
+    }
+
     /**
      * Add a new extension attachment to this FObj.
      * (see org.apache.fop.fo.FONode for details)

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FObjMixed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FObjMixed.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FObjMixed.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/FObjMixed.java Mon May 28 15:30:46 2012
@@ -201,4 +201,4 @@ public abstract class FObjMixed extends 
     public CharIterator charIterator() {
         return new RecursiveCharIterator(this);
     }
-}
\ No newline at end of file
+}

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/PropertyList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/PropertyList.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/PropertyList.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/PropertyList.java Mon May 28 15:30:46 2012
@@ -46,8 +46,6 @@ import org.apache.fop.fo.properties.Prop
  */
 public abstract class PropertyList {
 
-    // writing-mode index
-    private int writingMode;
 
     private static boolean[] inheritableProperty;
 
@@ -220,58 +218,60 @@ public abstract class PropertyList {
     }
 
     /**
-     * Set writing mode for this FO.
-     * Use that from the nearest ancestor, including self, which generates
-     * reference areas, or from root FO if no ancestor found.
-     * @throws PropertyException ...
-     */
-    public void setWritingMode() throws PropertyException {
-        FObj p = fobj.findNearestAncestorFObj();
-        // If this is a reference area or the root, use the property value.
-        if (fobj.generatesReferenceAreas() || p == null) {
-            writingMode = get(Constants.PR_WRITING_MODE).getEnum();
-        } else {
-            // Otherwise get the writing mode value from the parent.
-            writingMode = getParentPropertyList().getWritingMode();
-        }
-    }
-
-    /**
-     * Return the "writing-mode" property value.
-     * @return the "writing-mode" property value.
-     */
-    public int getWritingMode() {
-        return writingMode;
-    }
-
-
-    /**
-     * Uses the stored writingMode.
+     * Select a writing mode dependent property ID based on value of writing mode property.
      * @param lrtb the property ID to return under lrtb writingmode.
      * @param rltb the property ID to return under rltb writingmode.
      * @param tbrl the property ID to return under tbrl writingmode.
+     * @param tblr the property ID to return under tblr writingmode.
      * @return one of the property IDs, depending on the writing mode.
      */
-    public int getWritingMode(int lrtb, int rltb, int tbrl) {
-        switch (writingMode) {
-            case Constants.EN_LR_TB: return lrtb;
-            case Constants.EN_RL_TB: return rltb;
-            case Constants.EN_TB_RL: return tbrl;
+    public int selectFromWritingMode(int lrtb, int rltb, int tbrl, int tblr) {
+        int propID;
+        try {
+            switch (get(Constants.PR_WRITING_MODE).getEnum()) {
+            case Constants.EN_LR_TB:
+                propID = lrtb;
+                break;
+            case Constants.EN_RL_TB:
+                propID = rltb;
+                break;
+            case Constants.EN_TB_RL:
+                propID = tbrl;
+                break;
+            case Constants.EN_TB_LR:
+                propID = tblr;
+                break;
             default:
-                //nop
+            propID = -1;
+                break;
+            }
+        } catch ( PropertyException e ) {
+            propID = -1;
         }
-        return -1;
+        return propID;
     }
 
     private String addAttributeToList(Attributes attributes,
                                     String attributeName) throws ValidationException {
         String attributeValue = attributes.getValue(attributeName);
-        convertAttributeToProperty(attributes, attributeName, attributeValue);
+        if ( attributeValue != null ) {
+            convertAttributeToProperty(attributes, attributeName, attributeValue);
+        }
         return attributeValue;
     }
 
     /**
-     * Adds the attributes, passed in by the parser to the PropertyList
+     * <p>Adds the attributes, passed in by the parser to the PropertyList.</p>
+     * <p>Note that certain attributes are given priority in terms of order of
+     * processing due to conversion dependencies, where the order is as follows:</p>
+     * <ol>
+     * <li>writing-mode</li>
+     * <li>column-number</li>
+     * <li>number-columns-spanned</li>
+     * <li>font</li>
+     * <li>font-size</li>
+     * <li><emph>all others in order of appearance</emph></li>
+     * </ol>
      *
      * @param attributes Collection of attributes passed to us from the parser.
      * @throws ValidationException if there is an attribute that does not
@@ -280,6 +280,11 @@ public abstract class PropertyList {
     public void addAttributesToList(Attributes attributes)
                     throws ValidationException {
         /*
+         * Give writing-mode highest conversion priority.
+         */
+        addAttributeToList(attributes, "writing-mode");
+
+        /*
          * If column-number/number-columns-spanned are specified, then we
          * need them before all others (possible from-table-column() on any
          * other property further in the list...
@@ -300,9 +305,9 @@ public abstract class PropertyList {
             addAttributeToList(attributes, "font-size");
         }
 
+        String attributeNS;
         String attributeName;
         String attributeValue;
-        String attributeNS;
         FopFactory factory = getFObj().getUserAgent().getFactory();
         for (int i = 0; i < attributes.getLength(); i++) {
             /* convert all attributes with the same namespace as the fo element
@@ -646,4 +651,3 @@ public abstract class PropertyList {
         return CommonTextDecoration.createFromPropertyList(this);
     }
 }
-

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/ValidationException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/ValidationException.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/ValidationException.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/ValidationException.java Mon May 28 15:30:46 2012
@@ -19,9 +19,10 @@
 
 package org.apache.fop.fo;
 
-import org.apache.fop.apps.FOPException;
 import org.xml.sax.Locator;
 
+import org.apache.fop.apps.FOPException;
+
 /**
  * Exception thrown during FO tree validation.
  */

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/XMLObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/XMLObj.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/XMLObj.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/XMLObj.java Mon May 28 15:30:46 2012
@@ -19,7 +19,6 @@
 
 package org.apache.fop.fo;
 
-// Java
 import java.awt.geom.Point2D;
 import java.util.HashMap;
 
@@ -33,8 +32,8 @@ import org.xml.sax.Locator;
 
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.datatypes.Length;
-import org.apache.fop.util.XMLConstants;
 import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener;
+import org.apache.fop.util.XMLConstants;
 
 /**
  * Abstract class modelling generic, non-XSL-FO XML objects. Such objects are

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java Mon May 28 15:30:46 2012
@@ -21,6 +21,7 @@ package org.apache.fop.fo;
 
 import java.util.List;
 import java.util.Stack;
+
 import org.apache.fop.fo.flow.Block;
 import org.apache.fop.util.CharUtilities;
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/AbsFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/AbsFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/AbsFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/AbsFunction.java Mon May 28 15:30:46 2012
@@ -27,22 +27,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class AbsFunction extends FunctionBase {
 
-    /**
-     * @return 1 (the number of arguments required for the abs function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 1;
     }
 
-    /**
-     * @param args array of arguments to be evaluated, the first of which
-     * should be a numeric value
-     * @param propInfo the PropertyInfo object to be evaluated
-     * @return the absolute value of the input
-     * @throws PropertyException for non-numeric input
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo propInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo propInfo) throws PropertyException {
         Numeric num = args[0].getNumeric();
         if (num == null) {
             throw new PropertyException("Non numeric operand to abs function");

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/BodyStartFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/BodyStartFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/BodyStartFunction.java Mon May 28 15:30:46 2012
@@ -31,22 +31,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class BodyStartFunction extends FunctionBase {
 
-    /**
-     * @return 0 (there are no arguments for body-start)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 0;
     }
 
-    /**
-     * @param args array of arguments (none are used, but this is required by
-     * the Function interface)
-     * @param pInfo PropertyInfo object to be evaluated
-     * @return numeric object containing the calculated body-start value
-     * @throws PropertyException if called from outside of an fo:list-item
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Numeric distance
             = pInfo.getPropertyList()
               .get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric();

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/CIELabColorFunction.java Mon May 28 15:30:46 2012
@@ -30,29 +30,25 @@ import org.apache.fop.fo.properties.Prop
  */
 class CIELabColorFunction extends FunctionBase {
 
-    /**
-     * cie-lab-color() takes 2 times 3 arguments.
-     * {@inheritDoc}
-     */
-    public int nbArgs() {
-        return 2 * 3;
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 6;
     }
 
+    @Override
+    /** {@inheritDoc} */
     public PercentBase getPercentBase() {
         return new CIELabPercentBase();
     }
 
     /** {@inheritDoc} */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
 
         float red = args[0].getNumber().floatValue();
         float green = args[1].getNumber().floatValue();
         float blue = args[2].getNumber().floatValue();
         /* Verify sRGB replacement arguments */
-        if ((red < 0 || red > 255)
-                || (green < 0 || green > 255)
-                || (blue < 0 || blue > 255)) {
+        if ((red < 0 || red > 255) || (green < 0 || green > 255) || (blue < 0 || blue > 255)) {
             throw new PropertyException("sRGB color values out of range. "
                     + "Arguments to cie-lab-color() must be [0..255] or [0%..100%]");
         }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/CeilingFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/CeilingFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/CeilingFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/CeilingFunction.java Mon May 28 15:30:46 2012
@@ -24,12 +24,13 @@ import org.apache.fop.fo.properties.Prop
 
 class CeilingFunction extends FunctionBase {
 
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 1;
     }
 
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Number dbl = args[0].getNumber();
         if (dbl == null) {
             throw new PropertyException("Non number operand to ceiling function");

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FloorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FloorFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FloorFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FloorFunction.java Mon May 28 15:30:46 2012
@@ -25,12 +25,13 @@ import org.apache.fop.fo.properties.Prop
 
 class FloorFunction extends FunctionBase {
 
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 1;
     }
 
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Number dbl = args[0].getNumber();
         if (dbl == null) {
             throw new PropertyException("Non number operand to floor function");

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FromParentFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FromParentFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FromParentFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FromParentFunction.java Mon May 28 15:30:46 2012
@@ -29,29 +29,29 @@ import org.apache.fop.fo.properties.Prop
  */
 public class FromParentFunction extends FunctionBase {
 
-    /**
-     * @return 1 (maximum arguments for the from-parent function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 0;
+    }
+
+    @Override
+    /** {@inheritDoc} */
+    public int getOptionalArgsCount() {
         return 1;
     }
 
-    /**
-     * @return true (allow padding of arglist with property name)
-     */
-    public boolean padArgsWithPropertyName() {
-        return true;
+    @Override
+    /** {@inheritDoc} */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
+        if ( index == 0 ) {
+            return getPropertyName ( pi );
+        } else {
+            return super.getOptionalArgDefault ( index, pi );
+        }
     }
 
-    /**
-     * @param args array of arguments, which should either be empty, or the
-     * first of which should contain an NCName corresponding to property name
-     * @param pInfo PropertyInfo object to be evaluated
-     * @return property containing the computed value
-     * @throws PropertyException if the arguments are incorrect
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         String propName = args[0].getString();
         if (propName == null) {
             throw new PropertyException("Incorrect parameter to from-parent function");

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java Mon May 28 15:30:46 2012
@@ -20,9 +20,10 @@
 package org.apache.fop.fo.expr;
 
 import java.util.List;
+
 import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.FOPropertyMapping;
+import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.flow.table.ColumnNumberManager;
 import org.apache.fop.fo.flow.table.Table;
 import org.apache.fop.fo.flow.table.TableCell;
@@ -36,32 +37,29 @@ import org.apache.fop.fo.properties.Prop
  */
 public class FromTableColumnFunction extends FunctionBase {
 
-    /**
-     * @return 1 (maximum arguments for the from-table-column function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 0;
+    }
+
+    @Override
+    /** {@inheritDoc} */
+    public int getOptionalArgsCount() {
         return 1;
     }
 
-    /**
-     * @return true (allow padding of arglist with property name)
-     */
-    public boolean padArgsWithPropertyName() {
-        return true;
+    @Override
+    /** {@inheritDoc} */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
+        if ( index == 0 ) {
+            return getPropertyName ( pi );
+        } else {
+            return super.getOptionalArgDefault ( index, pi );
+        }
     }
 
-    /**
-     *
-     * @param args array of arguments, which should either be empty, or the
-     * first of which should contain an NCName corresponding to a property name
-     * @param pInfo PropertyInfo object to be evaluated
-     * @return the Property corresponding to the property name specified, or, if
-     * none, for the property for which the expression is being evaluated
-     * @throws PropertyException for incorrect arguments, and (for now) in all
-     * cases, because this function is not implemented
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
 
         FObj fo = pInfo.getPropertyList().getFObj();
 

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/Function.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/Function.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/Function.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/Function.java Mon May 28 15:30:46 2012
@@ -19,8 +19,8 @@
 
 package org.apache.fop.fo.expr;
 
-import org.apache.fop.fo.properties.Property;
 import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.fo.properties.Property;
 
 /**
  * Interface for managing XSL-FO Functions
@@ -28,11 +28,34 @@ import org.apache.fop.datatypes.PercentB
 public interface Function {
 
     /**
-     * @return the number of arguments that must be passed to this function. For
-     * example, if the function should determine the minimum of two numbers, it
-     * must be passed two arguments, one for each of the two values.
+     * @return the number of required (non-optional) arguments that must be specified
+     * in the argument list
      */
-    int nbArgs();
+    int getRequiredArgsCount();
+
+    /**
+     * @return the number of non-required (optional) arguments that may be specified
+     * in the argument list, which, if specified, must follow the required arguments
+     */
+    int getOptionalArgsCount();
+
+    /**
+     * @param index of optional argument
+     * @param pi property information instance that applies to property being evaluated
+     * @return the default property value for the optional argument at INDEX, where
+     * INDEX is with respect to optional arguments; i.e., the first optional argument
+     * position is index 0; if no default for a given index, then null is returned
+     * @throws PropertyException if index is greater than or equal to optional args count
+     */
+    Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException;
+
+    /**
+     * Determine if function allows variable arguments. If it does, then they must appear
+     * after required and optional arguments, and all optional arguments must be specified.
+     * @return true if function permits additional variable number of arguments after
+     * required and (completely specified) optional arguments
+     */
+    boolean hasVariableArgs();
 
     /**
      * @return the basis for percentage calculations
@@ -42,16 +65,10 @@ public interface Function {
     /**
      * Evaluate the function
      * @param args an array of Properties that should be evaluated
-     * @param propInfo the PropertyInfo
+     * @param pi property information instance that applies to property being evaluated
      * @return the Property satisfying the function
      * @throws PropertyException for problems when evaluating the function
      */
-    Property eval(Property[] args,
-                  PropertyInfo propInfo) throws PropertyException;
+    Property eval(Property[] args, PropertyInfo pi) throws PropertyException;
 
-    /**
-     * @return if it is allowed to fill up the property list with
-     * the property name if only one arg is missing.
-     */
-    boolean padArgsWithPropertyName();
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FunctionBase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FunctionBase.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FunctionBase.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/FunctionBase.java Mon May 28 15:30:46 2012
@@ -20,23 +20,45 @@
 package org.apache.fop.fo.expr;
 
 import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.fo.properties.Property;
+import org.apache.fop.fo.properties.StringProperty;
 
 /**
  * Abstract Base class for XSL-FO functions
  */
 public abstract class FunctionBase implements Function {
 
-    /**
-     * @return null (by default, functions have no percent-based arguments)
-     */
+    /** {@inheritDoc} */
+    public int getOptionalArgsCount() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
+        if ( index >= getOptionalArgsCount() ) {
+            PropertyException e = new PropertyException ( new IndexOutOfBoundsException ( "illegal optional argument index" ) );
+            e.setPropertyInfo ( pi );
+            throw e;
+        } else {
+            return null;
+        }
+    }
+
+    /** {@inheritDoc} */
+    public boolean hasVariableArgs() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
     public PercentBase getPercentBase() {
         return null;
     }
 
     /**
-     * @return false (by default don't pad arglist with property-name)
+     * @param pi property information instance that applies to property being evaluated
+     * @return string property whose value is name of property being evaluated
      */
-    public boolean padArgsWithPropertyName() {
-        return false;
+    protected final Property getPropertyName ( PropertyInfo pi ) {
+        return StringProperty.getInstance ( pi.getPropertyMaker().getName() );
     }
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java Mon May 28 15:30:46 2012
@@ -28,30 +28,29 @@ import org.apache.fop.fo.properties.Prop
  */
 public class InheritedPropFunction extends FunctionBase {
 
-    /**
-     * @return 1 (maximum number of arguments for the inherited-property-value
-     * function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
+        return 0;
+    }
+
+    @Override
+    /** {@inheritDoc} */
+    public int getOptionalArgsCount() {
         return 1;
     }
 
-    /**
-     * @return true (allow padding of arglist with property name)
-     */
-    public boolean padArgsWithPropertyName() {
-        return true;
+    @Override
+    /** {@inheritDoc} */
+    public Property getOptionalArgDefault(int index, PropertyInfo pi) throws PropertyException {
+        if ( index == 0 ) {
+            return getPropertyName ( pi );
+        } else {
+            return super.getOptionalArgDefault ( index, pi );
+        }
     }
 
-    /**
-     *
-     * @param args arguments to be evaluated
-     * @param pInfo PropertyInfo object to be evaluated
-     * @return Property satisfying the inherited-property-value
-     * @throws PropertyException for invalid parameter
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         String propName = args[0].getString();
         if (propName == null) {
             throw new PropertyException("Incorrect parameter to inherited-property-value function");

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/LabelEndFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/LabelEndFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/LabelEndFunction.java Mon May 28 15:30:46 2012
@@ -19,9 +19,9 @@
 
 package org.apache.fop.fo.expr;
 
-import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.Numeric;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.flow.ListItem;
@@ -34,23 +34,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class LabelEndFunction extends FunctionBase {
 
-    /**
-     * @return 0 (the number of arguments required for the label-end function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 0;
     }
 
-    /**
-     *
-     * @param args array of arguments for the function (none are needed, but
-     * required for the Function interface)
-     * @param pInfo PropertyInfo object for the function
-     * @return the calculated label-end value for the list
-     * @throws PropertyException if called from outside of an fo:list-item
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
 
         Length distance = pInfo.getPropertyList().get(
                 Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getLength();

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/MaxFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/MaxFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/MaxFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/MaxFunction.java Mon May 28 15:30:46 2012
@@ -28,22 +28,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class MaxFunction extends FunctionBase {
 
-    /**
-     * @return 2 (the number of arguments required for the max function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 2;
     }
 
-    /**
-     * Handle "numerics" if no proportional/percent parts
-     * @param args array of arguments to be processed
-     * @param pInfo PropertyInfo to be processed
-     * @return the maximum of the two args elements passed
-     * @throws PropertyException for invalid operands
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Numeric n1 = args[0].getNumeric();
         Numeric n2 = args[1].getNumeric();
         if (n1 == null || n2 == null) {

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/MinFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/MinFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/MinFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/MinFunction.java Mon May 28 15:30:46 2012
@@ -28,22 +28,13 @@ import org.apache.fop.fo.properties.Prop
  */
 public class MinFunction extends FunctionBase {
 
-    /**
-     * @return 2 (the number of arguments required for the min function)
-     */
-    public int nbArgs() {
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 2;
     }
 
-    /**
-     * Handle "numerics" if no proportional/percent parts
-     * @param args array of arguments to be processed
-     * @param pInfo PropertyInfo to be processed
-     * @return the minimum of the two args elements passed
-     * @throws PropertyException for invalid operands
-     */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Numeric n1 = args[0].getNumeric();
         Numeric n2 = args[1].getNumeric();
         if (n1 == null || n2 == null) {

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/NCnameProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/NCnameProperty.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/NCnameProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/NCnameProperty.java Mon May 28 15:30:46 2012
@@ -24,6 +24,7 @@ import java.awt.Color;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.fo.properties.Property;
 import org.apache.fop.util.ColorUtil;
+import org.apache.fop.util.CompareUtil;
 
 /**
  * Class for handling NC Name objects
@@ -79,4 +80,20 @@ public class NCnameProperty extends Prop
         return this.ncName;
     }
 
+    @Override
+    public int hashCode() {
+        return CompareUtil.getHashCode(ncName);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof NCnameProperty)) {
+            return false;
+        }
+        NCnameProperty other = (NCnameProperty) obj;
+        return CompareUtil.equal(ncName, other.ncName);
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/NumericProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/NumericProperty.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/NumericProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/NumericProperty.java Mon May 28 15:30:46 2012
@@ -23,10 +23,11 @@ import java.awt.Color;
 
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.datatypes.Length;
-import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.properties.FixedLength;
 import org.apache.fop.fo.properties.Property;
+import org.apache.fop.util.CompareUtil;
 
 /**
  * A numeric property which hold the final absolute result of an expression
@@ -127,4 +128,25 @@ public class NumericProperty extends Pro
             return value + "^" + dim;
         }
     }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + dim;
+        result = prime * result + CompareUtil.getHashCode(value);
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof NumericProperty)) {
+            return false;
+        }
+        NumericProperty other = (NumericProperty) obj;
+        return dim == other.dim && CompareUtil.equal(value, other.value);
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/PropertyParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/PropertyParser.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/PropertyParser.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/PropertyParser.java Mon May 28 15:30:46 2012
@@ -20,7 +20,6 @@
 package org.apache.fop.fo.expr;
 
 import java.util.HashMap;
-import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.xmlgraphics.util.UnitConv;
@@ -59,19 +58,16 @@ public final class PropertyParser extend
         FUNCTION_TABLE.put("rgb", new RGBColorFunction());
         FUNCTION_TABLE.put("system-color", new SystemColorFunction());
         FUNCTION_TABLE.put("from-table-column", new FromTableColumnFunction());
-        FUNCTION_TABLE.put("inherited-property-value",
-                          new InheritedPropFunction());
+        FUNCTION_TABLE.put("inherited-property-value", new InheritedPropFunction());
+        FUNCTION_TABLE.put("from-nearest-specified-value", new FromNearestSpecifiedValueFunction());
         FUNCTION_TABLE.put("from-parent", new FromParentFunction());
-        FUNCTION_TABLE.put("from-nearest-specified-value",
-                          new NearestSpecPropFunction());
-        FUNCTION_TABLE.put("proportional-column-width",
-                          new PPColWidthFunction());
+        FUNCTION_TABLE.put("proportional-column-width", new ProportionalColumnWidthFunction());
         FUNCTION_TABLE.put("label-end", new LabelEndFunction());
         FUNCTION_TABLE.put("body-start", new BodyStartFunction());
-        FUNCTION_TABLE.put("rgb-icc", new ICCColorFunction());
-        FUNCTION_TABLE.put("rgb-named-color", new NamedColorFunction()); //since XSL-FO 2.0
+        FUNCTION_TABLE.put("rgb-icc", new RGBICCColorFunction());
+        FUNCTION_TABLE.put("rgb-named-color", new RGBNamedColorFunction()); //since XSL-FO 2.0
         FUNCTION_TABLE.put("cie-lab-color", new CIELabColorFunction()); //since XSL-FO 2.0
-        FUNCTION_TABLE.put("cmyk", new CMYKcolorFunction()); //non-standard!!!
+        FUNCTION_TABLE.put("cmyk", new CMYKColorFunction()); //non-standard!!!
 
         /**
          * * NOT YET IMPLEMENTED!!!
@@ -341,12 +337,7 @@ public final class PropertyParser extend
             next();
             // Push new function (for function context: getPercentBase())
             propInfo.pushFunction(function);
-            if (function.nbArgs() < 0) {
-                // Negative nbArgs --> function with variable number of arguments
-                prop = function.eval(parseVarArgs(function), propInfo);
-            } else {
-                prop = function.eval(parseArgs(function), propInfo);
-            }
+            prop = function.eval(parseArgs(function), propInfo);
             propInfo.popFunction();
             return prop;
 
@@ -362,27 +353,27 @@ public final class PropertyParser extend
      * Parse a comma separated list of function arguments. Each argument
      * may itself be an expression. This method consumes the closing right
      * parenthesis of the argument list.
-     * @param function The function object for which the arguments are
-     * collected.
-     * @return An array of Property objects representing the arguments
-     * found.
+     * @param function The function object for which the arguments are collected.
+     * @return An array of Property objects representing the arguments found.
      * @throws PropertyException If the number of arguments found isn't equal
-     * to the number expected.
+     * to the number expected or if another argument parsing error occurs.
      */
     Property[] parseArgs(Function function) throws PropertyException {
-        int nbArgs = function.nbArgs();
-        Property[] args = new Property[nbArgs];
-        Property prop;
-        int i = 0;
+        int numReq = function.getRequiredArgsCount();   // # required args
+        int numOpt = function.getOptionalArgsCount();   // # optional args
+        boolean hasVar = function.hasVariableArgs();    // has variable args
+        List<Property> args = new java.util.ArrayList<Property>(numReq + numOpt);
         if (currentToken == TOK_RPAR) {
             // No args: func()
             next();
         } else {
             while (true) {
-
-                prop = parseAdditiveExpr();
-                if (i < nbArgs) {
-                    args[i++] = prop;
+                Property p = parseAdditiveExpr();
+                int i = args.size();
+                if ( ( i < numReq ) || ( ( i - numReq ) < numOpt ) || hasVar ) {
+                    args.add ( p );
+                } else {
+                    throw new PropertyException ( "Unexpected function argument at index " + i );
                 }
                 // ignore extra args
                 if (currentToken != TOK_COMMA) {
@@ -392,66 +383,19 @@ public final class PropertyParser extend
             }
             expectRpar();
         }
-        if (i == nbArgs - 1 && function.padArgsWithPropertyName()) {
-            args[i++] = StringProperty.getInstance(
-                            propInfo.getPropertyMaker().getName());
-        }
-        if (nbArgs != i) {
-            throw new PropertyException("Expected " + nbArgs
-                                        + ", but got " + i + " args for function");
-        }
-        return args;
-    }
-
-    /**
-     *
-     * Parse a comma separated list of function arguments. Each argument
-     * may itself be an expression. This method consumes the closing right
-     * parenthesis of the argument list.
-     *
-     * The method differs from parseArgs in that it accepts a variable
-     * number of arguments.
-     *
-     * @param function The function object for which the arguments are
-     * collected.
-     * @return An array of Property objects representing the arguments
-     * found.
-     * @throws PropertyException If the number of arguments found isn't equal
-     * to the number expected.
-     *
-     * TODO Merge this with parseArgs?
-     */
-    Property[] parseVarArgs(Function function) throws PropertyException {
-        // For variable argument functions the minimum number of arguments is returned as a
-        // negative integer from the nbArgs method
-        int nbArgs = -function.nbArgs();
-        List args = new LinkedList();
-        Property prop;
-        if (currentToken == TOK_RPAR) {
-            // No args: func()
-            next();
+        int numArgs = args.size();
+        if ( numArgs < numReq ) {
+            throw new PropertyException("Expected " + numReq + " required arguments, but only " + numArgs + " specified");
         } else {
-            while (true) {
-                prop = parseAdditiveExpr();
-                args.add(prop);
-                // ignore extra args
-                if (currentToken != TOK_COMMA) {
-                    break;
+            for ( int i = 0; i < numOpt; i++ ) {
+                if ( args.size() < ( numReq + i + 1 ) ) {
+                    args.add ( function.getOptionalArgDefault ( i, propInfo ) );
                 }
-                next();
             }
-            expectRpar();
         }
-        if (nbArgs > args.size()) {
-            throw new PropertyException("Expected at least " + nbArgs
-                                        + ", but got " + args.size() + " args for function");
-        }
-        Property[] propArray = new Property[args.size()];
-        args.toArray(propArray);
-        return propArray;
+        return (Property[]) args.toArray ( new Property [ args.size() ] );
     }
 
-
     /**
      * Evaluate an addition operation. If either of the arguments is null,
      * this means that it wasn't convertible to a Numeric value.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/PropertyTokenizer.java Mon May 28 15:30:46 2012
@@ -67,7 +67,7 @@ class PropertyTokenizer {
     }
 
     /**
-     * Return the next token in the expression string.
+     * Parse the next token in the expression string.
      * This sets the following package visible variables:
      * currentToken  An enumerated value identifying the recognized token
      * currentTokenValue  A String containing the token contents

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RGBColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RGBColorFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RGBColorFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RGBColorFunction.java Mon May 28 15:30:46 2012
@@ -19,8 +19,8 @@
 
 package org.apache.fop.fo.expr;
 
-import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.properties.ColorProperty;
 import org.apache.fop.fo.properties.Property;
 
@@ -30,22 +30,18 @@ import org.apache.fop.fo.properties.Prop
 class RGBColorFunction extends FunctionBase {
 
     /** {@inheritDoc} */
-    public int nbArgs() {
+    public int getRequiredArgsCount() {
         return 3;
     }
 
-    /**
-     * @return an object which implements the PercentBase interface.
-     * Percents in arguments to this function are interpreted relative
-     * to 255.
-     */
+    @Override
+    /** {@inheritDoc} */
     public PercentBase getPercentBase() {
         return new RGBPercentBase();
     }
 
     /** {@inheritDoc} */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
       return ColorProperty.getInstance(pInfo.getUserAgent(),
                                        "rgb(" + args[0] + ","
                                        + args[1] + "," + args[2] + ")");

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java Mon May 28 15:30:46 2012
@@ -20,10 +20,11 @@
 package org.apache.fop.fo.expr;
 
 import org.apache.fop.datatypes.Length;
-import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.datatypes.PercentBaseContext;
 import org.apache.fop.fo.properties.Property;
 import org.apache.fop.fo.properties.TableColLength;
+import org.apache.fop.util.CompareUtil;
 
 
 /**
@@ -173,6 +174,7 @@ public class RelativeNumericProperty ext
      * Cast this numeric as a Length.
      * @return numeric value as length
      */
+    @Override
     public Length getLength() {
         if (dimension == 1) {
             return this;
@@ -182,6 +184,7 @@ public class RelativeNumericProperty ext
     }
 
     /** @return numeric value */
+    @Override
     public Numeric getNumeric() {
         return this;
     }
@@ -223,7 +226,8 @@ public class RelativeNumericProperty ext
      *         specification.
      */
     public double getTableUnits() {
-        double tu1 = 0.0, tu2 = 0.0;
+        double tu1 = 0.0;
+        double tu2 = 0.0;
         if (op1 instanceof RelativeNumericProperty) {
             tu1 = ((RelativeNumericProperty) op1).getTableUnits();
         } else if (op1 instanceof TableColLength) {
@@ -272,6 +276,7 @@ public class RelativeNumericProperty ext
      * Return a string represention of the expression. Only used for debugging.
      * @return the string representation.
      */
+    @Override
     public String toString() {
         switch (operation) {
         case ADDITION: case SUBTRACTION:
@@ -289,4 +294,30 @@ public class RelativeNumericProperty ext
             return "unknown operation " + operation;
         }
     }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + dimension;
+        result = prime * result + CompareUtil.getHashCode(op1);
+        result = prime * result + CompareUtil.getHashCode(op2);
+        result = prime * result + operation;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof RelativeNumericProperty)) {
+            return false;
+        }
+        RelativeNumericProperty other = (RelativeNumericProperty) obj;
+        return dimension == other.dimension
+                && CompareUtil.equal(op1, other.op1)
+                && CompareUtil.equal(op2, other.op2)
+                && operation == other.operation;
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RoundFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RoundFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RoundFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/RoundFunction.java Mon May 28 15:30:46 2012
@@ -24,12 +24,14 @@ import org.apache.fop.fo.properties.Numb
 import org.apache.fop.fo.properties.Property;
 
 class RoundFunction extends FunctionBase {
-    public int nbArgs() {
+
+    /** {@inheritDoc} */
+    public int getRequiredArgsCount() {
         return 1;
     }
 
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    /** {@inheritDoc} */
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         Number dbl = args[0].getNumber();
         if (dbl == null) {
             throw new PropertyException("Non number operand to round function");

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/SystemColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/SystemColorFunction.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/SystemColorFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/expr/SystemColorFunction.java Mon May 28 15:30:46 2012
@@ -29,13 +29,12 @@ import org.apache.fop.fo.properties.Prop
 class SystemColorFunction extends FunctionBase {
 
     /** {@inheritDoc} */
-    public int nbArgs() {
+    public int getRequiredArgsCount() {
         return 1;
     }
 
     /** {@inheritDoc} */
-    public Property eval(Property[] args,
-                         PropertyInfo pInfo) throws PropertyException {
+    public Property eval(Property[] args, PropertyInfo pInfo) throws PropertyException {
         FOUserAgent ua = (pInfo == null)
                 ? null
                 : (pInfo.getFO() == null ? null : pInfo.getFO().getUserAgent());

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/ExtensionObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/ExtensionObj.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/ExtensionObj.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/ExtensionObj.java Mon May 28 15:30:46 2012
@@ -19,14 +19,14 @@
 
 package org.apache.fop.fo.extensions;
 
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FOEventHandler;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-
 
 /**
  * Base class for pdf bookmark extension objects.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java Mon May 28 15:30:46 2012
@@ -20,12 +20,15 @@
 package org.apache.fop.fo.extensions.svg;
 
 import java.util.HashMap;
+
 import javax.xml.parsers.SAXParserFactory;
 
+import org.w3c.dom.DOMImplementation;
+
 import org.apache.batik.util.XMLResourceDescriptor;
+
 import org.apache.fop.fo.ElementMapping;
 import org.apache.fop.fo.FONode;
-import org.w3c.dom.DOMImplementation;
 
 /**
  * This Element Mapping is for Batik SVG Extension elements

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/svg/SVGElementMapping.java Mon May 28 15:30:46 2012
@@ -20,16 +20,19 @@
 package org.apache.fop.fo.extensions.svg;
 
 import java.util.HashMap;
+
 import javax.xml.parsers.SAXParserFactory;
 
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.ElementMapping;
+import org.w3c.dom.DOMImplementation;
 
-import org.apache.batik.util.XMLResourceDescriptor;
-import org.apache.batik.dom.svg.SVGDOMImplementation;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.DOMImplementation;
+
+import org.apache.batik.dom.svg.SVGDOMImplementation;
+import org.apache.batik.util.XMLResourceDescriptor;
+
+import org.apache.fop.fo.ElementMapping;
+import org.apache.fop.fo.FONode;
 
 /**
  * Setup the SVG element mapping.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/AbstractMetadataElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/AbstractMetadataElement.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/AbstractMetadataElement.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/AbstractMetadataElement.java Mon May 28 15:30:46 2012
@@ -19,12 +19,13 @@
 
 package org.apache.fop.fo.extensions.xmp;
 
+import org.apache.xmlgraphics.xmp.Metadata;
+
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.extensions.ExtensionAttachment;
 import org.apache.fop.util.ContentHandlerFactory;
 import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener;
-import org.apache.xmlgraphics.xmp.Metadata;
 
 /**
  * Abstract base class for the XMP and RDF root nodes.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/RDFElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/RDFElement.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/RDFElement.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/RDFElement.java Mon May 28 15:30:46 2012
@@ -19,9 +19,10 @@
 
 package org.apache.fop.fo.extensions.xmp;
 
-import org.apache.fop.fo.FONode;
 import org.apache.xmlgraphics.xmp.XMPConstants;
 
+import org.apache.fop.fo.FONode;
+
 /**
  * Represents the top-level "RDF" element used by XMP metadata.
  */

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/RDFElementMapping.java Mon May 28 15:30:46 2012
@@ -21,11 +21,12 @@ package org.apache.fop.fo.extensions.xmp
 
 import java.util.HashMap;
 
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.ElementMapping;
+import org.w3c.dom.DOMImplementation;
+
 import org.apache.xmlgraphics.xmp.XMPConstants;
 
-import org.w3c.dom.DOMImplementation;
+import org.apache.fop.fo.ElementMapping;
+import org.apache.fop.fo.FONode;
 
 /**
  * Setup the element mapping for XMP metadata.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPContentHandlerFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPContentHandlerFactory.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPContentHandlerFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPContentHandlerFactory.java Mon May 28 15:30:46 2012
@@ -19,12 +19,14 @@
 
 package org.apache.fop.fo.extensions.xmp;
 
-import org.apache.fop.util.ContentHandlerFactory;
-import org.apache.xmlgraphics.xmp.XMPConstants;
-import org.apache.xmlgraphics.xmp.XMPHandler;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
+import org.apache.xmlgraphics.xmp.XMPConstants;
+import org.apache.xmlgraphics.xmp.XMPHandler;
+
+import org.apache.fop.util.ContentHandlerFactory;
+
 /**
  * ContentHandlerFactory for the XMP root element.
  */

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPElementMapping.java Mon May 28 15:30:46 2012
@@ -21,11 +21,12 @@ package org.apache.fop.fo.extensions.xmp
 
 import java.util.HashMap;
 
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.ElementMapping;
+import org.w3c.dom.DOMImplementation;
+
 import org.apache.xmlgraphics.xmp.XMPConstants;
 
-import org.w3c.dom.DOMImplementation;
+import org.apache.fop.fo.ElementMapping;
+import org.apache.fop.fo.FONode;
 
 /**
  * Setup the element mapping for XMP metadata.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPMetaElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPMetaElement.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPMetaElement.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPMetaElement.java Mon May 28 15:30:46 2012
@@ -19,9 +19,10 @@
 
 package org.apache.fop.fo.extensions.xmp;
 
-import org.apache.fop.fo.FONode;
 import org.apache.xmlgraphics.xmp.XMPConstants;
 
+import org.apache.fop.fo.FONode;
+
 /**
  * Represents the top-level "xmpmeta" element used by XMP metadata.
  */

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/extensions/xmp/XMPMetadata.java Mon May 28 15:30:46 2012
@@ -21,12 +21,14 @@ package org.apache.fop.fo.extensions.xmp
 
 import java.io.Serializable;
 
-import org.apache.fop.fo.extensions.ExtensionAttachment;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
 import org.apache.xmlgraphics.util.XMLizable;
 import org.apache.xmlgraphics.xmp.Metadata;
 import org.apache.xmlgraphics.xmp.XMPConstants;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
+
+import org.apache.fop.fo.extensions.ExtensionAttachment;
 
 /**
  * This is the pass-through value object for the XMP metadata extension.

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractGraphics.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractGraphics.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractGraphics.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractGraphics.java Mon May 28 15:30:46 2012
@@ -19,8 +19,11 @@
 
 package org.apache.fop.fo.flow;
 
+import java.util.Stack;
+
 import org.apache.fop.accessibility.StructureTreeElement;
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.FObj;
@@ -33,6 +36,7 @@ import org.apache.fop.fo.properties.Keep
 import org.apache.fop.fo.properties.LengthRangeProperty;
 import org.apache.fop.fo.properties.SpaceProperty;
 import org.apache.fop.fo.properties.StructureTreeElementHolder;
+import org.apache.fop.util.CharUtilities;
 
 /**
  * Common base class for the <a href="http://www.w3.org/TR/xsl/#fo_instream-foreign-object">
@@ -77,8 +81,6 @@ public abstract class AbstractGraphics e
     //     private int scalingMethod;
     // End of property values
 
-
-
     /**
      * constructs an instream-foreign-object object (called by Maker).
      *
@@ -250,4 +252,18 @@ public abstract class AbstractGraphics e
 
     /** @return the graphic's intrinsic alignment-adjust */
     public abstract Length getIntrinsicAlignmentAdjust();
+
+    @Override
+    public boolean isDelimitedTextRangeBoundary ( int boundary ) {
+        return false;
+    }
+
+    @Override
+    protected Stack collectDelimitedTextRanges ( Stack ranges, DelimitedTextRange currentRange ) {
+        if ( currentRange != null ) {
+            currentRange.append ( CharUtilities.OBJECT_REPLACEMENT_CHARACTER, this );
+        }
+        return ranges;
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java Mon May 28 15:30:46 2012
@@ -20,12 +20,14 @@
 package org.apache.fop.fo.flow;
 
 import java.awt.Color;
+import java.util.Stack;
 
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
 
 import org.apache.fop.accessibility.StructureTreeElement;
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
@@ -39,6 +41,7 @@ import org.apache.fop.fo.properties.Comm
 import org.apache.fop.fo.properties.CommonTextDecoration;
 import org.apache.fop.fo.properties.SpaceProperty;
 import org.apache.fop.fo.properties.StructureTreeElementHolder;
+import org.apache.fop.util.CharUtilities;
 
 /**
  * Common base class for the <a href="http://www.w3.org/TR/xsl/#fo_page-number-citation">
@@ -197,4 +200,17 @@ public abstract class AbstractPageNumber
         return refId;
     }
 
+    @Override
+    public boolean isDelimitedTextRangeBoundary ( int boundary ) {
+        return false;
+    }
+
+    @Override
+    protected Stack collectDelimitedTextRanges ( Stack ranges, DelimitedTextRange currentRange ) {
+        if ( currentRange != null ) {
+            currentRange.append ( CharUtilities.OBJECT_REPLACEMENT_CHARACTER, this );
+        }
+        return ranges;
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java Mon May 28 15:30:46 2012
@@ -103,17 +103,30 @@ public abstract class AbstractRetrieveMa
                         pList,
                         newPropertyList);
                 addChildTo(newChild, newParent);
-                if (newChild.getNameId() == FO_TABLE) {
+                switch ( newChild.getNameId() ) {
+                case FO_TABLE:
                     Table t = (Table) child;
                     cloneSubtree(t.getColumns().iterator(),
-                            newChild, marker, newPropertyList);
+                                 newChild, marker, newPropertyList);
                     cloneSingleNode(t.getTableHeader(),
-                            newChild, marker, newPropertyList);
+                                    newChild, marker, newPropertyList);
                     cloneSingleNode(t.getTableFooter(),
-                            newChild, marker, newPropertyList);
+                                    newChild, marker, newPropertyList);
+                    cloneSubtree(child.getChildNodes(),
+                                    newChild, marker, newPropertyList);
+                    break;
+                case FO_LIST_ITEM:
+                    ListItem li = (ListItem) child;
+                    cloneSingleNode(li.getLabel(),
+                                    newChild, marker, newPropertyList);
+                    cloneSingleNode(li.getBody(),
+                                    newChild, marker, newPropertyList);
+                    break;
+                default:
+                    cloneSubtree(child.getChildNodes(),
+                                    newChild, marker, newPropertyList);
+                    break;
                 }
-                cloneSubtree(child.getChildNodes(), newChild,
-                        marker, newPropertyList);
             } else if (child instanceof FOText) {
                 FOText ft = (FOText) newChild;
                 ft.bind(parentPropertyList);

Modified: xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/BidiOverride.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/BidiOverride.java?rev=1343285&r1=1343284&r2=1343285&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/BidiOverride.java (original)
+++ xmlgraphics/fop/branches/Temp_URI_Unification/src/java/org/apache/fop/fo/flow/BidiOverride.java Mon May 28 15:30:46 2012
@@ -19,38 +19,31 @@
 
 package org.apache.fop.fo.flow;
 
-import org.xml.sax.Locator;
+import java.util.Iterator;
+import java.util.Stack;
 
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
+import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FObjMixed;
 import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.properties.SpaceProperty;
+import org.apache.fop.fo.properties.Property;
+import org.apache.fop.util.CharUtilities;
 
 /**
  * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_bidi-override">
  * <code>fo:bidi-override</code></a> object.
  */
-public class BidiOverride extends FObjMixed {
+public class BidiOverride extends Inline {
 
-    // used for FO validation
-    private boolean blockOrInlineItemFound = false;
-    private boolean canHaveBlockLevelChildren = true;
-    // The value of properties relevant for fo:bidi-override.
-    // private ToBeImplementedProperty prDirection;
-    // private ToBeImplementedProperty prLetterSpacing;
-    private SpaceProperty lineHeight;
-    // private ToBeImplementedProperty prScoreSpaces;
-    // private ToBeImplementedProperty prUnicodeBidi;
-
-    // Unused but valid items, commented out for performance:
-    //     private CommonAural commonAural;
-    //     private CommonFont commonFont;
-    //     private CommonRelativePosition commonRelativePosition;
-    //     private Color prColor;
-    //     private SpaceProperty prWordSpacing;
-    // End of property values
+    // The value of FO traits (refined properties) that apply to fo:bidi-override
+    // (that are not implemented by InlineLevel).
+    private Property letterSpacing;
+    private Property wordSpacing;
+    private int direction;
+    private int unicodeBidi;
+    // private int scoreSpaces;
+    // End of trait values
 
     /**
      * Base constructor
@@ -59,66 +52,35 @@ public class BidiOverride extends FObjMi
      */
     public BidiOverride(FONode parent) {
         super(parent);
-
-       /* Check to see if this node can have block-level children.
-        * See validateChildNode() below.
-        */
-       int lvlLeader = findAncestor(FO_LEADER);
-       int lvlInCntr = findAncestor(FO_INLINE_CONTAINER);
-       int lvlInline = findAncestor(FO_INLINE);
-       int lvlFootnote = findAncestor(FO_FOOTNOTE);
-
-       if (lvlLeader > 0) {
-           if (lvlInCntr < 0 || (lvlInCntr > 0 && lvlInCntr > lvlLeader)) {
-               canHaveBlockLevelChildren = false;
-           }
-       } else if (lvlInline > 0 && lvlFootnote == (lvlInline + 1)) {
-           if (lvlInCntr < 0 || (lvlInCntr > 0 && lvlInCntr > lvlInline)) {
-               canHaveBlockLevelChildren = false;
-           }
-       }
-
     }
 
     /** {@inheritDoc} */
     public void bind(PropertyList pList) throws FOPException {
-        // prDirection = pList.get(PR_DIRECTION);
-        // prLetterSpacing = pList.get(PR_LETTER_SPACING);
-        lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
-        // prScoreSpaces = pList.get(PR_SCORE_SPACES);
-        // prUnicodeBidi = pList.get(PR_UNICODE_BIDI);
+        super.bind(pList);
+        letterSpacing = pList.get(PR_LETTER_SPACING);
+        wordSpacing = pList.get(PR_WORD_SPACING);
+        direction = pList.get(PR_DIRECTION).getEnum();
+        unicodeBidi = pList.get(PR_UNICODE_BIDI).getEnum();
     }
 
-    /**
-     * {@inheritDoc}
-     * <br>XSL Content Model: marker* (#PCDATA|%inline;|%block;)*
-     * <br><i>Additionally: "An fo:bidi-override that is a descendant of an fo:leader
-     *  or of the fo:inline child of an fo:footnote may not have block-level
-     *  children, unless it has a nearer ancestor that is an
-     *  fo:inline-container."</i>
-     */
-    protected void validateChildNode(Locator loc, String nsURI, String localName)
-                throws ValidationException {
-        if (FO_URI.equals(nsURI)) {
-            if (localName.equals("marker")) {
-                if (blockOrInlineItemFound) {
-                   nodesOutOfOrderError(loc, "fo:marker",
-                        "(#PCDATA|%inline;|%block;)");
-                }
-            } else if (!isBlockOrInlineItem(nsURI, localName)) {
-                invalidChildError(loc, nsURI, localName);
-            } else if (!canHaveBlockLevelChildren && isBlockItem(nsURI, localName)) {
-                invalidChildError(loc, getParent().getName(), nsURI, getName(),
-                        "rule.bidiOverrideContent");
-            } else {
-                blockOrInlineItemFound = true;
-            }
-        }
+    /** @return the "letter-spacing" trait */
+    public Property getLetterSpacing() {
+        return letterSpacing;
     }
 
-    /** @return the "line-height" property */
-    public SpaceProperty getLineHeight() {
-        return lineHeight;
+    /** @return the "word-spacing" trait */
+    public Property getWordSpacing() {
+        return wordSpacing;
+    }
+
+    /** @return the "direction" trait */
+    public int getDirection() {
+        return direction;
+    }
+
+    /** @return the "unicodeBidi" trait */
+    public int getUnicodeBidi() {
+        return unicodeBidi;
     }
 
     /** {@inheritDoc} */
@@ -133,4 +95,32 @@ public class BidiOverride extends FObjMi
     public int getNameId() {
         return FO_BIDI_OVERRIDE;
     }
+
+    @Override
+    protected Stack collectDelimitedTextRanges ( Stack ranges, DelimitedTextRange currentRange ) {
+        char pfx = 0;
+        char sfx = 0;
+        int unicodeBidi = getUnicodeBidi();
+        int direction = getDirection();
+        if ( unicodeBidi == Constants.EN_BIDI_OVERRIDE ) {
+            pfx = ( direction == Constants.EN_RTL ) ? CharUtilities.RLO : CharUtilities.LRO;
+            sfx = CharUtilities.PDF;
+        } else if ( unicodeBidi == Constants.EN_EMBED ) {
+            pfx = ( direction == Constants.EN_RTL ) ? CharUtilities.RLE : CharUtilities.LRE;
+            sfx = CharUtilities.PDF;
+        }
+        if ( currentRange != null ) {
+            if ( pfx != 0 ) {
+                currentRange.append ( pfx, this );
+            }
+            for ( Iterator it = getChildNodes(); ( it != null ) && it.hasNext();) {
+                ranges = ( (FONode) it.next() ).collectDelimitedTextRanges ( ranges );
+            }
+            if ( sfx != 0 ) {
+                currentRange.append ( sfx, this );
+            }
+        }
+        return ranges;
+    }
+
 }



---------------------------------------------------------------------
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