You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by pb...@apache.org on 2002/12/06 11:05:06 UTC

cvs commit: xml-fop/src/org/apache/fop/fo/properties TextDecoration.java

pbwest      2002/12/06 02:05:06

  Modified:    src/org/apache/fop/fo/properties Tag: FOP_0-20-0_Alt-Design
                        TextDecoration.java
  Log:
  Accomodated a 'none' decoration.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +31 -12    xml-fop/src/org/apache/fop/fo/properties/Attic/TextDecoration.java
  
  Index: TextDecoration.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/properties/Attic/TextDecoration.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- TextDecoration.java	29 Nov 2002 16:30:17 -0000	1.1.2.5
  +++ TextDecoration.java	6 Dec 2002 10:05:06 -0000	1.1.2.6
  @@ -2,13 +2,14 @@
   
   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 @@
           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 @@
       {
           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 @@
               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);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org