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 ke...@locus.apache.org on 2000/09/04 02:46:52 UTC

cvs commit: xml-fop/src/org/apache/fop/svg SVGLengthListProperty.java TRef.java TSpan.java Text.java

keiron      00/09/03 17:46:52

  Modified:    src/org/apache/fop/svg SVGLengthListProperty.java TRef.java
                        TSpan.java Text.java
  Log:
  handles children of text elements
  
  Revision  Changes    Path
  1.3       +11 -6     xml-fop/src/org/apache/fop/svg/SVGLengthListProperty.java
  
  Index: SVGLengthListProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/SVGLengthListProperty.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SVGLengthListProperty.java	2000/08/28 23:54:20	1.2
  +++ SVGLengthListProperty.java	2000/09/04 00:46:51	1.3
  @@ -1,4 +1,4 @@
  -/*-- $Id: SVGLengthListProperty.java,v 1.2 2000/08/28 23:54:20 keiron Exp $ -- 
  +/*-- $Id: SVGLengthListProperty.java,v 1.3 2000/09/04 00:46:51 keiron Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -58,6 +58,9 @@
   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 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 @@
   	}
   
   	/** the length as a Length object */
  -	protected SVGLengthListImpl value;
  +	protected SVGAnimatedLengthList value;
   	
   	/**
   	 * construct an SVG length (called by the Maker).
  @@ -116,7 +121,7 @@
   	 * @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 @@
   	 *
   	 * @return the length as a Length object
   	 */
  -	public /*SVGLengthList*/Vector getSVGLengthList() {
  -		return this.value.valueList();
  +	public SVGAnimatedLengthList getSVGLengthList() {
  +		return this.value;
   	}
   }
  
  
  
  1.3       +10 -17    xml-fop/src/org/apache/fop/svg/TRef.java
  
  Index: TRef.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/TRef.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TRef.java	2000/08/28 23:54:23	1.2
  +++ TRef.java	2000/09/04 00:46:51	1.3
  @@ -1,4 +1,4 @@
  -/*-- $Id: TRef.java,v 1.2 2000/08/28 23:54:23 keiron Exp $ -- 
  +/*-- $Id: TRef.java,v 1.3 2000/09/04 00:46:51 keiron Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -60,7 +60,7 @@
   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 @@
   	{
   		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;
  
  
  
  1.3       +15 -19    xml-fop/src/org/apache/fop/svg/TSpan.java
  
  Index: TSpan.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/TSpan.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TSpan.java	2000/08/28 23:54:23	1.2
  +++ TSpan.java	2000/09/04 00:46:51	1.3
  @@ -1,4 +1,4 @@
  -/*-- $Id: TSpan.java,v 1.2 2000/08/28 23:54:23 keiron Exp $ -- 
  +/*-- $Id: TSpan.java,v 1.3 2000/09/04 00:46:51 keiron Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -57,10 +57,12 @@
   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 @@
   	 */
   	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 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;
   	}
  
  
  
  1.10      +7 -3      xml-fop/src/org/apache/fop/svg/Text.java
  
  Index: Text.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/Text.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Text.java	2000/08/28 23:54:24	1.9
  +++ Text.java	2000/09/04 00:46:51	1.10
  @@ -1,4 +1,4 @@
  -/*-- $Id: Text.java,v 1.9 2000/08/28 23:54:24 keiron Exp $ -- 
  +/*-- $Id: Text.java,v 1.10 2000/09/04 00:46:51 keiron Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -64,8 +64,10 @@
   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 @@
   				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());