aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-10-06 15:52:46 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-10-06 15:52:46 +0000
commitbc04dfeebbe1aa3efff53517903f70403b9cb773 (patch)
treec91b5724e91f5fd510c20ce9881756b322c26843 /src/java/org/apache/fop
parent37d588c2610f156838e7ae1c0a31f2b05ff80a1b (diff)
downloadxmlgraphics-fop-bc04dfeebbe1aa3efff53517903f70403b9cb773.tar.gz
xmlgraphics-fop-bc04dfeebbe1aa3efff53517903f70403b9cb773.zip
move logic for creating area tree bookmarks from layoutmgr/LayoutManagerLS to area/AreaTree:
1. because it is not layout related 2. so that it can be reused by other Layout Strategies git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196942 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/area/AreaTree.java44
-rw-r--r--src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java42
2 files changed, 44 insertions, 42 deletions
diff --git a/src/java/org/apache/fop/area/AreaTree.java b/src/java/org/apache/fop/area/AreaTree.java
index a5585494a..c4f8ece85 100644
--- a/src/java/org/apache/fop/area/AreaTree.java
+++ b/src/java/org/apache/fop/area/AreaTree.java
@@ -50,6 +50,10 @@
*/
package org.apache.fop.area;
+import org.apache.fop.area.extensions.BookmarkData;
+import org.apache.fop.fo.extensions.Outline;
+import org.apache.fop.apps.Document;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -233,5 +237,43 @@ public class AreaTree {
}
model.endDocument();
}
-}
+ /**
+ * When this element is finished then it can create
+ * the bookmark data from the child elements and add
+ * the extension to the area tree.
+ */
+ public void addBookmarksToAreaTree(Document document) {
+ if (document.getBookmarks() == null) {
+ return;
+ }
+ document.getDriver().getLogger().debug("adding bookmarks to area tree");
+ BookmarkData data = new BookmarkData();
+ for (int count = 0; count < document.getBookmarks().getOutlines().size(); count++) {
+ Outline out = (Outline)(document.getBookmarks().getOutlines()).get(count);
+ data.addSubData(createBookmarkData(out));
+ }
+ // add data to area tree for resolving and handling
+ AreaTree at = document.getAreaTree();
+ at.addTreeExtension(data);
+ data.setAreaTree(at);
+ }
+
+ /**
+ * 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.
+ *
+ * @return the new bookmark data
+ */
+ public 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;
+ }
+
+}
diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java b/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java
index f95fe253f..bcf8692aa 100644
--- a/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java
+++ b/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java
@@ -54,8 +54,6 @@ import org.apache.fop.apps.Document;
import org.apache.fop.apps.FOPException;
import org.apache.fop.area.AreaTree;
import org.apache.fop.area.Title;
-import org.apache.fop.area.extensions.BookmarkData;
-import org.apache.fop.fo.extensions.Outline;
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.layout.LayoutStrategy;
@@ -96,7 +94,7 @@ public class LayoutManagerLS extends LayoutStrategy {
return;
}
- addBookmarksToAreaTree();
+ areaTree.addBookmarksToAreaTree(this.document);
// Initialize if already used?
// this.layoutMasterSet.resetPageMasters();
@@ -134,44 +132,6 @@ public class LayoutManagerLS extends LayoutStrategy {
}
/**
- * When this element is finished then it can create
- * the bookmark data from the child elements and add
- * the extension to the area tree.
- */
- public void addBookmarksToAreaTree() {
- if (document.getBookmarks() == null) {
- return;
- }
- document.getDriver().getLogger().debug("adding bookmarks to area tree");
- BookmarkData data = new BookmarkData();
- for (int count = 0; count < document.getBookmarks().getOutlines().size(); count++) {
- Outline out = (Outline)(document.getBookmarks().getOutlines()).get(count);
- data.addSubData(createBookmarkData(out));
- }
- // add data to area tree for resolving and handling
- AreaTree at = document.getAreaTree();
- at.addTreeExtension(data);
- data.setAreaTree(at);
- }
-
- /**
- * 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.
- *
- * @return the new bookmark data
- */
- public 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;
- }
-
- /**
* @return the Title area
*/
public org.apache.fop.area.Title getTitleArea(org.apache.fop.fo.pagination.Title foTitle) {