pbwest 2004/02/23 23:54:00 Added: src/java/org/apache/fop/area Tag: FOP_0-20-0_Alt-Design Resolveable.java RegionStartVport.java Viewport.java RegionEndVport.java RegionStartRefArea.java CoordTransformer.java RegionBeforeVport.java MainReferenceArea.java Span.java RegionRefArea.java RegionAfterVport.java RegionBodyVport.java PageRefArea.java PageViewport.java RegionBodyRefArea.java RegionEndRefArea.java RegionAfterRefArea.java RegionViewport.java RegionBeforeRefArea.java AbstractReferenceArea.java Log: More stubs for area processing. Revision Changes Path No revision No revision 1.1.2.1 +0 -0 xml-fop/src/java/org/apache/fop/area/Resolveable.java Index: Resolveable.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Resolveable.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 1.1.2.1 +42 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionStartVport.java 1.1.2.1 +28 -0 xml-fop/src/java/org/apache/fop/area/Attic/Viewport.java 1.1.2.1 +42 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionEndVport.java 1.1.2.1 +41 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionStartRefArea.java 1.1.2.1 +333 -0 xml-fop/src/java/org/apache/fop/area/Attic/CoordTransformer.java 1.1.2.1 +42 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionBeforeVport.java 1.1.2.1 +86 -0 xml-fop/src/java/org/apache/fop/area/Attic/MainReferenceArea.java 1.1.2.1 +29 -83 xml-fop/src/java/org/apache/fop/area/Span.java Index: Span.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Span.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -r1.1 -r1.1.2.1 --- Span.java 11 Mar 2003 13:05:27 -0000 1.1 +++ Span.java 24 Feb 2004 07:54:00 -0000 1.1.2.1 @@ -1,83 +1,48 @@ /* + Copyright 1999-2004 The Apache Software Foundation. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + * $Id$ - * ============================================================================ - * 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 - * [EMAIL PROTECTED] - * - * 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 <[EMAIL PROTECTED]>. 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.List; +import org.apache.fop.datastructs.Node; + /** - * The span reference area. + * The span reference areas are children of the main-reference-area + * of a region-body. * This is a reference area block area with 0 border and padding - * The span reference areas are stacked inside the main reference area. */ -public class Span extends Area { +public class Span +extends AbstractReferenceArea +implements ReferenceArea, Serializable { // the list of flow reference areas in this span area private List flowAreas; - private int height; + + private Integer cols; /** * Create a span area with the number of columns for this span area. * * @param cols the number of columns in the span */ - public Span(int cols) { - flowAreas = new java.util.ArrayList(cols); - } - - /** - * Add the flow area to this span area. - * - * @param flow the flow area to add - */ - public void addFlow(Flow flow) { - flowAreas.add(flow); + public Span(Node parent, Object sync, Integer cols) { + super(parent, sync); + this.cols = cols; } /** @@ -85,27 +50,8 @@ * * @return the number of columns in this span area */ - public int getColumnCount() { - return flowAreas.size(); - } - - /** - * Get the height of this span area. - * - * @return the height of this span area - */ - public int getHeight() { - return height; - } - - /** - * Get the flow area for a particular column. - * - * @param count the column number for the flow - * @return the flow area for the requested column - */ - public Flow getFlow(int count) { - return (Flow) flowAreas.get(count); + public Integer getColumnCount() { + return cols; } } 1.1.2.1 +67 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionRefArea.java 1.1.2.1 +42 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionAfterVport.java 1.1.2.1 +42 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionBodyVport.java 1.1.2.1 +204 -0 xml-fop/src/java/org/apache/fop/area/Attic/PageRefArea.java 1.2.2.1 +62 -80 xml-fop/src/java/org/apache/fop/area/PageViewport.java Index: PageViewport.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/PageViewport.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- PageViewport.java 17 Jan 2004 19:29:45 -0000 1.2 +++ PageViewport.java 24 Feb 2004 07:54:00 -0000 1.2.2.1 @@ -1,52 +1,19 @@ /* + * Copyright 1999-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * * $Id$ - * ============================================================================ - * 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 - * [EMAIL PROTECTED] - * - * 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 <[EMAIL PROTECTED]>. For more information on the Apache - * Software Foundation, please see <http://www.apache.org/>. */ package org.apache.fop.area; @@ -59,19 +26,23 @@ import java.util.HashMap; import java.util.Iterator; -import org.apache.fop.fo.Constants; +import org.apache.fop.datastructs.Node; +import org.apache.fop.fo.properties.RetrievePosition; /** - * Page viewport that specifies the viewport area and holds the page contents. + * Page viewport that specifies the viewport area. * This is the top level object for a page and remains valid for the life * of the document and the area tree. * This object may be used as a key to reference a page. - * This is the level that creates the page. - * The page (reference area) is then rendered inside the page object + * The immediate and only child of any viewport is a reference-area; in this + * cast the page-reference-area. + * The page reference area is then rendered inside the PageRefArea object */ -public class PageViewport implements Resolveable, Cloneable { +public class PageViewport +extends Area +implements Viewport, Resolveable, Cloneable { - private Page page; + private PageRefArea pageRefArea; private Rectangle2D viewArea; private boolean clip = false; private String pageNumber = null; @@ -99,12 +70,23 @@ * @param p the page reference area that holds the contents * @param bounds the bounds of this viewport */ - public PageViewport(Page p, Rectangle2D bounds) { - page = p; + public PageViewport( + Node parent, Object areaSync, PageRefArea p, Rectangle2D bounds) { + super(parent, areaSync); + pageRefArea = p; viewArea = bounds; } /** + * Create a page viewport. + */ + public PageViewport(Node parent, Object areaSync) { + super(parent, areaSync); + pageRefArea = null; + viewArea = null; + } + + /** * Set if this viewport should clip. * @param c true if this viewport should clip */ @@ -124,8 +106,8 @@ * Get the page reference area with the contents. * @return the page reference area */ - public Page getPage() { - return page; + public PageRefArea getPageRefArea() { + return pageRefArea; } /** @@ -159,7 +141,7 @@ * Add an unresolved id to this page. * All unresolved ids for the contents of this page are * added to this page. This is so that the resolvers can be - * serialized with the page to preserve the proper function. + * serialized with the pageRefArea to preserve the proper function. * @param id the id of the reference * @param res the resolver of the reference */ @@ -199,7 +181,7 @@ * may be null if not found */ public void resolve(String id, List pages) { - if (page == null) { + if (pageRefArea == null) { if (pendingResolved == null) { pendingResolved = new HashMap(); } @@ -236,7 +218,7 @@ * For "last-ending-within-page" it adds all markers that * are ending, replacing earlier markers. * - * Should this logic be placed in the Page layout manager. + * Should this logic be placed in the page layout manager. * * @param marks the map of markers to add * @param start if the area being added is starting or ending @@ -307,7 +289,7 @@ public Object getMarker(String name, int pos) { Object mark = null; switch (pos) { - case Constants.RetrievePosition.FSWP: + case RetrievePosition.FIRST_STARTING_WITHIN_PAGE: if (markerFirstStart != null) { mark = markerFirstStart.get(name); } @@ -315,12 +297,12 @@ mark = markerFirstAny.get(name); } break; - case Constants.RetrievePosition.FIC: + case RetrievePosition.FIRST_INCLUDING_CARRYOVER: if (markerFirstAny != null) { mark = markerFirstAny.get(name); } break; - case Constants.RetrievePosition.LSWP: + case RetrievePosition.LAST_STARTING_WITHIN_PAGE: if (markerLastStart != null) { mark = markerLastStart.get(name); } @@ -328,7 +310,7 @@ mark = markerLastAny.get(name); } break; - case Constants.RetrievePosition.LEWP: + case RetrievePosition.LAST_ENDING_WITHIN_PAGE: if (markerLastEnd != null) { mark = markerLastEnd.get(name); } @@ -341,30 +323,30 @@ } /** - * Save the page contents to an object stream. - * The map of unresolved references are set on the page so that + * Save the viewport pageRefArea to an object stream. + * The map of unresolved references are set on the pageRefArea so that * the resolvers can be properly serialized and reloaded. * @param out the object output stream to write the contents - * @throws Exception if there is a problem saving the page + * @throws Exception if there is a problem saving the pageRefArea */ public void savePage(ObjectOutputStream out) throws Exception { // set the unresolved references so they are serialized - page.setUnresolvedReferences(unresolved); - out.writeObject(page); - page = null; + pageRefArea.setUnresolvedReferences(unresolved); + out.writeObject(pageRefArea); + pageRefArea = null; } /** - * Load the page contents from an object stream. - * This loads the page contents from the stream and + * Load the viewport pageRefArea from an object stream. + * This loads the pageRefArea from the stream and * if there are any unresolved references that were resolved * while saved they will be resolved on the page contents. - * @param in the object input stream to read the page from - * @throws Exception if there is an error loading the page + * @param in the object input stream to read the pageRefArea from + * @throws Exception if there is an error loading the pageRefArea */ public void loadPage(ObjectInputStream in) throws Exception { - page = (Page) in.readObject(); - unresolved = page.getUnresolvedReferences(); + pageRefArea = (PageRefArea) in.readObject(); + unresolved = pageRefArea.getUnresolvedReferences(); if (unresolved != null && pendingResolved != null) { for (Iterator iter = pendingResolved.keySet().iterator(); iter.hasNext();) { @@ -381,18 +363,18 @@ * @return a copy of this page and associated viewports */ public Object clone() { - Page p = (Page)page.clone(); - PageViewport ret = new PageViewport(p, (Rectangle2D)viewArea.clone()); + PageRefArea p = (PageRefArea)pageRefArea.clone(); + PageViewport ret = new PageViewport(parent, sync, p, (Rectangle2D)viewArea.clone()); return ret; } /** - * Clear the page contents to save memory. + * Clear the pageRefArea contents to save memory. * This object is kept for the life of the area tree since * it holds id and marker information and is used as a key. */ public void clear() { - page = null; + pageRefArea = null; } /** 1.1.2.1 +175 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionBodyRefArea.java 1.1.2.1 +39 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionEndRefArea.java 1.1.2.1 +41 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionAfterRefArea.java 1.3.2.1 +77 -73 xml-fop/src/java/org/apache/fop/area/RegionViewport.java Index: RegionViewport.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/RegionViewport.java,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -u -r1.3 -r1.3.2.1 --- RegionViewport.java 2 Nov 2003 16:20:16 -0000 1.3 +++ RegionViewport.java 24 Feb 2004 07:54:00 -0000 1.3.2.1 @@ -52,17 +52,15 @@ import java.awt.geom.Rectangle2D; import java.io.IOException; -import java.util.HashMap; - -import org.apache.fop.traits.BorderProps; +import org.apache.fop.datastructs.Node; /** * Region Viewport reference area. * This area is the viewport for a region and contains a region area. */ -public class RegionViewport extends Area implements Cloneable { +public class RegionViewport extends Area implements Viewport, Cloneable { // this rectangle is relative to the page - private RegionReference region; + private RegionRefArea region; private Rectangle2D viewArea; private boolean clip = false; @@ -71,7 +69,8 @@ * * @param viewArea the view area of this viewport */ - public RegionViewport(Rectangle2D viewArea) { + public RegionViewport(Node parent, Object sync, Rectangle2D viewArea) { + super(parent, sync); this.viewArea = viewArea; } @@ -80,7 +79,7 @@ * * @param reg the child region inside this viewport */ - public void setRegion(RegionReference reg) { + public void setRegion(RegionRefArea reg) { region = reg; } @@ -89,7 +88,7 @@ * * @return the child region inside this viewport */ - public RegionReference getRegion() { + public RegionRefArea getRegion() { return region; } @@ -116,82 +115,86 @@ * * @return width in millipoints */ - public int getBorderAndPaddingWidthBefore() { - int margin = 0; - BorderProps bps = (BorderProps) getTrait(Trait.BORDER_BEFORE); - if (bps != null) { - margin = bps.width; - } - - Integer padWidth = (Integer) getTrait(Trait.PADDING_BEFORE); - if (padWidth != null) { - margin += padWidth.intValue(); - } - - return margin; - } +// public int getBorderAndPaddingWidthBefore() { +// int margin = 0; +// BorderProps bps = (BorderProps) getTrait(Trait.BORDER_BEFORE); +// if (bps != null) { +// margin = bps.width; +// } +// +// Integer padWidth = (Integer) getTrait(Trait.PADDING_BEFORE); +// if (padWidth != null) { +// margin += padWidth.intValue(); +// } +// +// return margin; +// } /** * Return the sum of region border- and padding-after * * @return width in millipoints */ - public int getBorderAndPaddingWidthAfter() { - int margin = 0; - - BorderProps bps = (BorderProps) getTrait(Trait.BORDER_AFTER); - if (bps != null) { - margin = bps.width; - } - - Integer padWidth = (Integer) getTrait(Trait.PADDING_AFTER); - if (padWidth != null) { - margin += padWidth.intValue(); - } - - return margin; - } +// public int getBorderAndPaddingWidthAfter() { +// int margin = 0; +// +// BorderProps bps = (BorderProps) getTrait(Trait.BORDER_AFTER); +// if (bps != null) { +// margin = bps.width; +// } +// +// Integer padWidth = (Integer) getTrait(Trait.PADDING_AFTER); +// if (padWidth != null) { +// margin += padWidth.intValue(); +// } +// +// return margin; +// } /** * Return the sum of region border- and padding-start * * @return width in millipoints */ - public int getBorderAndPaddingWidthStart() { - int margin = 0; - BorderProps bps = (BorderProps) getTrait(Trait.BORDER_START); - if (bps != null) { - margin = bps.width; - } - - Integer padWidth = (Integer) getTrait(Trait.PADDING_START); - if (padWidth != null) { - margin += padWidth.intValue(); - } - - return margin; - } +// public int getBorderAndPaddingWidthStart() { +// int margin = 0; +// BorderProps bps = (BorderProps) getTrait(Trait.BORDER_START); +// if (bps != null) { +// margin = bps.width; +// } +// +// Integer padWidth = (Integer) getTrait(Trait.PADDING_START); +// if (padWidth != null) { +// margin += padWidth.intValue(); +// } +// +// return margin; +// } /** * Return the sum of region border- and padding-end * * @return width in millipoints */ - public int getBorderAndPaddingWidthEnd() { - int margin = 0; - BorderProps bps = (BorderProps) getTrait(Trait.BORDER_END); - if (bps != null) { - margin = bps.width; - } - - Integer padWidth = (Integer) getTrait(Trait.PADDING_END); - if (padWidth != null) { - margin += padWidth.intValue(); - } - - return margin; - } +// public int getBorderAndPaddingWidthEnd() { +// int margin = 0; +// BorderProps bps = (BorderProps) getTrait(Trait.BORDER_END); +// if (bps != null) { +// margin = bps.width; +// } +// +// Integer padWidth = (Integer) getTrait(Trait.PADDING_END); +// if (padWidth != null) { +// margin += padWidth.intValue(); +// } +// +// return margin; +// } + /** + * @param out + * @throws IOException + */ private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.writeFloat((float) viewArea.getX()); @@ -199,7 +202,7 @@ out.writeFloat((float) viewArea.getWidth()); out.writeFloat((float) viewArea.getHeight()); out.writeBoolean(clip); - out.writeObject(props); + //out.writeObject(props); out.writeObject(region); } @@ -208,8 +211,8 @@ viewArea = new Rectangle2D.Float(in.readFloat(), in.readFloat(), in.readFloat(), in.readFloat()); clip = in.readBoolean(); - props = (HashMap)in.readObject(); - setRegion((RegionReference) in.readObject()); + //props = (HashMap)in.readObject(); + setRegion((RegionRefArea) in.readObject()); } /** @@ -219,11 +222,12 @@ * @return a new copy of this region viewport */ public Object clone() { - RegionViewport rv = new RegionViewport((Rectangle2D)viewArea.clone()); - rv.region = (RegionReference)region.clone(); - if (props != null) { - rv.props = (HashMap)props.clone(); - } + RegionViewport rv = + new RegionViewport(parent, sync, (Rectangle2D)viewArea.clone()); + rv.region = (RegionRefArea)region.clone(); +// if (props != null) { +// rv.props = (HashMap)props.clone(); +// } return rv; } } 1.1.2.1 +41 -0 xml-fop/src/java/org/apache/fop/area/Attic/RegionBeforeRefArea.java 1.1.2.1 +97 -0 xml-fop/src/java/org/apache/fop/area/Attic/AbstractReferenceArea.java
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]