From 9d053440c9abb44c32862faf116dbb42e394b4e4 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sun, 2 May 2004 02:56:15 +0000 Subject: [PATCH] Added isHorizontal and isLeftToRight methods, mimicking methods of the same name in java.awt.ComponentOrientation git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197546 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/fo/properties/WritingMode.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/java/org/apache/fop/fo/properties/WritingMode.java b/src/java/org/apache/fop/fo/properties/WritingMode.java index 43ce4ab50..b2670ec1b 100644 --- a/src/java/org/apache/fop/fo/properties/WritingMode.java +++ b/src/java/org/apache/fop/fo/properties/WritingMode.java @@ -314,5 +314,53 @@ public class WritingMode extends Property { return relAbsMaps[writingMode][relativeEdge]; } + /** Map of isHorizontal values for writing modes */ + private static final boolean[] horizontal = { + false + ,true // lr_tb + ,true // rl_tb + ,false // tb_rl + }; + + /** + * Mimics isHorizontal method from + * java.awt.ComponentOrientation. + * @param writingMode + * @return + * @throws PropertyException if the writing mode is invalid + */ + public static boolean isHorizontal(int writingMode) + throws PropertyException { + if (writingMode <= 0 || writingMode > MAX_WRITING_MODE) { + throw new PropertyException( + "Writing mode out of range:" + writingMode); + } + return horizontal[writingMode]; + } + + /** Map of isLeftToRight values for writing modes */ + private static final boolean[] leftToRight = { + false + ,true // lr_tb + ,false // rl_tb + ,false // tb_rl + }; + + /** + * Mimics isLeftToRight method from + * java.awt.ComponentOrientation. + * @param writingMode + * @return + * @throws PropertyException is the writing mode is invalid + */ + public static boolean isLeftToRight(int writingMode) + throws PropertyException { + if (writingMode <= 0 || writingMode > MAX_WRITING_MODE) { + throw new PropertyException( + "Writing mode out of range:" + writingMode); + } + return leftToRight[writingMode]; + } + } -- 2.39.5