git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193683 13f79535-47bb-0310-9956-ffa450edef68tags/pre-columns
@@ -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; | |||
} | |||
} |
@@ -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; |
@@ -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; | |||
} |
@@ -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()); |