From 1e9813ca4eb2388cd1047d34004d70b4595dbb93 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Thu, 22 Apr 2004 07:36:55 +0000 Subject: [PATCH] More work on border corresponding properties git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197530 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/fo/properties/BorderAfterColor.java | 9 ++- .../fop/fo/properties/BorderAfterStyle.java | 4 -- .../fop/fo/properties/BorderAfterWidth.java | 10 ++- .../fop/fo/properties/BorderBeforeColor.java | 9 ++- .../fop/fo/properties/BorderBeforeStyle.java | 4 -- .../fop/fo/properties/BorderBeforeWidth.java | 7 ++- .../fop/fo/properties/BorderBottomColor.java | 13 +++- .../fop/fo/properties/BorderBottomWidth.java | 11 +++- .../properties/BorderColorCorresponding.java | 57 +++++++++++++++++ .../BorderColorCorrespondingAbsolute.java | 58 +++++++++++++++++ .../BorderColorCorrespondingRelative.java | 62 +++++++++++++++++++ .../properties/BorderCommonStyleRelative.java | 5 +- .../fop/fo/properties/BorderCommonWidth.java | 7 ++- .../properties/BorderCommonWidthAbsolute.java | 58 +++++++++++++++++ .../properties/BorderCommonWidthRelative.java | 62 +++++++++++++++++++ .../fop/fo/properties/BorderEndColor.java | 9 ++- .../fop/fo/properties/BorderEndStyle.java | 4 -- .../fop/fo/properties/BorderEndWidth.java | 7 ++- .../fop/fo/properties/BorderLeftColor.java | 13 +++- .../fop/fo/properties/BorderLeftWidth.java | 11 +++- .../fop/fo/properties/BorderRightColor.java | 13 +++- .../fop/fo/properties/BorderRightWidth.java | 11 +++- .../fop/fo/properties/BorderStartColor.java | 9 ++- .../fop/fo/properties/BorderStartWidth.java | 7 ++- .../fop/fo/properties/BorderTopColor.java | 13 +++- .../fop/fo/properties/BorderTopWidth.java | 11 +++- 26 files changed, 452 insertions(+), 32 deletions(-) create mode 100644 src/java/org/apache/fop/fo/properties/BorderColorCorresponding.java create mode 100644 src/java/org/apache/fop/fo/properties/BorderColorCorrespondingAbsolute.java create mode 100644 src/java/org/apache/fop/fo/properties/BorderColorCorrespondingRelative.java create mode 100644 src/java/org/apache/fop/fo/properties/BorderCommonWidthAbsolute.java create mode 100644 src/java/org/apache/fop/fo/properties/BorderCommonWidthRelative.java diff --git a/src/java/org/apache/fop/fo/properties/BorderAfterColor.java b/src/java/org/apache/fop/fo/properties/BorderAfterColor.java index ae5036e00..586828932 100644 --- a/src/java/org/apache/fop/fo/properties/BorderAfterColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderAfterColor.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.ColorType; 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 BorderAfterColor extends ColorTransparent { +public class BorderAfterColor extends BorderColorCorrespondingRelative { public static final int dataTypes = ENUM | COLOR_T | INHERIT; public int getDataTypes() { @@ -56,4 +57,10 @@ public class BorderAfterColor extends ColorTransparent { return new ColorType (PropNames.BACKGROUND_COLOR, BLACK); } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingColorProperty( + foNode, WritingMode.AFTER); + } + } diff --git a/src/java/org/apache/fop/fo/properties/BorderAfterStyle.java b/src/java/org/apache/fop/fo/properties/BorderAfterStyle.java index af3facff6..8631c5e9a 100644 --- a/src/java/org/apache/fop/fo/properties/BorderAfterStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderAfterStyle.java @@ -57,9 +57,5 @@ extends BorderCommonStyleRelative { foNode, WritingMode.AFTER); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderAfterWidth.java b/src/java/org/apache/fop/fo/properties/BorderAfterWidth.java index 940f30c47..0844c8608 100644 --- a/src/java/org/apache/fop/fo/properties/BorderAfterWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderAfterWidth.java @@ -26,7 +26,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderAfterWidth extends BorderCommonWidth { +public class BorderAfterWidth extends BorderCommonWidthRelative { public static final int dataTypes = COMPOUND | MAPPED_LENGTH | LENGTH | INHERIT; @@ -47,7 +47,7 @@ public class BorderAfterWidth extends BorderCommonWidth { } - // Initial value for BorderAfterWidth is tne mapped enumerated value + // Initial value for BorderAfterWidth is the mapped enumerated value // "medium". This maps to 1pt. There is no way at present to // automatically update the following initial Length PropertyValue // if the mapping changes. @@ -70,7 +70,11 @@ public class BorderAfterWidth 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/BorderBeforeColor.java b/src/java/org/apache/fop/fo/properties/BorderBeforeColor.java index ad478d656..bfc6b751a 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBeforeColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderBeforeColor.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.ColorType; 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 BorderBeforeColor extends ColorTransparent { +public class BorderBeforeColor extends BorderColorCorrespondingRelative { public static final int dataTypes = ENUM | COLOR_T | INHERIT; public int getDataTypes() { @@ -56,5 +57,11 @@ public class BorderBeforeColor extends ColorTransparent { return new ColorType(PropNames.BACKGROUND_COLOR, BLACK); } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingColorProperty( + foNode, WritingMode.BEFORE); + } + } diff --git a/src/java/org/apache/fop/fo/properties/BorderBeforeStyle.java b/src/java/org/apache/fop/fo/properties/BorderBeforeStyle.java index b45a8e265..c334ae0f4 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBeforeStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderBeforeStyle.java @@ -57,9 +57,5 @@ extends BorderCommonStyleRelative { foNode, WritingMode.BEFORE); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderBeforeWidth.java b/src/java/org/apache/fop/fo/properties/BorderBeforeWidth.java index 7684592f6..750545dc0 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBeforeWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderBeforeWidth.java @@ -26,7 +26,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderBeforeWidth extends BorderCommonWidth { +public class BorderBeforeWidth extends BorderCommonWidthRelative { public static final int dataTypes = COMPOUND | MAPPED_LENGTH | LENGTH | INHERIT; @@ -64,6 +64,11 @@ public class BorderBeforeWidth 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 cd5eb8871..5b88df5ee 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBottomColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderBottomColor.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.ColorType; 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 BorderBottomColor extends ColorTransparent { +public class BorderBottomColor extends BorderColorCorrespondingAbsolute { public static final int dataTypes = ENUM | COLOR_T | INHERIT; public int getDataTypes() { @@ -56,5 +57,15 @@ public class BorderBottomColor extends ColorTransparent { return new ColorType(PropNames.BACKGROUND_COLOR, BLACK); } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingColorProperty( + 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 76afc49c3..f80d3d609 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBottomWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderBottomWidth.java @@ -26,7 +26,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderBottomWidth extends BorderCommonWidth { +public class BorderBottomWidth extends BorderCommonWidthAbsolute { public static final int dataTypes = LENGTH | MAPPED_LENGTH | INHERIT; public int getDataTypes() { @@ -63,6 +63,15 @@ public class BorderBottomWidth extends BorderCommonWidth { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingWidthProperty( + 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 new file mode 100644 index 000000000..0fe19b043 --- /dev/null +++ b/src/java/org/apache/fop/fo/properties/BorderColorCorresponding.java @@ -0,0 +1,57 @@ +/* + * + * 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 22/04/2004 + * $Id$ + */ +package org.apache.fop.fo.properties; + +import org.apache.fop.datatypes.EnumType; +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; + +/** + * @author pbw + * @version $Revision$ $Name$ + */ +public abstract class BorderColorCorresponding extends ColorTransparent + implements + CorrespondingProperty { + /* (non-Javadoc) + * @see org.apache.fop.fo.properties.CorrespondingProperty#getWritingMode(org.apache.fop.fo.FONode) + */ + public int getWritingMode(FONode foNode) + throws PropertyException { + PropertyValue wm = foNode.getPropertyValue(PropNames.WRITING_MODE); + return EnumType.getEnumValue(wm); + } + /* (non-Javadoc) + * @see org.apache.fop.fo.properties.CorrespondingProperty#getCorrespondingProperty(org.apache.fop.fo.FONode) + */ + public int getCorrespondingProperty(FONode foNode) + 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/BorderColorCorrespondingAbsolute.java b/src/java/org/apache/fop/fo/properties/BorderColorCorrespondingAbsolute.java new file mode 100644 index 000000000..ec0c8bfe6 --- /dev/null +++ b/src/java/org/apache/fop/fo/properties/BorderColorCorrespondingAbsolute.java @@ -0,0 +1,58 @@ +/* + * + * 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 22/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 class BorderColorCorrespondingAbsolute extends BorderColorCorresponding { + + /** Array of relative border color properties, + * indexed by relative edge constants */ + private static int[] relBorderColorProps = { + PropNames.NO_PROPERTY + ,PropNames.BORDER_BEFORE_COLOR + ,PropNames.BORDER_AFTER_COLOR + ,PropNames.BORDER_START_COLOR + ,PropNames.BORDER_END_COLOR + }; + + /** + * Gets the relative border color property corresponding to the given + * absolute edge + * @param foNode the node on which the property is being defined + * @param absoluteEdge + * @return the relative border color property index + * @throws PropertyException + */ + protected int getCorrespondingColorProperty( + FONode foNode, int absoluteEdge) + throws PropertyException { + int relEdge = WritingMode.getCorrespondingRelativeEdge( + getWritingMode(foNode), absoluteEdge); + return relBorderColorProps[relEdge]; + } + +} diff --git a/src/java/org/apache/fop/fo/properties/BorderColorCorrespondingRelative.java b/src/java/org/apache/fop/fo/properties/BorderColorCorrespondingRelative.java new file mode 100644 index 000000000..df814cdd6 --- /dev/null +++ b/src/java/org/apache/fop/fo/properties/BorderColorCorrespondingRelative.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 22/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 class BorderColorCorrespondingRelative extends BorderColorCorresponding { + + /** Array of absolute border color properties, + * indexed by absolute edge constants */ + private static int[] absBorderColorProps = { + PropNames.NO_PROPERTY + ,PropNames.BORDER_TOP_COLOR + ,PropNames.BORDER_BOTTOM_COLOR + ,PropNames.BORDER_LEFT_COLOR + ,PropNames.BORDER_RIGHT_COLOR + }; + + /** + * Gets the absolute border color property corresponding to the given + * relative edge + * @param foNode the node on which the property is being defined + * @param relativeEdge + * @return the relative border color property index + * @throws PropertyException + */ + protected int getCorrespondingColorProperty( + FONode foNode, int relativeEdge) + throws PropertyException { + int absEdge = WritingMode.getCorrespondingAbsoluteEdge( + getWritingMode(foNode), relativeEdge); + return absBorderColorProps[absEdge]; + } + + public boolean overridesCorresponding(FONode foNode) { + return false; + } + +} diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java b/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java index 3325188ba..7fc0a8e97 100644 --- a/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java +++ b/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java @@ -33,7 +33,6 @@ import org.apache.fop.fo.expr.PropertyException; public abstract class BorderCommonStyleRelative extends BorderCommonStyle { - /** Array of absolute border style properties, * indexed by absolute edge constants */ private static int[] absBorderStyleProps = { @@ -60,4 +59,8 @@ extends BorderCommonStyle { return absBorderStyleProps[absEdge]; } + public boolean overridesCorresponding(FONode foNode) { + return false; + } + } diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonWidth.java b/src/java/org/apache/fop/fo/properties/BorderCommonWidth.java index c88a8c509..0a6b59a62 100644 --- a/src/java/org/apache/fop/fo/properties/BorderCommonWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderCommonWidth.java @@ -29,7 +29,7 @@ import org.apache.fop.fo.expr.PropertyException; * Pseudo-property class for common border width values occurring in a * number of classes. */ -public class BorderCommonWidth extends Property { +public abstract class BorderCommonWidth extends AbstractCorrespondingProperty { public static final int THIN = 1; public static final int MEDIUM = 2; public static final int THICK = 3; @@ -72,5 +72,10 @@ public class BorderCommonWidth extends Property { 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/BorderCommonWidthAbsolute.java b/src/java/org/apache/fop/fo/properties/BorderCommonWidthAbsolute.java new file mode 100644 index 000000000..096f466e3 --- /dev/null +++ b/src/java/org/apache/fop/fo/properties/BorderCommonWidthAbsolute.java @@ -0,0 +1,58 @@ +/* + * + * 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 22/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 BorderCommonWidthAbsolute extends BorderCommonWidth { + + /** Array of relative border width properties, + * indexed by relative edge constants */ + private static int[] relBorderWidthProps = { + PropNames.NO_PROPERTY + ,PropNames.BORDER_BEFORE_WIDTH + ,PropNames.BORDER_AFTER_WIDTH + ,PropNames.BORDER_START_WIDTH + ,PropNames.BORDER_END_WIDTH + }; + + /** + * Gets the relative border width property corresponding to the given + * absolute edge + * @param foNode the node on which the property is being defined + * @param absoluteEdge + * @return the relative border width property index + * @throws PropertyException + */ + protected int getCorrespondingWidthProperty( + FONode foNode, int absoluteEdge) + throws PropertyException { + int relEdge = WritingMode.getCorrespondingRelativeEdge( + getWritingMode(foNode), absoluteEdge); + return relBorderWidthProps[relEdge]; + } + +} diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonWidthRelative.java b/src/java/org/apache/fop/fo/properties/BorderCommonWidthRelative.java new file mode 100644 index 000000000..ce6c4ce03 --- /dev/null +++ b/src/java/org/apache/fop/fo/properties/BorderCommonWidthRelative.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 22/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 BorderCommonWidthRelative extends BorderCommonWidth { + + /** Array of absolute border width properties, + * indexed by absolute edge constants */ + private static int[] absBorderWidthProps = { + PropNames.NO_PROPERTY + ,PropNames.BORDER_TOP_WIDTH + ,PropNames.BORDER_BOTTOM_WIDTH + ,PropNames.BORDER_LEFT_WIDTH + ,PropNames.BORDER_RIGHT_WIDTH + }; + + /** + * Gets the absolute border width property corresponding to the given + * relative edge + * @param foNode the node on which the property is being defined + * @param relativeEdge + * @return the absolute border width property index + * @throws PropertyException + */ + protected int getCorrespondingWidthProperty( + FONode foNode, int relativeEdge) + throws PropertyException { + int absEdge = WritingMode.getCorrespondingAbsoluteEdge( + getWritingMode(foNode), relativeEdge); + return absBorderWidthProps[absEdge]; + } + + public boolean overridesCorresponding(FONode foNode) { + return false; + } + +} diff --git a/src/java/org/apache/fop/fo/properties/BorderEndColor.java b/src/java/org/apache/fop/fo/properties/BorderEndColor.java index 7e59b7c42..8121ebccc 100644 --- a/src/java/org/apache/fop/fo/properties/BorderEndColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderEndColor.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.ColorType; 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 BorderEndColor extends ColorTransparent { +public class BorderEndColor extends BorderColorCorrespondingRelative { public static final int dataTypes = ENUM | COLOR_T | INHERIT; public int getDataTypes() { @@ -56,5 +57,11 @@ public class BorderEndColor extends ColorTransparent { return new ColorType (PropNames.BACKGROUND_COLOR, BLACK); } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingColorProperty( + foNode, WritingMode.END); + } + } diff --git a/src/java/org/apache/fop/fo/properties/BorderEndStyle.java b/src/java/org/apache/fop/fo/properties/BorderEndStyle.java index 726addad7..26f140864 100644 --- a/src/java/org/apache/fop/fo/properties/BorderEndStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderEndStyle.java @@ -57,9 +57,5 @@ extends BorderCommonStyleRelative { foNode, WritingMode.END); } - public boolean overridesCorresponding(FONode foNode) { - return false; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderEndWidth.java b/src/java/org/apache/fop/fo/properties/BorderEndWidth.java index bac0d425b..51d856925 100644 --- a/src/java/org/apache/fop/fo/properties/BorderEndWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderEndWidth.java @@ -26,7 +26,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderEndWidth extends BorderCommonWidth { +public class BorderEndWidth extends BorderCommonWidthRelative { public static final int dataTypes = COMPOUND | MAPPED_LENGTH | LENGTH | INHERIT; @@ -64,6 +64,11 @@ public class BorderEndWidth 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/BorderLeftColor.java b/src/java/org/apache/fop/fo/properties/BorderLeftColor.java index 8f0d480f7..60f4b56dc 100644 --- a/src/java/org/apache/fop/fo/properties/BorderLeftColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderLeftColor.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.ColorType; 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 BorderLeftColor extends ColorTransparent { +public class BorderLeftColor extends BorderColorCorrespondingAbsolute { public static final int dataTypes = ENUM | COLOR_T | INHERIT; public int getDataTypes() { @@ -56,5 +57,15 @@ public class BorderLeftColor extends ColorTransparent { return new ColorType (PropNames.BACKGROUND_COLOR, BLACK); } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingColorProperty( + 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 1f7455c06..64c9f636c 100644 --- a/src/java/org/apache/fop/fo/properties/BorderLeftWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderLeftWidth.java @@ -26,7 +26,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderLeftWidth extends BorderCommonWidth { +public class BorderLeftWidth extends BorderCommonWidthAbsolute { public static final int dataTypes = LENGTH | MAPPED_LENGTH | INHERIT; public int getDataTypes() { @@ -63,6 +63,15 @@ public class BorderLeftWidth extends BorderCommonWidth { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingWidthProperty( + 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 c38104d23..e7d46abf5 100644 --- a/src/java/org/apache/fop/fo/properties/BorderRightColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderRightColor.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.ColorType; 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 BorderRightColor extends ColorTransparent { +public class BorderRightColor extends BorderColorCorrespondingAbsolute { public static final int dataTypes = ENUM | COLOR_T | INHERIT; public int getDataTypes() { @@ -56,5 +57,15 @@ public class BorderRightColor extends ColorTransparent { return new ColorType (PropNames.BACKGROUND_COLOR, BLACK); } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingColorProperty( + 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 a1ce13d36..8d81f1704 100644 --- a/src/java/org/apache/fop/fo/properties/BorderRightWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderRightWidth.java @@ -26,7 +26,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderRightWidth extends BorderCommonWidth { +public class BorderRightWidth extends BorderCommonWidthAbsolute { public static final int dataTypes = LENGTH | MAPPED_LENGTH | INHERIT; public int getDataTypes() { @@ -63,6 +63,15 @@ public class BorderRightWidth extends BorderCommonWidth { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingWidthProperty( + foNode, WritingMode.RIGHT); + } + + public boolean overridesCorresponding(FONode foNode) { + return false; + } } diff --git a/src/java/org/apache/fop/fo/properties/BorderStartColor.java b/src/java/org/apache/fop/fo/properties/BorderStartColor.java index 25ed14512..be02bcdcf 100644 --- a/src/java/org/apache/fop/fo/properties/BorderStartColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderStartColor.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.ColorType; 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 BorderStartColor extends ColorTransparent { +public class BorderStartColor extends BorderColorCorrespondingRelative { public static final int dataTypes = ENUM | COLOR_T | INHERIT; public int getDataTypes() { @@ -57,5 +58,11 @@ public class BorderStartColor extends ColorTransparent { new ColorType(PropNames.BACKGROUND_COLOR, BLACK); } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingColorProperty( + foNode, WritingMode.END); + } + } diff --git a/src/java/org/apache/fop/fo/properties/BorderStartWidth.java b/src/java/org/apache/fop/fo/properties/BorderStartWidth.java index 4c3378dbf..caaacd7b0 100644 --- a/src/java/org/apache/fop/fo/properties/BorderStartWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderStartWidth.java @@ -26,7 +26,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderStartWidth extends BorderCommonWidth { +public class BorderStartWidth extends BorderCommonWidthRelative { public static final int dataTypes = COMPOUND | MAPPED_LENGTH | LENGTH | INHERIT; @@ -64,6 +64,11 @@ public class BorderStartWidth extends BorderCommonWidth { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingWidthProperty( + foNode, WritingMode.START); + } } diff --git a/src/java/org/apache/fop/fo/properties/BorderTopColor.java b/src/java/org/apache/fop/fo/properties/BorderTopColor.java index d42d4cf57..632229c47 100644 --- a/src/java/org/apache/fop/fo/properties/BorderTopColor.java +++ b/src/java/org/apache/fop/fo/properties/BorderTopColor.java @@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.ColorType; 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 BorderTopColor extends ColorTransparent { +public class BorderTopColor extends BorderColorCorrespondingAbsolute { public static final int dataTypes = ENUM | COLOR_T | INHERIT; public int getDataTypes() { @@ -56,5 +57,15 @@ public class BorderTopColor extends ColorTransparent { return new ColorType (PropNames.BACKGROUND_COLOR, BLACK); } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingColorProperty( + 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 c070e0c96..71dd6121d 100644 --- a/src/java/org/apache/fop/fo/properties/BorderTopWidth.java +++ b/src/java/org/apache/fop/fo/properties/BorderTopWidth.java @@ -26,7 +26,7 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; -public class BorderTopWidth extends BorderCommonWidth { +public class BorderTopWidth extends BorderCommonWidthAbsolute { public static final int dataTypes = LENGTH | MAPPED_LENGTH | INHERIT; public int getDataTypes() { @@ -63,6 +63,15 @@ public class BorderTopWidth extends BorderCommonWidth { return inherited; } + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingWidthProperty( + foNode, WritingMode.TOP); + } + + public boolean overridesCorresponding(FONode foNode) { + return false; + } } -- 2.39.5