necessary for PSLM to separately supply it to SCLM. Some simplification of SCLM's Breaker class. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198628 13f79535-47bb-0310-9956-ffa450edef68tags/fop-0_90-alpha1
@@ -18,7 +18,7 @@ | |||
package org.apache.fop.area; | |||
import org.apache.fop.fo.Constants; | |||
import org.apache.fop.fo.pagination.RegionBody; | |||
/** | |||
* This class is a container for the areas that may be generated by | |||
@@ -37,22 +37,13 @@ public class BodyRegion extends RegionReference { | |||
* Constructor which can read traits directly | |||
* from an fo:region-body formatting object. | |||
*/ | |||
public BodyRegion(int columnCount, int columnGap, RegionViewport parent) { | |||
super(Constants.FO_REGION_BODY, parent); | |||
this.columnCount = columnCount; | |||
this.columnGap = columnGap; | |||
public BodyRegion(RegionBody rb, RegionViewport parent) { | |||
super(rb, parent); | |||
this.columnCount = rb.getColumnCount(); | |||
this.columnGap = rb.getColumnGap(); | |||
mainReference = new MainReference(this); | |||
} | |||
/** | |||
* Set the number of columns for blocks when not spanning | |||
* | |||
* @param colCount the number of columns | |||
*/ | |||
public void setColumnCount(int colCount) { | |||
this.columnCount = colCount; | |||
} | |||
/** | |||
* Get the number of columns when not spanning | |||
* | |||
@@ -62,16 +53,6 @@ public class BodyRegion extends RegionReference { | |||
return this.columnCount; | |||
} | |||
/** | |||
* Set the column gap between columns | |||
* The length is in millipoints. | |||
* | |||
* @param colGap the column gap in millipoints | |||
*/ | |||
public void setColumnGap(int colGap) { | |||
this.columnGap = colGap; | |||
} | |||
/** @return the column-gap value */ | |||
public int getColumnGap() { | |||
return this.columnGap; | |||
@@ -126,7 +107,7 @@ public class BodyRegion extends RegionReference { | |||
* @return a shallow copy of this object | |||
*/ | |||
public Object clone() { | |||
BodyRegion br = new BodyRegion(columnCount, columnGap, regionViewport); | |||
BodyRegion br = new BodyRegion((RegionBody) regionFO, regionViewport); | |||
br.setCTM(getCTM()); | |||
br.setIPD(getIPD()); | |||
br.beforeFloat = beforeFloat; |
@@ -99,11 +99,9 @@ public class Page implements Serializable, Cloneable { | |||
r.setLayoutDimension(PercentBase.BLOCK_IPD, rvp.getIPD()); | |||
r.setLayoutDimension(PercentBase.BLOCK_BPD, rvp.getBPD()); | |||
if (r.getNameId() == Constants.FO_REGION_BODY) { | |||
RegionBody rb = (RegionBody) r; | |||
rr = new BodyRegion(rb.getColumnCount(), rb.getColumnGap(), | |||
rvp); | |||
rr = new BodyRegion((RegionBody) r, rvp); | |||
} else { | |||
rr = new RegionReference(r.getNameId(), rvp); | |||
rr = new RegionReference(r, rvp); | |||
} | |||
setRegionReferencePosition(rr, r, rvp.getViewArea()); | |||
rvp.setRegionReference(rr); |
@@ -21,7 +21,7 @@ package org.apache.fop.area; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.fop.fo.Constants; | |||
import org.apache.fop.fo.pagination.Region; | |||
/** | |||
* This is a region reference area for a page regions. | |||
@@ -29,8 +29,9 @@ import org.apache.fop.fo.Constants; | |||
* so the page master can make copies from the original page and regions. | |||
*/ | |||
public class RegionReference extends Area implements Cloneable { | |||
private int regionClass = Constants.FO_REGION_BEFORE; | |||
protected Region regionFO; | |||
private CTM ctm; | |||
// the list of block areas from the static flow | |||
private List blocks = new ArrayList(); | |||
@@ -43,8 +44,8 @@ public class RegionReference extends Area implements Cloneable { | |||
* | |||
* @param type the region class type | |||
*/ | |||
public RegionReference(int type, RegionViewport parent) { | |||
regionClass = type; | |||
public RegionReference(Region regionFO, RegionViewport parent) { | |||
this.regionFO = regionFO; | |||
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); | |||
regionViewport = parent; | |||
} | |||
@@ -93,7 +94,17 @@ public class RegionReference extends Area implements Cloneable { | |||
* @return the region class | |||
*/ | |||
public int getRegionClass() { | |||
return regionClass; | |||
return regionFO.getNameId(); | |||
} | |||
/** | |||
* Return the Region FO which provides the | |||
* traits for this region. | |||
* | |||
* @return the region formatting object | |||
*/ | |||
public Region getRegionFO() { | |||
return regionFO; | |||
} | |||
/** | |||
@@ -113,7 +124,7 @@ public class RegionReference extends Area implements Cloneable { | |||
* @return a copy of this region reference area | |||
*/ | |||
public Object clone() { | |||
RegionReference rr = new RegionReference(regionClass, regionViewport); | |||
RegionReference rr = new RegionReference(regionFO, regionViewport); | |||
rr.ctm = ctm; | |||
rr.setIPD(getIPD()); | |||
return rr; |
@@ -442,7 +442,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { | |||
areaTreeHandler.getLayoutManagerMaker().makeLayoutManager(sc); | |||
lm.setTargetRegion(rv.getRegionReference()); | |||
lm.setParent(this); | |||
lm.doLayout(reg); | |||
lm.doLayout(); | |||
lm.reset(null); | |||
} | |||
@@ -228,9 +228,10 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { | |||
return targetRegion; | |||
} | |||
public void doLayout(SideRegion region) { | |||
MinOptMax range = new MinOptMax(targetRegion.getIPD()); | |||
StaticContentBreaker breaker = new StaticContentBreaker(region, this, range); | |||
public void doLayout() { | |||
Region region = targetRegion.getRegionFO(); | |||
StaticContentBreaker breaker = new StaticContentBreaker( | |||
this, targetRegion.getIPD(), region.getDisplayAlign()); | |||
breaker.doLayout(targetRegion.getBPD()); | |||
if (breaker.isOverflow()) { | |||
if (region.getOverflow() == EN_ERROR_IF_OVERFLOW) { | |||
@@ -240,17 +241,17 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { | |||
} | |||
} | |||
private class StaticContentBreaker extends AbstractBreaker { | |||
private Region region; | |||
private class StaticContentBreaker extends AbstractBreaker { | |||
private StaticContentLayoutManager lm; | |||
private MinOptMax ipd; | |||
private int displayAlign; | |||
private int ipd; | |||
boolean overflow = false; | |||
public StaticContentBreaker(Region region, StaticContentLayoutManager lm, MinOptMax ipd) { | |||
this.region = region; | |||
public StaticContentBreaker(StaticContentLayoutManager lm, int ipd, | |||
int displayAlign) { | |||
this.lm = lm; | |||
this.ipd = ipd; | |||
this.displayAlign = displayAlign; | |||
} | |||
public boolean isOverflow() { | |||
@@ -263,7 +264,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { | |||
protected LayoutContext createLayoutContext() { | |||
LayoutContext lc = super.createLayoutContext(); | |||
lc.setRefIPD(ipd.opt); | |||
lc.setRefIPD(ipd); | |||
return lc; | |||
} | |||
@@ -290,7 +291,7 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { | |||
} | |||
protected int getCurrentDisplayAlign() { | |||
return region.getDisplayAlign(); | |||
return displayAlign; | |||
} | |||
protected boolean hasMoreContent() { | |||
@@ -317,7 +318,6 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { | |||
protected LayoutManager getCurrentChildLM() { | |||
return null; //TODO NYI | |||
} | |||
} | |||
} | |||