[prev in list] [next in list] [prev in thread] [next in thread]
List: fop-cvs
Subject: cvs commit: xml-fop/src/org/apache/fop/viewer SecureResourceBundle.java
From: keiron () apache ! org
Date: 2002-01-08 9:52:18
[Download RAW message or body]
keiron 02/01/08 01:52:18
Modified: src/org/apache/fop/apps Driver.java Fop.java
src/org/apache/fop/area Block.java Property.java
src/org/apache/fop/fo FOText.java FOUserAgent.java
src/org/apache/fop/fo/flow Flow.java
InstreamForeignObject.java Leader.java
RetrieveMarker.java
src/org/apache/fop/image FopImageFactory.java
src/org/apache/fop/layout FontInfo.java
src/org/apache/fop/layoutmgr AbstractLayoutManager.java
BlockLayoutManager.java
BlockStackingLayoutManager.java BreakCost.java
FlowLayoutManager.java LeafNodeLayoutManager.java
LineLayoutManager.java PageLayoutManager.java
SpaceSpecifier.java SplitContext.java
TextLayoutManager.java
src/org/apache/fop/render AbstractRenderer.java
RendererContext.java
src/org/apache/fop/render/pdf PDFRenderer.java
src/org/apache/fop/tools TestConverter.java
src/org/apache/fop/tools/anttasks RunTest.java
src/org/apache/fop/viewer SecureResourceBundle.java
Removed: src/org/apache/fop/tools/anttasks CompileXMLFiles.java
Log:
does some basic text into pdf and svg output just for a start
Revision Changes Path
1.41 +10 -1 xml-fop/src/org/apache/fop/apps/Driver.java
Index: Driver.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Driver.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- Driver.java 9 Nov 2001 11:32:36 -0000 1.40
+++ Driver.java 8 Jan 2002 09:52:16 -0000 1.41
@@ -1,5 +1,5 @@
/*
- * $Id: Driver.java,v 1.40 2001/11/09 11:32:36 keiron Exp $
+ * $Id: Driver.java,v 1.41 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -8,6 +8,7 @@
package org.apache.fop.apps;
// FOP
+import org.apache.fop.fo.FOUserAgent;
import org.apache.fop.fo.FOTreeBuilder;
import org.apache.fop.fo.ElementMapping;
import org.apache.fop.layout.AreaTree;
@@ -200,6 +201,13 @@
_stream = stream;
}
+ public void setUserAgent(FOUserAgent agent) {
+ }
+
+ private FOUserAgent getUserAgent() {
+ return new FOUserAgent();
+ }
+
public void setLogger(Logger logger) {
log = logger;
}
@@ -349,6 +357,7 @@
*/
public void setRenderer(Renderer renderer) {
renderer.setLogger(getLogger());
+ renderer.setUserAgent(getUserAgent());
_renderer = renderer;
}
1.10 +10 -2 xml-fop/src/org/apache/fop/apps/Fop.java
Index: Fop.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Fop.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Fop.java 28 Nov 2001 14:04:04 -0000 1.9
+++ Fop.java 8 Jan 2002 09:52:16 -0000 1.10
@@ -1,5 +1,5 @@
/*
- * $Id: Fop.java,v 1.9 2001/11/28 14:04:04 keiron Exp $
+ * $Id: Fop.java,v 1.10 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -17,14 +17,22 @@
Starter starter = options.getStarter();
starter.run();
} catch (FOPException e) {
- System.err.println("" + e.getMessage());
+ if("null".equals(e.getMessage())) {
+ System.err.println("NullPointerException");
+ } else {
+ System.err.println("" + e.getMessage());
+ }
if (options != null && options.isDebugMode().booleanValue()) {
e.printStackTrace();
+ } else {
+ System.err.println("Turn on debugging for more information");
}
} catch (java.io.FileNotFoundException e) {
System.err.println("" + e.getMessage());
if (options != null && options.isDebugMode().booleanValue()) {
e.printStackTrace();
+ } else {
+ System.err.println("Turn on debugging for more information");
}
}
}
1.4 +1 -12 xml-fop/src/org/apache/fop/area/Block.java
Index: Block.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Block.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Block.java 9 Nov 2001 22:02:34 -0000 1.3
+++ Block.java 8 Jan 2002 09:52:16 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: Block.java,v 1.3 2001/11/09 22:02:34 klease Exp $
+ * $Id: Block.java,v 1.4 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -33,7 +33,6 @@
// available markers, markers are discarded once page complete
private ArrayList markers = null;
- boolean blocks = false;
// a block with may contain the dominant styling info in
// terms of most lines or blocks with info
@@ -44,25 +43,15 @@
public void addBlock(Block block) {
if (children == null) {
children = new ArrayList();
- } else if (!blocks) {
- // error
}
- blocks = true;
children.add(block);
}
public void addLineArea(LineArea line) {
if (children == null) {
children = new ArrayList();
- } else if (blocks) {
- // error
}
children.add(line);
-
- }
-
- public boolean isChildrenBlocks() {
- return blocks;
}
public int getPositioning() {
1.3 +3 -1 xml-fop/src/org/apache/fop/area/Property.java
Index: Property.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Property.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Property.java 2 Nov 2001 07:45:17 -0000 1.2
+++ Property.java 8 Jan 2002 09:52:16 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * $Id: Property.java,v 1.2 2001/11/02 07:45:17 keiron Exp $
+ * $Id: Property.java,v 1.3 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -28,6 +28,8 @@
public static final int LINETHROUGH = 12;
public static final int OFFSET = 13;
public static final int SHADOW = 14;
+
+ public static final int FONT_STATE = 100;
public int propType;
public Object data;
1.29 +11 -11 xml-fop/src/org/apache/fop/fo/FOText.java
Index: FOText.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FOText.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- FOText.java 21 Nov 2001 22:13:36 -0000 1.28
+++ FOText.java 8 Jan 2002 09:52:16 -0000 1.29
@@ -1,5 +1,5 @@
/*
- * $Id: FOText.java,v 1.28 2001/11/21 22:13:36 klease Exp $
+ * $Id: FOText.java,v 1.29 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources."
@@ -38,18 +38,18 @@
TextInfo textInfo;
public static class TextInfo {
- FontState fs;
- float red;
- float green;
- float blue;
- int wrapOption;
- int whiteSpaceCollapse;
- int verticalAlign;
+ public FontState fs;
+ public float red;
+ public float green;
+ public float blue;
+ public int wrapOption;
+ public int whiteSpaceCollapse;
+ public int verticalAlign;
// Textdecoration
- protected boolean underlined = false;
- protected boolean overlined = false;
- protected boolean lineThrough = false;
+ public boolean underlined = false;
+ public boolean overlined = false;
+ public boolean lineThrough = false;
}
TextState ts;
1.4 +2 -2 xml-fop/src/org/apache/fop/fo/FOUserAgent.java
Index: FOUserAgent.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FOUserAgent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FOUserAgent.java 2 Nov 2001 07:45:17 -0000 1.3
+++ FOUserAgent.java 8 Jan 2002 09:52:16 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: FOUserAgent.java,v 1.3 2001/11/02 07:45:17 keiron Exp $
+ * $Id: FOUserAgent.java,v 1.4 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -73,7 +73,7 @@
handler.handleXML(ctx, doc, namespace);
} catch (Throwable t) {
// could not handle document
- t.printStackTrace();
+ ctx.getLogger().error("Could not render XML", t);
}
} else {
// no handler found for document
1.30 +3 -6 xml-fop/src/org/apache/fop/fo/flow/Flow.java
Index: Flow.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Flow.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Flow.java 22 Nov 2001 07:11:39 -0000 1.29
+++ Flow.java 8 Jan 2002 09:52:16 -0000 1.30
@@ -1,5 +1,5 @@
/*
- * $Id: Flow.java,v 1.29 2001/11/22 07:11:39 keiron Exp $
+ * $Id: Flow.java,v 1.30 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -87,14 +87,11 @@
protected void setFlowName(String name) throws FOPException {
if (name == null || name.equals("")) {
- log.warn("A 'flow-name' is required for "
- + getName()
- + ". This constraint will be enforced in future versions of FOP");
- _flowName = "xsl-region-body";
+ throw new FOPException("A 'flow-name' is required for "
+ + getName());
} else {
_flowName = name;
}
-
}
public String getFlowName() {
1.19 +44 -5 xml-fop/src/org/apache/fop/fo/flow/InstreamForeignObject.java
Index: InstreamForeignObject.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/InstreamForeignObject.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- InstreamForeignObject.java 22 Nov 2001 07:11:39 -0000 1.18
+++ InstreamForeignObject.java 8 Jan 2002 09:52:16 -0000 1.19
@@ -1,5 +1,5 @@
/*
- * $Id: InstreamForeignObject.java,v 1.18 2001/11/22 07:11:39 keiron Exp $
+ * $Id: InstreamForeignObject.java,v 1.19 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -10,6 +10,7 @@
// FOP
import org.apache.fop.fo.*;
import org.apache.fop.fo.properties.*;
+import org.apache.fop.area.Area;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.Viewport;
import org.apache.fop.area.inline.ForeignObject;
@@ -21,6 +22,8 @@
import org.apache.fop.layout.MarginInlineProps;
import org.apache.fop.layout.RelativePositionProps;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.SplitContext;
import org.w3c.dom.Document;
@@ -54,6 +57,31 @@
super(parent);
}
+ public LayoutManager getLayoutManager() {
+ return new LayoutManager() {
+ LayoutManager lm;
+ public void generateAreas() {
+ lm.addChild(getInlineArea());
+ }
+
+ public Area getParentArea (Area childArea) {
+ return null;
+ }
+
+ public void addChild (Area childArea) {
+ }
+
+ public boolean splitArea(Area areaToSplit, SplitContext context) {
+ return false;
+ }
+
+ public void setParentLM(LayoutManager lm) {
+ this.lm = lm;
+ }
+
+ };
+ }
+
/**
* Get the inline area created by this element.
*/
@@ -93,11 +121,22 @@
// if replaced then use height then ignore block-progression-dimension
//int h = this.properties.get("height").getLength().mvalue();
- // use line-height then ignore dimension in height direction
- int lh = this.properties.get("line-height").getLength().mvalue();
+ // use specified line-height then ignore dimension in height direction
+ boolean hasLH = properties.get("line-height").getSpecifiedValue() != null;
+ int bpd = 0;
+ boolean bpdauto = false;
+ if(hasLH) {
+ bpd = properties.get("line-height").getLength().mvalue();
+ } else {
+ // this property does not apply when the line-height applies
+ // isn't the block-progression-dimension always in the same
+ // direction as the line height?
+ bpdauto = properties.get("block-progression-dimension").getLength().isAuto();
+ bpd = properties.get("block-progression-dimension").getLength().mvalue();
+ }
- int bpd = this.properties.get("block-progression-dimension").getLength().mvalue();
- int ipd = this.properties.get("inline-progression-dimension").getLength().mvalue();
+ //boolean ipdauto = properties.get("inline-progression-dimension").getLength().isAuto();
+ //int ipd = properties.get("inline-progression-dimension").getLength().mvalue();
// if auto then use the intrinsic size of the content scaled
// to the content-height and content-width
1.16 +2 -2 xml-fop/src/org/apache/fop/fo/flow/Leader.java
Index: Leader.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Leader.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Leader.java 9 Nov 2001 11:32:38 -0000 1.15
+++ Leader.java 8 Jan 2002 09:52:16 -0000 1.16
@@ -1,5 +1,5 @@
/*
- * $Id: Leader.java,v 1.15 2001/11/09 11:32:38 keiron Exp $
+ * $Id: Leader.java,v 1.16 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -200,5 +200,5 @@
// this.hasLines = true;
return 1;
}
-
}
+
1.10 +2 -2 xml-fop/src/org/apache/fop/fo/flow/RetrieveMarker.java
Index: RetrieveMarker.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/RetrieveMarker.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- RetrieveMarker.java 22 Nov 2001 07:11:39 -0000 1.9
+++ RetrieveMarker.java 8 Jan 2002 09:52:16 -0000 1.10
@@ -1,5 +1,5 @@
/*
- * $Id: RetrieveMarker.java,v 1.9 2001/11/22 07:11:39 keiron Exp $
+ * $Id: RetrieveMarker.java,v 1.10 2002/01/08 09:52:16 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -64,7 +64,7 @@
}
}
- Status status = new Status(Status.AREA_FULL_NONE);
+ Status status = new Status(Status.OK);
if (null != bestMarker) {
// System.out.println("Laying out marker '" + bestMarker + "' in area '" + area + "'");
// the 'markers' referred to in this method are internal; they have
1.28 +6 -1 xml-fop/src/org/apache/fop/image/FopImageFactory.java
Index: FopImageFactory.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/image/FopImageFactory.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- FopImageFactory.java 16 Nov 2001 19:36:40 -0000 1.27
+++ FopImageFactory.java 8 Jan 2002 09:52:17 -0000 1.28
@@ -1,5 +1,5 @@
/*
- * $Id: FopImageFactory.java,v 1.27 2001/11/16 19:36:40 tore Exp $
+ * $Id: FopImageFactory.java,v 1.28 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -20,6 +20,11 @@
import org.apache.fop.image.analyser.ImageReaderFactory;
import org.apache.fop.image.analyser.ImageReader;
import org.apache.fop.configuration.Configuration;
+
+/*
+handle context: base dir, logger, caching
+
+*/
/**
* create FopImage objects (with a configuration file - not yet implemented).
1.16 +1 -2 xml-fop/src/org/apache/fop/layout/FontInfo.java
Index: FontInfo.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/FontInfo.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- FontInfo.java 22 Nov 2001 07:11:40 -0000 1.15
+++ FontInfo.java 8 Jan 2002 09:52:17 -0000 1.16
@@ -1,5 +1,5 @@
/*
- * $Id: FontInfo.java,v 1.15 2001/11/22 07:11:40 keiron Exp $
+ * $Id: FontInfo.java,v 1.16 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -8,7 +8,6 @@
package org.apache.fop.layout;
import java.util.HashMap;
-import java.util.Enumeration;
import org.apache.fop.apps.FOPException;
1.5 +45 -41 xml-fop/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
Index: AbstractLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractLayoutManager.java 11 Nov 2001 22:14:45 -0000 1.4
+++ AbstractLayoutManager.java 8 Jan 2002 09:52:17 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * $Id: AbstractLayoutManager.java,v 1.4 2001/11/11 22:14:45 klease Exp $
+ * $Id: AbstractLayoutManager.java,v 1.5 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -8,6 +8,7 @@
package org.apache.fop.layoutmgr;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.FONode;
import org.apache.fop.area.Area;
import java.util.ListIterator;
@@ -21,12 +22,12 @@
public AbstractLayoutManager(FObj fobj) {
- this.fobj = fobj;
- this.parentLM = null;
+ this.fobj = fobj;
+ this.parentLM = null;
}
public void setParentLM(LayoutManager lm) {
- this.parentLM = lm;
+ this.parentLM = lm;
}
@@ -36,38 +37,41 @@
* its generateAreas method.
*/
public void generateAreas() {
- ListIterator children = fobj.getChildren();
- while (children.hasNext()) {
- LayoutManager lm = ((FObj)children.next()).getLayoutManager();
- if (lm != null) {
- lm.setParentLM(this);
- lm.generateAreas();
- }
- }
- flush(); // Add last area to parent
+ ListIterator children = fobj.getChildren();
+ while (children.hasNext()) {
+ FONode node = (FONode) children.next();
+ if (node instanceof FObj) {
+ LayoutManager lm = ((FObj) node).getLayoutManager();
+ if (lm != null) {
+ lm.setParentLM(this);
+ lm.generateAreas();
+ }
+ }
+ }
+ flush(); // Add last area to parent
}
-// /**
-// * Ask the parent LayoutManager to add the current (full) area to the
-// * appropriate parent area.
-// * @param bFinished If true, this area is finished, either because it's
-// * completely full or because there is no more content to put in it.
-// * If false, we are in the middle of this area. This can happen,
-// * for example, if we find floats in a line. We stop the current area,
-// * and add it (temporarily) to its parent so that we can see if there
-// * is enough space to place the float(s) anchored in the line.
-// */
-// protected void flush(Area area, boolean bFinished) {
-// if (area != null) {
-// // area.setFinished(true);
-// parentLM.addChild(area, bFinished); // ????
-// if (bFinished) {
-// setCurrentArea(null);
-// }
-// }
-// }
+ // /**
+ // * Ask the parent LayoutManager to add the current (full) area to the
+ // * appropriate parent area.
+ // * @param bFinished If true, this area is finished, either because it's
+ // * completely full or because there is no more content to put in it.
+ // * If false, we are in the middle of this area. This can happen,
+ // * for example, if we find floats in a line. We stop the current area,
+ // * and add it (temporarily) to its parent so that we can see if there
+ // * is enough space to place the float(s) anchored in the line.
+ // */
+ // protected void flush(Area area, boolean bFinished) {
+ // if (area != null) {
+ // // area.setFinished(true);
+ // parentLM.addChild(area, bFinished); // ????
+ // if (bFinished) {
+ // setCurrentArea(null);
+ // }
+ // }
+ // }
- /**
+ /**
* Force current area to be added to parent area.
*/
abstract protected void flush();
@@ -84,12 +88,12 @@
* BPD.
*/
abstract public Area getParentArea(Area childArea);
-
-// public boolean generatesInlineAreas() {
-// return false;
-// }
+
+ // public boolean generatesInlineAreas() {
+ // return false;
+ // }
/**
@@ -97,12 +101,12 @@
* dimension of the current area to be exceeded, the parent LM is called
* to add it.
*/
- abstract public void addChild(Area childArea) ;
+ abstract public void addChild(Area childArea);
/** Do nothing */
public boolean splitArea(Area areaToSplit, SplitContext context) {
- context.nextArea = areaToSplit;
- return false;
+ context.nextArea = areaToSplit;
+ return false;
}
-
}
+
1.3 +89 -91 xml-fop/src/org/apache/fop/layoutmgr/BlockLayoutManager.java
Index: BlockLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/BlockLayoutManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BlockLayoutManager.java 11 Nov 2001 22:14:45 -0000 1.2
+++ BlockLayoutManager.java 8 Jan 2002 09:52:17 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * $Id: BlockLayoutManager.java,v 1.2 2001/11/11 22:14:45 klease Exp $
+ * $Id: BlockLayoutManager.java,v 1.3 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -23,43 +23,42 @@
private Block curBlockArea;
public BlockLayoutManager(FObj fobj) {
- super(fobj);
+ super(fobj);
}
// DESIGN. Potential alternative to getParentArea() scheme
-// /**
-// * Called by child layout manager to get the available space for
-// * content in the inline progression direction.
-// * Note that a manager may need to ask its parent for this.
-// * For a block area, available IPD is determined by indents.
-// */
-// public int getContentIPD() {
-// getArea(); // make if not existing
-// return blockArea.getIPD();
-// }
+ // /**
+ // * Called by child layout manager to get the available space for
+ // * content in the inline progression direction.
+ // * Note that a manager may need to ask its parent for this.
+ // * For a block area, available IPD is determined by indents.
+ // */
+ // public int getContentIPD() {
+ // getArea(); // make if not existing
+ // return blockArea.getIPD();
+ // }
/**
* Generate areas by tellings all layout managers for its FO's
* children to generate areas.
*/
public void generateAreas() {
- ListIterator children = fobj.getChildren();
- LayoutManager lm=null;
- while (children.hasNext()) {
- FObj childFO = (FObj)children.next();
- if (childFO.generatesInlineAreas()) {
- children.previous();
- lm = new LineLayoutManager(children);
- }
- else {
- lm = childFO.getLayoutManager();
- }
- if (lm != null) {
- lm.setParentLM(this);
- lm.generateAreas();
- }
- }
- flush(); // Add last area to parent
+ ListIterator children = fobj.getChildren();
+ LayoutManager lm = null;
+ while (children.hasNext()) {
+ FObj childFO = (FObj) children.next();
+ if (childFO.generatesInlineAreas()) {
+ children.previous();
+ lm = new LineLayoutManager(children);
+ } else {
+ lm = childFO.getLayoutManager();
+ }
+ if (lm != null) {
+ lm.setParentLM(this);
+ lm.generateAreas();
+ }
+ }
+ flush(); // Add last area to parent
}
@@ -74,74 +73,73 @@
* BPD.
*/
public Area getParentArea(Area childArea) {
- if (curBlockArea == null) {
- curBlockArea = new Block();
- // Set up dimensions
- // Must get dimensions from parent area
- //MinOptMax referenceIPD = parentLM.getReferenceIPD();
- Area parentArea = parentLM.getParentArea(curBlockArea);
- // Get reference IPD from parentArea
- setCurrentArea(curBlockArea); // ??? for generic operations
- }
- return curBlockArea;
+ if (curBlockArea == null) {
+ curBlockArea = new Block();
+ // Set up dimensions
+ // Must get dimensions from parent area
+ //MinOptMax referenceIPD = parentLM.getReferenceIPD();
+ Area parentArea = parentLM.getParentArea(curBlockArea);
+ // Get reference IPD from parentArea
+ setCurrentArea(curBlockArea); // ??? for generic operations
+ }
+ return curBlockArea;
}
-
+
public void addChild(Area childArea) {
- if (curBlockArea != null) {
- if (childArea instanceof LineArea) {
- // Something about widows and orphans
- // Position the line area and calculate size...
- curBlockArea.addLineArea((LineArea)childArea);
- }
- else {
- super.addChild(childArea);
- }
- }
+ if (curBlockArea != null) {
+ if (childArea instanceof LineArea) {
+ // Something about widows and orphans
+ // Position the line area and calculate size...
+ curBlockArea.addLineArea((LineArea) childArea);
+ } else {
+ super.addChild(childArea);
+ }
+ }
}
-// /**
-// * Called by child LayoutManager when it has filled one of its areas.
-// * If no current container, make one.
-// * See if the area will fit in the current container.
-// * If so, add it.
-// * @param childArea the area to add: will either be a LineArea or
-// * a BlockArea.
-// */
-// public void addChild(Area childArea) {
-// /* If the childArea fits entirely in the maximum available BPD
-// * add it and return an OK status.
-// * If it doesn't all fit, overrun or ask for split?
-// * Might as well just add it since the page layout process
-// * may need to make other adjustments, resulting in changing
-// * split point.
-// */
-// // Things like breaks on child area can cause premature
-// // termination of the current area.
-// /* We go past the theoretical maximum to be able to handle things
-// * like widows.
-// */
-// // WARNING: this doesn't take into account space-specifier
-// // adujstment between childArea and last content of blockArea!
-// if (blockArea.getContentBPD().min + childArea.getAllocationBPD().min
-// > blockArea.getAvailBPD().max) {
-// if (++extraLines <= iWidows) {
-// blockArea.add(childArea);
-// }
-// else {
-// blockArea.setIsLast(false);
-// parentLM.addChildArea(blockArea);
-// // Make a new one for this area
-// blockArea = makeAreaForChild(childArea);
-// extraLines = 0; // Count potential widows
-// blockArea.add(childArea);
-// }
-// }
-// else {
-// blockArea.add(childArea);
-// }
-// }
+ // /**
+ // * Called by child LayoutManager when it has filled one of its areas.
+ // * If no current container, make one.
+ // * See if the area will fit in the current container.
+ // * If so, add it.
+ // * @param childArea the area to add: will either be a LineArea or
+ // * a BlockArea.
+ // */
+ // public void addChild(Area childArea) {
+ // /* If the childArea fits entirely in the maximum available BPD
+ // * add it and return an OK status.
+ // * If it doesn't all fit, overrun or ask for split?
+ // * Might as well just add it since the page layout process
+ // * may need to make other adjustments, resulting in changing
+ // * split point.
+ // */
+ // // Things like breaks on child area can cause premature
+ // // termination of the current area.
+ // /* We go past the theoretical maximum to be able to handle things
+ // * like widows.
+ // */
+ // // WARNING: this doesn't take into account space-specifier
+ // // adujstment between childArea and last content of blockArea!
+ // if (blockArea.getContentBPD().min + childArea.getAllocationBPD().min
+ // > blockArea.getAvailBPD().max) {
+ // if (++extraLines <= iWidows) {
+ // blockArea.add(childArea);
+ // }
+ // else {
+ // blockArea.setIsLast(false);
+ // parentLM.addChildArea(blockArea);
+ // // Make a new one for this area
+ // blockArea = makeAreaForChild(childArea);
+ // extraLines = 0; // Count potential widows
+ // blockArea.add(childArea);
+ // }
+ // }
+ // else {
+ // blockArea.add(childArea);
+ // }
+ // }
}
1.3 +113 -115 xml-fop/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
Index: BlockStackingLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BlockStackingLayoutManager.java 11 Nov 2001 14:11:46 -0000 1.2
+++ BlockStackingLayoutManager.java 8 Jan 2002 09:52:17 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * $Id: BlockStackingLayoutManager.java,v 1.2 2001/11/11 14:11:46 klease Exp $
+ * $Id: BlockStackingLayoutManager.java,v 1.3 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -19,8 +19,7 @@
* Base LayoutManager class for all areas which stack their child
* areas in the block-progression direction, such as Flow, Block, ListBlock.
*/
-public abstract class BlockStackingLayoutManager
- extends AbstractLayoutManager {
+public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
/** Reference to FO whose areas it's managing or to the traits
* of the FO.
*/
@@ -28,105 +27,104 @@
BlockParent parentArea = null;
public BlockStackingLayoutManager(FObj fobj) {
- super(fobj);
+ super(fobj);
}
public boolean splitArea(Area area, SplitContext splitContext) {
- // Divide area so that it will be within targetLength if possible
- // If not, it can be shorter, but not longer.
- /* Iterate over contents of the area. */
-
- // Need to figure out if we can do this generically
- // Logically a BlockStacking LM only handles Block-type areas
- if (!(area instanceof BlockParent)) {
- return false;
- }
- Iterator areaIter = ((BlockParent)area).getChildAreas().iterator();
-
-
- BreakCost minBreakCost = null;
- MinOptMax remainBPD = splitContext.targetBPD;
- splitContext.nextArea = area;
-
- while (areaIter.hasNext()) {
- Area childArea = (Area)areaIter.next();
- if (remainBPD.max < childArea.getAllocationBPD().min) {
- // Past the end point: try to break it
- // TODO: get a LayoutManager to do the split of the child
- // area, either Area => LM or Area => gen FO => LM
- LayoutManager childLM = childArea.getGeneratingFObj().
- getLayoutManager();
- splitContext.targetBPD = remainBPD;
- if (childLM.splitArea(childArea, splitContext) == false) {
- // Can't split, so must split this area before childArea
- // Can we pass the iter?
- // If already saw several a potential break, use it
- if (minBreakCost != null) {
- /* Split 'area', placing all children after
- * minBreakCost.getArea() into a new area,
- * which we store in the splitContext.
- */
- // splitContext.nextArea = area.splitAfter(minBreakCost.getArea());
- }
- else {
- /* This area will be shorter than the desired minimum.
- * Split before the current childArea (which will be
- * the first area in the newly created Area.
- */
- //splitContext.nextArea = area.splitBefore(childArea);
- }
- }
- else return true; // childLM has done the work for us!
- // Set cost, dimension ???
- break;
- }
- else {
- remainBPD.subtract(childArea.getAllocationBPD());
- if (remainBPD.min < 0) {
- // Potential breakpoint: remember break Position and
- // break "cost" (constraint violation)
- BreakCost breakCost = evaluateBreakCost(area, childArea);
- minBreakCost = breakCost.chooseLowest(minBreakCost);
- }
- }
- //Note: size of area when split can depend on conditional
- // space, border and padding of the split area!!!
- }
- // True if some part of area can be placed, false if none is placed
- return (splitContext.nextArea != area);
-
+ // Divide area so that it will be within targetLength if possible
+ // If not, it can be shorter, but not longer.
+ /* Iterate over contents of the area. */
+
+ // Need to figure out if we can do this generically
+ // Logically a BlockStacking LM only handles Block-type areas
+ if (!(area instanceof BlockParent)) {
+ return false;
+ }
+ Iterator areaIter = ((BlockParent) area).getChildAreas().iterator();
+
+
+ BreakCost minBreakCost = null;
+ MinOptMax remainBPD = splitContext.targetBPD;
+ splitContext.nextArea = area;
+
+ while (areaIter.hasNext()) {
+ Area childArea = (Area) areaIter.next();
+ if (remainBPD.max < childArea.getAllocationBPD().min) {
+ // Past the end point: try to break it
+ // TODO: get a LayoutManager to do the split of the child
+ // area, either Area => LM or Area => gen FO => LM
+ LayoutManager childLM =
+ childArea.getGeneratingFObj(). getLayoutManager();
+ splitContext.targetBPD = remainBPD;
+ if (childLM.splitArea(childArea, splitContext) == false) {
+ // Can't split, so must split this area before childArea
+ // Can we pass the iter?
+ // If already saw several a potential break, use it
+ if (minBreakCost != null) {
+ /* Split 'area', placing all children after
+ * minBreakCost.getArea() into a new area,
+ * which we store in the splitContext.
+ */
+ // splitContext.nextArea = area.splitAfter(minBreakCost.getArea());
+ } else {
+ /* This area will be shorter than the desired minimum.
+ * Split before the current childArea (which will be
+ * the first area in the newly created Area.
+ */
+ //splitContext.nextArea = area.splitBefore(childArea);
+ }
+ } else
+ return true; // childLM has done the work for us!
+ // Set cost, dimension ???
+ break;
+ } else {
+ remainBPD.subtract(childArea.getAllocationBPD());
+ if (remainBPD.min < 0) {
+ // Potential breakpoint: remember break Position and
+ // break "cost" (constraint violation)
+ BreakCost breakCost =
+ evaluateBreakCost(area, childArea);
+ minBreakCost = breakCost.chooseLowest(minBreakCost);
+ }
+ }
+ //Note: size of area when split can depend on conditional
+ // space, border and padding of the split area!!!
+ }
+ // True if some part of area can be placed, false if none is placed
+ return (splitContext.nextArea != area);
+
}
private BreakCost evaluateBreakCost(Area parent, Area child) {
- return new BreakCost(child,0);
+ return new BreakCost(child, 0);
}
- /** return current area being filled
+ /** return current area being filled
*/
protected BlockParent getCurrentArea() {
- return this.parentArea;
+ return this.parentArea;
}
- /**
+ /**
* Set the current area being filled.
*/
protected void setCurrentArea(BlockParent parentArea) {
- this.parentArea = parentArea;
+ this.parentArea = parentArea;
}
protected MinOptMax resolveSpaceSpecifier(Area nextArea) {
- SpaceSpecifier spaceSpec = new SpaceSpecifier();
-// Area prevArea = getCurrentArea().getLast();
-// if (prevArea != null) {
-// spaceSpec.addSpace(prevArea.getSpaceAfter());
-// }
-// spaceSpec.addSpace(nextArea.getSpaceBefore());
- return spaceSpec.resolve();
+ SpaceSpecifier spaceSpec = new SpaceSpecifier();
+ // Area prevArea = getCurrentArea().getLast();
+ // if (prevArea != null) {
+ // spaceSpec.addSpace(prevArea.getSpaceAfter());
+ // }
+ // spaceSpec.addSpace(nextArea.getSpaceBefore());
+ return spaceSpec.resolve();
}
/**
@@ -139,39 +137,38 @@
* @param parentArea the area in which to add the childArea
*/
protected void addChildToArea(Area childArea, BlockParent parentArea) {
- // This should be a block-level Area (Block in the generic sense)
- if (!(childArea instanceof Block)) {
- System.err.println("Child not a Block in BlockStackingLM!");
- return;
- }
-
- // See if the whole thing fits, including space before
- // Calculate space between last child in curFlow and childArea
- MinOptMax targetDim = parentArea.getAvailBPD();
- MinOptMax spaceBefore = resolveSpaceSpecifier(childArea) ;
- targetDim.subtract(spaceBefore);
- if (targetDim.max >= childArea.getAllocationBPD().min) {
- //parentArea.addBlock(new InterBlockSpace(spaceBefore));
- parentArea.addBlock((Block)childArea);
- return;
- }
- else {
- // Probably need something like max BPD so we don't get into
- // infinite loops with large unbreakable chunks
- SplitContext splitContext = new SplitContext(targetDim);
-
- LayoutManager childLM = childArea.getGeneratingFObj().
- getLayoutManager();
- if (childLM.splitArea(childArea, splitContext)) {
- //parentArea.addBlock(new InterBlockSpace(spaceBefore));
- parentArea.addBlock((Block)childArea);
- }
- flush(); // hand off current area to parent
- getParentArea(splitContext.nextArea);
- // Check that reference IPD hasn't changed!!!
- // If it has, we must "reflow" the content
- addChild(splitContext.nextArea);
- }
+ // This should be a block-level Area (Block in the generic sense)
+ if (!(childArea instanceof Block)) {
+ System.err.println("Child not a Block in BlockStackingLM!");
+ return;
+ }
+
+ // See if the whole thing fits, including space before
+ // Calculate space between last child in curFlow and childArea
+ MinOptMax targetDim = parentArea.getAvailBPD();
+ MinOptMax spaceBefore = resolveSpaceSpecifier(childArea);
+ targetDim.subtract(spaceBefore);
+ if (targetDim.max >= childArea.getAllocationBPD().min) {
+ //parentArea.addBlock(new InterBlockSpace(spaceBefore));
+ parentArea.addBlock((Block) childArea);
+ return;
+ } else {
+ // Probably need something like max BPD so we don't get into
+ // infinite loops with large unbreakable chunks
+ SplitContext splitContext = new SplitContext(targetDim);
+
+ LayoutManager childLM =
+ childArea.getGeneratingFObj(). getLayoutManager();
+ if (childLM.splitArea(childArea, splitContext)) {
+ //parentArea.addBlock(new InterBlockSpace(spaceBefore));
+ parentArea.addBlock((Block) childArea);
+ }
+ flush(); // hand off current area to parent
+ getParentArea(splitContext.nextArea);
+ // Check that reference IPD hasn't changed!!!
+ // If it has, we must "reflow" the content
+ addChild(splitContext.nextArea);
+ }
}
@@ -184,14 +181,15 @@
* @param childArea the area to add: will be some block-stacked Area.
*/
public void addChild(Area childArea) {
- addChildToArea(childArea, getCurrentArea());
+ addChildToArea(childArea, getCurrentArea());
}
- /**
+ /**
* Force current area to be added to parent area.
*/
protected void flush() {
- parentLM.addChild(getCurrentArea());
+ if (getCurrentArea() != null)
+ parentLM.addChild(getCurrentArea());
}
1.2 +5 -5 xml-fop/src/org/apache/fop/layoutmgr/BreakCost.java
Index: BreakCost.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/BreakCost.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BreakCost.java 9 Nov 2001 21:57:47 -0000 1.1
+++ BreakCost.java 8 Jan 2002 09:52:17 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: BreakCost.java,v 1.1 2001/11/09 21:57:47 klease Exp $
+ * $Id: BreakCost.java,v 1.2 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -19,15 +19,15 @@
private int cost; // Will be more complicated than this!
public BreakCost(Area breakArea, int cost) {
- this.breakArea = breakArea;
- this.cost = cost;
+ this.breakArea = breakArea;
+ this.cost = cost;
}
Area getArea() {
- return breakArea;
+ return breakArea;
}
public BreakCost chooseLowest(BreakCost otherCost) {
- return this;
+ return this;
}
}
1.2 +10 -10 xml-fop/src/org/apache/fop/layoutmgr/FlowLayoutManager.java
Index: FlowLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/FlowLayoutManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FlowLayoutManager.java 9 Nov 2001 21:57:47 -0000 1.1
+++ FlowLayoutManager.java 8 Jan 2002 09:52:17 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: FlowLayoutManager.java,v 1.1 2001/11/09 21:57:47 klease Exp $
+ * $Id: FlowLayoutManager.java,v 1.2 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -28,7 +28,7 @@
* It is created by the PageSequence FO.
*/
public FlowLayoutManager(FObj fobj) {
- super(fobj);
+ super(fobj);
}
@@ -39,17 +39,17 @@
* at any one time. The actual work is done by BlockStackingLM.
*/
public void addChild(Area childArea) {
- addChildToArea(childArea,
- this.currentAreas[childArea.getAreaClass()]);
+ addChildToArea(childArea,
+ this.currentAreas[childArea.getAreaClass()]);
}
public Area getParentArea(Area childArea) {
- // Get an area from the Page
- BlockParent parentArea =
- (BlockParent)parentLM.getParentArea(childArea);
- this.currentAreas[parentArea.getAreaClass()] = parentArea;
- setCurrentArea(parentArea);
- return parentArea;
+ // Get an area from the Page
+ BlockParent parentArea =
+ (BlockParent) parentLM.getParentArea(childArea);
+ this.currentAreas[parentArea.getAreaClass()] = parentArea;
+ setCurrentArea(parentArea);
+ return parentArea;
}
1.2 +6 -6 xml-fop/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
Index: LeafNodeLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LeafNodeLayoutManager.java 11 Nov 2001 22:15:45 -0000 1.1
+++ LeafNodeLayoutManager.java 8 Jan 2002 09:52:17 -0000 1.2
@@ -1,5 +1,5 @@
/*
- * $Id: LeafNodeLayoutManager.java,v 1.1 2001/11/11 22:15:45 klease Exp $
+ * $Id: LeafNodeLayoutManager.java,v 1.2 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -22,16 +22,16 @@
private InlineArea curArea;
public LeafNodeLayoutManager(FObj fobj) {
- super(fobj);
+ super(fobj);
}
protected void setCurrentArea(InlineArea ia) {
- curArea = ia;
+ curArea = ia;
}
protected void flush() {
- parentLM.addChild(curArea);
+ parentLM.addChild(curArea);
}
/**
@@ -44,8 +44,8 @@
* This is a leaf-node, so this method is never called.
*/
public Area getParentArea(Area childArea) {
- return null;
+ return null;
}
-
+
}
1.3 +93 -92 xml-fop/src/org/apache/fop/layoutmgr/LineLayoutManager.java
Index: LineLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/LineLayoutManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LineLayoutManager.java 11 Nov 2001 22:14:45 -0000 1.2
+++ LineLayoutManager.java 8 Jan 2002 09:52:17 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * $Id: LineLayoutManager.java,v 1.2 2001/11/11 22:14:45 klease Exp $
+ * $Id: LineLayoutManager.java,v 1.3 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -31,80 +31,76 @@
private MinOptMax remainingIPD;
public LineLayoutManager(ListIterator fobjIter) {
- super(null);
- this.fobjIter = fobjIter;
+ super(null);
+ this.fobjIter = fobjIter;
}
-
/**
* Call child layout managers to generate content as long as they
* generate inline areas. If a block-level generating LM is found,
* finish any line being filled and return to the parent LM.
*/
public void generateAreas() {
- this.bFirstLine = true;
- while (fobjIter.hasNext()) {
- FObj childFO = (FObj)fobjIter.next();
- if (childFO.generatesInlineAreas()==false) {
- // It generates blocks, pass back to parent
- // Back up one
- fobjIter.previous();
- break;
- }
- else { // generates inline area
- curLM = childFO.getLayoutManager();
- if (curLM != null) {
- curLM.setParentLM(this);
- curLM.generateAreas();
- }
- }
- }
- flush(); // Add last area to parent
+ this.bFirstLine = true;
+ while (fobjIter.hasNext()) {
+ FObj childFO = (FObj) fobjIter.next();
+ if (childFO.generatesInlineAreas() == false) {
+ // It generates blocks, pass back to parent
+ // Back up one
+ fobjIter.previous();
+ break;
+ } else { // generates inline area
+ curLM = childFO.getLayoutManager();
+ if (curLM != null) {
+ curLM.setParentLM(this);
+ curLM.generateAreas();
+ }
+ }
+ }
+ flush(); // Add last area to parent
}
-
/**
* Align and position curLine and add it to parentContainer.
* Set curLine to null.
*/
public void flush() {
- if (lineArea != null) {
- // Adjust spacing as necessary
- // Calculate height, based on content (or does the Area do this?)
- parentLM.addChild(lineArea);
- lineArea = null;
- }
+ if (lineArea != null) {
+ // Adjust spacing as necessary
+ // Calculate height, based on content (or does the Area do this?)
+ lineArea.setHeight(14000);
+ parentLM.addChild(lineArea);
+ lineArea = null;
+ }
}
-
/**
* Return current lineArea or generate a new one if necessary.
*/
public Area getParentArea(Area childArea) {
- if (lineArea == null) {
- createLine();
- }
- return lineArea;
+ if (lineArea == null) {
+ createLine();
+ }
+ return lineArea;
}
private void createLine() {
- lineArea = new LineArea();
- /* Set line IPD from parentArea
- * This accounts for indents. What about first line indent?
- * Should we set an "isFirst" flag on the lineArea to signal
- * that to the parent (Block) LM? That's where indent property
- * information will be managed.
- */
- Area parent = parentLM.getParentArea(lineArea);
- // lineArea.setContentIPD(parent.getContentIPD());
- // remainingIPD = parent.getContentIPD();
- // OR???
- // remainingIPD = parentLM.getContentIPD();
- remainingIPD = new MinOptMax(100000); // TESTING!!!
- this.bFirstLine = false;
+ lineArea = new LineArea();
+ /* Set line IPD from parentArea
+ * This accounts for indents. What about first line indent?
+ * Should we set an "isFirst" flag on the lineArea to signal
+ * that to the parent (Block) LM? That's where indent property
+ * information will be managed.
+ */
+ Area parent = parentLM.getParentArea(lineArea);
+ // lineArea.setContentIPD(parent.getContentIPD());
+ // remainingIPD = parent.getContentIPD();
+ // OR???
+ // remainingIPD = parentLM.getContentIPD();
+ remainingIPD = new MinOptMax(300000); // TESTING!!!
+ this.bFirstLine = false;
}
-
/**
* Called by child LayoutManager when it has filled one of its areas.
* See if the area will fit in the current container.
@@ -113,49 +109,54 @@
* @param childArea the area to add: should be an InlineArea subclass!
*/
public void addChild(Area childArea) {
- if ((childArea instanceof InlineArea)==false) {
- // SIGNAL AN ERROR!!!
- return;
- }
- InlineArea inlineArea = (InlineArea)childArea;
- if (lineArea == null) {
- createLine();
- }
- if (inlineArea.getAllocationIPD().min < remainingIPD.max) {
- lineArea.addInlineArea(inlineArea);
- remainingIPD.subtract(inlineArea.getAllocationIPD());
- // Calculate number of spaces
- // Forced line break after this area (ex. ends with LF in nowrap)
- /* NOTYET!
- if (inlineArea.breakAfter()) {
- flush();
- }
- */
- /* Check if line could end after this area (potential line-break
- * character. If not, it must be joined with following inline
- * area to make a word. Otherwise, if the line could break here
- * and if it is "full", add it to the parent area.
- */
- if (remainingIPD.min<=0) {
- flush();
- }
- }
-
- else {
- /* The inline area won't entirely fit in this line. Ask its
- * layout manager to split it (by hyphenation for example),
- * in order to fit part of it in the line.
- * Note: only the current child LM could have generated this
- * area, so we ask it to do the split.
- */
- SplitContext splitContext = new SplitContext(remainingIPD);
- if (curLM.splitArea(inlineArea, splitContext)) {
- // inlineArea should now fit
- lineArea.addInlineArea(inlineArea);
- flush();
- }
- addChild(splitContext.nextArea);
- }
+ if ((childArea instanceof InlineArea) == false) {
+ // SIGNAL AN ERROR!!!
+ return;
+ }
+ InlineArea inlineArea = (InlineArea) childArea;
+ if (lineArea == null) {
+ createLine();
+ }
+ if (inlineArea.getAllocationIPD().min < remainingIPD.max) {
+ lineArea.addInlineArea(inlineArea);
+ remainingIPD.subtract(inlineArea.getAllocationIPD());
+ // Calculate number of spaces
+ // Forced line break after this area (ex. ends with LF in nowrap)
+ /* NOTYET!
+ if (inlineArea.breakAfter()) {
+ flush();
+ }
+ */
+ /* Check if line could end after this area (potential line-break
+ * character. If not, it must be joined with following inline
+ * area to make a word. Otherwise, if the line could break here
+ * and if it is "full", add it to the parent area.
+ */
+ if (remainingIPD.min <= 0) {
+ flush();
+ }
+ }
+ else {
+ /* The inline area won't entirely fit in this line. Ask its
+ * layout manager to split it (by hyphenation for example),
+ * in order to fit part of it in the line.
+ * Note: only the current child LM could have generated this
+ * area, so we ask it to do the split.
+ */
+ SplitContext splitContext = new SplitContext(remainingIPD);
+ if (curLM.splitArea(inlineArea, splitContext)) {
+ // inlineArea should now fit
+ lineArea.addInlineArea(inlineArea);
+ flush();
+ addChild(splitContext.nextArea);
+ } else {
+ lineArea.addInlineArea((InlineArea)splitContext.nextArea);
+ remainingIPD.subtract(inlineArea.getAllocationIPD());
+ if (remainingIPD.min <= 0) {
+ flush();
+ }
+ }
+ }
}
}
1.4 +187 -191 xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java
Index: PageLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PageLayoutManager.java 11 Nov 2001 14:11:46 -0000 1.3
+++ PageLayoutManager.java 8 Jan 2002 09:52:17 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * $Id: PageLayoutManager.java,v 1.3 2001/11/11 14:11:46 klease Exp $
+ * $Id: PageLayoutManager.java,v 1.4 2002/01/08 09:52:17 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
@@ -16,8 +16,7 @@
* LayoutManager for a PageSequence and its flow.
* It manages all page-related layout.
*/
-public class PageLayoutManager extends AbstractLayoutManager
- implements Runnable{
+public class PageLayoutManager extends AbstractLayoutManager implements Runnable {
/** True if haven't yet laid out any pages.*/
private boolean bFirstPage;
@@ -48,12 +47,12 @@
* It is created by the PageSequence FO.
*/
public PageLayoutManager(AreaTree areaTree, PageSequence pageseq) {
- super( pageseq);
- this.areaTree = areaTree;
+ super(pageseq);
+ this.areaTree = areaTree;
}
- /**
+ /**
* The layout process is designed to be able to be run in a thread.
* In theory it can run at the same
* time as FO tree generation, once the layout-master-set has been read.
@@ -63,7 +62,7 @@
* rendering process can also run in a parallel thread.
*/
public void run() {
- generateAreas();
+ generateAreas();
}
@@ -71,11 +70,12 @@
* For now, only handle normal flow areas.
*/
public void addChild(Area childArea) {
- if (childArea ==null) return;
- if (childArea.getAreaClass() == Area.CLASS_NORMAL) {
- placeFlowRefArea(childArea);
- }
- else ; // TODO: all the others!
+ if (childArea == null)
+ return;
+ if (childArea.getAreaClass() == Area.CLASS_NORMAL) {
+ placeFlowRefArea(childArea);
+ } else
+ ; // TODO: all the others!
}
/**
@@ -86,27 +86,27 @@
* possibly moving to the next column or to the next page.
*/
protected void placeFlowRefArea(Area area) {
- // assert (curSpan != null);
- // assert (area == curFlow);
- // assert (curFlow == curSpan.getFlow(curSpan.getColumnCount()-1));
- // assert (area.getBPD().min < curSpan.getHeight());
- // Last column on this page is filled
- // See if the flow is full. The Flow LM can add an area before
- // it's full in the case of a break or a span.
- // Also in the case of a float to be placed. In that case, there
- // may be further material added later.
- // The Flow LM sets the "finished" flag on the Flow Area if it has
- // completely filled it. In this case, if on the last column
- // end the page.
-
- // Alternatively the child LM indicates to parent that it's full?
- if (area.getAllocationBPD().max >= curSpan.getMaxBPD().min) {
- // Consider it filled
- if (curSpan.getColumnCount() == curSpanColumns) {
- finishPage();
- }
- else curFlow = null; // Create new flow on next getParentArea()
- }
+ // assert (curSpan != null);
+ // assert (area == curFlow);
+ // assert (curFlow == curSpan.getFlow(curSpan.getColumnCount()-1));
+ // assert (area.getBPD().min < curSpan.getHeight());
+ // Last column on this page is filled
+ // See if the flow is full. The Flow LM can add an area before
+ // it's full in the case of a break or a span.
+ // Also in the case of a float to be placed. In that case, there
+ // may be further material added later.
+ // The Flow LM sets the "finished" flag on the Flow Area if it has
+ // completely filled it. In this case, if on the last column
+ // end the page.
+
+ // Alternatively the child LM indicates to parent that it's full?
+ if (area.getAllocationBPD().max >= curSpan.getMaxBPD().min) {
+ // Consider it filled
+ if (curSpan.getColumnCount() == curSpanColumns) {
+ finishPage();
+ } else
+ curFlow = null; // Create new flow on next getParentArea()
+ }
}
@@ -122,37 +122,38 @@
}
protected void placeFootnote(Area area) {
- // After doing this, reduce available space on the curSpan.
- // This has to be propagated to the curFlow (FlowLM) so that
- // it can adjust its limit for composition (or it just asks
- // curSpan for BPD before doing the break?)
- // If multi-column, we may have to balance to find more space
- // for a float. When?
+ // After doing this, reduce available space on the curSpan.
+ // This has to be propagated to the curFlow (FlowLM) so that
+ // it can adjust its limit for composition (or it just asks
+ // curSpan for BPD before doing the break?)
+ // If multi-column, we may have to balance to find more space
+ // for a float. When?
}
- private PageViewport makeNewPage(boolean bIsBlank, boolean bIsLast) {
- finishPage();
- try {
- curPage = ((PageSequence)fobj).createPage(bIsBlank, bIsLast);
- } catch (FOPException fopex) { /* ???? */ }
- curBody = (BodyRegion) curPage.getPage().
- getRegion(RegionReference.BODY).getRegion();
- return curPage;
- }
+ private PageViewport makeNewPage(boolean bIsBlank, boolean bIsLast) {
+ finishPage();
+ try {
+ curPage = ((PageSequence) fobj).createPage(bIsBlank, bIsLast);
+ } catch (FOPException fopex) { /* ???? */
+ }
+ curBody = (BodyRegion) curPage.getPage(). getRegion(
+
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic