From 754189878337d805e4b148d9be8dca2dbe2c1dd5 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Thu, 29 Apr 2004 03:30:20 +0000 Subject: [PATCH] More work on corresponding properties; Changes to interface CorrespodingProperties Work on Padding properties git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197543 13f79535-47bb-0310-9956-ffa450edef68 --- .../AbstractCorrespondingProperty.java | 8 --- .../fo/properties/BorderAfterWidthLength.java | 9 ++- .../properties/BorderBeforeWidthLength.java | 8 ++- .../fop/fo/properties/BorderBottomColor.java | 4 -- .../fop/fo/properties/BorderBottomStyle.java | 5 -- .../fop/fo/properties/BorderBottomWidth.java | 4 -- .../properties/BorderColorCorresponding.java | 7 --- .../BorderColorCorrespondingRelative.java | 4 -- .../fop/fo/properties/BorderCommonStyle.java | 5 -- .../properties/BorderCommonStyleRelative.java | 4 -- .../fop/fo/properties/BorderCommonWidth.java | 5 -- .../properties/BorderCommonWidthRelative.java | 4 -- .../fo/properties/BorderEndWidthLength.java | 9 ++- .../fop/fo/properties/BorderLeftColor.java | 4 -- .../fop/fo/properties/BorderLeftStyle.java | 4 -- .../fop/fo/properties/BorderLeftWidth.java | 4 -- .../fop/fo/properties/BorderRightColor.java | 4 -- .../fop/fo/properties/BorderRightStyle.java | 4 -- .../fop/fo/properties/BorderRightWidth.java | 4 -- .../fop/fo/properties/BorderStartStyle.java | 4 -- .../fo/properties/BorderStartWidthLength.java | 9 ++- .../fop/fo/properties/BorderTopColor.java | 4 -- .../fop/fo/properties/BorderTopStyle.java | 4 -- .../fop/fo/properties/BorderTopWidth.java | 4 -- .../fo/properties/CorrespondingProperty.java | 2 - .../fop/fo/properties/PaddingAfter.java | 9 ++- .../fop/fo/properties/PaddingAfterLength.java | 9 ++- .../fop/fo/properties/PaddingBefore.java | 9 ++- .../fo/properties/PaddingBeforeLength.java | 9 ++- .../PaddingCorrespondingAbsolute.java | 63 +++++++++++++++++++ .../PaddingCorrespondingRelative.java | 62 ++++++++++++++++++ .../apache/fop/fo/properties/PaddingEnd.java | 9 ++- .../fop/fo/properties/PaddingEndLength.java | 9 ++- .../fop/fo/properties/PaddingStart.java | 9 ++- .../fop/fo/properties/PaddingStartLength.java | 9 ++- 35 files changed, 219 insertions(+), 105 deletions(-) create mode 100644 src/java/org/apache/fop/fo/properties/PaddingCorrespondingAbsolute.java create mode 100644 src/java/org/apache/fop/fo/properties/PaddingCorrespondingRelative.java diff --git a/src/java/org/apache/fop/fo/properties/AbstractCorrespondingProperty.java b/src/java/org/apache/fop/fo/properties/AbstractCorrespondingProperty.java index 99c43a1a7..7e2ac74bb 100644 --- a/src/java/org/apache/fop/fo/properties/AbstractCorrespondingProperty.java +++ b/src/java/org/apache/fop/fo/properties/AbstractCorrespondingProperty.java @@ -49,12 +49,4 @@ public abstract class AbstractCorrespondingProperty extends Property throw new PropertyException("Called from superclass"); } - /** - * @return - * @throws PropertyException - */ - public boolean overridesCorresponding() - throws PropertyException { - throw new PropertyException("Called from superclass"); - } } diff --git a/src/java/org/apache/fop/fo/properties/BorderAfterWidthLength.java b/src/java/org/apache/fop/fo/properties/BorderAfterWidthLength.java index 055af9103..2c1ae6ca5 100644 --- a/src/java/org/apache/fop/fo/properties/BorderAfterWidthLength.java +++ b/src/java/org/apache/fop/fo/properties/BorderAfterWidthLength.java @@ -21,10 +21,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderAfterWidthLength extends BorderCommonWidth { +public class BorderAfterWidthLength extends BorderCommonWidthRelative { public static final int dataTypes = LENGTH; public int getDataTypes() { @@ -56,6 +57,12 @@ public class BorderAfterWidthLength extends BorderCommonWidth { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingWidthProperty( + foNode, WritingMode.AFTER); + } + } diff --git a/src/java/org/apache/fop/fo/properties/BorderBeforeWidthLength.java b/src/java/org/apache/fop/fo/properties/BorderBeforeWidthLength.java index 814f3ce02..7fd869521 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBeforeWidthLength.java +++ b/src/java/org/apache/fop/fo/properties/BorderBeforeWidthLength.java @@ -21,10 +21,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderBeforeWidthLength extends BorderCommonWidth { +public class BorderBeforeWidthLength extends BorderCommonWidthRelative { public static final int dataTypes = LENGTH; public int getDataTypes() { @@ -56,6 +57,11 @@ public class BorderBeforeWidthLength extends BorderCommonWidth { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingWidthProperty( + foNode, WritingMode.BEFORE); + } } diff --git a/src/java/org/apache/fop/fo/properties/BorderBottomColor.java b/src/java/org/apache/fop/fo/properties/BorderBottomColor.java index 5b88df5ee..b1b4ac73c 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBottomColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderBottomColor.java @@ -63,9 +63,5 @@ public class BorderBottomColor extends BorderColorCorrespondingAbsolute { foNode, WritingMode.BOTTOM); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderBottomStyle.java b/src/java/org/apache/fop/fo/properties/BorderBottomStyle.java index 8a1c43431..6314d4119 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBottomStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderBottomStyle.java @@ -57,10 +57,5 @@ extends BorderCommonStyleAbsolute { foNode, WritingMode.BOTTOM); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - - } diff --git a/src/java/org/apache/fop/fo/properties/BorderBottomWidth.java b/src/java/org/apache/fop/fo/properties/BorderBottomWidth.java index f80d3d609..9ca539d2c 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBottomWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderBottomWidth.java @@ -69,9 +69,5 @@ public class BorderBottomWidth extends BorderCommonWidthAbsolute { foNode, WritingMode.BOTTOM); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderColorCorresponding.java b/src/java/org/apache/fop/fo/properties/BorderColorCorresponding.java index 0fe19b043..fcdc94e2d 100644 --- a/src/java/org/apache/fop/fo/properties/BorderColorCorresponding.java +++ b/src/java/org/apache/fop/fo/properties/BorderColorCorresponding.java @@ -47,11 +47,4 @@ public abstract class BorderColorCorresponding extends ColorTransparent throws PropertyException { throw new PropertyException("Called from superclass"); } - /* (non-Javadoc) - * @see org.apache.fop.fo.properties.CorrespondingProperty#overridesCorresponding(org.apache.fop.fo.FONode) - */ - public boolean overridesCorresponding(FONode foNode) - throws PropertyException { - throw new PropertyException("Called from superclass"); - } } diff --git a/src/java/org/apache/fop/fo/properties/BorderColorCorrespondingRelative.java b/src/java/org/apache/fop/fo/properties/BorderColorCorrespondingRelative.java index db80d95fe..fc6e6cad0 100644 --- a/src/java/org/apache/fop/fo/properties/BorderColorCorrespondingRelative.java +++ b/src/java/org/apache/fop/fo/properties/BorderColorCorrespondingRelative.java @@ -55,10 +55,6 @@ public class BorderColorCorrespondingRelative extends BorderColorCorresponding { return absBorderColorProps[absEdge]; } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - public boolean isCorrespondingRelative() { return true; } diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonStyle.java b/src/java/org/apache/fop/fo/properties/BorderCommonStyle.java index 12ff65565..e841457ca 100644 --- a/src/java/org/apache/fop/fo/properties/BorderCommonStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderCommonStyle.java @@ -23,7 +23,6 @@ package org.apache.fop.fo.properties; import java.util.HashMap; import org.apache.fop.datatypes.Ints; -import org.apache.fop.fo.FONode; import org.apache.fop.fo.expr.PropertyException; /** @@ -80,9 +79,5 @@ extends AbstractCorrespondingProperty { return rwEnums[index]; } - public boolean overridesCorresponding(FONode foNode) - throws PropertyException { - throw new PropertyException("Called within superclass"); - } } diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java b/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java index c807d685b..d9e2b8b5e 100644 --- a/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java +++ b/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java @@ -59,10 +59,6 @@ extends BorderCommonStyle { return absBorderStyleProps[absEdge]; } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - public boolean isCorrespondingRelative() { return true; } diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonWidth.java b/src/java/org/apache/fop/fo/properties/BorderCommonWidth.java index 0a6b59a62..e2a8bd5a8 100644 --- a/src/java/org/apache/fop/fo/properties/BorderCommonWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderCommonWidth.java @@ -72,10 +72,5 @@ public abstract class BorderCommonWidth extends AbstractCorrespondingProperty { return rwEnums[index]; } - public boolean overridesCorresponding(FONode foNode) - throws PropertyException { - throw new PropertyException("Called within superclass"); - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonWidthRelative.java b/src/java/org/apache/fop/fo/properties/BorderCommonWidthRelative.java index 6f6c982e6..b8b1e56f9 100644 --- a/src/java/org/apache/fop/fo/properties/BorderCommonWidthRelative.java +++ b/src/java/org/apache/fop/fo/properties/BorderCommonWidthRelative.java @@ -55,10 +55,6 @@ public abstract class BorderCommonWidthRelative extends BorderCommonWidth { return absBorderWidthProps[absEdge]; } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - public boolean isCorrespondingRelative() { return true; } diff --git a/src/java/org/apache/fop/fo/properties/BorderEndWidthLength.java b/src/java/org/apache/fop/fo/properties/BorderEndWidthLength.java index 925aea4c4..2c5374f63 100644 --- a/src/java/org/apache/fop/fo/properties/BorderEndWidthLength.java +++ b/src/java/org/apache/fop/fo/properties/BorderEndWidthLength.java @@ -21,10 +21,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderEndWidthLength extends BorderCommonWidth { +public class BorderEndWidthLength extends BorderCommonWidthRelative { public static final int dataTypes = LENGTH; public int getDataTypes() { @@ -55,7 +56,11 @@ public class BorderEndWidthLength extends BorderCommonWidth { public int getInherited() { return inherited; } - + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingWidthProperty( + foNode, WritingMode.END); + } } diff --git a/src/java/org/apache/fop/fo/properties/BorderLeftColor.java b/src/java/org/apache/fop/fo/properties/BorderLeftColor.java index 60f4b56dc..b8c20b43d 100644 --- a/src/java/org/apache/fop/fo/properties/BorderLeftColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderLeftColor.java @@ -63,9 +63,5 @@ public class BorderLeftColor extends BorderColorCorrespondingAbsolute { foNode, WritingMode.LEFT); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderLeftStyle.java b/src/java/org/apache/fop/fo/properties/BorderLeftStyle.java index 90aa7a58e..4936354a7 100644 --- a/src/java/org/apache/fop/fo/properties/BorderLeftStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderLeftStyle.java @@ -57,9 +57,5 @@ extends BorderCommonStyleAbsolute { foNode, WritingMode.LEFT); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderLeftWidth.java b/src/java/org/apache/fop/fo/properties/BorderLeftWidth.java index 64c9f636c..b102230e7 100644 --- a/src/java/org/apache/fop/fo/properties/BorderLeftWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderLeftWidth.java @@ -69,9 +69,5 @@ public class BorderLeftWidth extends BorderCommonWidthAbsolute { foNode, WritingMode.LEFT); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderRightColor.java b/src/java/org/apache/fop/fo/properties/BorderRightColor.java index e7d46abf5..e52f6e1ca 100644 --- a/src/java/org/apache/fop/fo/properties/BorderRightColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderRightColor.java @@ -63,9 +63,5 @@ public class BorderRightColor extends BorderColorCorrespondingAbsolute { foNode, WritingMode.RIGHT); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderRightStyle.java b/src/java/org/apache/fop/fo/properties/BorderRightStyle.java index 2ba0b125a..467f0ed4d 100644 --- a/src/java/org/apache/fop/fo/properties/BorderRightStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderRightStyle.java @@ -57,9 +57,5 @@ extends BorderCommonStyleAbsolute { foNode, WritingMode.RIGHT); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderRightWidth.java b/src/java/org/apache/fop/fo/properties/BorderRightWidth.java index 8d81f1704..2323503f7 100644 --- a/src/java/org/apache/fop/fo/properties/BorderRightWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderRightWidth.java @@ -69,9 +69,5 @@ public class BorderRightWidth extends BorderCommonWidthAbsolute { foNode, WritingMode.RIGHT); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderStartStyle.java b/src/java/org/apache/fop/fo/properties/BorderStartStyle.java index d6274db31..4e6f8481c 100644 --- a/src/java/org/apache/fop/fo/properties/BorderStartStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderStartStyle.java @@ -57,9 +57,5 @@ extends BorderCommonStyleRelative { foNode, WritingMode.START); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderStartWidthLength.java b/src/java/org/apache/fop/fo/properties/BorderStartWidthLength.java index adabf3f47..8722fe98b 100644 --- a/src/java/org/apache/fop/fo/properties/BorderStartWidthLength.java +++ b/src/java/org/apache/fop/fo/properties/BorderStartWidthLength.java @@ -21,10 +21,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderStartWidthLength extends BorderCommonWidth { +public class BorderStartWidthLength extends BorderCommonWidthRelative { public static final int dataTypes = LENGTH; public int getDataTypes() { @@ -56,5 +57,11 @@ public class BorderStartWidthLength extends BorderCommonWidth { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingWidthProperty( + foNode, WritingMode.END); + } + } diff --git a/src/java/org/apache/fop/fo/properties/BorderTopColor.java b/src/java/org/apache/fop/fo/properties/BorderTopColor.java index 632229c47..8914f3a9d 100644 --- a/src/java/org/apache/fop/fo/properties/BorderTopColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderTopColor.java @@ -63,9 +63,5 @@ public class BorderTopColor extends BorderColorCorrespondingAbsolute { foNode, WritingMode.TOP); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderTopStyle.java b/src/java/org/apache/fop/fo/properties/BorderTopStyle.java index d2bc28e4f..c48fdc08f 100644 --- a/src/java/org/apache/fop/fo/properties/BorderTopStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderTopStyle.java @@ -56,9 +56,5 @@ extends BorderCommonStyleAbsolute { foNode, WritingMode.TOP); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderTopWidth.java b/src/java/org/apache/fop/fo/properties/BorderTopWidth.java index 71dd6121d..f43a1eabe 100644 --- a/src/java/org/apache/fop/fo/properties/BorderTopWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderTopWidth.java @@ -69,9 +69,5 @@ public class BorderTopWidth extends BorderCommonWidthAbsolute { foNode, WritingMode.TOP); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/CorrespondingProperty.java b/src/java/org/apache/fop/fo/properties/CorrespondingProperty.java index 2f9404acf..e526098ce 100644 --- a/src/java/org/apache/fop/fo/properties/CorrespondingProperty.java +++ b/src/java/org/apache/fop/fo/properties/CorrespondingProperty.java @@ -34,6 +34,4 @@ public interface CorrespondingProperty { throws PropertyException; public int getCorrespondingProperty(FONode foNode) throws PropertyException; - public boolean overridesCorresponding(FONode foNode) - throws PropertyException; } diff --git a/src/java/org/apache/fop/fo/properties/PaddingAfter.java b/src/java/org/apache/fop/fo/properties/PaddingAfter.java index 5dd794a3c..2296bbe71 100644 --- a/src/java/org/apache/fop/fo/properties/PaddingAfter.java +++ b/src/java/org/apache/fop/fo/properties/PaddingAfter.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class PaddingAfter extends Property { +public class PaddingAfter extends PaddingCorrespondingRelative { public static final int dataTypes = COMPOUND | PERCENTAGE | LENGTH | INHERIT; @@ -56,5 +57,11 @@ public class PaddingAfter extends Property { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingPaddingProperty( + foNode, WritingMode.AFTER); + } + } diff --git a/src/java/org/apache/fop/fo/properties/PaddingAfterLength.java b/src/java/org/apache/fop/fo/properties/PaddingAfterLength.java index c21206fa8..82f426ed6 100644 --- a/src/java/org/apache/fop/fo/properties/PaddingAfterLength.java +++ b/src/java/org/apache/fop/fo/properties/PaddingAfterLength.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class PaddingAfterLength extends Property { +public class PaddingAfterLength extends PaddingCorrespondingRelative { public static final int dataTypes = PERCENTAGE | LENGTH; public int getDataTypes() { @@ -56,5 +57,11 @@ public class PaddingAfterLength extends Property { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingPaddingProperty( + foNode, WritingMode.AFTER); + } + } diff --git a/src/java/org/apache/fop/fo/properties/PaddingBefore.java b/src/java/org/apache/fop/fo/properties/PaddingBefore.java index 40448a70e..687502328 100644 --- a/src/java/org/apache/fop/fo/properties/PaddingBefore.java +++ b/src/java/org/apache/fop/fo/properties/PaddingBefore.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class PaddingBefore extends Property { +public class PaddingBefore extends PaddingCorrespondingRelative { public static final int dataTypes = COMPOUND |PERCENTAGE | LENGTH | INHERIT; @@ -57,5 +58,11 @@ public class PaddingBefore extends Property { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingPaddingProperty( + foNode, WritingMode.BEFORE); + } + } diff --git a/src/java/org/apache/fop/fo/properties/PaddingBeforeLength.java b/src/java/org/apache/fop/fo/properties/PaddingBeforeLength.java index 705673109..063d4f4a4 100644 --- a/src/java/org/apache/fop/fo/properties/PaddingBeforeLength.java +++ b/src/java/org/apache/fop/fo/properties/PaddingBeforeLength.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class PaddingBeforeLength extends Property { +public class PaddingBeforeLength extends PaddingCorrespondingRelative { public static final int dataTypes = LENGTH; public int getDataTypes() { @@ -56,5 +57,11 @@ public class PaddingBeforeLength extends Property { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingPaddingProperty( + foNode, WritingMode.BEFORE); + } + } diff --git a/src/java/org/apache/fop/fo/properties/PaddingCorrespondingAbsolute.java b/src/java/org/apache/fop/fo/properties/PaddingCorrespondingAbsolute.java new file mode 100644 index 000000000..83a3bf567 --- /dev/null +++ b/src/java/org/apache/fop/fo/properties/PaddingCorrespondingAbsolute.java @@ -0,0 +1,63 @@ +/* + * + * Copyright 2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Created on 29/04/2004 + * $Id$ + */ +package org.apache.fop.fo.properties; + +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropNames; +import org.apache.fop.fo.expr.PropertyException; + +/** + * @author pbw + * @version $Revision$ $Name$ + */ +public abstract class PaddingCorrespondingAbsolute +extends AbstractCorrespondingProperty { + + /** Array of relative padding properties, + * indexed by relative edge constants */ + private static int[] relPaddingProps = { + PropNames.NO_PROPERTY + ,PropNames.PADDING_BEFORE + ,PropNames.PADDING_AFTER + ,PropNames.PADDING_START + ,PropNames.PADDING_END + }; + + /** + * Gets the relative padding property corresponding to the given + * absolute edge + * @param foNode the node on which the property is being defined + * @param absoluteEdge + * @return the relative padding property index + * @throws PropertyException + */ + protected int getCorrespondingPaddingProperty( + FONode foNode, int absoluteEdge) + throws PropertyException { + int relEdge = WritingMode.getCorrespondingRelativeEdge( + getWritingMode(foNode), absoluteEdge); + return relPaddingProps[relEdge]; + } + + public boolean isCorrespondingAbsolute() { + return true; + } + +} diff --git a/src/java/org/apache/fop/fo/properties/PaddingCorrespondingRelative.java b/src/java/org/apache/fop/fo/properties/PaddingCorrespondingRelative.java new file mode 100644 index 000000000..6d79404db --- /dev/null +++ b/src/java/org/apache/fop/fo/properties/PaddingCorrespondingRelative.java @@ -0,0 +1,62 @@ +/* + * + * Copyright 2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Created on 29/04/2004 + * $Id$ + */ +package org.apache.fop.fo.properties; + +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropNames; +import org.apache.fop.fo.expr.PropertyException; + +/** + * @author pbw + * @version $Revision$ $Name$ + */ +public abstract class PaddingCorrespondingRelative extends AbstractCorrespondingProperty { + + /** Array of absolute padding properties, + * indexed by absolute edge constants */ + private static int[] absPaddingProps = { + PropNames.NO_PROPERTY + ,PropNames.PADDING_TOP + ,PropNames.PADDING_BOTTOM + ,PropNames.PADDING_LEFT + ,PropNames.PADDING_RIGHT + }; + + /** + * Gets the absolute padding property corresponding to the given + * relative edge + * @param foNode the node on which the property is being defined + * @param relativeEdge + * @return the absolute padding property index + * @throws PropertyException + */ + protected int getCorrespondingPaddingProperty( + FONode foNode, int relativeEdge) + throws PropertyException { + int relEdge = WritingMode.getCorrespondingAbsoluteEdge( + getWritingMode(foNode), relativeEdge); + return absPaddingProps[relEdge]; + } + + public boolean isCorrespondingRelative() { + return true; + } + +} diff --git a/src/java/org/apache/fop/fo/properties/PaddingEnd.java b/src/java/org/apache/fop/fo/properties/PaddingEnd.java index a2044ee4c..4c66dc086 100644 --- a/src/java/org/apache/fop/fo/properties/PaddingEnd.java +++ b/src/java/org/apache/fop/fo/properties/PaddingEnd.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class PaddingEnd extends Property { +public class PaddingEnd extends PaddingCorrespondingRelative { public static final int dataTypes = COMPOUND | PERCENTAGE | LENGTH | INHERIT; @@ -56,5 +57,11 @@ public class PaddingEnd extends Property { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingPaddingProperty( + foNode, WritingMode.END); + } + } diff --git a/src/java/org/apache/fop/fo/properties/PaddingEndLength.java b/src/java/org/apache/fop/fo/properties/PaddingEndLength.java index fb8e971be..e240d46a9 100644 --- a/src/java/org/apache/fop/fo/properties/PaddingEndLength.java +++ b/src/java/org/apache/fop/fo/properties/PaddingEndLength.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class PaddingEndLength extends Property { +public class PaddingEndLength extends PaddingCorrespondingRelative { public static final int dataTypes = PERCENTAGE | LENGTH; public int getDataTypes() { @@ -56,5 +57,11 @@ public class PaddingEndLength extends Property { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingPaddingProperty( + foNode, WritingMode.END); + } + } diff --git a/src/java/org/apache/fop/fo/properties/PaddingStart.java b/src/java/org/apache/fop/fo/properties/PaddingStart.java index 5621893f5..1619697c0 100644 --- a/src/java/org/apache/fop/fo/properties/PaddingStart.java +++ b/src/java/org/apache/fop/fo/properties/PaddingStart.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class PaddingStart extends Property { +public class PaddingStart extends PaddingCorrespondingRelative { public static final int dataTypes = COMPOUND | PERCENTAGE | LENGTH | INHERIT; @@ -56,5 +57,11 @@ public class PaddingStart extends Property { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingPaddingProperty( + foNode, WritingMode.START); + } + } diff --git a/src/java/org/apache/fop/fo/properties/PaddingStartLength.java b/src/java/org/apache/fop/fo/properties/PaddingStartLength.java index d6c5cfe05..997a5f51c 100644 --- a/src/java/org/apache/fop/fo/properties/PaddingStartLength.java +++ b/src/java/org/apache/fop/fo/properties/PaddingStartLength.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.PropertyValue; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class PaddingStartLength extends Property { +public class PaddingStartLength extends PaddingCorrespondingRelative { public static final int dataTypes = PERCENTAGE | LENGTH; public int getDataTypes() { @@ -56,5 +57,11 @@ public class PaddingStartLength extends Property { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingPaddingProperty( + foNode, WritingMode.START); + } + } -- 2.39.5