Browse Source

handles children of text elements


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193683 13f79535-47bb-0310-9956-ffa450edef68
tags/pre-columns
Keiron Liddle 24 years ago
parent
commit
bf8ed79811

+ 10
- 5
src/org/apache/fop/svg/SVGLengthListProperty.java View File

import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;


import org.apache.fop.dom.svg.*; import org.apache.fop.dom.svg.*;

import org.w3c.dom.svg.*;

/** /**
* a class representing all the length properties in SVG * a class representing all the length properties in SVG
*/ */
*/ */
public Property make(PropertyList propertyList, String value) public Property make(PropertyList propertyList, String value)
throws FOPException { throws FOPException {
SVGAnimatedLengthListImpl anime = new SVGAnimatedLengthListImpl();
SVGLengthListImpl len = new SVGLengthListImpl(); SVGLengthListImpl len = new SVGLengthListImpl();
anime.setBaseVal(len);
len.setValueAsString(value); len.setValueAsString(value);
return new SVGLengthListProperty(propertyList, len);
return new SVGLengthListProperty(propertyList, anime);
} }


/** /**
} }


/** the length as a Length object */ /** the length as a Length object */
protected SVGLengthListImpl value;
protected SVGAnimatedLengthList value;
/** /**
* construct an SVG length (called by the Maker). * construct an SVG length (called by the Maker).
* @param propertyList the property list this is a member of * @param propertyList the property list this is a member of
* @param explicitValue the explicit value as a Length object * @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.propertyList = propertyList;
this.value = explicitValue; this.value = explicitValue;
} }
* *
* @return the length as a Length object * @return the length as a Length object
*/ */
public /*SVGLengthList*/Vector getSVGLengthList() {
return this.value.valueList();
public SVGAnimatedLengthList getSVGLengthList() {
return this.value;
} }
} }

+ 9
- 16
src/org/apache/fop/svg/TRef.java View File

import org.apache.fop.dom.svg.*; import org.apache.fop.dom.svg.*;
import org.apache.fop.dom.svg.SVGArea; import org.apache.fop.dom.svg.SVGArea;


import org.w3c.dom.svg.SVGElement;
import org.w3c.dom.svg.*;


/** /**
* *
{ {
SVGTRefElementImpl tref = new SVGTRefElementImpl(); SVGTRefElementImpl tref = new SVGTRefElementImpl();
tref.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); 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; Property prop;
prop = this.properties.get("x"); 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"); 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"); 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"); 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.ref = this.properties.get("xlink:href").getString();
tref.setId(this.properties.get("id").getString()); tref.setId(this.properties.get("id").getString());
return tref; return tref;

+ 14
- 18
src/org/apache/fop/svg/TSpan.java View File

import org.apache.fop.layout.FontState; import org.apache.fop.layout.FontState;
import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;


import org.apache.fop.dom.CharacterDataImpl;
import org.apache.fop.dom.svg.*; import org.apache.fop.dom.svg.*;
import org.apache.fop.dom.svg.SVGArea; import org.apache.fop.dom.svg.SVGArea;


import org.w3c.dom.svg.SVGElement; import org.w3c.dom.svg.SVGElement;
import org.w3c.dom.CharacterData;


/** /**
* class representing svg:tspan pseudo flow object. * class representing svg:tspan pseudo flow object.
*/ */
protected void addCharacters(char data[], int start, int length) 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;
} }


/** /**
public SVGElement createTextElement() public SVGElement createTextElement()
{ {
tspan.setStyle(((SVGStyle)this.properties.get("style")).getStyle()); 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; Property prop;
prop = this.properties.get("x"); 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"); prop = this.properties.get("y");
// if(prop instanceof SVGLengthListProperty)
tspan.ylist = ((SVGLengthListProperty)prop).getSVGLengthList();
tspan.ylist = ((SVGLengthListProperty)prop).getSVGLengthList();
prop = this.properties.get("dx"); prop = this.properties.get("dx");
// if(prop instanceof SVGLengthListProperty)
tspan.dxlist = ((SVGLengthListProperty)prop).getSVGLengthList();
tspan.dxlist = ((SVGLengthListProperty)prop).getSVGLengthList();
prop = this.properties.get("dy"); 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()); tspan.setId(this.properties.get("id").getString());
return tspan; return tspan;
} }

+ 6
- 2
src/org/apache/fop/svg/Text.java View File

import org.apache.fop.dom.svg.*; import org.apache.fop.dom.svg.*;
import org.apache.fop.dom.svg.SVGTextElementImpl; import org.apache.fop.dom.svg.SVGTextElementImpl;
import org.apache.fop.dom.svg.SVGArea; import org.apache.fop.dom.svg.SVGArea;
import org.apache.fop.dom.CharacterDataImpl;


import org.w3c.dom.svg.SVGElement; import org.w3c.dom.svg.SVGElement;
import org.w3c.dom.CharacterData;


/** /**
* class representing svg:text pseudo flow object. * class representing svg:text pseudo flow object.
textGraph.appendChild(child); textGraph.appendChild(child);
} else if(obj instanceof String) { } else if(obj instanceof String) {
String str = (String)obj; String str = (String)obj;
// new CDATANode(str); ??
CharacterData cd = new CharacterDataImpl();
cd.setData(str);
textGraph.appendChild(cd);
} }
// System.out.println(child); // System.out.println(child);
} }
/* retrieve properties */ /* retrieve properties */
textGraph.x = ((SVGLengthProperty)this.properties.get("x")).getSVGLength().getValue(); textGraph.x = ((SVGLengthProperty)this.properties.get("x")).getSVGLength().getValue();
textGraph.y = ((SVGLengthProperty)this.properties.get("y")).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.setStyle(((SVGStyle)this.properties.get("style")).getStyle());
textGraph.setTransform(((SVGTransform)this.properties.get("transform")).getTransform()); textGraph.setTransform(((SVGTransform)this.properties.get("transform")).getTransform());
textGraph.setId(this.properties.get("id").getString()); textGraph.setId(this.properties.get("id").getString());

Loading…
Cancel
Save