public BodyRegion() {
super(Constants.FO_REGION_BODY);
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
- mainReference = new MainReference();
+ mainReference = new MainReference(this);
}
/**
this.columnGap = colGap;
}
+ /** @return the column-gap value */
+ public int getColumnGap() {
+ return this.columnGap;
+ }
+
/**
* Set the before float area.
*
beforeFloat = bf;
}
- /**
- * Set the main reference area.
- *
- * @param mr the main reference area
- */
- public void setMainReference(MainReference mr) {
- mainReference = mr;
- }
-
/**
* Set the footnote area.
*
* See fo:region-body definition in the XSL Rec for more information.
*/
public class MainReference extends Area {
+
+ private BodyRegion parent;
private List spanAreas = new java.util.ArrayList();
- private int columnGap;
private int width;
private boolean isEmpty = true;
/**
* Constructor
*/
- public MainReference() {
+ public MainReference(BodyRegion parent) {
+ this.parent = parent;
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
}
return isEmpty;
}
- /**
- * Get the column gap in millipoints.
- *
- * @return the column gap in millipoints
- */
+ /** @return the number of columns */
+ public int getColumnCount() {
+ return parent.getColumnCount();
+ }
+
+ /** @return the column gap in millipoints */
public int getColumnGap() {
- return columnGap;
+ return parent.getColumnGap();
}
/**
* @return the newly made NormalFlow object
*/
public NormalFlow addAdditionalNormalFlow() {
- if (flowAreas.size() >= columnCount) { // internal error
+ if (!hasMoreAvailableFlows()) { // internal error
throw new IllegalStateException("Maximum number of flow areas (" +
columnCount + ") for this span reached.");
}
* @return the flow area for the requested column
*/
public NormalFlow getNormalFlow(int columnNumber) {
- return (NormalFlow) flowAreas.get(columnNumber);
+ if (columnNumber < flowAreas.size()) {
+ return (NormalFlow) flowAreas.get(columnNumber);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @return true if this span can provide additional flow areas.
+ */
+ public boolean hasMoreAvailableFlows() {
+ return (getNormalFlowCount() < getColumnCount());
}
}
/**
* Abstract base class for fo:region-before and fo:region-after.
*/
-public abstract class RegionBA extends RegionOuter {
+public abstract class RegionBA extends SideRegion {
// The value of properties relevant for fo:region-[before|after].
private int precedence;
// End of property values
+++ /dev/null
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.fop.fo.pagination;
-
-import java.awt.Rectangle;
-
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.FODimension;
-import org.apache.fop.datatypes.Length;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.PropertyList;
-
-/**
- * @author Jeremias Maerki
- */
-public abstract class RegionOuter extends Region {
-
- private Length extent;
-
- /**
- * @see org.apache.fop.fo.FONode#FONode(FONode)
- */
- protected RegionOuter(FONode parent) {
- super(parent);
- }
-
- /**
- * @see org.apache.fop.fo.FObj#bind(PropertyList)
- */
- public void bind(PropertyList pList) throws FOPException {
- super.bind(pList);
- extent = pList.get(PR_EXTENT).getLength();
- }
-
- /**
- * @return the "extent" property.
- */
- public Length getExtent() {
- return extent;
- }
-
-
-
-
-}
/**
* Abstract base class for fo:region-start and fo:region-end.
*/
-public abstract class RegionSE extends RegionOuter {
+public abstract class RegionSE extends SideRegion {
// The value of properties relevant for fo:region-[start|end].
// End of property values
--- /dev/null
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.fo.pagination;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.PropertyList;
+
+/**
+ * Common base class for side regions (before, after, start, end).
+ */
+public abstract class SideRegion extends Region {
+
+ private Length extent;
+
+ /** @see org.apache.fop.fo.FONode#FONode(FONode) */
+ protected SideRegion(FONode parent) {
+ super(parent);
+ }
+
+ /** @see org.apache.fop.fo.FObj#bind(PropertyList) */
+ public void bind(PropertyList pList) throws FOPException {
+ super.bind(pList);
+ extent = pList.get(PR_EXTENT).getLength();
+ }
+
+ /** @return the "extent" property. */
+ public Length getExtent() {
+ return extent;
+ }
+
+}
}
}
- private class BlockSequence extends KnuthSequence {
- static final int ANY_PAGE = 0;
- static final int ODD_PAGE = 1;
- static final int EVEN_PAGE = 2;
+ public class BlockSequence extends KnuthSequence {
private int startOn;
super();
startOn = iStartOn;
}
+
+ public int getStartOn() {
+ return this.startOn;
+ }
public BlockSequence endBlockSequence() {
KnuthSequence temp = super.endSequence();
protected abstract void addAreas(PositionIterator posIter, LayoutContext context);
protected abstract LayoutManager getTopLevelLM();
protected abstract LayoutManager getCurrentChildLM();
+ protected abstract LinkedList getNextKnuthElements(LayoutContext context, int alignment);
/** @return true if there's no content that could be handled. */
public boolean isEmpty() {
return (blockLists.size() == 0);
}
+ protected void startPart(BlockSequence list) {
+ //nop
+ }
+
+ protected abstract void finishPart();
+
protected LayoutContext createLayoutContext() {
return new LayoutContext(0);
}
public void doLayout(int flowBPD) {
LayoutContext childLC = createLayoutContext();
+ childLC.setStackLimit(new MinOptMax(flowBPD));
//System.err.println("Vertical alignment: " +
// currentSimplePageMaster.getRegion(FO_REGION_BODY).getDisplayAlign());
System.out.println("PLM> flow BPD =" + flowBPD);
//*** Phase 1: Get Knuth elements ***
- int nextSequenceStartsOn = BlockSequence.ANY_PAGE;
+ int nextSequenceStartsOn = Constants.EN_ANY;
while (hasMoreContent()) {
nextSequenceStartsOn = getNextBlockList(childLC, nextSequenceStartsOn, blockLists);
}
//debug code start
System.err.println(" blockListIndex = " + blockListIndex);
- String pagina = (blockList.startOn == BlockSequence.ANY_PAGE) ? "any page"
- : (blockList.startOn == BlockSequence.ODD_PAGE) ? "odd page"
+ String pagina = (blockList.startOn == Constants.EN_ANY) ? "any page"
+ : (blockList.startOn == Constants.EN_ODD_PAGE) ? "odd page"
: "even page";
System.err.println(" sequence starts on " + pagina);
logBlocklist(blockList);
alignment, alignmentLast);
int iOptPageNumber;
- KnuthSequence effectiveList;
+ BlockSequence effectiveList;
if (alignment == Constants.EN_JUSTIFY) {
/* justification */
effectiveList = justifyBoxes(blockList, alg, flowBPD);
* @param effectiveList effective Knuth element list (after adjustments)
*/
protected abstract void doPhase3(PageBreakingAlgorithm alg, int partCount,
- KnuthSequence originalList, KnuthSequence effectiveList);
+ BlockSequence originalList, BlockSequence effectiveList);
/**
* Phase 3 of Knuth algorithm: Adds the areas
* @param effectiveList effective Knuth element list (after adjustments)
*/
protected void addAreas(PageBreakingAlgorithm alg, int partCount,
- KnuthSequence originalList, KnuthSequence effectiveList) {
+ BlockSequence originalList, BlockSequence effectiveList) {
LayoutContext childLC;
// add areas
ListIterator effectiveListIterator = effectiveList.listIterator();
int startElementIndex = 0;
int endElementIndex = 0;
for (int p = 0; p < partCount; p++) {
- int displayAlign = getCurrentDisplayAlign();
-
PageBreakPosition pbp = (PageBreakPosition) alg.getPageBreaks().get(p);
endElementIndex = pbp.getLeafPos();
- System.out.println("PLM> page: " + (p + 1)
+ System.out.println("PLM> part: " + (p + 1)
+ ", break at position " + endElementIndex);
+ startPart(effectiveList);
+
+ int displayAlign = getCurrentDisplayAlign();
+
// ignore the first elements added by the
// PageSequenceLayoutManager
startElementIndex += (startElementIndex == 0)
startElementIndex = pbp.getLeafPos() + 1;
}
}
- protected abstract void finishPart();
-
- protected abstract LinkedList getNextKnuthElements(LayoutContext context, int alignment);
/**
* Gets the next block list (sequence) and adds it to a list of block lists if it's not empty.
switch (breakPenalty.getBreakClass()) {
case Constants.EN_PAGE:
System.err.println("PLM> break - PAGE");
- nextSequenceStartsOn = BlockSequence.ANY_PAGE;
+ nextSequenceStartsOn = Constants.EN_ANY;
+ break;
+ case Constants.EN_COLUMN:
+ System.err.println("PLM> break - COLUMN");
+ //TODO Fix this when implementing multi-column layout
+ nextSequenceStartsOn = Constants.EN_COLUMN;
break;
case Constants.EN_ODD_PAGE:
System.err.println("PLM> break - ODD PAGE");
- nextSequenceStartsOn = BlockSequence.ODD_PAGE;
+ nextSequenceStartsOn = Constants.EN_ODD_PAGE;
break;
case Constants.EN_EVEN_PAGE:
System.err.println("PLM> break - EVEN PAGE");
- nextSequenceStartsOn = BlockSequence.EVEN_PAGE;
+ nextSequenceStartsOn = Constants.EN_EVEN_PAGE;
break;
default:
throw new IllegalStateException("Invalid break class: "
* @param availableBPD the available BPD
* @return the effective list
*/
- private KnuthSequence justifyBoxes(BlockSequence blockList, PageBreakingAlgorithm alg, int availableBPD) {
+ private BlockSequence justifyBoxes(BlockSequence blockList, PageBreakingAlgorithm alg, int availableBPD) {
int iOptPageNumber;
iOptPageNumber = alg.findBreakingPoints(blockList, availableBPD, 1,
true, true);
// create a new sequence: the new elements will contain the
// Positions
// which will be used in the addAreas() phase
- KnuthSequence effectiveList = new KnuthSequence();
+ BlockSequence effectiveList = new BlockSequence(blockList.getStartOn());
effectiveList.addAll(getCurrentChildLM().getChangedKnuthElements(
blockList.subList(0, blockList.size() - blockList.ignoreAtEnd),
/* 0, */0));
//Info for deferred adding of areas
private PageBreakingAlgorithm deferredAlg;
- private KnuthSequence deferredOriginalList;
- private KnuthSequence deferredEffectiveList;
+ private BlockSequence deferredOriginalList;
+ private BlockSequence deferredEffectiveList;
public BlockContainerBreaker(BlockContainerLayoutManager bclm, MinOptMax ipd) {
this.bclm = bclm;
}
protected void doPhase3(PageBreakingAlgorithm alg, int partCount,
- KnuthSequence originalList, KnuthSequence effectiveList) {
+ BlockSequence originalList, BlockSequence effectiveList) {
//Defer adding of areas until addAreas is called by the parent LM
this.deferredAlg = alg;
this.deferredOriginalList = originalList;
if (curBlockArea == null) {
curBlockArea = new Block();
+ TraitSetter.addBreaks(curBlockArea,
+ fobj.getBreakBefore(), fobj.getBreakAfter());
+
// Must get dimensions from parent area
//Don't optimize this line away. It can have ugly side-effects.
/*Area parentArea =*/ parentLM.getParentArea(curBlockArea);
TraitSetter.addMargins(curBlockArea,
fobj.getCommonBorderPaddingBackground(),
fobj.getCommonMarginBlock());
- TraitSetter.addBreaks(curBlockArea,
- fobj.getBreakBefore(), fobj.getBreakAfter());
// Set up dimensions
// Get reference IPD from parentArea
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.RegionBody;
-import org.apache.fop.fo.pagination.RegionOuter;
+import org.apache.fop.fo.pagination.SideRegion;
import org.apache.fop.fo.pagination.SimplePageMaster;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.properties.CommonMarginBlock;
public class PageSequenceLayoutManager extends AbstractLayoutManager {
private PageSequence pageSeq;
+ /*
private static class BlockBreakPosition extends LeafPosition {
protected BreakPoss breakps;
super(lm, 0);
breakps = bp;
}
- }
+ }*/
private int startPageNum = 0;
//private HashMap staticContentLMs = new HashMap(4);
private FlowLayoutManager childFLM = null;
-
+
/**
* Constructor - activated by AreaTreeHandler for each
* fo:page-sequence in the input FO stream
*/
public void activateLayout() {
startPageNum = pageSeq.getStartingPageNumber();
- currentPageNum = startPageNum;
+ currentPageNum = startPageNum - 1;
pageNumberString = pageSeq.makeFormattedPageNumber(currentPageNum);
LineArea title = null;
private class PageBreaker extends AbstractBreaker {
private PageSequenceLayoutManager pslm;
+ private boolean firstPart = true;
public PageBreaker(PageSequenceLayoutManager pslm) {
this.pslm = pslm;
}
+ protected LayoutContext createLayoutContext() {
+ LayoutContext lc = new LayoutContext(0);
+ lc.setRefIPD(flowIPD);
+ return lc;
+ }
+
protected LayoutManager getTopLevelLM() {
return pslm;
}
}
protected void doPhase3(PageBreakingAlgorithm alg, int partCount,
- KnuthSequence originalList, KnuthSequence effectiveList) {
+ BlockSequence originalList, BlockSequence effectiveList) {
//Directly add areas after finding the breaks
addAreas(alg, partCount, originalList, effectiveList);
}
- protected void finishPart() {
+ protected void startPart(BlockSequence list) {
+ if (curPage == null) {
+ throw new IllegalStateException("curPage must not be null");
+ } else {
+ //firstPart is necessary because we need the first page before we start the
+ //algorithm so we have a BPD and IPD. This may subject to change later when we
+ //start handling more complex cases.
+ if (!firstPart) {
+ if (curSpan.hasMoreAvailableFlows()) {
+ curFlow = curSpan.addAdditionalNormalFlow();
+ } else {
+ handleBreak(list.getStartOn());
+ }
+ }
+ }
// add static areas and resolve any new id areas
// finish page and add to area tree
- finishPage();
- currentPageNum++;
- pageNumberString = pageSeq
- .makeFormattedPageNumber(currentPageNum);
+ firstPart = false;
+ }
+
+ protected void finishPart() {
}
protected LayoutManager getCurrentChildLM() {
/*LF*/ }
LayoutContext childLC = new LayoutContext(0);
- childLC.setStackLimit(new MinOptMax(flowBPD));
- childLC.setRefIPD(flowIPD);
+ childLC.setStackLimit(context.getStackLimit());
+ childLC.setRefIPD(context.getRefIPD());
if (!curLM.isFinished()) {
pageSeq.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, flowIPD);
private PageViewport makeNewPage(boolean bIsBlank, boolean bIsLast) {
finishPage();
+ currentPageNum++;
+ pageNumberString = pageSeq.makeFormattedPageNumber(currentPageNum);
+
try {
// create a new page
currentSimplePageMaster = pageSeq.getSimplePageMasterToUse(
curPage.setPageNumberString(pageNumberString);
if (log.isDebugEnabled()) {
- log.debug("[" + curPage.getPageNumberString() + "]");
+ log.debug("[" + curPage.getPageNumberString() + (bIsBlank ? "*" : "") + "]");
}
flowBPD = (int) curPage.getBodyRegion().getBPD();
- createSpan(curPage.getBodyRegion().getColumnCount());
+ createSpan(curPage.getBodyRegion(), false);
return curPage;
}
- private void createSpan(int numCols) {
+ /**
+ * Creates a new span reference area.
+ * @param bodyRegion The region-body to create the span for
+ * @param spanned true if a spanned region should be created
+ */
+ private void createSpan(BodyRegion bodyRegion, boolean spanned) {
// get Width or Height as IPD for span
RegionViewport rv = curPage.getPage().getRegionViewport(FO_REGION_BODY);
int ipdWidth = (int) rv.getRegion().getIPD() -
rv.getBorderAndPaddingWidthStart() - rv.getBorderAndPaddingWidthEnd();
- // currently hardcoding to one column, replace with numCols when ready
- curSpan = new Span(1 /* numCols */, ipdWidth);
+ //TODO currently hardcoding to one column, replace with numCols when ready
+ if (spanned) {
+ curSpan = new Span(1, ipdWidth);
+ } else {
+ int colWidth
+ = (ipdWidth - (bodyRegion.getColumnCount() - 1) * bodyRegion.getColumnGap())
+ / bodyRegion.getColumnCount();
+ curSpan = new Span(bodyRegion.getColumnCount(), colWidth);
+ }
//curSpan.setPosition(BPD, newpos);
curPage.getBodyRegion().getMainReference().addSpan(curSpan);
}
private void layoutStaticContent(int regionID) {
- RegionOuter reg = (RegionOuter)currentSimplePageMaster.getRegion(regionID);
+ SideRegion reg = (SideRegion)currentSimplePageMaster.getRegion(regionID);
if (reg == null) {
return;
}
layoutStaticContent(FO_REGION_END);
// Queue for ID resolution and rendering
areaTreeModel.addPage(curPage);
+ log.debug("page finished: " + curPage.getPageNumberString() + ", current num: " + currentPageNum);
curPage = null;
curSpan = null;
curFlow = null;
}
+ private void prepareNormalFlowArea(Area childArea) {
+ // Need span, break
+ int breakVal = Constants.EN_AUTO;
+ Integer breakBefore = (Integer)childArea.getTrait(Trait.BREAK_BEFORE);
+ if (breakBefore != null) {
+ breakVal = breakBefore.intValue();
+ }
+ if (breakVal != Constants.EN_AUTO) {
+ // We may be forced to make new page
+ handleBreak(breakVal);
+ } else if (curPage == null) {
+ log.debug("curPage is null. Making new page");
+ makeNewPage(false, false);
+ }
+ // Now we should be on the right kind of page
+ boolean bNeedNewSpan = false;
+ /* Determine if a new span is needed. From the XSL
+ * fo:region-body definition, if an fo:block has a span="ALL"
+ * (i.e., span all columns defined for the region-body), it
+ * must be placed in a span-reference-area whose
+ * column-count = 1. If its span-value is "NONE",
+ * place in a normal Span whose column-count is what
+ * is defined for the region-body.
+ */ // temporarily hardcoded to EN_NONE.
+ int span = Constants.EN_NONE; // childArea.getSpan()
+ int numColsNeeded;
+ if (span == Constants.EN_ALL) {
+ numColsNeeded = 1;
+ } else { // EN_NONE
+ numColsNeeded = curPage.getBodyRegion().getColumnCount();
+ }
+ if (curSpan == null) { // should never happen, remove?
+ bNeedNewSpan = true;
+ } else if (numColsNeeded != curSpan.getColumnCount()) {
+ // need a new Span, with numColsNeeded columns
+ if (curSpan.getColumnCount() > 1) {
+ // finished with current span, so balance
+ // its columns to make them the same "height"
+ // balanceColumns(); // TODO: implement
+ }
+ bNeedNewSpan = true;
+ }
+ if (bNeedNewSpan) {
+ createSpan(curPage.getBodyRegion(), (span == Constants.EN_ALL));
+ } else if (curFlow == null) { // should not happen
+ curFlow = curSpan.addAdditionalNormalFlow();
+ }
+ }
+
/**
* This is called from FlowLayoutManager when it needs to start
* a new flow container (while generating areas).
public Area getParentArea(Area childArea) {
int aclass = childArea.getAreaClass();
if (aclass == Area.CLASS_NORMAL) {
- // todo: how to get properties from the Area???
- // Need span, break
- int breakVal = Constants.EN_AUTO;
- Integer breakBefore = (Integer)childArea.getTrait(Trait.BREAK_BEFORE);
- if (breakBefore != null) {
- breakVal = breakBefore.intValue();
- }
- if (breakVal != Constants.EN_AUTO) {
- // We may be forced to make new page
- handleBreak(breakVal);
- } else if (curPage == null) {
- log.debug("curPage is null. Making new page");
- makeNewPage(false, false);
- }
- // Now we should be on the right kind of page
- boolean bNeedNewSpan = false;
- /* Determine if a new span is needed. From the XSL
- * fo:region-body definition, if an fo:block has a span="ALL"
- * (i.e., span all columns defined for the region-body), it
- * must be placed in a span-reference-area whose
- * column-count = 1. If its span-value is "NONE",
- * place in a normal Span whose column-count is what
- * is defined for the region-body.
- */ // temporarily hardcoded to EN_NONE.
- int span = Constants.EN_NONE; // childArea.getSpan()
- int numColsNeeded;
- if (span == Constants.EN_ALL) {
- numColsNeeded = 1;
- } else { // EN_NONE
- numColsNeeded = curPage.getBodyRegion().getColumnCount();
- }
- if (curSpan == null) { // should never happen, remove?
- bNeedNewSpan = true;
- } else if (numColsNeeded != curSpan.getColumnCount()) {
- // need a new Span, with numColsNeeded columns
- if (curSpan.getColumnCount() > 1) {
- // finished with current span, so balance
- // its columns to make them the same "height"
- // balanceColumns(); // TODO: implement
- }
- bNeedNewSpan = true;
- }
- if (bNeedNewSpan) {
- createSpan(numColsNeeded);
- } else if (curFlow == null) { // should not happen
- curFlow = curSpan.addAdditionalNormalFlow();
- }
+ //We now do this in PageBreaker
+ //prepareNormalFlowArea(childArea);
return curFlow;
} else {
if (curPage == null) {
*/
private void handleBreak(int breakVal) {
if (breakVal == Constants.EN_COLUMN) {
- if (curSpan != null
- && curSpan.getNormalFlowCount() < curSpan.getColumnCount()) {
+ if (curSpan != null && curSpan.hasMoreAvailableFlows()) {
// Move to next column
curFlow = curSpan.addAdditionalNormalFlow();
return;
// else need new page
breakVal = Constants.EN_PAGE;
}
+ log.debug("handling break after page " + currentPageNum + " breakVal=" + breakVal);
if (needEmptyPage(breakVal)) {
curPage = makeNewPage(true, false);
}
*/
private boolean needEmptyPage(int breakValue) {
- if (breakValue == Constants.EN_PAGE || curPage.getPage().isEmpty()) {
+ if (breakValue == Constants.EN_PAGE || ((curPage != null) && curPage.getPage().isEmpty())) {
// any page is OK or we already have an empty page
return false;
- }
- else {
+ } else {
/* IF we are on the kind of page we need, we'll need a new page. */
if (currentPageNum % 2 != 0) {
// Current page is odd
return (breakValue == Constants.EN_ODD_PAGE);
- }
- else {
+ } else {
return (breakValue == Constants.EN_EVEN_PAGE);
}
}
if (breakValue == Constants.EN_PAGE) {
return false;
}
- else if (currentPageNum%2 != 0) {
+ else if (currentPageNum % 2 != 0) {
// Current page is odd
return (breakValue == Constants.EN_EVEN_PAGE);
}
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.fo.pagination.Region;
-import org.apache.fop.fo.pagination.RegionOuter;
+import org.apache.fop.fo.pagination.SideRegion;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.traits.MinOptMax;
log.error("Cannot add marker to static areas");
}
- public void doLayout(RegionOuter region, StaticContentLayoutManager lm, MinOptMax ipd) {
+ public void doLayout(SideRegion region, StaticContentLayoutManager lm, MinOptMax ipd) {
StaticContentBreaker breaker = new StaticContentBreaker(region, lm, ipd);
breaker.doLayout(lm.getRegionReference().getBPD());
if (breaker.isOverflow()) {
}
protected void doPhase3(PageBreakingAlgorithm alg, int partCount,
- KnuthSequence originalList, KnuthSequence effectiveList) {
+ BlockSequence originalList, BlockSequence effectiveList) {
//Directly add areas after finding the breaks
addAreas(alg, partCount, originalList, effectiveList);
if (partCount > 1) {
Span span = null;
List spans = mr.getSpans();
+ int saveBPPos = currentBPPosition;
for (int count = 0; count < spans.size(); count++) {
span = (Span) spans.get(count);
int offset = (mr.getWidth()
- - (span.getColumnCount() - 1) * mr.getColumnGap())
- / span.getColumnCount() + mr.getColumnGap();
+ - (mr.getColumnCount() - 1) * mr.getColumnGap())
+ / mr.getColumnCount() + mr.getColumnGap();
for (int c = 0; c < span.getColumnCount(); c++) {
NormalFlow flow = (NormalFlow) span.getNormalFlow(c);
- renderFlow(flow);
- currentIPPosition += offset;
+ if (flow != null) {
+ currentBPPosition = saveBPPos;
+ renderFlow(flow);
+ currentIPPosition += flow.getIPD();
+ currentIPPosition += offset;
+ }
}
currentIPPosition = saveIPPos;
- currentBPPosition += span.getHeight();
+ currentBPPosition = saveBPPos + span.getHeight();
}
}