From 529a3492c58d2acb6ea3aa8b12beb51ab90b1aa6 Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Thu, 18 Jul 2002 09:43:20 +0000 Subject: start page sequence with title git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195004 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/fo/Title.java | 9 +++++++++ src/org/apache/fop/fo/pagination/PageSequence.java | 22 ++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'src/org/apache/fop/fo') diff --git a/src/org/apache/fop/fo/Title.java b/src/org/apache/fop/fo/Title.java index f099fa29f..ccbcaac83 100644 --- a/src/org/apache/fop/fo/Title.java +++ b/src/org/apache/fop/fo/Title.java @@ -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 { } } + diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java index 2ff146c3a..e9c36a1f4 100644 --- a/src/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/org/apache/fop/fo/pagination/PageSequence.java @@ -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(); -- cgit v1.2.3