]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
start page sequence with title
authorKeiron Liddle <keiron@apache.org>
Thu, 18 Jul 2002 09:43:20 +0000 (09:43 +0000)
committerKeiron Liddle <keiron@apache.org>
Thu, 18 Jul 2002 09:43:20 +0000 (09:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195004 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/apps/LayoutHandler.java
src/org/apache/fop/apps/StructureHandler.java
src/org/apache/fop/fo/Title.java
src/org/apache/fop/fo/pagination/PageSequence.java
src/org/apache/fop/mif/MIFHandler.java

index ba4bdc04a2d97966b4a3a7110aa92eb689670caf..d716982fece2593faf5e5c239645c1055e503882 100644 (file)
@@ -12,6 +12,7 @@ import org.apache.fop.area.AreaTree;
 import org.apache.fop.area.Title;
 import org.apache.fop.render.Renderer;
 import org.apache.fop.fo.pagination.PageSequence;
+import org.apache.fop.fo.pagination.LayoutMasterSet;
 
 import org.apache.avalon.framework.logger.Logger;
 
@@ -143,6 +144,14 @@ public class LayoutHandler extends StructureHandler {
         //log.debug("Avg render time: " + (timeUsed / pageCount) + "ms/page");
     }
 
+    public void startPageSequence(PageSequence pageSeq, org.apache.fop.fo.Title seqTitle, LayoutMasterSet lms) {
+        Title title = null;
+        if(seqTitle != null) {
+            title = seqTitle.getTitleArea();
+        }
+        areaTree.startPageSequence(title);
+    }
+
     /**
        Format the PageSequence. The PageSequence
        formats Pages and adds them to the AreaTree,
index 4efbef2aaffc81065710730cd44d662964b4e67b..74f858396170640337bd7fed5ee3e048a8d4959a 100644 (file)
@@ -54,7 +54,7 @@ public class StructureHandler {
 
     }
 
-    public void startPageSequence(PageSequence pageSeq, LayoutMasterSet lms) {
+    public void startPageSequence(PageSequence pageSeq, Title seqTitle, LayoutMasterSet lms) {
 
     }
 
index f099fa29f2f1913afda6715c459524d6d7c2a1c3..ccbcaac83ffb12afbfec1148b596fbbb85c22a0e 100644 (file)
@@ -23,6 +23,14 @@ public class Title extends ToBeImplementedElement {
         super(parent);
     }
 
+    public org.apache.fop.area.Title getTitleArea() {
+        org.apache.fop.area.Title title =
+                 new org.apache.fop.area.Title();
+        // use special layout manager to add the inline areas
+        // to the Title.
+        return title;
+    }
+
     public void setup() {
 
         // Common Accessibility Properties
@@ -57,3 +65,4 @@ public class Title extends ToBeImplementedElement {
 
     }
 }
+
index 2ff146c3a38d12e50141bbab9d00dd95e4b15c1d..e9c36a1f4cbf4f65a06d71f6a8b8c8d3d9cc9585 100644 (file)
@@ -77,6 +77,9 @@ public class PageSequence extends FObj {
     // fo:flow per fo:page-sequence only.
     private boolean isFlowSet = false;
 
+    // for structure handler
+    private boolean sequenceStarted = false;
+
     //
     // state attributes used during layout
     //
@@ -128,7 +131,7 @@ public class PageSequence extends FObj {
     /**
      * The fo:title object for this page-sequence.
      */
-    private FObj titleFO;
+    private Title titleFO;
 
 
     public PageSequence(FONode parent) {
@@ -194,8 +197,6 @@ public class PageSequence extends FObj {
         // this.properties.get("country");
         // this.properties.get("language");
         setupID();
-
-        structHandler.startPageSequence(this, layoutMasterSet);
     }
 
 
@@ -232,8 +233,11 @@ public class PageSequence extends FObj {
            if (childName.equals("fo:title")) {
                if (this._flowMap.size()>0) {
                    log.warn("fo:title should be first in page-sequence");
+               } else {
+                   this.titleFO = (Title)child;
+                   structHandler.startPageSequence(this, titleFO, layoutMasterSet);
+                   sequenceStarted = true;
                }
-               this.titleFO = (FObj)child;
            }
            else if (childName.equals("fo:flow")) {
                if (this.mainFlow != null) {
@@ -241,6 +245,10 @@ public class PageSequence extends FObj {
                              + " per fo:page-sequence");
                }
                else {
+                   if(!sequenceStarted) {
+                        structHandler.startPageSequence(this, titleFO, layoutMasterSet);
+                        sequenceStarted = true;
+                    }
                    this.mainFlow = (Flow)child;
                    addFlow(mainFlow);
                    super.addChild(child); // For getChildren
@@ -252,6 +260,10 @@ public class PageSequence extends FObj {
                                           " must precede fo:flow; ignoring");
                }
                else {
+                    if(!sequenceStarted) {
+                        structHandler.startPageSequence(this, titleFO, layoutMasterSet);
+                        sequenceStarted = true;
+                    }
                    addFlow((Flow)child);
                }
            }
@@ -310,8 +322,6 @@ public class PageSequence extends FObj {
        // If no main flow, nothing to layout!
        if (this.mainFlow == null) return;
 
-       areaTree.startPageSequence(null);
-
        // Initialize if already used?
         this.layoutMasterSet.resetPageMasters();
 
index d874c3052117e05fb11fe37ef7647fd5543ff92a..2cf6bff192c0e44757e8e65d4a988e5a3c13fb10 100644 (file)
@@ -74,7 +74,7 @@ public class MIFHandler extends StructureHandler {
      * This creates the pages in the MIF document that will be used
      * by the following flows and static areas.
      */
-    public void startPageSequence(PageSequence pageSeq, LayoutMasterSet lms) {
+    public void startPageSequence(PageSequence pageSeq, Title seqTitle, LayoutMasterSet lms) {
         // get the layout master set
         // setup the pages for this sequence
         String name = pageSeq.getProperty("master-reference").getString();