* ============================================================================
* 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
* (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.area;
+import org.apache.fop.fo.pagination.Region;
+
/**
* The body region area.
* This area contains a main reference area and optionally a
* This sets the region reference area class to BODY.
*/
public BodyRegion() {
- super(BODY);
+ super(Region.BODY_CODE);
}
/**
* are assumed to be null and are not cloned.
*
* @return a shallow copy of this object
- */
+ */
public Object clone() {
BodyRegion br = new BodyRegion();
br.setCTM(getCTM());
* ============================================================================
* 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
* (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.area;
import java.io.Serializable;
import java.util.Map;
+import org.apache.fop.fo.pagination.Region;
+
/**
* The page.
* This holds the contents of the page. Each region is added.
* @param port the region viewport to set
*/
public void setRegion(int areaclass, RegionViewport port) {
- if (areaclass == RegionReference.BEFORE) {
+ if (areaclass == Region.BEFORE_CODE) {
regionBefore = port;
- } else if (areaclass == RegionReference.START) {
+ } else if (areaclass == Region.START_CODE) {
regionStart = port;
- } else if (areaclass == RegionReference.BODY) {
+ } else if (areaclass == Region.BODY_CODE) {
regionBody = port;
- } else if (areaclass == RegionReference.END) {
+ } else if (areaclass == Region.END_CODE) {
regionEnd = port;
- } else if (areaclass == RegionReference.AFTER) {
+ } else if (areaclass == Region.AFTER_CODE) {
regionAfter = port;
}
}
* @return the region viewport or null if none
*/
public RegionViewport getRegion(int areaclass) {
- if (areaclass == RegionReference.BEFORE) {
+ if (areaclass == Region.BEFORE_CODE) {
return regionBefore;
- } else if (areaclass == RegionReference.START) {
+ } else if (areaclass == Region.START_CODE) {
return regionStart;
- } else if (areaclass == RegionReference.BODY) {
+ } else if (areaclass == Region.BODY_CODE) {
return regionBody;
- } else if (areaclass == RegionReference.END) {
+ } else if (areaclass == Region.END_CODE) {
return regionEnd;
- } else if (areaclass == RegionReference.AFTER) {
+ } else if (areaclass == Region.AFTER_CODE) {
return regionAfter;
}
return null;
* ============================================================================
* 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
* (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.area;
import java.util.ArrayList;
import java.util.List;
+import org.apache.fop.fo.pagination.Region;
+
/**
* This is a region reference area for the page regions.
* This area represents a region on the page. It is cloneable
* so the page master can make copies from the original page and regions.
*/
public class RegionReference extends Area implements Cloneable {
- /**
- * The before region.
- */
- public static final int BEFORE = 0;
-
- /**
- * The start region.
- */
- public static final int START = 1;
-
- /**
- * The body region.
- */
- public static final int BODY = 2;
-
- /**
- * The end region.
- */
- public static final int END = 3;
-
- /**
- * The after region.
- */
- public static final int AFTER = 4;
-
- private int regionClass = BEFORE;
+ private int regionClass = Region.BEFORE_CODE;
private CTM ctm;
// the list of block areas from the static flow
private List blocks = new ArrayList();
curPage.setPageNumber(getCurrentPageNumber());
RegionViewport reg = curPage.getPage().getRegion(
- RegionReference.BODY);
+ Region.BODY_CODE);
curBody = (BodyRegion) reg.getRegion();
flowBPD = (int)reg.getViewArea().getHeight();
return curPage;
// Layout static content into the regions
// Need help from pageseq for this
layoutStaticContent(currentSimplePageMaster.getRegion(Region.BEFORE),
- RegionReference.BEFORE);
+ Region.BEFORE_CODE);
layoutStaticContent(currentSimplePageMaster.getRegion(Region.AFTER),
- RegionReference.AFTER);
+ Region.AFTER_CODE);
layoutStaticContent(currentSimplePageMaster.getRegion(Region.START),
- RegionReference.START);
+ Region.START_CODE);
layoutStaticContent(currentSimplePageMaster.getRegion(Region.END),
- RegionReference.END);
+ Region.END_CODE);
// Queue for ID resolution and rendering
areaTree.addPage(curPage);
curPage = null;
curSpan = new Span(numCols);
// get Width or Height as IPD for span
curSpan.setIPD((int) curPage.getPage().getRegion(
- RegionReference.BODY).getViewArea().getWidth());
+ Region.BODY_CODE).getViewArea().getWidth());
//curSpan.setPosition(BPD, newpos);
curBody.getMainReference().addSpan(curSpan);
rvp.setRegion(makeRegionReferenceArea(r, rvp.getViewArea()));
}
page.setRegion(r.getRegionClassCode(), rvp);
- if (r.getRegionClassCode() == RegionReference.BODY) {
+ if (r.getRegionClassCode() == Region.BODY_CODE) {
bHasBody = true;
}
}
import org.apache.fop.area.inline.Character;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.FOTreeControl;
+import org.apache.fop.fo.pagination.Region;
// Avalon
import org.apache.avalon.framework.logger.AbstractLogEnabled;
*/
protected void renderPageAreas(Page page) {
RegionViewport viewport;
- viewport = page.getRegion(RegionReference.BEFORE);
+ viewport = page.getRegion(Region.BEFORE_CODE);
renderRegionViewport(viewport);
- viewport = page.getRegion(RegionReference.START);
+ viewport = page.getRegion(Region.START_CODE);
renderRegionViewport(viewport);
- viewport = page.getRegion(RegionReference.BODY);
+ viewport = page.getRegion(Region.BODY_CODE);
renderRegionViewport(viewport);
- viewport = page.getRegion(RegionReference.END);
+ viewport = page.getRegion(Region.END_CODE);
renderRegionViewport(viewport);
- viewport = page.getRegion(RegionReference.AFTER);
+ viewport = page.getRegion(Region.AFTER_CODE);
renderRegionViewport(viewport);
}
// do after starting viewport area
handleViewportTraits(port);
- if (region.getRegionClass() == RegionReference.BODY) {
+ if (region.getRegionClass() == Region.BODY_CODE) {
renderBodyRegion((BodyRegion) region);
} else {
renderRegion(region);
import org.apache.fop.area.inline.Word;
import org.apache.fop.fo.properties.RuleStyle;
import org.apache.fop.fo.FOTreeControl;
+import org.apache.fop.fo.pagination.Region;
/**
* Renderer that renders areas to XML for debugging purposes.
writeStartTag("<regionViewport rect=\""
+ createString(port.getViewArea()) + "\">");
RegionReference region = port.getRegion();
- if (region.getRegionClass() == RegionReference.BEFORE) {
+ if (region.getRegionClass() == Region.BEFORE_CODE) {
writeStartTag("<regionBefore>");
renderRegion(region);
writeEndTag("</regionBefore>");
- } else if (region.getRegionClass() == RegionReference.START) {
+ } else if (region.getRegionClass() == Region.START_CODE) {
writeStartTag("<regionStart>");
renderRegion(region);
writeEndTag("</regionStart>");
- } else if (region.getRegionClass() == RegionReference.BODY) {
+ } else if (region.getRegionClass() == Region.BODY_CODE) {
writeStartTag("<regionBody>");
renderBodyRegion((BodyRegion) region);
writeEndTag("</regionBody>");
- } else if (region.getRegionClass() == RegionReference.END) {
+ } else if (region.getRegionClass() == Region.END_CODE) {
writeStartTag("<regionEnd>");
renderRegion(region);
writeEndTag("</regionEnd>");
- } else if (region.getRegionClass() == RegionReference.AFTER) {
+ } else if (region.getRegionClass() == Region.AFTER_CODE) {
writeStartTag("<regionAfter>");
renderRegion(region);
writeEndTag("</regionAfter>");
import org.apache.fop.render.svg.SVGRenderer;
import org.apache.fop.render.xml.XMLRenderer;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.properties.RuleStyle;
import org.apache.fop.fonts.FontMetrics;
for (int i = 0; i < childs.getLength(); i++) {
Node obj = childs.item(i);
if (obj.getNodeName().equals("regionBefore")) {
- reg.setRegion(readRegion((Element) obj, RegionReference.BEFORE));
- page.setRegion(RegionReference.BEFORE, reg);
+ reg.setRegion(readRegion((Element) obj, Region.BEFORE_CODE));
+ page.setRegion(Region.BEFORE_CODE, reg);
} else if (obj.getNodeName().equals("regionStart")) {
- reg.setRegion(readRegion((Element) obj, RegionReference.START));
- page.setRegion(RegionReference.START, reg);
+ reg.setRegion(readRegion((Element) obj, Region.START_CODE));
+ page.setRegion(Region.START_CODE, reg);
} else if (obj.getNodeName().equals("regionBody")) {
- reg.setRegion(readRegion((Element) obj, RegionReference.BODY));
- page.setRegion(RegionReference.BODY, reg);
+ reg.setRegion(readRegion((Element) obj, Region.BODY_CODE));
+ page.setRegion(Region.BODY_CODE, reg);
} else if (obj.getNodeName().equals("regionEnd")) {
- reg.setRegion(readRegion((Element) obj, RegionReference.END));
- page.setRegion(RegionReference.END, reg);
+ reg.setRegion(readRegion((Element) obj, Region.END_CODE));
+ page.setRegion(Region.END_CODE, reg);
} else if (obj.getNodeName().equals("regionAfter")) {
- reg.setRegion(readRegion((Element) obj, RegionReference.AFTER));
- page.setRegion(RegionReference.AFTER, reg);
+ reg.setRegion(readRegion((Element) obj, Region.AFTER_CODE));
+ page.setRegion(Region.AFTER_CODE, reg);
}
}
public RegionReference readRegion(Element root, int type) {
RegionReference reg;
- if (type == RegionReference.BODY) {
+ if (type == Region.BODY_CODE) {
BodyRegion br = new BodyRegion();
NodeList childs = root.getChildNodes();
for (int i = 0; i < childs.getLength(); i++) {