diff options
Diffstat (limited to 'src/java/org/apache/fop')
14 files changed, 43 insertions, 51 deletions
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 27e91c126..b7c865d9b 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -188,7 +188,7 @@ public class FObj extends FONode implements Constants { } /** - * Helper method to quickly obtain the String value of a property + * Convenience method to quickly obtain the String value of a property * for this FO, without querying for the propertyList first. * Meaningful only for properties having a string representation * @param propId - the Constants ID of the desired property to obtain @@ -199,6 +199,17 @@ public class FObj extends FONode implements Constants { } /** + * Convenience method to quickly obtain the length value of a property + * for this FO, without querying for the propertyList first. + * Meaningful only for properties having a length representation + * @param propId - the Constants ID of the desired property to obtain + * @return the length value of the property value + */ + public int getPropLength(int propId) { + return propertyList.get(propId).getLength().getValue(); + } + + /** * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ protected void addChildNode(FONode child) { diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index d46651e8b..f1fe8a345 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -116,18 +116,12 @@ public class Block extends FObjMixed { this.alignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum(); this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum(); - this.lineHeight = this.propertyList.get( - PR_LINE_HEIGHT).getLength().getValue(); - this.startIndent = this.propertyList.get( - PR_START_INDENT).getLength().getValue(); - this.endIndent = this.propertyList.get( - PR_END_INDENT).getLength().getValue(); - this.spaceBefore = this.propertyList.get( - PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue(); - this.spaceAfter = this.propertyList.get( - PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue(); - this.textIndent = this.propertyList.get( - PR_TEXT_INDENT).getLength().getValue(); + this.lineHeight = getPropLength(PR_LINE_HEIGHT); + this.startIndent = getPropLength(PR_START_INDENT); + this.endIndent = getPropLength(PR_END_INDENT); + this.spaceBefore = getPropLength(PR_SPACE_BEFORE | CP_OPTIMUM); + this.spaceAfter = getPropLength(PR_SPACE_AFTER | CP_OPTIMUM); + this.textIndent = getPropLength(PR_TEXT_INDENT); this.keepWithNext = this.propertyList.get(PR_KEEP_WITH_NEXT).getEnum(); diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java index a27a0f24f..2d277fece 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java @@ -64,8 +64,8 @@ public class BlockContainer extends FObj { this.backgroundColor = this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - this.width = this.propertyList.get(PR_WIDTH).getLength().getValue(); - this.height = this.propertyList.get(PR_HEIGHT).getLength().getValue(); + this.width = getPropLength(PR_WIDTH); + this.height = getPropLength(PR_HEIGHT); } /** diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index a417777b4..ca92fcb6f 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -75,8 +75,7 @@ public class Leader extends FObjMixed { case LeaderPattern.RULE: // the following properties only apply // for leader-pattern = "rule" - ruleThickness = - propertyList.get(PR_RULE_THICKNESS).getLength().getValue(); + ruleThickness = getPropLength(PR_RULE_THICKNESS); ruleStyle = propertyList.get(PR_RULE_STYLE).getEnum(); break; case LeaderPattern.DOTS: @@ -88,9 +87,7 @@ public class Leader extends FObjMixed { } // if leaderPatternWidth = 0 = default = use-font-metric - patternWidth = - this.propertyList.get(PR_LEADER_PATTERN_WIDTH).getLength().getValue(); - + patternWidth = getPropLength(PR_LEADER_PATTERN_WIDTH); } /** diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index 570372944..4c532f67f 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -86,15 +86,13 @@ public class Table extends FObj { super.addProperties(attlist); this.breakBefore = this.propertyList.get(PR_BREAK_BEFORE).getEnum(); this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum(); - this.spaceBefore = this.propertyList.get( - PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue(); - this.spaceAfter = this.propertyList.get( - PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue(); + this.spaceBefore = getPropLength(PR_SPACE_BEFORE | CP_OPTIMUM); + this.spaceAfter = getPropLength(PR_SPACE_AFTER | CP_OPTIMUM); this.backgroundColor = this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); this.ipd = this.propertyList.get( PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); - this.height = this.propertyList.get(PR_HEIGHT).getLength().getValue(); + this.height = getPropLength(PR_HEIGHT); this.bAutoLayout = (this.propertyList.get( PR_TABLE_LAYOUT).getEnum() == TableLayout.AUTO); diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index 2b0ad8dfc..342684c50 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -54,10 +54,8 @@ public class TableBody extends FObj { */ protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); - this.spaceBefore = this.propertyList.get( - PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue(); - this.spaceAfter = this.propertyList.get( - PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue(); + this.spaceBefore = getPropLength(PR_SPACE_BEFORE | CP_OPTIMUM); + this.spaceAfter = getPropLength(PR_SPACE_AFTER | CP_OPTIMUM); this.backgroundColor = this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); getFOInputHandler().startBody(this); diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index cb6928d87..1f8d46a71 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -202,8 +202,7 @@ public class TableCell extends FObj { bRelativeAlign = false; // Align on a per-cell basis } - this.minCellHeight = - this.propertyList.get(PR_HEIGHT).getLength().getValue(); + this.minCellHeight = getPropLength(PR_HEIGHT); } /** @@ -220,8 +219,8 @@ public class TableCell extends FObj { * border-separate should only be specified on the table object, * but it inherits. */ - int iSep = propertyList.get( - PR_BORDER_SEPARATION | CP_INLINE_PROGRESSION_DIRECTION).getLength().getValue(); + int iSep = getPropLength(PR_BORDER_SEPARATION | + CP_INLINE_PROGRESSION_DIRECTION); this.startAdjust = iSep / 2 + bp.getBorderStartWidth(false) + bp.getPaddingStart(false); @@ -230,8 +229,8 @@ public class TableCell extends FObj { + bp.getPaddingEnd(false); // Offset of content rectangle in the block-progression direction - borderSeparation = propertyList.get( - PR_BORDER_SEPARATION | CP_BLOCK_PROGRESSION_DIRECTION).getLength().getValue(); + borderSeparation = getPropLength(PR_BORDER_SEPARATION | + CP_BLOCK_PROGRESSION_DIRECTION); this.beforeOffset = borderSeparation / 2 + bp.getBorderBeforeWidth(false) + bp.getPaddingBefore(false); diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java index 21d5057d7..f4e3b448e 100644 --- a/src/java/org/apache/fop/fo/flow/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/TableRow.java @@ -89,7 +89,7 @@ public class TableRow extends FObj { this.keepWithPrevious = getKeepValue(PR_KEEP_WITH_PREVIOUS | CP_WITHIN_COLUMN); - this.minHeight = this.propertyList.get(PR_HEIGHT).getLength().getValue(); + this.minHeight = getPropLength(PR_HEIGHT); setup = true; } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBA.java b/src/java/org/apache/fop/fo/pagination/RegionBA.java index 53d1b0745..80705b429 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBA.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBA.java @@ -48,7 +48,7 @@ public abstract class RegionBA extends Region { bPrecedence = (this.propertyList.get(PR_PRECEDENCE).getEnum() == Precedence.TRUE); - this.extent = this.propertyList.get(PR_EXTENT).getLength().getValue(); + this.extent = getPropLength(PR_EXTENT); } /** diff --git a/src/java/org/apache/fop/fo/pagination/RegionSE.java b/src/java/org/apache/fop/fo/pagination/RegionSE.java index 596560237..1f97acdaf 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionSE.java +++ b/src/java/org/apache/fop/fo/pagination/RegionSE.java @@ -43,7 +43,7 @@ public abstract class RegionSE extends Region { protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); - this.extent = this.propertyList.get(PR_EXTENT).getLength().getValue(); + this.extent = getPropLength(PR_EXTENT); } /** diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index d3d42ac01..f8e46ed70 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -96,11 +96,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { } protected int getRotatedIPD() { - PropertyList props = fobj.getPropertyList(); - int height = props.get(PR_HEIGHT).getLength().getValue(); - height = props.get(PR_INLINE_PROGRESSION_DIMENSION | CP_OPTIMUM).getLength().getValue(); - - return height; + return fobj.getPropLength(PR_INLINE_PROGRESSION_DIMENSION + | CP_OPTIMUM); } public BreakPoss getNextBreakPoss(LayoutContext context) { diff --git a/src/java/org/apache/fop/layoutmgr/InstreamForeignObjectLM.java b/src/java/org/apache/fop/layoutmgr/InstreamForeignObjectLM.java index eb582e313..6abc1a60e 100644 --- a/src/java/org/apache/fop/layoutmgr/InstreamForeignObjectLM.java +++ b/src/java/org/apache/fop/layoutmgr/InstreamForeignObjectLM.java @@ -73,7 +73,7 @@ public class InstreamForeignObjectLM extends LeafNodeLayoutManager { int ipd = -1; boolean bpdauto = false; if (hasLH) { - bpd = ifoNode.getProperty(PR_LINE_HEIGHT).getLength().getValue(); + bpd = ifoNode.getPropLength(PR_LINE_HEIGHT); } else { // this property does not apply when the line-height applies // isn't the block-progression-dimension always in the same diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java index 5397b57dd..82dd3077f 100644 --- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -739,10 +739,9 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable } private PageViewport createPageAreas(SimplePageMaster spm) { - int pageWidth = - spm.getProperty(PR_PAGE_WIDTH).getLength().getValue(); - int pageHeight = - spm.getProperty(PR_PAGE_HEIGHT).getLength().getValue(); + int pageWidth = spm.getPropLength(PR_PAGE_WIDTH); + int pageHeight = spm.getPropLength(PR_PAGE_HEIGHT); + // Set the page dimension as the toplevel containing block for margin. ((FObj) fobj.getParent()).setLayoutDimension(PercentBase.BLOCK_IPD, pageWidth); ((FObj) fobj.getParent()).setLayoutDimension(PercentBase.BLOCK_BPD, pageHeight); @@ -844,8 +843,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable } body.setColumnCount(columnCount); - int columnGap = - r.getProperty(PR_COLUMN_GAP).getLength().getValue(); + int columnGap = r.getPropLength(PR_COLUMN_GAP); body.setColumnGap(columnGap); return body; } diff --git a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java index 0fc3902df..a33e4bb9d 100644 --- a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java +++ b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java @@ -103,7 +103,7 @@ class TextAttributesConverter { } private static void attrBlockFontSize(FObj fobj, RtfAttributes rtfAttr) { - int fopValue = fobj.getProperty(Constants.PR_FONT_SIZE).getLength().getValue() / 500; + int fopValue = fobj.getPropLength(Constants.PR_FONT_SIZE) / 500; rtfAttr.set("fs", fopValue); } |