diff options
author | Jeremias Maerki <jeremias@apache.org> | 2003-03-11 13:25:33 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2003-03-11 13:25:33 +0000 |
commit | 77930a96151d680333f3c11b8dcb5f7c9b6761e7 (patch) | |
tree | 2bd2afef42926ee98914666ef27ae08ef0c98edd /src/org/apache/fop/area | |
parent | b7052c02f1a0da7b6d2c04a799e947e8f9227d81 (diff) | |
download | xmlgraphics-fop-77930a96151d680333f3c11b8dcb5f7c9b6761e7.tar.gz xmlgraphics-fop-77930a96151d680333f3c11b8dcb5f7c9b6761e7.zip |
Moved sources from src/org/** to src/java/org/**
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196064 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/area')
39 files changed, 0 insertions, 5793 deletions
diff --git a/src/org/apache/fop/area/Area.java b/src/org/apache/fop/area/Area.java deleted file mode 100644 index e2aa457c7..000000000 --- a/src/org/apache/fop/area/Area.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * $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 - * 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.area; - -import java.io.Serializable; - -import java.util.Map; -import java.util.HashMap; - -// If the area appears more than once in the output -// or if the area has external data it is cached -// to keep track of it and to minimize rendered output -// renderers can render the output once and display it -// for every occurence -// this should also extend to all outputs (including PDFGraphics2D) -// and all types of renderers - -/** - * Base object for all areas. - */ -public class Area implements Serializable { - // stacking directions - /** - * Stacking left to right - */ - public static final int LR = 0; - - /** - * Stacking right to left - */ - public static final int RL = 1; - - /** - * Stacking top to bottom - */ - public static final int TB = 2; - - /** - * Stacking bottom to top - */ - public static final int BT = 3; - - // orientations for reference areas - /** - * Normal orientation - */ - public static final int ORIENT_0 = 0; - - /** - * Rotated 90 degrees clockwise - */ - public static final int ORIENT_90 = 1; - - /** - * Rotate 180 degrees - */ - public static final int ORIENT_180 = 2; - - /** - * Rotated 270 degrees clockwise - */ - public static final int ORIENT_270 = 3; - - // area class values - - /** - * Normal class - */ - public static final int CLASS_NORMAL = 0; - - /** - * Fixed position class - */ - public static final int CLASS_FIXED = 1; - - /** - * Absolute position class - */ - public static final int CLASS_ABSOLUTE = 2; - - /** - * Before float class - */ - public static final int CLASS_BEFORE_FLOAT = 3; - - /** - * Footnote class - */ - public static final int CLASS_FOOTNOTE = 4; - - /** - * Side float class - */ - public static final int CLASS_SIDE_FLOAT = 5; - - // IMPORTANT: make sure this is the maximum + 1 - /** - * Maximum class count - */ - public static final int CLASS_MAX = CLASS_SIDE_FLOAT + 1; - - private int areaClass = CLASS_NORMAL; - private int ipd; - - /** - * Traits for this area stored in a HashMap - */ - protected HashMap props = null; - - /** - * Get the area class of this area. - * - * @return the area class - */ - public int getAreaClass() { - return areaClass; - } - - /** - * Set the area class of this area. - * - * @param areaClass the area class - */ - public void setAreaClass(int areaClass) { - this.areaClass = areaClass; - } - - /** - * Set the inline progression dimension of this area. - * - * @param i the new inline progression dimension - */ - public void setIPD(int i) { - ipd = i; - } - - /** - * Get the inline progression dimension of this area. - * - * @return the inline progression dimension - */ - public int getIPD() { - return ipd; - } - - /** - * Add a child to this area. - * The default is to do nothing. Subclasses must override - * to do something if they can have child areas. - * - * @param child the child area to add - */ - public void addChild(Area child) { - } - - /** - * Add a trait property to this area. - * - * @param prop the Trait to add - */ - public void addTrait(Trait prop) { - if (props == null) { - props = new java.util.HashMap(20); - } - props.put(prop.getPropType(), prop.getData()); - } - - /** - * Add a trait to this area. - * - * @param traitCode the trait key - * @param prop the value of the trait - */ - public void addTrait(Object traitCode, Object prop) { - if (props == null) { - props = new java.util.HashMap(20); - } - props.put(traitCode, prop); - } - - /** - * Get the map of all traits on this area. - * - * @return the map of traits - */ - public Map getTraits() { - return this.props; - } - - /** - * Get a trait from this area. - * - * @param oTraitCode the trait key - * @return the trait value - */ - public Object getTrait(Object oTraitCode) { - return (props != null ? props.get(oTraitCode) : null); - } - - /** - * Get a trait from this area as an integer. - * - * @param oTraitCode the trait key - * @return the trait value - */ - public int getTraitAsInteger(Object oTraitCode) { - final Object obj = getTrait(oTraitCode); - if (obj instanceof Integer) { - return ((Integer)obj).intValue(); - } else { - throw new IllegalArgumentException("Trait " - + oTraitCode.getClass().getName() - + " could not be converted to an integer"); - } - } -} - diff --git a/src/org/apache/fop/area/AreaTree.java b/src/org/apache/fop/area/AreaTree.java deleted file mode 100644 index 722a8b482..000000000 --- a/src/org/apache/fop/area/AreaTree.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * $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 - * 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.area; - -import org.apache.fop.render.Renderer; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.util.Set; -import java.util.HashSet; -import java.util.Iterator; - -/** - * Area tree for formatting objects. - * - * Concepts: - * The area tree is to be as small as possible. With minimal classes - * and data to fully represent an area tree for formatting objects. - * The area tree needs to be simple to render and follow the spec - * closely. - * This area tree has the concept of page sequences. - * Where ever possible information is discarded or optimised to - * keep memory use low. The data is also organised to make it - * possible for renderers to minimise their output. - * A page can be saved if not fully resolved and once rendered - * a page contains only size and id reference information. - * The area tree pages are organised in a model that depends on the - * type of renderer. - */ -public class AreaTree { - // allows for different models to deal with adding/rendering - // in different situations - private AreaTreeModel model; - - // hashmap of arraylists containing pages with id area - private Map idLocations = new HashMap(); - // list of id's yet to be resolved and arraylists of pages - private Map resolve = new HashMap(); - private List treeExtensions = new ArrayList(); - - /** - * Create a render pages area tree model. - * @param rend the renderer that will be used - * @return RenderPagesModel the new area tree model - */ - public static RenderPagesModel createRenderPagesModel(Renderer rend) { - return new RenderPagesModel(rend); - } - - /** - * Create a new store pages model. - * @return StorePagesModel the new model - */ - public static StorePagesModel createStorePagesModel() { - return new StorePagesModel(); - } - - /** - * Set the tree model to use for this area tree. - * The different models can have different behaviour - * when pages area added and other changes. - * @param m the area tree model - */ - public void setTreeModel(AreaTreeModel m) { - model = m; - } - - /** - * Get the area tree model for this area tree. - * - * @return AreaTreeModel the model being used for this area tree - */ - public AreaTreeModel getAreaTreeModel() { - return model; - } - - /** - * Start a new page sequence. - * This signals that a new page sequence has started in the document. - * @param title the title of the new page sequence or null if no title - */ - public void startPageSequence(Title title) { - model.startPageSequence(title); - } - - /** - * Add a new page to the area tree. - * @param page the page to add - */ - public void addPage(PageViewport page) { - model.addPage(page); - } - - /** - * Add an id reference pointing to a page viewport. - * @param id the id of the reference - * @param pv the page viewport that contains the id reference - */ - public void addIDRef(String id, PageViewport pv) { - List list = (List)idLocations.get(id); - if (list == null) { - list = new ArrayList(); - idLocations.put(id, list); - } - list.add(pv); - - Set todo = (Set)resolve.get(id); - if (todo != null) { - for (Iterator iter = todo.iterator(); iter.hasNext();) { - Resolveable res = (Resolveable)iter.next(); - res.resolve(id, list); - } - resolve.remove(id); - } - } - - /** - * Get the list of id references for an id. - * @param id the id to lookup - * @return the list of id references. - */ - public List getIDReferences(String id) { - return (List)idLocations.get(id); - } - - /** - * Add an unresolved object with a given id. - * @param id the id reference that needs resolving - * @param res the Resolveable object to resolve - */ - public void addUnresolvedID(String id, Resolveable res) { - Set todo = (Set)resolve.get(id); - if (todo == null) { - todo = new HashSet(); - resolve.put(id, todo); - } - todo.add(res); - } - - /** - * Add a tree extension. - * This checks if the extension is resolveable and attempts - * to resolve or add the resolveable ids for later resolution. - * @param ext the tree extension to add. - */ - public void addTreeExtension(TreeExt ext) { - treeExtensions.add(ext); - if (ext.isResolveable()) { - Resolveable res = (Resolveable)ext; - String[] ids = res.getIDs(); - for (int count = 0; count < ids.length; count++) { - if (idLocations.containsKey(ids[count])) { - res.resolve(ids[count], (List)idLocations.get(ids[count])); - } else { - Set todo = (Set)resolve.get(ids[count]); - if (todo == null) { - todo = new HashSet(); - resolve.put(ids[count], todo); - } - todo.add(ext); - } - } - } else { - handleTreeExtension(ext, TreeExt.IMMEDIATELY); - } - } - - /** - * Handle a tree extension. - * This sends the extension to the model for handling. - * @param ext the tree extension to handle - * @param when when the extension should be handled by the model - */ - public void handleTreeExtension(TreeExt ext, int when) { - // queue tree extension according to the when - model.addExtension(ext, when); - } - - /** - * Signal end of document. - * This indicates that the document is complete and any unresolved - * reference can be dealt with. - */ - public void endDocument() { - for (Iterator iter = resolve.keySet().iterator(); iter.hasNext();) { - String id = (String)iter.next(); - Set list = (Set)resolve.get(id); - for (Iterator resIter = list.iterator(); resIter.hasNext();) { - Resolveable res = (Resolveable)resIter.next(); - if (!res.isResolved()) { - res.resolve(id, null); - } - } - } - model.endDocument(); - } -} - diff --git a/src/org/apache/fop/area/AreaTreeModel.java b/src/org/apache/fop/area/AreaTreeModel.java deleted file mode 100644 index dabfc531a..000000000 --- a/src/org/apache/fop/area/AreaTreeModel.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * $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 - * 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.area; - -/** - * This is the model for the area tree object. - * The model implementation can handle the page sequence, - * page and extensions. - * The mathods to acces the page viewports can only - * assume the PageViewport is valid as it remains for - * the life of the area tree model. - */ -public abstract class AreaTreeModel { - /** - * Start a page sequence on this model. - * @param title the title of the new page sequence - */ - public abstract void startPageSequence(Title title); - - /** - * Add a page to this moel. - * @param page the page to add to the model. - */ - public abstract void addPage(PageViewport page); - - /** - * Add an extension to this model. - * @param ext the extension to add - * @param when when the extension should be handled - */ - public abstract void addExtension(TreeExt ext, int when); - - /** - * Signal the end of the document for any processing. - */ - public abstract void endDocument(); - - /** - * Get the page sequence count. - * @return the number of page sequences in the document. - */ - public abstract int getPageSequenceCount(); - - /** - * Get the title for a page sequence. - * @param count the page sequence count - * @return the title of the page sequence - */ - public abstract Title getTitle(int count); - - /** - * Get the page count. - * @param seq the page sequence to count. - * @return returns the number of pages in a page sequence - */ - public abstract int getPageCount(int seq); - - /** - * Get the page for a position in the document. - * @param seq the page sequence number - * @param count the page count in the sequence - * @return the PageViewport for the particular page - */ - public abstract PageViewport getPage(int seq, int count); - -} diff --git a/src/org/apache/fop/area/BeforeFloat.java b/src/org/apache/fop/area/BeforeFloat.java deleted file mode 100644 index 10832791e..000000000 --- a/src/org/apache/fop/area/BeforeFloat.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * $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 - * 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.area; - -/** - * The before float area. - * This is used to place the before float areas. - * It has an optional separator and before float block children. - */ -public class BeforeFloat extends BlockParent { - // this is an optional block area that will be rendered - // as the separator only if there are float areas - private Block separator = null; - - /** - * Set the separator area for this before float. - * - * @param sep the before float separator area - */ - public void setSeparator(Block sep) { - separator = sep; - } - - /** - * Get the separator area for this before float. - * - * @return the before float separator area - */ - public Block getSeparator() { - return separator; - } - - /** - * Get the height of this before float. - * It gets the height of the children and if there is a - * separator its height is also added. - * - * @return the height of the before float including separator - */ - public int getHeight() { - int h = super.getHeight(); - if (separator != null) { - h += separator.getHeight(); - } - return h; - } - -} - diff --git a/src/org/apache/fop/area/Block.java b/src/org/apache/fop/area/Block.java deleted file mode 100644 index 7af15e628..000000000 --- a/src/org/apache/fop/area/Block.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * $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 - * 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.area; - -import java.util.ArrayList; - -// block areas hold either more block areas or line -// areas can also be used as a block spacer -// a block area may have children positioned by stacking -// or by relative to the parent for floats, tables and lists -// cacheable object -// has id information - -/** - * This is the block area class. - * It holds child block areas such as other blocks or lines. - */ -public class Block extends BlockParent { - /** - * Normally stacked with other blocks. - */ - public static final int STACK = 0; - - /** - * Placed relative to the flow position. - * This effects the flow placement of stacking normally. - */ - public static final int RELATIVE = 1; - - /** - * Relative to the block parent but not effecting the stacking - * Used for block-container, tables and lists. - */ - public static final int ABSOLUTE = 2; - - private int stacking = TB; - private int positioning = STACK; - - // a block with may contain the dominant styling info in - // terms of most lines or blocks with info - - /** - * Add the block to this block area. - * - * @param block the block area to add - */ - public void addBlock(Block block) { - if (children == null) { - children = new ArrayList(); - } - height += block.getHeight(); - children.add(block); - } - - /** - * Add the line area to this block area. - * - * @param line the line area to add - */ - public void addLineArea(LineArea line) { - if (children == null) { - children = new ArrayList(); - } - height += line.getHeight(); - children.add(line); - } - - /** - * Set the positioning of this area. - * - * @param pos the positioning to use when rendering this area - */ - public void setPositioning(int pos) { - positioning = pos; - } - - /** - * Get the positioning of this area. - * - * @return the positioning to use when rendering this area - */ - public int getPositioning() { - return positioning; - } - -} - diff --git a/src/org/apache/fop/area/BlockParent.java b/src/org/apache/fop/area/BlockParent.java deleted file mode 100644 index b97db8082..000000000 --- a/src/org/apache/fop/area/BlockParent.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * $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 - * 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.area; - -import java.util.ArrayList; -import java.util.List; - -/** - * A BlockParent holds block-level areas. - */ -public class BlockParent extends Area { - - // this position is used for absolute position - // or as an indent - // this has the size in the block progression dimension - - /** - * The x offset position of this block parent. - * Used for relative and absolute positioning. - */ - protected int xOffset = 0; - - /** - * The y offset position of this block parent. - * Used for relative and absolute positioning. - */ - protected int yOffset = 0; - - /** - * The width of this block parent. - */ - protected int width = 0; - - /** - * The height of this block parent. - */ - protected int height = 0; - - /** - * The children of this block parent area. - */ - protected List children = null; - - // orientation if reference area - private int orientation = ORIENT_0; - - /** - * Add the block area to this block parent. - * - * @param block the child block area to add - */ - public void addBlock(Block block) { - if (children == null) { - children = new ArrayList(); - } - children.add(block); - } - - /** - * Get the list of child areas for this block area. - * - * @return the list of child areas - */ - public List getChildAreas() { - return children; - } - - /** - * Set the X offset of this block parent area. - * - * @param off the x offset of the block parent area - */ - public void setXOffset(int off) { - xOffset = off; - } - - /** - * Set the Y offset of this block parent area. - * - * @param off the y offset of the block parent area - */ - public void setYOffset(int off) { - yOffset = off; - } - - /** - * Set the width of this block parent area. - * - * @param w the width of the area - */ - public void setWidth(int w) { - width = w; - } - - /** - * Set the height of this block parent area. - * - * @param h the height of the block parent area - */ - public void setHeight(int h) { - height = h; - } - - /** - * Get the X offset of this block parent area. - * - * @return the x offset of the block parent area - */ - public int getXOffset() { - return xOffset; - } - - /** - * Get the Y offset of this block parent area. - * - * @return the y offset of the block parent area - */ - public int getYOffset() { - return yOffset; - } - - /** - * Get the width of this block parent area. - * - * @return the width of the area - */ - public int getWidth() { - return width; - } - - /** - * Get the height of this block parent area. - * - * @return the height of the block parent area - */ - public int getHeight() { - return height; - } - -} diff --git a/src/org/apache/fop/area/BlockViewport.java b/src/org/apache/fop/area/BlockViewport.java deleted file mode 100644 index f6e99ca33..000000000 --- a/src/org/apache/fop/area/BlockViewport.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * $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 - * 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.area; - -/** - * A BlockViewport. - * This is used for block level Viewport/reference pairs. - * The block-container creates this area. - */ -public class BlockViewport extends Block { - // clipping for this viewport - private boolean clip = false; - // transform if rotated or absolute - private CTM viewportCTM; - - /** - * Create a new block viewport area. - */ - public BlockViewport() { - } - - /** - * Set the transform of this viewport. - * If the viewport is rotated or has an absolute positioning - * this transform will do the work. - * - * @param ctm the transformation - */ - public void setCTM(CTM ctm) { - viewportCTM = ctm; - } - - /** - * Get the transform of this block viewport. - * - * @return the transformation of this viewport - * or null if normally stacked without rotation - */ - public CTM getCTM() { - return viewportCTM; - } - - /** - * Set the clipping for this viewport. - * - * @param cl the clipping for the viewport - */ - public void setClip(boolean cl) { - clip = cl; - } - - /** - * Get the clipping for this viewport. - * - * @return the clipping for the viewport - * true if the contents should be clipped for this viewport - */ - public boolean getClip() { - return clip; - } -} - diff --git a/src/org/apache/fop/area/BodyRegion.java b/src/org/apache/fop/area/BodyRegion.java deleted file mode 100644 index df27c0af5..000000000 --- a/src/org/apache/fop/area/BodyRegion.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * $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 - * 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.area; - -/** - * The body region area. - * This area contains a main reference area and optionally a - * before float and footnote area. - */ -public class BodyRegion extends RegionReference { - private BeforeFloat beforeFloat; - private MainReference mainReference; - private Footnote footnote; - private int columnGap; - private int columnCount; - - /** Reference inline progression dimension for the body. */ - private int refIPD; - - /** - * Create a new body region area. - * This sets the region reference area class to BODY. - */ - public BodyRegion() { - super(BODY); - } - - /** - * Set the number of columns for blocks when not spanning - * - * @param colCount the number of columns - */ - public void setColumnCount(int colCount) { - this.columnCount = colCount; - } - - /** - * Get the number of columns when not spanning - * - * @return the number of columns - */ - public int getColumnCount() { - return this.columnCount; - } - - /** - * Set the column gap between columns - * The length is in millipoints. - * - * @param colGap the column gap in millipoints - */ - public void setColumnGap(int colGap) { - this.columnGap = colGap; - } - - /** - * Set the before float area. - * - * @param bf the before float area - */ - public void setBeforeFloat(BeforeFloat bf) { - beforeFloat = bf; - } - - /** - * Set the main reference area. - * - * @param mr the main reference area - */ - public void setMainReference(MainReference mr) { - mainReference = mr; - } - - /** - * Set the footnote area. - * - * @param foot the footnote area - */ - public void setFootnote(Footnote foot) { - footnote = foot; - } - - /** - * Get the before float area. - * - * @return the before float area - */ - public BeforeFloat getBeforeFloat() { - return beforeFloat; - } - - /** - * Get the main reference area. - * - * @return the main reference area - */ - public MainReference getMainReference() { - return mainReference; - } - - /** - * Get the footnote area. - * - * @return the footnote area - */ - public Footnote getFootnote() { - return footnote; - } - - /** - * Clone this object. - * This is only used to clone the current object, the child areas - * 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()); - br.setIPD(getIPD()); - br.columnGap = columnGap; - br.columnCount = columnCount; - return br; - } -} diff --git a/src/org/apache/fop/area/CTM.java b/src/org/apache/fop/area/CTM.java deleted file mode 100644 index 8623aaf95..000000000 --- a/src/org/apache/fop/area/CTM.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * $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 - * 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.area; - -import java.awt.geom.Rectangle2D; -import java.awt.Rectangle; -import java.io.Serializable; - -import org.apache.fop.fo.properties.WritingMode; - -/** - * Describe a PDF or PostScript style coordinate transformation matrix (CTM). - * The matrix encodes translations, scaling and rotations of the coordinate - * system used to render pages. - */ -public class CTM implements Serializable { - - private double a, b, c, d, e, f; - - private static final CTM CTM_LRTB = new CTM(1, 0, 0, 1, 0, 0); - private static final CTM CTM_RLTB = new CTM(-1, 0, 0, 1, 0, 0); - private static final CTM CTM_TBRL = new CTM(0, 1, -1, 0, 0, 0); - - /** - * Create the identity matrix - */ - public CTM() { - a = 1; - b = 0; - c = 0; - d = 1; - e = 0; - f = 0; - } - - /** - * Initialize a CTM from the passed arguments. - * - * @param a the x scale - * @param b the x shear - * @param c the y shear - * @param d the y scale - * @param e the x shift - * @param f the y shift - */ - public CTM(double a, double b, double c, double d, double e, double f) { - this.a = a; - this.b = b; - this.c = c; - this.d = d; - this.e = e; - this.f = f; - } - - /** - * Initialize a CTM to the identity matrix with a translation - * specified by x and y - * - * @param x the x shift - * @param y the y shift. - */ - public CTM(double x, double y) { - this.a = 1; - this.b = 0; - this.c = 0; - this.d = 1; - this.e = x; - this.f = y; - } - - /** - * Initialize a CTM with the values of another CTM. - * - * @param ctm another CTM - */ - protected CTM(CTM ctm) { - this.a = ctm.a; - this.b = ctm.b; - this.c = ctm.c; - this.d = ctm.d; - this.e = ctm.e; - this.f = ctm.f; - } - - /** - * Return a CTM which will transform coordinates for a particular writing-mode - * into normalized first quandrant coordinates. - * @param wm A writing mode constant from fo.properties.WritingMode, ie. - * one of LR_TB, RL_TB, TB_RL. - * @param ipd The inline-progression dimension of the reference area whose - * CTM is being set.. - * @param bpd The block-progression dimension of the reference area whose - * CTM is being set. - * @return a new CTM with the required transform - */ - public static CTM getWMctm(int wm, int ipd, int bpd) { - CTM wmctm; - switch (wm) { - case WritingMode.LR_TB: - return new CTM(CTM_LRTB); - case WritingMode.RL_TB: - { - wmctm = new CTM(CTM_RLTB); - wmctm.e = ipd; - return wmctm; - } - //return CTM_RLTB.translate(ipd, 0); - case WritingMode.TB_RL: // CJK - { - wmctm = new CTM(CTM_TBRL); - wmctm.e = bpd; - return wmctm; - } - //return CTM_TBRL.translate(0, ipd); - default: - return null; - } - } - - /** - * Multiply new passed CTM with this one and generate a new result CTM. - * @param premult The CTM to multiply with this one. The new one will be - * the first multiplicand. - * @return CTM The result of multiplying premult * this. - */ - public CTM multiply(CTM premult) { - CTM rslt = new CTM ((premult.a * a) + (premult.b * c), - (premult.a * b) + (premult.b * d), - (premult.c * a) + (premult.d * c), - (premult.c * b) + (premult.d * d), - (premult.e * a) + (premult.f * c) + e, - (premult.e * b) + (premult.f * d) + f); - return rslt; - } - - /** - * Rotate this CTM by "angle" radians and return a new result CTM. - * This is used to account for reference-orientation. - * @param angle The angle in radians. Positive angles are measured counter- - * clockwise. - * @return CTM The result of rotating this CTM. - */ - public CTM rotate(double angle) { - double cos, sin; - if (angle == 90.0) { - cos = 0.0; - sin = 1.0; - } else if (angle == 270.0) { - cos = 0.0; - sin = -1.0; - } else if (angle == 180.0) { - cos = -1.0; - sin = 0.0; - } else { - double rad = Math.toRadians(angle); - cos = Math.cos(rad); - sin = Math.sin(rad); - } - CTM rotate = new CTM(cos, -sin, sin, cos, 0, 0); - return multiply(rotate); - } - - /** - * Translate this CTM by the passed x and y values and return a new result CTM. - * @param x The amount to translate along the x axis. - * @param y The amount to translate along the y axis. - * @return CTM The result of translating this CTM. - */ - public CTM translate(double x, double y) { - CTM translate = new CTM(1, 0, 0, 1, x, y); - return multiply(translate); - } - - /** - * Scale this CTM by the passed x and y values and return a new result CTM. - * @param x The amount to scale along the x axis. - * @param y The amount to scale along the y axis. - * @return CTM The result of scaling this CTM. - */ - public CTM scale(double x, double y) { - CTM scale = new CTM(x, 0, 0, y, 0, 0); - return multiply(scale); - } - - /** - * Transform a rectangle by the CTM to produce a rectangle in the transformed - * coordinate system. - * @param inRect The rectangle in the original coordinate system - * @return Rectangle2D The rectangle in the transformed coordinate system. - */ - public Rectangle2D transform(Rectangle2D inRect) { - // Store as 2 sets of 2 points and transform those, then - // recalculate the width and height - int x1t = (int)(inRect.getX() * a + inRect.getY() * c + e); - int y1t = (int)(inRect.getX() * b + inRect.getY() * d + f); - int x2t = (int)((inRect.getX() + inRect.getWidth()) * a - + (inRect.getY() + inRect.getHeight()) * c + e); - int y2t = (int)((inRect.getX() + inRect.getWidth()) * b - + (inRect.getY() + inRect.getHeight()) * d + f); - // Normalize with x1 < x2 - if (x1t > x2t) { - int tmp = x2t; - x2t = x1t; - x1t = tmp; - } - if (y1t > y2t) { - int tmp = y2t; - y2t = y1t; - y1t = tmp; - } - return new Rectangle(x1t, y1t, x2t - x1t, y2t - y1t); - } - - /** - * Get string for this transform. - * - * @return a string with the transform values - */ - public String toString() { - return "[" + a + " " + b + " " + c + " " + d + " " + e + " " - + f + "]"; - } - - /** - * Get an array containing the values of this transform. - * This creates and returns a new transform with the values in it. - * - * @return an array containing the transform values - */ - public double[] toArray() { - return new double[]{a, b, c, d, e, f}; - } -} - diff --git a/src/org/apache/fop/area/CachedRenderPagesModel.java b/src/org/apache/fop/area/CachedRenderPagesModel.java deleted file mode 100644 index b2bfdf9ae..000000000 --- a/src/org/apache/fop/area/CachedRenderPagesModel.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * $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 - * 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.area; - -import org.apache.fop.render.Renderer; - -import java.util.Map; -import java.util.HashMap; -import java.util.Iterator; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileInputStream; -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedInputStream; - -/** - * A simple cached render pages model. - * If the page is prepared for later rendering then this saves - * the page contents to a file and once the page is resolved - * the contents a reloaded. - */ -public class CachedRenderPagesModel extends RenderPagesModel { - private Map pageMap = new HashMap(); - - /** - * Create a new render pages model with the given renderer. - * @param rend the renderer to render pages to - */ - public CachedRenderPagesModel(Renderer rend) { - super(rend); - } - - /** - * Check prepared pages - * If a page is resolved it loads the page contents from - * the file. - * - * @param newpage the new page being added - * @return true if the current page should be rendered - * false if the renderer doesn't support out of order - * rendering and there are pending pages - */ - protected boolean checkPreparedPages(PageViewport newpage) { - for (Iterator iter = prepared.iterator(); iter.hasNext();) { - PageViewport p = (PageViewport)iter.next(); - if (p.isResolved()) { - if (p != newpage) { - try { - // load page from cache - String name = (String)pageMap.get(p); - File temp = new File(name); - System.out.println("page serialized to: " + temp.length()); - ObjectInputStream in = new ObjectInputStream( - new BufferedInputStream( - new FileInputStream(temp))); - p.loadPage(in); - in.close(); - temp.delete(); - pageMap.remove(p); - } catch (Exception e) { - e.printStackTrace(); - } - } - - try { - renderer.renderPage(p); - } catch (Exception e) { - // use error handler to handle this FOP or IO Exception - e.printStackTrace(); - } - p.clear(); - iter.remove(); - } else { - if (!renderer.supportsOutOfOrder()) { - break; - } - } - } - if (newpage != null && newpage.getPage() != null) { - savePage(newpage); - } - return renderer.supportsOutOfOrder() || prepared.isEmpty(); - } - - /** - * Save a page. - * It saves the contents of the page to a file. - * - * @param page the page to prepare - */ - protected void savePage(PageViewport page) { - try { - // save page to cache - ObjectOutputStream tempstream; - String fname = "page" + page.toString() + ".ser"; - tempstream = new ObjectOutputStream(new BufferedOutputStream( - new FileOutputStream(fname))); - page.savePage(tempstream); - tempstream.close(); - pageMap.put(page, fname); - } catch (Exception e) { - e.printStackTrace(); - } - } -} - diff --git a/src/org/apache/fop/area/Flow.java b/src/org/apache/fop/area/Flow.java deleted file mode 100644 index 92ddacb6e..000000000 --- a/src/org/apache/fop/area/Flow.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $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 - * 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.area; - -/** - * The normal flow reference area class. - * This area contains a list of block areas from the flow. - */ -public class Flow extends BlockParent { - // the list of blocks created from the flow - private int stacking = TB; - private int width; - -} - diff --git a/src/org/apache/fop/area/Footnote.java b/src/org/apache/fop/area/Footnote.java deleted file mode 100644 index 36b781f49..000000000 --- a/src/org/apache/fop/area/Footnote.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * $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 - * 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.area; - -// may combine with before float into a conditional area - -/** - * Footnote reference area. - * This areas holds footnote areas and an optional separator area. - */ -public class Footnote extends BlockParent { - private Block separator = null; - - // footnote has an optional separator - // and a list of sub block areas that can be added/removed - - // this is the relative position of the footnote inside - // the body region - private int top; - - /** - * Set the separator area for this footnote. - * - * @param sep the separator area - */ - public void setSeparator(Block sep) { - separator = sep; - } - - /** - * Get the separator area for this footnote area. - * - * @return the separator area - */ - public Block getSeparator() { - return separator; - } - -} - diff --git a/src/org/apache/fop/area/LineArea.java b/src/org/apache/fop/area/LineArea.java deleted file mode 100644 index fe34326cd..000000000 --- a/src/org/apache/fop/area/LineArea.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * $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 - * 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.area; - -import org.apache.fop.area.inline.InlineArea; - -import java.util.ArrayList; -import java.util.List; - -/** - * The line area. - * This is a line area that contains inline areas. - */ -public class LineArea extends Area { - private int stacking = LR; - // contains inline areas - // has start indent and length, dominant baseline, height - private int startIndent; - private int length; - - private int lineHeight; - // this is the offset for the dominant baseline - private int baseLine; - - // this class can contain the dominant char styling info - // this means that many renderers can optimise a bit - - private List inlineAreas = new ArrayList(); - - /** - * Set the height of this line area. - * - * @param height the height of the line area - */ - public void setHeight(int height) { - lineHeight = height; - } - - /** - * Get the height of this line area. - * - * @return the height of the line area - */ - public int getHeight() { - return lineHeight; - } - - /** - * Add a child area to this line area. - * - * @param childArea the inline child area to add - */ - public void addChild(Area childArea) { - if (childArea instanceof InlineArea) { - addInlineArea((InlineArea)childArea); - } - } - - /** - * Add an inline child area to this line area. - * - * @param area the inline child area to add - */ - public void addInlineArea(InlineArea area) { - inlineAreas.add(area); - } - - /** - * Get the inline child areas of this line area. - * - * @return the list of inline areas - */ - public List getInlineAreas() { - return inlineAreas; - } - - /** - * Set the start indent of this line area. - * The start indent is used for offsetting the start of - * the inline areas for alignment or other indents. - * - * @param si the start indent value - */ - public void setStartIndent(int si) { - startIndent = si; - } - - /** - * Get the start indent of this line area. - * The start indent is used for offsetting the start of - * the inline areas for alignment or other indents. - * - * @return the start indent value - */ - public int getStartIndent() { - return startIndent; - } -} - diff --git a/src/org/apache/fop/area/LineTrait.java b/src/org/apache/fop/area/LineTrait.java deleted file mode 100644 index 71d601b59..000000000 --- a/src/org/apache/fop/area/LineTrait.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $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 - * 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.area; - -/** - * Traits for a range of areas in a line. - * Not sure if this is needed. - */ -public class LineTrait extends Trait { - private int[] range; -} - diff --git a/src/org/apache/fop/area/MainReference.java b/src/org/apache/fop/area/MainReference.java deleted file mode 100644 index 4f56c421d..000000000 --- a/src/org/apache/fop/area/MainReference.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * $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 - * 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.area; - -import java.util.List; - -/** - * The main body reference area. - * This area that contains the flow via the span areas. - */ -public class MainReference extends Area { - private List spanAreas = new java.util.ArrayList(); - private int columnGap; - private int width; - - /** - * Add a span area to this area. - * - * @param span the span area to add - */ - public void addSpan(Span span) { - spanAreas.add(span); - } - - /** - * Get the span areas from this area. - * - * @return the list of span areas - */ - public List getSpans() { - return spanAreas; - } - - /** - * Get the column gap in millipoints. - * - * @return the column gap in millioints - */ - public int getColumnGap() { - return columnGap; - } - - /** - * Get the width of this reference area. - * - * @return the width - */ - public int getWidth() { - return width; - } - -} - diff --git a/src/org/apache/fop/area/Page.java b/src/org/apache/fop/area/Page.java deleted file mode 100644 index 246e983eb..000000000 --- a/src/org/apache/fop/area/Page.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * $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 - * 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.area; - -import java.io.Serializable; -import java.util.Map; - -/** - * The page. - * This holds the contents of the page. Each region is added. - * The unresolved references area added so that if the page is - * serialized then it will handle the resolving properly after - * being reloaded. - * This is serializable so it can be saved to cache to save - * memory if there are forward references. - * The page is cloneable so the page master can make copies of - * the top level page and regions. - */ -public class Page implements Serializable, Cloneable { - // contains before, start, body, end and after regions - private RegionViewport regionBefore = null; - private RegionViewport regionStart = null; - private RegionViewport regionBody = null; - private RegionViewport regionEnd = null; - private RegionViewport regionAfter = null; - - // temporary map of unresolved objects used when serializing the page - private Map unresolved = null; - - /** - * Set the region on this page. - * - * @param areaclass the area class of the region to set - * @param port the region viewport to set - */ - public void setRegion(int areaclass, RegionViewport port) { - if (areaclass == RegionReference.BEFORE) { - regionBefore = port; - } else if (areaclass == RegionReference.START) { - regionStart = port; - } else if (areaclass == RegionReference.BODY) { - regionBody = port; - } else if (areaclass == RegionReference.END) { - regionEnd = port; - } else if (areaclass == RegionReference.AFTER) { - regionAfter = port; - } - } - - /** - * Get the region from this page. - * - * @param areaclass the region area class - * @return the region viewport or null if none - */ - public RegionViewport getRegion(int areaclass) { - if (areaclass == RegionReference.BEFORE) { - return regionBefore; - } else if (areaclass == RegionReference.START) { - return regionStart; - } else if (areaclass == RegionReference.BODY) { - return regionBody; - } else if (areaclass == RegionReference.END) { - return regionEnd; - } else if (areaclass == RegionReference.AFTER) { - return regionAfter; - } - return null; - } - - /** - * Clone this page. - * This returns a new page with a clone of all the regions. - * - * @return a new clone of this page - */ - public Object clone() { - Page p = new Page(); - if (regionBefore != null) { - p.regionBefore = (RegionViewport)regionBefore.clone(); - } - if (regionStart != null) { - p.regionStart = (RegionViewport)regionStart.clone(); - } - if (regionBody != null) { - p.regionBody = (RegionViewport)regionBody.clone(); - } - if (regionEnd != null) { - p.regionEnd = (RegionViewport)regionEnd.clone(); - } - if (regionAfter != null) { - p.regionAfter = (RegionViewport)regionAfter.clone(); - } - - return p; - } - - /** - * Set the unresolved references on this page for serializing. - * - * @param unres the map of unresolved objects - */ - public void setUnresolvedReferences(Map unres) { - unresolved = unres; - } - - /** - * Get the map unresolved references from this page. - * This should be called after deserializing to retrieve - * the map of unresolved references that were serialized. - * - * @return the de-serialized map of unresolved objects - */ - public Map getUnresolvedReferences() { - return unresolved; - } -} - diff --git a/src/org/apache/fop/area/PageViewport.java b/src/org/apache/fop/area/PageViewport.java deleted file mode 100644 index 2315afeed..000000000 --- a/src/org/apache/fop/area/PageViewport.java +++ /dev/null @@ -1,407 +0,0 @@ -/* - * $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 - * 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.area; - -import java.awt.geom.Rectangle2D; -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.util.Iterator; - -import org.apache.fop.fo.properties.RetrievePosition; - -/** - * Page viewport that specifies the viewport area and holds the page contents. - * 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 - */ -public class PageViewport implements Resolveable, Cloneable { - - private Page page; - private Rectangle2D viewArea; - private boolean clip = false; - private String pageNumber = null; - - // list of id references and the rectangle on the page - private Map idReferences = null; - - // this keeps a list of currently unresolved areas or extensions - // once the thing is resolved it is removed - // when this is empty the page can be rendered - private Map unresolved = null; - - private Map pendingResolved = null; - - // hashmap of markers for this page - // start and end are added by the fo that contains the markers - private Map markerFirstStart = null; - private Map markerLastStart = null; - private Map markerFirstAny = null; - private Map markerLastEnd = null; - private Map markerLastAny = null; - - /** - * Create a page viewport. - * @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; - viewArea = bounds; - } - - /** - * Set if this viewport should clip. - * @param c true if this viewport should clip - */ - public void setClip(boolean c) { - clip = c; - } - - /** - * Get the view area rectangle of this viewport. - * @return the rectangle for this viewport - */ - public Rectangle2D getViewArea() { - return viewArea; - } - - /** - * Get the page reference area with the contents. - * @return the page reference area - */ - public Page getPage() { - return page; - } - - /** - * Set the page number for this page. - * @param num the string representing the page number - */ - public void setPageNumber(String num) { - pageNumber = num; - } - - /** - * Get the page number of this page. - * @return the string that represents this page - */ - public String getPageNumber() { - return pageNumber; - } - - /** - * Get the key for this page viewport. - * This is used so that a serializable key can be used to - * lookup the page or some other reference. - * - * @return a unique page viewport key for this area tree - */ - public String getKey() { - return toString(); - } - - /** - * 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. - * @param id the id of the reference - * @param res the resolver of the reference - */ - public void addUnresolvedID(String id, Resolveable res) { - if (unresolved == null) { - unresolved = new HashMap(); - } - List list = (List)unresolved.get(id); - if (list == null) { - list = new ArrayList(); - unresolved.put(id, list); - } - list.add(res); - } - - /** - * Check if this page has been fully resolved. - * @return true if the page is resolved and can be rendered - */ - public boolean isResolved() { - return unresolved == null; - } - - /** - * Get the id references for this page. - * @return always null - */ - public String[] getIDs() { - return null; - } - - /** - * This resolves reference with a list of pages. - * The pages (PageViewport) contain the rectangle of the area. - * @param id the id to resolve - * @param pages the list of pages with the id area - * may be null if not found - */ - public void resolve(String id, List pages) { - if (page == null) { - if (pendingResolved == null) { - pendingResolved = new HashMap(); - } - pendingResolved.put(id, pages); - } else { - if (unresolved != null) { - List todo = (List)unresolved.get(id); - if (todo != null) { - for (int count = 0; count < todo.size(); count++) { - Resolveable res = (Resolveable)todo.get(count); - res.resolve(id, pages); - } - } - } - } - if (unresolved != null) { - unresolved.remove(id); - if (unresolved.isEmpty()) { - unresolved = null; - } - } - } - - /** - * Add the markers for this page. - * Only the required markers are kept. - * For "first-starting-within-page" it adds the markers - * that are starting only if the marker class name is not - * already added. - * For "first-including-carryover" it adds any starting marker - * if the marker class name is not already added. - * For "last-starting-within-page" it adds all marks that - * are starting, replacing earlier markers. - * 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. - * - * @param marks the map of markers to add - * @param start if the area being added is starting or ending - * @param isfirst isfirst or islast flag - */ - public void addMarkers(Map marks, boolean start, boolean isfirst) { - if (start) { - if (isfirst) { - if (markerFirstStart == null) { - markerFirstStart = new HashMap(); - } - if (markerFirstAny == null) { - markerFirstAny = new HashMap(); - } - // only put in new values, leave current - for (Iterator iter = marks.keySet().iterator(); iter.hasNext();) { - Object key = iter.next(); - if (!markerFirstStart.containsKey(key)) { - markerFirstStart.put(key, marks.get(key)); - } - if (!markerFirstAny.containsKey(key)) { - markerFirstAny.put(key, marks.get(key)); - } - } - if (markerLastStart == null) { - markerLastStart = new HashMap(); - } - // replace all - markerLastStart.putAll(marks); - - } else { - if (markerFirstAny == null) { - markerFirstAny = new HashMap(); - } - // only put in new values, leave current - for (Iterator iter = marks.keySet().iterator(); iter.hasNext();) { - Object key = iter.next(); - if (!markerFirstAny.containsKey(key)) { - markerFirstAny.put(key, marks.get(key)); - } - } - } - } else { - if (!isfirst) { - if (markerLastEnd == null) { - markerLastEnd = new HashMap(); - } - // replace all - markerLastEnd.putAll(marks); - } - if (markerLastAny == null) { - markerLastAny = new HashMap(); - } - // replace all - markerLastAny.putAll(marks); - } - } - - /** - * Get a marker from this page. - * This will retrieve a marker with the class name - * and position. - * - * @param name The class name of the marker to retrieve - * @param pos the position to retrieve - * @return Object the marker found or null - */ - public Object getMarker(String name, int pos) { - Object mark = null; - switch (pos) { - case RetrievePosition.FSWP: - if (markerFirstStart != null) { - mark = markerFirstStart.get(name); - } - if (mark == null && markerFirstAny != null) { - mark = markerFirstAny.get(name); - } - break; - case RetrievePosition.FIC: - if (markerFirstAny != null) { - mark = markerFirstAny.get(name); - } - break; - case RetrievePosition.LSWP: - if (markerLastStart != null) { - mark = markerLastStart.get(name); - } - if (mark == null && markerLastAny != null) { - mark = markerLastAny.get(name); - } - break; - case RetrievePosition.LEWP: - if (markerLastEnd != null) { - mark = markerLastEnd.get(name); - } - if (mark == null && markerLastAny != null) { - mark = markerLastAny.get(name); - } - break; - } - return mark; - } - - /** - * Save the page contents to an object stream. - * The map of unresolved references are set on the page 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 - */ - public void savePage(ObjectOutputStream out) throws Exception { - // set the unresolved references so they are serialized - page.setUnresolvedReferences(unresolved); - out.writeObject(page); - page = null; - } - - /** - * Load the page contents from an object stream. - * This loads the page contents 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 - */ - public void loadPage(ObjectInputStream in) throws Exception { - page = (Page) in.readObject(); - unresolved = page.getUnresolvedReferences(); - if (unresolved != null && pendingResolved != null) { - for (Iterator iter = pendingResolved.keySet().iterator(); - iter.hasNext();) { - String id = (String) iter.next(); - resolve(id, (List)pendingResolved.get(id)); - } - pendingResolved = null; - } - } - - /** - * Clone this page. - * Used by the page master to create a copy of an original page. - * @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()); - return ret; - } - - /** - * Clear the page 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; - } - - /** - * @see java.lang.Object#toString() - */ - public String toString() { - StringBuffer sb = new StringBuffer(64); - sb.append("PageViewport: page="); - sb.append(getPageNumber()); - return sb.toString(); - } -} diff --git a/src/org/apache/fop/area/RegionReference.java b/src/org/apache/fop/area/RegionReference.java deleted file mode 100644 index 700a20d85..000000000 --- a/src/org/apache/fop/area/RegionReference.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * $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 - * 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.area; - -import java.util.ArrayList; -import java.util.List; - -/** - * 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 CTM ctm; - // the list of block areas from the static flow - private List blocks = new ArrayList(); - - /** - * Create a new region reference area. - * - * @param type the region class type - */ - public RegionReference(int type) { - regionClass = type; - } - - /** - * Set the Coordinate Transformation Matrix which transforms content - * coordinates in this region reference area which are specified in - * terms of "start" and "before" into coordinates in a system which - * is positioned in "absolute" directions (with origin at lower left of - * the region reference area. - * - * @param ctm the current transform to position this region - */ - public void setCTM(CTM ctm) { - this.ctm = ctm; - } - - /** - * Get the current transform of this region. - * - * @return ctm the current transform to position this region - */ - public CTM getCTM() { - return this.ctm; - } - - /** - * Get the block in this region. - * - * @return the list of blocks in this region - */ - public List getBlocks() { - return blocks; - } - - /** - * Get the region class of this region. - * - * @return the region class - */ - public int getRegionClass() { - return regionClass; - } - - /** - * Add a block area to this region reference area. - * - * @param block the block area to add - */ - public void addBlock(Block block) { - blocks.add(block); - } - - /** - * Clone this region. - * This is used when cloning the page by the page master. - * The blocks are not copied since the master will have no blocks. - * - * @return a copy of this region reference area - */ - public Object clone() { - RegionReference rr = new RegionReference(regionClass); - rr.ctm = ctm; - rr.setIPD(getIPD()); - return rr; - } - -} diff --git a/src/org/apache/fop/area/RegionViewport.java b/src/org/apache/fop/area/RegionViewport.java deleted file mode 100644 index 4c34d20ee..000000000 --- a/src/org/apache/fop/area/RegionViewport.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * $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 - * 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.area; - -import java.awt.geom.Rectangle2D; -import java.io.IOException; -import java.util.HashMap; - -/** - * Region Viewport reference area. - * This area is the viewport for a region and contains a region area. - */ -public class RegionViewport extends Area implements Cloneable { - // this rectangle is relative to the page - private RegionReference region; - private Rectangle2D viewArea; - private boolean clip = false; - - /** - * Create a new region viewport. - * - * @param viewArea the view area of this viewport - */ - public RegionViewport(Rectangle2D viewArea) { - this.viewArea = viewArea; - } - - /** - * Set the region for this region viewport. - * - * @param reg the child region inside this viewport - */ - public void setRegion(RegionReference reg) { - region = reg; - } - - /** - * Get the region for this region viewport. - * - * @return the child region inside this viewport - */ - public RegionReference getRegion() { - return region; - } - - /** - * Set the clipping for this region viewport. - * - * @param c the clipping value - */ - public void setClip(boolean c) { - clip = c; - } - - /** - * Get the view area of this viewport. - * - * @return the viewport rectangle area - */ - public Rectangle2D getViewArea() { - return viewArea; - } - - private void writeObject(java.io.ObjectOutputStream out) - throws IOException { - out.writeFloat((float) viewArea.getX()); - out.writeFloat((float) viewArea.getY()); - out.writeFloat((float) viewArea.getWidth()); - out.writeFloat((float) viewArea.getHeight()); - out.writeBoolean(clip); - out.writeObject(props); - out.writeObject(region); - } - - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException { - viewArea = new Rectangle2D.Float(in.readFloat(), in.readFloat(), - in.readFloat(), in.readFloat()); - clip = in.readBoolean(); - props = (HashMap)in.readObject(); - setRegion((RegionReference) in.readObject()); - } - - /** - * Clone this region viewport. - * Used when creating a copy from the page master. - * - * @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(); - } - return rv; - } -} - diff --git a/src/org/apache/fop/area/RenderPagesModel.java b/src/org/apache/fop/area/RenderPagesModel.java deleted file mode 100644 index 9835eb9d8..000000000 --- a/src/org/apache/fop/area/RenderPagesModel.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * $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 - * 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.area; - -// FOP -import org.apache.fop.render.Renderer; - -// Java -import java.util.List; -import java.util.Iterator; - -/** - * This uses the store pages model to store the pages - * each page is either rendered if ready or prepared - * for later rendering. - * Once a page is rendered it is cleared to release the - * contents but the PageViewport is retained. So even - * though the pages are stored the contents are discarded. - */ -public class RenderPagesModel extends StorePagesModel { - /** - * The renderer that will render the pages. - */ - protected Renderer renderer; - /** - * Pages that have been prepared but not rendered yet. - */ - protected List prepared = new java.util.ArrayList(); - private List pendingExt = new java.util.ArrayList(); - private List endDocExt = new java.util.ArrayList(); - - /** - * Create a new render pages model with the given renderer. - * @param rend the renderer to render pages to - */ - public RenderPagesModel(Renderer rend) { - renderer = rend; - } - - /** - * Start a new page sequence. - * This tells the renderer that a new page sequence has - * started with the given title. - * @param title the title of the new page sequence - */ - public void startPageSequence(Title title) { - super.startPageSequence(title); - renderer.startPageSequence(title); - } - - /** - * Add a page to the render page model. - * If the page is finished it can be rendered immediately. - * If the page needs resolving then if the renderer supports - * out of order rendering it can prepare the page. Otherwise - * the page is added to a queue. - * @param page the page to add to the model - */ - public void addPage(PageViewport page) { - super.addPage(page); - - // for links the renderer needs to prepare the page - // it is more appropriate to do this after queued pages but - // it will mean that the renderer has not prepared a page that - // could be referenced - boolean done = renderer.supportsOutOfOrder() && page.isResolved(); - if (done) { - try { - renderer.renderPage(page); - } catch (Exception e) { - // use error handler to handle this FOP or IO Exception - e.printStackTrace(); - } - page.clear(); - } else { - preparePage(page); - } - - - // check prepared pages - boolean cont = checkPreparedPages(page); - - if (cont) { - renderExtensions(pendingExt); - pendingExt.clear(); - } - } - - /** - * Check prepared pages - * - * @param newpage the new page being added - * @return true if the current page should be rendered - * false if the renderer doesn't support out of order - * rendering and there are pending pages - */ - protected boolean checkPreparedPages(PageViewport newpage) { - for (Iterator iter = prepared.iterator(); iter.hasNext();) { - PageViewport p = (PageViewport)iter.next(); - if (p.isResolved()) { - try { - renderer.renderPage(p); - } catch (Exception e) { - // use error handler to handle this FOP or IO Exception - e.printStackTrace(); - } - p.clear(); - iter.remove(); - } else { - // if keeping order then stop at first page not resolved - if (!renderer.supportsOutOfOrder()) { - break; - } - } - } - return renderer.supportsOutOfOrder() || prepared.isEmpty(); - } - - /** - * Prepare a page. - * An unresolved page can be prepared if the renderer supports - * it and the page will be rendered later. - * @param page the page to prepare - */ - protected void preparePage(PageViewport page) { - if (renderer.supportsOutOfOrder()) { - renderer.preparePage(page); - } - prepared.add(page); - } - - /** - * Add an extension to this model. - * If handle immediately then send directly to the renderer. - * The after page ones are handled after the next page is added. - * End of document extensions are added to a list to be - * handled at the end. - * @param ext the extension - * @param when when to render the extension - */ - public void addExtension(TreeExt ext, int when) { - switch(when) { - case TreeExt.IMMEDIATELY: - renderer.renderExtension(ext); - break; - case TreeExt.AFTER_PAGE: - pendingExt.add(ext); - break; - case TreeExt.END_OF_DOC: - endDocExt.add(ext); - break; - } - } - - private void renderExtensions(List list) { - for (int count = 0; count < list.size(); count++) { - TreeExt ext = (TreeExt)list.get(count); - renderer.renderExtension(ext); - } - } - - /** - * End the document. Render any end document extensions. - */ - public void endDocument() { - // render any pages that had unresolved ids - checkPreparedPages(null); - - renderExtensions(pendingExt); - pendingExt.clear(); - - renderExtensions(endDocExt); - } -} - diff --git a/src/org/apache/fop/area/Resolveable.java b/src/org/apache/fop/area/Resolveable.java deleted file mode 100644 index 67341c30c..000000000 --- a/src/org/apache/fop/area/Resolveable.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * $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 - * 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.area; - -import java.util.List; - -/** - * Resolveable Interface. - * Classes that implement this can be resolved when - * an id is added to the area tree. - */ -public interface Resolveable { - - /** - * Check if this area has been resolved. - * - * @return true once this area is resolved - */ - boolean isResolved(); - - /** - * Get the array of id references of this resolveable object. - * If this object contains child resolveables that are - * resolved through this then it should return the id's of - * the child also. - * - * @return the id references for resolving this object - */ - String[] getIDs(); - - /** - * This resolves reference with a list of pages. - * The pages (PageViewport) contain the rectangle of the area. - * @param id the id to resolve - * @param pages the list of pages with the id area - * may be null if not found - */ - void resolve(String id, List pages); -} diff --git a/src/org/apache/fop/area/Span.java b/src/org/apache/fop/area/Span.java deleted file mode 100644 index 1e3e41a46..000000000 --- a/src/org/apache/fop/area/Span.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * $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 - * 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.area; - -import java.util.List; - -/** - * The span reference area. - * 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 { - // the list of flow reference areas in this span area - private List flowAreas; - private int height; - - /** - * 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); - } - - /** - * Get the column count for this span area. - * - * @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); - } - -} - diff --git a/src/org/apache/fop/area/StorePagesModel.java b/src/org/apache/fop/area/StorePagesModel.java deleted file mode 100644 index 2af688dee..000000000 --- a/src/org/apache/fop/area/StorePagesModel.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * $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 - * 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.area; - -// Java -import java.util.List; - -/** - * This class stores all the pages in the document - * for interactive agents. - * The pages are stored and can be retrieved in any order. - */ -public class StorePagesModel extends AreaTreeModel { - private List pageSequence = null; - private List titles = new java.util.ArrayList(); - private List currSequence; - private List extensions = new java.util.ArrayList(); - - /** - * Create a new store pages model - */ - public StorePagesModel() { - } - - /** - * Start a new page sequence. - * This creates a new list for the pages in the new page sequence. - * @param title the title of the page sequence. - */ - public void startPageSequence(Title title) { - titles.add(title); - if (pageSequence == null) { - pageSequence = new java.util.ArrayList(); - } - currSequence = new java.util.ArrayList(); - pageSequence.add(currSequence); - } - - /** - * Add a page. - * @param page the page to add to the current page sequence - */ - public void addPage(PageViewport page) { - currSequence.add(page); - } - - /** - * Get the page sequence count. - * @return the number of page sequences in the document. - */ - public int getPageSequenceCount() { - return pageSequence.size(); - } - - /** - * Get the title for a page sequence. - * @param count the page sequence count - * @return the title of the page sequence - */ - public Title getTitle(int count) { - return (Title) titles.get(count); - } - - /** - * Get the page count. - * @param seq the page sequence to count. - * @return returns the number of pages in a page sequence - */ - public int getPageCount(int seq) { - List sequence = (List) pageSequence.get(seq); - return sequence.size(); - } - - /** - * Get the page for a position in the document. - * @param seq the page sequence number - * @param count the page count in the sequence - * @return the PageViewport for the particular page - */ - public PageViewport getPage(int seq, int count) { - List sequence = (List) pageSequence.get(seq); - return (PageViewport) sequence.get(count); - } - - /** - * Add an extension to the store page model. - * The extension is stored so that it can be retrieved in the - * appropriate position. - * @param ext the extension to add - * @param when when the extension should be handled - */ - public void addExtension(TreeExt ext, int when) { - int seq, page; - switch(when) { - case TreeExt.IMMEDIATELY: - seq = pageSequence == null ? 0 : pageSequence.size(); - page = currSequence == null ? 0 : currSequence.size(); - break; - case TreeExt.AFTER_PAGE: - break; - case TreeExt.END_OF_DOC: - break; - } - extensions.add(ext); - } - - /** - * Get the list of extensions that apply at a particular - * position in the document. - * @param seq the page sequence number - * @param count the page count in the sequence - * @return the list of extensions - */ - public List getExtensions(int seq, int count) { - return null; - } - - /** - * Get the end of document extensions for this stroe pages model. - * @return the list of end extensions - */ - public List getEndExtensions() { - return extensions; - } - - /** - * End document, do nothing. - */ - public void endDocument() { - } -} diff --git a/src/org/apache/fop/area/Title.java b/src/org/apache/fop/area/Title.java deleted file mode 100644 index 70429c285..000000000 --- a/src/org/apache/fop/area/Title.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * $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 - * 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.area; - -/** - * The title area. - * This area holds the inline areas from the page-sequence - * title element. - */ -public class Title extends LineArea { -} - diff --git a/src/org/apache/fop/area/Trait.java b/src/org/apache/fop/area/Trait.java deleted file mode 100644 index 961222d4f..000000000 --- a/src/org/apache/fop/area/Trait.java +++ /dev/null @@ -1,475 +0,0 @@ -/* - * $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 - * 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.area; - -import org.apache.fop.datatypes.ColorType; -import org.apache.fop.traits.BorderProps; - -import java.io.Serializable; -import java.util.Map; -import java.util.HashMap; -import java.util.Iterator; - -// properties should be serialized by the holder -/** - * Area traits used for rendering. - * This class represents an area trait that specifies a value for rendering. - */ -public class Trait implements Serializable { - /** - * Id reference line, not resolved. - * not sure if this is needed. - */ - public static final Integer ID_LINK = new Integer(0); - - /** - * Internal link trait. - * This is resolved and provides a link to an internal area. - */ - public static final Integer INTERNAL_LINK = new Integer(1); //resolved - - /** - * External link. A URL link to an external resource. - */ - public static final Integer EXTERNAL_LINK = new Integer(2); - - /** - * The font name from the font setup. - */ - public static final Integer FONT_NAME = new Integer(3); - - /** - * Font size for the current font. - */ - public static final Integer FONT_SIZE = new Integer(4); - - /** - * The current colour. - */ - public static final Integer COLOR = new Integer(7); - - /** - * Don't think this is necessary. - */ - public static final Integer ID_AREA = new Integer(8); - - /** - * Background trait for an area. - */ - public static final Integer BACKGROUND = new Integer(9); - - /** - * Underline trait used when rendering inline parent. - */ - public static final Integer UNDERLINE = new Integer(10); - - /** - * Overline trait used when rendering inline parent. - */ - public static final Integer OVERLINE = new Integer(11); - - /** - * Linethrough trait used when rendering inline parent. - */ - public static final Integer LINETHROUGH = new Integer(12); - - /** - * Shadow offset. - */ - public static final Integer OFFSET = new Integer(13); - - /** - * The shadow for text. - */ - public static final Integer SHADOW = new Integer(14); - - /** - * The border start. - */ - public static final Integer BORDER_START = new Integer(15); - - /** - * The border end. - */ - public static final Integer BORDER_END = new Integer(16); - - /** - * The border before. - */ - public static final Integer BORDER_BEFORE = new Integer(17); - - /** - * The border after. - */ - public static final Integer BORDER_AFTER = new Integer(18); - - /** - * The padding start. - */ - public static final Integer PADDING_START = new Integer(19); - - /** - * The padding end. - */ - public static final Integer PADDING_END = new Integer(20); - - /** - * The padding before. - */ - public static final Integer PADDING_BEFORE = new Integer(21); - - /** - * The padding after. - */ - public static final Integer PADDING_AFTER = new Integer(22); - - private static final Map TRAIT_INFO = new HashMap(); - - private static class TraitInfo { - private String name; - private Class clazz; // Class of trait data - - public TraitInfo(String name, Class clazz) { - this.name = name; - this.clazz = clazz; - } - - public String getName() { - return this.name; - } - - public Class getClazz() { - return this.clazz; - } - } - - static { - // Create a hashmap mapping trait code to name for external representation - TRAIT_INFO.put(ID_LINK, new TraitInfo("id-link", String.class)); - TRAIT_INFO.put(INTERNAL_LINK, - new TraitInfo("internal-link", String.class)); - TRAIT_INFO.put(EXTERNAL_LINK, - new TraitInfo("external-link", String.class)); - TRAIT_INFO.put(FONT_NAME, - new TraitInfo("font-family", String.class)); - TRAIT_INFO.put(FONT_SIZE, - new TraitInfo("font-size", Integer.class)); - TRAIT_INFO.put(COLOR, new TraitInfo("color", String.class)); - TRAIT_INFO.put(ID_AREA, new TraitInfo("id-area", String.class)); - TRAIT_INFO.put(BACKGROUND, - new TraitInfo("background", Background.class)); - TRAIT_INFO.put(UNDERLINE, - new TraitInfo("underline", Boolean.class)); - TRAIT_INFO.put(OVERLINE, - new TraitInfo("overline", Boolean.class)); - TRAIT_INFO.put(LINETHROUGH, - new TraitInfo("linethrough", Boolean.class)); - TRAIT_INFO.put(OFFSET, new TraitInfo("offset", Integer.class)); - TRAIT_INFO.put(SHADOW, new TraitInfo("shadow", Integer.class)); - TRAIT_INFO.put(BORDER_START, - new TraitInfo("border-start", BorderProps.class)); - TRAIT_INFO.put(BORDER_END, - new TraitInfo("border-end", BorderProps.class)); - TRAIT_INFO.put(BORDER_BEFORE, - new TraitInfo("border-before", BorderProps.class)); - TRAIT_INFO.put(BORDER_AFTER, - new TraitInfo("border-after", BorderProps.class)); - TRAIT_INFO.put(PADDING_START, - new TraitInfo("padding-start", Integer.class)); - TRAIT_INFO.put(PADDING_END, - new TraitInfo("padding-end", Integer.class)); - TRAIT_INFO.put(PADDING_BEFORE, - new TraitInfo("padding-before", Integer.class)); - TRAIT_INFO.put(PADDING_AFTER, - new TraitInfo("padding-after", Integer.class)); - } - - /** - * Get the trait name for a trait code. - * - * @param traitCode the trait code to get the name for - * @return the trait name - */ - public static String getTraitName(Object traitCode) { - Object obj = TRAIT_INFO.get(traitCode); - if (obj != null) { - return ((TraitInfo) obj).getName(); - } else { - return "unknown-trait-" + traitCode.toString(); - } - } - - /** - * Get the trait code for a trait name. - * - * @param sTraitName the name of the trait to find - * @return the trait code object - */ - public static Object getTraitCode(String sTraitName) { - Iterator iter = TRAIT_INFO.entrySet().iterator(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry) iter.next(); - TraitInfo ti = (TraitInfo) entry.getValue(); - if (ti != null && ti.getName().equals(sTraitName)) { - return entry.getKey(); - } - } - return null; - } - - /** - * Get the data storage class for the trait. - * - * @param oTraitCode the trait code to lookup - * @return the class type for the trait - */ - private static Class getTraitClass(Object oTraitCode) { - TraitInfo ti = (TraitInfo) TRAIT_INFO.get(oTraitCode); - return (ti != null ? ti.getClazz() : null); - } - - /** - * The type of trait for an area. - */ - private Object propType; - - /** - * The data value of the trait. - */ - private Object data; - - /** - * Create a new empty trait. - */ - public Trait() { - this.propType = null; - this.data = null; - } - - /** - * Create a trait with the value and type. - * - * @param propType the type of trait - * @param data the data value - */ - public Trait(Object propType, Object data) { - this.propType = propType; - this.data = data; - } - - /** - * Returns the trait data value. - * @return the trait data value - */ - public Object getData() { - return this.data; - } - - /** - * Returns the property type. - * @return the property type - */ - public Object getPropType() { - return this.propType; - } - - /** - * Return the string for debugging. - * @see java.lang.Object#toString() - */ - public String toString() { - return data.toString(); - } - - /** - * Make a trait value. - * - * @param oCode trait code - * @param sTraitValue trait value as String - * @return the trait value as object - */ - public static Object makeTraitValue(Object oCode, String sTraitValue) { - // Get the code from the name - // See what type of object it is - // Convert string value to an object of that type - Class tclass = getTraitClass(oCode); - if (tclass == null) { - return null; - } - if (tclass.equals(String.class)) { - return sTraitValue; - } - if (tclass.equals(Integer.class)) { - return new Integer(sTraitValue); - } - // See if the class has a constructor from string or can read from a string - try { - Object o = tclass.newInstance(); - //return o.fromString(sTraitValue); - } catch (IllegalAccessException e1) { - System.err.println("Can't create instance of " - + tclass.getName()); - return null; - } catch (InstantiationException e2) { - System.err.println("Can't create instance of " - + tclass.getName()); - return null; - } - - - return null; - } - - /** - * Background trait structure. - * Used for storing back trait information which are related. - */ - public static class Background implements Serializable { - - /** The background color if any. */ - private ColorType color = null; - - /** The background image url if any. */ - private String url = null; - - /** Background repeat enum for images. */ - private int repeat; - - /** Background horizontal offset for images. */ - private int horiz; - - /** Background vertical offset for images. */ - private int vertical; - - /** - * Returns the background color. - * @return background color, null if n/a - */ - public ColorType getColor() { - return color; - } - - /** - * Returns the horizontal offset for images. - * @return the horizontal offset - */ - public int getHoriz() { - return horiz; - } - - /** - * Returns the image repetition behaviour for images. - * @return the image repetition behaviour - */ - public int getRepeat() { - return repeat; - } - - /** - * Returns the URL to the background image - * @return URL to the background image, null if n/a - */ - public String getURL() { - return url; - } - - /** - * Returns the vertical offset for images. - * @return the vertical offset - */ - public int getVertical() { - return vertical; - } - - /** - * Sets the color. - * @param color The color to set - */ - public void setColor(ColorType color) { - this.color = color; - } - - /** - * Sets the horizontal offset. - * @param horiz The horizontal offset to set - */ - public void setHoriz(int horiz) { - this.horiz = horiz; - } - - /** - * Sets the image repetition behaviour for images. - * @param repeat The image repetition behaviour to set - */ - public void setRepeat(int repeat) { - this.repeat = repeat; - } - - /** - * Sets the URL to the background image. - * @param url The URL to set - */ - public void setURL(String url) { - this.url = url; - } - - /** - * Sets the vertical offset for images. - * @param vertical The vertical offset to set - */ - public void setVertical(int vertical) { - this.vertical = vertical; - } - - } - -} - diff --git a/src/org/apache/fop/area/TreeExt.java b/src/org/apache/fop/area/TreeExt.java deleted file mode 100644 index c19420621..000000000 --- a/src/org/apache/fop/area/TreeExt.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * $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 - * 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.area; - -/** - * Area tree extension interface. - * This interface is used by area tree extensions that are handled - * by the renderer. - * When this extension is handled by the area tree it is rendered - * according to the three possibilities, IMMEDIATELY, AFTER_PAGE - * or END_OF_DOC. - */ -public interface TreeExt { - /** - * Render this extension immediately when - * being handled by the area tree. - */ - public static final int IMMEDIATELY = 0; - - /** - * Render this extension after the next page is rendered - * or prepared when being handled by the area tree. - */ - public static final int AFTER_PAGE = 1; - - /** - * Render this extension at the end of the document once - * all pages have been fully rendered. - */ - public static final int END_OF_DOC = 2; - - /** - * Check if this tree extension is also resolveable so that - * the area tree can do id reference resolution when the - * extension is added to the area tree. - * - * @return true if this also implements resolveable - */ - boolean isResolveable(); - - /** - * Get the mime type for the document that this area tree - * extension applies. - * - * @return the mime type of the document where this applies - */ - String getMimeType(); - - /** - * Get the name of this extension. - * - * @return the name of this extension - */ - String getName(); -} diff --git a/src/org/apache/fop/area/inline/Anchor.java b/src/org/apache/fop/area/inline/Anchor.java deleted file mode 100644 index 6c67474f7..000000000 --- a/src/org/apache/fop/area/inline/Anchor.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $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 - * 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.area.inline; - -/** - * Anchor area for footnote or float. - * Not sure if this is needed. - */ -public class Anchor extends InlineArea { - - // has a keep with adjacent area - // has reference to associated footnote or float out-of-line area - -} - diff --git a/src/org/apache/fop/area/inline/Character.java b/src/org/apache/fop/area/inline/Character.java deleted file mode 100644 index db556b942..000000000 --- a/src/org/apache/fop/area/inline/Character.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.render.Renderer; - -/** - * Single character inline area. - * This inline area holds a single character. - */ -public class Character extends InlineArea { - private char character; - - /** - * Create a new characater inline area with the given character. - * - * @param ch the character for this inline area - */ - public Character(char ch) { - character = ch; - } - - /** - * Render this inline area. - * - * @param renderer the renderer to render this character area - */ - public void render(Renderer renderer) { - renderer.renderCharacter(this); - } - - /** - * Get the character for this inline character area. - * - * @return the character - */ - public char getChar() { - return character; - } -} - diff --git a/src/org/apache/fop/area/inline/Container.java b/src/org/apache/fop/area/inline/Container.java deleted file mode 100644 index f6bda328a..000000000 --- a/src/org/apache/fop/area/inline/Container.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.area.Area; -import org.apache.fop.area.Block; - -import java.util.List; -import java.util.ArrayList; - -/** - * Container area for inline container. - * This area should be placed in a viewport as a result of the - * inline container formatting object. - * This allows an inline area to have blocks as children. - */ -public class Container extends Area { - /** - * The list of block areas stacked inside this container - */ - protected List blocks = new ArrayList(); - - /** - * The width of this container - */ - protected int width; - - /** - * Create a new container area - */ - public Container() { - } - - /** - * Add the block to this area. - * - * @param block the block area to add - */ - public void addBlock(Block block) { - blocks.add(block); - } - - /** - * Get the block areas stacked inside this container area. - * - * @return the list of block areas - */ - public List getBlocks() { - return blocks; - } - - /** - * Get the width of this container area. - * - * @return the width - */ - public int getWidth() { - return width; - } -} - diff --git a/src/org/apache/fop/area/inline/FilledArea.java b/src/org/apache/fop/area/inline/FilledArea.java deleted file mode 100644 index edba1f216..000000000 --- a/src/org/apache/fop/area/inline/FilledArea.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import java.util.List; -import java.util.ArrayList; - -/** - * Filled area. - * This inline area contains some inline areas. - * When the renderer gets the child areas to render - * the inline areas are repeated to fill the ipd of - * this inline parent. - * This extends InlineParent so that the renderer will render - * this as a normal inline parent. - */ -public class FilledArea extends InlineParent { - private int unitWidth; - - /** - * Create a new filled area. - */ - public FilledArea() { - } - - /** - * Set the unit width for the areas to fill the full width. - * - * @param w the unit width - */ - public void setUnitWidth(int w) { - unitWidth = w; - } - - /** - * Get the child areas for this filed area. - * This copies the references of the inline areas so that - * it fills the total width of the area a whole number of times - * for the unit width. - * - * @return the list of child areas copied to fill the width - */ - public List getChildAreas() { - int units = (int)(getWidth() / unitWidth); - List newList = new ArrayList(); - for (int count = 0; count < units; count++) { - newList.addAll(inlines); - } - return newList; - } -} - diff --git a/src/org/apache/fop/area/inline/ForeignObject.java b/src/org/apache/fop/area/inline/ForeignObject.java deleted file mode 100644 index 2f3e03ac7..000000000 --- a/src/org/apache/fop/area/inline/ForeignObject.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.area.Area; - -import org.w3c.dom.Document; - -// cacheable object -/** - * Foreign object inline area. - * This inline area represents an instream-foreign object. - * This holds an xml document and the associated namespace. - */ -public class ForeignObject extends Area { - private Document doc; - private String namespace; - - /** - * Create a new foreign object with the given dom and namespace. - * - * @param d the xml document - * @param ns the namespace of the document - */ - public ForeignObject(Document d, String ns) { - doc = d; - namespace = ns; - } - - /** - * Get the document for this foreign object. - * - * @return the xml document - */ - public Document getDocument() { - return doc; - } - - /** - * Get the namespace of this foreign object. - * - * @return the namespace of this document - */ - public String getNameSpace() { - return namespace; - } -} - diff --git a/src/org/apache/fop/area/inline/Image.java b/src/org/apache/fop/area/inline/Image.java deleted file mode 100644 index c72c729c9..000000000 --- a/src/org/apache/fop/area/inline/Image.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.area.Area; - -/** - * Image area for external-graphic. - * This area holds information for rendering an image. - * The url of the image is used as a key to reference the image cache. - */ -public class Image extends Area { - private String url; - - /** - * Create a new image with the given url. - * - * @param u the url of the image - */ - public Image(String u) { - url = u; - } - - /** - * Get the url of this image. - * This url is used as a key to locate the actual image data. - * - * @return the url of this image - */ - public String getURL() { - return url; - } -} - diff --git a/src/org/apache/fop/area/inline/InlineArea.java b/src/org/apache/fop/area/inline/InlineArea.java deleted file mode 100644 index d4d2c5eec..000000000 --- a/src/org/apache/fop/area/inline/InlineArea.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.area.Area; -import org.apache.fop.area.Trait; -import org.apache.fop.render.Renderer; -import org.apache.fop.traits.BorderProps; - -/** - * Inline Area - * This area is for all inline areas that can be placed - * in a line area. - * Extensions of this class should render themselves with the - * requested renderer. - */ -public class InlineArea extends Area { - // int width; - private int height; - /** - * The content ipd of this inline area - */ - protected int contentIPD = 0; - - /** - * offset position from top of parent area - */ - protected int verticalPosition = 0; - - /** - * Render this inline area. - * Inline areas that extend this class are expected - * to implement this method to render themselves in - * the renderer. - * - * @param renderer the renderer to render this inline area - */ - public void render(Renderer renderer) { - } - - /** - * Set the width of this inline area. - * Currently sets the ipd. - * - * @param w the width - */ - public void setWidth(int w) { - contentIPD = w; - } - - /** - * Get the width of this inline area. - * Currently gets the ipd. - * - * @return the width - */ - public int getWidth() { - return contentIPD; - } - - /** - * Set the inline progression dimension of this inline area. - * - * @param ipd the inline progression dimension - */ - public void setIPD(int ipd) { - this.contentIPD = ipd; - } - - /** - * Get the inline progression dimension - * - * @return the inline progression dimension of this area - */ - public int getIPD() { - return this.contentIPD; - } - - /** - * Increase the inline progression dimensions of this area. - * This is used for inline parent areas that contain mulitple child areas. - * - * @param ipd the inline progression to increase by - */ - public void increaseIPD(int ipd) { - this.contentIPD += ipd; - } - - /** - * Set the height of this inline area. - * - * @param h the height value to set - */ - public void setHeight(int h) { - height = h; - } - - /** - * Get the height of this inline area. - * - * @return the height of the inline area - */ - public int getHeight() { - return height; - } - - /** - * Get the allocation inline progression dimension of this area. - * This adds the content, borders and the padding to find the - * total allocated IPD. - * - * @return the total IPD allocation for this area - */ - public int getAllocIPD() { - // If start or end border or padding is non-zero, add to content IPD - int iBP = contentIPD; - Object t; - if ((t = getTrait(Trait.PADDING_START)) != null) { - iBP += ((Integer) t).intValue(); - } - if ((t = getTrait(Trait.PADDING_END)) != null) { - iBP += ((Integer) t).intValue(); - } - if ((t = getTrait(Trait.BORDER_START)) != null) { - iBP += ((BorderProps) t).width; - } - if ((t = getTrait(Trait.BORDER_END)) != null) { - iBP += ((BorderProps) t).width; - } - return iBP; - } - - /** - * Set the offset of this inline area. - * This is used to set the offset of the inline area - * which is normally relative to the top of the line - * or the baseline. - * - * @param v the offset - */ - public void setOffset(int v) { - verticalPosition = v; - } - - /** - * Get the offset of this inline area. - * This returns the offset of the inline area - * which is normally relative to the top of the line - * or the baseline. - * - * @return the offset - */ - public int getOffset() { - return verticalPosition; - } -} - diff --git a/src/org/apache/fop/area/inline/InlineParent.java b/src/org/apache/fop/area/inline/InlineParent.java deleted file mode 100644 index 8a2b11ae5..000000000 --- a/src/org/apache/fop/area/inline/InlineParent.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.area.Area; -import org.apache.fop.render.Renderer; - -import java.util.List; -import java.util.ArrayList; - -/** - * Inline parent area. - * This is an inline area that can have other inlines as children. - */ -public class InlineParent extends InlineArea { - /** - * The list of inline areas added to this inline parent. - */ - protected List inlines = new ArrayList(); - - /** - * An inline parent is a reference area somay have clipping - */ - protected boolean clip = false; - - /** - * Create a new inline parent to add areas to. - */ - public InlineParent() { - } - - /** - * Render this area. - * - * @param renderer the renderer to render this area in - */ - public void render(Renderer renderer) { - renderer.renderInlineParent(this); - } - - /** - * Override generic Area method. - * - * @param childArea the child area to add - */ - public void addChild(Area childArea) { - if (childArea instanceof InlineArea) { - inlines.add(childArea); - increaseIPD(((InlineArea) childArea).getAllocIPD()); - } - } - - /** - * Get the child areas for this inline parent. - * - * @return the list of child areas - */ - public List getChildAreas() { - return inlines; - } - -} - diff --git a/src/org/apache/fop/area/inline/Leader.java b/src/org/apache/fop/area/inline/Leader.java deleted file mode 100644 index b929ecf24..000000000 --- a/src/org/apache/fop/area/inline/Leader.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.render.Renderer; -import org.apache.fop.fo.properties.RuleStyle; - -/** - * This is a leader inline area. - * This class is only used for leader with leader-pattern of rule. - */ -public class Leader extends InlineArea { - - // in the case of use content or dots this is replaced - // with the set of inline areas - // if space replaced with a space - // otherwise this is a holder for a line - - private int ruleStyle = RuleStyle.SOLID; - private int ruleThickness = 1000; - - /** - * Create a new leader area. - */ - public Leader() { - } - - /** - * Set the rule style of this leader area. - * - * @param style the rule style for the leader line - */ - public void setRuleStyle(int style) { - ruleStyle = style; - } - - /** - * Set the rule thickness of the rule in miilipoints. - * - * @param rt the rule thickness in millipoints - */ - public void setRuleThickness(int rt) { - ruleThickness = rt; - } - - /** - * Get the rule style of this leader. - * - * @return the rule style - */ - public int getRuleStyle() { - return ruleStyle; - } - - /** - * Get the rule thickness of the rule in miilipoints. - * - * @return the rule thickness in millipoints - */ - public int getRuleThickness() { - return ruleThickness; - } - - /** - * Render this leader in the current renderer. - * - * @param renderer the renderer to render this inline area - */ - public void render(Renderer renderer) { - renderer.renderLeader(this); - } -} - diff --git a/src/org/apache/fop/area/inline/Space.java b/src/org/apache/fop/area/inline/Space.java deleted file mode 100644 index dd9a4d96d..000000000 --- a/src/org/apache/fop/area/inline/Space.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.render.Renderer; - -/** - * Inline space area. - * This is used for adding a inline space to the output. - */ -public class Space extends InlineArea { - - /** - * Render this inlien space area. - * - * @param renderer the renderer to render this inline area - */ - public void render(Renderer renderer) { - renderer.renderInlineSpace(this); - } -} diff --git a/src/org/apache/fop/area/inline/UnresolvedPageNumber.java b/src/org/apache/fop/area/inline/UnresolvedPageNumber.java deleted file mode 100644 index 9131de24b..000000000 --- a/src/org/apache/fop/area/inline/UnresolvedPageNumber.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.area.PageViewport; -import org.apache.fop.area.Resolveable; - -import java.util.List; - -/** - * Unresolveable page number area. - * This is a word area that resolves itself to a page number - * from an id reference. - */ -public class UnresolvedPageNumber extends Word implements Resolveable { - private boolean resolved = false; - private String pageRefId; - - /** - * Create a new unresolveable page number. - * - * @param id the id reference for resolving this - */ - public UnresolvedPageNumber(String id) { - pageRefId = id; - word = "?"; - } - - /** - * Get the id references for this area. - * - * @return the id reference for this unresolved page number - */ - public String[] getIDs() { - return new String[] {pageRefId}; - } - - /** - * Resolve this page number reference. - * This resolves the reference by getting the page number - * string from the first page in the list of pages that apply - * for the id reference. The word string is then set to the - * page number string. - * - * @param id the id reference being resolved - * @param pages the list of pages for the id reference - */ - public void resolve(String id, List pages) { - resolved = true; - if (pages != null) { - PageViewport page = (PageViewport)pages.get(0); - String str = page.getPageNumber(); - word = str; - - /**@todo Update IPD ??? */ - } - } - - /** - * Check if this is resolved. - * - * @return true when this has been resolved - */ - public boolean isResolved() { - return resolved; - } -} diff --git a/src/org/apache/fop/area/inline/Viewport.java b/src/org/apache/fop/area/inline/Viewport.java deleted file mode 100644 index b0f8cc762..000000000 --- a/src/org/apache/fop/area/inline/Viewport.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.area.Area; -import org.apache.fop.render.Renderer; - -import java.io.IOException; -import java.awt.geom.Rectangle2D; -import java.util.HashMap; - -/** - * Inline viewport area. - * This is an inline-level viewport area for inline container, - * external graphic and instream foreign object. This viewport - * holds the area and positions it. - */ -public class Viewport extends InlineArea { - // contents could be container, foreign object or image - private Area content; - // clipping for the viewport - private boolean clip = false; - // position of the cild area relative to this area - private Rectangle2D contentPosition; - - /** - * Create a new viewport area with the content area. - * - * @param child the child content area of this viewport - */ - public Viewport(Area child) { - content = child; - } - - /** - * Set the clip of this viewport. - * - * @param c true if this viewport should clip - */ - public void setClip(boolean c) { - clip = c; - } - - /** - * Get the clip of this viewport. - * - * @return true if this viewport should clip - */ - public boolean getClip() { - return clip; - } - - /** - * Set the position and size of the content of this viewport. - * - * @param cp the position and size to place the content - */ - public void setContentPosition(Rectangle2D cp) { - contentPosition = cp; - } - - /** - * Get the position and size of the content of this viewport. - * - * @return the position and size to place the content - */ - public Rectangle2D getContentPosition() { - return contentPosition; - } - - /** - * Get the content area for this viewport. - * - * @return the content area - */ - public Area getContent() { - return content; - } - - /** - * Render this inline area. - * - * @param renderer the renderer to render this inline area - */ - public void render(Renderer renderer) { - renderer.renderViewport(this); - } - - private void writeObject(java.io.ObjectOutputStream out) - throws IOException { - out.writeBoolean(contentPosition != null); - if (contentPosition != null) { - out.writeFloat((float) contentPosition.getX()); - out.writeFloat((float) contentPosition.getY()); - out.writeFloat((float) contentPosition.getWidth()); - out.writeFloat((float) contentPosition.getHeight()); - } - out.writeBoolean(clip); - out.writeObject(props); - out.writeObject(content); - } - - private void readObject(java.io.ObjectInputStream in) - throws IOException, ClassNotFoundException { - if (in.readBoolean()) { - contentPosition = new Rectangle2D.Float(in.readFloat(), - in.readFloat(), - in.readFloat(), - in.readFloat()); - } - clip = in.readBoolean(); - props = (HashMap) in.readObject(); - content = (Area) in.readObject(); - } - -} diff --git a/src/org/apache/fop/area/inline/Word.java b/src/org/apache/fop/area/inline/Word.java deleted file mode 100644 index 9b1b36297..000000000 --- a/src/org/apache/fop/area/inline/Word.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * $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 - * 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.area.inline; - -import org.apache.fop.render.Renderer; - -/** - * A word inline area. - * This is really a collection character inline areas collected together - * into a single word. - */ -public class Word extends InlineArea { - /** - * The word for this word area. - */ - protected String word; - private int iWSadjust = 0; - - /** - * Create a word area. - */ - public Word() { - } - - /** - * Render the word to the renderer. - * - * @param renderer the renderer to render this word - */ - public void render(Renderer renderer) { - renderer.renderWord(this); - } - - /** - * Set the word. - * - * @param w the word string - */ - public void setWord(String w) { - word = w; - } - - /** - * Get the word string. - * - * @return the word string - */ - public String getWord() { - return word; - } - - /** - * Get word space adjust. - * - * @return the word space adjustment - */ - public int getWSadjust() { - return iWSadjust; - } - - /** - * Set word space adjust. - * - * @param iWSadjust the word space adjustment - */ - public void setWSadjust(int iWSadjust) { - this.iWSadjust = iWSadjust; - } -} - |