identifiers. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197896 13f79535-47bb-0310-9956-ffa450edef68tags/Root_Temp_KnuthStylePageBreaking
@@ -18,7 +18,7 @@ | |||
package org.apache.fop.area; | |||
import org.apache.fop.fo.pagination.Region; | |||
import org.apache.fop.fo.Constants; | |||
/** | |||
* The body region area. | |||
@@ -40,7 +40,7 @@ public class BodyRegion extends RegionReference { | |||
* This sets the region reference area class to BODY. | |||
*/ | |||
public BodyRegion() { | |||
super(Region.BODY_CODE); | |||
super(Constants.FO_REGION_BODY); | |||
} | |||
/** |
@@ -21,7 +21,7 @@ package org.apache.fop.area; | |||
import java.io.Serializable; | |||
import java.util.Map; | |||
import org.apache.fop.fo.pagination.Region; | |||
import org.apache.fop.fo.Constants; | |||
/** | |||
* The page. | |||
@@ -52,15 +52,15 @@ public class Page implements Serializable, Cloneable { | |||
* @param port the region viewport to set | |||
*/ | |||
public void setRegionViewport(int areaclass, RegionViewport port) { | |||
if (areaclass == Region.BEFORE_CODE) { | |||
if (areaclass == Constants.FO_REGION_BEFORE) { | |||
regionBefore = port; | |||
} else if (areaclass == Region.START_CODE) { | |||
} else if (areaclass == Constants.FO_REGION_START) { | |||
regionStart = port; | |||
} else if (areaclass == Region.BODY_CODE) { | |||
} else if (areaclass == Constants.FO_REGION_BODY) { | |||
regionBody = port; | |||
} else if (areaclass == Region.END_CODE) { | |||
} else if (areaclass == Constants.FO_REGION_END) { | |||
regionEnd = port; | |||
} else if (areaclass == Region.AFTER_CODE) { | |||
} else if (areaclass == Constants.FO_REGION_AFTER) { | |||
regionAfter = port; | |||
} | |||
} | |||
@@ -72,15 +72,15 @@ public class Page implements Serializable, Cloneable { | |||
* @return the region viewport or null if none | |||
*/ | |||
public RegionViewport getRegionViewport(int areaclass) { | |||
if (areaclass == Region.BEFORE_CODE) { | |||
if (areaclass == Constants.FO_REGION_BEFORE) { | |||
return regionBefore; | |||
} else if (areaclass == Region.START_CODE) { | |||
} else if (areaclass == Constants.FO_REGION_START) { | |||
return regionStart; | |||
} else if (areaclass == Region.BODY_CODE) { | |||
} else if (areaclass == Constants.FO_REGION_BODY) { | |||
return regionBody; | |||
} else if (areaclass == Region.END_CODE) { | |||
} else if (areaclass == Constants.FO_REGION_END) { | |||
return regionEnd; | |||
} else if (areaclass == Region.AFTER_CODE) { | |||
} else if (areaclass == Constants.FO_REGION_AFTER) { | |||
return regionAfter; | |||
} | |||
return null; |
@@ -21,7 +21,7 @@ package org.apache.fop.area; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.apache.fop.fo.pagination.Region; | |||
import org.apache.fop.fo.Constants; | |||
/** | |||
* This is a region reference area for the page regions. | |||
@@ -29,7 +29,7 @@ import org.apache.fop.fo.pagination.Region; | |||
* so the page master can make copies from the original page and regions. | |||
*/ | |||
public class RegionReference extends Area implements Cloneable { | |||
private int regionClass = Region.BEFORE_CODE; | |||
private int regionClass = Constants.FO_REGION_BEFORE; | |||
private CTM ctm; | |||
// the list of block areas from the static flow | |||
private List blocks = new ArrayList(); |
@@ -555,7 +555,7 @@ public class PageSequence extends FObj { | |||
// SimplePageMaster spm = | |||
// this.layoutMasterSet.getSimplePageMaster(masterName); | |||
// Region region = spm.getRegion(Region.BODY); | |||
// Region region = spm.getRegion(FO_REGION_BODY); | |||
// Flow flow = (Flow)flowMap.get(region.getRegionName()); | |||
@@ -741,6 +741,9 @@ public class PageSequence extends FObj { | |||
return root; | |||
} | |||
/** | |||
* @see org.apache.fop.fo.FObj#getName() | |||
*/ | |||
public String getName() { | |||
return "fo:page-sequence"; | |||
} |
@@ -35,18 +35,6 @@ import org.apache.fop.fo.FObj; | |||
*/ | |||
public abstract class Region extends FObj { | |||
/* The following codes correspond to those found in area/RegionReference */ | |||
/** Integer Code for before regions */ | |||
public static final int BEFORE_CODE = 0; | |||
/** Integer Code for start regions */ | |||
public static final int START_CODE = 1; | |||
/** Integer Code for body regions */ | |||
public static final int BODY_CODE = 2; | |||
/** Integer Code for end regions */ | |||
public static final int END_CODE = 3; | |||
/** Integer Code for after regions */ | |||
public static final int AFTER_CODE = 4; | |||
private SimplePageMaster layoutMaster; | |||
private int regionId = -1; | |||
private String regionName; | |||
@@ -120,12 +108,6 @@ public abstract class Region extends FObj { | |||
*/ | |||
protected abstract String getDefaultRegionName(); | |||
/** | |||
* Returns the region class code. | |||
* @return the region class code | |||
*/ | |||
public abstract int getRegionClassCode(); | |||
/** | |||
* Returns the name of this region. | |||
* @return the region name |
@@ -34,7 +34,7 @@ public class RegionAfter extends RegionBA { | |||
* @see org.apache.fop.fo.FONode#FONode(FONode) | |||
*/ | |||
public RegionAfter(FONode parent) { | |||
super(parent, Region.AFTER_CODE); | |||
super(parent, FO_REGION_AFTER); | |||
} | |||
/** | |||
@@ -62,12 +62,8 @@ public class RegionAfter extends RegionBA { | |||
} | |||
/** | |||
* @see org.apache.fop.fo.pagination.Region#getRegionClassCode() | |||
* @see org.apache.fop.fo.FObj#getName() | |||
*/ | |||
public int getRegionClassCode() { | |||
return Region.AFTER_CODE; | |||
} | |||
public String getName() { | |||
return "fo:region-after"; | |||
} |
@@ -69,12 +69,12 @@ public abstract class RegionBA extends Region { | |||
*/ | |||
protected void adjustIPD(Rectangle vpRefRect, int wm) { | |||
int offset = 0; | |||
Region start = getSiblingRegion(Region.START); | |||
Region start = getSiblingRegion(FO_REGION_START); | |||
if (start != null) { | |||
offset = start.getExtent(); | |||
vpRefRect.translate(offset, 0); | |||
} | |||
Region end = getSiblingRegion(Region.END); | |||
Region end = getSiblingRegion(FO_REGION_END); | |||
if (end != null) { | |||
offset += end.getExtent(); | |||
} |
@@ -34,7 +34,7 @@ public class RegionBefore extends RegionBA { | |||
* @see org.apache.fop.fo.FONode#FONode(FONode) | |||
*/ | |||
public RegionBefore(FONode parent) { | |||
super(parent, Region.BEFORE_CODE); | |||
super(parent, FO_REGION_BEFORE); | |||
} | |||
/** | |||
@@ -44,13 +44,6 @@ public class RegionBefore extends RegionBA { | |||
return "xsl-region-before"; | |||
} | |||
/** | |||
* @see org.apache.fop.fo.pagination.Region#getRegionClassCode() | |||
*/ | |||
public int getRegionClassCode() { | |||
return Region.BEFORE_CODE; | |||
} | |||
/** | |||
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension) | |||
*/ | |||
@@ -73,6 +66,9 @@ public class RegionBefore extends RegionBA { | |||
return vpRect; | |||
} | |||
/** | |||
* @see org.apache.fop.fo.FObj#getName() | |||
*/ | |||
public String getName() { | |||
return "fo:region-before"; | |||
} |
@@ -45,7 +45,7 @@ public class RegionBody extends Region { | |||
* @see org.apache.fop.fo.FONode#FONode(FONode) | |||
*/ | |||
public RegionBody(FONode parent) { | |||
super(parent, Region.BODY_CODE); | |||
super(parent, FO_REGION_BODY); | |||
} | |||
/** | |||
@@ -100,12 +100,8 @@ public class RegionBody extends Region { | |||
} | |||
/** | |||
* @see org.apache.fop.fo.pagination.Region#getRegionClassCode() | |||
* @see org.apache.fop.fo.FObj#getName() | |||
*/ | |||
public int getRegionClassCode() { | |||
return Region.BODY_CODE; | |||
} | |||
public String getName() { | |||
return "fo:region-body"; | |||
} |
@@ -35,7 +35,7 @@ public class RegionEnd extends RegionSE { | |||
* @see org.apache.fop.fo.FONode#FONode(FONode) | |||
*/ | |||
public RegionEnd(FONode parent) { | |||
super(parent, Region.END_CODE); | |||
super(parent, FO_REGION_END); | |||
} | |||
/** | |||
@@ -63,12 +63,8 @@ public class RegionEnd extends RegionSE { | |||
} | |||
/** | |||
* @see org.apache.fop.fo.pagination.Region#getRegionClassCode() | |||
* @see org.apache.fop.fo.FObj#getName() | |||
*/ | |||
public int getRegionClassCode() { | |||
return Region.END_CODE; | |||
} | |||
public String getName() { | |||
return "fo:region-end"; | |||
} |
@@ -58,12 +58,12 @@ public abstract class RegionSE extends Region { | |||
*/ | |||
protected void adjustIPD(Rectangle vpRefRect, int wm) { | |||
int offset = 0; | |||
Region before = getSiblingRegion(Region.BEFORE); | |||
Region before = getSiblingRegion(FO_REGION_BEFORE); | |||
if (before != null && before.getPrecedence()) { | |||
offset = before.getExtent(); | |||
vpRefRect.translate(0, offset); | |||
} | |||
Region after = getSiblingRegion(Region.AFTER); | |||
Region after = getSiblingRegion(FO_REGION_AFTER); | |||
if (after != null && after.getPrecedence()) { | |||
offset += after.getExtent(); | |||
} |
@@ -34,7 +34,7 @@ public class RegionStart extends RegionSE { | |||
* @see org.apache.fop.fo.FONode#FONode(FONode) | |||
*/ | |||
public RegionStart(FONode parent) { | |||
super(parent, Region.START_CODE); | |||
super(parent, FO_REGION_START); | |||
} | |||
/** | |||
@@ -62,12 +62,8 @@ public class RegionStart extends RegionSE { | |||
} | |||
/** | |||
* @see org.apache.fop.fo.pagination.Region#getRegionClassCode() | |||
* @see org.apache.fop.fo.FObj#getName() | |||
*/ | |||
public int getRegionClassCode() { | |||
return Region.START_CODE; | |||
} | |||
public String getName() { | |||
return "fo:region-start"; | |||
} |
@@ -176,7 +176,7 @@ public class SimplePageMaster extends FObj { | |||
* @param region region to add | |||
*/ | |||
protected void addRegion(Region region) { | |||
String key = String.valueOf(region.getRegionClassCode()); | |||
String key = String.valueOf(region.getNameId()); | |||
regions.put(key, region); | |||
} | |||
@@ -442,7 +442,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable | |||
curPage.setPageNumber(getCurrentPageNumber()); | |||
RegionViewport rv = curPage.getPage().getRegionViewport( | |||
Region.BODY_CODE); | |||
FO_REGION_BODY); | |||
curBody = (BodyRegion) rv.getRegion(); | |||
flowBPD = (int) curBody.getBPD() - | |||
rv.getBorderAndPaddingWidthBefore() - rv.getBorderAndPaddingWidthAfter(); | |||
@@ -490,14 +490,14 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable | |||
} | |||
// Layout static content into the regions | |||
// Need help from pageseq for this | |||
layoutStaticContent(currentSimplePageMaster.getRegion(Region.BEFORE_CODE), | |||
Region.BEFORE_CODE); | |||
layoutStaticContent(currentSimplePageMaster.getRegion(Region.AFTER_CODE), | |||
Region.AFTER_CODE); | |||
layoutStaticContent(currentSimplePageMaster.getRegion(Region.START_CODE), | |||
Region.START_CODE); | |||
layoutStaticContent(currentSimplePageMaster.getRegion(Region.END_CODE), | |||
Region.END_CODE); | |||
layoutStaticContent(currentSimplePageMaster.getRegion(FO_REGION_BEFORE), | |||
FO_REGION_BEFORE); | |||
layoutStaticContent(currentSimplePageMaster.getRegion(FO_REGION_AFTER), | |||
FO_REGION_AFTER); | |||
layoutStaticContent(currentSimplePageMaster.getRegion(FO_REGION_START), | |||
FO_REGION_START); | |||
layoutStaticContent(currentSimplePageMaster.getRegion(FO_REGION_END), | |||
FO_REGION_END); | |||
// Queue for ID resolution and rendering | |||
areaTreeHandler.addPage(curPage); | |||
curPage = null; | |||
@@ -682,7 +682,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable | |||
curSpan = new Span(numCols); | |||
// get Width or Height as IPD for span | |||
RegionViewport rv = curPage.getPage().getRegionViewport(Region.BODY_CODE); | |||
RegionViewport rv = curPage.getPage().getRegionViewport(FO_REGION_BODY); | |||
int ipdWidth = (int) rv.getRegion().getIPD() - | |||
rv.getBorderAndPaddingWidthStart() - rv.getBorderAndPaddingWidthEnd(); | |||
@@ -708,7 +708,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable | |||
private PageViewport createPage(boolean bIsBlank, boolean bIsLast) | |||
throws FOPException { | |||
currentSimplePageMaster = getSimplePageMasterToUse(bIsBlank); | |||
Region body = currentSimplePageMaster.getRegion(Region.BODY_CODE); | |||
Region body = currentSimplePageMaster.getRegion(FO_REGION_BODY); | |||
if (!pageSequence.getMainFlow().getFlowName().equals(body.getRegionName())) { | |||
throw new FOPException("Flow '" + pageSequence.getMainFlow().getFlowName() | |||
+ "' does not map to the region-body in page-master '" | |||
@@ -777,13 +777,13 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable | |||
r.setLayoutDimension(PercentBase.BLOCK_IPD, pageWidth); | |||
r.setLayoutDimension(PercentBase.BLOCK_BPD, pageHeight); | |||
RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM); | |||
if (r.getRegionClassCode() == Region.BODY_CODE) { | |||
if (r.getNameId() == FO_REGION_BODY) { | |||
rvp.setRegion(makeRegionBodyReferenceArea(r, rvp.getViewArea())); | |||
} else { | |||
rvp.setRegion(makeRegionReferenceArea(r, rvp.getViewArea())); | |||
} | |||
page.setRegionViewport(r.getRegionClassCode(), rvp); | |||
if (r.getRegionClassCode() == Region.BODY_CODE) { | |||
page.setRegionViewport(r.getNameId(), rvp); | |||
if (r.getNameId() == FO_REGION_BODY) { | |||
bHasBody = true; | |||
} | |||
} | |||
@@ -857,7 +857,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable | |||
*/ | |||
private RegionReference makeRegionReferenceArea(Region r, | |||
Rectangle2D absRegVPRect) { | |||
RegionReference rr = new RegionReference(r.getRegionClassCode()); | |||
RegionReference rr = new RegionReference(r.getNameId()); | |||
setRegionPosition(r, rr, absRegVPRect); | |||
return rr; | |||
} |
@@ -238,15 +238,15 @@ public abstract class AbstractRenderer | |||
decision is to have fo:region-body on top, hence it is rendered | |||
last here. */ | |||
RegionViewport viewport; | |||
viewport = page.getRegionViewport(Region.BEFORE_CODE); | |||
viewport = page.getRegionViewport(FO_REGION_BEFORE); | |||
renderRegionViewport(viewport); | |||
viewport = page.getRegionViewport(Region.START_CODE); | |||
viewport = page.getRegionViewport(FO_REGION_START); | |||
renderRegionViewport(viewport); | |||
viewport = page.getRegionViewport(Region.END_CODE); | |||
viewport = page.getRegionViewport(FO_REGION_END); | |||
renderRegionViewport(viewport); | |||
viewport = page.getRegionViewport(Region.AFTER_CODE); | |||
viewport = page.getRegionViewport(FO_REGION_AFTER); | |||
renderRegionViewport(viewport); | |||
viewport = page.getRegionViewport(Region.BODY_CODE); | |||
viewport = page.getRegionViewport(FO_REGION_BODY); | |||
renderRegionViewport(viewport); | |||
} | |||
@@ -274,7 +274,7 @@ public abstract class AbstractRenderer | |||
// shouldn't the viewport have the CTM | |||
startVParea(region.getCTM()); | |||
// do after starting viewport area | |||
if (region.getRegionClass() == Region.BODY_CODE) { | |||
if (region.getRegionClass() == FO_REGION_BODY) { | |||
renderBodyRegion((BodyRegion) region); | |||
} else { | |||
renderRegion(region); |
@@ -517,8 +517,7 @@ public class PDFRenderer extends PrintRenderer { | |||
float width = (float)(viewArea.getWidth() / 1000f); | |||
float height = (float)(viewArea.getHeight() / 1000f); | |||
if (region.getRegion().getRegionClass() | |||
== org.apache.fop.fo.pagination.Region.BODY_CODE) { | |||
if (region.getRegion().getRegionClass() == FO_REGION_BODY) { | |||
bpMarginOffset = region.getBorderAndPaddingWidthBefore(); | |||
ipMarginOffset = region.getBorderAndPaddingWidthStart(); | |||
} |
@@ -53,9 +53,9 @@ class PageAttributesConverter { | |||
Property p = null; | |||
Float f = null; | |||
Region before = pagemaster.getRegion(Region.BEFORE_CODE); | |||
Region body = pagemaster.getRegion(Region.BODY_CODE); | |||
Region after = pagemaster.getRegion(Region.AFTER_CODE); | |||
Region before = pagemaster.getRegion(Constants.FO_REGION_BEFORE); | |||
Region body = pagemaster.getRegion(Constants.FO_REGION_BODY); | |||
Region after = pagemaster.getRegion(Constants.FO_REGION_AFTER); | |||
if ((p = pagemaster.getProperty(Constants.PR_PAGE_WIDTH)) != null) { | |||
f = new Float(p.getLength().getValue() / 1000f); |
@@ -253,23 +253,23 @@ public class XMLRenderer extends AbstractRenderer { | |||
writeStartTag("<regionViewport rect=\"" | |||
+ createString(port.getViewArea()) + "\">"); | |||
RegionReference region = port.getRegion(); | |||
if (region.getRegionClass() == Region.BEFORE_CODE) { | |||
if (region.getRegionClass() == FO_REGION_BEFORE) { | |||
writeStartTag("<regionBefore>"); | |||
renderRegion(region); | |||
writeEndTag("</regionBefore>"); | |||
} else if (region.getRegionClass() == Region.START_CODE) { | |||
} else if (region.getRegionClass() == FO_REGION_START) { | |||
writeStartTag("<regionStart>"); | |||
renderRegion(region); | |||
writeEndTag("</regionStart>"); | |||
} else if (region.getRegionClass() == Region.BODY_CODE) { | |||
} else if (region.getRegionClass() == FO_REGION_BODY) { | |||
writeStartTag("<regionBody>"); | |||
renderBodyRegion((BodyRegion) region); | |||
writeEndTag("</regionBody>"); | |||
} else if (region.getRegionClass() == Region.END_CODE) { | |||
} else if (region.getRegionClass() == FO_REGION_END) { | |||
writeStartTag("<regionEnd>"); | |||
renderRegion(region); | |||
writeEndTag("</regionEnd>"); | |||
} else if (region.getRegionClass() == Region.AFTER_CODE) { | |||
} else if (region.getRegionClass() == FO_REGION_AFTER) { | |||
writeStartTag("<regionAfter>"); | |||
renderRegion(region); | |||
writeEndTag("</regionAfter>"); |