diff options
author | Glen Mazza <gmazza@apache.org> | 2003-12-28 17:10:17 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2003-12-28 17:10:17 +0000 |
commit | ad99c2eb30a8b8bb26e858a9a09b1465298147b0 (patch) | |
tree | 970703dbab601fd60777d4378b769f45edd20294 /src/java/org/apache/fop | |
parent | 9a9cc2318e78c79a0ddb9dbeeb56f2bd85b10dde (diff) | |
download | xmlgraphics-fop-ad99c2eb30a8b8bb26e858a9a09b1465298147b0.tar.gz xmlgraphics-fop-ad99c2eb30a8b8bb26e858a9a09b1465298147b0.zip |
Conversion of more properties from Strings to ints.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197072 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
23 files changed, 151 insertions, 101 deletions
diff --git a/src/java/org/apache/fop/area/Block.java b/src/java/org/apache/fop/area/Block.java index 2c7273a61..850e8894a 100644 --- a/src/java/org/apache/fop/area/Block.java +++ b/src/java/org/apache/fop/area/Block.java @@ -93,10 +93,22 @@ public class Block extends BlockParent { * @param block the block area to add */ public void addBlock(Block block) { + addBlock(block, true); + } + + /** + * Add the block to this block area. + * + * @param block the block area to add + * @param autoHeight increase the height of the block. + */ + public void addBlock(Block block, boolean autoHeight) { if (children == null) { children = new ArrayList(); } - height += block.getHeight(); + if (autoHeight) { + height += block.getHeight(); + } children.add(block); } diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java index abff1d3f4..4d237ebcd 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/java/org/apache/fop/fo/flow/BasicLink.java @@ -102,10 +102,10 @@ public class BasicLink extends Inline { // this.propertyList.get("baseline-shift"); // this.propertyList.get("destination-place-offset"); // this.propertyList.get("dominant-baseline"); - String ext = propertyList.get("external-destination").getString(); + String ext = propertyList.get(PR_EXTERNAL_DESTINATION).getString(); setupID(); // this.propertyList.get("indicate-destination"); - String internal = propertyList.get("internal-destination").getString(); + String internal = propertyList.get(PR_INTERNAL_DESTINATION).getString(); if (ext.length() > 0) { link = ext; external = true; diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index dc0632516..82dec643b 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -102,27 +102,27 @@ public class ExternalGraphic extends FObj { * This gets the sizes for the image and the dimensions and clipping. */ public void setup() { - url = this.propertyList.get("src").getString(); + url = this.propertyList.get(PR_SRC).getString(); if (url == null) { return; } url = ImageFactory.getURL(url); // assume lr-tb for now - Length ipd = propertyList.get("inline-progression-dimension.optimum").getLength(); + Length ipd = propertyList.get(PR_INLINE_PROGRESSION_DIMENSION).getLength(); if (!ipd.isAuto()) { viewWidth = ipd.getValue(); } else { - ipd = propertyList.get("width").getLength(); + ipd = propertyList.get(PR_WIDTH).getLength(); if (!ipd.isAuto()) { viewWidth = ipd.getValue(); } } - Length bpd = propertyList.get("block-progression-dimension.optimum").getLength(); + Length bpd = propertyList.get(PR_BLOCK_PROGRESSION_DIMENSION | CP_OPTIMUM).getLength(); if (!bpd.isAuto()) { viewHeight = bpd.getValue(); } else { - bpd = propertyList.get("height").getLength(); + bpd = propertyList.get(PR_HEIGHT).getLength(); if (!bpd.isAuto()) { viewHeight = bpd.getValue(); } @@ -133,7 +133,7 @@ public class ExternalGraphic extends FObj { int cwidth = -1; int cheight = -1; - Length ch = propertyList.get("content-height").getLength(); + Length ch = propertyList.get(PR_CONTENT_HEIGHT).getLength(); if (!ch.isAuto()) { /*if (ch.scaleToFit()) { if (viewHeight != -1) { @@ -142,7 +142,7 @@ public class ExternalGraphic extends FObj { } else {*/ cheight = ch.getValue(); } - Length cw = propertyList.get("content-width").getLength(); + Length cw = propertyList.get(PR_CONTENT_WIDTH).getLength(); if (!cw.isAuto()) { /*if (cw.scaleToFit()) { if (viewWidth != -1) { @@ -152,7 +152,7 @@ public class ExternalGraphic extends FObj { cwidth = cw.getValue(); } - int scaling = propertyList.get("scaling").getEnum(); + int scaling = propertyList.get(PR_SCALING).getEnum(); if ((scaling == Scaling.UNIFORM) || (cwidth == -1) || cheight == -1) { ImageFactory fact = ImageFactory.getInstance(); fopimage = fact.getImage(url, getUserAgent()); @@ -195,7 +195,7 @@ public class ExternalGraphic extends FObj { } if (cwidth > viewWidth || cheight > viewHeight) { - int overflow = propertyList.get("overflow").getEnum(); + int overflow = propertyList.get(PR_OVERFLOW).getEnum(); if (overflow == Overflow.HIDDEN) { clip = true; } else if (overflow == Overflow.ERROR_IF_OVERFLOW) { @@ -207,7 +207,7 @@ public class ExternalGraphic extends FObj { int xoffset = 0; int yoffset = 0; - int da = propertyList.get("display-align").getEnum(); + int da = propertyList.get(PR_DISPLAY_ALIGN).getEnum(); switch(da) { case DisplayAlign.BEFORE: break; @@ -222,7 +222,7 @@ public class ExternalGraphic extends FObj { break; } - int ta = propertyList.get("text-align").getEnum(); + int ta = propertyList.get(PR_TEXT_ALIGN).getEnum(); switch(ta) { case TextAlign.CENTER: xoffset = (viewWidth - cwidth) / 2; diff --git a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java index 0eaa19d16..1987dec13 100644 --- a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -74,7 +74,7 @@ public class InstreamForeignObject extends FObj { public int computeXOffset (int ipd, int cwidth) { int xoffset = 0; - int ta = propertyList.get("text-align").getEnum(); + int ta = propertyList.get(PR_TEXT_ALIGN).getEnum(); switch (ta) { case TextAlign.CENTER: xoffset = (ipd - cwidth) / 2; @@ -93,7 +93,7 @@ public class InstreamForeignObject extends FObj { public int computeYOffset(int bpd, int cheight) { int yoffset = 0; - int da = propertyList.get("display-align").getEnum(); + int da = propertyList.get(PR_DISPLAY_ALIGN).getEnum(); switch (da) { case DisplayAlign.BEFORE: break; diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index d1691a3e5..538cea7b1 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -130,14 +130,14 @@ public class Leader extends FObjMixed { // this.propertyList.get("z-index"); // color properties - ColorType c = this.propertyList.get("color").getColorType(); + ColorType c = this.propertyList.get(PR_COLOR).getColorType(); float red = c.getRed(); float green = c.getGreen(); float blue = c.getBlue(); // fo:leader specific properties // determines the pattern of leader; allowed values: space, rule,dots, use-content - leaderPattern = this.propertyList.get("leader-pattern").getEnum(); + leaderPattern = this.propertyList.get(PR_LEADER_PATTERN).getEnum(); switch(leaderPattern) { case LeaderPattern.SPACE: // use Space @@ -146,8 +146,8 @@ public class Leader extends FObjMixed { // the following properties only apply // for leader-pattern = "rule" ruleThickness = - propertyList.get("rule-thickness").getLength().getValue(); - ruleStyle = propertyList.get("rule-style").getEnum(); + propertyList.get(PR_RULE_THICKNESS).getLength().getValue(); + ruleStyle = propertyList.get(PR_RULE_STYLE).getEnum(); break; case LeaderPattern.DOTS: break; @@ -159,7 +159,7 @@ public class Leader extends FObjMixed { // if leaderPatternWidth = 0 = default = use-font-metric patternWidth = - this.propertyList.get("leader-pattern-width").getLength().getValue(); + this.propertyList.get(PR_LEADER_PATTERN_WIDTH).getLength().getValue(); } diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java index 4088d38e1..73794c4a5 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/java/org/apache/fop/fo/flow/ListBlock.java @@ -118,21 +118,21 @@ public class ListBlock extends FObj { // this.propertyList.get("provisional-distance-between-starts"); // this.propertyList.get("provisional-label-separation"); - this.align = this.propertyList.get("text-align").getEnum(); - this.alignLast = this.propertyList.get("text-align-last").getEnum(); + this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum(); + this.alignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum(); this.lineHeight = - this.propertyList.get("line-height").getLength().getValue(); + this.propertyList.get(PR_LINE_HEIGHT).getLength().getValue(); this.startIndent = - this.propertyList.get("start-indent").getLength().getValue(); + this.propertyList.get(PR_START_INDENT).getLength().getValue(); this.endIndent = - this.propertyList.get("end-indent").getLength().getValue(); + this.propertyList.get(PR_END_INDENT).getLength().getValue(); this.spaceBefore = - this.propertyList.get("space-before.optimum").getLength().getValue(); + this.propertyList.get(PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue(); this.spaceAfter = - this.propertyList.get("space-after.optimum").getLength().getValue(); + this.propertyList.get(PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue(); this.spaceBetweenListRows = 0; // not used at present this.backgroundColor = - this.propertyList.get("background-color").getColorType(); + this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); } diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index efef19ec8..4928ccb53 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -117,14 +117,14 @@ public class ListItem extends FObj { // this.propertyList.get("keep-with-previous"); // this.propertyList.get("relative-align"); - this.align = this.propertyList.get("text-align").getEnum(); - this.alignLast = this.propertyList.get("text-align-last").getEnum(); + this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum(); + this.alignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum(); this.lineHeight = - this.propertyList.get("line-height").getLength().getValue(); + this.propertyList.get(PR_LINE_HEIGHT).getLength().getValue(); this.spaceBefore = - this.propertyList.get("space-before.optimum").getLength().getValue(); + this.propertyList.get(PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue(); this.spaceAfter = - this.propertyList.get("space-after.optimum").getLength().getValue(); + this.propertyList.get(PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue(); } diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index 00efde644..edc9b5ead 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -125,12 +125,12 @@ public class PageNumber extends FObj { // this.propertyList.get("text-transform"); // this.propertyList.get("word-spacing"); - ColorType c = this.propertyList.get("color").getColorType(); + ColorType c = this.propertyList.get(PR_COLOR).getColorType(); this.red = c.getRed(); this.green = c.getGreen(); this.blue = c.getBlue(); - this.wrapOption = this.propertyList.get("wrap-option").getEnum(); + this.wrapOption = this.propertyList.get(PR_WRAP_OPTION).getEnum(); } diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index 8fb8ba0de..1ef021d59 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -140,13 +140,13 @@ public class PageNumberCitation extends FObj { // this.propertyList.get("text-transform"); // this.propertyList.get("word-spacing"); - ColorType c = this.propertyList.get("color").getColorType(); + ColorType c = this.propertyList.get(PR_COLOR).getColorType(); this.red = c.getRed(); this.green = c.getGreen(); this.blue = c.getBlue(); - this.wrapOption = this.propertyList.get("wrap-option").getEnum(); - this.refId = this.propertyList.get("ref-id").getString(); + this.wrapOption = this.propertyList.get(PR_WRAP_OPTION).getEnum(); + this.refId = this.propertyList.get(PR_REF_ID).getString(); if (this.refId.equals("")) { //throw new FOPException("page-number-citation must contain \"ref-id\""); diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java index 768c0c889..41d0eb92c 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java @@ -85,11 +85,11 @@ public class RetrieveMarker extends FObjMixed { public void handleAttrs(Attributes attlist) throws FOPException { super.handleAttrs(attlist); this.retrieveClassName = - this.propertyList.get("retrieve-class-name").getString(); + this.propertyList.get(PR_RETRIEVE_CLASS_NAME).getString(); this.retrievePosition = - this.propertyList.get("retrieve-position").getEnum(); + this.propertyList.get(PR_RETRIEVE_POSITION).getEnum(); this.retrieveBoundary = - this.propertyList.get("retrieve-boundary").getEnum(); + this.propertyList.get(PR_RETRIEVE_BOUNDARY).getEnum(); } public String getRetrieveClassName() { diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index 1a9a9530c..c9da18dac 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -169,25 +169,25 @@ public class Table extends FObj { // this.propertyList.get("width"); // this.propertyList.get("writing-mode"); - this.breakBefore = this.propertyList.get("break-before").getEnum(); - this.breakAfter = this.propertyList.get("break-after").getEnum(); + this.breakBefore = this.propertyList.get(PR_BREAK_BEFORE).getEnum(); + this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum(); this.spaceBefore = this.propertyList.get( - "space-before.optimum").getLength().getValue(); + PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue(); this.spaceAfter = this.propertyList.get( - "space-after.optimum").getLength().getValue(); + PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue(); this.backgroundColor = - this.propertyList.get("background-color").getColorType(); + this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); this.ipd = this.propertyList.get( - "inline-progression-dimension").getLengthRange(); - this.height = this.propertyList.get("height").getLength().getValue(); + PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); + this.height = this.propertyList.get(PR_HEIGHT).getLength().getValue(); this.bAutoLayout = (this.propertyList.get( - "table-layout").getEnum() == TableLayout.AUTO); + PR_TABLE_LAYOUT).getEnum() == TableLayout.AUTO); this.omitHeaderAtBreak = this.propertyList.get( - "table-omit-header-at-break").getEnum() + PR_TABLE_OMIT_HEADER_AT_BREAK).getEnum() == TableOmitHeaderAtBreak.TRUE; this.omitFooterAtBreak = this.propertyList.get( - "table-omit-footer-at-break").getEnum() + PR_TABLE_OMIT_FOOTER_AT_BREAK).getEnum() == TableOmitFooterAtBreak.TRUE; } diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index 6ced2d9e0..d997ec0c1 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -101,11 +101,11 @@ public class TableBody extends FObj { setupID(); this.spaceBefore = this.propertyList.get( - "space-before.optimum").getLength().getValue(); + PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue(); this.spaceAfter = this.propertyList.get( - "space-after.optimum").getLength().getValue(); + PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue(); this.backgroundColor = - this.propertyList.get("background-color").getColorType(); + this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); } diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index 4c7ffc765..461f755c2 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -233,41 +233,41 @@ public class TableCell extends FObj { // this.propertyList.get("width"); this.iColNumber = - propertyList.get("column-number").getNumber().intValue(); + propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue(); if (iColNumber < 0) { iColNumber = 0; } this.numColumnsSpanned = - this.propertyList.get("number-columns-spanned").getNumber().intValue(); + this.propertyList.get(PR_NUMBER_COLUMNS_SPANNED).getNumber().intValue(); if (numColumnsSpanned < 1) { numColumnsSpanned = 1; } this.numRowsSpanned = - this.propertyList.get("number-rows-spanned").getNumber().intValue(); + this.propertyList.get(PR_NUMBER_ROWS_SPANNED).getNumber().intValue(); if (numRowsSpanned < 1) { numRowsSpanned = 1; } this.backgroundColor = - this.propertyList.get("background-color").getColorType(); + this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - bSepBorders = (this.propertyList.get("border-collapse").getEnum() + bSepBorders = (this.propertyList.get(PR_BORDER_COLLAPSE).getEnum() == BorderCollapse.SEPARATE); calcBorders(propMgr.getBorderAndPadding()); // Vertical cell alignment - verticalAlign = this.propertyList.get("display-align").getEnum(); + verticalAlign = this.propertyList.get(PR_DISPLAY_ALIGN).getEnum(); if (verticalAlign == DisplayAlign.AUTO) { // Depends on all cells starting in row bRelativeAlign = true; - verticalAlign = this.propertyList.get("relative-align").getEnum(); + verticalAlign = this.propertyList.get(PR_RELATIVE_ALIGN).getEnum(); } else { bRelativeAlign = false; // Align on a per-cell basis } this.minCellHeight = - this.propertyList.get("height").getLength().getValue(); + this.propertyList.get(PR_HEIGHT).getLength().getValue(); } /** @@ -285,7 +285,7 @@ public class TableCell extends FObj { * but it inherits. */ int iSep = propertyList.get( - "border-separation.inline-progression-direction").getLength().getValue(); + PR_BORDER_SEPARATION | CP_INLINE_PROGRESSION_DIRECTION).getLength().getValue(); this.startAdjust = iSep / 2 + bp.getBorderStartWidth(false) + bp.getPaddingStart(false); @@ -295,7 +295,7 @@ public class TableCell extends FObj { // Offset of content rectangle in the block-progression direction borderSeparation = propertyList.get( - "border-separation.block-progression-direction").getLength().getValue(); + PR_BORDER_SEPARATION | CP_BLOCK_PROGRESSION_DIRECTION).getLength().getValue(); this.beforeOffset = borderSeparation / 2 + bp.getBorderBeforeWidth(false) + bp.getPaddingBefore(false); diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java index 4670a12b4..4d6eb7a78 100644 --- a/src/java/org/apache/fop/fo/flow/TableColumn.java +++ b/src/java/org/apache/fop/fo/flow/TableColumn.java @@ -138,17 +138,17 @@ public class TableColumn extends FObj { // this.propertyList.get("number-columns-spanned"); // this.propertyList.get("visibility"); - iColumnNumber = propertyList.get("column-number").getNumber().intValue(); + iColumnNumber = propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue(); numColumnsRepeated = - propertyList.get("number-columns-repeated").getNumber().intValue(); + propertyList.get(PR_NUMBER_COLUMNS_REPEATED).getNumber().intValue(); this.backgroundColor = - this.propertyList.get("background-color").getColorType(); + this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - Property prop = this.propertyList.get("column-width"); + Property prop = this.propertyList.get(PR_COLUMN_WIDTH); if (prop != null) { - columnWidthPropVal = propertyList.get("column-width").getLength(); + columnWidthPropVal = propertyList.get(PR_COLUMN_WIDTH).getLength(); // This won't include resolved table-units or % values yet. columnWidth = columnWidthPropVal.getValue(); diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/java/org/apache/fop/fo/pagination/ColorProfile.java index 6f6476933..a34fbfac5 100644 --- a/src/java/org/apache/fop/fo/pagination/ColorProfile.java +++ b/src/java/org/apache/fop/fo/pagination/ColorProfile.java @@ -86,9 +86,9 @@ public class ColorProfile extends FObj { * object. */ public void end() { - src = this.propertyList.get("src").getString(); - profileName = this.propertyList.get("color-profile-name").getString(); - intent = this.propertyList.get("rendering-intent").getEnum(); + src = this.propertyList.get(PR_SRC).getString(); + profileName = this.propertyList.get(PR_COLOR_PROFILE_NAME).getString(); + intent = this.propertyList.get(PR_RENDERING_INTENT).getEnum(); this.propertyList = null; } diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java index db52a0f84..210193d7e 100644 --- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java @@ -98,9 +98,9 @@ public class ConditionalPageMasterReference extends FObj { validateParent(parent); - this.pagePosition = this.propertyList.get("page-position").getEnum(); - this.oddOrEven = this.propertyList.get("odd-or-even").getEnum(); - this.blankOrNotBlank = this.propertyList.get("blank-or-not-blank").getEnum(); + this.pagePosition = this.propertyList.get(PR_PAGE_POSITION).getEnum(); + this.oddOrEven = this.propertyList.get(PR_ODD_OR_EVEN).getEnum(); + this.blankOrNotBlank = this.propertyList.get(PR_BLANK_OR_NOT_BLANK).getEnum(); } /** @@ -136,7 +136,7 @@ public class ConditionalPageMasterReference extends FObj { if (pagePosition == PagePosition.REST) { return false; } else if (pagePosition == PagePosition.LAST) { - // how the hell do you know at this point? + // ?? how can one know at this point? getLogger().debug("LAST PagePosition NYI"); return false; } @@ -144,7 +144,7 @@ public class ConditionalPageMasterReference extends FObj { if (pagePosition == PagePosition.FIRST) { return false; } else if (pagePosition == PagePosition.LAST) { - // how the hell do you know at this point? + // ?? how can one know at this point? getLogger().debug("LAST PagePosition NYI"); // potentially valid, don't return } diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 0192382da..6b13cd92d 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -189,7 +189,7 @@ public class PageSequence extends FObj { // we are now on the first page of the page sequence thisIsFirstPage = true; - ipnValue = this.propertyList.get("initial-page-number").getString(); + ipnValue = this.propertyList.get(PR_INITIAL_PAGE_NUMBER).getString(); if (ipnValue.equals("auto")) { pageNumberType = AUTO; @@ -209,7 +209,7 @@ public class PageSequence extends FObj { } - String masterName = this.propertyList.get("master-reference").getString(); + String masterName = this.propertyList.get(PR_MASTER_REFERENCE).getString(); this.simplePageMaster = this.layoutMasterSet.getSimplePageMaster(masterName); if (this.simplePageMaster == null) { @@ -224,14 +224,14 @@ public class PageSequence extends FObj { // get the 'format' properties this.pageNumberGenerator = - new PageNumberGenerator(this.propertyList.get("format").getString(), - this.propertyList.get("grouping-separator").getCharacter(), - this.propertyList.get("grouping-size").getNumber().intValue(), - this.propertyList.get("letter-value").getEnum()); + new PageNumberGenerator(this.propertyList.get(PR_FORMAT).getString(), + this.propertyList.get(PR_GROUPING_SEPARATOR).getCharacter(), + this.propertyList.get(PR_GROUPING_SIZE).getNumber().intValue(), + this.propertyList.get(PR_LETTER_VALUE).getEnum()); this.pageNumberGenerator.enableLogging(getLogger()); this.forcePageCount = - this.propertyList.get("force-page-count").getEnum(); + this.propertyList.get(PR_FORCE_PAGE_COUNT).getEnum(); // this.propertyList.get("country"); // this.propertyList.get("language"); diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index d477b220e..6b97bb5b1 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -133,11 +133,11 @@ public abstract class Region extends FObj { + "of simple-page-master, not " + parent.getName()); } - this.wm = this.propertyList.get("writing-mode").getEnum(); + this.wm = this.propertyList.get(PR_WRITING_MODE).getEnum(); // this.propertyList.get("clip"); // this.propertyList.get("display-align"); - this.overflow = this.propertyList.get("overflow").getEnum(); + this.overflow = this.propertyList.get(PR_OVERFLOW).getEnum(); } public abstract Rectangle getViewportRectangle(FODimension pageRefRect); diff --git a/src/java/org/apache/fop/fo/pagination/RegionBA.java b/src/java/org/apache/fop/fo/pagination/RegionBA.java index fd795cd9f..e9d985770 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBA.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBA.java @@ -86,7 +86,7 @@ public abstract class RegionBA extends RegionBASE { public void end() { super.end(); bPrecedence = - (this.propertyList.get("precedence").getEnum() == Precedence.TRUE); + (this.propertyList.get(PR_PRECEDENCE).getEnum() == Precedence.TRUE); } /** diff --git a/src/java/org/apache/fop/fo/pagination/RegionBASE.java b/src/java/org/apache/fop/fo/pagination/RegionBASE.java index 425df2b39..6b1752ded 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBASE.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBASE.java @@ -74,7 +74,7 @@ public abstract class RegionBASE extends Region { public void end() { // The problem with this is that it might not be known yet.... // Supposing extent is calculated in terms of percentage - this.extent = this.propertyList.get("extent").getLength().getValue(); + this.extent = this.propertyList.get(PR_EXTENT).getLength().getValue(); } /** diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java index ae16402a4..02fb87a94 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -92,7 +92,7 @@ public class SimplePageMaster extends FObj { if (parent.getName().equals("fo:layout-master-set")) { LayoutMasterSet layoutMasterSet = (LayoutMasterSet)parent; - masterName = this.propertyList.get("master-name").getString(); + masterName = this.propertyList.get(PR_MASTER_NAME).getString(); if (masterName == null) { getLogger().warn("simple-page-master does not have " + "a master-name and so is being ignored"); diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java index 2b7bab983..3fbe8c67b 100644 --- a/src/java/org/apache/fop/fo/pagination/Title.java +++ b/src/java/org/apache/fop/fo/pagination/Title.java @@ -97,18 +97,18 @@ public class Title extends FObjMixed { CommonMarginInline mProps = propMgr.getMarginInlineProps(); Property prop; - prop = this.propertyList.get("baseline-shift"); + prop = this.propertyList.get(PR_BASELINE_SHIFT); if (prop instanceof LengthProperty) { Length bShift = prop.getLength(); } else if (prop instanceof EnumProperty) { int bShift = prop.getEnum(); } - ColorType col = this.propertyList.get("color").getColorType(); - Length lHeight = this.propertyList.get("line-height").getLength(); + ColorType col = this.propertyList.get(PR_COLOR).getColorType(); + Length lHeight = this.propertyList.get(PR_LINE_HEIGHT).getLength(); int lShiftAdj = this.propertyList.get( - "line-height-shift-adjustment").getEnum(); - int vis = this.propertyList.get("visibility").getEnum(); - Length zIndex = this.propertyList.get("z-index").getLength(); + PR_LINE_HEIGHT_SHIFT_ADJUSTMENT).getEnum(); + int vis = this.propertyList.get(PR_VISIBILITY).getEnum(); + Length zIndex = this.propertyList.get(PR_Z_INDEX).getLength(); } diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 4fb688fee..189d28c67 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -63,6 +63,7 @@ import org.apache.fop.fo.properties.Overflow; import org.apache.fop.fo.PropertyList; import org.apache.fop.area.CTM; import org.apache.fop.datatypes.FODimension; +import org.apache.fop.datatypes.Length; import org.apache.fop.traits.MinOptMax; /** @@ -81,6 +82,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { private boolean clip = false; private int overflow; private PropertyManager propManager; + private Length width; + private Length height; /** * Create a new block container layout manager. @@ -104,6 +107,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { absoluteCTM = CTM.getCTMandRelDims(pm.getAbsRefOrient(), pm.getWritingMode(), rect, relDims); } + height = pm.getPropertyList().get("height").getLength(); + width = pm.getPropertyList().get("width").getLength(); } protected int getRotatedIPD() { @@ -120,15 +125,21 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { return getAbsoluteBreakPoss(context); } - Rectangle2D rect = new Rectangle2D.Double(0, 0, context.getRefIPD(), - context.getStackLimit().opt); + int ipd = context.getRefIPD(); + int bpd = context.getStackLimit().opt; + if (!width.isAuto()) { + ipd = width.getValue(); + } + if (!height.isAuto()) { + bpd = height.getValue(); + } + Rectangle2D rect = new Rectangle2D.Double(0, 0, ipd, bpd); relDims = new FODimension(0, 0); absoluteCTM = CTM.getCTMandRelDims(propManager.getAbsRefOrient(), propManager.getWritingMode(), rect, relDims); double[] vals = absoluteCTM.toArray(); MinOptMax stackLimit; - int ipd = context.getRefIPD(); boolean rotated = vals[0] == 0.0; if (rotated) { // rotated 90 degrees @@ -160,6 +171,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { stackSize)); childLC.setRefIPD(ipd); + boolean over = false; while (!curLM.isFinished()) { if ((bp = curLM.getNextBreakPoss(childLC)) != null) { stackSize.add(bp.getStackingSize()); @@ -170,11 +182,17 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { } else { curLM.resetPosition(null); } + over = true; break; } lastPos = bp; childBreaks.add(bp); + if (bp.nextBreakOverflows()) { + over = true; + break; + } + childLC.setStackLimit(MinOptMax.subtract( stackLimit, stackSize)); } @@ -184,6 +202,9 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { breakPoss = new BreakPoss(new LeafPosition(this, childBreaks.size() - 1)); breakPoss.setStackingSize(stackSize); + if (over) { + breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true); + } return breakPoss; } } @@ -281,6 +302,11 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { public Area getParentArea(Area childArea) { if (curBlockArea == null) { viewportBlockArea = new BlockViewport(); + TraitSetter.addBorders(viewportBlockArea, + propManager.getBorderAndPadding()); + TraitSetter.addBackground(viewportBlockArea, + propManager.getBackgroundProps()); + if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) { viewportBlockArea.setXOffset(abProps.left); viewportBlockArea.setYOffset(abProps.top); @@ -304,11 +330,15 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { viewportBlockArea.setWidth(relDims.bpd); viewportBlockArea.setCTM(absoluteCTM); viewportBlockArea.setClip(clip); + } else { + viewportBlockArea.setWidth(relDims.ipd); + if (!height.isAuto()) { + viewportBlockArea.setHeight(relDims.bpd); + } } } curBlockArea = new Block(); - viewportBlockArea.addBlock(curBlockArea); if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) { viewportBlockArea.setPositioning(Block.ABSOLUTE); @@ -332,7 +362,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { */ public void addChild(Area childArea) { if (curBlockArea != null) { - curBlockArea.addBlock((Block) childArea); + curBlockArea.addBlock((Block) childArea, height.isAuto()); } } @@ -342,5 +372,13 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { } } + /* + * Force current area to be added to parent area. + */ + protected void flush() { + super.flush(); + viewportBlockArea.addBlock(curBlockArea); + } + } |