]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Stripped-down experimental develoment environment.
authorPeter Bernard West <pbwest@apache.org>
Tue, 7 May 2002 05:48:13 +0000 (05:48 +0000)
committerPeter Bernard West <pbwest@apache.org>
Tue, 7 May 2002 05:48:13 +0000 (05:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@194781 13f79535-47bb-0310-9956-ffa450edef68

18 files changed:
src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java [deleted file]
src/org/apache/fop/fo/pagination/LayoutMasterSet.java [deleted file]
src/org/apache/fop/fo/pagination/PageMasterReference.java [deleted file]
src/org/apache/fop/fo/pagination/PageNumberGenerator.java [deleted file]
src/org/apache/fop/fo/pagination/PageSequence.java [deleted file]
src/org/apache/fop/fo/pagination/PageSequenceMaster.java [deleted file]
src/org/apache/fop/fo/pagination/Region.java [deleted file]
src/org/apache/fop/fo/pagination/RegionAfter.java [deleted file]
src/org/apache/fop/fo/pagination/RegionBefore.java [deleted file]
src/org/apache/fop/fo/pagination/RegionBody.java [deleted file]
src/org/apache/fop/fo/pagination/RegionEnd.java [deleted file]
src/org/apache/fop/fo/pagination/RegionStart.java [deleted file]
src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java [deleted file]
src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java [deleted file]
src/org/apache/fop/fo/pagination/Root.java [deleted file]
src/org/apache/fop/fo/pagination/SimplePageMaster.java [deleted file]
src/org/apache/fop/fo/pagination/SinglePageMasterReference.java [deleted file]
src/org/apache/fop/fo/pagination/SubSequenceSpecifier.java [deleted file]

diff --git a/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
deleted file mode 100644 (file)
index b186bf7..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.messaging.MessageHandler;
-
-public class ConditionalPageMasterReference extends FObj {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new ConditionalPageMasterReference(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new ConditionalPageMasterReference.Maker();
-    }
-
-    private RepeatablePageMasterAlternatives repeatablePageMasterAlternatives;
-
-    private String masterName;
-
-    private int pagePosition;
-    private int oddOrEven;
-    private int blankOrNotBlank;
-
-    public ConditionalPageMasterReference(FObj parent, PropertyList propertyList)
-            throws FOPException {
-        super(parent, propertyList);
-
-        this.name = getElementName();
-        if (getProperty("master-name") != null) {
-            setMasterName(getProperty("master-name").getString());
-        }
-
-        validateParent(parent);
-
-        setPagePosition(this.properties.get("page-position").getEnum());
-        setOddOrEven(this.properties.get("odd-or-even").getEnum());
-        setBlankOrNotBlank(this.properties.get("blank-or-not-blank").getEnum());
-
-
-    }
-
-    protected void setMasterName(String masterName) {
-        this.masterName = masterName;
-    }
-
-    /**
-     * Returns the "master-name" attribute of this page master reference
-     */
-    public String getMasterName() {
-        return masterName;
-    }
-
-
-    protected boolean isValid(int currentPageNumber, boolean thisIsFirstPage,
-                              boolean isEmptyPage) {
-        // page-position
-        boolean okOnPagePosition = true;    // default is 'any'
-        switch (getPagePosition()) {
-        case PagePosition.FIRST:
-            if (!thisIsFirstPage)
-                okOnPagePosition = false;
-            break;
-        case PagePosition.LAST:
-            // how the hell do you know at this point?
-            MessageHandler.log("LAST PagePosition NYI");
-            okOnPagePosition = true;
-            break;
-        case PagePosition.REST:
-            if (thisIsFirstPage)
-                okOnPagePosition = false;
-            break;
-        case PagePosition.ANY:
-            okOnPagePosition = true;
-        }
-
-        // odd or even
-        boolean okOnOddOrEven = true;    // default is 'any'
-        int ooe = getOddOrEven();
-        boolean isOddPage = ((currentPageNumber % 2) == 1) ? true : false;
-        if ((OddOrEven.ODD == ooe) &&!isOddPage) {
-            okOnOddOrEven = false;
-        }
-        if ((OddOrEven.EVEN == ooe) && isOddPage) {
-            okOnOddOrEven = false;
-        }
-
-        // experimental check for blank-or-not-blank
-
-        boolean okOnBlankOrNotBlank = true;    // default is 'any'
-
-        int bnb = getBlankOrNotBlank();
-
-        if ((BlankOrNotBlank.BLANK == bnb) &&!isEmptyPage) {
-            okOnBlankOrNotBlank = false;
-        } else if ((BlankOrNotBlank.NOT_BLANK == bnb) && isEmptyPage) {
-            okOnBlankOrNotBlank = false;
-        }
-
-        return (okOnOddOrEven && okOnPagePosition && okOnBlankOrNotBlank);
-
-    }
-
-    protected void setPagePosition(int pagePosition) {
-        this.pagePosition = pagePosition;
-    }
-
-    protected int getPagePosition() {
-        return this.pagePosition;
-    }
-
-    protected void setOddOrEven(int oddOrEven) {
-        this.oddOrEven = oddOrEven;
-    }
-
-    protected int getOddOrEven() {
-        return this.oddOrEven;
-    }
-
-    protected void setBlankOrNotBlank(int blankOrNotBlank) {
-        this.blankOrNotBlank = blankOrNotBlank;
-    }
-
-    protected int getBlankOrNotBlank() {
-        return this.blankOrNotBlank;
-    }
-
-    protected String getElementName() {
-        return "fo:conditional-page-master-reference";
-    }
-
-
-    protected void validateParent(FObj parent) throws FOPException {
-        if (parent.getName().equals("fo:repeatable-page-master-alternatives")) {
-            this.repeatablePageMasterAlternatives =
-                (RepeatablePageMasterAlternatives)parent;
-
-            if (getMasterName() == null) {
-                MessageHandler.errorln("WARNING: single-page-master-reference"
-                                       + "does not have a master-name and so is being ignored");
-            } else {
-                this.repeatablePageMasterAlternatives.addConditionalPageMasterReference(this);
-            }
-        } else {
-            throw new FOPException("fo:conditional-page-master-reference must be child "
-                                   + "of fo:repeatable-page-master-alternatives, not "
-                                   + parent.getName());
-        }
-    }
-
-
-}
diff --git a/src/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/org/apache/fop/fo/pagination/LayoutMasterSet.java
deleted file mode 100644 (file)
index 1c5b851..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.layout.PageMaster;
-
-// Java
-import java.util.*;
-
-public class LayoutMasterSet extends FObj {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new LayoutMasterSet(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new LayoutMasterSet.Maker();
-    }
-
-    private Hashtable simplePageMasters;
-    private Hashtable pageSequenceMasters;
-    private Hashtable allRegions;
-
-    private Root root;
-
-    protected LayoutMasterSet(FObj parent,
-                              PropertyList propertyList) throws FOPException {
-        super(parent, propertyList);
-        this.name = "fo:layout-master-set";
-
-        this.simplePageMasters = new Hashtable();
-        this.pageSequenceMasters = new Hashtable();
-
-        if (parent.getName().equals("fo:root")) {
-            this.root = (Root)parent;
-            root.setLayoutMasterSet(this);
-        } else {
-            throw new FOPException("fo:layout-master-set must be child of fo:root, not "
-                                   + parent.getName());
-        }
-        allRegions = new Hashtable();
-
-    }
-
-    protected void addSimplePageMaster(SimplePageMaster simplePageMaster)
-            throws FOPException {
-        // check against duplication of master-name
-        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);
-    }
-
-    protected SimplePageMaster getSimplePageMaster(String masterName) {
-        return (SimplePageMaster)this.simplePageMasters.get(masterName);
-    }
-
-    protected void addPageSequenceMaster(String masterName, PageSequenceMaster pageSequenceMaster)
-            throws FOPException {
-        // check against duplication of master-name
-        if (existsName(masterName))
-            throw new FOPException("'master-name' (" + masterName
-                                   + ") must be unique "
-                                   + "across page-masters and page-sequence-masters");
-        this.pageSequenceMasters.put(masterName, pageSequenceMaster);
-    }
-
-    protected PageSequenceMaster getPageSequenceMaster(String masterName) {
-        return (PageSequenceMaster)this.pageSequenceMasters.get(masterName);
-    }
-
-    private boolean existsName(String masterName) {
-        if (simplePageMasters.containsKey(masterName)
-                || pageSequenceMasters.containsKey(masterName))
-            return true;
-        else
-            return false;
-    }
-
-    protected void resetPageMasters() {
-        for (Enumeration e = pageSequenceMasters.elements();
-                e.hasMoreElements(); ) {
-            ((PageSequenceMaster)e.nextElement()).reset();
-        }
-
-    }
-
-    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.
-        for (Enumeration spm = simplePageMasters.elements();
-                spm.hasMoreElements(); ) {
-            SimplePageMaster simplePageMaster =
-                (SimplePageMaster)spm.nextElement();
-            Hashtable spmRegions = simplePageMaster.getRegions();
-            for (Enumeration e = spmRegions.elements();
-                    e.hasMoreElements(); ) {
-                Region region = (Region)e.nextElement();
-                if (allRegions.containsKey(region.getRegionName())) {
-                    String localClass =
-                        (String)allRegions.get(region.getRegionName());
-                    if (!localClass.equals(region.getRegionClass())) {
-                        throw new FOPException("Duplicate region-names ("
-                                               + region.getRegionName()
-                                               + ") must map "
-                                               + "to the same region-class ("
-                                               + localClass + "!="
-                                               + region.getRegionClass()
-                                               + ")");
-                    }
-                }
-                allRegions.put(region.getRegionName(),
-                               region.getRegionClass());
-            }
-        }
-    }
-
-    /**
-     * Checks whether or not a region name exists in this master set
-     * @returns true when the region name specified has a region in this LayoutMasterSet
-     */
-    protected boolean regionNameExists(String regionName) {
-        boolean result = false;
-        for (Enumeration e = simplePageMasters.elements();
-                e.hasMoreElements(); ) {
-            result =
-                ((SimplePageMaster)e.nextElement()).regionNameExists(regionName);
-            if (result) {
-                return result;
-            }
-        }
-        return result;
-    }
-
-
-}
diff --git a/src/org/apache/fop/fo/pagination/PageMasterReference.java b/src/org/apache/fop/fo/pagination/PageMasterReference.java
deleted file mode 100644 (file)
index 1cae307..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.messaging.MessageHandler;
-
-/**
- * Base PageMasterReference class. Provides implementation for handling the
- * master-name attribute and containment within a PageSequenceMaster
- */
-public abstract class PageMasterReference extends FObj
-    implements SubSequenceSpecifier {
-
-    private String _masterName;
-    private PageSequenceMaster _pageSequenceMaster;
-
-    public PageMasterReference(FObj parent, PropertyList propertyList)
-            throws FOPException {
-        super(parent, propertyList);
-        this.name = getElementName();
-        if (getProperty("master-name") != null) {
-            setMasterName(getProperty("master-name").getString());
-        }
-        validateParent(parent);
-
-    }
-
-    protected void setMasterName(String masterName) {
-        _masterName = masterName;
-    }
-
-    /**
-     * Returns the "master-name" attribute of this page master reference
-     */
-    public String getMasterName() {
-        return _masterName;
-    }
-
-    protected void setPageSequenceMaster(PageSequenceMaster pageSequenceMaster) {
-        _pageSequenceMaster = pageSequenceMaster;
-    }
-
-    protected PageSequenceMaster getPageSequenceMaster() {
-        return _pageSequenceMaster;
-    }
-
-    public abstract String getNextPageMaster(int currentPageNumber,
-                                             boolean thisIsFirstPage,
-                                             boolean isEmptyPage);
-
-    /**
-     * Gets the formating object name for this object. Subclasses must provide this.
-     *
-     * @return the element name of this reference. e.g. fo:repeatable-page-master-reference
-     */
-    protected abstract String getElementName();
-
-    /**
-     * Checks that the parent is the right element. The default implementation
-     * checks for fo:page-sequence-master
-     */
-    protected void validateParent(FObj parent) throws FOPException {
-        if (parent.getName().equals("fo:page-sequence-master")) {
-            _pageSequenceMaster = (PageSequenceMaster)parent;
-
-            if (getMasterName() == null) {
-                MessageHandler.errorln("WARNING: " + getElementName()
-                                       + " does not have a master-name and so is being ignored");
-            } else {
-                _pageSequenceMaster.addSubsequenceSpecifier(this);
-            }
-        } else {
-            throw new FOPException(getElementName() + " must be"
-                                   + "child of fo:page-sequence-master, not "
-                                   + parent.getName());
-        }
-    }
-
-    public abstract void reset();
-
-
-
-
-}
diff --git a/src/org/apache/fop/fo/pagination/PageNumberGenerator.java b/src/org/apache/fop/fo/pagination/PageNumberGenerator.java
deleted file mode 100644 (file)
index 26153d4..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.messaging.MessageHandler;
-
-// Java
-import java.util.*;
-
-/**
- * This class uses the 'format', 'groupingSeparator', 'groupingSize',
- * and 'letterValue' properties on fo:page-sequence to return a String
- * corresponding to the supplied integer page number.
- */
-public class PageNumberGenerator {
-
-    private String format;
-    private char groupingSeparator;
-    private int groupingSize;
-    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'
-
-    // flags
-    private int formatType = DECIMAL;
-    private int minPadding = 0;    // for decimal formats
-
-    // preloaded strings of zeros
-    private String zeros[] = {
-        "", "0", "00", "000", "0000", "00000"
-    };
-
-    public PageNumberGenerator(String format, char groupingSeparator,
-                               int groupingSize, int letterValue) {
-        this.format = format;
-        this.groupingSeparator = groupingSeparator;
-        this.groupingSize = groupingSize;
-        this.letterValue = letterValue;
-
-        // the only accepted format strings are currently '0*1' 'a', 'A', 'i'
-        // and 'I'
-        int fmtLen = format.length();
-        if (fmtLen == 1) {
-            if (format.equals("1")) {
-                formatType = DECIMAL;
-                minPadding = 0;
-            } else if (format.equals("a")) {
-                formatType = LOWERALPHA;
-            } else if (format.equals("A")) {
-                formatType = UPPERALPHA;
-            } else if (format.equals("i")) {
-                formatType = LOWERROMAN;
-            } else if (format.equals("I")) {
-                formatType = UPPERROMAN;
-            } else {
-                // token not handled
-                MessageHandler.log("'format' token not recognized; using '1'");
-                formatType = DECIMAL;
-                minPadding = 0;
-            }
-        } else {
-            // only accepted token is '0+1'at this stage.       Because of the
-            // wonderful regular expression support in Java, we will resort to a
-            // loop
-            for (int i = 0; i < fmtLen - 1; i++) {
-                if (format.charAt(i) != '0') {
-                    MessageHandler.log("'format' token not recognized; using '1'");
-                    formatType = DECIMAL;
-                    minPadding = 0;
-                } else {
-                    minPadding = fmtLen - 1;
-                }
-            }
-        }
-    }
-
-    public String makeFormattedPageNumber(int number) {
-        String pn = null;
-        if (formatType == DECIMAL) {
-            pn = Integer.toString(number);
-            if (minPadding >= pn.length()) {
-                int nz = minPadding - pn.length() + 1;
-                pn = zeros[nz] + pn;
-            }
-        } else if ((formatType == LOWERROMAN) || (formatType == UPPERROMAN)) {
-            pn = makeRoman(number);
-            if (formatType == UPPERROMAN)
-                pn = pn.toUpperCase();
-        } else {
-            // alphabetic
-            pn = makeAlpha(number);
-            if (formatType == UPPERALPHA)
-                pn = pn.toUpperCase();
-        }
-        return pn;
-    }
-
-    private String makeRoman(int num) {
-        int arabic[] = {
-            1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1
-        };
-        String roman[] = {
-            "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix", "v", "iv",
-            "i"
-        };
-
-        int i = 0;
-        StringBuffer romanNumber = new StringBuffer();
-
-        while (num > 0) {
-            while (num >= arabic[i]) {
-                num = num - arabic[i];
-                romanNumber.append(roman[i]);
-            }
-            i = i + 1;
-        }
-        return romanNumber.toString();
-    }
-
-    private String makeAlpha(int num) {
-        String letters = "abcdefghijklmnopqrstuvwxyz";
-        StringBuffer alphaNumber = new StringBuffer();
-
-        int base = 26;
-        int rem = 0;
-
-        num--;
-        if (num < base) {
-            alphaNumber.append(letters.charAt(num));
-        } else {
-            while (num >= base) {
-                rem = num % base;
-                alphaNumber.append(letters.charAt(rem));
-                num = num / base;
-            }
-            alphaNumber.append(letters.charAt(num - 1));
-        }
-        return alphaNumber.reverse().toString();
-    }
-
-}
-
diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java
deleted file mode 100644 (file)
index 6b3bf6e..0000000
+++ /dev/null
@@ -1,687 +0,0 @@
-/*
- * $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.
- */
-/*
- Modified by Mark Lillywhite mark-fop@inomial.com. Does not add
- itself to the root any more. Does not hang onto currentPage
- pointer, which caused GC issues.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.messaging.MessageHandler;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.fo.flow.Flow;
-import org.apache.fop.fo.flow.StaticContent;
-import org.apache.fop.layout.Area;
-import org.apache.fop.layout.AreaContainer;
-import org.apache.fop.layout.BodyAreaContainer;
-import org.apache.fop.layout.AreaTree;
-import org.apache.fop.layout.Page;
-import org.apache.fop.layout.PageMaster;
-import org.apache.fop.apps.FOPException;
-
-// Java
-import java.util.*;
-
-
-/**
- * This provides pagination of flows onto pages. Much of the logic for paginating
- * flows is contained in this class. The main entry point is the format method.
- */
-public class PageSequence extends FObj {
-    //
-    // Factory methods
-    //
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new PageSequence(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new PageSequence.Maker();
-    }
-
-    //
-    // intial-page-number types
-    //
-    private static final int EXPLICIT = 0;
-    private static final int AUTO = 1;
-    private static final int AUTO_EVEN = 2;
-    private static final int AUTO_ODD = 3;
-
-    //
-    // associations
-    //
-
-    /**
-     * The parent root object
-     */
-    private Root root;
-
-    /**
-     * the set of layout masters (provided by the root object)
-     */
-    private LayoutMasterSet layoutMasterSet;
-
-    // There doesn't seem to be anything in the spec requiring flows
-    // to be in the order given, only that they map to the regions
-    // defined in the page sequence, so all we need is this one hashtable
-    // the set of flows includes StaticContent flows also
-
-    /**
-     * Map of flows to their flow name (flow-name, Flow)
-     */
-    private Hashtable _flowMap;
-
-    /**
-     * the "master-name" attribute
-     */
-    private String masterName;
-
-    // according to communication from Paul Grosso (XSL-List,
-    // 001228, Number 406), confusion in spec section 6.4.5 about
-    // multiplicity of fo:flow in XSL 1.0 is cleared up - one (1)
-    // fo:flow per fo:page-sequence only.
-    private boolean isFlowSet = false;
-
-    //
-    // state attributes used during layout
-    //
-
-    private Page currentPage;
-
-    // page number and related formatting variables
-    private String ipnValue;
-    private int currentPageNumber = 0;
-    private PageNumberGenerator pageNumberGenerator;
-
-    private int forcePageCount = 0;
-    private int pageCount = 0;
-    private boolean isForcing = false;
-
-    /**
-     * specifies page numbering type (auto|auto-even|auto-odd|explicit)
-     */
-    private int pageNumberType;
-
-    /**
-     * used to determine whether to calculate auto, auto-even, auto-odd
-     */
-    private boolean thisIsFirstPage;
-
-    /**
-     * the current subsequence while formatting a given page sequence
-     */
-    private SubSequenceSpecifier currentSubsequence;
-
-    /**
-     * the current index in the subsequence list
-     */
-    private int currentSubsequenceNumber =
-        -1;    // starting case is -1 so that first getNext increments to 0
-
-    /**
-     * the name of the current page master
-     */
-    private String currentPageMasterName;
-
-
-    protected PageSequence(FObj parent,
-                           PropertyList propertyList) throws FOPException {
-        super(parent, propertyList);
-        this.name = "fo:page-sequence";
-
-        if (parent.getName().equals("fo:root")) {
-            this.root = (Root)parent;
-            // this.root.addPageSequence(this);
-        }
-        else {
-            throw new FOPException("page-sequence must be child of root, not "
-                                   + parent.getName());
-        }
-
-        layoutMasterSet = root.getLayoutMasterSet();
-
-        // best time to run some checks on LayoutMasterSet
-        layoutMasterSet.checkRegionNames();
-
-        _flowMap = new Hashtable();
-
-        thisIsFirstPage =
-            true;    // we are now on the first page of the page sequence
-        ipnValue = this.properties.get("initial-page-number").getString();
-
-        if (ipnValue.equals("auto")) {
-            pageNumberType = AUTO;
-        } else if (ipnValue.equals("auto-even")) {
-            pageNumberType = AUTO_EVEN;
-        } else if (ipnValue.equals("auto-odd")) {
-            pageNumberType = AUTO_ODD;
-        } else {
-            pageNumberType = EXPLICIT;
-            try {
-                int pageStart = new Integer(ipnValue).intValue();
-                this.currentPageNumber = (pageStart > 0) ? pageStart - 1 : 0;
-            } catch (NumberFormatException nfe) {
-                throw new FOPException("\"" + ipnValue
-                                       + "\" is not a valid value for initial-page-number");
-            }
-        }
-
-        masterName = this.properties.get("master-name").getString();
-
-        // get the 'format' properties
-        this.pageNumberGenerator =
-            new PageNumberGenerator(this.properties.get("format").getString(),
-                                    this.properties.get("grouping-separator").getCharacter(),
-                                    this.properties.get("grouping-size").getNumber().intValue(),
-                                    this.properties.get("letter-value").getEnum());
-
-        this.forcePageCount =
-            this.properties.get("force-page-count").getEnum();
-
-        // this.properties.get("country");
-        // this.properties.get("language");
-        // this.properties.get("id");
-    }
-
-
-    public void addFlow(Flow flow) throws FOPException {
-        if (_flowMap.containsKey(flow.getFlowName())) {
-            throw new FOPException("flow-names must be unique within an fo:page-sequence");
-        }
-        if (!this.layoutMasterSet.regionNameExists(flow.getFlowName())) {
-            MessageHandler.errorln("WARNING: region-name '"
-                                   + flow.getFlowName()
-                                   + "' doesn't exist in the layout-master-set.");
-        }
-        _flowMap.put(flow.getFlowName(), flow);
-        setIsFlowSet(true);
-    }
-
-
-    /**
-     * Runs the formatting of this page sequence into the given area tree
-     */
-    public void format(AreaTree areaTree) throws FOPException {
-
-        Status status = new Status(Status.OK);
-
-        this.layoutMasterSet.resetPageMasters();
-
-        int firstAvailPageNumber = 0;
-        do {
-            // makePage() moved to after the page-number computations,
-            // but store the page-number at this point for that method,
-            // since we want the 'current' current page-number...
-            firstAvailPageNumber = this.root.getRunningPageNumberCounter();
-            boolean tempIsFirstPage = false;
-
-            if (thisIsFirstPage) {
-                tempIsFirstPage = thisIsFirstPage;
-                if (pageNumberType == AUTO) {
-                    this.currentPageNumber =
-                        this.root.getRunningPageNumberCounter();
-                } else if (pageNumberType == AUTO_ODD) {
-                    this.currentPageNumber =
-                        this.root.getRunningPageNumberCounter();
-                    if (this.currentPageNumber % 2 == 1) {
-                        this.currentPageNumber++;
-                    }
-                } else if (pageNumberType == AUTO_EVEN) {
-                    this.currentPageNumber =
-                        this.root.getRunningPageNumberCounter();
-                    if (this.currentPageNumber % 2 == 0) {
-                        this.currentPageNumber++;
-                    }
-                }
-                thisIsFirstPage = false;
-            }
-
-            this.currentPageNumber++;
-
-            // deliberately moved down here so page-number calculations
-            // are complete;
-            // compute flag for 'blank-or-not-blank'
-            boolean isEmptyPage = false;
-
-            if ((status.getCode() == Status.FORCE_PAGE_BREAK_EVEN)
-                    && ((currentPageNumber % 2) == 1)) {
-                isEmptyPage = true;
-            } else if ((status.getCode() == Status.FORCE_PAGE_BREAK_ODD)
-                       && ((currentPageNumber % 2) == 0)) {
-                isEmptyPage = true;
-            } else {
-                isEmptyPage = false;
-            }
-
-            currentPage = makePage(areaTree, firstAvailPageNumber,
-                                   tempIsFirstPage, isEmptyPage);
-
-            currentPage.setNumber(this.currentPageNumber);
-            String formattedPageNumber =
-                pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber);
-            currentPage.setFormattedNumber(formattedPageNumber);
-            this.root.setRunningPageNumberCounter(this.currentPageNumber);
-
-            MessageHandler.log(" [" + currentPageNumber);
-
-            if ((status.getCode() == Status.FORCE_PAGE_BREAK_EVEN)
-                && ((currentPageNumber % 2) == 1)) {}
-            else if ((status.getCode() == Status.FORCE_PAGE_BREAK_ODD)
-                 && ((currentPageNumber % 2) == 0)) {}
-            else {
-                BodyAreaContainer bodyArea = currentPage.getBody();
-                bodyArea.setIDReferences(areaTree.getIDReferences());
-
-                Flow flow = getCurrentFlow(RegionBody.REGION_CLASS);
-
-                if (null == flow) {
-                    MessageHandler.errorln("No flow found for region-body "
-                                           + "in page-master '"
-                                           + currentPageMasterName + "'");
-                    break;
-
-                } else {
-                    status = flow.layout(bodyArea);
-                }
-
-            }
-
-            // because of markers, do after fo:flow (likely also
-            // justifiable because of spec)
-            currentPage.setPageSequence(this);
-            formatStaticContent(areaTree);
-
-            MessageHandler.log("]");
-            areaTree.addPage(currentPage);
-            this.pageCount++;    // used for 'force-page-count' calculations
-        }
-        while (flowsAreIncomplete());
-        // handle the 'force-page-count'
-        forcePage(areaTree, firstAvailPageNumber);
-
-        currentPage = null;
-
-        MessageHandler.logln("");
-    }
-
-    /**
-     * Creates a new page area for the given parameters
-     * @param areaTree the area tree the page should be contained in
-     * @param firstAvailPageNumber the page number for this page
-     * @param isFirstPage true when this is the first page in the sequence
-     * @param isEmptyPage true if this page will be empty (e.g. forced even or odd break)
-     * @return a Page layout object based on the page master selected from the params
-     */
-    private Page makePage(AreaTree areaTree, int firstAvailPageNumber,
-                          boolean isFirstPage,
-                          boolean isEmptyPage) throws FOPException {
-        // layout this page sequence
-
-        // while there is still stuff in the flow, ask the
-        // layoutMasterSet for a new page
-
-        // page number is 0-indexed
-        PageMaster pageMaster = getNextPageMaster(masterName,
-                                firstAvailPageNumber,
-                                isFirstPage, isEmptyPage);
-
-        // a legal alternative is to use the last sub-sequence
-        // specification which should be handled in getNextSubsequence. That's not done here.
-        if (pageMaster == null) {
-            throw new FOPException("page masters exhausted. Cannot recover.");
-        }
-        Page p = pageMaster.makePage(areaTree);
-        if (currentPage != null) {
-            Vector foots = currentPage.getPendingFootnotes();
-            p.setPendingFootnotes(foots);
-        }
-        return p;
-    }
-
-    /**
-     * Formats the static content of the current page
-     */
-    private void formatStaticContent(AreaTree areaTree) throws FOPException {
-        SimplePageMaster simpleMaster = getCurrentSimplePageMaster();
-
-        if (simpleMaster.getRegion(RegionBefore.REGION_CLASS) != null
-                && (currentPage.getBefore() != null)) {
-            Flow staticFlow =
-                (Flow)_flowMap.get(simpleMaster.getRegion(RegionBefore.REGION_CLASS).getRegionName());
-            if (staticFlow != null) {
-                AreaContainer beforeArea = currentPage.getBefore();
-                beforeArea.setIDReferences(areaTree.getIDReferences());
-                layoutStaticContent(staticFlow,
-                                    simpleMaster.getRegion(RegionBefore.REGION_CLASS),
-                                    beforeArea);
-            }
-        }
-
-        if (simpleMaster.getRegion(RegionAfter.REGION_CLASS) != null
-                && (currentPage.getAfter() != null)) {
-            Flow staticFlow =
-                (Flow)_flowMap.get(simpleMaster.getRegion(RegionAfter.REGION_CLASS).getRegionName());
-            if (staticFlow != null) {
-                AreaContainer afterArea = currentPage.getAfter();
-                afterArea.setIDReferences(areaTree.getIDReferences());
-                layoutStaticContent(staticFlow,
-                                    simpleMaster.getRegion(RegionAfter.REGION_CLASS),
-                                    afterArea);
-            }
-        }
-
-        if (simpleMaster.getRegion(RegionStart.REGION_CLASS) != null
-                && (currentPage.getStart() != null)) {
-            Flow staticFlow =
-                (Flow)_flowMap.get(simpleMaster.getRegion(RegionStart.REGION_CLASS).getRegionName());
-            if (staticFlow != null) {
-                AreaContainer startArea = currentPage.getStart();
-                startArea.setIDReferences(areaTree.getIDReferences());
-                layoutStaticContent(staticFlow,
-                                    simpleMaster.getRegion(RegionStart.REGION_CLASS),
-                                    startArea);
-            }
-        }
-
-        if (simpleMaster.getRegion(RegionEnd.REGION_CLASS) != null
-                && (currentPage.getEnd() != null)) {
-            Flow staticFlow =
-                (Flow)_flowMap.get(simpleMaster.getRegion(RegionEnd.REGION_CLASS).getRegionName());
-            if (staticFlow != null) {
-                AreaContainer endArea = currentPage.getEnd();
-                endArea.setIDReferences(areaTree.getIDReferences());
-                layoutStaticContent(staticFlow,
-                                    simpleMaster.getRegion(RegionEnd.REGION_CLASS),
-                                    endArea);
-            }
-        }
-
-    }
-
-    private void layoutStaticContent(Flow flow, Region region,
-                                     AreaContainer area) throws FOPException {
-        if (flow instanceof StaticContent) {
-            AreaContainer beforeArea = currentPage.getBefore();
-            ((StaticContent)flow).layout(area, region);
-        } else {
-            MessageHandler.errorln("WARNING: " + region.getName()
-                                   + " only supports static-content flows currently. Cannot use flow named '"
-                                   + flow.getFlowName() + "'");
-        }
-    }
-
-    /**
-     * Returns the next SubSequenceSpecifier for the given page sequence master. The result
-     * is bassed on the current state of this page sequence.
-     */
-    // refactored from PageSequenceMaster
-    private SubSequenceSpecifier getNextSubsequence(PageSequenceMaster master) {
-        if (master.getSubSequenceSpecifierCount()
-                > currentSubsequenceNumber + 1) {
-
-            currentSubsequence =
-                master.getSubSequenceSpecifier(currentSubsequenceNumber + 1);
-            currentSubsequenceNumber++;
-            return currentSubsequence;
-        } else {
-            return null;
-        }
-
-    }
-
-    /**
-     * Returns the next simple page master for the given sequence master, page number and
-     * other state information
-     */
-    private SimplePageMaster getNextSimplePageMaster(PageSequenceMaster sequenceMaster,
-            int currentPageNumber, boolean thisIsFirstPage,
-            boolean isEmptyPage) {
-        // handle forcing
-        if (isForcing) {
-            String nextPageMaster = getNextPageMasterName(sequenceMaster,
-                                    currentPageNumber, false, true);
-            return this.layoutMasterSet.getSimplePageMaster(nextPageMaster);
-        }
-        String nextPageMaster = getNextPageMasterName(sequenceMaster,
-                                currentPageNumber, thisIsFirstPage, isEmptyPage);
-        return this.layoutMasterSet.getSimplePageMaster(nextPageMaster);
-
-    }
-
-    private String getNextPageMasterName(PageSequenceMaster sequenceMaster,
-                                         int currentPageNumber,
-                                         boolean thisIsFirstPage,
-                                         boolean isEmptyPage) {
-
-        if (null == currentSubsequence) {
-            currentSubsequence = getNextSubsequence(sequenceMaster);
-        }
-
-        String nextPageMaster =
-            currentSubsequence.getNextPageMaster(currentPageNumber,
-                                                 thisIsFirstPage,
-                                                 isEmptyPage);
-
-
-        if (null == nextPageMaster
-                || isFlowForMasterNameDone(currentPageMasterName)) {
-            SubSequenceSpecifier nextSubsequence =
-                getNextSubsequence(sequenceMaster);
-            if (nextSubsequence == null) {
-                MessageHandler.errorln("\nWARNING: Page subsequences exhausted. Using previous subsequence.");
-                thisIsFirstPage =
-                    true;    // this becomes the first page in the new (old really) page master
-                currentSubsequence.reset();
-
-                // we leave currentSubsequence alone
-            }
-            else {
-                currentSubsequence = nextSubsequence;
-            }
-
-            nextPageMaster =
-                currentSubsequence.getNextPageMaster(currentPageNumber,
-                                                     thisIsFirstPage,
-                                                     isEmptyPage);
-        }
-        currentPageMasterName = nextPageMaster;
-
-        return nextPageMaster;
-
-    }
-
-    private SimplePageMaster getCurrentSimplePageMaster() {
-        return this.layoutMasterSet.getSimplePageMaster(currentPageMasterName);
-    }
-
-    private String getCurrentPageMasterName() {
-        return currentPageMasterName;
-    }
-
-    // refactored from LayoutMasterSet
-    private PageMaster getNextPageMaster(String pageSequenceName,
-                                         int currentPageNumber,
-                                         boolean thisIsFirstPage,
-                                         boolean isEmptyPage) throws FOPException {
-        PageMaster pageMaster = null;
-
-        // see if there is a page master sequence for this master name
-        PageSequenceMaster sequenceMaster =
-            this.layoutMasterSet.getPageSequenceMaster(pageSequenceName);
-
-        if (sequenceMaster != null) {
-            pageMaster = getNextSimplePageMaster(sequenceMaster,
-                                                 currentPageNumber,
-                                                 thisIsFirstPage,
-                                                 isEmptyPage).getPageMaster();
-
-        } else {    // otherwise see if there's a simple master by the given name
-            SimplePageMaster simpleMaster =
-                this.layoutMasterSet.getSimplePageMaster(pageSequenceName);
-            if (simpleMaster == null) {
-                throw new FOPException("'master-name' for 'fo:page-sequence'"
-                                       + "matches no 'simple-page-master' or 'page-sequence-master'");
-            }
-            currentPageMasterName = pageSequenceName;
-
-            pageMaster = simpleMaster.getNextPageMaster();
-        }
-        return pageMaster;
-    }
-
-
-    /**
-     * Returns true when there is more flow elements left to lay out.
-     */
-    private boolean flowsAreIncomplete() {
-        boolean isIncomplete = false;
-
-        for (Enumeration e = _flowMap.elements(); e.hasMoreElements(); ) {
-            Flow flow = (Flow)e.nextElement();
-            if (flow instanceof StaticContent) {
-                continue;
-            }
-
-            Status status = flow.getStatus();
-            isIncomplete |= status.isIncomplete();
-        }
-        return isIncomplete;
-    }
-
-    /**
-     * Returns the flow that maps to the given region class for the current
-     * page master.
-     */
-    private Flow getCurrentFlow(String regionClass) {
-        Region region = getCurrentSimplePageMaster().getRegion(regionClass);
-        if (region != null) {
-            Flow flow = (Flow)_flowMap.get(region.getRegionName());
-            return flow;
-
-        } else {
-
-            System.out.println("flow is null. regionClass = '" + regionClass
-                               + "' currentSPM = "
-                               + getCurrentSimplePageMaster());
-
-            return null;
-        }
-
-    }
-
-    private boolean isFlowForMasterNameDone(String masterName) {
-        // parameter is master-name of PMR; we need to locate PM
-        // referenced by this, and determine whether flow(s) are OK
-        if (isForcing)
-            return false;
-        if (masterName != null) {
-
-            SimplePageMaster spm =
-                this.layoutMasterSet.getSimplePageMaster(masterName);
-            Region region = spm.getRegion(RegionBody.REGION_CLASS);
-
-
-            Flow flow = (Flow)_flowMap.get(region.getRegionName());
-            if ((null == flow) || flow.getStatus().isIncomplete())
-                return false;
-            else
-                return true;
-        }
-        return false;
-    }
-
-    public boolean isFlowSet() {
-        return isFlowSet;
-    }
-
-    public void setIsFlowSet(boolean isFlowSet) {
-        this.isFlowSet = isFlowSet;
-    }
-
-    public String getIpnValue() {
-        return ipnValue;
-    }
-
-    public int getCurrentPageNumber() {
-        return currentPageNumber;
-    }
-
-    private void forcePage(AreaTree areaTree, int firstAvailPageNumber) {
-        boolean makePage = false;
-        if (this.forcePageCount == ForcePageCount.AUTO) {
-            PageSequence nextSequence =
-                this.root.getSucceedingPageSequence(this);
-            if (nextSequence != null) {
-                if (nextSequence.getIpnValue().equals("auto")) {
-                    // do nothing special
-                }
-                else if (nextSequence.getIpnValue().equals("auto-odd")) {
-                    if (firstAvailPageNumber % 2 == 0) {
-                        makePage = true;
-                    }
-                } else if (nextSequence.getIpnValue().equals("auto-even")) {
-                    if (firstAvailPageNumber % 2 != 0) {
-                        makePage = true;
-                    }
-                } else {
-                    int nextSequenceStartPageNumber =
-                        nextSequence.getCurrentPageNumber();
-                    if ((nextSequenceStartPageNumber % 2 == 0)
-                            && (firstAvailPageNumber % 2 == 0)) {
-                        makePage = true;
-                    } else if ((nextSequenceStartPageNumber % 2 != 0)
-                               && (firstAvailPageNumber % 2 != 0)) {
-                        makePage = true;
-                    }
-                }
-            }
-        } else if ((this.forcePageCount == ForcePageCount.EVEN)
-                   && (this.pageCount % 2 != 0)) {
-            makePage = true;
-        } else if ((this.forcePageCount == ForcePageCount.ODD)
-                   && (this.pageCount % 2 == 0)) {
-            makePage = true;
-        } else if ((this.forcePageCount == ForcePageCount.END_ON_EVEN)
-                   && (firstAvailPageNumber % 2 == 0)) {
-            makePage = true;
-        } else if ((this.forcePageCount == ForcePageCount.END_ON_ODD)
-                   && (firstAvailPageNumber % 2 != 0)) {
-            makePage = true;
-        } else if (this.forcePageCount == ForcePageCount.NO_FORCE) {
-            // do nothing
-        }
-
-        if (makePage) {
-            try {
-                this.isForcing = true;
-                this.currentPageNumber++;
-                firstAvailPageNumber = this.currentPageNumber;
-                currentPage = makePage(areaTree, firstAvailPageNumber, false,
-                                       true);
-                String formattedPageNumber =
-                    pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber);
-                currentPage.setFormattedNumber(formattedPageNumber);
-                currentPage.setPageSequence(this);
-                formatStaticContent(areaTree);
-                MessageHandler.log("[forced-" + firstAvailPageNumber + "]");
-                areaTree.addPage(currentPage);
-                this.root.setRunningPageNumberCounter(this.currentPageNumber);
-                this.isForcing = false;
-            } catch (FOPException fopex) {
-                MessageHandler.log("'force-page-count' failure");
-            }
-        }
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/org/apache/fop/fo/pagination/PageSequenceMaster.java
deleted file mode 100644 (file)
index e7598c4..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.layout.PageMaster;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.messaging.MessageHandler;
-
-// Java
-import java.util.*;
-
-public class PageSequenceMaster extends FObj {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new PageSequenceMaster(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new PageSequenceMaster.Maker();
-    }
-
-    LayoutMasterSet layoutMasterSet;
-    Vector subSequenceSpecifiers;
-
-
-    // The terminology may be confusing. A 'page-sequence-master' consists
-    // of a sequence of what the XSL spec refers to as
-    // 'sub-sequence-specifiers'. These are, in fact, simple or complex
-    // references to page-masters. So the methods use the former
-    // terminology ('sub-sequence-specifiers', or SSS),
-    // but the actual FO's are MasterReferences.
-    protected PageSequenceMaster(FObj parent, PropertyList propertyList)
-            throws FOPException {
-        super(parent, propertyList);
-        this.name = "fo:page-sequence-master";
-
-        subSequenceSpecifiers = new Vector();
-
-        if (parent.getName().equals("fo:layout-master-set")) {
-            this.layoutMasterSet = (LayoutMasterSet)parent;
-            String pm = this.properties.get("master-name").getString();
-            if (pm == null) {
-                MessageHandler.errorln("WARNING: page-sequence-master does not have "
-                                       + "a page-master-name and so is being ignored");
-            } else {
-                this.layoutMasterSet.addPageSequenceMaster(pm, this);
-            }
-        } else {
-            throw new FOPException("fo:page-sequence-master must be child "
-                                   + "of fo:layout-master-set, not "
-                                   + parent.getName());
-        }
-    }
-
-    protected void addSubsequenceSpecifier(SubSequenceSpecifier pageMasterReference) {
-        subSequenceSpecifiers.addElement(pageMasterReference);
-    }
-
-    protected SubSequenceSpecifier getSubSequenceSpecifier(int sequenceNumber) {
-        if (sequenceNumber >= 0
-                && sequenceNumber < getSubSequenceSpecifierCount()) {
-            return (SubSequenceSpecifier)subSequenceSpecifiers.elementAt(sequenceNumber);
-        }
-        return null;
-
-
-    }
-
-    protected int getSubSequenceSpecifierCount() {
-        return subSequenceSpecifiers.size();
-    }
-
-    public void reset() {
-        for (Enumeration e = subSequenceSpecifiers.elements();
-                e.hasMoreElements(); ) {
-            ((SubSequenceSpecifier)e.nextElement()).reset();
-        }
-
-    }
-
-
-}
diff --git a/src/org/apache/fop/fo/pagination/Region.java b/src/org/apache/fop/fo/pagination/Region.java
deleted file mode 100644 (file)
index 18c2d6d..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.layout.RegionArea;
-
-/**
- * This is an abstract base class for pagination regions
- */
-public abstract class Region extends FObj {
-    public static final String PROP_REGION_NAME = "region-name";
-
-    private SimplePageMaster _layoutMaster;
-    private String _regionName;
-
-    protected Region(FObj parent,
-                     PropertyList propertyList) throws FOPException {
-        super(parent, propertyList);
-        this.name = getElementName();
-
-        // regions may have name, or default
-        if (null == this.properties.get(PROP_REGION_NAME)) {
-            setRegionName(getDefaultRegionName());
-        } else if (this.properties.get(PROP_REGION_NAME).getString().equals("")) {
-            setRegionName(getDefaultRegionName());
-        } else {
-            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
-                                       + "' for " + this.name
-                                       + " not permitted.");
-            }
-        }
-
-        if (parent.getName().equals("fo:simple-page-master")) {
-            _layoutMaster = (SimplePageMaster)parent;
-            getPageMaster().addRegion(this);
-        } else {
-            throw new FOPException(getElementName() + " must be child "
-                                   + "of simple-page-master, not "
-                                   + parent.getName());
-        }
-    }
-
-    /**
-     * Creates a Region layout object for this pagination Region.
-     */
-    abstract RegionArea makeRegionArea(int allocationRectangleXPosition,
-                                       int allocationRectangleYPosition,
-                                       int allocationRectangleWidth,
-                                       int allocationRectangleHeight);
-
-    /**
-     * Returns the default region name (xsl-region-before, xsl-region-start,
-     * etc.)
-     */
-    protected abstract String getDefaultRegionName();
-
-    /**
-     * Returns the element name ("fo:region-body", "fo:region-start",
-     * etc.)
-     */
-    protected abstract String getElementName();
-
-    public abstract String getRegionClass();
-
-
-    /**
-     * Returns the name of this region
-     */
-    public String getRegionName() {
-        return _regionName;
-    }
-
-    private void setRegionName(String name) {
-        _regionName = name;
-    }
-
-    protected SimplePageMaster getPageMaster() {
-        return _layoutMaster;
-    }
-
-    /**
-     * Checks to see if a given region name is one of the reserved names
-     *
-     * @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 {
-        return (name.equals("xsl-region-before")
-                || name.equals("xsl-region-start")
-                || name.equals("xsl-region-end")
-                || name.equals("xsl-region-after")
-                || name.equals("xsl-before-float-separator")
-                || name.equals("xsl-footnote-separator"));
-    }
-
-    public boolean generatesReferenceAreas() {
-        return true;
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/RegionAfter.java b/src/org/apache/fop/fo/pagination/RegionAfter.java
deleted file mode 100644 (file)
index 39fe22d..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.layout.RegionArea;
-import org.apache.fop.layout.BorderAndPadding;
-import org.apache.fop.layout.BackgroundProps;
-
-public class RegionAfter extends Region {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new RegionAfter(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new RegionAfter.Maker();
-    }
-
-    public static final String REGION_CLASS = "after";
-
-    private int precedence;
-
-    protected RegionAfter(FObj parent,
-                          PropertyList propertyList) throws FOPException {
-        super(parent, propertyList);
-        precedence = this.properties.get("precedence").getEnum();
-    }
-
-    RegionArea makeRegionArea(int allocationRectangleXPosition,
-                              int allocationRectangleYPosition,
-                              int allocationRectangleWidth,
-                              int allocationRectangleHeight) {
-
-        // Common Border, Padding, and Background Properties
-        BorderAndPadding bap = propMgr.getBorderAndPadding();
-        BackgroundProps bProps = propMgr.getBackgroundProps();
-
-        // this.properties.get("clip");
-        // this.properties.get("display-align");
-        int extent = this.properties.get("extent").getLength().mvalue();
-        // this.properties.get("overflow");
-        // this.properties.get("precedence");
-        // this.properties.get("region-name");
-        // this.properties.get("reference-orientation");
-        // this.properties.get("writing-mode");
-
-        return new RegionArea(allocationRectangleXPosition,
-                              allocationRectangleYPosition
-                              - allocationRectangleHeight + extent,
-                              allocationRectangleWidth, extent);
-    }
-
-
-    protected String getDefaultRegionName() {
-        return "xsl-region-after";
-    }
-
-    protected String getElementName() {
-        return "fo:region-after";
-    }
-
-    public String getRegionClass() {
-        return REGION_CLASS;
-    }
-
-    public boolean getPrecedence() {
-        return (precedence == Precedence.TRUE ? true : false);
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/RegionBefore.java b/src/org/apache/fop/fo/pagination/RegionBefore.java
deleted file mode 100644 (file)
index e2bcdcf..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.layout.RegionArea;
-import org.apache.fop.layout.BorderAndPadding;
-import org.apache.fop.layout.BackgroundProps;
-import org.apache.fop.apps.FOPException;
-
-public class RegionBefore extends Region {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new RegionBefore(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new RegionBefore.Maker();
-    }
-
-    public static final String REGION_CLASS = "before";
-
-    private int precedence;
-
-    protected RegionBefore(FObj parent,
-                           PropertyList propertyList) throws FOPException {
-        super(parent, propertyList);
-        precedence = this.properties.get("precedence").getEnum();
-    }
-
-
-    RegionArea makeRegionArea(int allocationRectangleXPosition,
-                              int allocationRectangleYPosition,
-                              int allocationRectangleWidth,
-                              int allocationRectangleHeight) {
-
-        // Common Border, Padding, and Background Properties
-        BorderAndPadding bap = propMgr.getBorderAndPadding();
-        BackgroundProps bProps = propMgr.getBackgroundProps();
-
-        // this.properties.get("clip");
-        // this.properties.get("display-align");
-        int extent = this.properties.get("extent").getLength().mvalue();
-        // this.properties.get("overflow");
-        // this.properties.get("precedence");
-        // this.properties.get("region-name");
-        // this.properties.get("reference-orientation");
-        // this.properties.get("writing-mode");
-
-        return new RegionArea(allocationRectangleXPosition,
-                              allocationRectangleYPosition,
-                              allocationRectangleWidth, extent);
-    }
-
-
-    protected String getDefaultRegionName() {
-        return "xsl-region-before";
-    }
-
-    protected String getElementName() {
-        return "fo:region-before";
-    }
-
-    public String getRegionClass() {
-        return REGION_CLASS;
-    }
-
-    public boolean getPrecedence() {
-        return (precedence == Precedence.TRUE ? true : false);
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/RegionBody.java b/src/org/apache/fop/fo/pagination/RegionBody.java
deleted file mode 100644 (file)
index 1eae1bb..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.properties.Overflow;
-import org.apache.fop.datatypes.ColorType;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.layout.RegionArea;
-import org.apache.fop.layout.BodyRegionArea;
-import org.apache.fop.layout.BorderAndPadding;
-import org.apache.fop.layout.BackgroundProps;
-import org.apache.fop.layout.MarginProps;
-import org.apache.fop.messaging.MessageHandler;
-
-public class RegionBody extends Region {
-
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new RegionBody(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new RegionBody.Maker();
-    }
-
-    public static final String REGION_CLASS = "body";
-
-    ColorType backgroundColor;
-
-    protected RegionBody(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-        super(parent, propertyList);
-    }
-
-    RegionArea makeRegionArea(int allocationRectangleXPosition,
-                              int allocationRectangleYPosition,
-                              int allocationRectangleWidth,
-                              int allocationRectangleHeight) {
-
-        // Common Border, Padding, and Background Properties
-        BorderAndPadding bap = propMgr.getBorderAndPadding();
-        BackgroundProps bProps = propMgr.getBackgroundProps();
-
-        // Common Margin Properties-Block
-        MarginProps mProps = propMgr.getMarginProps();
-
-        // this.properties.get("clip");
-        // this.properties.get("display-align");
-        // this.properties.get("region-name");
-        // this.properties.get("reference-orientation");
-        // this.properties.get("writing-mode");
-
-        this.backgroundColor =
-            this.properties.get("background-color").getColorType();
-
-        BodyRegionArea body = new BodyRegionArea(allocationRectangleXPosition
-                                                 + mProps.marginLeft,
-                                                 allocationRectangleYPosition
-                                                 - mProps.marginTop,
-                                                 allocationRectangleWidth
-                                                 - mProps.marginLeft
-                                                 - mProps.marginRight,
-                                                 allocationRectangleHeight
-                                                 - mProps.marginTop
-                                                 - mProps.marginBottom);
-
-        int overflow = this.properties.get("overflow").getEnum();
-        String columnCountAsString =
-            this.properties.get("column-count").getString();
-        int columnCount = 1;
-        try {
-            columnCount = Integer.parseInt(columnCountAsString);
-        } catch (NumberFormatException nfe) {
-            MessageHandler.errorln("Bad value on region body 'column-count'");
-            columnCount = 1;
-        }
-        if ((columnCount > 1) && (overflow == Overflow.SCROLL)) {
-            // recover by setting 'column-count' to 1. This is allowed but
-            // not required by the spec.
-            MessageHandler.errorln("Setting 'column-count' to 1 because "
-                                   + "'overflow' is set to 'scroll'");
-            columnCount = 1;
-        }
-        body.setColumnCount(columnCount);
-
-        int columnGap =
-            this.properties.get("column-gap").getLength().mvalue();
-        body.setColumnGap(columnGap);
-
-        body.setBackgroundColor(backgroundColor);
-
-        return body;
-    }
-
-    protected String getDefaultRegionName() {
-        return "xsl-region-body";
-    }
-
-    protected String getElementName() {
-        return "fo:region-body";
-    }
-
-    public String getRegionClass() {
-        return REGION_CLASS;
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/RegionEnd.java b/src/org/apache/fop/fo/pagination/RegionEnd.java
deleted file mode 100644 (file)
index 0712af5..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.layout.RegionArea;
-import org.apache.fop.layout.BorderAndPadding;
-import org.apache.fop.layout.BackgroundProps;
-import org.apache.fop.apps.FOPException;
-
-public class RegionEnd extends Region {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new RegionEnd(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new RegionEnd.Maker();
-    }
-
-    public static final String REGION_CLASS = "end";
-
-
-    protected RegionEnd(FObj parent,
-                        PropertyList propertyList) throws FOPException {
-        super(parent, propertyList);
-    }
-
-
-    RegionArea makeRegionArea(int allocationRectangleXPosition,
-                              int allocationRectangleYPosition,
-                              int allocationRectangleWidth,
-                              int allocationRectangleHeight,
-                              boolean beforePrecedence,
-                              boolean afterPrecedence, int beforeHeight,
-                              int afterHeight) {
-        int extent = this.properties.get("extent").getLength().mvalue();
-
-        int startY = allocationRectangleYPosition;
-        int startH = allocationRectangleHeight;
-        if (beforePrecedence) {
-            startY -= beforeHeight;
-            startH -= beforeHeight;
-        }
-        if (afterPrecedence)
-            startH -= afterHeight;
-        return new RegionArea(allocationRectangleXPosition
-                              + allocationRectangleWidth - extent, startY,
-                              extent, startH);
-    }
-
-    RegionArea makeRegionArea(int allocationRectangleXPosition,
-                              int allocationRectangleYPosition,
-                              int allocationRectangleWidth,
-                              int allocationRectangleHeight) {
-
-        // Common Border, Padding, and Background Properties
-        BorderAndPadding bap = propMgr.getBorderAndPadding();
-        BackgroundProps bProps = propMgr.getBackgroundProps();
-
-        // this.properties.get("clip");
-        // this.properties.get("display-align");
-        int extent = this.properties.get("extent").getLength().mvalue();
-        // this.properties.get("overflow");
-        // this.properties.get("region-name");
-        // this.properties.get("reference-orientation");
-        // this.properties.get("writing-mode");
-
-        return makeRegionArea(allocationRectangleXPosition,
-                              allocationRectangleYPosition,
-                              allocationRectangleWidth, extent, false, false,
-                              0, 0);
-    }
-
-    protected String getDefaultRegionName() {
-        return "xsl-region-end";
-    }
-
-    protected String getElementName() {
-        return "fo:region-end";
-    }
-
-    public String getRegionClass() {
-        return REGION_CLASS;
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/RegionStart.java b/src/org/apache/fop/fo/pagination/RegionStart.java
deleted file mode 100644 (file)
index 0388340..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * $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."
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.layout.RegionArea;
-import org.apache.fop.layout.BorderAndPadding;
-import org.apache.fop.layout.BackgroundProps;
-import org.apache.fop.apps.FOPException;
-
-public class RegionStart extends Region {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new RegionStart(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new RegionStart.Maker();
-    }
-
-    public static final String REGION_CLASS = "start";
-
-
-    protected RegionStart(FObj parent,
-                          PropertyList propertyList) throws FOPException {
-        super(parent, propertyList);
-    }
-
-
-    RegionArea makeRegionArea(int allocationRectangleXPosition,
-                              int allocationRectangleYPosition,
-                              int allocationRectangleWidth,
-                              int allocationRectangleHeight,
-                              boolean beforePrecedence,
-                              boolean afterPrecedence, int beforeHeight,
-                              int afterHeight) {
-        int extent = this.properties.get("extent").getLength().mvalue();
-
-        int startY = allocationRectangleYPosition;
-        int startH = allocationRectangleHeight;
-        if (beforePrecedence) {
-            startY -= beforeHeight;
-            startH -= beforeHeight;
-        }
-        if (afterPrecedence)
-            startH -= afterHeight;
-        return new RegionArea(allocationRectangleXPosition, startY, extent,
-                              startH);
-    }
-
-    RegionArea makeRegionArea(int allocationRectangleXPosition,
-                              int allocationRectangleYPosition,
-                              int allocationRectangleWidth,
-                              int allocationRectangleHeight) {
-
-        // Common Border, Padding, and Background Properties
-        BorderAndPadding bap = propMgr.getBorderAndPadding();
-        BackgroundProps bProps = propMgr.getBackgroundProps();
-
-        // this.properties.get("clip");
-        // this.properties.get("display-align");
-        int extent = this.properties.get("extent").getLength().mvalue();
-        // this.properties.get("overflow");
-        // this.properties.get("region-name");
-        // this.properties.get("reference-orientation");
-        // this.properties.get("writing-mode");
-
-        return makeRegionArea(allocationRectangleXPosition,
-                              allocationRectangleYPosition,
-                              allocationRectangleWidth, extent, false, false,
-                              0, 0);
-    }
-
-    protected String getDefaultRegionName() {
-        return "xsl-region-start";
-    }
-
-    protected String getElementName() {
-        return "fo:region-start";
-    }
-
-    public String getRegionClass() {
-        return REGION_CLASS;
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
deleted file mode 100644 (file)
index c7eded7..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-import org.apache.fop.fo.*;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.messaging.MessageHandler;
-
-// Java
-import java.util.Vector;
-
-public class RepeatablePageMasterAlternatives extends FObj
-    implements SubSequenceSpecifier {
-
-    private static final int INFINITE = -1;
-
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new RepeatablePageMasterAlternatives(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new RepeatablePageMasterAlternatives.Maker();
-    }
-
-    private PageSequenceMaster pageSequenceMaster;
-
-    /**
-     * Max times this page master can be repeated.
-     * INFINITE is used for the unbounded case
-     */
-    private int maximumRepeats;
-    private int numberConsumed = 0;
-
-    private Vector conditionalPageMasterRefs;
-
-    public RepeatablePageMasterAlternatives(FObj parent, PropertyList propertyList)
-            throws FOPException {
-        super(parent, propertyList);
-        this.name = "fo:repeatable-page-master-alternatives";
-
-        conditionalPageMasterRefs = new Vector();
-
-        if (parent.getName().equals("fo:page-sequence-master")) {
-            this.pageSequenceMaster = (PageSequenceMaster)parent;
-            this.pageSequenceMaster.addSubsequenceSpecifier(this);
-        } else {
-            throw new FOPException("fo:repeatable-page-master-alternatives"
-                                   + "must be child of fo:page-sequence-master, not "
-                                   + parent.getName());
-        }
-
-        String mr = getProperty("maximum-repeats").getString();
-        if (mr.equals("no-limit")) {
-            setMaximumRepeats(INFINITE);
-        } else {
-            try {
-                setMaximumRepeats(Integer.parseInt(mr));
-            } catch (NumberFormatException nfe) {
-                throw new FOPException("Invalid number for "
-                                       + "'maximum-repeats' property");
-            }
-        }
-
-    }
-
-    public String getNextPageMaster(int currentPageNumber,
-                                    boolean thisIsFirstPage,
-                                    boolean isEmptyPage) {
-        String pm = null;
-
-        if (getMaximumRepeats() != INFINITE) {
-            if (numberConsumed < getMaximumRepeats()) {
-                numberConsumed++;
-            } else {
-                return null;
-            }
-        }
-
-        for (int i = 0; i < conditionalPageMasterRefs.size(); i++) {
-            ConditionalPageMasterReference cpmr =
-                (ConditionalPageMasterReference)conditionalPageMasterRefs.elementAt(i);
-
-            // 0-indexed page number
-            if (cpmr.isValid(currentPageNumber + 1, thisIsFirstPage,
-                             isEmptyPage)) {
-                pm = cpmr.getMasterName();
-                break;
-            }
-        }
-        return pm;
-    }
-
-    private void setMaximumRepeats(int maximumRepeats) {
-        if (maximumRepeats == INFINITE) {
-            this.maximumRepeats = maximumRepeats;
-        } else {
-            this.maximumRepeats = (maximumRepeats < 0) ? 0 : maximumRepeats;
-        }
-
-    }
-
-    private int getMaximumRepeats() {
-        return this.maximumRepeats;
-    }
-
-    public void addConditionalPageMasterReference(ConditionalPageMasterReference cpmr) {
-        this.conditionalPageMasterRefs.addElement(cpmr);
-    }
-
-    public void reset() {
-        this.numberConsumed = 0;
-    }
-
-
-    protected PageSequenceMaster getPageSequenceMaster() {
-        return pageSequenceMaster;
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
deleted file mode 100644 (file)
index 85abf80..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-import org.apache.fop.fo.*;
-import org.apache.fop.apps.FOPException;
-
-public class RepeatablePageMasterReference extends PageMasterReference
-    implements SubSequenceSpecifier {
-
-    private static final int INFINITE = -1;
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new RepeatablePageMasterReference(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new RepeatablePageMasterReference.Maker();
-    }
-
-
-    private PageSequenceMaster pageSequenceMaster;
-
-    private int maximumRepeats;
-    private int numberConsumed = 0;
-
-    public RepeatablePageMasterReference(FObj parent, PropertyList propertyList)
-            throws FOPException {
-        super(parent, propertyList);
-
-        String mr = getProperty("maximum-repeats").getString();
-        if (mr.equals("no-limit")) {
-            setMaximumRepeats(INFINITE);
-        } else {
-            try {
-                setMaximumRepeats(Integer.parseInt(mr));
-            } catch (NumberFormatException nfe) {
-                throw new FOPException("Invalid number for "
-                                       + "'maximum-repeats' property");
-            }
-        }
-
-    }
-
-    public String getNextPageMaster(int currentPageNumber,
-                                    boolean thisIsFirstPage,
-                                    boolean isEmptyPage) {
-        String pm = getMasterName();
-
-        if (getMaximumRepeats() != INFINITE) {
-            if (numberConsumed < getMaximumRepeats()) {
-                numberConsumed++;
-            } else {
-                pm = null;
-            }
-        }
-        return pm;
-    }
-
-    private void setMaximumRepeats(int maximumRepeats) {
-        if (maximumRepeats == INFINITE) {
-            this.maximumRepeats = maximumRepeats;
-        } else {
-            this.maximumRepeats = (maximumRepeats < 0) ? 0 : maximumRepeats;
-        }
-    }
-
-    private int getMaximumRepeats() {
-        return this.maximumRepeats;
-    }
-
-    protected String getElementName() {
-        return "fo:repeatable-page-master-reference";
-    }
-
-    public void reset() {
-        this.numberConsumed = 0;
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/Root.java b/src/org/apache/fop/fo/pagination/Root.java
deleted file mode 100644 (file)
index e98d8f1..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.messaging.MessageHandler;
-import org.apache.fop.fo.flow.*;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.layout.AreaTree;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.extensions.ExtensionObj;
-
-// Java
-import java.util.Vector;
-import java.util.Enumeration;
-
-/**
- * The fo:root formatting object. Contains page masters, root extensions,
- * page-sequences.
- */
-public class Root extends FObj {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new Root(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new Root.Maker();
-    }
-
-    LayoutMasterSet layoutMasterSet;
-    Vector pageSequences;
-
-    /**
-     * keeps count of page number from over PageSequence instances
-     */
-    private int runningPageNumberCounter = 0;
-
-    protected Root(FObj parent,
-                   PropertyList propertyList) throws FOPException {
-        super(parent, propertyList);
-        this.name = "fo:root";
-
-        // this.properties.get("media-usage");
-
-        pageSequences = new Vector();
-
-        if (parent != null) {
-            throw new FOPException("root must be root element");
-        }
-    }
-
-    protected int getRunningPageNumberCounter() {
-        return this.runningPageNumberCounter;
-    }
-
-    protected void setRunningPageNumberCounter(int count) {
-        this.runningPageNumberCounter = count;
-    }
-
-    /**
-     * @deprecated handled by addChild now
-     */
-    public void addPageSequence(PageSequence pageSequence) {
-        this.pageSequences.addElement(pageSequence);
-    }
-
-    public int getPageSequenceCount() {
-        return pageSequences.size();
-    }
-
-    /**
-     * Some properties, such as 'force-page-count', require a
-     * page-sequence to know about some properties of the next.
-     * @returns succeeding PageSequence; null if none
-     */
-    public PageSequence getSucceedingPageSequence(PageSequence current) {
-        int currentIndex = pageSequences.indexOf(current);
-        if (currentIndex == -1)
-            return null;
-        if (currentIndex < (pageSequences.size() - 1)) {
-            return (PageSequence)pageSequences.elementAt(currentIndex + 1);
-        } else {
-            return null;
-        }
-    }
-
-    public LayoutMasterSet getLayoutMasterSet() {
-        return this.layoutMasterSet;
-    }
-
-    public void setLayoutMasterSet(LayoutMasterSet layoutMasterSet) {
-        this.layoutMasterSet = layoutMasterSet;
-    }
-
-    public void format(AreaTree areaTree) throws FOPException {
-        // MessageHandler.errorln(" Root[" + marker + "] ");
-        if (layoutMasterSet == null) {
-            throw new FOPException("No layout master set.");
-        }
-
-        Enumeration e = children.elements();
-        while (e.hasMoreElements()) {
-            Object o = e.nextElement();
-            if (o instanceof PageSequence) {
-                ((PageSequence)o).format(areaTree);
-            } else if (o instanceof ExtensionObj) {
-                ((ExtensionObj)o).format(areaTree);
-            }
-        }
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/org/apache/fop/fo/pagination/SimplePageMaster.java
deleted file mode 100644 (file)
index fed72e9..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-// FOP
-import org.apache.fop.fo.*;
-import org.apache.fop.messaging.MessageHandler;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.layout.PageMaster;
-import org.apache.fop.layout.RegionArea;
-import org.apache.fop.layout.BodyRegionArea;
-import org.apache.fop.layout.MarginProps;
-import org.apache.fop.apps.FOPException;
-
-import java.util.*;
-
-public class SimplePageMaster extends FObj {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new SimplePageMaster(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new SimplePageMaster.Maker();
-    }
-
-    /**
-     * Page regions (regionClass, Region)
-     */
-    private Hashtable _regions;
-
-
-    LayoutMasterSet layoutMasterSet;
-    PageMaster pageMaster;
-    String masterName;
-
-    // before and after data as required by start and end
-    boolean beforePrecedence;
-    int beforeHeight;
-    boolean afterPrecedence;
-    int afterHeight;
-
-    protected SimplePageMaster(FObj parent, PropertyList propertyList)
-            throws FOPException {
-        super(parent, propertyList);
-        this.name = "fo:simple-page-master";
-
-        if (parent.getName().equals("fo:layout-master-set")) {
-            this.layoutMasterSet = (LayoutMasterSet)parent;
-            masterName = this.properties.get("master-name").getString();
-            if (masterName == null) {
-                MessageHandler.errorln("WARNING: simple-page-master does not have "
-                                       + "a master-name and so is being ignored");
-            } else {
-                this.layoutMasterSet.addSimplePageMaster(this);
-            }
-        } else {
-            throw new FOPException("fo:simple-page-master must be child "
-                                   + "of fo:layout-master-set, not "
-                                   + parent.getName());
-        }
-        _regions = new Hashtable();
-
-    }
-
-    protected void end() {
-        int pageWidth =
-            this.properties.get("page-width").getLength().mvalue();
-        int pageHeight =
-            this.properties.get("page-height").getLength().mvalue();
-        // this.properties.get("reference-orientation");
-        // this.properties.get("writing-mode");
-
-        // Common Margin Properties-Block
-        MarginProps mProps = propMgr.getMarginProps();
-
-        int contentRectangleXPosition = mProps.marginLeft;
-        int contentRectangleYPosition = pageHeight - mProps.marginTop;
-        int contentRectangleWidth = pageWidth - mProps.marginLeft
-                                    - mProps.marginRight;
-        int contentRectangleHeight = pageHeight - mProps.marginTop
-                                     - mProps.marginBottom;
-
-        this.pageMaster = new PageMaster(pageWidth, pageHeight);
-        if (getRegion(RegionBody.REGION_CLASS) != null) {
-            BodyRegionArea body =
-                (BodyRegionArea)getRegion(RegionBody.REGION_CLASS).makeRegionArea(contentRectangleXPosition,
-                                          contentRectangleYPosition,
-                                          contentRectangleWidth,
-                                          contentRectangleHeight);
-            this.pageMaster.addBody(body);
-        } else {
-            MessageHandler.errorln("ERROR: simple-page-master must have a region of class "
-                                   + RegionBody.REGION_CLASS);
-        }
-
-        if (getRegion(RegionBefore.REGION_CLASS) != null) {
-            RegionArea before =
-                getRegion(RegionBefore.REGION_CLASS).makeRegionArea(contentRectangleXPosition,
-                          contentRectangleYPosition, contentRectangleWidth,
-                          contentRectangleHeight);
-            this.pageMaster.addBefore(before);
-            beforePrecedence =
-                ((RegionBefore)getRegion(RegionBefore.REGION_CLASS)).getPrecedence();
-            beforeHeight = before.getHeight();
-        } else {
-            beforePrecedence = false;
-        }
-
-        if (getRegion(RegionAfter.REGION_CLASS) != null) {
-            RegionArea after =
-                getRegion(RegionAfter.REGION_CLASS).makeRegionArea(contentRectangleXPosition,
-                          contentRectangleYPosition, contentRectangleWidth,
-                          contentRectangleHeight);
-            this.pageMaster.addAfter(after);
-            afterPrecedence =
-                ((RegionAfter)getRegion(RegionAfter.REGION_CLASS)).getPrecedence();
-            afterHeight = after.getHeight();
-        } else {
-            afterPrecedence = false;
-        }
-
-        if (getRegion(RegionStart.REGION_CLASS) != null) {
-            RegionArea start =
-                ((RegionStart)getRegion(RegionStart.REGION_CLASS)).makeRegionArea(contentRectangleXPosition,
-                    contentRectangleYPosition, contentRectangleWidth,
-                    contentRectangleHeight, beforePrecedence,
-                    afterPrecedence, beforeHeight, afterHeight);
-            this.pageMaster.addStart(start);
-        }
-
-        if (getRegion(RegionEnd.REGION_CLASS) != null) {
-            RegionArea end =
-                ((RegionEnd)getRegion(RegionEnd.REGION_CLASS)).makeRegionArea(contentRectangleXPosition,
-                    contentRectangleYPosition, contentRectangleWidth,
-                    contentRectangleHeight, beforePrecedence,
-                    afterPrecedence, beforeHeight, afterHeight);
-            this.pageMaster.addEnd(end);
-        }
-    }
-
-    public PageMaster getPageMaster() {
-        return this.pageMaster;
-    }
-
-    public PageMaster getNextPageMaster() {
-        return this.pageMaster;
-    }
-
-    public String getMasterName() {
-        return masterName;
-    }
-
-
-    protected void addRegion(Region region) throws FOPException {
-        if (_regions.containsKey(region.getRegionClass())) {
-            throw new FOPException("Only one region of class "
-                                   + region.getRegionClass()
-                                   + " allowed within a simple-page-master.");
-        } else {
-            _regions.put(region.getRegionClass(), region);
-        }
-    }
-
-    protected Region getRegion(String regionClass) {
-        return (Region)_regions.get(regionClass);
-    }
-
-    protected Hashtable getRegions() {
-        return _regions;
-    }
-
-    protected boolean regionNameExists(String regionName) {
-        for (Enumeration regenum = _regions.elements();
-                regenum.hasMoreElements(); ) {
-            Region r = (Region)regenum.nextElement();
-            if (r.getRegionName().equals(regionName)) {
-                return true;
-            }
-        }
-        return false;
-
-    }
-
-}
diff --git a/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/org/apache/fop/fo/pagination/SinglePageMasterReference.java
deleted file mode 100644 (file)
index 315107c..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * $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.
- */
-package org.apache.fop.fo.pagination;
-
-import org.apache.fop.fo.*;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.messaging.MessageHandler;
-
-public class SinglePageMasterReference extends PageMasterReference
-    implements SubSequenceSpecifier {
-
-    public static class Maker extends FObj.Maker {
-        public FObj make(FObj parent,
-                         PropertyList propertyList) throws FOPException {
-            return new SinglePageMasterReference(parent, propertyList);
-        }
-
-    }
-
-    public static FObj.Maker maker() {
-        return new SinglePageMasterReference.Maker();
-    }
-
-    private static final int FIRST = 0;
-    private static final int DONE = 1;
-
-    private int state;
-
-    public SinglePageMasterReference(FObj parent, PropertyList propertyList)
-            throws FOPException {
-        super(parent, propertyList);
-        this.state = FIRST;
-
-    }
-
-    public String getNextPageMaster(int currentPageNumber,
-                                    boolean thisIsFirstPage,
-                                    boolean isEmptyPage) {
-        if (this.state == FIRST) {
-            this.state = DONE;
-            return getMasterName();
-        } else {
-            return null;
-        }
-
-    }
-
-    public void reset() {
-        this.state = FIRST;
-    }
-
-
-    protected String getElementName() {
-        return "fo:single-page-master-reference";
-    }
-
-
-}
diff --git a/src/org/apache/fop/fo/pagination/SubSequenceSpecifier.java b/src/org/apache/fop/fo/pagination/SubSequenceSpecifier.java
deleted file mode 100644 (file)
index e8507fa..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * $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.
- */
-
-package org.apache.fop.fo.pagination;
-
-/**
- * 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 getNextPageMaster(int currentPageNumber,
-                                    boolean thisIsFirstPage,
-                                    boolean isEmptyPage);
-
-    /**
-     * Called before a new page sequence is rendered so subsequences can reset
-     * any state they keep during the formatting process.
-     */
-    public void reset();
-
-}
-