From: Glen Mazza Date: Thu, 17 Jul 2003 04:52:38 +0000 (+0000) Subject: Inter-package references between fo.flow and fo.pagination removed by moving Flow... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1272 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3fff14625687eb95ab55e2d0de7944bd86f2a261;p=xmlgraphics-fop.git Inter-package references between fo.flow and fo.pagination removed by moving Flow and StaticContent classes to pagination package. Pagination.PageSequence and .Root children Title, Declarations, and ColorProfile also moved under pagination. Rationale given here: http://marc.theaimsgroup.com/?l=fop-dev&m=105813290817472&w=2 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196722 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/ColorProfile.java b/src/java/org/apache/fop/fo/ColorProfile.java deleted file mode 100644 index da432d826..000000000 --- a/src/java/org/apache/fop/fo/ColorProfile.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * $Id: ColorProfile.java,v 1.10 2003/03/05 21:48:01 jeremias Exp $ - * ============================================================================ - * 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 . For more information on the Apache - * Software Foundation, please see . - */ -package org.apache.fop.fo; - -// Java -import java.awt.color.ICC_Profile; -import java.awt.color.ICC_ColorSpace; -import java.net.URL; -import java.io.IOException; -import java.io.InputStream; - -// FOP -import org.apache.fop.datatypes.ColorType; - -/** - * The fo:color-profile formatting object. - * This loads the color profile when needed and resolves a requested color. - */ -public class ColorProfile extends FObj { - private int intent; - private String src; - private String profileName; - private ICC_ColorSpace colorSpace = null; - - /** - * @see org.apache.fop.fo.FONode#FONode(FONode) - */ - protected ColorProfile(FONode parent) { - super(parent); - } - - public void end() { - src = this.properties.get("src").getString(); - profileName = this.properties.get("color-profile-name").getString(); - intent = this.properties.get("rendering-intent").getEnum(); - this.properties = null; - } - - /** - * Get the name of this color profile. - */ - public String getProfileName() { - return profileName; - } - - /** - * Get the color specified with the color values from the color profile. - * The default values are used if the profile could not be loaded - * or the value is not found. - */ - public ColorType getColor(int[] colorVals, int defR, int defG, int defB) { - // float[] rgbvals = colorSpace.toRGB(colorVals); - // return new ColorType(rgbvals); - return null; - } - - /** - * Load the color profile. - */ - private void load() { - try { - URL url = new URL(src); - InputStream is = url.openStream(); - ICC_Profile iccProfile = ICC_Profile.getInstance(is); - colorSpace = new ICC_ColorSpace(iccProfile); - } catch (IOException ioe) { - getLogger().error("Could not read Color Profile src", ioe); - } catch (IllegalArgumentException iae) { - getLogger().error("Color Profile src not an ICC Profile", iae); - } - } -} diff --git a/src/java/org/apache/fop/fo/Declarations.java b/src/java/org/apache/fop/fo/Declarations.java deleted file mode 100644 index 6dfb9aa61..000000000 --- a/src/java/org/apache/fop/fo/Declarations.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * $Id: Declarations.java,v 1.8 2003/03/05 21:48:01 jeremias Exp $ - * ============================================================================ - * 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 . For more information on the Apache - * Software Foundation, please see . - */ -package org.apache.fop.fo; - -// Java -import java.util.List; -import java.util.Map; -import java.util.Iterator; - -/** - * Declarations formatting object. - * A declarations formatting object holds a set of color-profiles - * and optionally additional non-XSL namespace elements. - * The color-profiles are held in a hashmap for use with color-profile - * references. - */ -public class Declarations extends FObj { - - private Map colorProfiles = null; - private List external = null; - - protected Declarations(FONode parent) { - super(parent); - } - - /** - * At then end of this element sort out the child into - * a hashmap of color profiles and a list of external xml. - */ - public void end() { - for (Iterator iter = children.iterator(); iter.hasNext();) { - FONode node = (FONode)iter.next(); - if (node.getName().equals("fo:color-profile")) { - ColorProfile cp = (ColorProfile)node; - if (!"".equals(cp.getProfileName())) { - if (colorProfiles == null) { - colorProfiles = new java.util.HashMap(); - } - if (colorProfiles.get(cp.getProfileName()) != null) { - // duplicate names - getLogger().warn("Duplicate fo:color-profile profile name : " - + cp.getProfileName()); - } - colorProfiles.put(cp.getProfileName(), cp); - } else { - getLogger().warn("color-profile-name required for color profile"); - } - } else if (node instanceof XMLObj) { - if (external == null) { - external = new java.util.ArrayList(); - } - external.add(node); - } else { - getLogger().warn("invalid element " + node.getName() + "inside declarations"); - } - } - children = null; - } -} diff --git a/src/java/org/apache/fop/fo/FOElementMapping.java b/src/java/org/apache/fop/fo/FOElementMapping.java index 4dce2889a..0736a47bb 100644 --- a/src/java/org/apache/fop/fo/FOElementMapping.java +++ b/src/java/org/apache/fop/fo/FOElementMapping.java @@ -160,13 +160,13 @@ public class FOElementMapping extends ElementMapping { static class Dec extends ElementMapping.Maker { public FONode make(FONode parent) { - return new Declarations(parent); + return new org.apache.fop.fo.pagination.Declarations(parent); } } static class CP extends ElementMapping.Maker { public FONode make(FONode parent) { - return new ColorProfile(parent); + return new org.apache.fop.fo.pagination.ColorProfile(parent); } } @@ -250,19 +250,19 @@ public class FOElementMapping extends ElementMapping { static class Fl extends ElementMapping.Maker { public FONode make(FONode parent) { - return new org.apache.fop.fo.flow.Flow(parent); + return new org.apache.fop.fo.pagination.Flow(parent); } } static class SC extends ElementMapping.Maker { public FONode make(FONode parent) { - return new org.apache.fop.fo.flow.StaticContent(parent); + return new org.apache.fop.fo.pagination.StaticContent(parent); } } static class T extends ElementMapping.Maker { public FONode make(FONode parent) { - return new Title(parent); + return new org.apache.fop.fo.pagination.Title(parent); } } diff --git a/src/java/org/apache/fop/fo/StructureHandler.java b/src/java/org/apache/fop/fo/StructureHandler.java index 89d6f6f7a..1d5f5711d 100644 --- a/src/java/org/apache/fop/fo/StructureHandler.java +++ b/src/java/org/apache/fop/fo/StructureHandler.java @@ -61,7 +61,6 @@ import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.flow.ExternalGraphic; -import org.apache.fop.fo.flow.Flow; import org.apache.fop.fo.flow.InstreamForeignObject; import org.apache.fop.fo.flow.Leader; import org.apache.fop.fo.flow.ListBlock; @@ -70,6 +69,7 @@ import org.apache.fop.fo.flow.Table; import org.apache.fop.fo.flow.TableBody; import org.apache.fop.fo.flow.TableCell; import org.apache.fop.fo.flow.TableRow; +import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.layout.FontInfo; diff --git a/src/java/org/apache/fop/fo/Title.java b/src/java/org/apache/fop/fo/Title.java deleted file mode 100644 index 4857e0830..000000000 --- a/src/java/org/apache/fop/fo/Title.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * $Id: Title.java,v 1.15 2003/03/05 21:48:01 jeremias Exp $ - * ============================================================================ - * 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 . For more information on the Apache - * Software Foundation, please see . - */ -package org.apache.fop.fo; - -// FOP -import org.apache.fop.datatypes.ColorType; -import org.apache.fop.datatypes.Length; -import org.apache.fop.layout.AccessibilityProps; -import org.apache.fop.layout.AuralProps; -import org.apache.fop.layout.BackgroundProps; -import org.apache.fop.layout.BorderAndPadding; -import org.apache.fop.layout.FontState; -import org.apache.fop.layout.MarginInlineProps; -import org.apache.fop.layoutmgr.ContentLayoutManager; -import org.apache.fop.layoutmgr.InlineStackingLayoutManager; -import org.apache.fop.layoutmgr.LMiter; - -/** - * Class modelling the fo:title object. See Sec. 6.4.20 in the XSL-FO Standard. - */ -public class Title extends FObjMixed { - - /** - * @param parent FONode that is the parent of this object - */ - public Title(FONode parent) { - super(parent); - } - - /** - * TODO: shouldn't this code be in Layout?? - * @return the Title area - */ - public org.apache.fop.area.Title getTitleArea() { - org.apache.fop.area.Title title = - new org.apache.fop.area.Title(); - // use special layout manager to add the inline areas - // to the Title. - InlineStackingLayoutManager lm; - lm = new InlineStackingLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - lm.setLMiter(new LMiter(children.listIterator())); - lm.init(); - - // get breaks then add areas to title - - ContentLayoutManager clm = new ContentLayoutManager(title); - clm.setUserAgent(getUserAgent()); - lm.setParent(clm); - - clm.fillArea(lm); - - return title; - } - - private void setup() { - - // Common Accessibility Properties - AccessibilityProps mAccProps = propMgr.getAccessibilityProps(); - - // Common Aural Properties - AuralProps mAurProps = propMgr.getAuralProps(); - - // Common Border, Padding, and Background Properties - BorderAndPadding bap = propMgr.getBorderAndPadding(); - BackgroundProps bProps = propMgr.getBackgroundProps(); - - // Common Font Properties - FontState fontState = propMgr.getFontState(structHandler.getFontInfo()); - - // Common Margin Properties-Inline - MarginInlineProps mProps = propMgr.getMarginInlineProps(); - - Property prop; - prop = this.properties.get("baseline-shift"); - if (prop instanceof LengthProperty) { - Length bShift = prop.getLength(); - } else if (prop instanceof EnumProperty) { - int bShift = prop.getEnum(); - } - ColorType col = this.properties.get("color").getColorType(); - Length lHeight = this.properties.get("line-height").getLength(); - int lShiftAdj = this.properties.get( - "line-height-shift-adjustment").getEnum(); - int vis = this.properties.get("visibility").getEnum(); - Length zIndex = this.properties.get("z-index").getLength(); - - } -} - diff --git a/src/java/org/apache/fop/fo/flow/Flow.java b/src/java/org/apache/fop/fo/flow/Flow.java deleted file mode 100644 index d66799592..000000000 --- a/src/java/org/apache/fop/fo/flow/Flow.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * $Id: Flow.java,v 1.37 2003/03/06 11:36:30 jeremias Exp $ - * ============================================================================ - * 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 . For more information on the Apache - * Software Foundation, please see . - */ -package org.apache.fop.fo.flow; - -// Java -import java.util.ArrayList; -import java.util.List; - -// XML -import org.xml.sax.Attributes; - -// FOP -import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObj; -import org.apache.fop.fo.pagination.PageSequence; -import org.apache.fop.apps.FOPException; -import org.apache.fop.layoutmgr.FlowLayoutManager; - -/** - * Class modelling the fo:flow object. See Sec. 6.4.18 in the XSL-FO Standard. - */ -public class Flow extends FObj { - - /** - * PageSequence container - */ - private PageSequence pageSequence; - - /** - * ArrayList to store snapshot - */ - private ArrayList markerSnapshot; - - /** - * flow-name attribute - */ - private String flowName; - - /** - * Content-width of current column area during layout - */ - private int contentWidth; - - /** - * @param parent FONode that is the parent of this object - */ - public Flow(FONode parent) { - super(parent); - } - - /** - * @see org.apache.fop.fo.FObj#handleAttrs - * @param attlist Collection of attributes passed to us from the parser. - * @throws FOPException if parent is not a page-sequence object - */ - public void handleAttrs(Attributes attlist) throws FOPException { - super.handleAttrs(attlist); - if (parent.getName().equals("fo:page-sequence")) { - this.pageSequence = (PageSequence) parent; - } else { - throw new FOPException("flow must be child of " - + "page-sequence, not " + parent.getName()); - } - // according to communication from Paul Grosso (XSL-List, - // 001228, Number 406), confusion in spec section 6.4.5 about - // multiplicity of fo:flow in XSL 1.0 is cleared up - one (1) - // fo:flow per fo:page-sequence only. - - /* if (pageSequence.isFlowSet()) { - if (this.name.equals("fo:flow")) { - throw new FOPException("Only a single fo:flow permitted" - + " per fo:page-sequence"); - } else { - throw new FOPException(this.name - + " not allowed after fo:flow"); - } - } - */ - setFlowName(getProperty("flow-name").getString()); - // Now done in addChild of page-sequence - //pageSequence.addFlow(this); - - structHandler.startFlow(this); - } - - /** - * Tell the StructureRenderer that we are at the end of the flow. - */ - public void end() { - structHandler.endFlow(this); - } - - /** - * @param name the name of the flow to set - * @throws FOPException for an empty name - */ - protected void setFlowName(String name) throws FOPException { - if (name == null || name.equals("")) { - throw new FOPException("A 'flow-name' is required for " - + getName()); - } else { - flowName = name; - } - } - - /** - * @return the name of this flow - */ - public String getFlowName() { - return flowName; - } - - /** - * @param contentWidth content width of this flow, in millipoints (??) - */ - protected void setContentWidth(int contentWidth) { - this.contentWidth = contentWidth; - } - /** - * @return the content width of this flow (really of the region - * in which it is flowing), in millipoints (??). - */ - public int getContentWidth() { - return this.contentWidth; - } - - /** - * @return true (Flow can generate reference areas) - */ - public boolean generatesReferenceAreas() { - return true; - } - - /** - * @see org.apache.fop.fo.FObj#addLayoutManager - */ - public void addLayoutManager(List list) { - FlowLayoutManager lm = new FlowLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - list.add(lm); - } - -} diff --git a/src/java/org/apache/fop/fo/flow/StaticContent.java b/src/java/org/apache/fop/fo/flow/StaticContent.java deleted file mode 100644 index 6ded5505d..000000000 --- a/src/java/org/apache/fop/fo/flow/StaticContent.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * $Id: StaticContent.java,v 1.26 2003/03/06 11:36:30 jeremias Exp $ - * ============================================================================ - * 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 . For more information on the Apache - * Software Foundation, please see . - */ -package org.apache.fop.fo.flow; - -// FOP -import org.apache.fop.fo.FONode; -import org.apache.fop.apps.FOPException; -import org.apache.fop.layoutmgr.StaticContentLayoutManager; - -/** - * Class modelling the fo:static-content object. See Sec. 6.4.19 of the XSL-FO - * Standard. - */ -public class StaticContent extends Flow { - - /** - * @param parent FONode that is the parent of this object - */ - public StaticContent(FONode parent) { - super(parent); - } - - private void setup() { - } - - /** - * flowname checking is more stringient for static content currently - * @param name the flow-name to set - * @throws FOPException for a missing flow name - */ - protected void setFlowName(String name) throws FOPException { - if (name == null || name.equals("")) { - throw new FOPException("A 'flow-name' is required for " - + getName() + "."); - } else { - super.setFlowName(name); - } - - } - - private StaticContentLayoutManager lm; - - /** - * @return this object's layout manager - */ - public StaticContentLayoutManager getLayoutManager() { - if (lm == null) { - lm = new StaticContentLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.setFObj(this); - } - return lm; - } - -} diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/java/org/apache/fop/fo/pagination/ColorProfile.java new file mode 100644 index 000000000..12413aec8 --- /dev/null +++ b/src/java/org/apache/fop/fo/pagination/ColorProfile.java @@ -0,0 +1,122 @@ +/* + * $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 . For more information on the Apache + * Software Foundation, please see . + */ +package org.apache.fop.fo.pagination; + +// Java +import java.awt.color.ICC_Profile; +import java.awt.color.ICC_ColorSpace; +import java.net.URL; +import java.io.IOException; +import java.io.InputStream; + +// FOP +import org.apache.fop.datatypes.ColorType; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FObj; + +/** + * The fo:color-profile formatting object. + * This loads the color profile when needed and resolves a requested color. + */ +public class ColorProfile extends FObj { + private int intent; + private String src; + private String profileName; + private ICC_ColorSpace colorSpace = null; + + /** + * @see org.apache.fop.fo.FONode#FONode(FONode) + */ + public ColorProfile(FONode parent) { + super(parent); + } + + public void end() { + src = this.properties.get("src").getString(); + profileName = this.properties.get("color-profile-name").getString(); + intent = this.properties.get("rendering-intent").getEnum(); + this.properties = null; + } + + /** + * Get the name of this color profile. + */ + public String getProfileName() { + return profileName; + } + + /** + * Get the color specified with the color values from the color profile. + * The default values are used if the profile could not be loaded + * or the value is not found. + */ + public ColorType getColor(int[] colorVals, int defR, int defG, int defB) { + // float[] rgbvals = colorSpace.toRGB(colorVals); + // return new ColorType(rgbvals); + return null; + } + + /** + * Load the color profile. + */ + private void load() { + try { + URL url = new URL(src); + InputStream is = url.openStream(); + ICC_Profile iccProfile = ICC_Profile.getInstance(is); + colorSpace = new ICC_ColorSpace(iccProfile); + } catch (IOException ioe) { + getLogger().error("Could not read Color Profile src", ioe); + } catch (IllegalArgumentException iae) { + getLogger().error("Color Profile src not an ICC Profile", iae); + } + } +} diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java new file mode 100644 index 000000000..c1bc817f9 --- /dev/null +++ b/src/java/org/apache/fop/fo/pagination/Declarations.java @@ -0,0 +1,113 @@ +/* + * $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 . For more information on the Apache + * Software Foundation, please see . + */ +package org.apache.fop.fo.pagination; + +// Java +import java.util.List; +import java.util.Map; +import java.util.Iterator; + +// FOP +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FObj; +import org.apache.fop.fo.XMLObj; + + +/** + * Declarations formatting object. + * A declarations formatting object holds a set of color-profiles + * and optionally additional non-XSL namespace elements. + * The color-profiles are held in a hashmap for use with color-profile + * references. + */ +public class Declarations extends FObj { + + private Map colorProfiles = null; + private List external = null; + + public Declarations(FONode parent) { + super(parent); + } + + /** + * At then end of this element sort out the child into + * a hashmap of color profiles and a list of external xml. + */ + public void end() { + for (Iterator iter = children.iterator(); iter.hasNext();) { + FONode node = (FONode)iter.next(); + if (node.getName().equals("fo:color-profile")) { + ColorProfile cp = (ColorProfile)node; + if (!"".equals(cp.getProfileName())) { + if (colorProfiles == null) { + colorProfiles = new java.util.HashMap(); + } + if (colorProfiles.get(cp.getProfileName()) != null) { + // duplicate names + getLogger().warn("Duplicate fo:color-profile profile name : " + + cp.getProfileName()); + } + colorProfiles.put(cp.getProfileName(), cp); + } else { + getLogger().warn("color-profile-name required for color profile"); + } + } else if (node instanceof XMLObj) { + if (external == null) { + external = new java.util.ArrayList(); + } + external.add(node); + } else { + getLogger().warn("invalid element " + node.getName() + "inside declarations"); + } + } + children = null; + } +} diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java new file mode 100644 index 000000000..3bcaf5d35 --- /dev/null +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -0,0 +1,191 @@ +/* + * $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 . For more information on the Apache + * Software Foundation, please see . + */ +package org.apache.fop.fo.pagination; + +// Java +import java.util.ArrayList; +import java.util.List; + +// XML +import org.xml.sax.Attributes; + +// FOP +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.FObj; +import org.apache.fop.apps.FOPException; +import org.apache.fop.layoutmgr.FlowLayoutManager; + +/** + * Class modelling the fo:flow object. See Sec. 6.4.18 in the XSL-FO Standard. + */ +public class Flow extends FObj { + + /** + * PageSequence container + */ + private PageSequence pageSequence; + + /** + * ArrayList to store snapshot + */ + private ArrayList markerSnapshot; + + /** + * flow-name attribute + */ + private String flowName; + + /** + * Content-width of current column area during layout + */ + private int contentWidth; + + /** + * @param parent FONode that is the parent of this object + */ + public Flow(FONode parent) { + super(parent); + } + + /** + * @see org.apache.fop.fo.FObj#handleAttrs + * @param attlist Collection of attributes passed to us from the parser. + * @throws FOPException if parent is not a page-sequence object + */ + public void handleAttrs(Attributes attlist) throws FOPException { + super.handleAttrs(attlist); + if (parent.getName().equals("fo:page-sequence")) { + this.pageSequence = (PageSequence) parent; + } else { + throw new FOPException("flow must be child of " + + "page-sequence, not " + parent.getName()); + } + // according to communication from Paul Grosso (XSL-List, + // 001228, Number 406), confusion in spec section 6.4.5 about + // multiplicity of fo:flow in XSL 1.0 is cleared up - one (1) + // fo:flow per fo:page-sequence only. + + /* if (pageSequence.isFlowSet()) { + if (this.name.equals("fo:flow")) { + throw new FOPException("Only a single fo:flow permitted" + + " per fo:page-sequence"); + } else { + throw new FOPException(this.name + + " not allowed after fo:flow"); + } + } + */ + setFlowName(getProperty("flow-name").getString()); + // Now done in addChild of page-sequence + //pageSequence.addFlow(this); + + structHandler.startFlow(this); + } + + /** + * Tell the StructureRenderer that we are at the end of the flow. + */ + public void end() { + structHandler.endFlow(this); + } + + /** + * @param name the name of the flow to set + * @throws FOPException for an empty name + */ + protected void setFlowName(String name) throws FOPException { + if (name == null || name.equals("")) { + throw new FOPException("A 'flow-name' is required for " + + getName()); + } else { + flowName = name; + } + } + + /** + * @return the name of this flow + */ + public String getFlowName() { + return flowName; + } + + /** + * @param contentWidth content width of this flow, in millipoints (??) + */ + protected void setContentWidth(int contentWidth) { + this.contentWidth = contentWidth; + } + /** + * @return the content width of this flow (really of the region + * in which it is flowing), in millipoints (??). + */ + public int getContentWidth() { + return this.contentWidth; + } + + /** + * @return true (Flow can generate reference areas) + */ + public boolean generatesReferenceAreas() { + return true; + } + + /** + * @see org.apache.fop.fo.FObj#addLayoutManager + */ + public void addLayoutManager(List list) { + FlowLayoutManager lm = new FlowLayoutManager(); + lm.setUserAgent(getUserAgent()); + lm.setFObj(this); + list.add(lm); + } + +} diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index dcb8c6b48..892a67c8b 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -53,9 +53,6 @@ package org.apache.fop.fo.pagination; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; -import org.apache.fop.fo.Title; -import org.apache.fop.fo.flow.Flow; -import org.apache.fop.fo.flow.StaticContent; import org.apache.fop.layout.PageMaster; import org.apache.fop.area.AreaTree; import org.apache.fop.area.PageViewport; diff --git a/src/java/org/apache/fop/fo/pagination/StaticContent.java b/src/java/org/apache/fop/fo/pagination/StaticContent.java new file mode 100644 index 000000000..d18d6d798 --- /dev/null +++ b/src/java/org/apache/fop/fo/pagination/StaticContent.java @@ -0,0 +1,103 @@ +/* + * $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 . For more information on the Apache + * Software Foundation, please see . + */ +package org.apache.fop.fo.pagination; + +// FOP +import org.apache.fop.fo.FONode; +import org.apache.fop.apps.FOPException; +import org.apache.fop.layoutmgr.StaticContentLayoutManager; + +/** + * Class modelling the fo:static-content object. See Sec. 6.4.19 of the XSL-FO + * Standard. + */ +public class StaticContent extends Flow { + + /** + * @param parent FONode that is the parent of this object + */ + public StaticContent(FONode parent) { + super(parent); + } + + private void setup() { + } + + /** + * flowname checking is more stringient for static content currently + * @param name the flow-name to set + * @throws FOPException for a missing flow name + */ + protected void setFlowName(String name) throws FOPException { + if (name == null || name.equals("")) { + throw new FOPException("A 'flow-name' is required for " + + getName() + "."); + } else { + super.setFlowName(name); + } + + } + + private StaticContentLayoutManager lm; + + /** + * @return this object's layout manager + */ + public StaticContentLayoutManager getLayoutManager() { + if (lm == null) { + lm = new StaticContentLayoutManager(); + lm.setUserAgent(getUserAgent()); + lm.setFObj(this); + } + return lm; + } + +} diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java new file mode 100644 index 000000000..7389e0fce --- /dev/null +++ b/src/java/org/apache/fop/fo/pagination/Title.java @@ -0,0 +1,144 @@ +/* + * $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 . For more information on the Apache + * Software Foundation, please see . + */ +package org.apache.fop.fo.pagination; + +// FOP +import org.apache.fop.datatypes.ColorType; +import org.apache.fop.datatypes.Length; +import org.apache.fop.fo.EnumProperty; +import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.LengthProperty; +import org.apache.fop.fo.Property; +import org.apache.fop.layout.AccessibilityProps; +import org.apache.fop.layout.AuralProps; +import org.apache.fop.layout.BackgroundProps; +import org.apache.fop.layout.BorderAndPadding; +import org.apache.fop.layout.FontState; +import org.apache.fop.layout.MarginInlineProps; +import org.apache.fop.layoutmgr.ContentLayoutManager; +import org.apache.fop.layoutmgr.InlineStackingLayoutManager; +import org.apache.fop.layoutmgr.LMiter; + +/** + * Class modelling the fo:title object. See Sec. 6.4.20 in the XSL-FO Standard. + */ +public class Title extends FObjMixed { + + /** + * @param parent FONode that is the parent of this object + */ + public Title(FONode parent) { + super(parent); + } + + /** + * TODO: shouldn't this code be in Layout?? + * @return the Title area + */ + public org.apache.fop.area.Title getTitleArea() { + org.apache.fop.area.Title title = + new org.apache.fop.area.Title(); + // use special layout manager to add the inline areas + // to the Title. + InlineStackingLayoutManager lm; + lm = new InlineStackingLayoutManager(); + lm.setUserAgent(getUserAgent()); + lm.setFObj(this); + lm.setLMiter(new LMiter(children.listIterator())); + lm.init(); + + // get breaks then add areas to title + + ContentLayoutManager clm = new ContentLayoutManager(title); + clm.setUserAgent(getUserAgent()); + lm.setParent(clm); + + clm.fillArea(lm); + + return title; + } + + private void setup() { + + // Common Accessibility Properties + AccessibilityProps mAccProps = propMgr.getAccessibilityProps(); + + // Common Aural Properties + AuralProps mAurProps = propMgr.getAuralProps(); + + // Common Border, Padding, and Background Properties + BorderAndPadding bap = propMgr.getBorderAndPadding(); + BackgroundProps bProps = propMgr.getBackgroundProps(); + + // Common Font Properties + FontState fontState = propMgr.getFontState(structHandler.getFontInfo()); + + // Common Margin Properties-Inline + MarginInlineProps mProps = propMgr.getMarginInlineProps(); + + Property prop; + prop = this.properties.get("baseline-shift"); + if (prop instanceof LengthProperty) { + Length bShift = prop.getLength(); + } else if (prop instanceof EnumProperty) { + int bShift = prop.getEnum(); + } + ColorType col = this.properties.get("color").getColorType(); + Length lHeight = this.properties.get("line-height").getLength(); + int lShiftAdj = this.properties.get( + "line-height-shift-adjustment").getEnum(); + int vis = this.properties.get("visibility").getEnum(); + Length zIndex = this.properties.get("z-index").getLength(); + + } +} + diff --git a/src/java/org/apache/fop/layoutmgr/LayoutHandler.java b/src/java/org/apache/fop/layoutmgr/LayoutHandler.java index e3986d17e..4a2a89fec 100644 --- a/src/java/org/apache/fop/layoutmgr/LayoutHandler.java +++ b/src/java/org/apache/fop/layoutmgr/LayoutHandler.java @@ -66,11 +66,7 @@ import org.apache.fop.area.StorePagesModel; import org.apache.fop.area.Title; import org.apache.fop.area.TreeExt; import org.apache.fop.fo.StructureHandler; -import org.apache.fop.fo.pagination.PageSequence; -import org.apache.fop.layout.FontInfo; -import org.apache.fop.render.Renderer; import org.apache.fop.fo.flow.Block; -import org.apache.fop.fo.flow.Flow; import org.apache.fop.fo.flow.ExternalGraphic; import org.apache.fop.fo.flow.InstreamForeignObject; import org.apache.fop.fo.flow.Leader; @@ -80,6 +76,10 @@ import org.apache.fop.fo.flow.Table; import org.apache.fop.fo.flow.TableBody; import org.apache.fop.fo.flow.TableCell; import org.apache.fop.fo.flow.TableRow; +import org.apache.fop.fo.pagination.Flow; +import org.apache.fop.fo.pagination.PageSequence; +import org.apache.fop.layout.FontInfo; +import org.apache.fop.render.Renderer; /** * Layout handler that receives the structure events. diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java index e179edddf..dd65ad663 100644 --- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -65,13 +65,13 @@ import org.apache.fop.area.BeforeFloat; import org.apache.fop.area.Footnote; import org.apache.fop.area.Resolveable; import org.apache.fop.fo.flow.Marker; -import org.apache.fop.fo.flow.StaticContent; +import org.apache.fop.fo.properties.Constants; +import org.apache.fop.fo.pagination.PageNumberGenerator; import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.Region; -import org.apache.fop.fo.pagination.SimplePageMaster; -import org.apache.fop.fo.pagination.PageNumberGenerator; -import org.apache.fop.fo.properties.Constants; import org.apache.fop.fo.properties.RetrieveBoundary; +import org.apache.fop.fo.pagination.SimplePageMaster; +import org.apache.fop.fo.pagination.StaticContent; import java.util.ArrayList; import java.util.List; diff --git a/src/java/org/apache/fop/mif/MIFHandler.java b/src/java/org/apache/fop/mif/MIFHandler.java index 5685dcf08..c8f2132a9 100644 --- a/src/java/org/apache/fop/mif/MIFHandler.java +++ b/src/java/org/apache/fop/mif/MIFHandler.java @@ -60,7 +60,7 @@ import org.xml.sax.SAXException; // FOP import org.apache.fop.fo.StructureHandler; import org.apache.fop.fo.flow.Block; -import org.apache.fop.fo.flow.Flow; +import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.PageSequenceMaster; import org.apache.fop.fo.pagination.SimplePageMaster; diff --git a/src/java/org/apache/fop/rtf/renderer/RTFHandler.java b/src/java/org/apache/fop/rtf/renderer/RTFHandler.java index a06521ecd..03b5346fb 100644 --- a/src/java/org/apache/fop/rtf/renderer/RTFHandler.java +++ b/src/java/org/apache/fop/rtf/renderer/RTFHandler.java @@ -60,7 +60,6 @@ import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.StructureHandler; import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.flow.ExternalGraphic; -import org.apache.fop.fo.flow.Flow; import org.apache.fop.fo.flow.InstreamForeignObject; import org.apache.fop.fo.flow.Leader; import org.apache.fop.fo.flow.ListBlock; @@ -69,6 +68,7 @@ import org.apache.fop.fo.flow.Table; import org.apache.fop.fo.flow.TableBody; import org.apache.fop.fo.flow.TableCell; import org.apache.fop.fo.flow.TableRow; +import org.apache.fop.fo.pagination.Flow; import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.properties.Constants; import org.apache.fop.layout.FontInfo;