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