aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2000-09-04 00:46:51 +0000
committerKeiron Liddle <keiron@apache.org>2000-09-04 00:46:51 +0000
commitbf8ed7981157cf196d2d27e2d37cefb304b21bac (patch)
tree6080471390e2e7f8bda8d4111ccd910aa05e4af3 /src
parent5f0d33f723ef8affae89b9346deb287c6c702e04 (diff)
downloadxmlgraphics-fop-bf8ed7981157cf196d2d27e2d37cefb304b21bac.tar.gz
xmlgraphics-fop-bf8ed7981157cf196d2d27e2d37cefb304b21bac.zip
handles children of text elements
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193683 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/svg/SVGLengthListProperty.java15
-rw-r--r--src/org/apache/fop/svg/TRef.java25
-rw-r--r--src/org/apache/fop/svg/TSpan.java32
-rw-r--r--src/org/apache/fop/svg/Text.java8
4 files changed, 39 insertions, 41 deletions
diff --git a/src/org/apache/fop/svg/SVGLengthListProperty.java b/src/org/apache/fop/svg/SVGLengthListProperty.java
index 7ebe0bd44..bcb955a16 100644
--- a/src/org/apache/fop/svg/SVGLengthListProperty.java
+++ b/src/org/apache/fop/svg/SVGLengthListProperty.java
@@ -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;
}
}
diff --git a/src/org/apache/fop/svg/TRef.java b/src/org/apache/fop/svg/TRef.java
index 4fe43ca2c..8d4f93846 100644
--- a/src/org/apache/fop/svg/TRef.java
+++ b/src/org/apache/fop/svg/TRef.java
@@ -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;
diff --git a/src/org/apache/fop/svg/TSpan.java b/src/org/apache/fop/svg/TSpan.java
index 02f565df9..f4b7624c5 100644
--- a/src/org/apache/fop/svg/TSpan.java
+++ b/src/org/apache/fop/svg/TSpan.java
@@ -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;
}
diff --git a/src/org/apache/fop/svg/Text.java b/src/org/apache/fop/svg/Text.java
index ebb0027bf..35e6ac964 100644
--- a/src/org/apache/fop/svg/Text.java
+++ b/src/org/apache/fop/svg/Text.java
@@ -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());