aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/area
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-01-07 10:52:09 +0000
committerJeremias Maerki <jeremias@apache.org>2008-01-07 10:52:09 +0000
commit6415c9acd2fcfeb4961d53b8b5b967ad1010dceb (patch)
treeb75183e52d13946c1d9e58bc9453ccd03434dfd4 /src/java/org/apache/fop/area
parent47571de516042aee166a579e6d984697ac60146c (diff)
downloadxmlgraphics-fop-6415c9acd2fcfeb4961d53b8b5b967ad1010dceb.tar.gz
xmlgraphics-fop-6415c9acd2fcfeb4961d53b8b5b967ad1010dceb.zip
Reenabled documentation for fox:destination.
Enabled intermediate format functionality for fox:destination. Added a test case to check fox:destination. Deprecated FOP's XMLizable in favor of the XML Graphics Commons variant (and extend that variant). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@609567 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/area')
-rw-r--r--src/java/org/apache/fop/area/AreaTreeParser.java40
-rw-r--r--src/java/org/apache/fop/area/DestinationData.java17
2 files changed, 43 insertions, 14 deletions
diff --git a/src/java/org/apache/fop/area/AreaTreeParser.java b/src/java/org/apache/fop/area/AreaTreeParser.java
index aa499338b..b4a804712 100644
--- a/src/java/org/apache/fop/area/AreaTreeParser.java
+++ b/src/java/org/apache/fop/area/AreaTreeParser.java
@@ -36,16 +36,25 @@ import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.area.Trait.InternalLink;
import org.apache.fop.area.Trait.Background;
-import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.area.Trait.InternalLink;
import org.apache.fop.area.inline.AbstractTextArea;
import org.apache.fop.area.inline.Character;
import org.apache.fop.area.inline.ForeignObject;
import org.apache.fop.area.inline.Image;
+import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.InlineBlockParent;
import org.apache.fop.area.inline.InlineParent;
import org.apache.fop.area.inline.Leader;
@@ -68,12 +77,6 @@ import org.apache.fop.util.ContentHandlerFactory;
import org.apache.fop.util.ContentHandlerFactoryRegistry;
import org.apache.fop.util.DefaultErrorListener;
import org.apache.fop.util.QName;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
/**
* This is a parser for the area tree XML (intermediate format) which is used to reread an area
@@ -179,6 +182,7 @@ public class AreaTreeParser {
makers.put("foreignObject", new ForeignObjectMaker());
makers.put("bookmarkTree", new BookmarkTreeMaker());
makers.put("bookmark", new BookmarkMaker());
+ makers.put("destination", new DestinationMaker());
}
private static Rectangle2D parseRect(String rect) {
@@ -922,6 +926,26 @@ public class AreaTreeParser {
}
}
+ private class DestinationMaker extends AbstractMaker {
+
+ public void startElement(Attributes attributes) {
+ String[] linkdata
+ = InternalLink.parseXMLAttribute(lastAttributes.getValue("internal-link"));
+ PageViewport pv = (PageViewport) pageViewportsByKey.get(linkdata[0]);
+ DestinationData dest = new DestinationData(linkdata[1]);
+ List pages = new java.util.ArrayList();
+ pages.add(pv);
+ dest.resolveIDRef(linkdata[1], pages);
+ areaStack.push(dest);
+ }
+
+ public void endElement() {
+ Object tos = areaStack.pop();
+ assertObjectOfClass(tos, DestinationData.class);
+ treeModel.handleOffDocumentItem((DestinationData) tos);
+ }
+ }
+
// ====================================================================
diff --git a/src/java/org/apache/fop/area/DestinationData.java b/src/java/org/apache/fop/area/DestinationData.java
index b23605972..2cff02ef4 100644
--- a/src/java/org/apache/fop/area/DestinationData.java
+++ b/src/java/org/apache/fop/area/DestinationData.java
@@ -22,7 +22,6 @@ package org.apache.fop.area;
import java.util.List;
import org.apache.fop.fo.extensions.destination.Destination;
-import org.apache.fop.area.PageViewport;
/**
* An instance of this class is named destination from fox:destination
*/
@@ -46,11 +45,19 @@ public class DestinationData extends AbstractOffDocumentItem implements Resolvab
* @param destination the fo:bookmark object
*/
public DestinationData(Destination destination) {
- idRef = destination.getInternalDestination();
- idRefs = new String[] {idRef};
+ this(destination.getInternalDestination());
}
/**
+ * Create a new named destination.
+ * @param idRef the id reference of the destination
+ */
+ public DestinationData(String idRef) {
+ this.idRef = idRef;
+ this.idRefs = new String[] {idRef};
+ }
+
+ /**
* Get the idref for this destination
*
* @return the idref for the destination
@@ -99,9 +106,7 @@ public class DestinationData extends AbstractOffDocumentItem implements Resolvab
// TODO get rect area of id on page
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String getName() {
return "Destination";
}