]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Accomodated a 'none' decoration.
authorPeter Bernard West <pbwest@apache.org>
Fri, 6 Dec 2002 10:05:06 +0000 (10:05 +0000)
committerPeter Bernard West <pbwest@apache.org>
Fri, 6 Dec 2002 10:05:06 +0000 (10:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195734 13f79535-47bb-0310-9956-ffa450edef68

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

index 6a7e7e8df82c5aa2c27cff7bcdfd2242375dc35d..b14c5b01cb8fb6dae56c5200866ae0f137c414e2 100644 (file)
@@ -2,13 +2,14 @@ package org.apache.fop.fo.properties;
 
 import org.apache.fop.datatypes.PropertyValueList;
 import org.apache.fop.datatypes.NCName;
-import org.apache.fop.fo.PropertyConsts;
-import org.apache.fop.datastructs.ROStringArray;
-import org.apache.fop.datastructs.ROIntArray;
-import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.datatypes.None;
 import org.apache.fop.datatypes.PropertyValue;
 import org.apache.fop.datatypes.TextDecorations;
 import org.apache.fop.datatypes.TextDecorator;
+import org.apache.fop.datastructs.ROStringArray;
+import org.apache.fop.datastructs.ROIntArray;
+import org.apache.fop.fo.PropertyConsts;
+import org.apache.fop.fo.expr.PropertyException;
 import org.apache.fop.fo.PropNames;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.properties.Property;
@@ -26,17 +27,20 @@ public class TextDecoration extends Property  {
         return new TextDecorations
                             (PropNames.TEXT_DECORATION, NO_DECORATION);
     }
-    public static final int inherited = COMPUTED;
+    public static final int inherited = NO;
 
-    /** Text decoration constant */
+    /** Text decoration constant. */
     public static final byte
       NO_DECORATION = 0
          ,UNDERLINE = 1
           ,OVERLINE = 2
       ,LINE_THROUGH = 4
              ,BLINK = 8
+
+   ,ALL_DECORATIONS = UNDERLINE | OVERLINE | LINE_THROUGH | BLINK;
                     ;
 
+
     private static final String[] alternatives = {
                                 null
                                 ,"underline"
@@ -68,23 +72,34 @@ public class TextDecoration extends Property  {
     {
         byte onMask = NO_DECORATION;
         byte offMask = NO_DECORATION;
+        int type = list.getType();
         Iterator iter;
         PropertyValueList ssList = null;
         LinkedList strings = new LinkedList();
-        if ( ! (list instanceof PropertyValueList)) {
-            if ( ! (list instanceof NCName))
+        if ( ! (type == PropertyValue.LIST)) {
+            switch (type) {
+            case PropertyValue.NCNAME:
+                strings.add(((NCName)list).getNCName());
+                break;
+            case PropertyValue.NONE:
+                strings.add("none");
+                break;
+            default:
                 throw new PropertyException
-                    ("text-decoration require list of NCNames");
-            strings.add(((NCName)list).getNCName());
+                    ("text-decoration requires list of NCNames");
+            }
         } else { // list is a PropertyValueList
             ssList = spaceSeparatedList((PropertyValueList)list);
             iter = ((PropertyValueList)ssList).iterator();
             while (iter.hasNext()) {
                 Object value = iter.next();
-                if ( ! (value instanceof NCName))
+                if (value instanceof NCName)
+                    strings.add(((NCName)value).getNCName());
+                else if(value instanceof None)
+                    strings.add("none");
+                else
                     throw new PropertyException
                         ("text-decoration requires a list of NCNames");
-                strings.add(((NCName)value).getNCName());
             }
         }
         iter = strings.iterator();
@@ -94,6 +109,10 @@ public class TextDecoration extends Property  {
             boolean negate;
             negate = false;
             str = (String)iter.next();
+            if (str.equals("none")) {
+                offMask |= ALL_DECORATIONS;
+                break;
+            }
             str2 = str;
             if (str.indexOf("no-") == 0) {
                 str2 = str.substring(3);