gmazza 2004/08/29 13:17:35
Modified: src/java/org/apache/fop/fo FObj.java
src/java/org/apache/fop/fo/flow Block.java
BlockContainer.java Leader.java Table.java
TableBody.java TableCell.java TableRow.java
src/java/org/apache/fop/fo/pagination RegionBA.java
RegionSE.java
src/java/org/apache/fop/layoutmgr
BlockContainerLayoutManager.java
InstreamForeignObjectLM.java PageLayoutManager.java
src/java/org/apache/fop/render/rtf
TextAttributesConverter.java
Log:
Convenience method fobj.getPropLength() added to simplify some of the code.
Revision Changes Path
1.70 +12 -1 xml-fop/src/java/org/apache/fop/fo/FObj.java
Index: FObj.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- FObj.java 20 Aug 2004 09:38:21 -0000 1.69
+++ FObj.java 29 Aug 2004 20:17:34 -0000 1.70
@@ -188,7 +188,7 @@
}
/**
- * 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
@@ -196,6 +196,17 @@
*/
public String getPropString(int propId) {
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();
}
/**
1.36 +6 -12 xml-fop/src/java/org/apache/fop/fo/flow/Block.java
Index: Block.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Block.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- Block.java 25 Aug 2004 05:03:06 -0000 1.35
+++ Block.java 29 Aug 2004 20:17:34 -0000 1.36
@@ -116,18 +116,12 @@
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();
1.21 +2 -2 xml-fop/src/java/org/apache/fop/fo/flow/BlockContainer.java
Index: BlockContainer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/BlockContainer.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- BlockContainer.java 25 Aug 2004 05:03:06 -0000 1.20
+++ BlockContainer.java 29 Aug 2004 20:17:34 -0000 1.21
@@ -64,8 +64,8 @@
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);
}
/**
1.35 +2 -5 xml-fop/src/java/org/apache/fop/fo/flow/Leader.java
Index: Leader.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Leader.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- Leader.java 25 Aug 2004 05:03:06 -0000 1.34
+++ Leader.java 29 Aug 2004 20:17:34 -0000 1.35
@@ -75,8 +75,7 @@
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 @@
}
// if leaderPatternWidth = 0 = default = use-font-metric
- patternWidth =
- this.propertyList.get(PR_LEADER_PATTERN_WIDTH).getLength().getValue();
-
+ patternWidth = getPropLength(PR_LEADER_PATTERN_WIDTH);
}
/**
1.32 +3 -5 xml-fop/src/java/org/apache/fop/fo/flow/Table.java
Index: Table.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Table.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- Table.java 25 Aug 2004 05:03:06 -0000 1.31
+++ Table.java 29 Aug 2004 20:17:35 -0000 1.32
@@ -86,15 +86,13 @@
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);
1.26 +2 -4 xml-fop/src/java/org/apache/fop/fo/flow/TableBody.java
Index: TableBody.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableBody.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- TableBody.java 25 Aug 2004 05:03:06 -0000 1.25
+++ TableBody.java 29 Aug 2004 20:17:35 -0000 1.26
@@ -54,10 +54,8 @@
*/
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);
1.28 +5 -6 xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java
Index: TableCell.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- TableCell.java 25 Aug 2004 05:03:06 -0000 1.27
+++ TableCell.java 29 Aug 2004 20:17:35 -0000 1.28
@@ -202,8 +202,7 @@
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 @@
* 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 @@
+ 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);
1.30 +1 -1 xml-fop/src/java/org/apache/fop/fo/flow/TableRow.java
Index: TableRow.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableRow.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- TableRow.java 25 Aug 2004 05:03:06 -0000 1.29
+++ TableRow.java 29 Aug 2004 20:17:35 -0000 1.30
@@ -89,7 +89,7 @@
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;
}
1.16 +1 -1 xml-fop/src/java/org/apache/fop/fo/pagination/RegionBA.java
Index: RegionBA.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RegionBA.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- RegionBA.java 29 Aug 2004 13:34:06 -0000 1.15
+++ RegionBA.java 29 Aug 2004 20:17:35 -0000 1.16
@@ -48,7 +48,7 @@
bPrecedence =
(this.propertyList.get(PR_PRECEDENCE).getEnum() == Precedence.TRUE);
- this.extent = this.propertyList.get(PR_EXTENT).getLength().getValue();
+ this.extent = getPropLength(PR_EXTENT);
}
/**
1.11 +1 -1 xml-fop/src/java/org/apache/fop/fo/pagination/RegionSE.java
Index: RegionSE.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RegionSE.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RegionSE.java 29 Aug 2004 13:34:06 -0000 1.10
+++ RegionSE.java 29 Aug 2004 20:17:35 -0000 1.11
@@ -43,7 +43,7 @@
protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
- this.extent = this.propertyList.get(PR_EXTENT).getLength().getValue();
+ this.extent = getPropLength(PR_EXTENT);
}
/**
1.21 +2 -5
xml-fop/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
Index: BlockContainerLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- BlockContainerLayoutManager.java 26 May 2004 05:09:00 -0000 1.20
+++ BlockContainerLayoutManager.java 29 Aug 2004 20:17:35 -0000 1.21
@@ -96,11 +96,8 @@
}
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) {
1.2 +2 -2
xml-fop/src/java/org/apache/fop/layoutmgr/InstreamForeignObjectLM.java
Index: InstreamForeignObjectLM.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/InstreamForeignObjectLM.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InstreamForeignObjectLM.java 14 Aug 2004 18:36:21 -0000 1.1
+++ InstreamForeignObjectLM.java 29 Aug 2004 20:17:35 -0000 1.2
@@ -73,7 +73,7 @@
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
1.44 +4 -6 xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
Index: PageLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- PageLayoutManager.java 13 Jul 2004 00:16:22 -0000 1.43
+++ PageLayoutManager.java 29 Aug 2004 20:17:35 -0000 1.44
@@ -739,10 +739,9 @@
}
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 @@
}
body.setColumnCount(columnCount);
- int columnGap =
- r.getProperty(PR_COLUMN_GAP).getLength().getValue();
+ int columnGap = r.getPropLength(PR_COLUMN_GAP);
body.setColumnGap(columnGap);
return body;
}
1.14 +2 -2
xml-fop/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
Index: TextAttributesConverter.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TextAttributesConverter.java 22 May 2004 21:44:38 -0000 1.13
+++ TextAttributesConverter.java 29 Aug 2004 20:17:35 -0000 1.14
@@ -103,7 +103,7 @@
}
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);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]