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() {
return new ColorType (PropNames.BACKGROUND_COLOR, BLACK);
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingColorProperty(
+ foNode, WritingMode.AFTER);
+ }
+
}
foNode, WritingMode.AFTER);
}
- public boolean overridesCorresponding(FONode foNode) {
- return false;
- }
-
}
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;
}
- // 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.
return inherited;
}
-
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingWidthProperty(
+ foNode, WritingMode.AFTER);
+ }
}
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() {
return new ColorType(PropNames.BACKGROUND_COLOR, BLACK);
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingColorProperty(
+ foNode, WritingMode.BEFORE);
+ }
+
}
foNode, WritingMode.BEFORE);
}
- public boolean overridesCorresponding(FONode foNode) {
- return false;
- }
-
}
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;
return inherited;
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingWidthProperty(
+ foNode, WritingMode.BEFORE);
+ }
}
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() {
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;
+ }
+
}
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() {
return inherited;
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingWidthProperty(
+ foNode, WritingMode.BOTTOM);
+ }
+
+ public boolean overridesCorresponding(FONode foNode) {
+ return false;
+ }
}
--- /dev/null
+/*
+ *
+ * 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");
+ }
+}
--- /dev/null
+/*
+ *
+ * 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];
+ }
+
+}
--- /dev/null
+/*
+ *
+ * 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;
+ }
+
+}
public abstract class BorderCommonStyleRelative
extends BorderCommonStyle {
-
/** Array of absolute border style properties,
* indexed by absolute edge constants */
private static int[] absBorderStyleProps = {
return absBorderStyleProps[absEdge];
}
+ public boolean overridesCorresponding(FONode foNode) {
+ return false;
+ }
+
}
* 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;
return rwEnums[index];
}
+ public boolean overridesCorresponding(FONode foNode)
+ throws PropertyException {
+ throw new PropertyException("Called within superclass");
+ }
+
}
--- /dev/null
+/*
+ *
+ * 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];
+ }
+
+}
--- /dev/null
+/*
+ *
+ * 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;
+ }
+
+}
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() {
return new ColorType (PropNames.BACKGROUND_COLOR, BLACK);
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingColorProperty(
+ foNode, WritingMode.END);
+ }
+
}
foNode, WritingMode.END);
}
- public boolean overridesCorresponding(FONode foNode) {
- return false;
- }
-
}
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;
return inherited;
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingWidthProperty(
+ foNode, WritingMode.END);
+ }
}
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() {
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;
+ }
+
}
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() {
return inherited;
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingWidthProperty(
+ foNode, WritingMode.LEFT);
+ }
+
+ public boolean overridesCorresponding(FONode foNode) {
+ return false;
+ }
}
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() {
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;
+ }
+
}
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() {
return inherited;
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingWidthProperty(
+ foNode, WritingMode.RIGHT);
+ }
+
+ public boolean overridesCorresponding(FONode foNode) {
+ return false;
+ }
}
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() {
new ColorType(PropNames.BACKGROUND_COLOR, BLACK);
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingColorProperty(
+ foNode, WritingMode.END);
+ }
+
}
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;
return inherited;
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingWidthProperty(
+ foNode, WritingMode.START);
+ }
}
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() {
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;
+ }
+
}
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() {
return inherited;
}
+ public int getCorrespondingProperty(FONode foNode)
+ throws PropertyException {
+ return getCorrespondingWidthProperty(
+ foNode, WritingMode.TOP);
+ }
+
+ public boolean overridesCorresponding(FONode foNode) {
+ return false;
+ }
}