]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Added isHorizontal and isLeftToRight methods, mimicking methods
authorPeter Bernard West <pbwest@apache.org>
Sun, 2 May 2004 02:56:15 +0000 (02:56 +0000)
committerPeter Bernard West <pbwest@apache.org>
Sun, 2 May 2004 02:56:15 +0000 (02:56 +0000)
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

src/java/org/apache/fop/fo/properties/WritingMode.java

index 43ce4ab5006b311c340289d7a74cd641879afb39..b2670ec1b42404c2584f4778138a552945062102 100644 (file)
@@ -314,5 +314,53 @@ public class WritingMode extends Property  {
         return relAbsMaps[writingMode][relativeEdge];
     }
 
+    /** Map of <code>isHorizontal</code> values for writing modes */
+    private static final boolean[] horizontal = {
+            false
+            ,true   // lr_tb
+            ,true   // rl_tb
+            ,false  // tb_rl
+    };
+
+    /**
+     * Mimics <code>isHorizontal</code> method from
+     * <code>java.awt.ComponentOrientation</code>.
+     * @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 <code>isLeftToRight</code> values for writing modes */
+    private static final boolean[] leftToRight = {
+            false
+            ,true   // lr_tb
+            ,false  // rl_tb
+            ,false  // tb_rl
+    };
+
+    /**
+     * Mimics <code>isLeftToRight</code> method from
+     * <code>java.awt.ComponentOrientation</code>.
+     * @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];
+    }
+
 }