ソースを参照

Fourth phase of performance improvement.

- 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-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Finn Bock 19年前
コミット
3f8fd79510
35個のファイルの変更127行の追加132行の削除
  1. 1
    1
      src/java/org/apache/fop/fo/FObj.java
  2. 6
    7
      src/java/org/apache/fop/fo/expr/BodyStartFunction.java
  3. 7
    7
      src/java/org/apache/fop/fo/expr/LabelEndFunction.java
  4. 2
    5
      src/java/org/apache/fop/fo/flow/Character.java
  5. 1
    1
      src/java/org/apache/fop/fo/flow/ExternalGraphic.java
  6. 2
    4
      src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
  7. 2
    4
      src/java/org/apache/fop/fo/flow/TableCell.java
  8. 0
    12
      src/java/org/apache/fop/fo/pagination/ColorProfile.java
  9. 1
    1
      src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
  10. 2
    2
      src/java/org/apache/fop/fo/pagination/PageSequence.java
  11. 4
    4
      src/java/org/apache/fop/fo/pagination/RegionBA.java
  12. 2
    2
      src/java/org/apache/fop/fo/pagination/RegionSE.java
  13. 1
    1
      src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
  14. 1
    1
      src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
  15. 1
    1
      src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java
  16. 0
    12
      src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java
  17. 0
    12
      src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
  18. 4
    2
      src/java/org/apache/fop/layoutmgr/CharacterLayoutManager.java
  19. 11
    9
      src/java/org/apache/fop/layoutmgr/ExternalGraphicLayoutManager.java
  20. 7
    4
      src/java/org/apache/fop/layoutmgr/ICLayoutManager.java
  21. 14
    10
      src/java/org/apache/fop/layoutmgr/InstreamForeignObjectLM.java
  22. 9
    4
      src/java/org/apache/fop/layoutmgr/LeaderLayoutManager.java
  23. 5
    1
      src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
  24. 4
    0
      src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java
  25. 6
    1
      src/java/org/apache/fop/layoutmgr/PageNumberLayoutManager.java
  26. 11
    11
      src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
  27. 3
    1
      src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java
  28. 1
    1
      src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
  29. 4
    1
      src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
  30. 0
    1
      src/java/org/apache/fop/layoutmgr/table/Body.java
  31. 6
    2
      src/java/org/apache/fop/layoutmgr/table/Caption.java
  32. 0
    1
      src/java/org/apache/fop/layoutmgr/table/Column.java
  33. 1
    1
      src/java/org/apache/fop/layoutmgr/table/Row.java
  34. 7
    3
      src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
  35. 1
    2
      src/java/org/apache/fop/render/mif/MIFHandler.java

+ 1
- 1
src/java/org/apache/fop/fo/FObj.java ファイルの表示

@@ -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();) {

+ 6
- 7
src/java/org/apache/fop/fo/expr/BodyStartFunction.java ファイルの表示

@@ -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);
}

+ 7
- 7
src/java/org/apache/fop/fo/expr/LabelEndFunction.java ファイルの表示

@@ -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);


+ 2
- 5
src/java/org/apache/fop/fo/flow/Character.java ファイルの表示

@@ -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);
}

/**

+ 1
- 1
src/java/org/apache/fop/fo/flow/ExternalGraphic.java ファイルの表示

@@ -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);
}

+ 2
- 4
src/java/org/apache/fop/fo/flow/InstreamForeignObject.java ファイルの表示

@@ -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:

+ 2
- 4
src/java/org/apache/fop/fo/flow/TableCell.java ファイルの表示

@@ -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);

+ 0
- 12
src/java/org/apache/fop/fo/pagination/ColorProfile.java ファイルの表示

@@ -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)

+ 1
- 1
src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java ファイルの表示

@@ -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

+ 2
- 2
src/java/org/apache/fop/fo/pagination/PageSequence.java ファイルの表示

@@ -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 \""

+ 4
- 4
src/java/org/apache/fop/fo/pagination/RegionBA.java ファイルの表示

@@ -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) {

+ 2
- 2
src/java/org/apache/fop/fo/pagination/RegionSE.java ファイルの表示

@@ -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) {

+ 1
- 1
src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java ファイルの表示

@@ -96,7 +96,7 @@ public class RepeatablePageMasterReference extends FObj
return null;
}
}
return getPropString(PR_MASTER_REFERENCE);
return masterReference;
}

/**

+ 1
- 1
src/java/org/apache/fop/fo/pagination/SimplePageMaster.java ファイルの表示

@@ -237,7 +237,7 @@ public class SimplePageMaster extends FObj {
* Return "master-name" property.
*/
public String getMasterName() {
return getPropString(PR_MASTER_NAME);
return masterName;
}

/**

+ 1
- 1
src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java ファイルの表示

@@ -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;
}

+ 0
- 12
src/java/org/apache/fop/fo/properties/LineHeightPropertyMaker.java ファイルの表示

@@ -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);
}
*/
}

+ 0
- 12
src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java ファイルの表示

@@ -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.

+ 4
- 2
src/java/org/apache/fop/layoutmgr/CharacterLayoutManager.java ファイルの表示

@@ -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());
}
}


+ 11
- 9
src/java/org/apache/fop/layoutmgr/ExternalGraphicLayoutManager.java ファイルの表示

@@ -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());
}
}


+ 7
- 4
src/java/org/apache/fop/layoutmgr/ICLayoutManager.java ファイルの表示

@@ -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());
}
}

+ 14
- 10
src/java/org/apache/fop/layoutmgr/InstreamForeignObjectLM.java ファイルの表示

@@ -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());
}
}


+ 9
- 4
src/java/org/apache/fop/layoutmgr/LeaderLayoutManager.java ファイルの表示

@@ -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());
}
}

+ 5
- 1
src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java ファイルの表示

@@ -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

+ 4
- 0
src/java/org/apache/fop/layoutmgr/PageNumberCitationLayoutManager.java ファイルの表示

@@ -114,5 +114,9 @@ public class PageNumberCitationLayoutManager extends LeafNodeLayoutManager {
}
return width;
}
protected void addId() {
addID(fobj.getId());
}
}


+ 6
- 1
src/java/org/apache/fop/layoutmgr/PageNumberLayoutManager.java ファイルの表示

@@ -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());
}
}


+ 11
- 11
src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java ファイルの表示

@@ -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;
}
}

+ 3
- 1
src/java/org/apache/fop/layoutmgr/RetrieveMarkerLayoutManager.java ファイルの表示

@@ -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);

}

+ 1
- 1
src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java ファイルの表示

@@ -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


+ 4
- 1
src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java ファイルの表示

@@ -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);

+ 0
- 1
src/java/org/apache/fop/layoutmgr/table/Body.java ファイルの表示

@@ -167,7 +167,6 @@ public class Body extends BlockStackingLayoutManager {
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
getParentArea(null);
addID();

Row childLM;
int iStartPos = 0;

+ 6
- 2
src/java/org/apache/fop/layoutmgr/table/Caption.java ファイルの表示

@@ -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;

+ 0
- 1
src/java/org/apache/fop/layoutmgr/table/Column.java ファイルの表示

@@ -67,7 +67,6 @@ public class Column extends AbstractLayoutManager {
*/
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
addID();
}

/**

+ 1
- 1
src/java/org/apache/fop/layoutmgr/table/Row.java ファイルの表示

@@ -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;

+ 7
- 3
src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java ファイルの表示

@@ -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;

+ 1
- 2
src/java/org/apache/fop/render/mif/MIFHandler.java ファイルの表示

@@ -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);

読み込み中…
キャンセル
保存