From 173ebbd7275a41c3c525a2b5ea373c55956c01f0 Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Wed, 24 Jan 2001 00:35:40 +0000 Subject: [PATCH] moved inline objects to the layout.inline package added WordArea as an inline object to represent a word git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193980 13f79535-47bb-0310-9956-ffa450edef68 --- .../{ => inline}/ForeignObjectArea.java | 3 +- .../fop/layout/{ => inline}/InlineArea.java | 47 ++++++---- .../fop/layout/{ => inline}/InlineSpace.java | 3 +- .../fop/layout/{ => inline}/LeaderArea.java | 5 +- .../{ => inline}/PageNumberInlineArea.java | 5 +- .../apache/fop/layout/inline/WordArea.java | 89 +++++++++++++++++++ 6 files changed, 131 insertions(+), 21 deletions(-) rename src/org/apache/fop/layout/{ => inline}/ForeignObjectArea.java (98%) rename src/org/apache/fop/layout/{ => inline}/InlineArea.java (80%) rename src/org/apache/fop/layout/{ => inline}/InlineSpace.java (98%) rename src/org/apache/fop/layout/{ => inline}/LeaderArea.java (96%) rename src/org/apache/fop/layout/{ => inline}/PageNumberInlineArea.java (96%) create mode 100644 src/org/apache/fop/layout/inline/WordArea.java diff --git a/src/org/apache/fop/layout/ForeignObjectArea.java b/src/org/apache/fop/layout/inline/ForeignObjectArea.java similarity index 98% rename from src/org/apache/fop/layout/ForeignObjectArea.java rename to src/org/apache/fop/layout/inline/ForeignObjectArea.java index b067eed16..2939b9955 100644 --- a/src/org/apache/fop/layout/ForeignObjectArea.java +++ b/src/org/apache/fop/layout/inline/ForeignObjectArea.java @@ -48,10 +48,11 @@ Software Foundation, please see . */ -package org.apache.fop.layout; +package org.apache.fop.layout.inline; // FOP import org.apache.fop.render.Renderer; +import org.apache.fop.layout.*; // Java import java.util.Vector; diff --git a/src/org/apache/fop/layout/InlineArea.java b/src/org/apache/fop/layout/inline/InlineArea.java similarity index 80% rename from src/org/apache/fop/layout/InlineArea.java rename to src/org/apache/fop/layout/inline/InlineArea.java index 41b3f3a02..0d85b7446 100644 --- a/src/org/apache/fop/layout/InlineArea.java +++ b/src/org/apache/fop/layout/inline/InlineArea.java @@ -48,13 +48,18 @@ Software Foundation, please see . */ -package org.apache.fop.layout; +package org.apache.fop.layout.inline; import org.apache.fop.render.Renderer; +import org.apache.fop.layout.Area; +import org.apache.fop.layout.FontState; +import org.apache.fop.layout.*; -public class InlineArea extends Area { +public abstract class InlineArea extends Area { - private String text; + private int yOffset = 0; + private int height = 0; + private int verticalAlign = 0; protected String pageNumberId = null; private float red, green, blue; @@ -64,20 +69,12 @@ public class InlineArea extends Area { protected boolean lineThrough = false; - public InlineArea(FontState fontState, float red, float green, - float blue, String text, int width) { + public InlineArea(FontState fontState, int width, float red, float green, + float blue) { super(fontState); - this.red = red; - this.green = green; - this.blue = blue; - this.text = text; this.contentRectangleWidth = width; } - public void render(Renderer renderer) { - renderer.renderInlineArea(this); - } - public float getBlue() { return this.blue; } @@ -90,8 +87,28 @@ public class InlineArea extends Area { return this.red; } - public String getText() { - return this.text; + public void setHeight(int height) { + this.height = height; + } + + public int getHeight() { + return this.height; + } + + public void setVerticalAlign(int align) { + this.verticalAlign = align; + } + + public int getVerticalAlign() { + return this.verticalAlign; + } + + public void setYOffset(int yOffset) { + this.yOffset = yOffset; + } + + public int getYOffset() { + return this.yOffset; } public String getPageNumberID() { diff --git a/src/org/apache/fop/layout/InlineSpace.java b/src/org/apache/fop/layout/inline/InlineSpace.java similarity index 98% rename from src/org/apache/fop/layout/InlineSpace.java rename to src/org/apache/fop/layout/inline/InlineSpace.java index 95a9efb96..1e3b58001 100644 --- a/src/org/apache/fop/layout/InlineSpace.java +++ b/src/org/apache/fop/layout/inline/InlineSpace.java @@ -48,9 +48,10 @@ Software Foundation, please see . */ -package org.apache.fop.layout; +package org.apache.fop.layout.inline; import org.apache.fop.render.Renderer; +import org.apache.fop.layout.*; public class InlineSpace extends Space { private int size; // in millipoints diff --git a/src/org/apache/fop/layout/LeaderArea.java b/src/org/apache/fop/layout/inline/LeaderArea.java similarity index 96% rename from src/org/apache/fop/layout/LeaderArea.java rename to src/org/apache/fop/layout/inline/LeaderArea.java index 3fbdd919b..9366e5fc3 100644 --- a/src/org/apache/fop/layout/LeaderArea.java +++ b/src/org/apache/fop/layout/inline/LeaderArea.java @@ -48,9 +48,10 @@ Software Foundation, please see . */ -package org.apache.fop.layout; +package org.apache.fop.layout.inline; import org.apache.fop.render.Renderer; +import org.apache.fop.layout.*; import java.util.Vector; import java.util.Enumeration; @@ -66,7 +67,7 @@ public class LeaderArea extends InlineArea { public LeaderArea(FontState fontState, float red, float green, float blue, String text, int leaderLengthOptimum, int leaderPattern, int ruleThickness, int ruleStyle) { - super(fontState, red, green, blue, text, leaderLengthOptimum); + super(fontState, leaderLengthOptimum, red, green, blue); this.leaderPattern = leaderPattern; this.leaderLengthOptimum = leaderLengthOptimum; diff --git a/src/org/apache/fop/layout/PageNumberInlineArea.java b/src/org/apache/fop/layout/inline/PageNumberInlineArea.java similarity index 96% rename from src/org/apache/fop/layout/PageNumberInlineArea.java rename to src/org/apache/fop/layout/inline/PageNumberInlineArea.java index 7b56cab10..614c51a43 100644 --- a/src/org/apache/fop/layout/PageNumberInlineArea.java +++ b/src/org/apache/fop/layout/inline/PageNumberInlineArea.java @@ -48,12 +48,13 @@ Software Foundation, please see . */ -package org.apache.fop.layout; +package org.apache.fop.layout.inline; import org.apache.fop.render.Renderer; import org.apache.fop.datatypes.IDNode; +import org.apache.fop.layout.*; -public class PageNumberInlineArea extends InlineArea { +public class PageNumberInlineArea extends WordArea { public PageNumberInlineArea(FontState fontState, float red, float green, float blue, String refid, int width) { diff --git a/src/org/apache/fop/layout/inline/WordArea.java b/src/org/apache/fop/layout/inline/WordArea.java new file mode 100644 index 000000000..bb9e0d22e --- /dev/null +++ b/src/org/apache/fop/layout/inline/WordArea.java @@ -0,0 +1,89 @@ +/*-- $Id$ -- + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) 1999 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.layout.inline; + +import org.apache.fop.render.Renderer; +import org.apache.fop.layout.FontState; + +public class WordArea extends InlineArea { + + private String text; + + // Textdecoration + protected boolean underlined = false; + protected boolean overlined = false; + protected boolean lineThrough = false; + + + public WordArea(FontState fontState, float red, float green, + float blue, String text, int width) { + super(fontState, width, red, green, blue); + this.text = text; + this.contentRectangleWidth = width; + } + + public void render(Renderer renderer) { + renderer.renderWordArea(this); + } + + public String getText() { + return this.text; + } + + public void setUnderlined(boolean ul) { + this.underlined = ul; + } + + public boolean getUnderlined() { + return this.underlined; + } + +} -- 2.39.5