]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
PR:
authorGlen Mazza <gmazza@apache.org>
Sat, 25 Dec 2004 01:08:11 +0000 (01:08 +0000)
committerGlen Mazza <gmazza@apache.org>
Sat, 25 Dec 2004 01:08:11 +0000 (01:08 +0000)
Obtained from:
Submitted by:
Reviewed by:
More XSL 1.1-like terms for PDF bookmarks used, minor bug in TableLayoutManagerMaker fixed.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198209 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
src/java/org/apache/fop/render/pdf/PDFRenderer.java

index 40dd6d93a9b5f0e476f799746325b5fdc5ea8439..c119c9a019682b741d5bb305a2954c57b4ed8ee4 100644 (file)
@@ -128,7 +128,7 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
        makers.put(Wrapper.class, new WrapperLayoutManagerMaker());
        makers.put(Title.class, new InlineLayoutManagerMaker());
     }
-    
+
     public void makeLayoutManagers(FONode node, List lms) {
        Maker maker = (Maker) makers.get(node.getClass());
        if (maker == null) {
@@ -162,7 +162,7 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
                        return;
                }
        }
-       
+
        public static class FOTextLayoutManagerMaker extends Maker {
                public void make(FONode node, List lms) {
                        FOText foText = (FOText) node;
@@ -171,7 +171,7 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
                    }
                }
        }
-       
+
     /*
        public static class FObjMixedLayoutManagerMaker extends Maker {
            public void make(FONode node, List lms) {
@@ -209,7 +209,7 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
                }
            }
        }
-       
+
        public static class InlineLayoutManagerMaker extends Maker {
             public void make(FONode node, List lms) {
              if (node.getChildNodes() != null) {
@@ -217,36 +217,36 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
              }
             }
        }
-       
+
        public static class FootnodeLayoutManagerMaker extends Maker {
            public void make(FONode node, List lms) {
             Inline citation = ((Footnote) node).getInlineFO();
                if (citation != null) {
                 lms.add(new InlineLayoutManager(citation));
             }
-           }           
+           }
        }
-       
+
        public static class InlineContainerLayoutManagerMaker extends Maker {
            public void make(FONode node, List lms) {
                ArrayList childList = new ArrayList();
                super.make(node, childList);
                lms.add(new ICLayoutManager((InlineContainer) node, childList));
-           }           
+           }
        }
-       
+
        public static class BasicLinkLayoutManagerMaker extends Maker {
         public void make(FONode node, List lms) {
             lms.add(new BasicLinkLayoutManager((BasicLink) node));
         }
     }
-       
+
        public static class BlockLayoutManagerMaker extends Maker {
             public void make(FONode node, List lms) {
                 lms.add(new BlockLayoutManager((Block) node));
             }
        }
-       
+
        public static class LeaderLayoutManagerMaker extends Maker {
         public void make(FONode node, List lms) {
             lms.add(new LeaderLayoutManager((Leader) node));
@@ -295,7 +295,7 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
        public static class PageNumberLayoutManagerMaker extends Maker {
             public void make(FONode node, List lms) {
              lms.add(new PageNumberLayoutManager((PageNumber) node));
-            }          
+            }
        }
 
        public static class PageNumberCitationLayoutManagerMaker extends Maker {
@@ -319,7 +319,7 @@ public class LayoutManagerMapping implements LayoutManagerMaker {
                                ArrayList columnLMs = new ArrayList();
                                ListIterator iter = columns.listIterator();
                                while (iter.hasNext()) {
-                    columnLMs.add(new Column((TableColumn) node));
+                    columnLMs.add(new Column((TableColumn) iter.next()));
                                }
                                tlm.setColumns(columnLMs);
                        }
index abd2357c8fe784dfa1c38823f62d22a12a296934..42f11b96560c1c8a986b99a7ae9655db2dcc16c8 100644 (file)
@@ -281,44 +281,45 @@ public class PDFRenderer extends PrintRenderer {
     /**
      * @see org.apache.fop.render.Renderer#processOffDocumentItem(OffDocumentItem)
      */
-    public void processOffDocumentItem(OffDocumentItem ext) {
-        // render bookmark extension
-        if (ext instanceof BookmarkData) {
-            renderRootExtensions((BookmarkData)ext);
+    public void processOffDocumentItem(OffDocumentItem odi) {
+        // render Bookmark-Tree
+        if (odi instanceof BookmarkData) {
+            renderBookmarkTree((BookmarkData) odi);
         }
     }
 
     /**
-     * Renders the root extension elements
-     * @param bookmarks the bookmarks to render
+     * Renders a Bookmark-Tree object
+     * @param bookmarks the BookmarkData object containing all the Bookmark-Items
      */
-    protected void renderRootExtensions(BookmarkData bookmarks) {
+    protected void renderBookmarkTree(BookmarkData bookmarks) {
         for (int i = 0; i < bookmarks.getCount(); i++) {
             BookmarkData ext = bookmarks.getSubData(i);
-            renderOutline(ext, null);
+            renderBookmarkItem(ext, null);
         }
     }
 
-    private void renderOutline(BookmarkData outline, PDFOutline parentOutline) {
+    private void renderBookmarkItem(BookmarkData bookmarkItem, 
+            PDFOutline parentBookmarkItem) {
         PDFOutline pdfOutline = null;
-        PageViewport pv = outline.getPageViewport();
+        PageViewport pv = bookmarkItem.getPageViewport();
         if (pv != null) {
             Rectangle2D bounds = pv.getViewArea();
             double h = bounds.getHeight();
             float yoffset = (float)h / 1000f;
             String intDest = (String)pageReferences.get(pv.getKey());
-            if (parentOutline == null) {
+            if (parentBookmarkItem == null) {
                 PDFOutline outlineRoot = pdfDoc.getOutlineRoot();
                 pdfOutline = pdfDoc.getFactory().makeOutline(outlineRoot,
-                                        outline.getLabel(), intDest, yoffset);
+                                        bookmarkItem.getLabel(), intDest, yoffset);
             } else {
-                pdfOutline = pdfDoc.getFactory().makeOutline(parentOutline,
-                                        outline.getLabel(), intDest, yoffset);
+                pdfOutline = pdfDoc.getFactory().makeOutline(parentBookmarkItem,
+                                        bookmarkItem.getLabel(), intDest, yoffset);
             }
         }
 
-        for (int i = 0; i < outline.getCount(); i++) {
-            renderOutline(outline.getSubData(i), pdfOutline);
+        for (int i = 0; i < bookmarkItem.getCount(); i++) {
+            renderBookmarkItem(bookmarkItem.getSubData(i), pdfOutline);
         }
     }