]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
remove region code from /area/RegionReference in favor of those in fo/pagination...
authorWilliam Victor Mote <vmote@apache.org>
Wed, 27 Aug 2003 18:14:46 +0000 (18:14 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Wed, 27 Aug 2003 18:14:46 +0000 (18:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196864 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/area/BodyRegion.java
src/java/org/apache/fop/area/Page.java
src/java/org/apache/fop/area/RegionReference.java
src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
src/java/org/apache/fop/render/AbstractRenderer.java
src/java/org/apache/fop/render/xml/XMLRenderer.java
src/java/org/apache/fop/tools/AreaTreeBuilder.java

index 1db0ed1144fcf47d7cb4d8414e0fed45e1778e64..e6116bf79f5570f58796a438a929d9ce79e3e9a3 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    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
@@ -70,7 +72,7 @@ public class BodyRegion extends RegionReference {
      * This sets the region reference area class to BODY.
      */
     public BodyRegion() {
-        super(BODY);
+        super(Region.BODY_CODE);
     }
 
     /**
@@ -161,7 +163,7 @@ public class BodyRegion extends RegionReference {
      * 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());
index 857a2578ef5d0b316a9676a56b6daf1a6ab6b7ff..f5cda397f529280aee606a6255f656e6a904aed7 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    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.
@@ -82,15 +84,15 @@ public class Page implements Serializable, Cloneable {
      * @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;
         }
     }
@@ -102,15 +104,15 @@ public class Page implements Serializable, Cloneable {
      * @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;
index f83e8ded08f922d8302e7b1df1616d3a29893b16..cadf27846639d373cd76896e654270abe98bd2ff 100644 (file)
@@ -3,34 +3,34 @@
  * ============================================================================
  *                    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();
index b7cc1cd52a3c2826ec87ad528afb5f9207cd057a..4c9514116eb54915902d7120ec05589b001c347c 100644 (file)
@@ -460,7 +460,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
 
         curPage.setPageNumber(getCurrentPageNumber());
         RegionViewport reg = curPage.getPage().getRegion(
-                    RegionReference.BODY);
+                    Region.BODY_CODE);
         curBody = (BodyRegion) reg.getRegion();
         flowBPD = (int)reg.getViewArea().getHeight();
         return curPage;
@@ -508,13 +508,13 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
             // 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;
@@ -699,7 +699,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
         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);
@@ -792,7 +792,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
                rvp.setRegion(makeRegionReferenceArea(r, rvp.getViewArea()));
            }
            page.setRegion(r.getRegionClassCode(), rvp);
-           if (r.getRegionClassCode() == RegionReference.BODY) {
+           if (r.getRegionClassCode() == Region.BODY_CODE) {
                bHasBody = true;
            }
        }
index 38f0844bd97ddeb26d14bd0937584530c718bf62..c9d756923d1404ac47a98159d8571fc07c05a51a 100644 (file)
@@ -89,6 +89,7 @@ import org.apache.fop.area.inline.Word;
 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;
@@ -272,15 +273,15 @@ public abstract class AbstractRenderer extends 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);
     }
 
@@ -308,7 +309,7 @@ public abstract class AbstractRenderer extends AbstractLogEnabled
 
             // do after starting viewport area
             handleViewportTraits(port);
-            if (region.getRegionClass() == RegionReference.BODY) {
+            if (region.getRegionClass() == Region.BODY_CODE) {
                 renderBodyRegion((BodyRegion) region);
             } else {
                 renderRegion(region);
index af896b9a47f200f1eca1b4f6c42988eec73c16cf..2637bc406eb7da2cc4f473f06d6e913961c2e085 100644 (file)
@@ -94,6 +94,7 @@ import org.apache.fop.area.inline.Viewport;
 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.
@@ -288,23 +289,23 @@ public class XMLRenderer extends AbstractRenderer {
             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>");
index 0131e61a8b7693447bebc38454abf6c6214deaf2..2f4eafc39c2ee2f02640e00c0b4bb8164482afe7 100644 (file)
@@ -107,6 +107,7 @@ import org.apache.fop.render.pdf.PDFRenderer;
 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;
 
@@ -381,20 +382,20 @@ class TreeLoader extends AbstractLogEnabled {
         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);
             }
         }
 
@@ -403,7 +404,7 @@ class TreeLoader extends AbstractLogEnabled {
 
     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++) {