aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/area/BookmarkData.java
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-12-17 00:19:11 +0000
committerGlen Mazza <gmazza@apache.org>2004-12-17 00:19:11 +0000
commit5e3226de17b719d795eaa44bc7d940c5a80fc808 (patch)
treefc8c77e10e24bc602f3212d3cabc1e35d6c2ff61 /src/java/org/apache/fop/area/BookmarkData.java
parent316fa029c4eae2f0f68e730828aa125b947a64fb (diff)
downloadxmlgraphics-fop-5e3226de17b719d795eaa44bc7d940c5a80fc808.tar.gz
xmlgraphics-fop-5e3226de17b719d795eaa44bc7d940c5a80fc808.zip
Moved the (upcoming) fo:bookmark-tree construction code from AreaTreeHandler
to the BookmarkData object. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198203 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/area/BookmarkData.java')
-rw-r--r--src/java/org/apache/fop/area/BookmarkData.java32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/area/BookmarkData.java b/src/java/org/apache/fop/area/BookmarkData.java
index 9e814a0d9..8a0a4b39d 100644
--- a/src/java/org/apache/fop/area/BookmarkData.java
+++ b/src/java/org/apache/fop/area/BookmarkData.java
@@ -22,6 +22,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
+import org.apache.fop.fo.extensions.Bookmarks;
+import org.apache.fop.fo.extensions.Outline;
+
/**
* An instance of this class is either a PDF bookmark-tree and
* its child bookmark-items, or a bookmark-item and the child
@@ -46,10 +49,17 @@ public class BookmarkData extends OffDocumentItem implements Resolvable {
* Create a new bookmark data object.
* This should only be called by the bookmark-tree item because
* it has no idref item that needs to be resolved.
+ *
+ * @param bookmarks fo:bookmark-tree for this document
*/
- public BookmarkData() {
+ public BookmarkData(Bookmarks bookmarks) {
idRef = null;
whenToProcess = END_OF_DOC;
+
+ for (int count = 0; count < bookmarks.getOutlines().size(); count++) {
+ Outline out = (Outline)(bookmarks.getOutlines()).get(count);
+ addSubData(createBookmarkData(out));
+ }
}
/**
@@ -183,5 +193,25 @@ public class BookmarkData extends OffDocumentItem implements Resolvable {
public String getName() {
return "Bookmarks";
}
+
+ /**
+ * Create and return the bookmark data for this outline.
+ * This creates a bookmark data with the destination
+ * and adds all the data from child outlines.
+ *
+ * @param outline the Outline object for which a bookmark entry should be
+ * created
+ * @return the new bookmark data
+ */
+ private BookmarkData createBookmarkData(Outline outline) {
+ BookmarkData data = new BookmarkData(outline.getInternalDestination());
+ data.setLabel(outline.getLabel());
+ for (int count = 0; count < outline.getOutlines().size(); count++) {
+ Outline out = (Outline)(outline.getOutlines()).get(count);
+ data.addSubData(createBookmarkData(out));
+ }
+ return data;
+ }
+
}