aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/svg
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2002-02-26 12:43:10 +0000
committerKeiron Liddle <keiron@apache.org>2002-02-26 12:43:10 +0000
commit06f1a67571fc02ac28eb8fe97bce1aa21362bf6b (patch)
tree65618a4be92cd2e8e3cc3e5db5c11dd2ba7ef187 /src/org/apache/fop/svg
parent6149a1b0be49d64f31d27c26c11f542fc642d246 (diff)
downloadxmlgraphics-fop-06f1a67571fc02ac28eb8fe97bce1aa21362bf6b.tar.gz
xmlgraphics-fop-06f1a67571fc02ac28eb8fe97bce1aa21362bf6b.zip
remove SVGArea and ImageArea, no longer needed
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194674 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/svg')
-rw-r--r--src/org/apache/fop/svg/SVGArea.java52
-rw-r--r--src/org/apache/fop/svg/SVGElement.java60
2 files changed, 15 insertions, 97 deletions
diff --git a/src/org/apache/fop/svg/SVGArea.java b/src/org/apache/fop/svg/SVGArea.java
deleted file mode 100644
index 8935b42ac..000000000
--- a/src/org/apache/fop/svg/SVGArea.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
-package org.apache.fop.svg;
-
-// FOP
-import org.apache.fop.render.Renderer;
-import org.apache.fop.layout.FontState;
-import org.apache.fop.layout.Area;
-
-//import java.util.*;
-
-import org.w3c.dom.svg.*;
-import org.w3c.dom.*;
-
-/**
- * class representing an SVG area in which the SVG graphics sit
- */
-public class SVGArea extends Area {
- Document doc;
-
- /**
- * construct an SVG area
- *
- * @param fontState the font state
- * @param width the width of the area
- * @param height the height of the area
- */
- public SVGArea(FontState fontState, float width, float height) {
- super(fontState, (int)width * 1000, (int)height * 1000);
- currentHeight = (int)height * 1000;
- contentRectangleWidth = (int)width * 1000;
- }
-
- public void setSVGDocument(Document doc) {
- this.doc = doc;
- }
-
- public Document getSVGDocument() {
- return doc;
- }
-
- public int getWidth() {
- // return getSVGDocument().getRootElement().getWidth().getBaseVal().getValue();
- return contentRectangleWidth;
- }
-
-}
diff --git a/src/org/apache/fop/svg/SVGElement.java b/src/org/apache/fop/svg/SVGElement.java
index f369ab466..7b34c1f8a 100644
--- a/src/org/apache/fop/svg/SVGElement.java
+++ b/src/org/apache/fop/svg/SVGElement.java
@@ -45,14 +45,13 @@ import java.util.List;
import java.util.ArrayList;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
+import java.awt.Dimension;
/**
* class representing svg:svg pseudo flow object.
*/
public class SVGElement extends SVGObj {
- FontState fs;
-
/**
* constructs an SVG object (called by Maker).
*
@@ -68,21 +67,7 @@ public class SVGElement extends SVGObj {
init();
}
- /**
- * layout this formatting object.
- *
- * @param area the area to layout the object into
- *
- * @return the status of the layout
- */
- public Status layout(final Area area) throws FOPException {
-
- if (!(area instanceof ForeignObjectArea)) {
- // this is an error
- throw new FOPException("SVG not in fo:instream-foreign-object");
- }
-
- this.fs = area.getFontState();
+ public Point2D getDimension(Point2D view) {
// TODO - change so doesn't hold onto fo,area tree
Element svgRoot = element;
@@ -90,15 +75,14 @@ public class SVGElement extends SVGObj {
/* if width and height are zero, get the bounds of the content. */
FOPSVGContext dc = new FOPSVGContext();
dc.svgRoot = element;
- ForeignObjectArea foa = (ForeignObjectArea)area;
- dc.cwauto = foa.isContentWidthAuto();
- dc.chauto = foa.isContentHeightAuto();
- dc.cwidth = foa.getContentWidth();
- dc.cheight = foa.getContentHeight();
+ dc.cwauto = (view.getX() == -1);
+ dc.chauto = (view.getY() == -1);
+ dc.cwidth = (float)view.getX();
+ dc.cheight = (float)view.getY();
((SVGOMDocument)doc).setSVGContext(dc);
try {
- String baseDir = Configuration.getStringValue("baseDir");
+ String baseDir = userAgent.getBaseDirectory();
if(baseDir != null) {
((SVGOMDocument)doc).setURLObject(new URL(baseDir));
}
@@ -112,23 +96,9 @@ public class SVGElement extends SVGObj {
e.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns", SVGDOMImplementation.SVG_NAMESPACE_URI);
//}
- Point2D p2d = getSize(this.fs, svgRoot);
-
- SVGArea svg = new SVGArea(fs, (float)p2d.getX(),
- (float)p2d.getY());
- svg.setSVGDocument(doc);
- svg.start();
-
- /* finish off the SVG area */
- svg.end();
-
- /* add the SVG area to the containing area */
- foa.setObject(svg);
- foa.setIntrinsicWidth(svg.getWidth());
- foa.setIntrinsicHeight(svg.getHeight());
+ Point2D p2d = getSize(12 /* font size */, svgRoot);
- /* return status */
- return new Status(Status.OK);
+ return p2d;
}
private void init() {
@@ -141,10 +111,10 @@ public class SVGElement extends SVGObj {
buildTopLevel(doc, element);
}
- public static Point2D getSize(FontState fs, Element svgRoot) {
+ public static Point2D getSize(int size, Element svgRoot) {
String str;
UnitProcessor.Context ctx;
- ctx = new PDFUnitContext(fs, svgRoot);
+ ctx = new PDFUnitContext(size, svgRoot);
str = svgRoot.getAttributeNS(null, SVGConstants.SVG_WIDTH_ATTRIBUTE);
if (str.length() == 0) str = "100%";
float width = UnitProcessor.svgHorizontalLengthToUserSpace
@@ -166,10 +136,10 @@ public class SVGElement extends SVGObj {
/** The element. */
protected Element e;
- protected FontState fs;
- public PDFUnitContext(FontState fs, Element e) {
+ protected int fontSize;
+ public PDFUnitContext(int size, Element e) {
this.e = e;
- this.fs = fs;
+ this.fontSize = size;
}
/**
@@ -209,7 +179,7 @@ public class SVGElement extends SVGObj {
public CSSPrimitiveValue getFontSize() {
return new CSSOMReadOnlyValue
(new ImmutableFloat(CSSPrimitiveValue.CSS_PT,
- fs.getFontSize()));
+ fontSize));
}
/**