aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2002-04-26 09:40:58 +0000
committerKeiron Liddle <keiron@apache.org>2002-04-26 09:40:58 +0000
commit0954beb3e9d49330fad81ea551aa738f0e987e49 (patch)
tree2ad3e65bd6b5642cc4a0c809fd1f8c553bab595d /src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
parente05f8b6c0cfc6420fa2f0adca56a874b6486906d (diff)
downloadxmlgraphics-fop-0954beb3e9d49330fad81ea551aa738f0e987e49.tar.gz
xmlgraphics-fop-0954beb3e9d49330fad81ea551aa738f0e987e49.zip
initial implementation of line area layout processing
all inline area and their managers are managed by the LineLayoutManager. This class fills a line with inline areas and then does the alignment on all the inline areas. elements which create inline areas add their managers to the list that is used by the line layout. These managers have a retrievable index of inline areas. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194747 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java')
-rw-r--r--src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java45
1 files changed, 25 insertions, 20 deletions
diff --git a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
index 423af36d3..52156eca4 100644
--- a/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
@@ -30,12 +30,10 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
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. */
+ /* 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
@@ -66,13 +64,13 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
/* 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
@@ -94,7 +92,8 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
}
// True if some part of area can be placed, false if none is placed
return (splitContext.nextArea != area);
-
+ */
+ return false;
}
private BreakCost evaluateBreakCost(Area parent, Area child) {
@@ -136,11 +135,11 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
* @param childArea the area to add: will be some block-stacked Area.
* @param parentArea the area in which to add the childArea
*/
- protected void addChildToArea(Area childArea, BlockParent parentArea) {
+ protected boolean 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;
+ return false;
}
// See if the whole thing fits, including space before
@@ -151,23 +150,28 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
if (targetDim.max >= childArea.getAllocationBPD().min) {
//parentArea.addBlock(new InterBlockSpace(spaceBefore));
parentArea.addBlock((Block) childArea);
- return;
+ return false;
} else {
+ parentArea.addBlock((Block) childArea);
+ flush(); // hand off current area to parent
// Probably need something like max BPD so we don't get into
// infinite loops with large unbreakable chunks
- SplitContext splitContext = new SplitContext(targetDim);
+ //SplitContext splitContext = new SplitContext(targetDim);
- LayoutManager childLM =
+ /*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);
+ }*/
+ //flush(); // hand off current area to parent
+ //getParentArea(splitContext.nextArea);
+ //getParentArea(childArea);
// Check that reference IPD hasn't changed!!!
// If it has, we must "reflow" the content
- addChild(splitContext.nextArea);
+ //addChild(splitContext.nextArea);
+ //addChild(childArea);
+ return true;
}
}
@@ -180,17 +184,18 @@ public abstract class BlockStackingLayoutManager extends AbstractLayoutManager {
* If so, add it. Otherwise initiate breaking.
* @param childArea the area to add: will be some block-stacked Area.
*/
- public void addChild(Area childArea) {
- addChildToArea(childArea, getCurrentArea());
+ public boolean addChild(Area childArea) {
+ return addChildToArea(childArea, getCurrentArea());
}
/**
* Force current area to be added to parent area.
*/
- protected void flush() {
+ protected boolean flush() {
if (getCurrentArea() != null)
- parentLM.addChild(getCurrentArea());
+ return parentLM.addChild(getCurrentArea());
+ return false;
}
-
}
+