You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/07/07 16:09:10 UTC

svn commit: r674497 [5/11] - in /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign: ./ lib/ lib/build/ src/codegen/unicode/data/ src/codegen/unicode/java/org/apache/fop/text/linebreak/ src/documentation/ src/documentation/content/xdocs/ src/documentation...

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableFObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableFObj.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableFObj.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableFObj.java Mon Jul  7 07:09:01 2008
@@ -34,6 +34,8 @@
 import org.apache.fop.fo.properties.Property;
 import org.apache.fop.fo.properties.PropertyMaker;
 import org.apache.fop.layoutmgr.table.CollapsingBorderModel;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
 
 /**
  * Common base class for table-related FOs
@@ -53,9 +55,10 @@
     CollapsingBorderModel collapsingBorderModel;
 
     /**
-     * Main constructor
+     * Create a TableFObj instance that is a child
+     * of the given {@link FONode}
      *
-     * @param parent    the parent node
+     * @param parent the parent {@link FONode}
      */
     public TableFObj(FONode parent) {
         super(parent);
@@ -79,6 +82,8 @@
     }
 
     /**
+     * Return the value for the "border-precedence" property
+     * for the given side.
      *
      * @param side  the side for which to return the border precedence
      * @return the "border-precedence" value for the given side
@@ -100,13 +105,13 @@
 
     /**
      * Convenience method to returns a reference
-     * to the base Table instance
+     * to the base {@link Table} instance.
      *
      * @return  the base table instance
      *
      */
     public Table getTable() {
-        // Will be overridden in Table; for any other Table-node, recursive call to
+        // Overridden in Table; for any other Table-node, recursive call to
         // parent.getTable()
         return ((TableFObj) parent).getTable();
     }
@@ -117,13 +122,13 @@
     public abstract CommonBorderPaddingBackground getCommonBorderPaddingBackground();
 
     /**
-     * PropertyMaker subclass for the column-number property
-     *
+     * {@link PropertyMaker} subclass for the column-number property
      */
     public static class ColumnNumberPropertyMaker extends PropertyMaker {
 
         /**
          * Constructor
+         *
          * @param propId    the id of the property for which the maker should
          *                  be created
          */
@@ -142,47 +147,50 @@
 
 
         /**
+         * {@inheritDoc}
          * Check the value of the column-number property.
-         * Return the parent's column index (initial value) in case
-         * of a negative or zero value
-         *
-         * @see org.apache.fop.fo.properties.PropertyMaker#make(PropertyList, String, FObj)
          */
         public Property make(PropertyList propertyList, String value, FObj fo)
                     throws PropertyException {
+
             Property p = super.make(propertyList, value, fo);
 
-            ColumnNumberManagerHolder parent
-                    = (ColumnNumberManagerHolder) propertyList.getParentFObj();
-            ColumnNumberManager columnIndexManager =  parent.getColumnNumberManager();
             int columnIndex = p.getNumeric().getValue();
             int colSpan = propertyList.get(Constants.PR_NUMBER_COLUMNS_SPANNED)
                                 .getNumeric().getValue();
-            
-            int i = columnIndex - 1;
-            int lastIndex = (columnIndex + colSpan) - 1;
-            while (++i < lastIndex) {
-                if (columnIndexManager.isColumnNumberUsed(i)) {
-                    /* if column-number is already in use by another
-                     * cell/column => error!
-                     */
-                    TableEventProducer eventProducer = TableEventProducer.Provider.get(
-                            fo.getUserAgent().getEventBroadcaster());
-                    eventProducer.cellOverlap(this, propertyList.getFObj().getName(),
-                                                i, fo.getLocator());
+
+            // only check whether the column-number is occupied in case it was
+            // specified on a fo:table-cell or fo:table-column
+            int foId = propertyList.getFObj().getNameId();
+            if (foId == FO_TABLE_COLUMN || foId == FO_TABLE_CELL) {
+                ColumnNumberManagerHolder parent
+                        = (ColumnNumberManagerHolder) propertyList.getParentFObj();
+                ColumnNumberManager columnIndexManager = parent.getColumnNumberManager();
+                int lastIndex = columnIndex - 1 + colSpan;
+                for (int i = columnIndex; i <= lastIndex; ++i) {
+                    if (columnIndexManager.isColumnNumberUsed(i)) {
+                        /* if column-number is already in use by another
+                         * cell/column => error!
+                         */
+                        TableEventProducer eventProducer
+                                = TableEventProducer.Provider.get(
+                                    fo.getUserAgent().getEventBroadcaster());
+                        eventProducer.cellOverlap(
+                                this, propertyList.getFObj().getName(),
+                                i, propertyList.getFObj().getLocator());
+                    }
                 }
             }
-
             return p;
         }
-        
+
         /**
-         * If the value is not positive, return a property whose value is the next column number
-         * 
          * {@inheritDoc}
+         * If the value is not positive, return a property whose value
+         * is the next column number.
          */
-        public Property convertProperty(Property p, 
-                                        PropertyList propertyList, FObj fo) 
+        public Property convertProperty(Property p,
+                                        PropertyList propertyList, FObj fo)
                     throws PropertyException {
             if (p instanceof EnumProperty) {
                 return EnumNumber.getInstance(p);
@@ -190,11 +198,24 @@
             Number val = p.getNumber();
             if (val != null) {
                 int i = Math.round(val.floatValue());
+                int foId = propertyList.getFObj().getNameId();
                 if (i <= 0) {
-                    ColumnNumberManagerHolder parent =
-                        (ColumnNumberManagerHolder) propertyList.getParentFObj();
-                    ColumnNumberManager columnIndexManager =  parent.getColumnNumberManager();
-                    i = columnIndexManager.getCurrentColumnNumber();
+                    if (foId == FO_TABLE_CELL || foId == FO_TABLE_COLUMN) {
+                        ColumnNumberManagerHolder parent =
+                            (ColumnNumberManagerHolder) propertyList.getParentFObj();
+                        ColumnNumberManager columnIndexManager = parent.getColumnNumberManager();
+                        i = columnIndexManager.getCurrentColumnNumber();
+                    } else {
+                        /* very exceptional case:
+                         * negative column-number specified on
+                         * a FO that is not a fo:table-cell or fo:table-column
+                         */
+                        i = 1;
+                    }
+                    TableEventProducer eventProducer =
+                        TableEventProducer.Provider.get(fo.getUserAgent().getEventBroadcaster());
+                    eventProducer.forceNextColumnNumber(this, propertyList.getFObj().getName(),
+                                                        val, i, propertyList.getFObj().getLocator());
                 }
                 return NumberProperty.getInstance(i);
             }
@@ -204,8 +225,8 @@
     }
 
     /** {@inheritDoc} */
-    public void startOfNode() throws FOPException {
-        super.startOfNode();
+    public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException {
+        super.processNode(elementName, locator, attlist, pList);
         Table table = getTable();
         if (!inMarker() && !table.isSeparateBorderModel()) {
             collapsingBorderModel = CollapsingBorderModel.getBorderModelFor(table
@@ -213,15 +234,7 @@
             setCollapsedBorders();
         }
     }
-
-    /*
-     * TODO made public so that RetrieveMarker can access it.
-     */
-    /** {@inheritDoc} */
-    public void endOfNode() throws FOPException {
-        super.endOfNode();
-    }
-
+    
     /**
      * Prepares the borders of this element if the collapsing-border model is in use.
      * Conflict resolution with parent elements is done where applicable.
@@ -236,26 +249,26 @@
     /**
      * Creates a BorderSpecification from the border set on the given side. If no border
      * is set, a BorderSpecification with border-style none is created.
-     * 
+     *
      * @param side one of CommonBorderPaddingBackground.BEFORE|AFTER|START|END
      */
     private void createBorder(int side) {
         BorderSpecification borderSpec = new BorderSpecification(
                 getCommonBorderPaddingBackground().getBorderInfo(side), getNameId());
         switch (side) {
-        case CommonBorderPaddingBackground.BEFORE:
-            borderBefore = new ConditionalBorder(borderSpec, collapsingBorderModel);
-            break;
-        case CommonBorderPaddingBackground.AFTER:
-            borderAfter = new ConditionalBorder(borderSpec, collapsingBorderModel);
-            break;
-        case CommonBorderPaddingBackground.START:
-            borderStart = borderSpec;
-            break;
-        case CommonBorderPaddingBackground.END:
-            borderEnd = borderSpec;
-            break;
-        default: assert false;
+            case CommonBorderPaddingBackground.BEFORE:
+                borderBefore = new ConditionalBorder(borderSpec, collapsingBorderModel);
+                break;
+            case CommonBorderPaddingBackground.AFTER:
+                borderAfter = new ConditionalBorder(borderSpec, collapsingBorderModel);
+                break;
+            case CommonBorderPaddingBackground.START:
+                borderStart = borderSpec;
+                break;
+            case CommonBorderPaddingBackground.END:
+                borderEnd = borderSpec;
+                break;
+            default: assert false;
         }
     }
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableFooter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableFooter.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableFooter.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableFooter.java Mon Jul  7 07:09:01 2008
@@ -28,7 +28,7 @@
  * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-footer">
  * <code>fo:table-footer</code></a> object.
  */
-public class TableFooter extends TableBody {
+public class TableFooter extends TablePart {
 
     /**
      * Create a TableFooter instance with the given {@link FONode}
@@ -41,17 +41,15 @@
     }
 
     /** {@inheritDoc} */
-    public void startOfNode() throws FOPException {
+    protected void startOfNode() throws FOPException {
         super.startOfNode();
+        getFOEventHandler().startFooter(this);
     }
 
     /** {@inheritDoc} */
-    public void endOfNode() throws FOPException {
-        if (!(tableRowsFound || tableCellsFound)) {
-            missingChildElementError("marker* (table-row+|table-cell+)");
-        } else {
-            finishLastRowGroup();
-        }
+    protected void endOfNode() throws FOPException {
+        super.endOfNode();
+        getFOEventHandler().endFooter(this);
     }
 
     /** {@inheritDoc} */
@@ -67,8 +65,4 @@
         return FO_TABLE_FOOTER;
     }
 
-    /** {@inheritDoc} */
-    protected boolean isTableFooter() {
-        return true;
-    }
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableHeader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableHeader.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableHeader.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableHeader.java Mon Jul  7 07:09:01 2008
@@ -28,7 +28,7 @@
  * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-header">
  * <code>fo:table-header</code></a> object.
  */
-public class TableHeader extends TableBody {
+public class TableHeader extends TablePart {
 
     /**
      * Create a TableHeader instance with the given {@link FONode}
@@ -40,17 +40,15 @@
     }
 
     /** {@inheritDoc} */
-    public void startOfNode() throws FOPException {
+    protected void startOfNode() throws FOPException {
         super.startOfNode();
+        getFOEventHandler().startHeader(this);
     }
 
     /** {@inheritDoc} */
-    public void endOfNode() throws FOPException {
-        if (!(tableRowsFound || tableCellsFound)) {
-            missingChildElementError("marker* (table-row+|table-cell+)");
-        } else {
-            finishLastRowGroup();
-        }
+    protected void endOfNode() throws FOPException {
+        super.endOfNode();
+        getFOEventHandler().endHeader(this);
     }
 
     /** {@inheritDoc} */
@@ -66,8 +64,4 @@
         return FO_TABLE_HEADER;
     }
 
-    /** {@inheritDoc} */
-    protected boolean isTableHeader() {
-        return true;
-    }
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableRow.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableRow.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableRow.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/TableRow.java Mon Jul  7 07:09:01 2008
@@ -78,32 +78,38 @@
     /** {@inheritDoc} */
     public void processNode(String elementName, Locator locator,
             Attributes attlist, PropertyList pList) throws FOPException {
+        super.processNode(elementName, locator, attlist, pList);
         if (!inMarker()) {
-            TableBody body = (TableBody) parent;
-            pendingSpans = body.pendingSpans;
-            columnNumberManager = body.columnNumberManager;
+            TablePart part = (TablePart) parent;
+            pendingSpans = part.pendingSpans;
+            columnNumberManager = part.columnNumberManager;
         }
-        super.processNode(elementName, locator, attlist, pList);
     }
 
     /** {@inheritDoc} */
     protected void addChildNode(FONode child) throws FOPException {
         if (!inMarker()) {
             TableCell cell = (TableCell) child;
-            TableBody body = (TableBody) getParent();
-            addTableCellChild(cell, body.isFirst(this));
+            TablePart part = (TablePart) getParent();
+            addTableCellChild(cell, part.isFirst(this));
         }
         super.addChildNode(child);
     }
 
     /** {@inheritDoc} */
-    public void startOfNode() throws FOPException {
+    protected void startOfNode() throws FOPException {
         super.startOfNode();
         getFOEventHandler().startRow(this);
     }
 
     /** {@inheritDoc} */
-    public void endOfNode() throws FOPException {
+    protected void endOfNode() throws FOPException {
+        super.endOfNode();
+        getFOEventHandler().endRow(this);
+    }
+
+    /** {@inheritDoc} */
+    public void finalizeNode() throws FOPException {
         if (firstChild == null) {
             missingChildElementError("(table-cell+)");
         }
@@ -111,9 +117,8 @@
             pendingSpans = null;
             columnNumberManager = null;
         }
-        getFOEventHandler().endRow(this);
     }
-
+    
     /**
      * {@inheritDoc} String, String)
      * <br>XSL Content Model: (table-cell+)
@@ -129,8 +134,8 @@
     }
 
     /** {@inheritDoc} */
-    TableBody getTablePart() {
-        return (TableBody) parent;
+    TablePart getTablePart() {
+        return (TablePart) parent;
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java Mon Jul  7 07:09:01 2008
@@ -82,7 +82,7 @@
     }
 
     /** {@inheritDoc} */
-    void endRow(final TableBody part) {
+    void endRow(final TablePart part) {
         events.add(new Event() {
             public void play(RowGroupBuilder rowGroupBuilder) {
                 rowGroupBuilder.endRow(part);
@@ -91,7 +91,7 @@
     }
 
     /** {@inheritDoc} */
-    void startTablePart(final TableBody part) {
+    void startTablePart(final TablePart part) {
         events.add(new Event() {
             public void play(RowGroupBuilder rowGroupBuilder) {
                 rowGroupBuilder.startTablePart(part);

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/Flow.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/Flow.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/Flow.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/Flow.java Mon Jul  7 07:09:01 2008
@@ -50,6 +50,7 @@
 
     /** {@inheritDoc} */
     public void bind(PropertyList pList) throws FOPException {
+        super.bind(pList);
         flowName = pList.get(PR_FLOW_NAME).getString();
     }
     

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/Root.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/Root.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/Root.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/Root.java Mon Jul  7 07:09:01 2008
@@ -27,6 +27,7 @@
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FOEventHandler;
 import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FOTreeBuilderContext;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
@@ -59,6 +60,11 @@
     private int totalPagesGenerated = 0;
 
     /**
+     * Context class used while building the FO tree.
+     */
+    private FOTreeBuilderContext builderContext;
+    
+    /**
      * FOEventHandler object for this FO Tree
      */
     private FOEventHandler foEventHandler = null;
@@ -164,10 +170,23 @@
         return foEventHandler;   
     }
 
-     /**
-     * Gets the last page number generated by the previous page-sequence
-     * @return the last page number, 0 if no page sequences yet generated
+    /**
+     * Sets the builder context for this FO tree.
+     * @param context the builder context to be used
      */
+    public void setBuilderContext(FOTreeBuilderContext context) {
+        this.builderContext = context;
+    }
+
+    /** {@inheritDoc} */
+    public FOTreeBuilderContext getBuilderContext() {
+        return this.builderContext;
+    }
+    
+    /**
+    * Gets the last page number generated by the previous page-sequence
+    * @return the last page number, 0 if no page sequences yet generated
+    */
     public int getEndingPageNumberOfPreviousSequence() {
         return endingPageNumberOfPreviousSequence;
     }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java Mon Jul  7 07:09:01 2008
@@ -51,13 +51,13 @@
      *
      * @param data the character data
      * @param start the start position in the data array
-     * @param end the end position in the character array
+     * @param length the length of the character array
      * @param locator location in fo source file.
      */
-    protected void addCharacters(char[] data, int start, int end,
+    protected void addCharacters(char[] data, int start, int length,
                                  PropertyList pList,
                                  Locator locator) {
-        title += new String(data, start, end - start);
+        title += new String(data, start, length);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java Mon Jul  7 07:09:01 2008
@@ -23,7 +23,6 @@
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.expr.PropertyException;
-import org.apache.fop.fo.properties.LengthProperty;
 
 /**
  * Custom Maker for page-height / page-width
@@ -54,8 +53,8 @@
         Property p = super.get(0, propertyList, tryInherit, tryDefault);    
         FObj fo = propertyList.getFObj();
         String fallbackValue = (propId == Constants.PR_PAGE_HEIGHT)
-            ? fo.getFOEventHandler().getUserAgent().getPageHeight()
-                    : fo.getFOEventHandler().getUserAgent().getPageWidth();
+            ? fo.getUserAgent().getPageHeight()
+                    : fo.getUserAgent().getPageWidth();
         
         if (p.getEnum() == Constants.EN_INDEFINITE) {
             int otherId = (propId == Constants.PR_PAGE_HEIGHT) 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CustomFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CustomFont.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CustomFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/CustomFont.java Mon Jul  7 07:09:01 2008
@@ -190,12 +190,17 @@
         return fontBBox;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public int getFlags() {
         return flags;
     }
+    
+    /** {@inheritDoc} */
+    public boolean isSymbolicFont() {
+        return ((getFlags() & 4) != 0) || "ZapfDingbatsEncoding".equals(getEncodingName());
+        //Note: The check for ZapfDingbats is necessary as the PFM does not reliably indicate
+        //if a font is symbolic.
+    }
 
     /**
      * Returns the font weight (100, 200...800, 900). This value may be different from the

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontDescriptor.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontDescriptor.java Mon Jul  7 07:09:01 2008
@@ -53,7 +53,11 @@
      */
     int getFlags();
 
-
+    /**
+     * Indicates whether the font is a symbolic font.
+     * @return true if the font is a symbolic font (i.e. Symbol or ZapfDingbats)
+     */
+    boolean isSymbolicFont();
     /**
      * Returns the font's bounding box.
      * @return the bounding box

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontReader.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontReader.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/FontReader.java Mon Jul  7 07:09:01 2008
@@ -27,8 +27,6 @@
 
 import javax.xml.parsers.SAXParserFactory;
 
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.fonts.apps.TTFReader;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
@@ -36,6 +34,9 @@
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.DefaultHandler;
 
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.apps.TTFReader;
+
 /**
  * Class for reading a metric.xml file and creating a font object.
  * Typical usage:
@@ -228,11 +229,11 @@
         if ("font-name".equals(localName)) {
             returnFont.setFontName(content);
         } else if ("full-name".equals(localName)) {
-            multiFont.setFullName(content);
+            returnFont.setFullName(content);
         } else if ("family-name".equals(localName)) {
             Set s = new java.util.HashSet();
             s.add(content);
-            multiFont.setFamilyNames(s);
+            returnFont.setFamilyNames(s);
         } else if ("ttc-name".equals(localName) && isCID) {
             multiFont.setTTCName(content);
         } else if ("encoding".equals(localName)) {

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/LazyFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/LazyFont.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/LazyFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/LazyFont.java Mon Jul  7 07:09:01 2008
@@ -321,14 +321,18 @@
         return realFontDescriptor.getAscender();
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public int getFlags() {
         load(true);
         return realFontDescriptor.getFlags();
     }
 
+    /** {@inheritDoc} */
+    public boolean isSymbolicFont() {
+        load(true);
+        return realFontDescriptor.isSymbolicFont();
+    }
+
     /**
      * {@inheritDoc}
      */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/SingleByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/SingleByteFont.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/SingleByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/SingleByteFont.java Mon Jul  7 07:09:01 2008
@@ -50,8 +50,8 @@
     
     /** {@inheritDoc} */
     public boolean isEmbeddable() {
-        return (getEmbedFileName() == null && getEmbedResourceName() == null) ? false
-               : true;
+        return (!(getEmbedFileName() == null 
+                && getEmbedResourceName() == null));
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/fonts/autodetect/UnixFontDirFinder.java Mon Jul  7 07:09:01 2008
@@ -32,6 +32,7 @@
         return new String[] {
             System.getProperty("user.home") + "/.fonts", // user
             "/usr/local/fonts", // local
+            "/usr/local/share/fonts", // local shared
             "/usr/share/fonts", // system
             "/usr/X11R6/lib/X11/fonts" // X
         };

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java Mon Jul  7 07:09:01 2008
@@ -34,17 +34,17 @@
 public abstract class AbstractBaseLayoutManager 
     implements LayoutManager, PercentBaseContext {
     
-    /** Indicator if this LM generates reference areas */
+    /** Indicator if this LM generates reference areas. */
     protected boolean generatesReferenceArea = false;
-    /** Indicator if this LM generates block areas */
+    /** Indicator if this LM generates block areas. */
     protected boolean generatesBlockArea = false;
-    /** The formatting object for this LM */
+    /** The formatting object for this LM. */
     protected final FObj fobj;
 
     /**
      * logging instance
      */
-    private static Log log = LogFactory.getLog(AbstractBaseLayoutManager.class);
+    private static final Log LOG = LogFactory.getLog(AbstractBaseLayoutManager.class);
 
     /**
      * Abstract base layout manager.
@@ -69,8 +69,8 @@
     // --------- Property Resolution related functions --------- //
     
     /** {@inheritDoc} */
-    public int getBaseLength(int lengthBase, FObj fobj) {
-        if (fobj == this.fobj) {
+    public int getBaseLength(int lengthBase, FObj fobjx) {
+        if (fobjx == this.fobj) {
             switch (lengthBase) {
             case LengthBase.CONTAINING_BLOCK_WIDTH:
                 return getAncestorBlockAreaIPD();
@@ -81,20 +81,20 @@
             case LengthBase.CONTAINING_REFAREA_WIDTH:
                 return getReferenceAreaIPD();
             default:
-                log.error("Unknown base type for LengthBase:" + lengthBase);
+                LOG.error("Unknown base type for LengthBase:" + lengthBase);
                 return 0;
             }
         } else {
             LayoutManager lm = getParent();
-            while (lm != null && fobj != lm.getFObj()) {
+            while (lm != null && fobjx != lm.getFObj()) {
                 lm = lm.getParent();
             }
             if (lm != null) {
-                return lm.getBaseLength(lengthBase, fobj);
+                return lm.getBaseLength(lengthBase, fobjx);
             }
         }
-        log.error("Cannot find LM to handle given FO for LengthBase. ("
-                + fobj.getContextInfo() + ")");
+        LOG.error("Cannot find LM to handle given FO for LengthBase. ("
+                + fobjx.getContextInfo() + ")");
         return 0;
     }
 
@@ -111,7 +111,7 @@
             }
             lm = lm.getParent();
         }
-        log.error("No parent LM found");
+        LOG.error("No parent LM found");
         return 0;
     }
 
@@ -128,7 +128,7 @@
             }
             lm = lm.getParent();
         }
-        log.error("No parent LM found");
+        LOG.error("No parent LM found");
         return 0;
     }
 
@@ -141,7 +141,7 @@
         if (lm != null) {
             return lm.getContentAreaIPD();
         }
-        log.error("No parent LM found");
+        LOG.error("No parent LM found");
         return 0;
     }
 
@@ -154,7 +154,7 @@
         if (lm != null) {
             return lm.getContentAreaBPD();
         }
-        log.error("No parent LM found");
+        LOG.error("No parent LM found");
         return 0;
     }
 
@@ -171,7 +171,7 @@
             }
             lm = lm.getParent();
         }
-        log.error("No parent LM found");
+        LOG.error("No parent LM found");
         return 0;
     }
 
@@ -188,7 +188,7 @@
             }
             lm = lm.getParent();
         }
-        log.error("No parent LM found");
+        LOG.error("No parent LM found");
         return 0;
     }
 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Mon Jul  7 07:09:01 2008
@@ -28,6 +28,7 @@
 
 import org.apache.fop.fo.Constants;
 import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.ListUtil;
 
 /**
  * Abstract base class for breakers (page breakers, static region handlers etc.).
@@ -116,8 +117,8 @@
         public KnuthSequence endSequence(Position breakPosition) {
             // remove glue and penalty item at the end of the paragraph
             while (this.size() > ignoreAtStart
-                   && !((KnuthElement)this.get(this.size() - 1)).isBox()) {
-                this.remove(this.size() - 1);
+                    && !((KnuthElement) ListUtil.getLast(this)).isBox()) {
+                ListUtil.removeLast(this);
             }
             if (this.size() > ignoreAtStart) {
                 // add the elements representing the space at the end of the last line
@@ -211,11 +212,11 @@
      * getNextKnuthElements() implementation(s) that are to be called. 
      * @return LinkedList of Knuth elements.  
      */
-    protected abstract LinkedList getNextKnuthElements(LayoutContext context, int alignment);
+    protected abstract List getNextKnuthElements(LayoutContext context, int alignment);
 
     /** @return true if there's no content that could be handled. */
     public boolean isEmpty() {
-        return (this.blockLists.size() == 0);
+        return (this.blockLists.isEmpty());
     }
     
     protected void startPart(BlockSequence list, int breakClass) {
@@ -549,9 +550,9 @@
         childLC.signalSpanChange(Constants.NOT_SET);
         
         BlockSequence blockList;
-        LinkedList returnedList = getNextKnuthElements(childLC, alignment);
+        List returnedList = getNextKnuthElements(childLC, alignment);
         if (returnedList != null) {
-            if (returnedList.size() == 0) {
+            if (returnedList.isEmpty()) {
                 nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn);
                 return nextSequenceStartsOn;
             }
@@ -561,8 +562,9 @@
             nextSequenceStartsOn = handleSpanChange(childLC, nextSequenceStartsOn);
             
             Position breakPosition = null;
-            if (((KnuthElement) returnedList.getLast()).isForcedBreak()) {
-                KnuthPenalty breakPenalty = (KnuthPenalty)returnedList.removeLast();
+            if (((KnuthElement) ListUtil.getLast(returnedList)).isForcedBreak()) {
+                KnuthPenalty breakPenalty = (KnuthPenalty) ListUtil
+                        .removeLast(returnedList);
                 breakPosition = breakPenalty.getPosition();
                 switch (breakPenalty.getBreakClass()) {
                 case Constants.EN_PAGE:
@@ -743,12 +745,12 @@
                     if (!bBoxSeen) {
                         // this is the first box met in this page
                         bBoxSeen = true;
-                    } else if (unconfirmedList.size() > 0) {
-                        // glue items in unconfirmedList were not after
-                        // the last box
-                        // in this page; they must be added to
-                        // blockSpaceList
-                        while (unconfirmedList.size() > 0) {
+                    } else {
+                        while (!unconfirmedList.isEmpty()) {
+                            // glue items in unconfirmedList were not after
+                            // the last box
+                            // in this page; they must be added to
+                            // blockSpaceList
                             KnuthGlue blockSpace = (KnuthGlue) unconfirmedList
                                     .removeFirst();
                             spaceMaxAdjustment.max += ((KnuthGlue) blockSpace)

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Mon Jul  7 07:09:01 2008
@@ -20,14 +20,12 @@
 package org.apache.fop.layoutmgr;
 
 import java.util.ArrayList;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.area.Area;
 import org.apache.fop.area.PageViewport;
 import org.apache.fop.fo.Constants;
@@ -152,7 +150,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context,
+    public List getNextKnuthElements(LayoutContext context,
                                            int alignment) {
         log.warn("null implementation of getNextKnuthElements() called!");
         setFinished(true);
@@ -160,7 +158,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getChangedKnuthElements(List oldList,
+    public List getChangedKnuthElements(List oldList,
                                               int alignment) {
         log.warn("null implementation of getChangeKnuthElement() called!");
         return null;

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Mon Jul  7 07:09:01 2008
@@ -39,6 +39,7 @@
 import org.apache.fop.fo.properties.CommonAbsolutePosition;
 import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.traits.SpaceVal;
+import org.apache.fop.util.ListUtil;
 
 /**
  * LayoutManager for a block-container FO.
@@ -189,7 +190,7 @@
     }
     
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
         resetSpaces();
         if (isAbsoluteOrFixed()) {
             return getNextKnuthElementsAbsolute(context, alignment);
@@ -247,9 +248,9 @@
         
         MinOptMax stackLimit = new MinOptMax(relDims.bpd);
 
-        LinkedList returnedList;
-        LinkedList contentList = new LinkedList();
-        LinkedList returnList = new LinkedList();
+        List returnedList;
+        List contentList = new LinkedList();
+        List returnList = new LinkedList();
         
         if (!breakBeforeServed) {
             try {
@@ -285,13 +286,13 @@
 
                 // get elements from curLM
                 returnedList = curLM.getNextKnuthElements(childLC, alignment);
-                if (contentList.size() == 0 && childLC.isKeepWithPreviousPending()) {
+                if (contentList.isEmpty() && childLC.isKeepWithPreviousPending()) {
                     //Propagate keep-with-previous up from the first child
                     context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
                     childLC.clearKeepWithPreviousPending();
                 }
                 if (returnedList.size() == 1
-                        && ((ListElement)returnedList.getFirst()).isForcedBreak()) {
+                        && ((ListElement)returnedList.get(0)).isForcedBreak()) {
                     // a descendant of this block has break-before
                     /*
                     if (returnList.size() == 0) {
@@ -317,11 +318,12 @@
                         addInBetweenBreak(contentList, context, childLC);
                     }
                     contentList.addAll(returnedList);
-                    if (returnedList.size() == 0) {
+                    if (returnedList.isEmpty()) {
                         //Avoid NoSuchElementException below (happens with empty blocks)
                         continue;
                     }
-                    if (((ListElement)returnedList.getLast()).isForcedBreak()) {
+                    if (((ListElement) ListUtil.getLast(returnedList))
+                            .isForcedBreak()) {
                         // a descendant of this block has break-after
                         if (curLM.isFinished()) {
                             // there is no other content in this block;
@@ -392,7 +394,7 @@
         return returnList;
     }
     
-    private LinkedList getNextKnuthElementsAbsolute(LayoutContext context, int alignment) {
+    private List getNextKnuthElementsAbsolute(LayoutContext context, int alignment) {
         autoHeight = false;
 
         boolean switchedProgressionDirection
@@ -515,7 +517,7 @@
             }
             updateRelDims(0, 0, false);
         }
-        LinkedList returnList = new LinkedList();
+        List returnList = new LinkedList();
         if (!breaker.isEmpty()) {
             Position bcPosition = new BlockContainerPosition(this, breaker);
             returnList.add(new KnuthBox(0, notifyPos(bcPosition), false));
@@ -622,9 +624,9 @@
             return lc;
         }
         
-        protected LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+        protected List getNextKnuthElements(LayoutContext context, int alignment) {
             LayoutManager curLM; // currently active LM
-            LinkedList returnList = new LinkedList();
+            List returnList = new LinkedList();
 
             while ((curLM = getChildLM()) != null) {
                 LayoutContext childLC = new LayoutContext(0);
@@ -632,7 +634,7 @@
                 childLC.setRefIPD(context.getRefIPD());
                 childLC.setWritingMode(getBlockContainerFO().getWritingMode());
                 
-                LinkedList returnedList = null;
+                List returnedList = null;
                 if (!curLM.isFinished()) {
                     returnedList = curLM.getNextKnuthElements(childLC, alignment);
                 }
@@ -723,7 +725,7 @@
 
         // "unwrap" the NonLeafPositions stored in parentIter
         // and put them in a new list;
-        LinkedList positionList = new LinkedList();
+        List positionList = new LinkedList();
         Position pos;
         boolean bSpaceBefore = false;
         boolean bSpaceAfter = false;
@@ -753,7 +755,7 @@
                     // pos was created by this BCLM and was inside an element
                     // representing space before or after
                     // this means the space was not discarded
-                    if (positionList.size() == 0 && bcpos == null) {
+                    if (positionList.isEmpty() && bcpos == null) {
                         // pos was in the element representing space-before
                         bSpaceBefore = true;
                     } else {
@@ -798,10 +800,12 @@
                 //    // the last item inside positionList is a Position;
                 //    // this means that the paragraph has been split
                 //    // between consecutive pages
-                LinkedList splitList = new LinkedList();
+                List splitList = new LinkedList();
                 int splitLength = 0;
-                int iFirst = ((MappingPosition) positionList.getFirst()).getFirstIndex();
-                int iLast = ((MappingPosition) positionList.getLast()).getLastIndex();
+                int iFirst = ((MappingPosition) positionList.get(0))
+                        .getFirstIndex();
+                int iLast = ((MappingPosition) ListUtil.getLast(positionList))
+                        .getLastIndex();
                 // copy from storedList to splitList all the elements from
                 // iFirst to iLast
                 ListIterator storedListIterator = storedList.listIterator(iFirst);

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Mon Jul  7 07:09:01 2008
@@ -113,7 +113,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
         resetSpaces(); 
         return super.getNextKnuthElements(context, alignment);
     }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Mon Jul  7 07:09:01 2008
@@ -36,6 +36,7 @@
 import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
 import org.apache.fop.layoutmgr.inline.LineLayoutManager;
 import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.ListUtil;
 
 /**
  * Base LayoutManager class for all areas which stack their child
@@ -63,7 +64,7 @@
     /** space-after value adjusted for block-progression-unit handling */
     protected int adjustedSpaceAfter = 0;
     /** Only used to store the original list when createUnitElements is called */
-    protected LinkedList storedList = null;
+    protected List storedList = null;
     /** Indicates whether break before has been served or not */
     protected boolean breakBeforeServed = false;
     /** Indicates whether the first visible mark has been returned by this LM, yet */
@@ -235,7 +236,7 @@
     }
     
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
         //log.debug("BLM.getNextKnuthElements> keep-together = "
               // + layoutProps.keepTogether.getType());
         //log.debug(" keep-with-previous = " +
@@ -249,9 +250,9 @@
         
         updateContentAreaIPDwithOverconstrainedAdjust();
 
-        LinkedList returnedList = null;
-        LinkedList contentList = new LinkedList();
-        LinkedList returnList = new LinkedList();
+        List returnedList = null;
+        List contentList = new LinkedList();
+        List returnList = new LinkedList();
 
         if (!breakBeforeServed) {
             try {
@@ -296,23 +297,23 @@
 
             // get elements from curLM
             returnedList = curLM.getNextKnuthElements(childLC, alignment);
-            if (contentList.size() == 0 && childLC.isKeepWithPreviousPending()) {
+            if (contentList.isEmpty() && childLC.isKeepWithPreviousPending()) {
                 //Propagate keep-with-previous up from the first child
                 context.updateKeepWithPreviousPending(childLC.getKeepWithPreviousPending());
                 childLC.clearKeepWithPreviousPending();
             }
             if (returnedList != null
                     && returnedList.size() == 1
-                    && ((ListElement) returnedList.getFirst()).isForcedBreak()) {
+                    && ((ListElement) returnedList.get(0)).isForcedBreak()) {
 
                 if (curLM.isFinished() && !hasNextChildLM()) {
                     // a descendant of this block has break-before
-                    forcedBreakAfterLast = (BreakElement) returnedList.getFirst();
+                    forcedBreakAfterLast = (BreakElement) returnedList.get(0);
                     context.clearPendingMarks();
                     break;
                 }
 
-                if (contentList.size() == 0) {
+                if (contentList.isEmpty()) {
                     // Empty fo:block, zero-length box makes sure the IDs and/or markers 
                     // are registered and borders/padding are painted.
                     returnList.add(new KnuthBox(0, notifyPos(new Position(this)), false));
@@ -339,15 +340,17 @@
                     // before the one handled by curLM
                     addInBetweenBreak(contentList, context, childLC);
                 }
-                if (returnedList == null || returnedList.size() == 0) {
+                if (returnedList == null || returnedList.isEmpty()) {
                     //Avoid NoSuchElementException below (happens with empty blocks)
                     continue;
                 }
                 contentList.addAll(returnedList);
-                if (((ListElement) returnedList.getLast()).isForcedBreak()) {
+                if (((ListElement) ListUtil.getLast(returnedList))
+                        .isForcedBreak()) {
                     // a descendant of this block has break-after
                     if (curLM.isFinished() && !hasNextChildLM()) {
-                        forcedBreakAfterLast = (BreakElement)contentList.removeLast();
+                        forcedBreakAfterLast = (BreakElement) ListUtil
+                                .removeLast(contentList);                                
                         context.clearPendingMarks();
                         break;
                     }
@@ -379,7 +382,7 @@
         /* end of extension */
 
         returnedList = new LinkedList();
-        if (contentList.size() > 0) {
+        if (!contentList.isEmpty()) {
             wrapPositionElements(contentList, returnList);
         } else if (forcedBreakAfterLast == null) {
             // Empty fo:block, zero-length box makes sure the IDs and/or markers 
@@ -414,7 +417,7 @@
      * @param context the current layout context
      * @param childLC the currently active child layout context
      */
-    protected void addInBetweenBreak(LinkedList contentList, LayoutContext context,
+    protected void addInBetweenBreak(List contentList, LayoutContext context,
             LayoutContext childLC) {
         if (mustKeepTogether() 
                 || context.isKeepWithNextPending()
@@ -438,7 +441,7 @@
             return;
         }
         
-        ListElement last = (ListElement)contentList.getLast(); 
+        ListElement last = (ListElement) ListUtil.getLast(contentList);
         if (last.isGlue()) {
             // the last element in contentList is a glue;
             // it is a feasible breakpoint, there is no need to add
@@ -585,7 +588,7 @@
     /**
      * {@inheritDoc} 
      */
-    public LinkedList getChangedKnuthElements(List oldList, int alignment) {
+    public List getChangedKnuthElements(List oldList, int alignment) {
 /*LF*/  //log.debug("");
 /*LF*/  //log.debug("  BLM.getChangedKnuthElements> inizio: oldList.size() = " 
         //  + oldList.size());
@@ -593,8 +596,8 @@
         KnuthElement returnedElement;
         KnuthElement currElement = null;
         KnuthElement prevElement = null;
-        LinkedList returnedList = new LinkedList();
-        LinkedList returnList = new LinkedList();
+        List returnedList = new LinkedList();
+        List returnList = new LinkedList();
         int fromIndex = 0;
 
         // "unwrap" the Positions stored in the elements
@@ -691,7 +694,9 @@
                     // add an infinite penalty to forbid a break between blocks
                     returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, 
                             new Position(this), false));
-                } else if (bSomethingAdded && !((KnuthElement) returnedList.getLast()).isGlue()) {
+                } else if (bSomethingAdded
+                        && !((KnuthElement) ListUtil.getLast(returnedList))
+                                .isGlue()) {
                     // add a null penalty to allow a break between blocks
                     returnedList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
                 }
@@ -710,8 +715,8 @@
                 // currLM == this
                 // there are no more elements to add
                 // remove the last penalty added to returnedList
-                if (returnedList.size() > 0) {
-                    returnedList.removeLast();
+                if (!returnedList.isEmpty()) {
+                    ListUtil.removeLast(returnedList);
                 }
                 //log.debug(" BLM.getChangedKnuthElements> elementi propri, ignorati, da " 
                 //  + fromIndex + " a " + workList.size());
@@ -943,7 +948,7 @@
      * @param isFirst true if this is the first time a layout manager instance needs to generate 
      *                border and padding
      */
-    protected void addKnuthElementsForBorderPaddingBefore(LinkedList returnList, boolean isFirst) {
+    protected void addKnuthElementsForBorderPaddingBefore(List returnList, boolean isFirst) {
         //Border and Padding (before)
         CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground();
         if (borderAndPadding != null) {
@@ -970,7 +975,7 @@
      * @param isLast true if this is the last time a layout manager instance needs to generate 
      *               border and padding
      */
-    protected void addKnuthElementsForBorderPaddingAfter(LinkedList returnList, boolean isLast) {
+    protected void addKnuthElementsForBorderPaddingAfter(List returnList, boolean isLast) {
         //Border and Padding (after)
         CommonBorderPaddingBackground borderAndPadding = getBorderPaddingBackground();
         if (borderAndPadding != null) {
@@ -997,7 +1002,7 @@
      * @param context the layout context
      * @return true if an element has been added due to a break-before.
      */
-    protected boolean addKnuthElementsForBreakBefore(LinkedList returnList, 
+    protected boolean addKnuthElementsForBreakBefore(List returnList, 
             LayoutContext context) {
         int breakBefore = -1;
         if (fobj instanceof org.apache.fop.fo.flow.Block) {
@@ -1030,7 +1035,7 @@
      * @param context the layout context
      * @return true if an element has been added due to a break-after.
      */
-    protected boolean addKnuthElementsForBreakAfter(LinkedList returnList, 
+    protected boolean addKnuthElementsForBreakAfter(List returnList, 
             LayoutContext context) {
         int breakAfter = -1;
         if (fobj instanceof org.apache.fop.fo.flow.Block) {
@@ -1062,7 +1067,7 @@
      * @param returnList return list to add the additional elements to
      * @param alignment vertical alignment
      */
-    protected void addKnuthElementsForSpaceBefore(LinkedList returnList/*, 
+    protected void addKnuthElementsForSpaceBefore(List returnList/*, 
             Position returnPosition*/, int alignment) {
         SpaceProperty spaceBefore = getSpaceBeforeProperty();
         // append elements representing space-before
@@ -1111,7 +1116,7 @@
      * @param returnList return list to add the additional elements to
      * @param alignment vertical alignment
      */
-    protected void addKnuthElementsForSpaceAfter(LinkedList returnList/*, Position returnPosition*/, 
+    protected void addKnuthElementsForSpaceAfter(List returnList/*, Position returnPosition*/, 
                 int alignment) {
         SpaceProperty spaceAfter = getSpaceAfterProperty();
         // append elements representing space-after
@@ -1156,22 +1161,22 @@
         }*/
     }
 
-    protected LinkedList createUnitElements(LinkedList oldList) {
+    protected List createUnitElements(List oldList) {
         //log.debug("Start conversion: " + oldList.size() 
         //  + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min
         //  + " space-after.min=" + layoutProps.spaceAfter.getSpace().min);
         // add elements at the beginning and at the end of oldList
         // representing minimum spaces
-        LayoutManager lm = ((KnuthElement)oldList.getFirst()).getLayoutManager();
+        LayoutManager lm = ((KnuthElement)oldList.get(0)).getLayoutManager();
         boolean bAddedBoxBefore = false;
         boolean bAddedBoxAfter = false;
         if (adjustedSpaceBefore > 0) {
-            oldList.addFirst(new KnuthBox(adjustedSpaceBefore,
+            oldList.add(0, new KnuthBox(adjustedSpaceBefore,
                                           new Position(lm), true));
             bAddedBoxBefore = true;
         }
         if (adjustedSpaceAfter > 0) {
-            oldList.addLast(new KnuthBox(adjustedSpaceAfter,
+            oldList.add(new KnuthBox(adjustedSpaceAfter,
                                          new Position(lm), true));
             bAddedBoxAfter = true;
         }
@@ -1399,10 +1404,10 @@
         // remove elements at the beginning and at the end of oldList
         // representing minimum spaces
         if (adjustedSpaceBefore > 0) {
-            oldList.removeFirst();
+            oldList.remove(0);
         }
         if (adjustedSpaceAfter > 0) {
-            oldList.removeLast();
+            ListUtil.removeLast(oldList);
         }
 
         // if space-before.conditionality is "discard", correct newList
@@ -1459,7 +1464,7 @@
             newList.addLast(new KnuthBox(wrongBox.getW() - decreasedLength,
                                          wrongBox.getPosition(), false));
             // add preserved elements
-            if (preserveList.size() > 0) {
+            if (!preserveList.isEmpty()) {
                 newList.addAll(preserveList);
             }
             // insert the correct glue

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/ElementListUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/ElementListUtils.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/ElementListUtils.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/ElementListUtils.java Mon Jul  7 07:09:01 2008
@@ -19,16 +19,20 @@
 
 package org.apache.fop.layoutmgr;
 
-import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
 
 import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.ListUtil;
 
 /**
  * Utilities for Knuth element lists.
  */
-public class ElementListUtils {
+public final class ElementListUtils {
+    
+    private ElementListUtils() {
+        // Utility class.
+    }
 
     /**
      * Removes legal breaks in an element list. A constraint can be specified to limit the
@@ -38,7 +42,7 @@
      * @param constraint min/opt/max value to restrict the range in which the breaks are removed.
      * @return true if the opt constraint is bigger than the list contents
      */
-    public static boolean removeLegalBreaks(LinkedList elements, MinOptMax constraint) {
+    public static boolean removeLegalBreaks(List elements, MinOptMax constraint) {
         return removeLegalBreaks(elements, constraint.opt);
     }
 
@@ -50,7 +54,7 @@
      * @param constraint value to restrict the range in which the breaks are removed.
      * @return true if the constraint is bigger than the list contents
      */
-    public static boolean removeLegalBreaks(LinkedList elements, int constraint) {
+    public static boolean removeLegalBreaks(List elements, int constraint) {
         int len = 0;
         ListIterator iter = elements.listIterator();
         while (iter.hasNext()) {
@@ -97,7 +101,7 @@
      * @param constraint value to restrict the range in which the breaks are removed.
      * @return true if the constraint is bigger than the list contents
      */
-    public static boolean removeLegalBreaksFromEnd(LinkedList elements, int constraint) {
+    public static boolean removeLegalBreaksFromEnd(List elements, int constraint) {
         int len = 0;
         ListIterator i = elements.listIterator(elements.size());
         while (i.hasPrevious()) {
@@ -184,8 +188,8 @@
      * @param elems the element list
      * @return true if the list ends with a forced break
      */
-    public static boolean endsWithForcedBreak(LinkedList elems) {
-        ListElement last = (ListElement)elems.getLast();
+    public static boolean endsWithForcedBreak(List elems) {
+        ListElement last = (ListElement) ListUtil.getLast(elems);
         return last.isForcedBreak();
     }
 
@@ -195,8 +199,8 @@
      * @param elems the element list
      * @return true if the list ends with a non-infinite penalty
      */
-    public static boolean endsWithNonInfinitePenalty(LinkedList elems) {
-        ListElement last = (ListElement)elems.getLast();
+    public static boolean endsWithNonInfinitePenalty(List elems) {
+        ListElement last = (ListElement) ListUtil.getLast(elems);
         if (last.isPenalty() && ((KnuthPenalty)last).getP() < KnuthElement.INFINITE) {
             return true;
         } else if (last instanceof BreakElement

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Mon Jul  7 07:09:01 2008
@@ -64,16 +64,16 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
 
         // set layout dimensions
         int flowIPD = getCurrentPV().getCurrentSpan().getColumnWidth();
-        int flowBPD = (int) getCurrentPV().getBodyRegion().getBPD();
+        int flowBPD = getCurrentPV().getBodyRegion().getBPD();
 
         // currently active LM
         LayoutManager curLM;
-        LinkedList returnedList;
-        LinkedList returnList = new LinkedList();
+        List returnedList;
+        List returnList = new LinkedList();
 
         while ((curLM = getChildLM()) != null) {
             if (!(curLM instanceof WrapperLayoutManager)
@@ -114,7 +114,7 @@
             }
 
             // "wrap" the Position inside each element
-            LinkedList tempList = returnedList;
+            List tempList = returnedList;
             returnedList = new LinkedList();
             wrapPositionElements(tempList, returnedList);
 
@@ -213,11 +213,11 @@
     }
     
     /** {@inheritDoc} */
-    public LinkedList getChangedKnuthElements(List oldList, /*int flaggedPenalty,*/ int alignment) {
+    public List getChangedKnuthElements(List oldList, /*int flaggedPenalty,*/ int alignment) {
         ListIterator oldListIterator = oldList.listIterator();
         KnuthElement returnedElement;
-        LinkedList returnedList = new LinkedList();
-        LinkedList returnList = new LinkedList();
+        List returnedList = new LinkedList();
+        List returnList = new LinkedList();
         KnuthElement prevElement = null;
         KnuthElement currElement = null;
         int fromIndex = 0;
@@ -257,7 +257,8 @@
                     // add an infinite penalty to forbid a break between blocks
                     returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, 
                             new Position(this), false));
-                } else if (!((KnuthElement) returnedList.getLast()).isGlue()) {
+                } else if (!((KnuthElement) returnedList.get(returnedList
+                        .size() - 1)).isGlue()) {
                     // add a null penalty to allow a break between blocks
                     returnedList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
                 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/KnuthBlockBox.java Mon Jul  7 07:09:01 2008
@@ -19,9 +19,10 @@
 
 package org.apache.fop.layoutmgr;
 
-import org.apache.fop.traits.MinOptMax;
-
 import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.fop.traits.MinOptMax;
 
 /**
  * Knuth box used to represent a line in block-progression-dimension (i.e. the width is its height).
@@ -34,9 +35,9 @@
      * it isn't possible to get the opt value stored in a MinOptMax object.
      */
     private int bpd;
-    private LinkedList footnoteList;
+    private List footnoteList;
     /** List of Knuth elements. This is a list of LinkedList elements. */
-    private LinkedList elementLists = null;
+    private List elementLists = null;
 
     /**
      * Creates a new box.
@@ -61,7 +62,7 @@
      * @param pos the Position stored in this box
      * @param bAux is this box auxiliary?
      */
-    public KnuthBlockBox(int w, LinkedList list, Position pos, boolean bAux) {
+    public KnuthBlockBox(int w, List list, Position pos, boolean bAux) {
         super(w, pos, bAux);
         ipdRange = new MinOptMax(0);
         bpd = 0;
@@ -71,7 +72,7 @@
     /**
      * @return the LMs for the footnotes cited in this box.
      */
-    public LinkedList getFootnoteBodyLMs() {
+    public List getFootnoteBodyLMs() {
         return footnoteList;
     }
 
@@ -86,7 +87,7 @@
      * Adds the given list of Knuth elements to this box' list of elements.
      * @param list elements corresponding to a footnote body
      */
-    public void addElementList(LinkedList list) {
+    public void addElementList(List list) {
         if (elementLists == null) {
             elementLists = new LinkedList();
         }
@@ -98,7 +99,7 @@
      * @return a list of KnuthElement sequences corresponding to footnotes cited in this
      * box
      */
-    public LinkedList getElementLists() {
+    public List getElementLists() {
         return elementLists;
     }
 

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutManager.java Mon Jul  7 07:09:01 2008
@@ -19,7 +19,6 @@
  
 package org.apache.fop.layoutmgr;
 
-import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.fop.area.Area;
@@ -135,10 +134,10 @@
      * of the node assigned to the LM
      * 
      * @param context   the LayoutContext used to store layout information
-     * @param alignment the desired text alignement
+     * @param alignment the desired text alignment
      * @return          the list of KnuthElements
      */
-    LinkedList getNextKnuthElements(LayoutContext context, int alignment);
+    List getNextKnuthElements(LayoutContext context, int alignment);
 
     /**
      * Get a sequence of KnuthElements representing the content 
@@ -146,7 +145,7 @@
      *
      * In the context of line breaking, this method is called after hyphenation has
      * been performed, in order to receive the sequence of elements representing the 
-     * text together with all possibile hyphenation points.
+     * text together with all possible hyphenation points.
      * For example, if the text "representation" originates a single box element
      * when getNextKnuthElements() is called, it will be now split in syllables
      * (rep-re-sen-ta-tion) each one originating a box and divided by additional
@@ -175,7 +174,7 @@
      * @param alignment      the desired text alignment
      * @return               the updated list of KnuthElements
      */
-    LinkedList getChangedKnuthElements(List oldList, int alignment);
+    List getChangedKnuthElements(List oldList, int alignment);
     
     /**
      * Returns the IPD of the content area

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java Mon Jul  7 07:09:01 2008
@@ -41,8 +41,8 @@
 import org.apache.fop.fo.flow.ExternalGraphic;
 import org.apache.fop.fo.flow.Footnote;
 import org.apache.fop.fo.flow.Inline;
-import org.apache.fop.fo.flow.InlineLevel;
 import org.apache.fop.fo.flow.InlineContainer;
+import org.apache.fop.fo.flow.InlineLevel;
 import org.apache.fop.fo.flow.InstreamForeignObject;
 import org.apache.fop.fo.flow.Leader;
 import org.apache.fop.fo.flow.ListBlock;
@@ -224,7 +224,7 @@
     public static class FOTextLayoutManagerMaker extends Maker {
         public void make(FONode node, List lms) {
             FOText foText = (FOText) node;
-            if (foText.endIndex - foText.startIndex > 0) {
+            if (foText.length() > 0) {
                 lms.add(new TextLayoutManager(foText));
             }
         }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageBreaker.java Mon Jul  7 07:09:01 2008
@@ -135,8 +135,8 @@
     }
     
     /** {@inheritDoc} */
-    protected LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
-        LinkedList contentList = null;
+    protected List getNextKnuthElements(LayoutContext context, int alignment) {
+        List contentList = null;
         
         while (!childFLM.isFinished() && contentList == null) {
             contentList = childFLM.getNextKnuthElements(context, alignment);
@@ -156,7 +156,7 @@
                     footnoteContext.setStackLimitBP(context.getStackLimitBP());
                     footnoteContext.setRefIPD(pslm.getCurrentPV()
                             .getRegionReference(Constants.FO_REGION_BODY).getIPD());
-                    LinkedList footnoteBodyLMs = ((KnuthBlockBox) element).getFootnoteBodyLMs();
+                    List footnoteBodyLMs = ((KnuthBlockBox) element).getFootnoteBodyLMs();
                     ListIterator footnoteBodyIterator = footnoteBodyLMs.listIterator();
                     // store the lists of elements representing the footnote bodies
                     // in the box representing the line containing their references

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java Mon Jul  7 07:09:01 2008
@@ -21,11 +21,11 @@
 
 import java.util.ArrayList;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.ListIterator;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.layoutmgr.AbstractBreaker.PageBreakPosition;
@@ -230,7 +230,7 @@
      * @param elementLists list of KnuthElement sequences corresponding to the footnotes
      * bodies
      */
-    private void handleFootnotes(LinkedList elementLists) {
+    private void handleFootnotes(List elementLists) {
         // initialization
         if (!footnotesPending) {
             footnotesPending = true;
@@ -286,7 +286,7 @@
         return returnValue;
     }
 
-    private void resetFootnotes(LinkedList elementLists) {
+    private void resetFootnotes(List elementLists) {
         for (int i = 0; i < elementLists.size(); i++) {
             /*LinkedList removedList = (LinkedList)*/footnotesList.remove(footnotesList.size() - 1);
             lengthList.remove(lengthList.size() - 1);
@@ -325,7 +325,7 @@
                 // this page contains some footnote citations
                 // add the footnote separator width
                 actualWidth += footnoteSeparatorLength.opt;
-                if (actualWidth + allFootnotes <= getLineWidth()) {
+                if (actualWidth + allFootnotes <= getLineWidth(activeNode.line)) {
                     // there is enough space to insert all footnotes:
                     // add the whole allFootnotes length
                     actualWidth += allFootnotes;
@@ -337,7 +337,7 @@
                                 = checkCanDeferOldFootnotes(pageNode, elementIndex))
                             || newFootnotes)
                            && (footnoteSplit = getFootnoteSplit(pageNode,
-                                   getLineWidth() - actualWidth, canDeferOldFootnotes)) > 0) {
+                                   getLineWidth(activeNode.line) - actualWidth, canDeferOldFootnotes)) > 0) {
                     // it is allowed to break or even defer footnotes if either:
                     //  - there are new footnotes in the last piece of content, and
                     //    there is space to add at least a piece of the first one
@@ -683,7 +683,7 @@
         insertedFootnotesLength = lastNode.totalFootnotes;
         footnoteListIndex = lastNode.footnoteListIndex;
         footnoteElementIndex = lastNode.footnoteElementIndex;
-        int availableBPD = getLineWidth();
+        int availableBPD = getLineWidth(lastNode.line);
         int split = 0;
         KnuthPageNode prevNode = lastNode;
 
@@ -718,7 +718,7 @@
                 removeNode(prevNode.line, prevNode);
 
                 prevNode = node;
-                availableBPD = getLineWidth();
+                availableBPD = getLineWidth(node.line);
             }
         }
         // create the last node

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java Mon Jul  7 07:09:01 2008
@@ -102,18 +102,17 @@
         curPage = makeNewPage(false, false);
         
         PageBreaker breaker = new PageBreaker(this);
-        int flowBPD = (int)getCurrentPV().getBodyRegion().getRemainingBPD();
+        int flowBPD = getCurrentPV().getBodyRegion().getRemainingBPD();
         breaker.doLayout(flowBPD);
 
         finishPage();
     }
-        
+
     /** {@inheritDoc} */
     public void finishPageSequence() {
         if (pageSeq.hasId()) {
             idTracker.signalIDProcessed(pageSeq.getId());
         }
-
         pageSeq.getRoot().notifyPageSequenceFinished(currentPageNum,
                 (currentPageNum - startPageNum) + 1);
         areaTreeHandler.notifyPageSequenceFinished(pageSeq,
@@ -150,9 +149,9 @@
             return;
         }
 
-        StaticContentLayoutManager lm = (StaticContentLayoutManager)
-            getLayoutManagerMaker().makeStaticContentLayoutManager(
-                    this, sc, reg);
+        StaticContentLayoutManager lm = getLayoutManagerMaker()
+                                            .makeStaticContentLayoutManager(
+                                                this, sc, reg);
         lm.doLayout();
     }
 
@@ -166,5 +165,5 @@
         
         super.finishPage();
     }
-        
+    
 }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/SpaceResolver.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/SpaceResolver.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/SpaceResolver.java Mon Jul  7 07:09:01 2008
@@ -614,7 +614,7 @@
      * Resolves unresolved elements applying the space resolution rules defined in 4.3.1.
      * @param elems the element list
      */
-    public static void resolveElementList(LinkedList elems) {
+    public static void resolveElementList(List elems) {
         if (log.isTraceEnabled()) {
             log.trace(elems);
         }

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java?rev=674497&r1=674496&r2=674497&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java Mon Jul  7 07:09:01 2008
@@ -38,6 +38,7 @@
 import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
 import org.apache.fop.layoutmgr.inline.TextLayoutManager;
 import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.util.ListUtil;
 
 /**
  * LayoutManager for an fo:flow object.
@@ -87,7 +88,7 @@
     }
 
     /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
         if (true) {
             throw new UnsupportedOperationException(
                 "Shouldn't this method be emptied because it's never called at all?");
@@ -102,8 +103,8 @@
         BlockLevelLayoutManager curLM;
         BlockLevelLayoutManager prevLM = null;
         MinOptMax stackSize = new MinOptMax();
-        LinkedList returnedList;
-        LinkedList returnList = new LinkedList();
+        List returnedList;
+        List returnList = new LinkedList();
 
         while ((curLM = ((BlockLevelLayoutManager) getChildLM())) != null) {
             if (curLM instanceof InlineLevelLayoutManager) {
@@ -125,7 +126,7 @@
             //    + returnedList.size());
 
             // "wrap" the Position inside each element
-            LinkedList tempList = returnedList;
+            List tempList = returnedList;
             KnuthElement tempElement;
             returnedList = new LinkedList();
             ListIterator listIter = tempList.listIterator();
@@ -136,13 +137,13 @@
             }
 
             if (returnedList.size() == 1
-                && ((KnuthElement)returnedList.getFirst()).isPenalty()
-                && ((KnuthPenalty)returnedList.getFirst()).getP() == -KnuthElement.INFINITE) {
+                && ((KnuthElement)returnedList.get(0)).isPenalty()
+                && ((KnuthPenalty)returnedList.get(0)).getP() == -KnuthElement.INFINITE) {
                 // a descendant of this flow has break-before
                 returnList.addAll(returnedList);
                 return returnList;
             } else {
-                if (returnList.size() > 0) {
+                if (!returnList.isEmpty()) {
                     // there is a block before this one
                     if (prevLM.mustKeepWithNext()
                         || curLM.mustKeepWithPrevious()) {
@@ -150,16 +151,18 @@
                         returnList.add(new KnuthPenalty(0, 
                                 KnuthElement.INFINITE, false, 
                                 new Position(this), false));
-                    } else if (!((KnuthElement) returnList.getLast()).isGlue()) {
+                    } else if (!((KnuthElement) ListUtil.getLast(returnList))
+                            .isGlue()) {
                         // add a null penalty to allow a break between blocks
                         returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
                     }
                 }
-/*LF*/          if (returnedList.size() > 0) { // controllare!
+/*LF*/          if (!returnedList.isEmpty()) { // controllare!
                     returnList.addAll(returnedList);
-                    if (((KnuthElement)returnedList.getLast()).isPenalty()
-                            && ((KnuthPenalty)returnedList.getLast()).getP() 
-                                    == -KnuthElement.INFINITE) {
+                    final KnuthElement last = (KnuthElement) ListUtil
+                            .getLast(returnedList);
+                    if (last.isPenalty()
+                            && ((KnuthPenalty) last).getP() == -KnuthElement.INFINITE) {
                         // a descendant of this flow has break-after
 /*LF*/                  //log.debug("FLM - break after!!");
                         return returnList;
@@ -171,10 +174,10 @@
 
         setFinished(true);
 
-        if (returnList.size() > 0) {
-            return returnList;
-        } else {
+        if (returnList.isEmpty()) {
             return null;
+        } else {
+            return returnList;
         }
     }
     
@@ -325,9 +328,9 @@
             return lc;
         }
         
-        protected LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
+        protected List getNextKnuthElements(LayoutContext context, int alignment) {
             LayoutManager curLM; // currently active LM
-            LinkedList returnList = new LinkedList();
+            List returnList = new LinkedList();
 
             while ((curLM = getChildLM()) != null) {
                 LayoutContext childLC = new LayoutContext(0);
@@ -335,7 +338,7 @@
                 childLC.setRefIPD(context.getRefIPD());
                 childLC.setWritingMode(context.getWritingMode());
 
-                LinkedList returnedList = null;
+                List returnedList = null;
                 //The following is a HACK! Ignore leading and trailing white space 
                 boolean ignore = curLM instanceof TextLayoutManager;
                 if (!curLM.isFinished()) {
@@ -364,6 +367,12 @@
         
         protected void doPhase3(PageBreakingAlgorithm alg, int partCount, 
                 BlockSequence originalList, BlockSequence effectiveList) {
+            if (partCount > 1) {
+                PageBreakPosition pos = (PageBreakPosition)alg.getPageBreaks().getFirst();
+                int firstPartLength = ElementListUtils.calcContentLength(effectiveList,
+                        effectiveList.ignoreAtStart, pos.getLeafPos());
+                overflow += alg.totalWidth - firstPartLength;        
+            }         
             //Rendering all parts (not just the first) at once for the case where the parts that 
             //overflow should be visible.
             alg.removeAllPageBreaks();



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