- Get rid of calls to FObj.getProperty() and its friends. Replace them with the property getters on the FO nodes. PR: 31699 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198086 13f79535-47bb-0310-9956-ffa450edef68tags/Root_Temp_KnuthStylePageBreaking
@@ -316,7 +316,7 @@ public class FObj extends FONode implements Constants { | |||
* @param marker Marker to add. | |||
*/ | |||
protected void addMarker(Marker marker) { | |||
String mcname = marker.getPropString(PR_MARKER_CLASS_NAME); | |||
String mcname = marker.getMarkerClassName(); | |||
if (childNodes != null) { | |||
// check for empty childNodes | |||
for (Iterator iter = childNodes.iterator(); iter.hasNext();) { |
@@ -20,7 +20,7 @@ package org.apache.fop.fo.expr; | |||
import org.apache.fop.datatypes.Numeric; | |||
import org.apache.fop.fo.Constants; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.PropertyList; | |||
import org.apache.fop.fo.flow.ListItem; | |||
import org.apache.fop.fo.properties.Property; | |||
@@ -49,16 +49,15 @@ public class BodyStartFunction extends FunctionBase { | |||
Numeric distance = | |||
pInfo.getPropertyList().get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric(); | |||
FONode item = pInfo.getFO(); | |||
while (item != null && !(item instanceof ListItem)) { | |||
item = item.getParent(); | |||
PropertyList pList = pInfo.getPropertyList(); | |||
while (pList != null && !(pList.getFObj() instanceof ListItem)) { | |||
pList = pList.getParentPropertyList(); | |||
} | |||
if (item == null) { | |||
if (pList == null) { | |||
throw new PropertyException("body-start() called from outside an fo:list-item"); | |||
} | |||
Numeric startIndent = | |||
((ListItem)item).getProperty(Constants.PR_START_INDENT).getNumeric(); | |||
Numeric startIndent = pList.get(Constants.PR_START_INDENT).getNumeric(); | |||
return (Property) NumericOp.addition(distance, startIndent); | |||
} |
@@ -22,7 +22,7 @@ import org.apache.fop.datatypes.Numeric; | |||
import org.apache.fop.datatypes.Length; | |||
import org.apache.fop.datatypes.LengthBase; | |||
import org.apache.fop.fo.Constants; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.PropertyList; | |||
import org.apache.fop.fo.flow.ListItem; | |||
import org.apache.fop.fo.properties.PercentLength; | |||
import org.apache.fop.fo.properties.Property; | |||
@@ -56,17 +56,17 @@ public class LabelEndFunction extends FunctionBase { | |||
Length separation = | |||
pInfo.getPropertyList().getNearestSpecified(Constants.PR_PROVISIONAL_LABEL_SEPARATION).getLength(); | |||
FONode item = pInfo.getFO(); | |||
while (item != null && !(item instanceof ListItem)) { | |||
item = item.getParent(); | |||
PropertyList pList = pInfo.getPropertyList(); | |||
while (pList != null && !(pList.getFObj() instanceof ListItem)) { | |||
pList = pList.getParentPropertyList(); | |||
} | |||
if (item == null) { | |||
if (pList == null) { | |||
throw new PropertyException("label-end() called from outside an fo:list-item"); | |||
} | |||
Length startIndent = ((ListItem)item).getProperty(Constants.PR_START_INDENT).getLength(); | |||
Length startIndent = pList.get(Constants.PR_START_INDENT).getLength(); | |||
// Should be CONTAINING_REFAREA but that doesn't work | |||
LengthBase base = new LengthBase((ListItem)item, pInfo.getPropertyList(), | |||
LengthBase base = new LengthBase(pList.getFObj(), pInfo.getPropertyList(), | |||
LengthBase.CONTAINING_BOX); | |||
PercentLength refWidth = new PercentLength(1.0, base); | |||
@@ -229,11 +229,8 @@ public class Character extends FObj { | |||
* @see org.apache.fop.fo.FONode#addLayoutManager(List) | |||
*/ | |||
public void addLayoutManager(List list) { | |||
String str = getPropString(PR_CHARACTER); | |||
if (str.length() == 1) { | |||
CharacterLayoutManager lm = new CharacterLayoutManager(this); | |||
list.add(lm); | |||
} | |||
CharacterLayoutManager lm = new CharacterLayoutManager(this); | |||
list.add(lm); | |||
} | |||
/** |
@@ -245,7 +245,7 @@ public class ExternalGraphic extends FObj { | |||
* @see org.apache.fop.fo.FONode#addLayoutManager(List) | |||
*/ | |||
public void addLayoutManager(List list) { | |||
if (getPropString(PR_SRC) != null) { | |||
if (!src.equals("")) { | |||
ExternalGraphicLayoutManager lm = new ExternalGraphicLayoutManager(this); | |||
list.add(lm); | |||
} |
@@ -150,8 +150,7 @@ public class InstreamForeignObject extends FObj { | |||
public int computeXOffset (int ipd, int cwidth) { | |||
int xoffset = 0; | |||
int ta = getPropEnum(PR_TEXT_ALIGN); | |||
switch (ta) { | |||
switch (textAlign) { | |||
case TextAlign.CENTER: | |||
xoffset = (ipd - cwidth) / 2; | |||
break; | |||
@@ -169,8 +168,7 @@ public class InstreamForeignObject extends FObj { | |||
public int computeYOffset(int bpd, int cheight) { | |||
int yoffset = 0; | |||
int da = getPropEnum(PR_DISPLAY_ALIGN); | |||
switch (da) { | |||
switch (displayAlign) { | |||
case DisplayAlign.BEFORE: | |||
break; | |||
case DisplayAlign.AFTER: |
@@ -202,8 +202,7 @@ public class TableCell extends FObj { | |||
* border-separate should only be specified on the table object, | |||
* but it inherits. | |||
*/ | |||
int iSep = getPropLength(PR_BORDER_SEPARATION | | |||
CP_INLINE_PROGRESSION_DIRECTION); | |||
int iSep = borderSeparation.getIPD().getLength().getValue(); | |||
this.startAdjust = iSep / 2 + bp.getBorderStartWidth(false) | |||
+ bp.getPaddingStart(false); | |||
@@ -212,8 +211,7 @@ public class TableCell extends FObj { | |||
+ bp.getPaddingEnd(false); | |||
// Offset of content rectangle in the block-progression direction | |||
int bSep = getPropLength(PR_BORDER_SEPARATION | | |||
CP_BLOCK_PROGRESSION_DIRECTION); | |||
int bSep = borderSeparation.getBPD().getLength().getValue(); | |||
this.beforeOffset = bSep / 2 | |||
+ bp.getBorderBeforeWidth(false) | |||
+ bp.getPaddingBefore(false); |
@@ -66,18 +66,6 @@ public class ColorProfile extends FObj { | |||
renderingIntent = pList.get(PR_RENDERING_INTENT).getEnum(); | |||
} | |||
/** | |||
* Special processing for the end of parsing an ColorProfile object. | |||
* Extract instance variables from the collection of properties for this | |||
* object. | |||
*/ | |||
protected void endOfNode() throws SAXParseException { | |||
src = getPropString(PR_SRC); | |||
profileName = getPropString(PR_COLOR_PROFILE_NAME); | |||
intent = getPropEnum(PR_RENDERING_INTENT); | |||
this.propertyList = null; | |||
} | |||
/** | |||
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) | |||
XSL 1.0/FOP: EMPTY (no child nodes permitted) |
@@ -145,7 +145,7 @@ public class LayoutMasterSet extends FObj { | |||
throws SAXParseException { | |||
// check for duplication of master-name | |||
String masterName = sPM.getPropString(PR_MASTER_NAME); | |||
String masterName = sPM.getMasterName(); | |||
if (existsName(masterName)) { | |||
throw new SAXParseException("'master-name' (" | |||
+ masterName |
@@ -251,7 +251,7 @@ public class PageSequence extends FObj { | |||
super.addChildNode(child); // For getChildren | |||
} else if (childId == FO_STATIC_CONTENT) { | |||
addFlow((StaticContent) child); | |||
String flowName = ((StaticContent) child).getPropString(PR_FLOW_NAME); | |||
String flowName = ((StaticContent) child).getFlowName(); | |||
flowMap.put(flowName, child); | |||
startStructuredPageSequence(); | |||
} | |||
@@ -264,7 +264,7 @@ public class PageSequence extends FObj { | |||
* used to generate that page. | |||
*/ | |||
private void addFlow(Flow flow) throws SAXParseException { | |||
String flowName = flow.getPropString(PR_FLOW_NAME); | |||
String flowName = flow.getFlowName(); | |||
if (hasFlowName(flowName)) { | |||
throw new SAXParseException ("duplicate flow-name \"" |
@@ -79,14 +79,14 @@ public abstract class RegionBA extends Region { | |||
*/ | |||
protected void adjustIPD(Rectangle vpRefRect, int wm) { | |||
int offset = 0; | |||
Region start = getSiblingRegion(FO_REGION_START); | |||
RegionStart start = (RegionStart) getSiblingRegion(FO_REGION_START); | |||
if (start != null) { | |||
offset = start.getPropLength(PR_EXTENT); | |||
offset = start.getExtent().getValue(); | |||
vpRefRect.translate(offset, 0); // move (x, y) units | |||
} | |||
Region end = getSiblingRegion(FO_REGION_END); | |||
RegionEnd end = (RegionEnd) getSiblingRegion(FO_REGION_END); | |||
if (end != null) { | |||
offset += end.getPropLength(PR_EXTENT); | |||
offset += end.getExtent().getValue(); | |||
} | |||
if (offset > 0) { | |||
if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB) { |
@@ -73,12 +73,12 @@ public abstract class RegionSE extends Region { | |||
int offset = 0; | |||
RegionBefore before = (RegionBefore) getSiblingRegion(FO_REGION_BEFORE); | |||
if (before != null && before.getPrecedence() == TRUE) { | |||
offset = before.getPropLength(PR_EXTENT); | |||
offset = before.getExtent().getValue(); | |||
vpRefRect.translate(0, offset); | |||
} | |||
RegionAfter after = (RegionAfter) getSiblingRegion(FO_REGION_AFTER); | |||
if (after != null && after.getPrecedence() == TRUE) { | |||
offset += after.getPropLength(PR_EXTENT); | |||
offset += after.getExtent().getValue(); | |||
} | |||
if (offset > 0) { | |||
if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB) { |
@@ -96,7 +96,7 @@ public class RepeatablePageMasterReference extends FObj | |||
return null; | |||
} | |||
} | |||
return getPropString(PR_MASTER_REFERENCE); | |||
return masterReference; | |||
} | |||
/** |
@@ -237,7 +237,7 @@ public class SimplePageMaster extends FObj { | |||
* Return "master-name" property. | |||
*/ | |||
public String getMasterName() { | |||
return getPropString(PR_MASTER_NAME); | |||
return masterName; | |||
} | |||
/** |
@@ -88,7 +88,7 @@ public class SinglePageMasterReference extends FObj | |||
boolean isEmptyPage) { | |||
if (this.state == FIRST) { | |||
this.state = DONE; | |||
return getPropString(PR_MASTER_REFERENCE); | |||
return masterReference; | |||
} else { | |||
return null; | |||
} |
@@ -92,16 +92,4 @@ public class LineHeightPropertyMaker extends SpaceProperty.Maker { | |||
} | |||
return super.convertProperty(p, propertyList, fo); | |||
} | |||
/* | |||
protected Property convertPropertyDatatype(Property p, | |||
PropertyList propertyList, | |||
FObj fo) { | |||
Number numval = p.getNumber(); | |||
if (numval != null) { | |||
return new PercentLength(numval.doubleValue(), getPercentBase(fo,propertyList)); | |||
} | |||
return super.convertPropertyDatatype(p, propertyList, fo); | |||
} | |||
*/ | |||
} |
@@ -42,7 +42,6 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants | |||
protected LayoutManager parentLM = null; | |||
protected List childLMs = new ArrayList(10); | |||
protected FObj fobj; | |||
protected String foID = null; | |||
protected ListIterator fobjIter = null; | |||
protected Map markers = null; | |||
@@ -84,7 +83,6 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants | |||
*/ | |||
public void setFObj(FObj fo) { | |||
this.fobj = fo; | |||
foID = fobj.getPropString(PR_ID); | |||
markers = fobj.getMarkers(); | |||
fobjIter = fobj.getChildNodes(); | |||
childLMiter = new LMiter(this); | |||
@@ -344,16 +342,6 @@ public abstract class AbstractLayoutManager implements LayoutManager, Constants | |||
return parentLM.resolveRefID(ref); | |||
} | |||
/** | |||
* Add the id to the page. | |||
* If the id string is not null then add the id to the current page. | |||
*/ | |||
protected void addID() { | |||
if (foID != null) { | |||
addIDToPage(foID); | |||
} | |||
} | |||
/** | |||
* Add the id to the page. | |||
* If the id string is not null then add the id to the current page. |
@@ -56,9 +56,8 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { | |||
} | |||
private InlineArea getCharacterInlineArea(Character node) { | |||
String str = node.getProperty(Character.PR_CHARACTER).getString(); | |||
org.apache.fop.area.inline.Character ch = | |||
new org.apache.fop.area.inline.Character(str.charAt(0)); | |||
new org.apache.fop.area.inline.Character(node.getCharacter()); | |||
return ch; | |||
} | |||
@@ -255,5 +254,8 @@ public class CharacterLayoutManager extends LeafNodeLayoutManager { | |||
return returnList; | |||
} | |||
protected void addId() { | |||
addID(fobj.getId()); | |||
} | |||
} | |||
@@ -62,7 +62,7 @@ public class ExternalGraphicLayoutManager extends LeafNodeLayoutManager { | |||
setup(); | |||
InlineArea area = getExternalGraphicInlineArea(); | |||
setCurrentArea(area); | |||
setAlignment(graphic.getPropEnum(PR_VERTICAL_ALIGN)); | |||
setAlignment(graphic.getVerticalAlign()); | |||
setLead(viewHeight); | |||
} | |||
@@ -72,7 +72,7 @@ public class ExternalGraphicLayoutManager extends LeafNodeLayoutManager { | |||
* @todo see if can simplify property handling logic | |||
*/ | |||
private void setup() { | |||
url = ImageFactory.getURL(graphic.getPropString(PR_SRC)); | |||
url = ImageFactory.getURL(graphic.getSrc()); | |||
// assume lr-tb for now and just use the .optimum value of the range | |||
Length ipd = graphic.getPropertyList().get(PR_INLINE_PROGRESSION_DIMENSION). | |||
@@ -119,7 +119,7 @@ public class ExternalGraphicLayoutManager extends LeafNodeLayoutManager { | |||
cwidth = cw.getValue(); | |||
} | |||
int scaling = graphic.getPropEnum(PR_SCALING); | |||
int scaling = graphic.getScaling(); | |||
if ((scaling == Scaling.UNIFORM) || (cwidth == -1) || cheight == -1) { | |||
ImageFactory fact = ImageFactory.getInstance(); | |||
fopimage = fact.getImage(url, graphic.getUserAgent()); | |||
@@ -162,7 +162,7 @@ public class ExternalGraphicLayoutManager extends LeafNodeLayoutManager { | |||
} | |||
if (cwidth > viewWidth || cheight > viewHeight) { | |||
int overflow = graphic.getPropEnum(PR_OVERFLOW); | |||
int overflow = graphic.getOverflow(); | |||
if (overflow == Overflow.HIDDEN) { | |||
clip = true; | |||
} else if (overflow == Overflow.ERROR_IF_OVERFLOW) { | |||
@@ -174,8 +174,7 @@ public class ExternalGraphicLayoutManager extends LeafNodeLayoutManager { | |||
int xoffset = 0; | |||
int yoffset = 0; | |||
int da = graphic.getPropEnum(PR_DISPLAY_ALIGN); | |||
switch(da) { | |||
switch(graphic.getDisplayAlign()) { | |||
case DisplayAlign.BEFORE: | |||
break; | |||
case DisplayAlign.AFTER: | |||
@@ -189,8 +188,7 @@ public class ExternalGraphicLayoutManager extends LeafNodeLayoutManager { | |||
break; | |||
} | |||
int ta = graphic.getPropEnum(PR_TEXT_ALIGN); | |||
switch(ta) { | |||
switch(graphic.getTextAlign()) { | |||
case TextAlign.CENTER: | |||
xoffset = (viewWidth - cwidth) / 2; | |||
break; | |||
@@ -213,7 +211,7 @@ public class ExternalGraphicLayoutManager extends LeafNodeLayoutManager { | |||
* @return the viewport containing the image area | |||
*/ | |||
public InlineArea getExternalGraphicInlineArea() { | |||
Image imArea = new Image(graphic.getPropString(PR_SRC)); | |||
Image imArea = new Image(graphic.getSrc()); | |||
Viewport vp = new Viewport(imArea); | |||
vp.setIPD(viewWidth); | |||
vp.setBPD(viewHeight); | |||
@@ -227,5 +225,9 @@ public class ExternalGraphicLayoutManager extends LeafNodeLayoutManager { | |||
return vp; | |||
} | |||
protected void addId() { | |||
addID(graphic.getId()); | |||
} | |||
} | |||
@@ -23,19 +23,19 @@ import java.util.List; | |||
// FOP | |||
import org.apache.fop.area.inline.InlineArea; | |||
import org.apache.fop.fo.FObj; | |||
import org.apache.fop.fo.flow.InlineContainer; | |||
/** | |||
* This creates a single inline container area after | |||
* laying out the child block areas. All footnotes, floats | |||
* and id areas are maintained for later retrieval. | |||
*/ | |||
public class ICLayoutManager extends LeafNodeLayoutManager { | |||
private InlineContainer fobj; | |||
private List childrenLM; | |||
public ICLayoutManager(FObj node, List childLM) { | |||
public ICLayoutManager(InlineContainer node, List childLM) { | |||
super(node); | |||
fobj = node; | |||
childrenLM = childLM; | |||
} | |||
@@ -43,4 +43,7 @@ public class ICLayoutManager extends LeafNodeLayoutManager { | |||
return null; | |||
} | |||
protected void addId() { | |||
addID(fobj.getId()); | |||
} | |||
} |
@@ -45,7 +45,7 @@ public class InstreamForeignObjectLM extends LeafNodeLayoutManager { | |||
ifoNode = node; | |||
Viewport areaCurrent = getInlineArea(); | |||
setCurrentArea(areaCurrent); | |||
setAlignment(node.getPropEnum(PR_VERTICAL_ALIGN)); | |||
setAlignment(node.getVerticalAlign()); | |||
setLead(areaCurrent.getBPD()); | |||
} | |||
@@ -72,27 +72,27 @@ public class InstreamForeignObjectLM extends LeafNodeLayoutManager { | |||
int ipd = -1; | |||
boolean bpdauto = false; | |||
if (hasLH) { | |||
bpd = ifoNode.getPropLength(PR_LINE_HEIGHT); | |||
bpd = ifoNode.getLineHeight().getValue(); | |||
} else { | |||
// this property does not apply when the line-height applies | |||
// isn't the block-progression-dimension always in the same | |||
// direction as the line height? | |||
len = ifoNode.getProperty(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange().getOptimum().getLength(); | |||
len = ifoNode.getBlockProgressionDimension().getOptimum().getLength(); | |||
if (!len.isAuto()) { | |||
bpd = len.getValue(); | |||
} else { | |||
len = ifoNode.getProperty(PR_HEIGHT).getLength(); | |||
len = ifoNode.getHeight(); | |||
if (!len.isAuto()) { | |||
bpd = len.getValue(); | |||
} | |||
} | |||
} | |||
len = ifoNode.getProperty(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange().getOptimum().getLength(); | |||
len = ifoNode.getInlineProgressionDimension().getOptimum().getLength(); | |||
if (!len.isAuto()) { | |||
ipd = len.getValue(); | |||
} else { | |||
len = ifoNode.getProperty(PR_WIDTH).getLength(); | |||
len = ifoNode.getWidth(); | |||
if (!len.isAuto()) { | |||
ipd = len.getValue(); | |||
} | |||
@@ -102,7 +102,7 @@ public class InstreamForeignObjectLM extends LeafNodeLayoutManager { | |||
// to the content-height and content-width | |||
int cwidth = -1; | |||
int cheight = -1; | |||
len = ifoNode.getProperty(PR_CONTENT_WIDTH).getLength(); | |||
len = ifoNode.getContentWidth(); | |||
if (!len.isAuto()) { | |||
/*if(len.scaleToFit()) { | |||
if(ipd != -1) { | |||
@@ -111,7 +111,7 @@ public class InstreamForeignObjectLM extends LeafNodeLayoutManager { | |||
} else {*/ | |||
cwidth = len.getValue(); | |||
} | |||
len = ifoNode.getProperty(PR_CONTENT_HEIGHT).getLength(); | |||
len = ifoNode.getContentHeight(); | |||
if (!len.isAuto()) { | |||
/*if(len.scaleToFit()) { | |||
if(bpd != -1) { | |||
@@ -134,7 +134,7 @@ public class InstreamForeignObjectLM extends LeafNodeLayoutManager { | |||
if (cheight == -1) { | |||
cheight = (int)size.getY() * 1000; | |||
} | |||
int scaling = ifoNode.getPropEnum(PR_SCALING); | |||
int scaling = ifoNode.getScaling(); | |||
if (scaling == Scaling.UNIFORM) { | |||
// adjust the larger | |||
double rat1 = cwidth / (size.getX() * 1000f); | |||
@@ -156,7 +156,7 @@ public class InstreamForeignObjectLM extends LeafNodeLayoutManager { | |||
boolean clip = false; | |||
if (cwidth > ipd || cheight > bpd) { | |||
int overflow = ifoNode.getPropEnum(PR_OVERFLOW); | |||
int overflow = ifoNode.getOverflow(); | |||
if (overflow == Overflow.HIDDEN) { | |||
clip = true; | |||
} else if (overflow == Overflow.ERROR_IF_OVERFLOW) { | |||
@@ -185,5 +185,9 @@ public class InstreamForeignObjectLM extends LeafNodeLayoutManager { | |||
return areaCurrent; | |||
} | |||
protected void addId() { | |||
addID(ifoNode.getId()); | |||
} | |||
} | |||
@@ -23,6 +23,7 @@ import org.apache.fop.area.inline.FilledArea; | |||
import org.apache.fop.area.inline.InlineArea; | |||
import org.apache.fop.area.inline.Space; | |||
import org.apache.fop.area.inline.TextArea; | |||
import org.apache.fop.datatypes.PercentBase; | |||
import org.apache.fop.fo.flow.Leader; | |||
import org.apache.fop.fonts.Font; | |||
import org.apache.fop.traits.MinOptMax; | |||
@@ -48,7 +49,7 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { | |||
super(node); | |||
ldrNode = node; | |||
font = node.getFontState(); | |||
setAlignment(node.getPropEnum(PR_LEADER_ALIGNMENT)); | |||
setAlignment(node.getLeaderAlignment()); | |||
} | |||
public InlineArea get(LayoutContext context) { | |||
@@ -61,9 +62,10 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { | |||
private MinOptMax getLeaderAllocIPD(int ipd) { | |||
// length of the leader | |||
int opt = ldrNode.getLength(ldrNode.getProperty(PR_LEADER_LENGTH).getLengthRange().getOptimum().getLength(), ipd); | |||
int min = ldrNode.getLength(ldrNode.getProperty(PR_LEADER_LENGTH).getLengthRange().getMinimum().getLength(), ipd); | |||
int max = ldrNode.getLength(ldrNode.getProperty(PR_LEADER_LENGTH).getLengthRange().getMaximum().getLength(), ipd); | |||
fobj.setLayoutDimension(PercentBase.BLOCK_IPD, ipd); | |||
int opt = ldrNode.getLeaderLength().getOptimum().getLength().getValue(); | |||
int min = ldrNode.getLeaderLength().getMinimum().getLength().getValue(); | |||
int max = ldrNode.getLeaderLength().getMaximum().getLength().getValue(); | |||
return new MinOptMax(min, opt, max); | |||
} | |||
@@ -238,4 +240,7 @@ public class LeaderLayoutManager extends LeafNodeLayoutManager { | |||
return returnList; | |||
} | |||
protected void addId() { | |||
addID(ldrNode.getId()); | |||
} | |||
} |
@@ -225,7 +225,7 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager { | |||
* @param context the layout context for adding the area | |||
*/ | |||
public void addAreas(PositionIterator posIter, LayoutContext context) { | |||
addID(); | |||
addId(); | |||
offsetArea(context); | |||
widthAdjustArea(context); | |||
@@ -236,6 +236,10 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager { | |||
} | |||
} | |||
protected void addId() { | |||
// Do nothing here, overriden in subclasses that has a 'id' property. | |||
} | |||
/** | |||
* Offset this area. | |||
* Offset the inline area in the bpd direction when adding the |
@@ -114,5 +114,9 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager { | |||
} | |||
return width; | |||
} | |||
protected void addId() { | |||
addID(fobj.getId()); | |||
} | |||
} | |||
@@ -28,7 +28,7 @@ import org.apache.fop.fonts.Font; | |||
* LayoutManager for the fo:page-number formatting object | |||
*/ | |||
public class PageNumberLayoutManager extends LeafNodeLayoutManager { | |||
private PageNumber fobj; | |||
Font font = null; | |||
/** | |||
@@ -39,6 +39,7 @@ public class PageNumberLayoutManager extends LeafNodeLayoutManager { | |||
*/ | |||
public PageNumberLayoutManager(PageNumber node) { | |||
super(node); | |||
fobj = node; | |||
font = node.getFontState(); | |||
} | |||
@@ -64,5 +65,9 @@ public class PageNumberLayoutManager extends LeafNodeLayoutManager { | |||
protected void offsetArea(LayoutContext context) { | |||
curArea.setOffset(context.getBaseline()); | |||
} | |||
protected void addId() { | |||
addID(fobj.getId()); | |||
} | |||
} | |||
@@ -47,6 +47,7 @@ import org.apache.fop.fo.flow.Marker; | |||
import org.apache.fop.fo.pagination.PageNumberGenerator; | |||
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.SimplePageMaster; | |||
import org.apache.fop.fo.pagination.StaticContent; | |||
import org.apache.fop.fo.pagination.Title; | |||
@@ -743,8 +744,8 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements | |||
throws FOPException { | |||
currentSimplePageMaster = getSimplePageMasterToUse(bIsBlank); | |||
Region body = currentSimplePageMaster.getRegion(FO_REGION_BODY); | |||
if (!pageSequence.getMainFlow().getPropString(PR_FLOW_NAME).equals(body.getRegionName())) { | |||
throw new FOPException("Flow '" + pageSequence.getMainFlow().getPropString(PR_FLOW_NAME) | |||
if (!pageSequence.getMainFlow().getFlowName().equals(body.getRegionName())) { | |||
throw new FOPException("Flow '" + pageSequence.getMainFlow().getFlowName() | |||
+ "' does not map to the region-body in page-master '" | |||
+ currentSimplePageMaster.getMasterName() + "'"); | |||
} | |||
@@ -773,8 +774,8 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements | |||
} | |||
private PageViewport createPageAreas(SimplePageMaster spm) { | |||
int pageWidth = spm.getPropLength(PR_PAGE_WIDTH); | |||
int pageHeight = spm.getPropLength(PR_PAGE_HEIGHT); | |||
int pageWidth = spm.getPageWidth().getValue(); | |||
int pageHeight = spm.getPageHeight().getValue(); | |||
// Set the page dimension as the toplevel containing block for margin. | |||
((FObj) fobj.getParent()).setLayoutDimension(PercentBase.BLOCK_IPD, pageWidth); | |||
@@ -809,7 +810,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements | |||
r.setLayoutDimension(PercentBase.BLOCK_BPD, pageHeight); | |||
RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM); | |||
if (r.getNameId() == FO_REGION_BODY) { | |||
rvp.setRegion(makeRegionBodyReferenceArea(r, rvp.getViewArea())); | |||
rvp.setRegion(makeRegionBodyReferenceArea((RegionBody) r, rvp.getViewArea())); | |||
} else { | |||
rvp.setRegion(makeRegionReferenceArea(r, rvp.getViewArea())); | |||
} | |||
@@ -848,13 +849,12 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements | |||
TraitSetter.addBackground(rv, r.getCommonBorderPaddingBackground()); | |||
} | |||
private RegionReference makeRegionBodyReferenceArea(Region r, | |||
private RegionReference makeRegionBodyReferenceArea(RegionBody r, | |||
Rectangle2D absRegVPRect) { | |||
// Should set some column stuff here I think, or put it elsewhere | |||
BodyRegion body = new BodyRegion(); | |||
setRegionPosition(r, body, absRegVPRect); | |||
int columnCount = | |||
r.getProperty(PR_COLUMN_COUNT).getNumber().intValue(); | |||
int columnCount = r.getColumnCount(); | |||
if ((columnCount > 1) && (r.getOverflow() == Overflow.SCROLL)) { | |||
// recover by setting 'column-count' to 1. This is allowed but | |||
// not required by the spec. | |||
@@ -864,7 +864,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements | |||
} | |||
body.setColumnCount(columnCount); | |||
int columnGap = r.getPropLength(PR_COLUMN_GAP); | |||
int columnGap = r.getColumnGap(); | |||
body.setColumnGap(columnGap); | |||
return body; | |||
} | |||
@@ -905,13 +905,13 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements | |||
*/ | |||
private StaticContentLayoutManager getStaticContentLayoutManager(StaticContent sc) { | |||
StaticContentLayoutManager lm = | |||
(StaticContentLayoutManager)staticContentLMs.get(sc.getPropString(PR_FLOW_NAME)); | |||
(StaticContentLayoutManager)staticContentLMs.get(sc.getFlowName()); | |||
if (lm != null) { | |||
return lm; | |||
} | |||
lm = new StaticContentLayoutManager(); | |||
lm.setFObj(sc); | |||
staticContentLMs.put(sc.getPropString(PR_FLOW_NAME), lm); | |||
staticContentLMs.put(sc.getFlowName(), lm); | |||
return lm; | |||
} | |||
} |
@@ -30,6 +30,8 @@ import org.apache.fop.fo.flow.RetrieveMarker; | |||
* LayoutManager for a block FO. | |||
*/ | |||
public class RetrieveMarkerLayoutManager extends AbstractLayoutManager { | |||
private RetrieveMarker fobj; | |||
private LayoutManager replaceLM = null; | |||
private boolean loaded = false; | |||
private String name; | |||
@@ -42,6 +44,7 @@ public class RetrieveMarkerLayoutManager extends AbstractLayoutManager { | |||
*/ | |||
public RetrieveMarkerLayoutManager(RetrieveMarker node) { | |||
super(node); | |||
fobj = node; | |||
name = node.getRetrieveClassName(); | |||
position = node.getRetrievePosition(); | |||
boundary = node.getRetrieveBoundary(); | |||
@@ -76,7 +79,6 @@ public class RetrieveMarkerLayoutManager extends AbstractLayoutManager { | |||
LayoutContext layoutContext) { | |||
loadLM(); | |||
addID(); | |||
replaceLM.addAreas(parentIter, layoutContext); | |||
} |
@@ -145,7 +145,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager { | |||
public void addAreas(PositionIterator parentIter, | |||
LayoutContext layoutContext) { | |||
getParentArea(null); | |||
addID(); | |||
addID(fobj.getId()); | |||
// the list block contains areas stacked from each list item | |||
@@ -42,6 +42,8 @@ import java.util.List; | |||
* The list item contains a list item label and a list item body. | |||
*/ | |||
public class ListItemLayoutManager extends BlockStackingLayoutManager { | |||
private ListItem fobj; | |||
private Item label; | |||
private Item body; | |||
@@ -64,6 +66,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { | |||
*/ | |||
public ListItemLayoutManager(ListItem node) { | |||
super(node); | |||
fobj = node; | |||
setLabel(node.getLabel()); | |||
setBody(node.getBody()); | |||
} | |||
@@ -203,7 +206,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager { | |||
public void addAreas(PositionIterator parentIter, | |||
LayoutContext layoutContext) { | |||
getParentArea(null); | |||
addID(); | |||
addID(fobj.getId()); | |||
Item childLM; | |||
LayoutContext lc = new LayoutContext(0); |
@@ -167,7 +167,6 @@ public class Body extends BlockStackingLayoutManager { | |||
public void addAreas(PositionIterator parentIter, | |||
LayoutContext layoutContext) { | |||
getParentArea(null); | |||
addID(); | |||
Row childLM; | |||
int iStartPos = 0; |
@@ -18,6 +18,7 @@ | |||
package org.apache.fop.layoutmgr.table; | |||
import org.apache.fop.fo.flow.TableCaption; | |||
import org.apache.fop.layoutmgr.BlockStackingLayoutManager; | |||
import org.apache.fop.layoutmgr.LayoutManager; | |||
import org.apache.fop.layoutmgr.LeafPosition; | |||
@@ -39,6 +40,7 @@ import java.util.List; | |||
* table. | |||
*/ | |||
public class Caption extends BlockStackingLayoutManager { | |||
private TableCaption fobj; | |||
private Block curBlockArea; | |||
@@ -48,7 +50,9 @@ public class Caption extends BlockStackingLayoutManager { | |||
* Create a new Caption layout manager. | |||
* | |||
*/ | |||
public Caption() { | |||
public Caption(TableCaption node) { | |||
super(node); | |||
fobj = node; | |||
} | |||
/** | |||
@@ -134,7 +138,7 @@ public class Caption extends BlockStackingLayoutManager { | |||
public void addAreas(PositionIterator parentIter, | |||
LayoutContext layoutContext) { | |||
getParentArea(null); | |||
addID(); | |||
addID(fobj.getId()); | |||
LayoutManager childLM; | |||
int iStartPos = 0; |
@@ -67,7 +67,6 @@ public class Column extends AbstractLayoutManager { | |||
*/ | |||
public void addAreas(PositionIterator parentIter, | |||
LayoutContext layoutContext) { | |||
addID(); | |||
} | |||
/** |
@@ -267,7 +267,7 @@ public class Row extends BlockStackingLayoutManager { | |||
public void addAreas(PositionIterator parentIter, | |||
LayoutContext layoutContext) { | |||
getParentArea(null); | |||
addID(); | |||
addID(fobj.getId()); | |||
Cell childLM; | |||
int iStartPos = 0; |
@@ -18,6 +18,7 @@ | |||
package org.apache.fop.layoutmgr.table; | |||
import org.apache.fop.fo.flow.TableAndCaption; | |||
import org.apache.fop.layoutmgr.BlockStackingLayoutManager; | |||
import org.apache.fop.layoutmgr.LayoutManager; | |||
import org.apache.fop.layoutmgr.LeafPosition; | |||
@@ -41,7 +42,8 @@ import java.util.List; | |||
* The caption blocks have an implicit keep with the table. | |||
*/ | |||
public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { | |||
private TableAndCaption fobj; | |||
private Block curBlockArea; | |||
private List childBreaks = new ArrayList(); | |||
@@ -50,7 +52,9 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { | |||
* Create a new table and caption layout manager. | |||
* | |||
*/ | |||
public TableAndCaptionLayoutManager() { | |||
public TableAndCaptionLayoutManager(TableAndCaption node) { | |||
super(node); | |||
fobj = node; | |||
} | |||
/** | |||
@@ -135,7 +139,7 @@ public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager { | |||
public void addAreas(PositionIterator parentIter, | |||
LayoutContext layoutContext) { | |||
getParentArea(null); | |||
addID(); | |||
addID(fobj.getId()); | |||
LayoutManager childLM; | |||
int iStartPos = 0; |
@@ -23,7 +23,6 @@ import java.io.IOException; | |||
import java.io.OutputStream; | |||
import org.apache.fop.apps.FOUserAgent; | |||
import org.apache.fop.fo.Constants; | |||
import org.apache.fop.fo.FOEventHandler; | |||
import org.apache.fop.fo.flow.BasicLink; | |||
import org.apache.fop.fo.flow.Block; | |||
@@ -114,7 +113,7 @@ public class MIFHandler extends FOEventHandler { | |||
public void startPageSequence(PageSequence pageSeq) { | |||
// get the layout master set | |||
// setup the pages for this sequence | |||
String name = pageSeq.getPropString(Constants.PR_MASTER_REFERENCE); | |||
String name = pageSeq.getMasterReference(); | |||
SimplePageMaster spm = pageSeq.getRoot().getLayoutMasterSet().getSimplePageMaster(name); | |||
if (spm == null) { | |||
PageSequenceMaster psm = pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(name); |