vmote 2003/10/06 08:52:46 Modified: src/java/org/apache/fop/area AreaTree.java src/java/org/apache/fop/layoutmgr LayoutManagerLS.java Log: 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 Revision Changes Path 1.3 +43 -1 xml-fop/src/java/org/apache/fop/area/AreaTree.java Index: AreaTree.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTree.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AreaTree.java 10 Sep 2003 06:25:36 -0000 1.2 +++ AreaTree.java 6 Oct 2003 15:52:46 -0000 1.3 @@ -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 @@ } 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; + } + +} 1.16 +2 -42 xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java Index: LayoutManagerLS.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManagerLS.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- LayoutManagerLS.java 19 Sep 2003 14:33:15 -0000 1.15 +++ LayoutManagerLS.java 6 Oct 2003 15:52:46 -0000 1.16 @@ -54,8 +54,6 @@ 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 @@ return; } - addBookmarksToAreaTree(); + areaTree.addBookmarksToAreaTree(this.document); // Initialize if already used? // this.layoutMasterSet.resetPageMasters(); @@ -131,44 +129,6 @@ pageSeq.setCurrentPageNumber(pageLM.getPageCount()); // Tell the root the last page number we created. pageSeq.getRoot().setRunningPageNumberCounter(pageSeq.getCurrentPageNumber()); - } - - /** - * 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; } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]