/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-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.
package org.apache.fop.area;
/**
- * The before float area.
- * This is used to place the before float areas.
+ * The before-float-reference-area optionally generated by an fo:region-body.
* It has an optional separator and before float block children.
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class BeforeFloat extends BlockParent {
// this is an optional block area that will be rendered
import org.apache.fop.fo.Constants;
/**
- * The body region area.
- * This area contains a main reference area and optionally a
- * before float and footnote area.
+ * This class is a container for all areas that may be generated by
+ * an fo:region-body. It extends the RegionReference that is used
+ * directly by the other region classes.
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class BodyRegion extends RegionReference {
- private BeforeFloat beforeFloat;
- private MainReference mainReference;
- private Footnote footnote;
+ private BeforeFloat beforeFloat; // optional
+ private MainReference mainReference; // mandatory
+ private Footnote footnote; // optional
private int columnGap;
private int columnCount;
+++ /dev/null
-/*
- * Copyright 1999-2004 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.area;
-
-/**
- * The normal flow reference area class.
- * This area contains a list of block areas from the flow.
- */
-public class Flow extends BlockParent {
- // the list of blocks created from the flow
- private int stacking = TB;
-
- /**
- * Constructor.
- */
- public Flow() {
- addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
- }
-}
-
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-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.
// may combine with before float into a conditional area
/**
- * Footnote reference area.
+ * The footnote-reference-area optionally generated by an fo:region-body.
* This areas holds footnote areas and an optional separator area.
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class Footnote extends BlockParent {
private Block separator = null;
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-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.
import java.util.Iterator;
/**
- * The main body reference area.
- * This area that contains the flow via the span areas.
+ * The main-reference-area generated by an fo:region-body
+ * This object holds one or more span-reference-areas (block-areas
+ * stacked in the block progression direction)
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class MainReference extends Area {
private List spanAreas = new java.util.ArrayList();
for (Iterator spaniter = spanAreas.iterator(); spaniter.hasNext(); ) {
Span spanArea = (Span) spaniter.next();
for (int i = 0; i < spanArea.getColumnCount(); i++) {
- Flow flow = spanArea.getFlow(i);
+ NormalFlow flow = spanArea.getNormalFlow(i);
if (flow != null) {
if (flow.getChildAreas() != null) {
areaCount += flow.getChildAreas().size();
/**
* Get the column gap in millipoints.
*
- * @return the column gap in millioints
+ * @return the column gap in millipoints
*/
public int getColumnGap() {
return columnGap;
--- /dev/null
+/*
+ * Copyright 1999-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.area;
+
+/**
+ * The normal-flow-reference-area class.
+ * Each span-reference-area contains one or more of these objects
+ * See fo:region-body definition in the XSL Rec for more information.
+ */
+public class NormalFlow extends BlockParent {
+ /**
+ * Constructor.
+ */
+ public NormalFlow() {
+ addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
+ }
+}
+
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-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.
import java.util.List;
/**
- * The span reference area.
- * This is a reference area block area with 0 border and padding
- * The span reference areas are stacked inside the main reference area.
+ * The span-reference-area.
+ * This is a block-area with 0 border and padding that is stacked
+ * within the main-reference-area
+ * This object holds one or more normal-flow-reference-area children
+ * based on the column-count trait in effect for this span.
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class Span extends Area {
// the list of flow reference areas in this span area
private List flowAreas;
private int height;
+ private int columnCount;
/**
* Create a span area with the number of columns for this span area.
*/
public Span(int cols) {
flowAreas = new java.util.ArrayList(cols);
+ columnCount = cols;
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
}
/**
- * Add a flow area to this span area.
+ * Add a normal-flow-reference-area to this span-reference-area.
*
- * @param flow the flow area to add
+ * @param flow the normal-flow-reference-area to add
*/
- public void addFlow(Flow flow) {
+ public void addNormalFlow(NormalFlow flow) {
flowAreas.add(flow);
}
/**
- * Create a new flow and add it to this span area
+ * Create a new normal flow and add it to this span area
*
- * @return the newly made Flow object
+ * @return the newly made NormalFlow object
*/
- public Flow addNewFlow() {
- Flow newFlow = new Flow();
+ public NormalFlow addNewNormalFlow() {
+ NormalFlow newFlow = new NormalFlow();
newFlow.setIPD(getIPD());
flowAreas.add(newFlow);
return newFlow;
/**
* Get the column count for this span area.
*
- * @return the number of columns in this span area
+ * @return the number of columns defined for this span area
*/
public int getColumnCount() {
+ return columnCount;
+ }
+
+ /**
+ * Get the count of normal flows for this span area.
+ *
+ * @return the number of normal flows attached to this span
+ */
+ public int getNormalFlowCount() {
return flowAreas.size();
}
}
/**
- * Get the flow area for a particular column.
+ * Get the normal flow area for a particular column.
*
* @param count the column number for the flow
* @return the flow area for the requested column
*/
- public Flow getFlow(int count) {
- return (Flow) flowAreas.get(count);
+ public NormalFlow getNormalFlow(int columnNumber) {
+ return (NormalFlow) flowAreas.get(columnNumber);
}
}
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-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.
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-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.
import org.apache.fop.area.AreaTreeModel;
import org.apache.fop.area.Area;
import org.apache.fop.area.PageViewport;
-import org.apache.fop.area.Flow;
+import org.apache.fop.area.NormalFlow;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.Page;
import org.apache.fop.area.RegionViewport;
/** Current span being filled */
private Span curSpan;
- /** Number of columns in current span area. */
- private int curSpanColumns;
-
- /** Current flow-reference-area (column) being filled. */
- private Flow curFlow;
+ /** Current normal-flow-reference-area being filled. */
+ private NormalFlow curFlow;
private int flowBPD = 0;
private int flowIPD = 0;
return;
}
if (childArea.getAreaClass() == Area.CLASS_NORMAL) {
- placeFlowRefArea(childArea);
+ placeNormalFlowRefArea(childArea);
} else {
// todo: all the others!
}
}
/**
- * Place a FlowReferenceArea into the current span. The FlowLM is
+ * Place a normal-flow-reference-area into the current span. The FlowLM is
* responsible for making sure that it will actually fit in the
* current span area. In fact the area has already been added to the
* current span, so we are just checking to see if the span is "full",
*
* @param area the area to place
*/
- protected void placeFlowRefArea(Area area) {
+ protected void placeNormalFlowRefArea(Area area) {
// assert (curSpan != null);
// assert (area == curFlow);
// assert (curFlow == curSpan.getFlow(curSpan.getColumnCount()-1));
// ":" + curSpan.getMaxBPD().min);
/*if (area.getAllocationBPD().max >= curSpan.getMaxBPD().min) {
// Consider it filled
- if (curSpan.getColumnCount() == curSpanColumns) {
+ if (curSpan.getColumnCount() == curSpan.getNormalFlowCount()) {
finishPage();
} else
curFlow = null; // Create new flow on next getParentArea()
if (curSpan == null) {
createBodyMainReferenceArea();
bNeedSpan = true;
- } else if (numCols != curSpanColumns) {
+ } else if (numCols != curSpan.getNormalFlowCount()) {
// todo: BALANCE EXISTING COLUMNS
- if (curSpanColumns > 1) {
+ if (curSpan.getNormalFlowCount() > 1) {
// balanceColumns();
}
bNeedSpan = true;
// Make a new span and the first flow
createSpan(numCols);
} else if (curFlow == null) {
- curFlow = curSpan.addNewFlow();
+ curFlow = curSpan.addNewNormalFlow();
}
return curFlow;
} else {
*/
private void handleBreak(int breakVal) {
if (breakVal == Constants.EN_COLUMN) {
- if (curSpan != null
- && curSpan.getColumnCount() != curSpanColumns) {
+ if (curSpan != null // TODO: change below to < or <=
+ && curSpan.getNormalFlowCount() != curSpan.getColumnCount()) {
// Move to next column
- curFlow = curSpan.addNewFlow();
+ curFlow = curSpan.addNewNormalFlow();
return;
}
// else need new page
//}
//else newpos = new MinOptMax();
curSpan = new Span(numCols);
- curSpanColumns = numCols;
// get Width or Height as IPD for span
RegionViewport rv = curPage.getPage().getRegionViewport(FO_REGION_BODY);
curSpan.setIPD(ipdWidth);
//curSpan.setPosition(BPD, newpos);
curBody.getMainReference().addSpan(curSpan);
- curFlow = curSpan.addNewFlow();
+ curFlow = curSpan.addNewNormalFlow();
}
private PageViewport createPageAreas(SimplePageMaster spm) {
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-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.
import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.BodyRegion;
import org.apache.fop.area.CTM;
-import org.apache.fop.area.Flow;
+import org.apache.fop.area.NormalFlow;
import org.apache.fop.area.Footnote;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.MainReference;
- (span.getColumnCount() - 1) * mr.getColumnGap())
/ span.getColumnCount() + mr.getColumnGap();
for (int c = 0; c < span.getColumnCount(); c++) {
- Flow flow = (Flow) span.getFlow(c);
+ NormalFlow flow = (NormalFlow) span.getNormalFlow(c);
renderFlow(flow);
currentIPPosition += offset;
*
* @param flow The flow reference area
*/
- protected void renderFlow(Flow flow) {
+ protected void renderFlow(NormalFlow flow) {
// the normal flow reference area contains stacked blocks
List blocks = flow.getChildAreas();
if (blocks != null) {
import org.apache.fop.area.Block;
import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.BodyRegion;
-import org.apache.fop.area.Flow;
+import org.apache.fop.area.NormalFlow;
import org.apache.fop.area.Footnote;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.MainReference;
addTraitAttributes(span);
startElement("span", atts);
for (int c = 0; c < span.getColumnCount(); c++) {
- Flow flow = (Flow) span.getFlow(c);
+ NormalFlow flow = (NormalFlow) span.getNormalFlow(c);
renderFlow(flow);
}
/**
* @see org.apache.fop.render.AbstractRenderer#renderFlow(Flow)
*/
- protected void renderFlow(Flow flow) {
+ protected void renderFlow(NormalFlow flow) {
// the normal flow reference area contains stacked blocks
atts.clear();
addAreaAttributes(flow);