diff options
Diffstat (limited to 'src/java/org/apache/fop/fo')
21 files changed, 157 insertions, 128 deletions
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index b7c865d9b..9aefe68ab 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -210,6 +210,17 @@ public class FObj extends FONode implements Constants { } /** + * Convenience method to quickly obtain the Constants class enumeration + * value of a property for this FO. Meaningful only for properties + * having an enumeration representation + * @param propId - the Constants ID of the desired property to obtain + * @return the enumeration value of the property value + */ + public int getPropEnum(int propId) { + return propertyList.get(propId).getEnum(); + } + + /** * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ protected void addChildNode(FONode child) { @@ -362,7 +373,7 @@ public class FObj extends FONode implements Constants { protected void setWritingMode() { FObj p = findNearestAncestorGeneratingRAs(true, true); this.propertyList.setWritingMode( - p.getProperty(PR_WRITING_MODE).getEnum()); + p.getPropEnum(PR_WRITING_MODE)); } /** diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index f1fe8a345..1040d2538 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -103,28 +103,20 @@ public class Block extends FObjMixed { */ protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); - this.span = this.propertyList.get(PR_SPAN).getEnum(); - this.wsTreatment = - this.propertyList.get(PR_WHITE_SPACE_TREATMENT).getEnum(); - this.bWScollapse = - (this.propertyList.get(PR_WHITE_SPACE_COLLAPSE).getEnum() - == Constants.TRUE); - this.lfTreatment = - this.propertyList.get(PR_LINEFEED_TREATMENT).getEnum(); - - this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum(); - this.alignLast = - this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum(); - this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum(); + this.span = getPropEnum(PR_SPAN); + this.wsTreatment = getPropEnum(PR_WHITE_SPACE_TREATMENT); + this.bWScollapse = (getPropEnum(PR_WHITE_SPACE_COLLAPSE) == Constants.TRUE); + this.lfTreatment = getPropEnum(PR_LINEFEED_TREATMENT); + this.align = getPropEnum(PR_TEXT_ALIGN); + this.alignLast = getPropEnum(PR_TEXT_ALIGN_LAST); + this.breakAfter = getPropEnum(PR_BREAK_AFTER); 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.keepWithNext = getPropEnum(PR_KEEP_WITH_NEXT); this.blockWidows = this.propertyList.get(PR_WIDOWS).getNumber().intValue(); this.blockOrphans = diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java index 2d277fece..47965c1bd 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java @@ -60,7 +60,7 @@ public class BlockContainer extends FObj { */ protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); - this.span = this.propertyList.get(PR_SPAN).getEnum(); + this.span = getPropEnum(PR_SPAN); this.backgroundColor = this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); @@ -87,7 +87,7 @@ public class BlockContainer extends FObj { */ public void addLayoutManager(List list) { BlockContainerLayoutManager blm = new BlockContainerLayoutManager(this); - blm.setOverflow(getProperty(PR_OVERFLOW).getEnum()); + blm.setOverflow(getPropEnum(PR_OVERFLOW)); list.add(blm); } diff --git a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java index 0da8d71ff..ba87618e1 100644 --- a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -77,7 +77,7 @@ public class InstreamForeignObject extends FObj { public int computeXOffset (int ipd, int cwidth) { int xoffset = 0; - int ta = propertyList.get(PR_TEXT_ALIGN).getEnum(); + int ta = getPropEnum(PR_TEXT_ALIGN); switch (ta) { case TextAlign.CENTER: xoffset = (ipd - cwidth) / 2; @@ -96,7 +96,7 @@ public class InstreamForeignObject extends FObj { public int computeYOffset(int bpd, int cheight) { int yoffset = 0; - int da = propertyList.get(PR_DISPLAY_ALIGN).getEnum(); + int da = getPropEnum(PR_DISPLAY_ALIGN); 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 ca92fcb6f..6582c3672 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -67,7 +67,7 @@ public class Leader extends FObjMixed { // fo:leader specific properties // determines the pattern of leader; allowed values: space, rule,dots, use-content - leaderPattern = this.propertyList.get(PR_LEADER_PATTERN).getEnum(); + leaderPattern = getPropEnum(PR_LEADER_PATTERN); switch(leaderPattern) { case LeaderPattern.SPACE: // use Space @@ -76,7 +76,7 @@ public class Leader extends FObjMixed { // the following properties only apply // for leader-pattern = "rule" ruleThickness = getPropLength(PR_RULE_THICKNESS); - ruleStyle = propertyList.get(PR_RULE_STYLE).getEnum(); + ruleStyle = getPropEnum(PR_RULE_STYLE); break; case LeaderPattern.DOTS: break; diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index d4585cdb2..13d1d43c0 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -75,8 +75,7 @@ public class PageNumber extends FObj { this.green = c.getGreen(); this.blue = c.getBlue(); - this.wrapOption = this.propertyList.get(PR_WRAP_OPTION).getEnum(); - + this.wrapOption = getPropEnum(PR_WRAP_OPTION); getFOInputHandler().startPageNumber(this); } diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index 73257626d..c8e25eeda 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -79,7 +79,7 @@ public class PageNumberCitation extends FObj { this.green = c.getGreen(); this.blue = c.getBlue(); - this.wrapOption = this.propertyList.get(PR_WRAP_OPTION).getEnum(); + this.wrapOption = getPropEnum(PR_WRAP_OPTION); this.refId = getPropString(PR_REF_ID); if (this.refId.equals("")) { diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java index 30526a7ac..55d739cc5 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java @@ -58,10 +58,8 @@ public class RetrieveMarker extends FObjMixed { protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); this.retrieveClassName = getPropString(PR_RETRIEVE_CLASS_NAME); - this.retrievePosition = - this.propertyList.get(PR_RETRIEVE_POSITION).getEnum(); - this.retrieveBoundary = - this.propertyList.get(PR_RETRIEVE_BOUNDARY).getEnum(); + this.retrievePosition = getPropEnum(PR_RETRIEVE_POSITION); + this.retrieveBoundary = getPropEnum(PR_RETRIEVE_BOUNDARY); } /** diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index 4c532f67f..c5df32f8b 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -84,8 +84,8 @@ public class Table extends FObj { */ protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); - this.breakBefore = this.propertyList.get(PR_BREAK_BEFORE).getEnum(); - this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum(); + this.breakBefore = getPropEnum(PR_BREAK_BEFORE); + this.breakAfter = getPropEnum(PR_BREAK_AFTER); this.spaceBefore = getPropLength(PR_SPACE_BEFORE | CP_OPTIMUM); this.spaceAfter = getPropLength(PR_SPACE_AFTER | CP_OPTIMUM); this.backgroundColor = @@ -93,15 +93,12 @@ public class Table extends FObj { this.ipd = this.propertyList.get( PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); this.height = getPropLength(PR_HEIGHT); - this.bAutoLayout = (this.propertyList.get( - PR_TABLE_LAYOUT).getEnum() == TableLayout.AUTO); - - this.omitHeaderAtBreak = this.propertyList.get( - PR_TABLE_OMIT_HEADER_AT_BREAK).getEnum() - == TableOmitHeaderAtBreak.TRUE; - this.omitFooterAtBreak = this.propertyList.get( - PR_TABLE_OMIT_FOOTER_AT_BREAK).getEnum() - == TableOmitFooterAtBreak.TRUE; + this.bAutoLayout = (getPropEnum(PR_TABLE_LAYOUT) == TableLayout.AUTO); + + this.omitHeaderAtBreak = getPropEnum(PR_TABLE_OMIT_HEADER_AT_BREAK) + == TableOmitHeaderAtBreak.TRUE; + this.omitFooterAtBreak = getPropEnum(PR_TABLE_OMIT_FOOTER_AT_BREAK) + == TableOmitFooterAtBreak.TRUE; getFOInputHandler().startTable(this); } diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index 1f8d46a71..ed2caa557 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -187,17 +187,16 @@ public class TableCell extends FObj { this.backgroundColor = this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - bSepBorders = (this.propertyList.get(PR_BORDER_COLLAPSE).getEnum() - == BorderCollapse.SEPARATE); + bSepBorders = (getPropEnum(PR_BORDER_COLLAPSE) == BorderCollapse.SEPARATE); calcBorders(propMgr.getBorderAndPadding()); // Vertical cell alignment - verticalAlign = this.propertyList.get(PR_DISPLAY_ALIGN).getEnum(); + verticalAlign = getPropEnum(PR_DISPLAY_ALIGN); if (verticalAlign == DisplayAlign.AUTO) { // Depends on all cells starting in row bRelativeAlign = true; - verticalAlign = this.propertyList.get(PR_RELATIVE_ALIGN).getEnum(); + verticalAlign = getPropEnum(PR_RELATIVE_ALIGN); } else { bRelativeAlign = false; // Align on a per-cell basis } diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java index f4e3b448e..3e6f1700f 100644 --- a/src/java/org/apache/fop/fo/flow/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/TableRow.java @@ -80,7 +80,7 @@ public class TableRow extends FObj { } private void doSetup() { - this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum(); + this.breakAfter = getPropEnum(PR_BREAK_AFTER); this.backgroundColor = this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/java/org/apache/fop/fo/pagination/ColorProfile.java index eedfabc32..6a483bf49 100644 --- a/src/java/org/apache/fop/fo/pagination/ColorProfile.java +++ b/src/java/org/apache/fop/fo/pagination/ColorProfile.java @@ -66,9 +66,9 @@ public class ColorProfile extends FObj { * object. */ protected void endOfNode() throws SAXParseException { - src = this.propertyList.get(PR_SRC).getString(); - profileName = this.propertyList.get(PR_COLOR_PROFILE_NAME).getString(); - intent = this.propertyList.get(PR_RENDERING_INTENT).getEnum(); + src = getPropString(PR_SRC); + profileName = getPropString(PR_COLOR_PROFILE_NAME); + intent = getPropEnum(PR_RENDERING_INTENT); 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 322d3df25..18018eb58 100644 --- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java @@ -72,9 +72,9 @@ public class ConditionalPageMasterReference extends FObj { validateParent(parent); - 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(); + this.pagePosition = getPropEnum(PR_PAGE_POSITION); + this.oddOrEven = getPropEnum(PR_ODD_OR_EVEN); + this.blankOrNotBlank = getPropEnum(PR_BLANK_OR_NOT_BLANK); } /** diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 04738468a..57eff5ccd 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -276,13 +276,12 @@ public class PageSequence extends FObj { // get the 'format' properties this.pageNumberGenerator = - new PageNumberGenerator(this.propertyList.get(PR_FORMAT).getString(), + new PageNumberGenerator(getPropString(PR_FORMAT), this.propertyList.get(PR_GROUPING_SEPARATOR).getCharacter(), this.propertyList.get(PR_GROUPING_SIZE).getNumber().intValue(), - this.propertyList.get(PR_LETTER_VALUE).getEnum()); + getPropEnum(PR_LETTER_VALUE)); - this.forcePageCount = - this.propertyList.get(PR_FORCE_PAGE_COUNT).getEnum(); + this.forcePageCount = getPropEnum(PR_FORCE_PAGE_COUNT); // 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 974c71cf8..95a0ec5e2 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -43,13 +43,12 @@ public abstract class Region extends FObj { /** Holds the writing mode */ protected int wm; - protected int extent = 0; - /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ protected Region(FONode parent) { super(parent); + layoutMaster = (SimplePageMaster) parent; } /** @@ -61,31 +60,21 @@ public abstract class Region extends FObj { // regions may have name, or default if (null == this.propertyList.get(PR_REGION_NAME)) { setRegionName(getDefaultRegionName()); - } else if (this.propertyList.get(PR_REGION_NAME).getString().equals("")) { + } else if (getPropString(PR_REGION_NAME).equals("")) { setRegionName(getDefaultRegionName()); } else { - setRegionName(this.propertyList.get(PR_REGION_NAME).getString()); + setRegionName(getPropString(PR_REGION_NAME)); // check that name is OK. Not very pretty. if (isReserved(getRegionName()) && !getRegionName().equals(getDefaultRegionName())) { throw new SAXParseException("region-name '" + regionName + "' for " + this.getName() - + " not permitted.", locator); + + " is not permitted.", locator); } } - if (parent instanceof SimplePageMaster) { - layoutMaster = (SimplePageMaster)parent; - } else { - throw new SAXParseException(this.getName() + " must be child " - + "of simple-page-master, not " - + parent.getName(), locator); - } - this.wm = this.propertyList.get(PR_WRITING_MODE).getEnum(); - - // this.propertyList.get("clip"); - // this.propertyList.get("display-align"); - this.overflow = this.propertyList.get(PR_OVERFLOW).getEnum(); + this.wm = getPropEnum(PR_WRITING_MODE); + this.overflow = getPropEnum(PR_OVERFLOW); } /** @@ -123,14 +112,6 @@ public abstract class Region extends FObj { } /** - * Returns the page master associated with this region. - * @return a simple-page-master - */ - protected SimplePageMaster getPageMaster() { - return this.layoutMaster; - } - - /** * Checks to see if a given region name is one of the reserved names * * @param name a region name to check @@ -159,18 +140,6 @@ public abstract class Region extends FObj { */ protected Region getSiblingRegion(int regionId) { // Ask parent for region - return layoutMaster.getRegion(regionId); - } - - /** - * Indicates if this region gets precedence. - * @return True if it gets precedence - */ - public boolean getPrecedence() { - return false; - } - - public int getExtent() { - return extent; + return layoutMaster.getRegion(regionId); } } diff --git a/src/java/org/apache/fop/fo/pagination/RegionAfter.java b/src/java/org/apache/fop/fo/pagination/RegionAfter.java index 55dadce6e..199c2c0dc 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionAfter.java +++ b/src/java/org/apache/fop/fo/pagination/RegionAfter.java @@ -21,6 +21,10 @@ package org.apache.fop.fo.pagination; // Java import java.awt.Rectangle; +// XML +import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; import org.apache.fop.datatypes.FODimension; @@ -30,6 +34,9 @@ import org.apache.fop.datatypes.FODimension; */ public class RegionAfter extends RegionBA { + private int extent = 0; + private boolean precedence = false; + /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -38,17 +45,34 @@ public class RegionAfter extends RegionBA { } /** + * @see org.apache.fop.fo.FObj#addProperties + */ + protected void addProperties(Attributes attlist) throws SAXParseException { + super.addProperties(attlist); + extent = getPropLength(PR_EXTENT); + precedence = (getPropEnum(PR_PRECEDENCE) == Precedence.TRUE); + } + + /** + * Indicates if this region gets precedence. + * @return True if it gets precedence + */ + public boolean getPrecedence() { + return precedence; + } + + /** * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension) */ public Rectangle getViewportRectangle (FODimension reldims) { // Depends on extent, precedence ans writing mode Rectangle vpRect; if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) { - vpRect = new Rectangle(0, reldims.bpd - getExtent(), reldims.ipd, getExtent()); + vpRect = new Rectangle(0, reldims.bpd - extent, reldims.ipd, extent); } else { - vpRect = new Rectangle(0, reldims.bpd - getExtent(), getExtent(), reldims.ipd); + vpRect = new Rectangle(0, reldims.bpd - extent, extent, reldims.ipd); } - if (getPrecedence() == false) { + if (precedence == false) { adjustIPD(vpRect, this.wm); } return vpRect; diff --git a/src/java/org/apache/fop/fo/pagination/RegionBA.java b/src/java/org/apache/fop/fo/pagination/RegionBA.java index 0e670d59c..57273828f 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBA.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBA.java @@ -33,8 +33,6 @@ import org.apache.fop.fo.FONode; */ public abstract class RegionBA extends Region { - private boolean bPrecedence; - /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -42,20 +40,11 @@ public abstract class RegionBA extends Region { super(parent); } - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - bPrecedence = - (this.propertyList.get(PR_PRECEDENCE).getEnum() == Precedence.TRUE); - - this.extent = getPropLength(PR_EXTENT); - } - /** - * @see org.apache.fop.fo.pagination.Region#getPrecedence() + * @see org.apache.fop.fo.FObj#addProperties */ - public boolean getPrecedence() { - return bPrecedence; + protected void addProperties(Attributes attlist) throws SAXParseException { + super.addProperties(attlist); } /** @@ -71,12 +60,12 @@ public abstract class RegionBA extends Region { int offset = 0; Region start = getSiblingRegion(FO_REGION_START); if (start != null) { - offset = start.getExtent(); + offset = start.getPropLength(PR_EXTENT); vpRefRect.translate(offset, 0); } Region end = getSiblingRegion(FO_REGION_END); if (end != null) { - offset += end.getExtent(); + offset += end.getPropLength(PR_EXTENT); } if (offset > 0) { if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB) { diff --git a/src/java/org/apache/fop/fo/pagination/RegionBefore.java b/src/java/org/apache/fop/fo/pagination/RegionBefore.java index 222e0fbac..1315c2c04 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBefore.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBefore.java @@ -21,6 +21,10 @@ package org.apache.fop.fo.pagination; // Java import java.awt.Rectangle; +// XML +import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.datatypes.FODimension; import org.apache.fop.fo.FONode; @@ -30,6 +34,9 @@ import org.apache.fop.fo.FONode; */ public class RegionBefore extends RegionBA { + private int extent = 0; + private boolean precedence = false; + /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -38,6 +45,23 @@ public class RegionBefore extends RegionBA { } /** + * @see org.apache.fop.fo.FObj#addProperties + */ + protected void addProperties(Attributes attlist) throws SAXParseException { + super.addProperties(attlist); + extent = getPropLength(PR_EXTENT); + precedence = (getPropEnum(PR_PRECEDENCE) == Precedence.TRUE); + } + + /** + * Indicates if this region gets precedence. + * @return True if it gets precedence + */ + public boolean getPrecedence() { + return precedence; + } + + /** * @see org.apache.fop.fo.pagination.Region#getDefaultRegionName() */ protected String getDefaultRegionName() { @@ -56,11 +80,11 @@ public class RegionBefore extends RegionBA { // ipd depends on precedence, bpd=extent Rectangle vpRect; if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) { - vpRect = new Rectangle(0, 0, reldims.ipd, getExtent()); + vpRect = new Rectangle(0, 0, reldims.ipd, extent); } else { - vpRect = new Rectangle(0, 0, getExtent(), reldims.ipd); + vpRect = new Rectangle(0, 0, extent, reldims.ipd); } - if (getPrecedence() == false) { + if (precedence == false) { adjustIPD(vpRect, this.wm); } return vpRect; diff --git a/src/java/org/apache/fop/fo/pagination/RegionEnd.java b/src/java/org/apache/fop/fo/pagination/RegionEnd.java index 25eb93843..3636dfc7a 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionEnd.java +++ b/src/java/org/apache/fop/fo/pagination/RegionEnd.java @@ -21,6 +21,10 @@ package org.apache.fop.fo.pagination; // Java import java.awt.Rectangle; +// XML +import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; import org.apache.fop.datatypes.FODimension; @@ -30,6 +34,7 @@ import org.apache.fop.datatypes.FODimension; */ public class RegionEnd extends RegionSE { + private int extent = 0; /** * @see org.apache.fop.fo.FONode#FONode(FONode) @@ -39,17 +44,25 @@ public class RegionEnd extends RegionSE { } /** + * @see org.apache.fop.fo.FObj#addProperties + */ + protected void addProperties(Attributes attlist) throws SAXParseException { + super.addProperties(attlist); + extent = getPropLength(PR_EXTENT); + } + + /** * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension) */ public Rectangle getViewportRectangle (FODimension reldims) { // Depends on extent, precedence and writing mode Rectangle vpRect; if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) { - vpRect = new Rectangle(reldims.ipd - getExtent(), 0, - getExtent(), reldims.bpd); + vpRect = new Rectangle(reldims.ipd - extent, 0, + extent, reldims.bpd); } else { - vpRect = new Rectangle(reldims.ipd - getExtent(), 0, - reldims.bpd, getExtent()); + vpRect = new Rectangle(reldims.ipd - extent, 0, + reldims.bpd, extent); } adjustIPD(vpRect, this.wm); return vpRect; diff --git a/src/java/org/apache/fop/fo/pagination/RegionSE.java b/src/java/org/apache/fop/fo/pagination/RegionSE.java index 98b8b71f1..21fa704ac 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionSE.java +++ b/src/java/org/apache/fop/fo/pagination/RegionSE.java @@ -40,10 +40,11 @@ public abstract class RegionSE extends Region { super(parent); } + /** + * @see org.apache.fop.fo.FObj#addProperties + */ protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); - - this.extent = getPropLength(PR_EXTENT); } /** @@ -58,14 +59,14 @@ public abstract class RegionSE extends Region { */ protected void adjustIPD(Rectangle vpRefRect, int wm) { int offset = 0; - Region before = getSiblingRegion(FO_REGION_BEFORE); + RegionBefore before = (RegionBefore) getSiblingRegion(FO_REGION_BEFORE); if (before != null && before.getPrecedence()) { - offset = before.getExtent(); + offset = before.getPropLength(PR_EXTENT); vpRefRect.translate(0, offset); } - Region after = getSiblingRegion(FO_REGION_AFTER); + RegionAfter after = (RegionAfter) getSiblingRegion(FO_REGION_AFTER); if (after != null && after.getPrecedence()) { - offset += after.getExtent(); + offset += after.getPropLength(PR_EXTENT); } if (offset > 0) { if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB) { diff --git a/src/java/org/apache/fop/fo/pagination/RegionStart.java b/src/java/org/apache/fop/fo/pagination/RegionStart.java index 66523e657..f00414934 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionStart.java +++ b/src/java/org/apache/fop/fo/pagination/RegionStart.java @@ -21,6 +21,10 @@ package org.apache.fop.fo.pagination; // Java import java.awt.Rectangle; +// XML +import org.xml.sax.Attributes; +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; import org.apache.fop.datatypes.FODimension; @@ -30,6 +34,8 @@ import org.apache.fop.datatypes.FODimension; */ public class RegionStart extends RegionSE { + private int extent = 0; + /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -38,6 +44,14 @@ public class RegionStart extends RegionSE { } /** + * @see org.apache.fop.fo.FObj#addProperties + */ + protected void addProperties(Attributes attlist) throws SAXParseException { + super.addProperties(attlist); + extent = getPropLength(PR_EXTENT); + } + + /** * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension) */ public Rectangle getViewportRectangle (FODimension reldims) { @@ -46,9 +60,9 @@ public class RegionStart extends RegionSE { // writing-mode relative coordinates Rectangle vpRect; if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) { - vpRect = new Rectangle(0, 0, getExtent(), reldims.bpd); + vpRect = new Rectangle(0, 0, extent, reldims.bpd); } else { - vpRect = new Rectangle(0, 0, reldims.bpd, getExtent()); + vpRect = new Rectangle(0, 0, reldims.bpd, extent); } adjustIPD(vpRect, this.wm); return vpRect; |