diff options
Diffstat (limited to 'src/org/apache/fop/extensions/Outline.java')
-rw-r--r-- | src/org/apache/fop/extensions/Outline.java | 77 |
1 files changed, 23 insertions, 54 deletions
diff --git a/src/org/apache/fop/extensions/Outline.java b/src/org/apache/fop/extensions/Outline.java index 48efad0f4..4f8236c3e 100644 --- a/src/org/apache/fop/extensions/Outline.java +++ b/src/org/apache/fop/extensions/Outline.java @@ -7,10 +7,7 @@ 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.fo.FONode; import org.apache.fop.apps.FOPException; import java.util.*; @@ -18,79 +15,51 @@ import java.util.*; import org.xml.sax.Attributes; public class Outline extends ExtensionObj { - private Label _label; - private ArrayList _outlines = new ArrayList(); + private Label label; + private ArrayList outlines = new ArrayList(); - 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; + private String internalDestination; + private String externalDestination; public Outline(FONode parent) { super(parent); } public void handleAttrs(Attributes attlist) throws FOPException { - _internalDestination = - attlist.getValue(null, "internal-destination"); - _externalDestination = - attlist.getValue(null, "external-destination"); - if (_externalDestination != null &&!_externalDestination.equals("")) { + internalDestination = + attlist.getValue("internal-destination"); + externalDestination = + attlist.getValue("external-destination"); + if (externalDestination != null &&!externalDestination.equals("")) { log.warn("fox:outline external-destination not supported currently."); } - if (_internalDestination == null || _internalDestination.equals("")) { + if (internalDestination == null || internalDestination.equals("")) { log.warn("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; + label = (Label)obj; } else if (obj instanceof Outline) { - _outlines.add(obj); + outlines.add(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) : _label; - } - - public ArrayList getOutlines() { - return _outlines; + public BookmarkData getData() { + BookmarkData data = new BookmarkData(internalDestination); + data.setLabel(getLabel()); + for(int count = 0; count < outlines.size(); count++) { + Outline out = (Outline)outlines.get(count); + data.addSubData(out.getData()); + } + return data; } - public String getInternalDestination() { - return _internalDestination; + public String getLabel() { + return label == null ? "" : label.toString(); } } |