}
/**
- * 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
return propertyList.get(propId).getString();
}
+ /**
+ * 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)
*/
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();
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);
}
/**
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:
}
// if leaderPatternWidth = 0 = default = use-font-metric
- patternWidth =
- this.propertyList.get(PR_LEADER_PATTERN_WIDTH).getLength().getValue();
-
+ patternWidth = getPropLength(PR_LEADER_PATTERN_WIDTH);
}
/**
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);
*/
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);
bRelativeAlign = false; // Align on a per-cell basis
}
- this.minCellHeight =
- this.propertyList.get(PR_HEIGHT).getLength().getValue();
+ this.minCellHeight = getPropLength(PR_HEIGHT);
}
/**
* 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);
+ 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);
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;
}
bPrecedence =
(this.propertyList.get(PR_PRECEDENCE).getEnum() == Precedence.TRUE);
- this.extent = this.propertyList.get(PR_EXTENT).getLength().getValue();
+ this.extent = getPropLength(PR_EXTENT);
}
/**
protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
- this.extent = this.propertyList.get(PR_EXTENT).getLength().getValue();
+ this.extent = getPropLength(PR_EXTENT);
}
/**
}
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) {
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
}
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);
}
body.setColumnCount(columnCount);
- int columnGap =
- r.getProperty(PR_COLUMN_GAP).getLength().getValue();
+ int columnGap = r.getPropLength(PR_COLUMN_GAP);
body.setColumnGap(columnGap);
return body;
}
}
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);
}