You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Bookmarks.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.extensions;
  8. import org.apache.fop.apps.LayoutHandler;
  9. import org.apache.fop.fo.FONode;
  10. import org.apache.fop.area.AreaTree;
  11. import java.util.*;
  12. import org.xml.sax.Attributes;
  13. public class Bookmarks extends ExtensionObj {
  14. private ArrayList outlines = new ArrayList();
  15. private BookmarkData data;
  16. public Bookmarks(FONode parent) {
  17. super(parent);
  18. }
  19. protected void addChild(FONode obj) {
  20. if (obj instanceof Outline) {
  21. outlines.add(obj);
  22. }
  23. }
  24. public BookmarkData getData() {
  25. return data;
  26. }
  27. public void end() {
  28. getLogger().debug("adding bookmarks to area tree");
  29. data = new BookmarkData();
  30. for(int count = 0; count < outlines.size(); count++) {
  31. Outline out = (Outline)outlines.get(count);
  32. data.addSubData(out.getData());
  33. }
  34. // add data to area tree for resolving and handling
  35. if(structHandler instanceof LayoutHandler) {
  36. AreaTree at = ((LayoutHandler)structHandler).getAreaTree();
  37. at.addTreeExtension(data);
  38. }
  39. }
  40. }