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 je...@apache.org on 2003/03/06 14:42:43 UTC

cvs commit: xml-fop/src/org/apache/fop/fo/pagination RegionEnd.java PageMasterReference.java RepeatablePageMasterAlternatives.java Region.java RegionBody.java LayoutMasterSet.java SimplePageMaster.java RegionBASE.java PageNumberGenerator.java Root.java SubSequenceSpecifier.java ConditionalPageMasterReference.java RegionStart.java PageSequence.java RegionBA.java RepeatablePageMasterReference.java RegionBefore.java PageSequenceMaster.java RegionAfter.java SinglePageMasterReference.java RegionSE.java

jeremias    2003/03/06 05:42:43

  Modified:    src/org/apache/fop/fo/pagination RegionEnd.java
                        PageMasterReference.java
                        RepeatablePageMasterAlternatives.java Region.java
                        RegionBody.java LayoutMasterSet.java
                        SimplePageMaster.java RegionBASE.java
                        PageNumberGenerator.java Root.java
                        SubSequenceSpecifier.java
                        ConditionalPageMasterReference.java
                        RegionStart.java PageSequence.java RegionBA.java
                        RepeatablePageMasterReference.java
                        RegionBefore.java PageSequenceMaster.java
                        RegionAfter.java SinglePageMasterReference.java
                        RegionSE.java
  Log:
  Switched to long licence
  Some general checkstyle fixing
  
  Revision  Changes    Path
  1.11      +71 -12    xml-fop/src/org/apache/fop/fo/pagination/RegionEnd.java
  
  Index: RegionEnd.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionEnd.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- RegionEnd.java	5 Jan 2003 09:03:12 -0000	1.10
  +++ RegionEnd.java	6 Mar 2003 13:42:41 -0000	1.11
  @@ -1,52 +1,111 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
   // Java
   import java.awt.Rectangle;
   
   // FOP
  -import org.apache.fop.fo.*;
  +import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.properties.WritingMode;
   import org.apache.fop.datatypes.FODimension;
   import org.apache.fop.area.RegionReference;
   
  -
  +/**
  + * The fo:region-end element.
  + */
   public class RegionEnd extends RegionSE {
   
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public RegionEnd(FONode parent) {
           super(parent);
       }
   
  -
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
  +     */
       protected Rectangle getViewportRectangle (FODimension reldims) {
           // Depends on extent, precedence and writing mode
           Rectangle vpRect;
  -        if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB)
  +        if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
               vpRect = new Rectangle(reldims.ipd - getExtent(), 0,
                       getExtent(), reldims.bpd);
  -        else
  +        } else {
               vpRect = new Rectangle(reldims.ipd - getExtent(), 0,
                       reldims.bpd, getExtent());
  +        }
           adjustIPD(vpRect, this.wm);
           return vpRect;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getDefaultRegionName()
  +     */
       protected String getDefaultRegionName() {
           return "xsl-region-end";
       }
   
  -
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionClass()
  +     */
       public String getRegionClass() {
           return Region.END;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionAreaClass()
  +     */
       public int getRegionAreaClass() {
           return RegionReference.END;
       }
  
  
  
  1.12      +67 -14    xml-fop/src/org/apache/fop/fo/pagination/PageMasterReference.java
  
  Index: PageMasterReference.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageMasterReference.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PageMasterReference.java	22 Dec 2002 23:37:05 -0000	1.11
  +++ PageMasterReference.java	6 Mar 2003 13:42:41 -0000	1.12
  @@ -1,32 +1,82 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
  -// FOP
  -import org.apache.fop.fo.*;
  -import org.apache.fop.apps.FOPException;
  -
   // SAX
   import org.xml.sax.Attributes;
   
  +// FOP
  +import org.apache.fop.fo.FONode;
  +import org.apache.fop.fo.FObj;
  +import org.apache.fop.apps.FOPException;
  +
   /**
    * Base PageMasterReference class. Provides implementation for handling the
    * master-reference attribute and containment within a PageSequenceMaster
    */
   public abstract class PageMasterReference extends FObj
  -    implements SubSequenceSpecifier {
  +            implements SubSequenceSpecifier {
   
       private String masterName;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public PageMasterReference(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
  +     */
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
           if (getProperty("master-reference") != null) {
  @@ -38,6 +88,7 @@
   
       /**
        * Returns the "master-reference" attribute of this page master reference
  +     * @return the name of the page master
        */
       public String getMasterName() {
           return masterName;
  @@ -45,15 +96,17 @@
   
       /**
        * Checks that the parent is the right element. The default implementation
  -     * checks for fo:page-sequence-master
  +     * checks for fo:page-sequence-master.
  +     * @param parent parent node
  +     * @throws FOPException If the parent is invalid.
        */
       protected void validateParent(FONode parent) throws FOPException {
           if (parent.getName().equals("fo:page-sequence-master")) {
               PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
   
               if (getMasterName() == null) {
  -                getLogger().warn("" + getName()
  -                                       + " does not have a master-reference and so is being ignored");
  +                getLogger().warn(getName()
  +                    + " does not have a master-reference and so is being ignored");
               } else {
                   pageSequenceMaster.addSubsequenceSpecifier(this);
               }
  
  
  
  1.12      +72 -12    xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
  
  Index: RepeatablePageMasterAlternatives.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- RepeatablePageMasterAlternatives.java	17 Aug 2002 23:51:07 -0000	1.11
  +++ RepeatablePageMasterAlternatives.java	6 Mar 2003 13:42:41 -0000	1.12
  @@ -1,20 +1,66 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
  -import org.apache.fop.fo.*;
  -import org.apache.fop.apps.FOPException;
  -
   // Java
   import java.util.ArrayList;
   
  +// XML
   import org.xml.sax.Attributes;
   
  +// FOP
  +import org.apache.fop.fo.FONode;
  +import org.apache.fop.fo.FObj;
  +import org.apache.fop.apps.FOPException;
  +
   /**
    * A repeatable-page-master-alternatives formatting object.
    * This contains a list of conditional-page-master-reference
  @@ -35,10 +81,16 @@
   
       private ArrayList conditionalPageMasterRefs;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public RepeatablePageMasterAlternatives(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
  +     */
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
   
  @@ -55,7 +107,7 @@
   
           String mr = getProperty("maximum-repeats").getString();
           if (mr.equals("no-limit")) {
  -            this.maximumRepeats=INFINITE;
  +            this.maximumRepeats = INFINITE;
           } else {
               try {
                   this.maximumRepeats = Integer.parseInt(mr);
  @@ -74,10 +126,11 @@
       /**
        * Get the next matching page master from the conditional
        * page master references.
  +     * @see org.apache.fop.fo.pagination.SubSequenceSpecifier
        */
       public String getNextPageMasterName(boolean isOddPage,
                                           boolean isFirstPage,
  -                                        boolean isEmptyPage) {
  +                                        boolean isBlankPage) {
           if (maximumRepeats != INFINITE) {
               if (numberConsumed < maximumRepeats) {
                   numberConsumed++;
  @@ -89,7 +142,7 @@
           for (int i = 0; i < conditionalPageMasterRefs.size(); i++) {
               ConditionalPageMasterReference cpmr =
                   (ConditionalPageMasterReference)conditionalPageMasterRefs.get(i);
  -            if (cpmr.isValid(isOddPage, isFirstPage, isEmptyPage)) {
  +            if (cpmr.isValid(isOddPage, isFirstPage, isBlankPage)) {
                   return cpmr.getMasterName();
               }
           }
  @@ -97,10 +150,17 @@
       }
   
   
  +    /**
  +     * Adds a new conditional page master reference.
  +     * @param cpmr the new conditional reference
  +     */
       public void addConditionalPageMasterReference(ConditionalPageMasterReference cpmr) {
           this.conditionalPageMasterRefs.add(cpmr);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.SubSequenceSpecifier#reset()
  +     */
       public void reset() {
           this.numberConsumed = 0;
       }
  
  
  
  1.18      +108 -20   xml-fop/src/org/apache/fop/fo/pagination/Region.java
  
  Index: Region.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Region.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Region.java	19 Feb 2003 05:51:15 -0000	1.17
  +++ Region.java	6 Mar 2003 13:42:41 -0000	1.18
  @@ -1,10 +1,53 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
   // Java
  @@ -30,24 +73,38 @@
    * This is an abstract base class for pagination regions
    */
   public abstract class Region extends FObj {
  +
       private static final String PROP_REGION_NAME = "region-name";
   
  +    /** Key for before regions */
       public static final String BEFORE = "before";
  +    /** Key for start regions */
       public static final String START =  "start";
  +    /** Key for end regions */
       public static final String END =    "end";
  +    /** Key for after regions */
       public static final String AFTER =  "after";
  +    /** Key for body regions */
       public static final String BODY =   "body";
   
  -    private SimplePageMaster _layoutMaster;
  -    private String _regionName;
  +    private SimplePageMaster layoutMaster;
  +    private String regionName;
   
  +    /** Holds the overflow attribute */
       protected int overflow;
  +    /** Holds the writing mode */
       protected int wm;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       protected Region(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
  +     */
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
   
  @@ -60,15 +117,15 @@
               setRegionName(this.properties.get(PROP_REGION_NAME).getString());
               // check that name is OK. Not very pretty.
               if (isReserved(getRegionName())
  -                    &&!getRegionName().equals(getDefaultRegionName())) {
  -                throw new FOPException(PROP_REGION_NAME + " '" + _regionName
  +                    && !getRegionName().equals(getDefaultRegionName())) {
  +                throw new FOPException(PROP_REGION_NAME + " '" + regionName
                           + "' for " + this.name
                           + " not permitted.");
               }
           }
   
           if (parent instanceof SimplePageMaster) {
  -            _layoutMaster = (SimplePageMaster)parent;
  +            layoutMaster = (SimplePageMaster)parent;
           } else {
               throw new FOPException(this.name + " must be child "
                       + "of simple-page-master, not "
  @@ -79,6 +136,9 @@
   
       /**
        * Creates a RegionViewport Area object for this pagination Region.
  +     * @param reldims relative dimensions
  +     * @param pageCTM page coordinate transformation matrix
  +     * @return the new region viewport
        */
       public RegionViewport makeRegionViewport(FODimension reldims, CTM pageCTM) {
           Rectangle2D relRegionRect = getViewportRectangle(reldims);
  @@ -116,6 +176,7 @@
        * @param absRegVPRect The region viewport rectangle is "absolute" coordinates
        * where x=distance from left, y=distance from bottom, width=right-left
        * height=top-bottom
  +     * @return a new region reference area
        */
       public RegionReference makeRegionReferenceArea(Rectangle2D absRegVPRect) {
           RegionReference r = new RegionReference(getRegionAreaClass());
  @@ -132,39 +193,54 @@
        * @param absRegVPRect the rectangle to place the region contents
        */
       protected void setRegionPosition(RegionReference r, Rectangle2D absRegVPRect) {
  -        FODimension reldims = new FODimension(0,0);
  +        FODimension reldims = new FODimension(0, 0);
           r.setCTM(propMgr.getCTMandRelDims(absRegVPRect, reldims));
       }
   
       /**
        * Return the enumerated value designating this type of region in the
        * Area tree.
  +     * @return the region area class
        */
       protected abstract int getRegionAreaClass();
   
       /**
        * Returns the default region name (xsl-region-before, xsl-region-start,
        * etc.)
  +     * @return the default region name
        */
       protected abstract String getDefaultRegionName();
   
   
  +    /**
  +     * Returns the region class name.
  +     * @return the region class name
  +     */
       public abstract String getRegionClass();
   
   
       /**
  -     * Returns the name of this region
  +     * Returns the name of this region.
  +     * @return the region name
        */
       public String getRegionName() {
  -        return _regionName;
  +        return this.regionName;
       }
   
  +    /**
  +     * Sets the name of the region.
  +     * @param name the name
  +     */
       private void setRegionName(String name) {
  -        _regionName = name;
  +        this.regionName = name;
       }
   
  +    /**
  +     * Returns the page master associated with this region.
  +     * @return a simple-page-master
  +     */
       protected SimplePageMaster getPageMaster() {
  -        return _layoutMaster;
  +        return this.layoutMaster;
       }
   
       /**
  @@ -173,7 +249,7 @@
        * @param name a region name to check
        * @return true if the name parameter is a reserved region name
        */
  -    protected boolean isReserved(String name) throws FOPException {
  +    protected boolean isReserved(String name) /*throws FOPException*/ {
           return (name.equals("xsl-region-before")
                   || name.equals("xsl-region-start")
                   || name.equals("xsl-region-end")
  @@ -182,20 +258,32 @@
                   || name.equals("xsl-footnote-separator"));
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FObj#generatesReferenceAreas()
  +     */
       public boolean generatesReferenceAreas() {
           return true;
       }
   
  +    /**
  +     * Returns a sibling region for this region.
  +     * @param regionClass the class of the requested region
  +     * @return the requested region
  +     */
       protected Region getSiblingRegion(String regionClass) {
           // Ask parent for region
  -        return  _layoutMaster.getRegion(regionClass);
  +        return  layoutMaster.getRegion(regionClass);
       }
   
  -    boolean getPrecedence() {
  +    /**
  +     * Indicates if this region gets precedence.
  +     * @return True if it gets precedence
  +     */
  +    public boolean getPrecedence() {
           return false;
       }
   
  -    int getExtent() {
  +    public int getExtent() {
           return 0;
       }
   }
  
  
  
  1.23      +20 -1     xml-fop/src/org/apache/fop/fo/pagination/RegionBody.java
  
  Index: RegionBody.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionBody.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- RegionBody.java	5 Mar 2003 20:38:23 -0000	1.22
  +++ RegionBody.java	6 Mar 2003 13:42:41 -0000	1.23
  @@ -67,14 +67,23 @@
   import org.apache.fop.area.BodyRegion;
   import org.apache.fop.layout.MarginProps;
   
  +/**
  + * The fo:region-body element.
  + */
   public class RegionBody extends Region {
   
       private ColorType backgroundColor;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public RegionBody(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
  +     */
       protected Rectangle getViewportRectangle (FODimension reldims) {
           /*
           * Use space-before and space-after which will use corresponding
  @@ -115,20 +124,30 @@
           return ((prop != null) ? prop.getLength().getValue() : 0);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getDefaultRegionName()
  +     */
       protected String getDefaultRegionName() {
           return "xsl-region-body";
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionClass()
  +     */
       public String getRegionClass() {
           return Region.BODY;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionAreaClass()
  +     */
       public int getRegionAreaClass() {
           return RegionReference.BODY;
       }
   
       /**
        * Override the inherited method.
  +     * @see org.apache.fop.fo.pagination.Region#makeRegionReferenceArea(Rectangle2D)
        */
       public RegionReference makeRegionReferenceArea(Rectangle2D absRegVPRect) {
           // Should set some column stuff here I think, or put it elsewhere
  
  
  
  1.19      +95 -27    xml-fop/src/org/apache/fop/fo/pagination/LayoutMasterSet.java
  
  Index: LayoutMasterSet.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/LayoutMasterSet.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- LayoutMasterSet.java	22 Dec 2002 23:37:05 -0000	1.18
  +++ LayoutMasterSet.java	6 Mar 2003 13:42:41 -0000	1.19
  @@ -1,23 +1,67 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
  -// FOP
  -import org.apache.fop.fo.*;
  -import org.apache.fop.apps.FOPException;
  -
   // Java
  -import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
   
  +// XML
   import org.xml.sax.Attributes;
   
  +// FOP
  +import org.apache.fop.fo.FONode;
  +import org.apache.fop.fo.FObj;
  +import org.apache.fop.apps.FOPException;
  +
   /**
    * The layout-master-set formatting object.
    * This class maintains the set of simple page master and
  @@ -28,13 +72,20 @@
    * information for a page sequence.
    */
   public class LayoutMasterSet extends FObj {
  +    
       private Map simplePageMasters;
       private Map pageSequenceMasters;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public LayoutMasterSet(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
  +     */
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
   
  @@ -46,22 +97,25 @@
                                      + parent.getName());
           }
   
  -        this.simplePageMasters = new HashMap();
  -        this.pageSequenceMasters = new HashMap();
  +        this.simplePageMasters = new java.util.HashMap();
  +        this.pageSequenceMasters = new java.util.HashMap();
       }
   
       /**
        * Add a simple page master.
        * The name is checked to throw an error if already added.
  +     * @param simplePageMaster simple-page-master to add
  +     * @throws FOPException if there's a problem with name uniqueness
        */
       protected void addSimplePageMaster(SimplePageMaster simplePageMaster)
  -            throws FOPException {
  +                throws FOPException {
           // check against duplication of master-name
  -        if (existsName(simplePageMaster.getMasterName()))
  +        if (existsName(simplePageMaster.getMasterName())) {
               throw new FOPException("'master-name' ("
                                      + simplePageMaster.getMasterName()
                                      + ") must be unique "
                                      + "across page-masters and page-sequence-masters");
  +        }
           this.simplePageMasters.put(simplePageMaster.getMasterName(),
                                      simplePageMaster);
       }
  @@ -70,6 +124,8 @@
        * Get a simple page master by name.
        * This is used by the page sequence to get a page master for
        * creating pages.
  +     * @param masterName the name of the page master
  +     * @return the requested simple-page-master
        */
       public SimplePageMaster getSimplePageMaster(String masterName) {
           return (SimplePageMaster)this.simplePageMasters.get(masterName);
  @@ -78,14 +134,19 @@
       /**
        * Add a page sequence master.
        * The name is checked to throw an error if already added.
  +     * @param masterName name for the master
  +     * @param pageSequenceMaster PageSequenceMaster instance
  +     * @throws FOPException if there's a problem with name uniqueness
        */
  -    protected void addPageSequenceMaster(String masterName, PageSequenceMaster pageSequenceMaster)
  -            throws FOPException {
  +    protected void addPageSequenceMaster(String masterName, 
  +                                        PageSequenceMaster pageSequenceMaster)
  +                throws FOPException {
           // check against duplication of master-name
  -        if (existsName(masterName))
  +        if (existsName(masterName)) {
               throw new FOPException("'master-name' (" + masterName
                                      + ") must be unique "
                                      + "across page-masters and page-sequence-masters");
  +        }
           this.pageSequenceMasters.put(masterName, pageSequenceMaster);
       }
   
  @@ -93,6 +154,8 @@
        * Get a page sequence master by name.
        * This is used by the page sequence to get a page master for
        * creating pages.
  +     * @param masterName name of the master
  +     * @return the requested PageSequenceMaster instance
        */
       public PageSequenceMaster getPageSequenceMaster(String masterName) {
           return (PageSequenceMaster)this.pageSequenceMasters.get(masterName);
  @@ -100,23 +163,27 @@
   
       private boolean existsName(String masterName) {
           if (simplePageMasters.containsKey(masterName)
  -                || pageSequenceMasters.containsKey(masterName))
  +                || pageSequenceMasters.containsKey(masterName)) {
               return true;
  -        else
  +        } else {
               return false;
  +        }
       }
   
  +    /**
  +     * Section 7.33.15: check to see that if a region-name is a
  +     * duplicate, that it maps to the same region-class.
  +     * @throws FOPException if there's a name duplication
  +     */
       protected void checkRegionNames() throws FOPException {
  -        // Section 7.33.15 check to see that if a region-name is a
  -        // duplicate, that it maps to the same region-class.
  -        Map allRegions = new HashMap();
  +        Map allRegions = new java.util.HashMap();
           for (Iterator spm = simplePageMasters.values().iterator();
  -                spm.hasNext(); ) {
  +                spm.hasNext();) {
               SimplePageMaster simplePageMaster =
                   (SimplePageMaster)spm.next();
               Map spmRegions = simplePageMaster.getRegions();
               for (Iterator e = spmRegions.values().iterator();
  -                    e.hasNext(); ) {
  +                    e.hasNext();) {
                   Region region = (Region)e.next();
                   if (allRegions.containsKey(region.getRegionName())) {
                       String localClass =
  @@ -138,12 +205,13 @@
       }
   
       /**
  -     * Checks whether or not a region name exists in this master set
  +     * Checks whether or not a region name exists in this master set.
  +     * @param regionName name of the region
        * @return true when the region name specified has a region in this LayoutMasterSet
        */
       protected boolean regionNameExists(String regionName) {
           for (Iterator e = simplePageMasters.values().iterator();
  -                e.hasNext(); ) {
  +                e.hasNext();) {
               if (((SimplePageMaster)e.next()).regionNameExists(regionName)) {
                   return true;
               }
  
  
  
  1.30      +48 -7     xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java
  
  Index: SimplePageMaster.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- SimplePageMaster.java	5 Mar 2003 20:38:23 -0000	1.29
  +++ SimplePageMaster.java	6 Mar 2003 13:42:41 -0000	1.30
  @@ -86,10 +86,16 @@
       private PageMaster pageMaster;
       private String masterName;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public SimplePageMaster(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
  +     */
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
   
  @@ -171,22 +177,41 @@
           properties = null;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FObj#generatesReferenceAreas()
  +     */
       public boolean generatesReferenceAreas() {
           return true;
       }
   
  +    /**
  +     * Returns the page master.
  +     * @return the page master
  +     */
       public PageMaster getPageMaster() {
           return this.pageMaster;
       }
   
  +    /**
  +     * Returns the next page master. For simple-page-master this is always the
  +     * same as the previous.
  +     * @return the page master
  +     */
       public PageMaster getNextPageMaster() {
           return this.pageMaster;
       }
   
  +    /**
  +     * Returns the name of the simple-page-master.
  +     * @return the page master name
  +     */
       public String getMasterName() {
           return masterName;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#addChild(FONode)
  +     */
       protected void addChild(FONode child) {
           if (child instanceof Region) {
               addRegion((Region)child);
  @@ -196,28 +221,44 @@
           }
       }
   
  +    /**
  +     * Adds a region to this simple-page-master.
  +     * @param region region to add
  +     */
       protected void addRegion(Region region) {
           String key = region.getRegionClass();
           if (regions.containsKey(key)) {
  -            getLogger().error("Only one region of class "
  -                    + key
  -                    + " allowed within a simple-page-master.");
  -            // throw new FOPException("Only one region of class "
  -//                                    + key
  -//                                    + " allowed within a simple-page-master.");
  +            getLogger().error("Only one region of class " + key
  +                    + " allowed within a simple-page-master. The duplicate"
  +                    + " region (" + region.getName() + ") is ignored.");
           } else {
               regions.put(key, region);
           }
       }
   
  +    /**
  +     * Returns the region for a given region class.
  +     * @param regionClass region class to lookup
  +     * @return the region, null if it doesn't exist
  +     */
       public Region getRegion(String regionClass) {
           return (Region)regions.get(regionClass);
       }
   
  +    /**
  +     * Returns a Map of regions associated with this simple-page-master
  +     * @return the regions
  +     */
       protected Map getRegions() {
           return regions;
       }
   
  +    /**
  +     * Indicates if a region with a given name exists in this 
  +     * simple-page-master.
  +     * @param regionName name of the region to lookup
  +     * @return True if a region with this name exists
  +     */
       protected boolean regionNameExists(String regionName) {
           for (Iterator regenum = regions.values().iterator();
                   regenum.hasNext();) {
  
  
  
  1.5       +10 -1     xml-fop/src/org/apache/fop/fo/pagination/RegionBASE.java
  
  Index: RegionBASE.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionBASE.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RegionBASE.java	5 Mar 2003 20:38:23 -0000	1.4
  +++ RegionBASE.java	6 Mar 2003 13:42:42 -0000	1.5
  @@ -60,16 +60,25 @@
   
       private int extent;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       protected RegionBASE(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#end()
  +     */
       public void end() {
           // The problem with this is that it might not be known yet....
           // Supposing extent is calculated in terms of percentage
           this.extent = this.properties.get("extent").getLength().getValue();
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getExtent()
  +     */
       public int getExtent() {
           return this.extent;
       }
  
  
  
  1.8       +71 -13    xml-fop/src/org/apache/fop/fo/pagination/PageNumberGenerator.java
  
  Index: PageNumberGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageNumberGenerator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PageNumberGenerator.java	22 Dec 2002 23:37:05 -0000	1.7
  +++ PageNumberGenerator.java	6 Mar 2003 13:42:42 -0000	1.8
  @@ -1,10 +1,53 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
   // Avalon
  @@ -23,11 +66,11 @@
       private int letterValue;
   
       // constants
  -    private int DECIMAL = 1;       // '0*1'
  -    private int LOWERALPHA = 2;    // 'a'
  -    private int UPPERALPHA = 3;    // 'A'
  -    private int LOWERROMAN = 4;    // 'i'
  -    private int UPPERROMAN = 5;    // 'I'
  +    private static final int DECIMAL = 1;       // '0*1'
  +    private static final int LOWERALPHA = 2;    // 'a'
  +    private static final int UPPERALPHA = 3;    // 'A'
  +    private static final int LOWERROMAN = 4;    // 'i'
  +    private static final int UPPERROMAN = 5;    // 'I'
   
       // flags
       private int formatType = DECIMAL;
  @@ -38,6 +81,14 @@
           "", "0", "00", "000", "0000", "00000"
       };
   
  +    /**
  +     * Main constructor. For further information on the parameters see the XSLT
  +     * specs (Number to String Conversion Attributes).
  +     * @param format format for the page number
  +     * @param groupingSeparator grouping separator
  +     * @param groupingSize grouping size
  +     * @param letterValue letter value
  +     */
       public PageNumberGenerator(String format, char groupingSeparator,
                                  int groupingSize, int letterValue) {
           this.format = format;
  @@ -82,6 +133,11 @@
           }
       }
   
  +    /**
  +     * Formats a page number.
  +     * @param number page number to format
  +     * @return the formatted page number as a String
  +     */
       public String makeFormattedPageNumber(int number) {
           String pn = null;
           if (formatType == DECIMAL) {
  @@ -92,13 +148,15 @@
               }
           } else if ((formatType == LOWERROMAN) || (formatType == UPPERROMAN)) {
               pn = makeRoman(number);
  -            if (formatType == UPPERROMAN)
  +            if (formatType == UPPERROMAN) {
                   pn = pn.toUpperCase();
  +            }
           } else {
               // alphabetic
               pn = makeAlpha(number);
  -            if (formatType == UPPERALPHA)
  +            if (formatType == UPPERALPHA) {
                   pn = pn.toUpperCase();
  +            }
           }
           return pn;
       }
  
  
  
  1.24      +77 -10    xml-fop/src/org/apache/fop/fo/pagination/Root.java
  
  Index: Root.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/Root.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Root.java	23 Dec 2002 00:01:56 -0000	1.23
  +++ Root.java	6 Mar 2003 13:42:42 -0000	1.24
  @@ -1,10 +1,53 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
   // FOP
  @@ -12,7 +55,6 @@
   import org.apache.fop.fo.FONode;
   
   // Java
  -import java.util.ArrayList;
   import java.util.List;
   
   /**
  @@ -23,27 +65,42 @@
       private List pageSequences;
   
       /**
  -     * keeps count of page number from over PageSequence instances
  +     * Keeps count of page number from over PageSequence instances
        */
       private int runningPageNumberCounter = 0;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public Root(FONode parent) {
           super(parent);
           // this.properties.get("media-usage");
  -        pageSequences = new ArrayList();
  +        pageSequences = new java.util.ArrayList();
           if (parent != null) {
               //throw new FOPException("root must be root element");
           }
       }
   
  +    /**
  +     * Returns the number of pages generated (over all PageSequence instances).
  +     * @return the number of pages
  +     */
       protected int getRunningPageNumberCounter() {
           return this.runningPageNumberCounter;
       }
   
  +    /**
  +     * Sets the overall page number counter.
  +     * @param count the new page count
  +     */
       protected void setRunningPageNumberCounter(int count) {
           this.runningPageNumberCounter = count;
       }
   
  +    /**
  +     * Returns the number of PageSequence instances.
  +     * @return the number of PageSequence instances
  +     */
       public int getPageSequenceCount() {
           return pageSequences.size();
       }
  @@ -51,12 +108,14 @@
       /**
        * Some properties, such as 'force-page-count', require a
        * page-sequence to know about some properties of the next.
  +     * @param current the current PageSequence
        * @return succeeding PageSequence; null if none
        */
       public PageSequence getSucceedingPageSequence(PageSequence current) {
           int currentIndex = pageSequences.indexOf(current);
  -        if (currentIndex == -1)
  +        if (currentIndex == -1) {
               return null;
  +        }
           if (currentIndex < (pageSequences.size() - 1)) {
               return (PageSequence)pageSequences.get(currentIndex + 1);
           } else {
  @@ -64,10 +123,18 @@
           }
       }
   
  +    /**
  +     * Returns the associated LayoutMasterSet.
  +     * @return the LayoutMasterSet instance
  +     */
       public LayoutMasterSet getLayoutMasterSet() {
           return this.layoutMasterSet;
       }
   
  +    /**
  +     * Sets the associated LayoutMasterSet.
  +     * @param layoutMasterSet the LayoutMasterSet to use
  +     */
       public void setLayoutMasterSet(LayoutMasterSet layoutMasterSet) {
           this.layoutMasterSet = layoutMasterSet;
       }
  
  
  
  1.5       +64 -11    xml-fop/src/org/apache/fop/fo/pagination/SubSequenceSpecifier.java
  
  Index: SubSequenceSpecifier.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/SubSequenceSpecifier.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SubSequenceSpecifier.java	17 Aug 2002 23:51:07 -0000	1.4
  +++ SubSequenceSpecifier.java	6 Mar 2003 13:42:42 -0000	1.5
  @@ -1,28 +1,81 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
   import org.apache.fop.apps.FOPException;
  +
   /**
    * Classes that implement this interface can be added to a PageSequenceMaster,
    * and are capable of looking up an appropriate PageMaster.
    */
   public interface SubSequenceSpecifier {
  -    public String getNextPageMasterName(boolean isOddPage,
  -                                        boolean isFirstPage,
  -                                        boolean isEmptyPage)
  -      throws FOPException;
  +    
  +    /**
  +     * Returns the name of the next page master.
  +     * @param isOddPage True if the next page number is odd
  +     * @param isFirstPage True if the next page is the first
  +     * @param isBlankPage True if the next page is blank
  +     * @return the page master name
  +     * @throws FOPException if there's a problem determining the next page master
  +     */
  +    String getNextPageMasterName(boolean isOddPage,
  +                                 boolean isFirstPage,
  +                                 boolean isBlankPage)
  +                                    throws FOPException;
   
       /**
        * Called before a new page sequence is rendered so subsequences can reset
        * any state they keep during the formatting process.
        */
  -    public void reset();
  +    void reset();
   
   }
   
  
  
  
  1.12      +88 -22    xml-fop/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
  
  Index: ConditionalPageMasterReference.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ConditionalPageMasterReference.java	17 Aug 2002 23:51:07 -0000	1.11
  +++ ConditionalPageMasterReference.java	6 Mar 2003 13:42:42 -0000	1.12
  @@ -1,18 +1,66 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
  -import org.apache.fop.fo.*;
  -import org.apache.fop.fo.properties.*;
  -import org.apache.fop.apps.FOPException;
  -
  +// XML
   import org.xml.sax.Attributes;
   
  +// FOP
  +import org.apache.fop.fo.FONode;
  +import org.apache.fop.fo.FObj;
  +import org.apache.fop.fo.properties.BlankOrNotBlank;
  +import org.apache.fop.fo.properties.OddOrEven;
  +import org.apache.fop.fo.properties.PagePosition;
  +import org.apache.fop.apps.FOPException;
  +
   /**
    * A conditional-page-master-reference formatting object.
    * This is a reference to a page master with a set of conditions.
  @@ -31,10 +79,16 @@
       private int oddOrEven;
       private int blankOrNotBlank;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public ConditionalPageMasterReference(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
  +     */
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
           if (getProperty("master-reference") != null) {
  @@ -48,12 +102,17 @@
           this.blankOrNotBlank = this.properties.get("blank-or-not-blank").getEnum();
       }
   
  +    /**
  +     * Sets the master name.
  +     * @param masterName name for the master
  +     */
       protected void setMasterName(String masterName) {
           this.masterName = masterName;
       }
   
       /**
        * Returns the "master-name" attribute of this page master reference
  +     * @return the master name
        */
       public String getMasterName() {
           return masterName;
  @@ -63,22 +122,27 @@
        * Check if the conditions for this reference are met.
        * checks the page number and emptyness to determine if this
        * matches.
  +     * @param isOddPage True if page number odd
  +     * @param isFirstPage True if page is first page
  +     * @param isBlankPage True if page is blank
  +     * @return True if the conditions for this reference are met
        */
  -    protected boolean isValid(boolean isOddPage, boolean isFirstPage,
  -                              boolean isEmptyPage) {
  +    protected boolean isValid(boolean isOddPage, 
  +                              boolean isFirstPage,
  +                              boolean isBlankPage) {
           // page-position
  -        if( isFirstPage ) {
  -            if (pagePosition==PagePosition.REST) {
  +        if (isFirstPage) {
  +            if (pagePosition == PagePosition.REST) {
                   return false;
  -            } else if (pagePosition==PagePosition.LAST) {
  +            } else if (pagePosition == PagePosition.LAST) {
                   // how the hell do you know at this point?
                   getLogger().debug("LAST PagePosition NYI");
                   return false;
               }
           } else {
  -            if (pagePosition==PagePosition.FIRST) {
  +            if (pagePosition == PagePosition.FIRST) {
                   return false;
  -            } else if (pagePosition==PagePosition.LAST) {
  +            } else if (pagePosition == PagePosition.LAST) {
                   // how the hell do you know at this point?
                   getLogger().debug("LAST PagePosition NYI");
                   // potentially valid, don't return
  @@ -87,22 +151,22 @@
   
           // odd-or-even
           if (isOddPage) {
  -            if (oddOrEven==OddOrEven.EVEN) {
  +            if (oddOrEven == OddOrEven.EVEN) {
                 return false;
               }
           } else {
  -            if (oddOrEven==OddOrEven.ODD) {
  +            if (oddOrEven == OddOrEven.ODD) {
                 return false;
               }
           }
   
           // blank-or-not-blank
  -        if (isEmptyPage) {
  -            if (blankOrNotBlank==BlankOrNotBlank.NOT_BLANK) {
  +        if (isBlankPage) {
  +            if (blankOrNotBlank == BlankOrNotBlank.NOT_BLANK) {
                   return false;
               }
           } else {
  -            if (blankOrNotBlank==BlankOrNotBlank.BLANK) {
  +            if (blankOrNotBlank == BlankOrNotBlank.BLANK) {
                   return false;
               }
           }
  @@ -112,6 +176,8 @@
       /**
        * Check that the parent is the right type of formatting object
        * repeatable-page-master-alternatives.
  +     * @param parent parent node
  +     * @throws FOPException If the parent is invalid
        */
       protected void validateParent(FONode parent) throws FOPException {
           if (parent.getName().equals("fo:repeatable-page-master-alternatives")) {
  
  
  
  1.11      +71 -11    xml-fop/src/org/apache/fop/fo/pagination/RegionStart.java
  
  Index: RegionStart.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionStart.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- RegionStart.java	5 Jan 2003 09:03:12 -0000	1.10
  +++ RegionStart.java	6 Mar 2003 13:42:42 -0000	1.11
  @@ -1,50 +1,110 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources."
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
   // Java
   import java.awt.Rectangle;
   
   // FOP
  -import org.apache.fop.fo.*;
  +import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.properties.WritingMode;
   import org.apache.fop.datatypes.FODimension;
   import org.apache.fop.area.RegionReference;
   
  +/**
  + * The fo:region-start element.
  + */
   public class RegionStart extends RegionSE {
   
  -
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public RegionStart(FONode parent) {
           super(parent);
       }
   
  -
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
  +     */
       protected Rectangle getViewportRectangle (FODimension reldims) {
           // Depends on extent, precedence an� writing mode
           // This is the rectangle relative to the page-reference area in
           // writing-mode relative coordinates
           Rectangle vpRect;
  -        if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB)
  +        if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
               vpRect = new Rectangle(0, 0, getExtent(), reldims.bpd);
  -        else
  +        } else {
               vpRect = new Rectangle(0, 0, reldims.bpd, getExtent());
  +        }
           adjustIPD(vpRect, this.wm);
           return vpRect;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getDefaultRegionName()
  +     */
       protected String getDefaultRegionName() {
           return "xsl-region-start";
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionClass()
  +     */
       public String getRegionClass() {
           return Region.START;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionAreaClass()
  +     */
       public int getRegionAreaClass() {
           return RegionReference.START;
       }
  
  
  
  1.61      +49 -6     xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java
  
  Index: PageSequence.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- PageSequence.java	14 Feb 2003 04:15:06 -0000	1.60
  +++ PageSequence.java	6 Mar 2003 13:42:42 -0000	1.61
  @@ -1,10 +1,53 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
   // FOP
  
  
  
  1.6       +75 -17    xml-fop/src/org/apache/fop/fo/pagination/RegionBA.java
  
  Index: RegionBA.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionBA.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RegionBA.java	5 Jan 2003 09:03:12 -0000	1.5
  +++ RegionBA.java	6 Mar 2003 13:42:42 -0000	1.6
  @@ -1,36 +1,91 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
  +// Java
  +import java.awt.Rectangle;
  +
   // FOP
  -import org.apache.fop.fo.*;
  +import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.properties.Precedence;
   import org.apache.fop.fo.properties.WritingMode;
   
  -// Java
  -import java.awt.Rectangle;
  -
  +/**
  + * Abstract base class for fo:region-before and fo:region-after.
  + */
   public abstract class RegionBA extends RegionBASE {
   
       private boolean bPrecedence;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       protected RegionBA(FONode parent) {
           super(parent);
       }
   
  -    boolean getPrecedence() {
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getPrecedence()
  +     */
  +    public boolean getPrecedence() {
           return bPrecedence;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#end()
  +     */
       public void end() {
           super.end();
           bPrecedence =
  -            (this.properties.get("precedence").getEnum()==Precedence.TRUE);
  +            (this.properties.get("precedence").getEnum() == Precedence.TRUE);
       }
   
       /**
  @@ -39,6 +94,8 @@
        * If precedence is false on a before or after region, its
        * inline-progression-dimension is limited by the extent of the start
        * and end regions if they are present.
  +     * @param vpRect viewport rectangle
  +     * @param wm writing mode
        */
       protected void adjustIPD(Rectangle vpRect, int wm) {
           int offset = 0;
  @@ -47,15 +104,16 @@
               offset = start.getExtent();
               vpRect.translate(offset, 0);
           }
  -        Region end =getSiblingRegion(Region.END);
  +        Region end = getSiblingRegion(Region.END);
           if (end != null) {
               offset += end.getExtent();
           }
           if (offset > 0) {
  -            if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB)
  -                vpRect.width-=offset;
  -            else
  -                vpRect.height-=offset;
  +            if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB) {
  +                vpRect.width -= offset;
  +            } else {
  +                vpRect.height -= offset;
  +            }
           }
       }
   }
  
  
  
  1.8       +67 -10    xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
  
  Index: RepeatablePageMasterReference.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RepeatablePageMasterReference.java	17 Aug 2002 23:51:07 -0000	1.7
  +++ RepeatablePageMasterReference.java	6 Mar 2003 13:42:42 -0000	1.8
  @@ -1,24 +1,69 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
  -import org.apache.fop.fo.*;
  -import org.apache.fop.apps.FOPException;
  -
  +// XML
   import org.xml.sax.Attributes;
   
  +// FOP
  +import org.apache.fop.fo.FONode;
  +import org.apache.fop.apps.FOPException;
  +
   /**
    * A repeatable-page-master-reference formatting object.
    * This handles a reference with a specified number of repeating
    * instances of the referenced page master (may have no limit).
    */
   public class RepeatablePageMasterReference extends PageMasterReference
  -    implements SubSequenceSpecifier {
  +            implements SubSequenceSpecifier {
   
       private static final int INFINITE = -1;
   
  @@ -27,10 +72,16 @@
       private int maximumRepeats;
       private int numberConsumed = 0;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public RepeatablePageMasterReference(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
  +     */
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
   
  @@ -52,6 +103,9 @@
           }
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.SubSequenceSpecifier
  +     */
       public String getNextPageMasterName(boolean isOddPage,
                                           boolean isFirstPage,
                                           boolean isEmptyPage) {
  @@ -65,6 +119,9 @@
           return getMasterName();
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.SubSequenceSpecifier#reset()
  +     */
       public void reset() {
           this.numberConsumed = 0;
       }
  
  
  
  1.18      +70 -8     xml-fop/src/org/apache/fop/fo/pagination/RegionBefore.java
  
  Index: RegionBefore.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionBefore.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- RegionBefore.java	5 Jan 2003 09:03:12 -0000	1.17
  +++ RegionBefore.java	6 Mar 2003 13:42:42 -0000	1.18
  @@ -1,10 +1,53 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
   // FOP
  @@ -16,24 +59,42 @@
   // Java
   import java.awt.Rectangle;
   
  +/**
  + * The fo:region-before element.
  + */
   public class RegionBefore extends RegionBA {
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public RegionBefore(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getDefaultRegionName()
  +     */
       protected String getDefaultRegionName() {
           return "xsl-region-before";
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionClass()
  +     */
       public String getRegionClass() {
           return Region.BEFORE;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionAreaClass()
  +     */
       public int getRegionAreaClass() {
           return RegionReference.BEFORE;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
  +     */
       protected Rectangle getViewportRectangle (FODimension reldims) {
           // Depends on extent, precedence and writing mode
           // This should return rectangle in writing-mode coordinates relative
  @@ -42,10 +103,11 @@
           // Before is always 0, start depends on extent
           // ipd depends on precedence, bpd=extent
           Rectangle vpRect;
  -        if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB)
  +        if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
               vpRect = new Rectangle(0, 0, reldims.ipd, getExtent());
  -        else
  +        } else {
               vpRect = new Rectangle(0, 0, getExtent(), reldims.ipd);
  +        }
           if (getPrecedence() == false) {
               adjustIPD(vpRect, this.wm);
           }
  
  
  
  1.13      +99 -29    xml-fop/src/org/apache/fop/fo/pagination/PageSequenceMaster.java
  
  Index: PageSequenceMaster.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequenceMaster.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PageSequenceMaster.java	22 Dec 2002 23:37:05 -0000	1.12
  +++ PageSequenceMaster.java	6 Mar 2003 13:42:42 -0000	1.13
  @@ -1,31 +1,75 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
  -// FOP
  -import org.apache.fop.fo.*;
  -import org.apache.fop.apps.FOPException;
  -
   // Java
  -import java.util.ArrayList;
   import java.util.List;
   
   // SAX
   import org.xml.sax.Attributes;
   
  +// FOP
  +import org.apache.fop.fo.FONode;
  +import org.apache.fop.fo.FObj;
  +import org.apache.fop.apps.FOPException;
  +
   /**
    * The page-sequence-master formatting object.
    * This class handles a list of subsequence specifiers
    * which are simple or complex references to page-masters.
    */
   public class PageSequenceMaster extends FObj {
  -    LayoutMasterSet layoutMasterSet;
  -    List subSequenceSpecifiers;
  +    
  +    private LayoutMasterSet layoutMasterSet;
  +    private List subSequenceSpecifiers;
       private SubSequenceSpecifier currentSubSequence;
       private int currentSubSequenceNumber;
       private String masterName;
  @@ -36,14 +80,21 @@
       // references to page-masters. So the methods use the former
       // terminology ('sub-sequence-specifiers', or SSS),
       // but the actual FO's are MasterReferences.
  +    
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public PageSequenceMaster(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#handleAttrs(Attributes)
  +     */
       public void handleAttrs(Attributes attlist) throws FOPException {
           super.handleAttrs(attlist);
   
  -        subSequenceSpecifiers = new ArrayList();
  +        subSequenceSpecifiers = new java.util.ArrayList();
   
           if (parent.getName().equals("fo:layout-master-set")) {
               this.layoutMasterSet = (LayoutMasterSet)parent;
  @@ -61,10 +112,18 @@
           }
       }
   
  +    /**
  +     * Adds a new suqsequence specifier to the page sequence master.
  +     * @param pageMasterReference the subsequence to add
  +     */
       protected void addSubsequenceSpecifier(SubSequenceSpecifier pageMasterReference) {
           subSequenceSpecifiers.add(pageMasterReference);
       }
   
  +    /**
  +     * Returns the next subsequence specifier
  +     * @return a subsequence specifier
  +     */
       private SubSequenceSpecifier getNextSubSequence() {
           currentSubSequenceNumber++;
           if (currentSubSequenceNumber >= 0
  @@ -75,31 +134,42 @@
           return null;
       }
   
  +    /**
  +     * Resets the subsequence specifiers subsystem.
  +     */
       public void reset() {
           currentSubSequenceNumber = -1;
           currentSubSequence = null;
  -        for (int i = 0; i< subSequenceSpecifiers.size(); i++ ) {
  +        for (int i = 0; i < subSequenceSpecifiers.size(); i++) {
               ((SubSequenceSpecifier)subSequenceSpecifiers.get(i)).reset();
           }
       }
   
  -    public SimplePageMaster getNextSimplePageMaster(boolean oddPage,
  -                                                    boolean firstPage,
  -                                                    boolean blankPage)
  -      throws FOPException {
  -        if (currentSubSequence==null) {
  +    /**
  +     * Returns the next simple-page-master.
  +     * @param isOddPage True if the next page number is odd
  +     * @param isFirstPage True if the next page is the first
  +     * @param isBlankPage True if the next page is blank
  +     * @return the requested page master
  +     * @throws FOPException if there's a problem determining the next page master
  +     */
  +    public SimplePageMaster getNextSimplePageMaster(boolean isOddPage,
  +                                                    boolean isFirstPage,
  +                                                    boolean isBlankPage)
  +                                                      throws FOPException {
  +        if (currentSubSequence == null) {
               currentSubSequence = getNextSubSequence();
  -            if (currentSubSequence==null) {
  +            if (currentSubSequence == null) {
                   throw new FOPException("no subsequences in page-sequence-master '"
                                          + masterName + "'");
               }
           }
           String pageMasterName = currentSubSequence
  -          .getNextPageMasterName(oddPage, firstPage, blankPage);
  +            .getNextPageMasterName(isOddPage, isFirstPage, isBlankPage);
           boolean canRecover = true;
  -        while (pageMasterName==null) {
  +        while (pageMasterName == null) {
               SubSequenceSpecifier nextSubSequence = getNextSubSequence();
  -            if (nextSubSequence==null) {
  +            if (nextSubSequence == null) {
                   if (!canRecover) {
                       throw new FOPException("subsequences exhausted in page-sequence-master '"
                                              + masterName
  @@ -114,14 +184,14 @@
                   currentSubSequence = nextSubSequence;
               }
               pageMasterName = currentSubSequence
  -              .getNextPageMasterName(oddPage, firstPage, blankPage);
  +                .getNextPageMasterName(isOddPage, isFirstPage, isBlankPage);
           }
  -        SimplePageMaster pageMaster=this.layoutMasterSet
  -          .getSimplePageMaster(pageMasterName);
  -        if (pageMaster==null) {
  +        SimplePageMaster pageMaster = this.layoutMasterSet
  +            .getSimplePageMaster(pageMasterName);
  +        if (pageMaster == null) {
               throw new FOPException("No simple-page-master matching '"
                                      + pageMasterName + "' in page-sequence-master '"
  -                                   + masterName +"'");
  +                                   + masterName + "'");
           }
           return pageMaster;
       }
  
  
  
  1.17      +74 -12    xml-fop/src/org/apache/fop/fo/pagination/RegionAfter.java
  
  Index: RegionAfter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionAfter.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- RegionAfter.java	5 Jan 2003 09:03:12 -0000	1.16
  +++ RegionAfter.java	6 Mar 2003 13:42:42 -0000	1.17
  @@ -1,48 +1,110 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
  +// Java
  +import java.awt.Rectangle;
  +
   // FOP
  -import org.apache.fop.fo.*;
  +import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.properties.WritingMode;
   import org.apache.fop.datatypes.FODimension;
   import org.apache.fop.area.RegionReference;
   
  -// Java
  -import java.awt.Rectangle;
  -
  +/**
  + * The fo:region-after element.
  + */
   public class RegionAfter extends RegionBA {
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public RegionAfter(FONode parent) {
           super(parent);
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
  +     */
       protected Rectangle getViewportRectangle (FODimension reldims) {
           // Depends on extent, precedence ans writing mode
           Rectangle vpRect;
  -        if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB)
  +        if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
               vpRect = new Rectangle(0, reldims.bpd - getExtent(), reldims.ipd, getExtent());
  -        else
  +        } else {
               vpRect = new Rectangle(0, reldims.bpd - getExtent(), getExtent(), reldims.ipd);
  +        }
           if (getPrecedence() == false) {
               adjustIPD(vpRect, this.wm);
           }
           return vpRect;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getDefaultRegionName()
  +     */
       protected String getDefaultRegionName() {
           return "xsl-region-after";
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionAreaClass()
  +     */
       public int getRegionAreaClass() {
           return RegionReference.AFTER;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.Region#getRegionClass()
  +     */
       public String getRegionClass() {
           return Region.AFTER;
       }
  
  
  
  1.9       +59 -6     xml-fop/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java
  
  Index: SinglePageMasterReference.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SinglePageMasterReference.java	17 Aug 2002 23:51:07 -0000	1.8
  +++ SinglePageMasterReference.java	6 Mar 2003 13:42:42 -0000	1.9
  @@ -1,9 +1,53 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
   import org.apache.fop.fo.FONode;
  @@ -14,18 +58,24 @@
    * master name only once until reset.
    */
   public class SinglePageMasterReference extends PageMasterReference
  -    implements SubSequenceSpecifier {
  +            implements SubSequenceSpecifier {
   
       private static final int FIRST = 0;
       private static final int DONE = 1;
   
       private int state;
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       public SinglePageMasterReference(FONode parent) {
           super(parent);
           this.state = FIRST;
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.SubSequenceSpecifier
  +     */
       public String getNextPageMasterName(boolean isOddPage,
                                           boolean isFirstPage,
                                           boolean isEmptyPage) {
  @@ -37,6 +87,9 @@
           }
       }
   
  +    /**
  +     * @see org.apache.fop.fo.pagination.SubSequenceSpecifier#reset()
  +     */
       public void reset() {
           this.state = FIRST;
       }
  
  
  
  1.5       +66 -14    xml-fop/src/org/apache/fop/fo/pagination/RegionSE.java
  
  Index: RegionSE.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionSE.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RegionSE.java	5 Jan 2003 09:03:12 -0000	1.4
  +++ RegionSE.java	6 Mar 2003 13:42:42 -0000	1.5
  @@ -1,21 +1,70 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  - * For details on use and redistribution please refer to the
  - * LICENSE file included with these sources.
  - */
  -
  + * ============================================================================
  + *                    The Apache Software License, Version 1.1
  + * ============================================================================
  + * 
  + * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  + * 
  + * Redistribution and use in source and binary forms, with or without modifica-
  + * tion, are permitted provided that the following conditions are met:
  + * 
  + * 1. Redistributions of source code must retain the above copyright notice,
  + *    this list of conditions and the following disclaimer.
  + * 
  + * 2. Redistributions in binary form must reproduce the above copyright notice,
  + *    this list of conditions and the following disclaimer in the documentation
  + *    and/or other materials provided with the distribution.
  + * 
  + * 3. The end-user documentation included with the redistribution, if any, must
  + *    include the following acknowledgment: "This product includes software
  + *    developed by the Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowledgment may appear in the software itself, if
  + *    and wherever such third-party acknowledgments normally appear.
  + * 
  + * 4. The names "FOP" and "Apache Software Foundation" must not be used to
  + *    endorse or promote products derived from this software without prior
  + *    written permission. For written permission, please contact
  + *    apache@apache.org.
  + * 
  + * 5. Products derived from this software may not be called "Apache", nor may
  + *    "Apache" appear in their name, without prior written permission of the
  + *    Apache Software Foundation.
  + * 
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  + * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
  + * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + * ============================================================================
  + * 
  + * This software consists of voluntary contributions made by many individuals
  + * on behalf of the Apache Software Foundation and was originally created by
  + * James Tauber <jt...@jtauber.com>. For more information on the Apache
  + * Software Foundation, please see <http://www.apache.org/>.
  + */ 
   package org.apache.fop.fo.pagination;
   
  -// FOP
  -import org.apache.fop.fo.*;
  -import org.apache.fop.fo.properties.WritingMode;
  -
   // Java
   import java.awt.Rectangle;
   
  +// FOP
  +import org.apache.fop.fo.FONode;
  +import org.apache.fop.fo.properties.WritingMode;
  +
  +/**
  + * Abstract base class for fo:region-start and fo:region-end.
  + */
   public abstract class RegionSE extends RegionBASE {
   
  +    /**
  +     * @see org.apache.fop.fo.FONode#FONode(FONode)
  +     */
       protected RegionSE(FONode parent) {
           super(parent);
       }
  @@ -27,6 +76,8 @@
        * regions only go to the limits of their extents, otherwise
        * they extend in the BPD to the page reference rectangle
        * diminish by extend of start and end if present.
  +     * @param refRect reference rectangle
  +     * @param wm writing mode
        */
       protected void adjustIPD(Rectangle refRect, int wm) {
           int offset = 0;
  @@ -40,10 +91,11 @@
               offset += after.getExtent();
           }
           if (offset > 0) {
  -            if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB)
  -                refRect.height-=offset;
  -            else
  -                refRect.width-=offset;
  +            if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB) {
  +                refRect.height -= offset;
  +            } else {
  +                refRect.width -= offset;
  +            }
           }
       }
   }
  
  
  

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