diff options
author | Finn Bock <bckfnn@apache.org> | 2004-10-19 13:45:38 +0000 |
---|---|---|
committer | Finn Bock <bckfnn@apache.org> | 2004-10-19 13:45:38 +0000 |
commit | c34e500124d950dac4d5deb7fe435b6e4c2c4613 (patch) | |
tree | af79d410e72159248722c056ecc695fb3abf4caa | |
parent | 732269867ee965ab81e1f56c86b9cc0c6586e31c (diff) | |
download | xmlgraphics-fop-c34e500124d950dac4d5deb7fe435b6e4c2c4613.tar.gz xmlgraphics-fop-c34e500124d950dac4d5deb7fe435b6e4c2c4613.zip |
Second phase of performance improvement.
- Removed addProperties() method and misc old property fields.
PR: 31699
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198065 13f79535-47bb-0310-9956-ffa450edef68
40 files changed, 53 insertions, 1034 deletions
diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java index 3b9424b99..ccb94584a 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/java/org/apache/fop/fo/flow/BasicLink.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -51,12 +50,6 @@ public class BasicLink extends Inline { // private ToBeImplementedProperty targetStylesheet; // End of property values - // link represented by this FO - private String link = null; - - // indicator of whether link is internal or external - private boolean isExternalLink = false; - // used only for FO validation private boolean blockOrInlineItemFound = false; @@ -109,31 +102,6 @@ public class BasicLink extends Inline { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - // This logic is for determining the link represented by this FO. - String ext = propertyList.get(PR_EXTERNAL_DESTINATION).getString(); - String internal = propertyList.get(PR_INTERNAL_DESTINATION).getString(); - - // per spec, internal takes precedence if both specified - if (internal.length() > 0) { - link = internal; - } else if (ext.length() > 0) { - link = ext; - isExternalLink = true; - } else { - // slightly stronger than spec "should be specified" - attributeError("Missing attribute: Either external-destination or " + - "internal-destination must be specified."); - } - - getFOEventHandler().startLink(this); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: marker* (#PCDATA|%inline;|%block;)* */ @@ -159,20 +127,6 @@ public class BasicLink extends Inline { } /** - * @return link represented by this fo:basic-link - */ - public String getLink() { - return link; - } - - /** - * @return true if link is external, false if internal - */ - public boolean isExternalLink() { - return isExternalLink; - } - - /** * Return the "internal-destination" property. */ public String getInternalDestination() { diff --git a/src/java/org/apache/fop/fo/flow/BidiOverride.java b/src/java/org/apache/fop/fo/flow/BidiOverride.java index 6d15a8ebc..3f5740a35 100644 --- a/src/java/org/apache/fop/fo/flow/BidiOverride.java +++ b/src/java/org/apache/fop/fo/flow/BidiOverride.java @@ -23,7 +23,6 @@ import java.util.ArrayList; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -108,15 +107,6 @@ public class BidiOverride extends FObjMixed { } /** - * @see org.apache.fop.fo.FObj#addProperties - * @todo see if can use a BitSet to determine if an FO should - * have its ID setup; then move setupID() instances to FObj. - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: marker* (#PCDATA|%inline;|%block;)* * Additionally: "An fo:bidi-override that is a descendant of an fo:leader diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index 9ae7963ea..b7c54bb79 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -110,23 +109,6 @@ public class Block extends FObjMixed { private int wrapOption; // End of property values - private int align; - private int alignLast; - private int _lineHeight; - private int startIndent; - private int endIndent; - private int spaceBefore; - private int spaceAfter; - private int _textIndent; - private int _keepWithNext; - private ColorType backgroundColor; - private int blockWidows; - private int blockOrphans; - - private int wsTreatment; //ENUMERATION - private int lfTreatment; //ENUMERATION - private boolean bWScollapse; //true if white-space-collapse=true - // this may be helpful on other FOs too private boolean anythingLaidOut = false; @@ -293,33 +275,6 @@ public class Block extends FObjMixed { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - 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 = getPropEnum(PR_KEEP_WITH_NEXT); - this.blockWidows = - this.propertyList.get(PR_WIDOWS).getNumber().intValue(); - this.blockOrphans = - this.propertyList.get(PR_ORPHANS).getNumber().intValue(); - - getFOEventHandler().startBlock(this); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: marker* initial-property-set? (#PCDATA|%inline;|%block;)* * Additionally: "An fo:bidi-override that is a descendant of an fo:leader @@ -391,7 +346,7 @@ public class Block extends FObjMixed { /* Some kind of whitespace character, except linefeed. */ boolean bIgnore = false; - switch (wsTreatment) { + switch (whiteSpaceTreatment) { case Constants.IGNORE: bIgnore = true; break; @@ -412,8 +367,8 @@ public class Block extends FObjMixed { // Handle ignore and replacement if (bIgnore) { charIter.remove(); - } else if (bWScollapse) { - if (bInWS || (lfTreatment == Constants.PRESERVE + } else if (whiteSpaceCollapse == TRUE) { + if (bInWS || (linefeedTreatment == Constants.PRESERVE && (bPrevWasLF || lfCheck.nextIsLF()))) { charIter.remove(); } else { @@ -442,7 +397,7 @@ public class Block extends FObjMixed { lfCheck.reset(); bPrevWasLF = true; // for following whitespace - switch (lfTreatment) { + switch (linefeedTreatment) { case Constants.IGNORE: charIter.remove(); break; @@ -451,7 +406,7 @@ public class Block extends FObjMixed { // only if bWScollapse=true charIter.remove(); } else { - if (bWScollapse) { + if (whiteSpaceCollapse == TRUE) { bInWS = true; // remove the linefeed if no word in block // encountered yet diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java index df1a8e884..643d7577b 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // FOP -import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.Numeric; import org.apache.fop.fo.FONode; @@ -35,7 +34,6 @@ import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fo.properties.LengthRangeProperty; import org.apache.fop.layoutmgr.BlockContainerLayoutManager; -import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; /** @@ -67,17 +65,6 @@ public class BlockContainer extends FObj { // private ToBeImplementedProperty zIndex; // End of property values - private ColorType backgroundColor; - private int position; - - private int top; - private int bottom; - private int left; - private int right; - private int _width; - private int _height; - - /** * @param parent FONode that is the parent of this object */ @@ -121,20 +108,6 @@ public class BlockContainer extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - this.span = getPropEnum(PR_SPAN); - this.backgroundColor = - this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - - this._width = getPropLength(PR_WIDTH); - this._height = getPropLength(PR_HEIGHT); - getFOEventHandler().startBlockContainer(this); - } - - /** * @see org.apache.fop.fo.FONode#endOfNode */ protected void endOfNode() throws SAXParseException { diff --git a/src/java/org/apache/fop/fo/flow/Character.java b/src/java/org/apache/fop/fo/flow/Character.java index 2a84a6dcf..464ae434a 100644 --- a/src/java/org/apache/fop/fo/flow/Character.java +++ b/src/java/org/apache/fop/fo/flow/Character.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -95,8 +94,6 @@ public class Character extends FObj { /** constant indicating that the character does not fit */ public static final int DOESNOT_FIT = 1; - private char characterValue; - /** * @param parent FONode that is the parent of this object */ @@ -157,21 +154,11 @@ public class Character extends FObj { invalidChildError(loc, nsURI, localName); } - - /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - characterValue = propertyList.get(PR_CHARACTER).getCharacter(); - getFOEventHandler().character(this); - } - /** * @see org.apache.fop.fo.FObj#charIterator */ public CharIterator charIterator() { - return new OneCharIterator(characterValue); + return new OneCharIterator(character); // But what if the character is ignored due to white space handling? } diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index 290183b51..344886140 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -138,15 +137,6 @@ public class ExternalGraphic extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - * @todo switch method from image() to startImage()? - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - getFOEventHandler().image(this); - } - - /** * Return the Common Border, Padding, and Background Properties. */ public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index 1b5506e2d..7c7bc1a91 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -58,14 +57,6 @@ public class Footnote extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - getFOEventHandler().startFootnote(this); - } - - /** * @see org.apache.fop.fo.FONode#startOfNode */ protected void startOfNode() throws SAXParseException { diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/java/org/apache/fop/fo/flow/FootnoteBody.java index d582d9e1b..671e44d00 100644 --- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/java/org/apache/fop/fo/flow/FootnoteBody.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.flow; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -71,14 +70,6 @@ public class FootnoteBody extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - getFOEventHandler().startFootnoteBody(this); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: (%block;)+ */ diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java index a1ae50300..ce88a2f8b 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/java/org/apache/fop/fo/flow/Inline.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.flow; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -144,33 +143,6 @@ public class Inline extends FObjMixed { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - /* Check to see if this node can have block-level children. - * See validateChildNode() below. - */ - int lvlLeader = findAncestor(FO_LEADER); - int lvlFootnote = findAncestor(FO_FOOTNOTE); - int lvlInCntr = findAncestor(FO_INLINE_CONTAINER); - - if (lvlLeader > 0) { - if (lvlInCntr < 0 || - (lvlInCntr > 0 && lvlInCntr > lvlLeader)) { - canHaveBlockLevelChildren = false; - } - } else if (lvlFootnote > 0) { - if (lvlInCntr < 0 || lvlInCntr > lvlFootnote) { - canHaveBlockLevelChildren = false; - } - } - - getFOEventHandler().startInline(this); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: marker* (#PCDATA|%inline;|%block;)* * Additionally: " An fo:inline that is a descendant of an fo:leader diff --git a/src/java/org/apache/fop/fo/flow/InlineContainer.java b/src/java/org/apache/fop/fo/flow/InlineContainer.java index 5f7d22e5d..7fae66003 100644 --- a/src/java/org/apache/fop/fo/flow/InlineContainer.java +++ b/src/java/org/apache/fop/fo/flow/InlineContainer.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.ArrayList; // XML -import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP @@ -111,13 +110,6 @@ public class InlineContainer extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - } - - /** * Return the "id" property. */ public String getId() { diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index d5752907a..87cd555ec 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -80,11 +80,6 @@ public class Leader extends FObjMixed { private SpaceProperty wordSpacing; // End of property values - private int _ruleThickness; - private int patternWidth; - /** FontState for this object */ - protected Font fontState; - /** * @param parent FONode that is the parent of this object */ @@ -146,51 +141,12 @@ public class Leader extends FObjMixed { protected void startOfNode() throws SAXParseException { checkId(id); } - - /** - * @todo convert to addProperties() - */ - private void setup() { - // Common Font Properties - this.fontState = propMgr.getFontState(getFOEventHandler().getFontInfo()); - - // color properties - 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 = getPropEnum(PR_LEADER_PATTERN); - switch(leaderPattern) { - case LeaderPattern.SPACE: - // use Space - break; - case LeaderPattern.RULE: - // the following properties only apply - // for leader-pattern = "rule" - _ruleThickness = getPropLength(PR_RULE_THICKNESS); - ruleStyle = getPropEnum(PR_RULE_STYLE); - break; - case LeaderPattern.DOTS: - break; - case LeaderPattern.USECONTENT: - // use inline layout manager to create inline areas - // add the inline parent multiple times until leader full - break; - } - - // if leaderPatternWidth = 0 = default = use-font-metric - patternWidth = getPropLength(PR_LEADER_PATTERN_WIDTH); - } /** * @todo check need for each of these accessors (should be LM instead?) */ - public int getLength(int propId, int dim) { + public int getLength(Length maxlength, int dim) { int length; - Length maxlength = propertyList.get(propId).getLength(); if (maxlength instanceof PercentLength) { length = (int)(((PercentLength)maxlength).value() * dim); } else { @@ -200,15 +156,15 @@ public class Leader extends FObjMixed { } public int getRuleThickness() { - return _ruleThickness; + return ruleThickness.getValue(); } public Font getFontState() { - return fontState; + return propMgr.getFontState(getFOEventHandler().getFontInfo()); } public int getPatternWidth() { - return patternWidth; + return leaderPatternWidth.getValue(); } /** @@ -272,7 +228,6 @@ public class Leader extends FObjMixed { * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ public void addLayoutManager(List list) { - setup(); LeaderLayoutManager lm = new LeaderLayoutManager(this); list.add(lm); } diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java index 6c99580aa..75c86be63 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/java/org/apache/fop/fo/flow/ListBlock.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -111,14 +110,6 @@ public class ListBlock extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - getFOEventHandler().startList(this); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: marker* (list-item)+ */ diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index 6b04f22e1..6297a619f 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -108,14 +107,6 @@ public class ListItem extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - getFOEventHandler().startListItem(this); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: marker* (list-item-label,list-item-body) */ diff --git a/src/java/org/apache/fop/fo/flow/ListItemBody.java b/src/java/org/apache/fop/fo/flow/ListItemBody.java index 2b936f68a..1f79c7584 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/java/org/apache/fop/fo/flow/ListItemBody.java @@ -71,18 +71,6 @@ public class ListItemBody extends FObj { } /** - * @todo convert to addProperties() - */ - private void setup() { - /* - * For calculating the lineage - The fo:list-item-body formatting object - * does not generate any areas. The fo:list-item-body formatting object - * returns the sequence of areas created by concatenating the sequences - * of areas returned by each of the child nodes of the fo:list-item-body. - */ - } - - /** * Return the "id" property. */ public String getId() { diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/java/org/apache/fop/fo/flow/ListItemLabel.java index f7e3ec063..3f02ca7f2 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/java/org/apache/fop/fo/flow/ListItemLabel.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.flow; // XML -import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP @@ -72,20 +71,6 @@ public class ListItemLabel extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - getFOEventHandler().startListLabel(); - /* - * For calculating the lineage - The fo:list-item-label formatting object - * does not generate any areas. The fo:list-item-label formatting object - * returns the sequence of areas created by concatenating the sequences - * of areas returned by each of the child nodes of the fo:list-item-label. - */ - } - - /** * Return the "id" property. */ public String getId() { diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java index 066d40189..68a473a7d 100644 --- a/src/java/org/apache/fop/fo/flow/Marker.java +++ b/src/java/org/apache/fop/fo/flow/Marker.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.flow; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -52,13 +51,6 @@ public class Marker extends FObjMixed { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: (#PCDATA|%inline;|%block;)* * Additionally: "An fo:marker may contain any formatting objects that diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index 5671cddb2..a48e65e20 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -22,12 +22,10 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP -import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; @@ -74,13 +72,6 @@ public class PageNumber extends FObj { private int wrapOption; // End of property values - /** FontState for this object */ - protected Font fontState; - - private float red; - private float green; - private float blue; - /** * @param parent FONode that is the parent of this object */ @@ -143,28 +134,11 @@ public class PageNumber extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - // Common Font Properties - this.fontState = propMgr.getFontState(getFOEventHandler().getFontInfo()); - - ColorType c = this.propertyList.get(PR_COLOR).getColorType(); - this.red = c.getRed(); - this.green = c.getGreen(); - this.blue = c.getBlue(); - - this.wrapOption = getPropEnum(PR_WRAP_OPTION); - getFOEventHandler().startPageNumber(this); - } - - /** * @return the FontState object for this PageNumber */ public Font getFontState() { - return fontState; + return propMgr.getFontState(getFOEventHandler().getFontInfo()); + } /** diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index 89e2b6127..9d62c96db 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -134,17 +133,6 @@ public class PageNumberCitation extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - if (getPropString(PR_REF_ID) == null || getPropString(PR_REF_ID).equals("")) { - missingPropertyError("ref-id"); - } - } - - /** * Return the Common Font Properties. */ public CommonFont getCommonFont() { diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java index a944b69bd..aff9b0e02 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -64,16 +63,6 @@ public class RetrieveMarker extends FObjMixed { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - this.retrieveClassName = getPropString(PR_RETRIEVE_CLASS_NAME); - this.retrievePosition = getPropEnum(PR_RETRIEVE_POSITION); - this.retrieveBoundary = getPropEnum(PR_RETRIEVE_BOUNDARY); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty */ diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index b9457a2e4..9ebd94d5f 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -24,11 +24,9 @@ import java.util.ListIterator; import java.util.ArrayList; // XML -import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP -import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; @@ -84,23 +82,6 @@ public class Table extends FObj { protected ArrayList columns = null; private TableBody tableHeader = null; private TableBody tableFooter = null; - private boolean omitHeaderAtBreak = false; - private boolean omitFooterAtBreak = false; - - private int spaceBefore; - private int spaceAfter; - private ColorType backgroundColor; - private LengthRangeProperty ipd; - private int _height; - - private boolean bAutoLayout = false; - private int contentWidth = 0; // Sum of column widths - /** Optimum inline-progression-dimension */ - private int optIPD; - /** Minimum inline-progression-dimension */ - private int minIPD; - /** Maximum inline-progression-dimension */ - private int maxIPD; /** * @param parent FONode that is the parent of this object @@ -157,29 +138,6 @@ public class Table extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - 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 = - this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - this.ipd = this.propertyList.get( - PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); - this._height = getPropLength(PR_HEIGHT); - 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; - getFOEventHandler().startTable(this); - } - - /** * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ protected void addChildNode(FONode child) throws SAXParseException { diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index 80cc2e51d..e3ed61007 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -22,11 +22,9 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP -import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; @@ -53,10 +51,6 @@ public class TableBody extends FObj { // private ToBeImplementedProperty visibility; // End of property values - private int spaceBefore; - private int spaceAfter; - private ColorType backgroundColor; - /** * @param parent FONode that is the parent of the object */ @@ -94,18 +88,6 @@ public class TableBody extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - 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(); - getFOEventHandler().startBody(this); - } - - /** * Return the Common Border, Padding, and Background Properties. */ public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index d0917e36b..8ca7ca2ed 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -22,12 +22,10 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP -import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.Numeric; import org.apache.fop.fo.FONode; @@ -73,14 +71,6 @@ public class TableCell extends FObj { private Length width; // End of property values - // private int spaceBefore; - // private int spaceAfter; - private ColorType backgroundColor; - - private int numColumnsSpanned; - private int numRowsSpanned; - private int iColNumber = -1; // uninitialized - /** used for FO validation */ private boolean blockItemFound = false; @@ -91,12 +81,6 @@ public class TableCell extends FObj { protected int startOffset; /** - * Dimension of allocation rectangle in inline-progression-direction, - * determined by the width of the column(s) occupied by the cell - */ - protected int _width; - - /** * Offset of content rectangle, in block-progression-direction, * relative to the row. */ @@ -117,36 +101,15 @@ public class TableCell extends FObj { /** For collapsed border style */ protected int borderHeight = 0; - /** Minimum content height of cell. */ - protected int minCellHeight = 0; - - /** Height of cell */ - protected int _height = 0; - /** Ypos of cell ??? */ protected int top; - /** corresponds to display-align property */ - protected int verticalAlign; - - /** is this cell relatively aligned? */ - protected boolean bRelativeAlign = false; - - // boolean setup = false; - private boolean bSepBorders = true; - /** * Set to true if all content completely laid out. */ private boolean bDone = false; /** - * Border separation value in the block-progression dimension. - * Used in calculating cells height. - */ - private int _borderSeparation = 0; - - /** * @param parent FONode that is the parent of this object */ public TableCell(FONode parent) { @@ -203,48 +166,6 @@ public class TableCell extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - this.iColNumber = - propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue(); - if (iColNumber < 0) { - iColNumber = 0; - } - this.numColumnsSpanned = - this.propertyList.get(PR_NUMBER_COLUMNS_SPANNED).getNumber().intValue(); - if (numColumnsSpanned < 1) { - numColumnsSpanned = 1; - } - this.numRowsSpanned = - this.propertyList.get(PR_NUMBER_ROWS_SPANNED).getNumber().intValue(); - if (numRowsSpanned < 1) { - numRowsSpanned = 1; - } - - this.backgroundColor = - this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - - bSepBorders = (getPropEnum(PR_BORDER_COLLAPSE) == BorderCollapse.SEPARATE); - - calcBorders(propMgr.getBorderAndPadding()); - - // Vertical cell alignment - verticalAlign = getPropEnum(PR_DISPLAY_ALIGN); - if (verticalAlign == DisplayAlign.AUTO) { - // Depends on all cells starting in row - bRelativeAlign = true; - verticalAlign = getPropEnum(PR_RELATIVE_ALIGN); - } else { - bRelativeAlign = false; // Align on a per-cell basis - } - - this.minCellHeight = getPropLength(PR_HEIGHT); - getFOEventHandler().startCell(this); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: marker* (%block;)+ */ @@ -269,42 +190,11 @@ public class TableCell extends FObj { } /** - * Sets the width of the cell. Initially this width is the same as the - * width of the column containing this cell, or the sum of the spanned - * columns if numColumnsSpanned > 1 - * @param width the width of the cell (in millipoints ??) - */ - public void setWidth(int width) { - this._width = width; - } - - /** - * @return number of the column containing this cell - */ - public int getColumnNumber() { - return iColNumber; - } - - /** - * @return the number of columns spanned by this cell - */ - public int getNumColumnsSpanned() { - return numColumnsSpanned; - } - - /** - * @return the number of rows spanned by this cell - */ - public int getNumRowsSpanned() { - return numRowsSpanned; - } - - /** * Calculate cell border and padding, including offset of content * rectangle from the theoretical grid position. */ private void calcBorders(CommonBorderAndPadding bp) { - if (this.bSepBorders) { + if (this.borderCollapse == BorderCollapse.SEPARATE) { /* * Easy case. * Cell border is the property specified directly on cell. @@ -323,9 +213,9 @@ public class TableCell extends FObj { + bp.getPaddingEnd(false); // Offset of content rectangle in the block-progression direction - _borderSeparation = getPropLength(PR_BORDER_SEPARATION | + int bSep = getPropLength(PR_BORDER_SEPARATION | CP_BLOCK_PROGRESSION_DIRECTION); - this.beforeOffset = _borderSeparation / 2 + this.beforeOffset = bSep / 2 + bp.getBorderBeforeWidth(false) + bp.getPaddingBefore(false); @@ -403,11 +293,10 @@ public class TableCell extends FObj { } /** - * @return number of the column containing this cell - * TODO 31699 + * Return the "column-number" property. */ - public int ___getColumnNumber() { - return columnNumber.getValue(); + public int getColumnNumber() { + return Math.max(columnNumber.getValue(), 0); } /** @@ -418,17 +307,17 @@ public class TableCell extends FObj { } /** - * @return the number of columns spanned by this cell + * Return the "number-columns-spanned" property. */ public int getNumberColumnsSpanned() { - return numberColumnsSpanned.getValue(); + return Math.max(numberColumnsSpanned.getValue(), 1); } /** - * @return the number of rows spanned by this cell + * Return the "number-rows-spanned" property. */ public int getNumberRowsSpanned() { - return numberRowsSpanned.getValue(); + return Math.max(numberRowsSpanned.getValue(), 1); } /** diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java index ad242ede0..522225f43 100644 --- a/src/java/org/apache/fop/fo/flow/TableColumn.java +++ b/src/java/org/apache/fop/fo/flow/TableColumn.java @@ -19,12 +19,10 @@ package org.apache.fop.fo.flow; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP -import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.Numeric; import org.apache.fop.fo.FONode; @@ -49,11 +47,6 @@ public class TableColumn extends FObj { // private ToBeImplementedProperty visibility; // End of property values - private ColorType backgroundColor; - private int columnOffset; - private int numColumnsRepeated; - private int iColumnNumber; - /** * @param parent FONode that is the parent of this object */ @@ -101,29 +94,6 @@ public class TableColumn extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties(Attributes) - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - iColumnNumber = propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue(); - numColumnsRepeated = - propertyList.get(PR_NUMBER_COLUMNS_REPEATED).getNumber().intValue(); - this.backgroundColor = - this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - columnWidth = this.propertyList.get(PR_COLUMN_WIDTH).getLength(); - - getFOEventHandler().startColumn(this); - } - - /** - * @return value for number of columns repeated - */ - public int getNumColumnsRepeated() { - return numColumnsRepeated; - } - - /** * Return the Common Border, Padding, and Background Properties. */ public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java index e1c5774d3..439f18887 100644 --- a/src/java/org/apache/fop/fo/flow/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/TableRow.java @@ -22,12 +22,10 @@ package org.apache.fop.fo.flow; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP -import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.KeepValue; import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; @@ -70,14 +68,6 @@ public class TableRow extends FObj { private boolean setup = false; - private ColorType backgroundColor; - - private KeepValue _keepWithNext; - private KeepValue _keepWithPrevious; - private KeepValue _keepTogether; - - private int minHeight = 0; // force row height - /** * @param parent FONode that is the parent of this object */ @@ -127,14 +117,6 @@ public class TableRow extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - getFOEventHandler().startRow(this); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: (table-cell+) */ @@ -145,30 +127,6 @@ public class TableRow extends FObj { } } - /** - * @return keepWithPrevious - */ - public KeepValue getKeepWithPrevious() { - return _keepWithPrevious; - } - - /** - * @todo see if should remove, or move code to addProperties() - */ - private void doSetup() { - this.breakAfter = getPropEnum(PR_BREAK_AFTER); - this.backgroundColor = - this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - - this._keepTogether = getKeepValue(PR_KEEP_TOGETHER | CP_WITHIN_COLUMN); - this._keepWithNext = getKeepValue(PR_KEEP_WITH_NEXT | CP_WITHIN_COLUMN); - this._keepWithPrevious = - getKeepValue(PR_KEEP_WITH_PREVIOUS | CP_WITHIN_COLUMN); - - this.minHeight = getPropLength(PR_HEIGHT); - setup = true; - } - private KeepValue getKeepValue(int propId) { Property p = this.propertyList.get(propId); Number n = p.getNumber(); diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java index 33e2b5caa..8d9b4d0e8 100644 --- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.pagination; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -46,8 +45,6 @@ public class ConditionalPageMasterReference extends FObj { private RepeatablePageMasterAlternatives repeatablePageMasterAlternatives; - private String masterName; - /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -82,38 +79,6 @@ public class ConditionalPageMasterReference extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - if (getProperty(PR_MASTER_REFERENCE) != null) { - setMasterName(getProperty(PR_MASTER_REFERENCE).getString()); - } - - validateParent(parent); - - this.pagePosition = getPropEnum(PR_PAGE_POSITION); - this.oddOrEven = getPropEnum(PR_ODD_OR_EVEN); - this.blankOrNotBlank = getPropEnum(PR_BLANK_OR_NOT_BLANK); - } - - /** - * Sets the master name. - * @param masterName name for the master - */ - protected void setMasterName(String masterName) { - this.masterName = masterName; - } - - /** - * Returns the "master-name" attribute of this page master reference - * @return the master name - */ - public String getMasterName() { - return masterName; - } - - /** * Check if the conditions for this reference are met. * checks the page number and emptyness to determine if this * matches. @@ -179,7 +144,7 @@ public class ConditionalPageMasterReference extends FObj { this.repeatablePageMasterAlternatives = (RepeatablePageMasterAlternatives)parent; - if (getMasterName() == null) { + if (getMasterReference() == null) { getLogger().warn("single-page-master-reference" + "does not have a master-name and so is being ignored"); } else { diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index 09cafb357..33f42ca90 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -23,7 +23,6 @@ import java.util.ArrayList; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -47,11 +46,6 @@ public class Flow extends FObj { */ private ArrayList markerSnapshot; - /** - * Content-width of current column area during layout - */ - private int contentWidth; - /** used for FO validation */ private boolean blockItemFound = false; @@ -115,22 +109,6 @@ public class Flow extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - // check flow_name property - String flowName = getPropString(PR_FLOW_NAME); - - if (flowName == null || flowName.equals("")) { - missingPropertyError("flow-name"); - } - - getFOEventHandler().startFlow(this); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: marker* (%block;)+ */ @@ -148,21 +126,6 @@ public class Flow extends FObj { } /** - * @param contentWidth content width of this flow, in millipoints (??) - */ - protected void setContentWidth(int contentWidth) { - this.contentWidth = contentWidth; - } - - /** - * @return the content width of this flow (really of the region - * in which it is flowing), in millipoints (??). - */ - public int getContentWidth() { - return this.contentWidth; - } - - /** * @return true (Flow can generate reference areas) */ public boolean generatesReferenceAreas() { @@ -170,7 +133,7 @@ public class Flow extends FObj { } /** - * @return the name of this flow + * Return "flow-name" property. */ public String getFlowName() { return flowName; diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index 7697a834d..40073f761 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -23,7 +23,6 @@ import java.util.Iterator; import java.util.Map; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -71,6 +70,8 @@ public class LayoutMasterSet extends FObj { throw new SAXParseException("fo:layout-master-set must be child of fo:root, not " + parent.getName(), locator); } + simplePageMasters = new java.util.HashMap(); + pageSequenceMasters = new java.util.HashMap(); } /** @@ -84,24 +85,6 @@ public class LayoutMasterSet extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - if (parent.getName().equals("fo:root")) { - Root root = (Root)parent; - root.setLayoutMasterSet(this); - } else { - throw new SAXParseException("fo:layout-master-set must be child of fo:root, not " - + parent.getName(), locator); - } - - this.simplePageMasters = new java.util.HashMap(); - this.pageSequenceMasters = new java.util.HashMap(); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL/FOP: (simple-page-master|page-sequence-master)+ */ diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 5205b0e77..939b8eb83 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.pagination; import java.util.HashMap; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -205,58 +204,6 @@ public class PageSequence extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - this.root = (Root) parent; - layoutMasterSet = root.getLayoutMasterSet(); - flowMap = new HashMap(); - - // we are now on the first page of the page sequence - thisIsFirstPage = true; - Property ipnValue = getProperty(PR_INITIAL_PAGE_NUMBER); - - if (ipnValue.getEnum() != 0) { - // auto | auto-odd | auto-even. - pageNumberType = ipnValue.getEnum(); - } else { - pageNumberType = EXPLICIT; - int pageStart = ipnValue.getNumber().intValue(); - this.explicitFirstNumber = (pageStart > 0) ? pageStart : 1; - } - - String masterName = getPropString(PR_MASTER_REFERENCE); - this.simplePageMaster = - this.layoutMasterSet.getSimplePageMaster(masterName); - if (this.simplePageMaster == null) { - this.pageSequenceMaster = - this.layoutMasterSet.getPageSequenceMaster(masterName); - if (this.pageSequenceMaster == null) { - throw new SAXParseException("master-reference '" + masterName - + "' for fo:page-sequence matches no" - + " simple-page-master or page-sequence-master", locator); - } - } - - // get the 'format' properties - this.pageNumberGenerator = - new PageNumberGenerator(getPropString(PR_FORMAT), - this.propertyList.get(PR_GROUPING_SEPARATOR).getCharacter(), - this.propertyList.get(PR_GROUPING_SIZE).getNumber().intValue(), - getPropEnum(PR_LETTER_VALUE)); - - this.forcePageCount = getPropEnum(PR_FORCE_PAGE_COUNT); - - // this.propertyList.get("country"); - // this.propertyList.get("language"); - - //call startStructuredPageSequence to ensure, that startPageSequence is called - //before startFlow. - startStructuredPageSequence(); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL Content Model: (title?,static-content*,flow) */ diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index fcb2e0d97..a6713ad2f 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.pagination; import java.util.List; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -99,28 +98,6 @@ public class PageSequenceMaster extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - subSequenceSpecifiers = new java.util.ArrayList(); - if (parent.getName().equals("fo:layout-master-set")) { - this.layoutMasterSet = (LayoutMasterSet)parent; - masterName = getPropString(PR_MASTER_NAME); - if (masterName == null) { - getLogger().warn("page-sequence-master does not have " - + "a master-name and so is being ignored"); - } else { - this.layoutMasterSet.addPageSequenceMaster(masterName, this); - } - } else { - throw new SAXParseException("fo:page-sequence-master must be child " - + "of fo:layout-master-set, not " - + parent.getName(), locator); - } - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL/FOP: (single-page-master-reference|repeatable-page-master-reference| * repeatable-page-master-alternatives)+ diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index a165dcf11..d68961441 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -21,7 +21,6 @@ package org.apache.fop.fo.pagination; import java.awt.Rectangle; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -49,9 +48,6 @@ public abstract class Region extends FObj { private SimplePageMaster layoutMaster; - /** Holds the writing mode */ - protected int wm; - /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -90,32 +86,6 @@ public abstract class Region extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - // regions may have name, or default - if (null == this.propertyList.get(PR_REGION_NAME)) { - setRegionName(getDefaultRegionName()); - } else if (getPropString(PR_REGION_NAME).equals("")) { - setRegionName(getDefaultRegionName()); - } else { - 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() - + " is not permitted.", locator); - } - } - - this.wm = getPropEnum(PR_WRITING_MODE); - this.overflow = getPropEnum(PR_OVERFLOW); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty */ diff --git a/src/java/org/apache/fop/fo/pagination/RegionAfter.java b/src/java/org/apache/fop/fo/pagination/RegionAfter.java index 199c2c0dc..2b47a24f5 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionAfter.java +++ b/src/java/org/apache/fop/fo/pagination/RegionAfter.java @@ -21,10 +21,6 @@ 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; @@ -34,9 +30,6 @@ 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) */ @@ -45,35 +38,18 @@ 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 - extent, reldims.ipd, extent); + if (this.getWritingMode() == WritingMode.LR_TB || this.getWritingMode() == WritingMode.RL_TB) { + vpRect = new Rectangle(0, reldims.bpd - getExtent().getValue(), reldims.ipd, getExtent().getValue()); } else { - vpRect = new Rectangle(0, reldims.bpd - extent, extent, reldims.ipd); + vpRect = new Rectangle(0, reldims.bpd - getExtent().getValue(), getExtent().getValue(), reldims.ipd); } - if (precedence == false) { - adjustIPD(vpRect, this.wm); + if (getPrecedence() == FALSE) { + adjustIPD(vpRect, this.getWritingMode()); } 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 4ad44e168..34fba9c91 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBA.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBA.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.pagination; import java.awt.Rectangle; // XML -import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP @@ -56,13 +55,6 @@ public abstract class RegionBA extends Region { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - } - - /** * Return the "extent" property. */ public Length getExtent() { @@ -71,9 +63,8 @@ public abstract class RegionBA extends Region { /** * Return the "precedence" property. - * TODO: 31699 */ - public int ___getPrecedence() { + public int getPrecedence() { return precedence; } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBefore.java b/src/java/org/apache/fop/fo/pagination/RegionBefore.java index 1315c2c04..c00a40ce0 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBefore.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBefore.java @@ -21,10 +21,6 @@ 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; @@ -33,10 +29,6 @@ import org.apache.fop.fo.FONode; * The fo:region-before element. */ public class RegionBefore extends RegionBA { - - private int extent = 0; - private boolean precedence = false; - /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -45,23 +37,6 @@ 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() { @@ -79,13 +54,13 @@ public class RegionBefore extends RegionBA { // Before is always 0, start depends on extent // 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, extent); + if (this.getWritingMode() == WritingMode.LR_TB || this.getWritingMode() == WritingMode.RL_TB) { + vpRect = new Rectangle(0, 0, reldims.ipd, getExtent().getValue()); } else { - vpRect = new Rectangle(0, 0, extent, reldims.ipd); + vpRect = new Rectangle(0, 0, getExtent().getValue(), reldims.ipd); } - if (precedence == false) { - adjustIPD(vpRect, this.wm); + if (getPrecedence() == FALSE) { + adjustIPD(vpRect, this.getWritingMode()); } 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 bfadeb48b..0940719bf 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionEnd.java +++ b/src/java/org/apache/fop/fo/pagination/RegionEnd.java @@ -21,10 +21,6 @@ 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; @@ -33,9 +29,6 @@ import org.apache.fop.datatypes.FODimension; * The fo:region-end element. */ public class RegionEnd extends RegionSE { - - private int extent = 0; - /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -44,29 +37,21 @@ 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) { + if (this.getWritingMode() == WritingMode.LR_TB || this.getWritingMode() == WritingMode.RL_TB) { // Rectangle: x , y (of top left point), width, height - vpRect = new Rectangle(reldims.ipd - extent, 0, - extent, reldims.bpd); + vpRect = new Rectangle(reldims.ipd - getExtent().getValue(), 0, + getExtent().getValue(), reldims.bpd); } else { // Rectangle: x , y (of top left point), width, height - vpRect = new Rectangle(reldims.ipd - extent, 0, - reldims.bpd, extent); + vpRect = new Rectangle(reldims.ipd - getExtent().getValue(), 0, + reldims.bpd, getExtent().getValue()); } - adjustIPD(vpRect, this.wm); + adjustIPD(vpRect, this.getWritingMode()); 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 4ba8b1e7c..dc8839c6d 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionSE.java +++ b/src/java/org/apache/fop/fo/pagination/RegionSE.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.pagination; import java.awt.Rectangle; // XML -import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP @@ -54,13 +53,6 @@ public abstract class RegionSE extends Region { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - } - - /** * Return the "extent" property. */ public Length getExtent() { @@ -80,12 +72,12 @@ public abstract class RegionSE extends Region { protected void adjustIPD(Rectangle vpRefRect, int wm) { int offset = 0; RegionBefore before = (RegionBefore) getSiblingRegion(FO_REGION_BEFORE); - if (before != null && before.getPrecedence()) { + if (before != null && before.getPrecedence() == TRUE) { offset = before.getPropLength(PR_EXTENT); vpRefRect.translate(0, offset); } RegionAfter after = (RegionAfter) getSiblingRegion(FO_REGION_AFTER); - if (after != null && after.getPrecedence()) { + if (after != null && after.getPrecedence() == TRUE) { offset += after.getPropLength(PR_EXTENT); } if (offset > 0) { diff --git a/src/java/org/apache/fop/fo/pagination/RegionStart.java b/src/java/org/apache/fop/fo/pagination/RegionStart.java index f00414934..ad72e2737 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionStart.java +++ b/src/java/org/apache/fop/fo/pagination/RegionStart.java @@ -21,10 +21,6 @@ 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; @@ -33,9 +29,6 @@ import org.apache.fop.datatypes.FODimension; * The fo:region-start element. */ public class RegionStart extends RegionSE { - - private int extent = 0; - /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -44,14 +37,6 @@ 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) { @@ -59,12 +44,12 @@ public class RegionStart extends RegionSE { // This is the rectangle relative to the page-reference area in // writing-mode relative coordinates Rectangle vpRect; - if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) { - vpRect = new Rectangle(0, 0, extent, reldims.bpd); + if (this.getWritingMode() == WritingMode.LR_TB || this.getWritingMode() == WritingMode.RL_TB) { + vpRect = new Rectangle(0, 0, getExtent().getValue(), reldims.bpd); } else { - vpRect = new Rectangle(0, 0, reldims.bpd, extent); + vpRect = new Rectangle(0, 0, reldims.bpd, getExtent().getValue()); } - adjustIPD(vpRect, this.wm); + adjustIPD(vpRect, this.getWritingMode()); return vpRect; } diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index c2d601551..541cf8330 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java @@ -22,7 +22,6 @@ package org.apache.fop.fo.pagination; import java.util.ArrayList; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -124,36 +123,6 @@ public class RepeatablePageMasterAlternatives extends FObj } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - conditionalPageMasterRefs = new ArrayList(); - - if (parent.getName().equals("fo:page-sequence-master")) { - PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent; - pageSequenceMaster.addSubsequenceSpecifier(this); - } else { - throw new SAXParseException("fo:repeatable-page-master-alternatives " - + "must be child of fo:page-sequence-master, not " - + parent.getName(), locator); - } - - Property mr = getProperty(PR_MAXIMUM_REPEATS); - - if (mr.getEnum() == NO_LIMIT) { - this._maximumRepeats = INFINITE; - } else { - this._maximumRepeats = mr.getNumber().intValue(); - if (this._maximumRepeats < 0) { - getLogger().debug("negative maximum-repeats: " - + this.maximumRepeats); - this._maximumRepeats = 0; - } - } - } - - /** * Get the next matching page master from the conditional * page master references. * @see org.apache.fop.fo.pagination.SubSequenceSpecifier @@ -173,7 +142,7 @@ public class RepeatablePageMasterAlternatives extends FObj ConditionalPageMasterReference cpmr = (ConditionalPageMasterReference)conditionalPageMasterRefs.get(i); if (cpmr.isValid(isOddPage, isFirstPage, isBlankPage)) { - return cpmr.getMasterName(); + return cpmr.getMasterReference(); } } return null; diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java index d01422500..1b66cbea2 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.pagination; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -45,7 +44,6 @@ public class RepeatablePageMasterReference extends FObj private static final int INFINITE = -1; private PageSequenceMaster pageSequenceMaster; - private int _maximumRepeats; private int numberConsumed = 0; /** @@ -75,35 +73,7 @@ public class RepeatablePageMasterReference extends FObj pageSequenceMaster.addSubsequenceSpecifier(this); } } - - /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent; - - if (getPropString(PR_MASTER_REFERENCE) == null) { - missingPropertyError("master-reference"); - } else { - pageSequenceMaster.addSubsequenceSpecifier(this); - } - - Property mr = getProperty(PR_MAXIMUM_REPEATS); - - if (mr.getEnum() == NO_LIMIT) { - this._maximumRepeats = INFINITE; - } else { - this._maximumRepeats = mr.getNumber().intValue(); - if (this._maximumRepeats < 0) { - getLogger().debug("negative maximum-repeats: " - + this.maximumRepeats); - this._maximumRepeats = 0; - } - } - } - + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty @@ -119,8 +89,8 @@ public class RepeatablePageMasterReference extends FObj public String getNextPageMasterName(boolean isOddPage, boolean isFirstPage, boolean isEmptyPage) { - if (_maximumRepeats != INFINITE) { - if (numberConsumed < _maximumRepeats) { + if (getMaximumRepeats() != INFINITE) { + if (numberConsumed < getMaximumRepeats()) { numberConsumed++; } else { return null; diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java index 122f0866d..8f39e759c 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -24,7 +24,6 @@ import java.util.Iterator; import java.util.Map; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -110,24 +109,6 @@ public class SimplePageMaster extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - LayoutMasterSet layoutMasterSet = (LayoutMasterSet) parent; - - if (getPropString(PR_MASTER_NAME) == null) { - missingPropertyError("master-name"); - } else { - layoutMasterSet.addSimplePageMaster(this); - } - - //Well, there are only 5 regions so we can save a bit of memory here - regions = new HashMap(5); - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: (region-body,region-before?,region-after?,region-start?,region-end?) */ diff --git a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java index 2abcbb565..faa61c0aa 100644 --- a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java @@ -19,7 +19,6 @@ package org.apache.fop.fo.pagination; // XML -import org.xml.sax.Attributes; import org.xml.sax.Locator; import org.xml.sax.SAXParseException; @@ -73,20 +72,6 @@ public class SinglePageMasterReference extends FObj } /** - * @see org.apache.fop.fo.FObj#addProperties - */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); - - PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent; - if (getPropString(PR_MASTER_REFERENCE) == null) { - missingPropertyError("master-reference"); - } else { - pageSequenceMaster.addSubsequenceSpecifier(this); - } - } - - /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty */ |