+++ /dev/null
-/*
- * $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.extensions;
-
-import org.apache.fop.fo.*;
-import org.apache.fop.fo.properties.ExtensionPropertyMapping;
-import org.apache.fop.fo.TreeBuilder;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-public class ExtensionElementMapping implements ElementMapping {
-
- public static final String URI = "http://xml.apache.org/fop/extensions";
-
- public void addToBuilder(TreeBuilder builder) {
- builder.addMapping(URI, "outline", Outline.maker());
- builder.addMapping(URI, "label", Label.maker());
-
-
- builder.addPropertyList(ExtensionElementMapping.URI,
- ExtensionPropertyMapping.getGenericMappings());
- /* Add any element mappings */
- for (Enumeration e = ExtensionPropertyMapping.getElementMappings();
- e.hasMoreElements(); ) {
- String elem = (String)e.nextElement();
- builder.addElementPropertyList(ExtensionElementMapping.URI, elem,
- ExtensionPropertyMapping.getElementMapping(elem));
- }
- }
-
-}
+++ /dev/null
-/*
- * $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.extensions;
-
-import org.apache.fop.fo.*;
-import org.apache.fop.layout.*;
-import org.apache.fop.apps.FOPException;
-
-/**
- * base class for extension objects
- */
-public abstract class ExtensionObj extends FObj {
-
- /**
- *
- * @param parent the parent formatting object
- * @param propertyList the explicit properties of this object
- */
- public ExtensionObj(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- }
-
- /**
- * Called for extensions within a page sequence or flow. These extensions
- * are allowed to generate visible areas within the layout.
- *
- *
- * @param area
- */
- public Status layout(Area area) throws FOPException {
- ExtensionArea extArea = new ExtensionArea(this);
- area.addChild(extArea);
- return new Status(Status.OK);
- }
-
-
- /**
- * Called for root extensions. Root extensions aren't allowed to generate
- * any visible areas. They are used for extra items that don't show up in
- * the page layout itself. For example: pdf outlines
- *
- * @param areaTree
- */
- public void format(AreaTree areaTree) throws FOPException {
- ExtensionArea extArea = new ExtensionArea(this);
- areaTree.addExtension(this);
- }
-
-}
+++ /dev/null
-/*
- * $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.extensions;
-
-import org.apache.fop.fo.*;
-
-
-public class Label extends ExtensionObj {
- private String _label = "";
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent, PropertyList propertyList) {
- return new Label(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Label.Maker();
- }
-
- public Label(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
- }
-
- protected void addCharacters(char data[], int start, int end) {
- _label += new String(data, start, end - start);
- }
-
- public String toString() {
- return _label;
- }
-
-
-}
+++ /dev/null
-/*
- * $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.extensions;
-
-import org.apache.fop.fo.*;
-import org.apache.fop.pdf.PDFGoTo;
-import org.apache.fop.pdf.PDFAction;
-import org.apache.fop.datatypes.IDReferences;
-import org.apache.fop.messaging.MessageHandler;
-
-import java.util.*;
-
-
-public class Outline extends ExtensionObj {
- private Label _label;
- private Vector _outlines = new Vector();
-
- private String _internalDestination;
- private String _externalDestination;
-
- /**
- * The parent outline object if it exists
- */
- private Outline _parentOutline;
-
- /**
- * an opaque renderer context object, e.g. PDFOutline for PDFRenderer
- */
- private Object _rendererObject;
-
-
- public static class Maker extends FObj.Maker {
- public FObj make(FObj parent, PropertyList propertyList) {
- return new Outline(parent, propertyList);
- }
-
- }
-
- public static FObj.Maker maker() {
- return new Outline.Maker();
- }
-
- public Outline(FObj parent, PropertyList propertyList) {
- super(parent, propertyList);
-
- _internalDestination =
- this.properties.get("internal-destination").getString();
- _externalDestination =
- this.properties.get("external-destination").getString();
- if (_externalDestination != null &&!_externalDestination.equals("")) {
- MessageHandler.errorln("WARNING: fox:outline external-destination not supported currently.");
- }
-
- if (_internalDestination == null || _internalDestination.equals("")) {
- MessageHandler.errorln("WARNING: fox:outline requires an internal-destination.");
- }
-
- for (FONode node = getParent(); node != null;
- node = node.getParent()) {
- if (node instanceof Outline) {
- _parentOutline = (Outline)node;
- break;
- }
- }
-
- }
-
- protected void addChild(FONode obj) {
- if (obj instanceof Label) {
- _label = (Label)obj;
- } else if (obj instanceof Outline) {
- _outlines.addElement(obj);
- }
- super.addChild(obj);
- }
-
-
- public void setRendererObject(Object o) {
- _rendererObject = o;
- }
-
- public Object getRendererObject() {
- return _rendererObject;
- }
-
- public Outline getParentOutline() {
- return _parentOutline;
- }
-
- public Label getLabel() {
- return _label == null ? new Label(this, this.properties) : _label;
- }
-
- public Vector getOutlines() {
- return _outlines;
- }
-
- public String getInternalDestination() {
- return _internalDestination;
- }
-
-
-
-}
-