From 5d142ec8b6167a5d509904246821f2ec8b45f1ec Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 26 Aug 2005 15:16:58 +0000 Subject: Common base class for TextArea and Character. These two might even be merged altogether. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@240260 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/area/inline/AbstractTextArea.java | 63 ++++++++++++++++++++++ src/java/org/apache/fop/area/inline/Character.java | 41 +------------- .../org/apache/fop/area/inline/InlineArea.java | 4 ++ src/java/org/apache/fop/area/inline/TextArea.java | 40 +------------- 4 files changed, 71 insertions(+), 77 deletions(-) create mode 100644 src/java/org/apache/fop/area/inline/AbstractTextArea.java (limited to 'src/java/org/apache/fop/area') diff --git a/src/java/org/apache/fop/area/inline/AbstractTextArea.java b/src/java/org/apache/fop/area/inline/AbstractTextArea.java new file mode 100644 index 000000000..36ed639b1 --- /dev/null +++ b/src/java/org/apache/fop/area/inline/AbstractTextArea.java @@ -0,0 +1,63 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.area.inline; + +/** + * Abstract base class for both TextArea and Character. + */ +public abstract class AbstractTextArea extends InlineArea { + + private int iTextWordSpaceAdjust = 0; + private int iTextLetterSpaceAdjust = 0; + + /** + * Get text word space adjust. + * + * @return the text word space adjustment + */ + public int getTextWordSpaceAdjust() { + return iTextWordSpaceAdjust; + } + + /** + * Set text word space adjust. + * + * @param iTWSadjust the text word space adjustment + */ + public void setTextWordSpaceAdjust(int iTWSadjust) { + iTextWordSpaceAdjust = iTWSadjust; + } + /** + * Get text letter space adjust. + * + * @return the text letter space adjustment + */ + public int getTextLetterSpaceAdjust() { + return iTextLetterSpaceAdjust; + } + + /** + * Set text letter space adjust. + * + * @param iTLSadjust the text letter space adjustment + */ + public void setTextLetterSpaceAdjust(int iTLSadjust) { + iTextLetterSpaceAdjust = iTLSadjust; + } +} diff --git a/src/java/org/apache/fop/area/inline/Character.java b/src/java/org/apache/fop/area/inline/Character.java index bed1b194a..f672e3632 100644 --- a/src/java/org/apache/fop/area/inline/Character.java +++ b/src/java/org/apache/fop/area/inline/Character.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,12 +22,10 @@ package org.apache.fop.area.inline; * Single character inline area. * This inline area holds a single character. */ -public class Character extends InlineArea { +public class Character extends AbstractTextArea { // use a String instead of a character because if this character // ends a syllable the hyphenation character must be added private String character; - private int iTextWordSpaceAdjust = 0; - private int iTextLetterSpaceAdjust = 0; /** * Create a new character inline area with the given character. @@ -58,40 +56,5 @@ public class Character extends InlineArea { this.setIPD(this.getIPD() + hyphSize); } - /** - * Get text word space adjust. - * - * @return the text word space adjustment - */ - public int getTextWordSpaceAdjust() { - return iTextWordSpaceAdjust; - } - - /** - * Set text word space adjust. - * - * @param iTWSadjust the text word space adjustment - */ - public void setTextWordSpaceAdjust(int iTWSadjust) { - iTextWordSpaceAdjust = iTWSadjust; - } - - /** - * Get text letter space adjust. - * - * @return the text letter space adjustment - */ - public int getTextLetterSpaceAdjust() { - return iTextLetterSpaceAdjust; - } - - /** - * Set text letter space adjust. - * - * @param iTLSadjust the text letter space adjustment - */ - public void setTextLetterSpaceAdjust(int iTLSadjust) { - iTextLetterSpaceAdjust = iTLSadjust; - } } diff --git a/src/java/org/apache/fop/area/inline/InlineArea.java b/src/java/org/apache/fop/area/inline/InlineArea.java index c09105f40..b6344dd3f 100644 --- a/src/java/org/apache/fop/area/inline/InlineArea.java +++ b/src/java/org/apache/fop/area/inline/InlineArea.java @@ -67,18 +67,22 @@ public class InlineArea extends Area { return verticalPosition; } + /** @return true if the inline area is underlined. */ public boolean hasUnderline() { return getBooleanTrait(Trait.UNDERLINE); } + /** @return true if the inline area is overlined. */ public boolean hasOverline() { return getBooleanTrait(Trait.OVERLINE); } + /** @return true if the inline area has a line through. */ public boolean hasLineThrough() { return getBooleanTrait(Trait.LINETHROUGH); } + /** @return true if the inline area is blinking. */ public boolean isBlinking() { return getBooleanTrait(Trait.BLINK); } diff --git a/src/java/org/apache/fop/area/inline/TextArea.java b/src/java/org/apache/fop/area/inline/TextArea.java index 86bf35838..d805e78e8 100644 --- a/src/java/org/apache/fop/area/inline/TextArea.java +++ b/src/java/org/apache/fop/area/inline/TextArea.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,12 @@ package org.apache.fop.area.inline; /** * A text inline area. */ -public class TextArea extends InlineArea { +public class TextArea extends AbstractTextArea { /** * The text for this inline area */ protected String text; - private int iTextWordSpaceAdjust = 0; - private int iTextLetterSpaceAdjust = 0; /** * Create a text inline area @@ -54,39 +52,5 @@ public class TextArea extends InlineArea { return text; } - /** - * Get text word space adjust. - * - * @return the text word space adjustment - */ - public int getTextWordSpaceAdjust() { - return iTextWordSpaceAdjust; - } - - /** - * Set text word space adjust. - * - * @param iTWSadjust the text word space adjustment - */ - public void setTextWordSpaceAdjust(int iTWSadjust) { - iTextWordSpaceAdjust = iTWSadjust; - } - /** - * Get text letter space adjust. - * - * @return the text letter space adjustment - */ - public int getTextLetterSpaceAdjust() { - return iTextLetterSpaceAdjust; - } - - /** - * Set text letter space adjust. - * - * @param iTLSadjust the text letter space adjustment - */ - public void setTextLetterSpaceAdjust(int iTLSadjust) { - iTextLetterSpaceAdjust = iTLSadjust; - } } -- cgit v1.2.3