]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
handles children of text elements
authorKeiron Liddle <keiron@apache.org>
Mon, 4 Sep 2000 00:46:51 +0000 (00:46 +0000)
committerKeiron Liddle <keiron@apache.org>
Mon, 4 Sep 2000 00:46:51 +0000 (00:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193683 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/svg/SVGLengthListProperty.java
src/org/apache/fop/svg/TRef.java
src/org/apache/fop/svg/TSpan.java
src/org/apache/fop/svg/Text.java

index 7ebe0bd4470a5a71cc57a7c816337005d36658ec..bcb955a164277c8e5a1a51aa54a7c3f07a251503 100644 (file)
@@ -58,6 +58,9 @@ import org.apache.fop.datatypes.*;
 import org.apache.fop.apps.FOPException;
 
 import org.apache.fop.dom.svg.*;
+
+import org.w3c.dom.svg.*;
+
 /**
  * a class representing all the length properties in SVG
  */
@@ -83,9 +86,11 @@ public class SVGLengthListProperty extends Property {
         */
        public Property make(PropertyList propertyList, String value)
                throws FOPException {
+               SVGAnimatedLengthListImpl anime = new SVGAnimatedLengthListImpl();
                SVGLengthListImpl len = new SVGLengthListImpl();
+               anime.setBaseVal(len);
                len.setValueAsString(value);
-               return new SVGLengthListProperty(propertyList, len);
+               return new SVGLengthListProperty(propertyList, anime);
        }
 
        /** 
@@ -108,7 +113,7 @@ public class SVGLengthListProperty extends Property {
        }
 
        /** the length as a Length object */
-       protected SVGLengthListImpl value;
+       protected SVGAnimatedLengthList value;
        
        /**
         * construct an SVG length (called by the Maker).
@@ -116,7 +121,7 @@ public class SVGLengthListProperty extends Property {
         * @param propertyList the property list this is a member of
         * @param explicitValue the explicit value as a Length object
         */
-       protected SVGLengthListProperty(PropertyList propertyList, SVGLengthListImpl explicitValue) {
+       protected SVGLengthListProperty(PropertyList propertyList, SVGAnimatedLengthList explicitValue) {
        this.propertyList = propertyList;
        this.value = explicitValue;
        }
@@ -126,7 +131,7 @@ public class SVGLengthListProperty extends Property {
         *
         * @return the length as a Length object
         */
-       public /*SVGLengthList*/Vector getSVGLengthList() {
-               return this.value.valueList();
+       public SVGAnimatedLengthList getSVGLengthList() {
+               return this.value;
        }
 }
index 4fe43ca2cdb7a871ac419e39ade44d37ba500b5f..8d4f9384607a4dbe7536c794b992f4f0840cac28 100644 (file)
@@ -60,7 +60,7 @@ import org.apache.fop.apps.FOPException;
 import org.apache.fop.dom.svg.*;
 import org.apache.fop.dom.svg.SVGArea;
 
-import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.svg.*;
 
 /**
  *
@@ -110,26 +110,19 @@ public class TRef extends SVGObj implements TextElement {
        {
                SVGTRefElementImpl tref = new SVGTRefElementImpl();
                tref.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
-//             tref.dx = ((SVGLengthProperty)this.properties.get("dx")).getSVGLength().mvalue();
-//             tref.dy = ((SVGLengthProperty)this.properties.get("dy")).getSVGLength().mvalue();
-//             tref.x = ((SVGLengthProperty)this.properties.get("x")).getSVGLength().mvalue();
-//             tref.y = ((SVGLengthProperty)this.properties.get("y")).getSVGLength().mvalue();
                Property prop;
                prop = this.properties.get("x");
-               // bit of a hack, but otherwise the svg:text x element could be
-               // returned which is not a list
-//             if(prop instanceof SVGLengthListProperty)
-                       tref.xlist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               SVGAnimatedLengthList xlist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               tref.xlist = xlist;
                prop = this.properties.get("y");
-//             if(prop instanceof SVGLengthListProperty)
-                       tref.ylist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               SVGAnimatedLengthList ylist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               tref.ylist = ylist;
                prop = this.properties.get("dx");
-//             if(prop instanceof SVGLengthListProperty)
-                       tref.dxlist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               SVGAnimatedLengthList dxlist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               tref.dxlist = dxlist;
                prop = this.properties.get("dy");
-//             if(prop instanceof SVGLengthListProperty)
-                       tref.dylist = ((SVGLengthListProperty)prop).getSVGLengthList();
-//             tref.dxlist = ((SVGLengthProperty)this.properties.get("dx")).getSVGLength().valueList();
+               SVGAnimatedLengthList dylist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               tref.dylist = dylist;
                tref.ref = this.properties.get("xlink:href").getString();
                tref.setId(this.properties.get("id").getString());
                return tref;
index 02f565df9ac66b85e0cebb3575b635662665f6d4..f4b7624c57d58ae13aa26f4351b59c040cd56d11 100644 (file)
@@ -57,10 +57,12 @@ import org.apache.fop.layout.Area;
 import org.apache.fop.layout.FontState;
 import org.apache.fop.apps.FOPException;
 
+import org.apache.fop.dom.CharacterDataImpl;
 import org.apache.fop.dom.svg.*;
 import org.apache.fop.dom.svg.SVGArea;
 
 import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.CharacterData;
 
 /**
  * class representing svg:tspan pseudo flow object.
@@ -107,8 +109,11 @@ public class TSpan extends SVGObj implements TextElement {
         */
        protected void addCharacters(char data[], int start, int length)
        {
-               this.text += new String(data, start, length - start);
-               tspan.str = this.text;
+               this.text = new String(data, start, length - start);
+               CharacterData cd = new CharacterDataImpl();
+               cd.setData(text);
+               tspan.appendChild(cd);
+//             tspan.str = this.text;
        }
 
        /**
@@ -125,27 +130,18 @@ public class TSpan extends SVGObj implements TextElement {
        public SVGElement createTextElement()
        {
                tspan.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
-//             tspan.dx = ((SVGLengthProperty)this.properties.get("dx")).getSVGLength().mvalue();
-//             tspan.dy = ((SVGLengthProperty)this.properties.get("dy")).getSVGLength().mvalue();
-//             tspan.x = ((SVGLengthListProperty)this.properties.get("x")).getSVGLength().mvalue();
-//             tspan.y = ((SVGLengthProperty)this.properties.get("y")).getSVGLength().mvalue();
+/*             CharacterData cd = new CharacterDataImpl();
+               cd.setData(text);
+               tspan.appendChild(cd);*/
                Property prop;
                prop = this.properties.get("x");
-               // bit of a hack, but otherwise the svg:text x element coud be
-               // returned which is not a list
-//             if(prop instanceof SVGLengthListProperty)
-                       tspan.xlist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               tspan.xlist = ((SVGLengthListProperty)prop).getSVGLengthList();
                prop = this.properties.get("y");
-//             if(prop instanceof SVGLengthListProperty)
-                       tspan.ylist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               tspan.ylist = ((SVGLengthListProperty)prop).getSVGLengthList();
                prop = this.properties.get("dx");
-//             if(prop instanceof SVGLengthListProperty)
-                       tspan.dxlist = ((SVGLengthListProperty)prop).getSVGLengthList();
+               tspan.dxlist = ((SVGLengthListProperty)prop).getSVGLengthList();
                prop = this.properties.get("dy");
-//             if(prop instanceof SVGLengthListProperty)
-                       tspan.dylist = ((SVGLengthListProperty)prop).getSVGLengthList();
-//             tspan.xlist = ((SVGLengthListProperty)this.properties.get("x")).getSVGLengthList();
-//             tspan.dxlist = ((SVGLengthProperty)this.properties.get("dx")).getSVGLength().valueList();
+               tspan.dylist = ((SVGLengthListProperty)prop).getSVGLengthList();
                tspan.setId(this.properties.get("id").getString());
                return tspan;
        }
index ebb0027bf8d4a2aa4dfd9bdc76c53f63137758c2..35e6ac964abff79d39380d3ca173517964efb6bf 100644 (file)
@@ -64,8 +64,10 @@ import java.util.*;
 import org.apache.fop.dom.svg.*;
 import org.apache.fop.dom.svg.SVGTextElementImpl;
 import org.apache.fop.dom.svg.SVGArea;
+import org.apache.fop.dom.CharacterDataImpl;
 
 import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.CharacterData;
 
 /**
  * class representing svg:text pseudo flow object.
@@ -156,14 +158,16 @@ public class Text extends SVGObj {
                                textGraph.appendChild(child);
                        } else if(obj instanceof String) {
                                String str = (String)obj;
-                               // new CDATANode(str); ??
+                               CharacterData cd = new CharacterDataImpl();
+                               cd.setData(str);
+                               textGraph.appendChild(cd);
                        }
 //                     System.out.println(child);
                }
                /* retrieve properties */
                textGraph.x = ((SVGLengthProperty)this.properties.get("x")).getSVGLength().getValue();
                textGraph.y = ((SVGLengthProperty)this.properties.get("y")).getSVGLength().getValue();
-               textGraph.textList = textList;
+//             textGraph.textList = textList;
                textGraph.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
                textGraph.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
                textGraph.setId(this.properties.get("id").getString());