From b0839fa1f93f128c6dd271930209e59228bb0472 Mon Sep 17 00:00:00 2001 From: Finn Bock Date: Tue, 19 Oct 2004 08:53:51 +0000 Subject: [PATCH] First phase of performance improvement. Added bind() and startOfNode() methods to the FO nodes, unused for now. PR: 31699 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198054 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/FOText.java | 82 +++++++ .../org/apache/fop/fo/flow/BasicLink.java | 75 +++++- .../org/apache/fop/fo/flow/BidiOverride.java | 36 +++ src/java/org/apache/fop/fo/flow/Block.java | 229 ++++++++++++++++-- .../apache/fop/fo/flow/BlockContainer.java | 140 ++++++++++- .../org/apache/fop/fo/flow/Character.java | 150 ++++++++++++ .../apache/fop/fo/flow/ExternalGraphic.java | 186 ++++++++++++++ src/java/org/apache/fop/fo/flow/Float.java | 13 + src/java/org/apache/fop/fo/flow/Footnote.java | 45 +++- .../org/apache/fop/fo/flow/FootnoteBody.java | 43 +++- .../fop/fo/flow/InitialPropertySet.java | 52 ++++ src/java/org/apache/fop/fo/flow/Inline.java | 138 ++++++++++- .../apache/fop/fo/flow/InlineContainer.java | 72 ++++++ .../fop/fo/flow/InstreamForeignObject.java | 175 ++++++++++++- src/java/org/apache/fop/fo/flow/Leader.java | 166 ++++++++++++- .../org/apache/fop/fo/flow/ListBlock.java | 105 ++++++-- src/java/org/apache/fop/fo/flow/ListItem.java | 104 ++++++-- .../org/apache/fop/fo/flow/ListItemBody.java | 45 ++++ .../org/apache/fop/fo/flow/ListItemLabel.java | 45 +++- src/java/org/apache/fop/fo/flow/Marker.java | 18 ++ .../org/apache/fop/fo/flow/MultiCase.java | 30 +++ .../apache/fop/fo/flow/MultiProperties.java | 44 +++- .../apache/fop/fo/flow/MultiPropertySet.java | 27 +++ .../org/apache/fop/fo/flow/MultiSwitch.java | 42 +++- .../org/apache/fop/fo/flow/MultiToggle.java | 21 +- .../org/apache/fop/fo/flow/PageNumber.java | 118 ++++++++- .../fop/fo/flow/PageNumberCitation.java | 107 +++++++- .../apache/fop/fo/flow/RetrieveMarker.java | 23 +- src/java/org/apache/fop/fo/flow/Table.java | 118 ++++++++- .../apache/fop/fo/flow/TableAndCaption.java | 113 ++++++--- .../org/apache/fop/fo/flow/TableBody.java | 54 ++++- .../org/apache/fop/fo/flow/TableCaption.java | 67 ++++- .../org/apache/fop/fo/flow/TableCell.java | 143 +++++++++-- .../org/apache/fop/fo/flow/TableColumn.java | 73 +++++- src/java/org/apache/fop/fo/flow/TableRow.java | 138 +++++++++-- src/java/org/apache/fop/fo/flow/Wrapper.java | 30 ++- .../fop/fo/pagination/ColorProfile.java | 27 ++- .../ConditionalPageMasterReference.java | 37 ++- .../fop/fo/pagination/Declarations.java | 8 + .../org/apache/fop/fo/pagination/Flow.java | 77 +++++- .../fop/fo/pagination/LayoutMasterSet.java | 41 +++- .../fop/fo/pagination/PageSequence.java | 106 ++++++-- .../fop/fo/pagination/PageSequenceMaster.java | 51 +++- .../org/apache/fop/fo/pagination/Region.java | 91 ++++++- .../apache/fop/fo/pagination/RegionBA.java | 32 ++- .../apache/fop/fo/pagination/RegionBody.java | 42 ++++ .../apache/fop/fo/pagination/RegionSE.java | 20 ++ .../RepeatablePageMasterAlternatives.java | 68 +++++- .../RepeatablePageMasterReference.java | 58 ++++- .../org/apache/fop/fo/pagination/Root.java | 32 ++- .../fop/fo/pagination/SimplePageMaster.java | 218 +++++++++++------ .../pagination/SinglePageMasterReference.java | 24 ++ .../fop/fo/pagination/StaticContent.java | 23 +- .../org/apache/fop/fo/pagination/Title.java | 28 +++ .../layoutmgr/PageSequenceLayoutManager.java | 2 +- 55 files changed, 3620 insertions(+), 432 deletions(-) diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java index 3c4f70b29..f634c6443 100644 --- a/src/java/org/apache/fop/fo/FOText.java +++ b/src/java/org/apache/fop/fo/FOText.java @@ -23,8 +23,13 @@ import java.util.List; import java.util.NoSuchElementException; // FOP +import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.pagination.Root; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonHyphenation; +import org.apache.fop.fo.properties.Property; +import org.apache.fop.fo.properties.SpaceProperty; import org.apache.fop.layoutmgr.TextLayoutManager; /** @@ -65,6 +70,18 @@ public class FOText extends FONode { */ public int endIndex = 0; + // The value of properties relevant for character. + private CommonFont commonFont; + private CommonHyphenation commonHyphenation; + private ColorType color; + private Property letterSpacing; + private SpaceProperty lineHeight; + private int whiteSpaceCollapse; + private int textTransform; + private Property wordSpacing; + private int wrapOption; + // End of property values + /** * The TextInfo object attached to the text */ @@ -121,6 +138,22 @@ public class FOText extends FONode { textTransform(); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonFont = pList.getFontProps(); + commonHyphenation = pList.getHyphenationProps(); + + color = pList.get(Constants.PR_COLOR).getColorType(); + lineHeight = pList.get(Constants.PR_LINE_HEIGHT).getSpace(); + letterSpacing = pList.get(Constants.PR_LETTER_SPACING); + whiteSpaceCollapse = pList.get(Constants.PR_WHITE_SPACE_COLLAPSE).getEnum(); + textTransform = pList.get(Constants.PR_TEXT_TRANSFORM).getEnum(); + wordSpacing = pList.get(Constants.PR_WORD_SPACING); + wrapOption = pList.get(Constants.PR_WRAP_OPTION).getEnum(); + } + /** * Check if this text node will create an area. * This means either there is non-whitespace or it is @@ -488,6 +521,55 @@ public class FOText extends FONode { } + /** + * Return the Common Font Properties. + */ + public CommonFont getCommonFont() { + return commonFont; + } + + /** + * Return the Common Hyphenation Properties. + */ + public CommonHyphenation getCommonHyphenation() { + return commonHyphenation; + } + + /** + * Return the "color" property. + */ + public ColorType getColor() { + return color; + } + + /** + * Return the "letter-spacing" property. + */ + public Property getLetterSpacing() { + return letterSpacing; + } + + /** + * Return the "line-height" property. + */ + public SpaceProperty getLineHeight() { + return lineHeight; + } + + /** + * Return the "word-spacing" property. + */ + public Property getWordSpacing() { + return wordSpacing; + } + + /** + * Return the "wrap-option" property. + */ + public int getWrapOption() { + return wrapOption; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/BasicLink.java b/src/java/org/apache/fop/fo/flow/BasicLink.java index 101d0ccfa..3b9424b99 100644 --- a/src/java/org/apache/fop/fo/flow/BasicLink.java +++ b/src/java/org/apache/fop/fo/flow/BasicLink.java @@ -28,6 +28,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; import org.apache.fop.layoutmgr.BasicLinkLayoutManager; /** @@ -38,6 +39,17 @@ import org.apache.fop.layoutmgr.BasicLinkLayoutManager; * reference). */ public class BasicLink extends Inline { + // The value of properties relevant for fo:basic-link. + // private ToBeImplementedProperty destinationPlacementOffset; + // private ToBeImplementedProperty dominantBaseline; + private String externalDestination; + // private ToBeImplementedProperty indicateDestination; + private String internalDestination; + // private ToBeImplementedProperty showDestination; + // private ToBeImplementedProperty targetProcessingContext; + // private ToBeImplementedProperty targetPresentationContext; + // private ToBeImplementedProperty targetStylesheet; + // End of property values // link represented by this FO private String link = null; @@ -55,6 +67,47 @@ public class BasicLink extends Inline { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) throws SAXParseException { + super.bind(pList); + // destinationPlacementOffset = pList.get(PR_DESTINATION_PLACEMENT_OFFSET); + // dominantBaseline = pList.get(PR_DOMINANT_BASELINE); + externalDestination = pList.get(PR_EXTERNAL_DESTINATION).getString(); + // indicateDestination = pList.get(PR_INDICATE_DESTINATION); + internalDestination = pList.get(PR_INTERNAL_DESTINATION).getString(); + // showDestination = pList.get(PR_SHOW_DESTINATION); + // targetProcessingContext = pList.get(PR_TARGET_PROCESSING_CONTEXT); + // targetPresentationContext = pList.get(PR_TARGET_PRESENTATION_CONTEXT); + // targetStylesheet = pList.get(PR_TARGET_STYLESHEET); + + // per spec, internal takes precedence if both specified + if (internalDestination.length() > 0) { + externalDestination = null; + } else if (externalDestination.length() == 0) { + // slightly stronger than spec "should be specified" + attributeError("Missing attribute: Either external-destination or " + + "internal-destination must be specified."); + } + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + super.startOfNode(); + getFOEventHandler().startLink(this); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + super.endOfNode(); + getFOEventHandler().endLink(); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -97,14 +150,6 @@ public class BasicLink extends Inline { } } - /** - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - super.endOfNode(); - getFOEventHandler().endLink(); - } - /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ @@ -127,6 +172,20 @@ public class BasicLink extends Inline { return isExternalLink; } + /** + * Return the "internal-destination" property. + */ + public String getInternalDestination() { + return internalDestination; + } + + /** + * Return the "external-destination" property. + */ + public String getExternalDestination() { + return externalDestination; + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/flow/BidiOverride.java b/src/java/org/apache/fop/fo/flow/BidiOverride.java index 73f8118e7..6d15a8ebc 100644 --- a/src/java/org/apache/fop/fo/flow/BidiOverride.java +++ b/src/java/org/apache/fop/fo/flow/BidiOverride.java @@ -28,8 +28,15 @@ import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.ColorTypeProperty; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.SpaceProperty; import org.apache.fop.layoutmgr.BidiLayoutManager; import org.apache.fop.layoutmgr.InlineStackingLayoutManager; import org.apache.fop.layoutmgr.LayoutManager; @@ -43,6 +50,19 @@ public class BidiOverride extends FObjMixed { private boolean blockOrInlineItemFound = false; private boolean canHaveBlockLevelChildren = true; + // The value of properties relevant for fo:bidi-override. + private CommonAural commonAural; + private CommonFont commonFont; + private CommonRelativePosition commonRelativePosition; + private ColorTypeProperty prColor; + // private ToBeImplementedProperty prDirection; + // private ToBeImplementedProperty prLetterSpacing; + private Length prLineHeight; + // private ToBeImplementedProperty prScoreSpaces; + // private ToBeImplementedProperty prUnicodeBidi; + private SpaceProperty prWordSpacing; + // End of property values + /** * @param parent FONode that is the parent of this object */ @@ -71,6 +91,22 @@ public class BidiOverride extends FObjMixed { } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAural = pList.getAuralProps(); + commonFont = pList.getFontProps(); + commonRelativePosition = pList.getRelativePositionProps(); + prColor = pList.get(PR_COLOR).getColorType(); + // prDirection = pList.get(PR_DIRECTION); + // prLetterSpacing = pList.get(PR_LETTER_SPACING); + prLineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + // prScoreSpaces = pList.get(PR_SCORE_SPACES); + // prUnicodeBidi = pList.get(PR_UNICODE_BIDI); + prWordSpacing = pList.get(PR_WORD_SPACING).getSpace(); + } + /** * @see org.apache.fop.fo.FObj#addProperties * @todo see if can use a BitSet to determine if an FO should diff --git a/src/java/org/apache/fop/fo/flow/Block.java b/src/java/org/apache/fop/fo/flow/Block.java index c328e7758..9ae7963ea 100644 --- a/src/java/org/apache/fop/fo/flow/Block.java +++ b/src/java/org/apache/fop/fo/flow/Block.java @@ -28,12 +28,24 @@ 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.CharIterator; -import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOText; +import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.PropertySets; import org.apache.fop.fo.RecursiveCharIterator; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonHyphenation; +import org.apache.fop.fo.properties.CommonMarginBlock; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.SpaceProperty; import org.apache.fop.layoutmgr.BlockLayoutManager; import org.apache.fop.fo.Constants; import org.apache.fop.util.CharUtilities; @@ -61,22 +73,56 @@ public class Block extends FObjMixed { private boolean blockOrInlineItemFound = false; private boolean initialPropertySetFound = false; + // The value of properties relevant for fo:block. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonFont commonFont; + private CommonHyphenation commonHyphenation; + private CommonMarginBlock commonMarginBlock; + private CommonRelativePosition commonRelativePosition; + private int breakAfter; + private int breakBefore; + private ColorType color; + // private ToBeImplementedProperty textDepth; + // private ToBeImplementedProperty textAltitude; + // private ToBeImplementedProperty hyphenationKeep; + // private ToBeImplementedProperty hyphenationLadderCount; + private String id; + // private ToBeImplementedProperty intrusionDisplace; + private KeepProperty keepTogether; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + // private ToBeImplementedProperty lastLineEndIndent; + private int linefeedTreatment; + private SpaceProperty lineHeight; + // private ToBeImplementedProperty lineHeightShiftAdjustment; + // private ToBeImplementedProperty lineStackingStrategy; + private Numeric orphans; + private int whiteSpaceTreatment; + private int span; + private int textAlign; + private int textAlignLast; + private Length textIndent; + // private ToBeImplementedProperty visibility; + private int whiteSpaceCollapse; + private Numeric widows; + private int wrapOption; + // End of property values + private int align; private int alignLast; - private int breakAfter; - private int lineHeight; + private int _lineHeight; private int startIndent; private int endIndent; private int spaceBefore; private int spaceAfter; - private int textIndent; - private int keepWithNext; + private int _textIndent; + private int _keepWithNext; private ColorType backgroundColor; private int blockWidows; private int blockOrphans; - private String id; - private int span; private int wsTreatment; //ENUMERATION private int lfTreatment; //ENUMERATION private boolean bWScollapse; //true if white-space-collapse=true @@ -98,6 +144,154 @@ public class Block extends FObjMixed { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) throws SAXParseException { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonFont = pList.getFontProps(); + commonHyphenation = pList.getHyphenationProps(); + commonMarginBlock = pList.getMarginBlockProps(); + commonRelativePosition = pList.getRelativePositionProps(); + + breakAfter = pList.get(PR_BREAK_AFTER).getEnum(); + breakBefore = pList.get(PR_BREAK_BEFORE).getEnum(); + color = pList.get(PR_COLOR).getColorType(); + // textDepth = pList.get(PR_TEXT_DEPTH); + // textAltitude = pList.get(PR_TEXT_ALTITUDE); + // hyphenationKeep = pList.get(PR_HYPHENATION_KEEP); + // hyphenationLadderCount = pList.get(PR_HYPHENATION_LADDER_COUNT); + id = pList.get(PR_ID).getString(); + // intrusionDisplace = pList.get(PR_INTRUSION_DISPLACE); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + // lastLineEndIndent = pList.get(PR_LAST_LINE_END_INDENT); + linefeedTreatment = pList.get(PR_LINEFEED_TREATMENT).getEnum(); + lineHeight = pList.get(PR_LINE_HEIGHT).getSpace(); + // lineHeightShiftAdjustment = pList.get(PR_LINE_HEIGHT_SHIFT_ADJUSTMENT); + // lineStackingStrategy = pList.get(PR_LINE_STACKING_STRATEGY); + orphans = pList.get(PR_ORPHANS).getNumeric(); + whiteSpaceTreatment = pList.get(PR_WHITE_SPACE_TREATMENT).getEnum(); + span = pList.get(PR_SPAN).getEnum(); + textAlign = pList.get(PR_TEXT_ALIGN).getEnum(); + textAlignLast = pList.get(PR_TEXT_ALIGN_LAST).getEnum(); + textIndent = pList.get(PR_TEXT_INDENT).getLength(); + // visibility = pList.get(PR_VISIBILITY); + whiteSpaceCollapse = pList.get(PR_WHITE_SPACE_COLLAPSE).getEnum(); + widows = pList.get(PR_WIDOWS).getNumeric(); + wrapOption = pList.get(PR_WRAP_OPTION).getEnum(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startBlock(this); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + handleWhiteSpace(); + getFOEventHandler().endBlock(this); + } + + /** + * Return the Common Margin Properties-Block. + */ + public CommonMarginBlock getCommonMarginBlock() { + return commonMarginBlock; + } + + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + + /** + * Return the Common Font Properties. + */ + public CommonFont getCommonFont() { + return commonFont; + } + + /** + * Return the Common Hyphenation Properties. + */ + public CommonHyphenation getCommonHyphenation() { + return commonHyphenation; + } + + /** + * Return the "break-after" property. + */ + public int getBreakAfter() { + return breakAfter; + } + + /** + * Return the "break-before" property. + */ + public int getBreakBefore() { + return breakBefore; + } + + /** + * Return the "color" property. + */ + public ColorType getColor() { + return color; + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "line-height" property. + */ + public SpaceProperty getLineHeight() { + return lineHeight; + } + + /** + * Return the "span" property. + */ + public int getSpan() { + return this.span; + } + + /** + * Return the "text-align" property. + */ + public int getTextAlign() { + return textAlign; + } + + /** + * Return the "text-align-last" property. + */ + public int getTextAlignLast() { + return textAlignLast; + } + + /** + * Return the "text-indent" property. + */ + public Length getTextIndent() { + return textIndent; + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -110,13 +304,13 @@ public class Block extends FObjMixed { 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._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._textIndent = getPropLength(PR_TEXT_INDENT); + this._keepWithNext = getPropEnum(PR_KEEP_WITH_NEXT); this.blockWidows = this.propertyList.get(PR_WIDOWS).getNumber().intValue(); this.blockOrphans = @@ -156,13 +350,6 @@ public class Block extends FObjMixed { } } - /** - * @return span for this Block, in millipoints (??) - */ - public int getSpan() { - return this.span; - } - /** * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ @@ -183,14 +370,6 @@ public class Block extends FObjMixed { super.addChildNode(child); } - /** - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - handleWhiteSpace(); - getFOEventHandler().endBlock(this); - } - private void handleWhiteSpace() { //getLogger().debug("fo:block: handleWhiteSpace"); if (firstInlineChild != null) { diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java index af9079c23..df1a8e884 100644 --- a/src/java/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java @@ -23,8 +23,16 @@ 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; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAbsolutePosition; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonMarginBlock; +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; @@ -35,6 +43,29 @@ import org.xml.sax.SAXParseException; * @todo implement validateChildNode() */ public class BlockContainer extends FObj { + // The value of properties relevant for fo:block-container. + private CommonAbsolutePosition commonAbsolutePosition ; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonMarginBlock commonMarginBlock; + private LengthRangeProperty blockProgressionDimension; + private int breakAfter; + private int breakBefore; + // private ToBeImplementedProperty clip; + private int displayAlign; + private Length height; + private String id; + private LengthRangeProperty inlineProgressionDimension; + // private ToBeImplementedProperty intrusionDisplace; + private KeepProperty keepTogether; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private int overflow; + private Numeric referenceOrientation; + private int span; + private Length width; + private int writingMode; + // private ToBeImplementedProperty zIndex; + // End of property values private ColorType backgroundColor; private int position; @@ -43,10 +74,9 @@ public class BlockContainer extends FObj { private int bottom; private int left; private int right; - private int width; - private int height; + private int _width; + private int _height; - private int span; /** * @param parent FONode that is the parent of this object @@ -55,6 +85,41 @@ public class BlockContainer extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAbsolutePosition = pList.getAbsolutePositionProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonMarginBlock = pList.getMarginBlockProps(); + blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); + breakAfter = pList.get(PR_BREAK_AFTER).getEnum(); + breakBefore = pList.get(PR_BREAK_BEFORE).getEnum(); + // clip = pList.get(PR_CLIP); + displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum(); + height = pList.get(PR_HEIGHT).getLength(); + id = pList.get(PR_ID).getString(); + inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); + // intrusionDisplace = pList.get(PR_INTRUSION_DISPLACE); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + overflow = pList.get(PR_OVERFLOW).getEnum(); + referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric(); + span = pList.get(PR_SPAN).getEnum(); + width = pList.get(PR_WIDTH).getLength(); + writingMode = pList.get(PR_WRITING_MODE).getEnum(); + // zIndex = pList.get(PR_Z_INDEX); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startBlockContainer(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -64,8 +129,8 @@ public class BlockContainer extends FObj { this.backgroundColor = this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - this.width = getPropLength(PR_WIDTH); - this.height = getPropLength(PR_HEIGHT); + this._width = getPropLength(PR_WIDTH); + this._height = getPropLength(PR_HEIGHT); getFOEventHandler().startBlockContainer(this); } @@ -84,12 +149,75 @@ public class BlockContainer extends FObj { } /** - * @return the span for this object + * Return the Common Absolute Position Properties. + */ + public CommonAbsolutePosition getCommonAbsolutePosition() { + return commonAbsolutePosition; + } + + /** + * Return the Common Margin Properties-Block. + */ + public CommonMarginBlock getCommonMarginBlock() { + return commonMarginBlock; + } + + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + + /** + * Return the "block-progression-dimension" property. + */ + public LengthRangeProperty getBlockProgressionDimension() { + return blockProgressionDimension; + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "inline-progression-dimension" property. + */ + public LengthRangeProperty getInlineProgressionDimension() { + return inlineProgressionDimension; + } + + /** + * Return the "overflow" property. + */ + public int getOverflow() { + return overflow; + } + + /** + * Return the "reference-orientation" property. + */ + public int getReferenceOrientation() { + return referenceOrientation.getValue(); + } + + /** + * Return the "span" property. */ public int getSpan() { return this.span; } + /** + * Return the "writing-mode" property. + */ + public int getWritingMode() { + return writingMode; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/Character.java b/src/java/org/apache/fop/fo/flow/Character.java index f1b185826..2a84a6dcf 100644 --- a/src/java/org/apache/fop/fo/flow/Character.java +++ b/src/java/org/apache/fop/fo/flow/Character.java @@ -27,9 +27,20 @@ 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.CharIterator; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonHyphenation; +import org.apache.fop.fo.properties.CommonMarginInline; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.Property; import org.apache.fop.fo.OneCharIterator; import org.apache.fop.layoutmgr.CharacterLayoutManager; @@ -47,6 +58,37 @@ import org.apache.fop.layoutmgr.CharacterLayoutManager; * */ public class Character extends FObj { + // The value of properties relevant for fo:character. + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonFont commonFont; + private CommonHyphenation commonHyphenation; + private CommonMarginInline commonMarginInline; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty alignmentAdjust; + // private ToBeImplementedProperty treatAsWordSpace; + // private ToBeImplementedProperty alignmentBaseline; + private Length baselineShift; + private char character; + private ColorType color; + // private ToBeImplementedProperty dominantBaseline; + // private ToBeImplementedProperty textDepth; + // private ToBeImplementedProperty textAltitude; + // private ToBeImplementedProperty glyphOrientationHorizontal; + // private ToBeImplementedProperty glyphOrientationVertical; + private String id; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private Property letterSpacing; + private Length lineHeight; + // private ToBeImplementedProperty scoreSpaces; + // private ToBeImplementedProperty suppressAtLineBreak; + private int textDecoration; + // private ToBeImplementedProperty textShadow; + private int textTransform; + // private ToBeImplementedProperty visibility; + private Property wordSpacing; + // End of property values /** constant indicating that the character is OK */ public static final int OK = 0; @@ -62,6 +104,50 @@ public class Character extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonFont = pList.getFontProps(); + commonHyphenation = pList.getHyphenationProps(); + commonMarginInline = pList.getMarginInlineProps(); + commonRelativePosition = pList.getRelativePositionProps(); + + // alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST); + // treatAsWordSpace = pList.get(PR_TREAT_AS_WORD_SPACE); + // alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE); + baselineShift = pList.get(PR_BASELINE_SHIFT).getLength(); + character = pList.get(PR_CHARACTER).getCharacter(); + color = pList.get(PR_COLOR).getColorType(); + // dominantBaseline = pList.get(PR_DOMINANT_BASELINE); + // textDepth = pList.get(PR_TEXT_DEPTH); + // textAltitude = pList.get(PR_TEXT_ALTITUDE); + // glyphOrientationHorizontal = pList.get(PR_GLYPH_ORIENTATION_HORIZONTAL); + // glyphOrientationVertical = pList.get(PR_GLYPH_ORIENTATION_VERTICAL); + id = pList.get(PR_ID).getString(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + letterSpacing = pList.get(PR_LETTER_SPACING); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + // scoreSpaces = pList.get(PR_SCORE_SPACES); + // suppressAtLineBreak = pList.get(PR_SUPPRESS_AT_LINE_BREAK); + textDecoration = pList.get(PR_TEXT_DECORATION).getEnum(); + // textShadow = pList.get(PR_TEXT_SHADOW); + textTransform = pList.get(PR_TEXT_TRANSFORM).getEnum(); + // visibility = pList.get(PR_VISIBILITY); + wordSpacing = pList.get(PR_WORD_SPACING); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().character(this); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty @@ -71,6 +157,7 @@ public class Character extends FObj { invalidChildError(loc, nsURI, localName); } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -88,6 +175,69 @@ public class Character extends FObj { // But what if the character is ignored due to white space handling? } + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + + /** + * Return the Common Font Properties. + */ + public CommonFont getCommonFont() { + return commonFont; + } + + /** + * Return the Common Hyphenation Properties. + */ + public CommonHyphenation getCommonHyphenation() { + return commonHyphenation; + } + + /** + * Return the "character" property. + */ + public char getCharacter() { + return character; + } + + /** + * Return the "color" property. + */ + public ColorType getColor() { + return color; + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "letter-spacing" property. + */ + public Property getLetterSpacing() { + return letterSpacing; + } + + /** + * Return the "text-decoration" property. + */ + public int getTextDecoration() { + return textDecoration; + } + + /** + * Return the "word-spacing" property. + */ + public Property getWordSpacing() { + return wordSpacing; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index 241d5ebae..290183b51 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -27,8 +27,17 @@ import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonMarginInline; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; import org.apache.fop.layoutmgr.ExternalGraphicLayoutManager; /** @@ -37,6 +46,36 @@ import org.apache.fop.layoutmgr.ExternalGraphicLayoutManager; * inline area that can be added to the area tree. */ public class ExternalGraphic extends FObj { + // The value of properties relevant for fo:external-graphic. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonMarginInline commonMarginInline; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty alignmentAdjust; + // private ToBeImplementedProperty alignmentBaseline; + private Length baselineShift; + private LengthRangeProperty blockProgressionDimension; + // private ToBeImplementedProperty clip; + private Length contentHeight; + // private ToBeImplementedProperty contentType; + private Length contentWidth; + private int displayAlign; + // private ToBeImplementedProperty dominantBaseline; + private Length height; + private String id; + private LengthRangeProperty inlineProgressionDimension; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private Length lineHeight; + private int overflow; + private int scaling; + // private ToBeImplementedProperty scalingMethod; + private String src; + private int textAlign; + private int verticalAlign; //Extra + private Length width; + // End of property values /** * Create a new External graphic node. @@ -47,6 +86,48 @@ public class ExternalGraphic extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonMarginInline = pList.getMarginInlineProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST); + // alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE); + baselineShift = pList.get(PR_BASELINE_SHIFT).getLength(); + blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); + // clip = pList.get(PR_CLIP); + contentHeight = pList.get(PR_CONTENT_HEIGHT).getLength(); + // contentType = pList.get(PR_CONTENT_TYPE); + contentWidth = pList.get(PR_CONTENT_WIDTH).getLength(); + displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum(); + // dominantBaseline = pList.get(PR_DOMINANT_BASELINE); + height = pList.get(PR_HEIGHT).getLength(); + id = pList.get(PR_ID).getString(); + inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + overflow = pList.get(PR_OVERFLOW).getEnum(); + scaling = pList.get(PR_SCALING).getEnum(); + // scalingMethod = pList.get(PR_SCALING_METHOD); + src = pList.get(PR_SRC).getString(); + textAlign = pList.get(PR_TEXT_ALIGN).getEnum(); + verticalAlign = pList.get(PR_VERTICAL_ALIGN).getEnum(); + width = pList.get(PR_WIDTH).getLength(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().image(this); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty @@ -65,6 +146,111 @@ public class ExternalGraphic extends FObj { getFOEventHandler().image(this); } + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + + /** + * Return the Common Margin Properties-Inline. + */ + public CommonMarginInline getCommonMarginInline() { + return commonMarginInline; + } + + /** + * Return the "block-progression-dimension" property. + */ + public LengthRangeProperty getBlockProgressionDimension() { + return blockProgressionDimension; + } + + /** + * Return the "content-height" property. + */ + public Length getContentHeight() { + return contentHeight; + } + + /** + * Return the "content-width" property. + */ + public Length getContentWidth() { + return contentWidth; + } + + /** + * Return the "display-align" property. + */ + public int getDisplayAlign() { + return displayAlign; + } + + /** + * Return the "height" property. + */ + public Length getHeight() { + return height; + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "inline-progression-dimension" property. + */ + public LengthRangeProperty getInlineProgressionDimension() { + return inlineProgressionDimension; + } + + /** + * Return the "overflow" property. + */ + public int getOverflow() { + return overflow; + } + + /** + * Return the "scaling" property. + */ + public int getScaling() { + return scaling; + } + + /** + * Return the "src" property. + */ + public String getSrc() { + return src; + } + + /** + * Return the "text-align" property. + */ + public int getTextAlign() { + return textAlign; + } + + /** + * Return the "width" property. + */ + public Length getWidth() { + return width; + } + + /** + * Return the "vertical-align" property. + */ + public int getVerticalAlign() { + return verticalAlign; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/Float.java b/src/java/org/apache/fop/fo/flow/Float.java index c6062092c..b846260c4 100644 --- a/src/java/org/apache/fop/fo/flow/Float.java +++ b/src/java/org/apache/fop/fo/flow/Float.java @@ -25,11 +25,16 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; /** * fo:float element. */ public class Float extends FObj { + // The value of properties relevant for fo:float. + // private ToBeImplementedProperty float; + // private ToBeImplementedProperty clear; + // End of property values static boolean notImplementedWarningGiven = false; @@ -45,6 +50,14 @@ public class Float extends FObj { } } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + // float = pList.get(PR_FLOAT); + // clear = pList.get(PR_CLEAR); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: (%block;)+ diff --git a/src/java/org/apache/fop/fo/flow/Footnote.java b/src/java/org/apache/fop/fo/flow/Footnote.java index f44c2950a..1b5506e2d 100644 --- a/src/java/org/apache/fop/fo/flow/Footnote.java +++ b/src/java/org/apache/fop/fo/flow/Footnote.java @@ -29,11 +29,16 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; /** * Class modelling the fo:footnote object. */ public class Footnote extends FObj { + // The value of properties relevant for fo:footnote. + private CommonAccessibility commonAccessibility; + // End of property values private Inline inlineFO = null; private FootnoteBody footnoteBody; @@ -45,6 +50,13 @@ public class Footnote extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -53,6 +65,26 @@ public class Footnote extends FObj { getFOEventHandler().startFootnote(this); } + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + getFOEventHandler().startFootnote(this); + } + + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + super.endOfNode(); + if (inlineFO == null || footnoteBody == null) { + missingChildElementError("(inline,footnote-body)"); + } + getFOEventHandler().endFootnote(this); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: (inline,footnote-body) @@ -79,19 +111,6 @@ public class Footnote extends FObj { } } - /** - * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - super.endOfNode(); - if (inlineFO == null || footnoteBody == null) { - missingChildElementError("(inline,footnote-body)"); - } - getFOEventHandler().endFootnote(this); - } - /** * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ diff --git a/src/java/org/apache/fop/fo/flow/FootnoteBody.java b/src/java/org/apache/fop/fo/flow/FootnoteBody.java index c6de42c1f..d582d9e1b 100644 --- a/src/java/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/java/org/apache/fop/fo/flow/FootnoteBody.java @@ -26,11 +26,16 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; /** * Class modelling the fo:footnote-body object. */ public class FootnoteBody extends FObj { + // The value of properties relevant for fo:footnote-body. + private CommonAccessibility commonAccessibility; + // End of property values /** * @param parent FONode that is the parent of this object @@ -39,6 +44,32 @@ public class FootnoteBody extends FObj { super(parent); } + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (childNodes == null) { + missingChildElementError("(%block;)+"); + } + getFOEventHandler().endFootnoteBody(this); + } + + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + getFOEventHandler().startFootnoteBody(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -58,18 +89,6 @@ public class FootnoteBody extends FObj { } } - /** - * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - if (childNodes == null) { - missingChildElementError("(%block;)+"); - } - getFOEventHandler().endFootnoteBody(this); - } - /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java b/src/java/org/apache/fop/fo/flow/InitialPropertySet.java index 89a7ac766..27c83b368 100644 --- a/src/java/org/apache/fop/fo/flow/InitialPropertySet.java +++ b/src/java/org/apache/fop/fo/flow/InitialPropertySet.java @@ -23,6 +23,15 @@ import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.ColorTypeProperty; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.SpaceProperty; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; @@ -30,6 +39,22 @@ import org.apache.fop.fo.FObj; * Class modelling the fo:initial-property-set object. */ public class InitialPropertySet extends FObj { + // The value of properties relevant for fo:initial-property-set. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonFont commonFont; + private CommonRelativePosition commonRelativePosition; + private ColorTypeProperty color; + private String id; + // private ToBeImplementedProperty letterSpacing; + private Length lineHeight; + // private ToBeImplementedProperty scoreSpaces; + private int textDecoration; + // private ToBeImplementedProperty textShadow; + private int textTransform; + private SpaceProperty wordSpacing; + // End of property values /** * @param parent FONode that is the parent of this object @@ -38,6 +63,33 @@ public class InitialPropertySet extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonFont = pList.getFontProps(); + commonRelativePosition = pList.getRelativePositionProps(); + color = pList.get(PR_COLOR).getColorType(); + id = pList.get(PR_ID).getString(); + // letterSpacing = pList.get(PR_LETTER_SPACING); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + // scoreSpaces = pList.get(PR_SCORE_SPACES); + textDecoration = pList.get(PR_TEXT_DECORATION).getEnum(); + // textShadow = pList.get(PR_TEXT_SHADOW); + textTransform = pList.get(PR_TEXT_TRANSFORM).getEnum(); + wordSpacing = pList.get(PR_WORD_SPACING).getSpace(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty diff --git a/src/java/org/apache/fop/fo/flow/Inline.java b/src/java/org/apache/fop/fo/flow/Inline.java index a611c07d0..a1ae50300 100644 --- a/src/java/org/apache/fop/fo/flow/Inline.java +++ b/src/java/org/apache/fop/fo/flow/Inline.java @@ -24,15 +24,51 @@ 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.CharIterator; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; import org.apache.fop.fo.InlineCharIterator; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonMarginInline; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; /** * Class modelling the fo:inline formatting object. */ public class Inline extends FObjMixed { + // The value of properties relevant for fo:inline. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonFont commonFont; + private CommonMarginInline commonMarginInline; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty alignmentAdjust; + // private ToBeImplementedProperty alignmentBaseline; + private Length baselineShift; + private LengthRangeProperty blockProgressionDimension; + private ColorType color; + // private ToBeImplementedProperty dominantBaseline; + private Length height; + private String id; + private LengthRangeProperty inlineProgressionDimension; + private KeepProperty keepTogether; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private Length lineHeight; + private int textDecoration; + // private ToBeImplementedProperty visibility; + private Length width; + private int wrapOption; + // End of property values // used for FO validation private boolean blockOrInlineItemFound = false; @@ -45,6 +81,68 @@ public class Inline extends FObjMixed { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) throws SAXParseException { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonFont = pList.getFontProps(); + commonMarginInline = pList.getMarginInlineProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST); + // alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE); + baselineShift = pList.get(PR_BASELINE_SHIFT).getLength(); + blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); + color = pList.get(PR_COLOR).getColorType(); + // dominantBaseline = pList.get(PR_DOMINANT_BASELINE); + height = pList.get(PR_HEIGHT).getLength(); + id = pList.get(PR_ID).getString(); + inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + textDecoration = pList.get(PR_TEXT_DECORATION).getEnum(); + // visibility = pList.get(PR_VISIBILITY); + width = pList.get(PR_WIDTH).getLength(); + wrapOption = pList.get(PR_WRAP_OPTION).getEnum(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + /* 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; + } + } + + checkId(id); + getFOEventHandler().startInline(this); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + getFOEventHandler().endInline(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -100,12 +198,46 @@ public class Inline extends FObjMixed { } } + /** + * Return the Common Margin Properties-Inline. + */ + public CommonMarginInline getCommonMarginInline() { + return commonMarginInline; + } /** - * @see org.apache.fop.fo.FONode#endOfNode + * Return the Common Border, Padding, and Background Properties. */ - protected void endOfNode() throws SAXParseException { - getFOEventHandler().endInline(this); + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + + /** + * Return the Common Font Properties. + */ + public CommonFont getCommonFont() { + return commonFont; + } + + /** + * Return the "color" property. + */ + public ColorType getColor() { + return color; + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "text-decoration" property. + */ + public int getTextDecoration() { + return textDecoration; } /** diff --git a/src/java/org/apache/fop/fo/flow/InlineContainer.java b/src/java/org/apache/fop/fo/flow/InlineContainer.java index 4d375827a..5f7d22e5d 100644 --- a/src/java/org/apache/fop/fo/flow/InlineContainer.java +++ b/src/java/org/apache/fop/fo/flow/InlineContainer.java @@ -27,16 +27,47 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; +import org.apache.fop.datatypes.Numeric; import org.apache.fop.layoutmgr.LayoutManager; import org.apache.fop.layoutmgr.ICLayoutManager; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonMarginInline; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; /** * Class modelling the fo:inline-container object. * @todo implement validateChildNode() */ public class InlineContainer extends FObj { + // The value of properties relevant for fo:inline-container. + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonMarginInline commonMarginInline; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty alignmentAdjust; + // private ToBeImplementedProperty alignmentBaseline; + private Length baselineShift; + private LengthRangeProperty blockProgressionDimension; + // private ToBeImplementedProperty clip; + private int displayAlign; + // private ToBeImplementedProperty dominantBaseline; + private Length height; + private String id; + private LengthRangeProperty inlineProgressionDimension; + private KeepProperty keepTogether; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private Length lineHeight; + private int overflow; + private Numeric referenceOrientation; + private Length width; + private int writingMode; + // End of property values /** * @param parent FONode that is the parent of this object @@ -45,6 +76,40 @@ public class InlineContainer extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonMarginInline = pList.getMarginInlineProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST); + // alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE); + baselineShift = pList.get(PR_BASELINE_SHIFT).getLength(); + blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); + // clip = pList.get(PR_CLIP); + displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum(); + // dominantBaseline = pList.get(PR_DOMINANT_BASELINE); + height = pList.get(PR_HEIGHT).getLength(); + id = pList.get(PR_ID).getString(); + inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + overflow = pList.get(PR_OVERFLOW).getEnum(); + referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric(); + width = pList.get(PR_WIDTH).getLength(); + writingMode = pList.get(PR_WRITING_MODE).getEnum(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -52,6 +117,13 @@ public class InlineContainer extends FObj { super.addProperties(attlist); } + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java index 952afe133..debf9b9a5 100644 --- a/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -26,9 +26,18 @@ import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; +import org.apache.fop.fo.FObj; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonMarginInline; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; import org.apache.fop.layoutmgr.InstreamForeignObjectLM; -import org.apache.fop.fo.FObj; /** * The instream-foreign-object flow formatting object. @@ -36,6 +45,35 @@ import org.apache.fop.fo.FObj; * xml data. */ public class InstreamForeignObject extends FObj { + // The value of properties relevant for fo:instream-foreign-object. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonMarginInline commonMarginInline; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty alignmentAdjust; + // private ToBeImplementedProperty alignmentBaseline; + private Length baselineShift; + private LengthRangeProperty blockProgressionDimension; + // private ToBeImplementedProperty clip; + private Length contentHeight; + // private ToBeImplementedProperty contentType; + private Length contentWidth; + private int displayAlign; + // private ToBeImplementedProperty dominantBaseline; + private Length height; + private String id; + private LengthRangeProperty inlineProgressionDimension; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private Length lineHeight; + private int overflow; + private int scaling; + // private ToBeImplementedProperty scalingMethod; + private int textAlign; + private int verticalAlign; // shorthand!!! + private Length width; + // End of property values /** * constructs an instream-foreign-object object (called by Maker). @@ -47,16 +85,43 @@ public class InstreamForeignObject extends FObj { } /** - * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) - * XSL Content Model: one (1) non-XSL namespace child + * @see org.apache.fop.fo.FObj#bind(PropertyList) */ - protected void validateChildNode(Locator loc, String nsURI, String localName) - throws SAXParseException { - if (nsURI == FO_URI) { - invalidChildError(loc, nsURI, localName); - } else if (childNodes != null) { - tooManyNodesError(loc, "child element"); - } + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonMarginInline = pList.getMarginInlineProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST); + // alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE); + baselineShift = pList.get(PR_BASELINE_SHIFT).getLength(); + blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); + // clip = pList.get(PR_CLIP); + contentHeight = pList.get(PR_CONTENT_HEIGHT).getLength(); + // contentType = pList.get(PR_CONTENT_TYPE); + contentWidth = pList.get(PR_CONTENT_WIDTH).getLength(); + displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum(); + // dominantBaseline = pList.get(PR_DOMINANT_BASELINE); + height = pList.get(PR_HEIGHT).getLength(); + id = pList.get(PR_ID).getString(); + inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + overflow = pList.get(PR_OVERFLOW).getEnum(); + scaling = pList.get(PR_SCALING).getEnum(); + // scalingMethod = pList.get(PR_SCALING_METHOD); + textAlign = pList.get(PR_TEXT_ALIGN).getEnum(); + verticalAlign = pList.get(PR_VERTICAL_ALIGN).getEnum(); + width = pList.get(PR_WIDTH).getLength(); + } + + /** + * @see org.apache.fop.fo.FONode#start + */ + protected void startOfNode() throws SAXParseException { + checkId(id); } /** @@ -70,6 +135,19 @@ public class InstreamForeignObject extends FObj { } } + /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + * XSL Content Model: one (1) non-XSL namespace child + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { + if (nsURI == FO_URI) { + invalidChildError(loc, nsURI, localName); + } else if (childNodes != null) { + tooManyNodesError(loc, "child element"); + } + } + public int computeXOffset (int ipd, int cwidth) { int xoffset = 0; int ta = getPropEnum(PR_TEXT_ALIGN); @@ -108,6 +186,83 @@ public class InstreamForeignObject extends FObj { return yoffset; } + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "line-height" property. + */ + public Length getLineHeight() { + return lineHeight; + } + + /** + * Return the "inline-progression-dimension" property. + */ + public LengthRangeProperty getInlineProgressionDimension() { + return inlineProgressionDimension; + } + + /** + * Return the "block-progression-dimension" property. + */ + public LengthRangeProperty getBlockProgressionDimension() { + return blockProgressionDimension; + } + + /** + * Return the "height" property. + */ + public Length getHeight() { + return height; + } + + /** + * Return the "width" property. + */ + public Length getWidth() { + return width; + } + + /** + * Return the "content-height" property. + */ + public Length getContentHeight() { + return contentHeight; + } + + /** + * Return the "content-width" property. + */ + public Length getContentWidth() { + return contentWidth; + } + + /** + * Return the "scaling" property. + */ + public int getScaling() { + return scaling; + } + + /** + * Return the "vertical-align" property. + */ + public int getVerticalAlign() { + return verticalAlign; + } + + /** + * Return the "overflow" property. + */ + public int getOverflow() { + return overflow; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/Leader.java b/src/java/org/apache/fop/fo/flow/Leader.java index b18d2e17d..d5752907a 100644 --- a/src/java/org/apache/fop/fo/flow/Leader.java +++ b/src/java/org/apache/fop/fo/flow/Leader.java @@ -21,11 +21,24 @@ package org.apache.fop.fo.flow; // Java import java.util.List; +// XML +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.FObjMixed; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonMarginInline; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; +import org.apache.fop.fo.properties.SpaceProperty; import org.apache.fop.fo.properties.PercentLength; import org.apache.fop.fonts.Font; import org.apache.fop.layoutmgr.LeaderLayoutManager; @@ -37,10 +50,37 @@ import org.apache.fop.layoutmgr.LeaderLayoutManager; * @todo implement validateChildNode() */ public class Leader extends FObjMixed { - - private int ruleStyle; - private int ruleThickness; + // The value of properties relevant for fo:leader. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonFont commonFont; + private CommonMarginInline commonMarginInline; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty alignmentAdjust; + // private ToBeImplementedProperty alignmentBaseline; + private Length baselineShift; + private ColorType color; + // private ToBeImplementedProperty dominantBaseline; + // private ToBeImplementedProperty textDepth; + // private ToBeImplementedProperty textAltitude; + private String id; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private int leaderAlignment; + private LengthRangeProperty leaderLength; private int leaderPattern; + private Length leaderPatternWidth; + private int ruleStyle; + private Length ruleThickness; + // private ToBeImplementedProperty letterSpacing; + private Length lineHeight; + // private ToBeImplementedProperty textShadow; + // private ToBeImplementedProperty visibility; + private SpaceProperty wordSpacing; + // End of property values + + private int _ruleThickness; private int patternWidth; /** FontState for this object */ protected Font fontState; @@ -52,6 +92,61 @@ public class Leader extends FObjMixed { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonFont = pList.getFontProps(); + commonMarginInline = pList.getMarginInlineProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST); + // alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE); + baselineShift = pList.get(PR_BASELINE_SHIFT).getLength(); + color = pList.get(PR_COLOR).getColorType(); + // dominantBaseline = pList.get(PR_DOMINANT_BASELINE); + // textDepth = pList.get(PR_TEXT_DEPTH); + // textAltitude = pList.get(PR_TEXT_ALTITUDE); + id = pList.get(PR_ID).getString(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + leaderAlignment = pList.get(PR_LEADER_ALIGNMENT).getEnum(); + leaderLength = pList.get(PR_LEADER_LENGTH).getLengthRange(); + leaderPattern = pList.get(PR_LEADER_PATTERN).getEnum(); + leaderPatternWidth = pList.get(PR_LEADER_PATTERN_WIDTH).getLength(); + switch(leaderPattern) { + case LeaderPattern.SPACE: + // use Space + break; + case LeaderPattern.RULE: + // the following properties only apply + // for leader-pattern = "rule" + ruleStyle = pList.get(PR_RULE_STYLE).getEnum(); + ruleThickness = pList.get(PR_RULE_THICKNESS).getLength(); + 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; + } + // letterSpacing = pList.get(PR_LETTER_SPACING); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + // textShadow = pList.get(PR_TEXT_SHADOW); + // visibility = pList.get(PR_VISIBILITY); + wordSpacing = pList.get(PR_WORD_SPACING).getSpace(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + } + /** * @todo convert to addProperties() */ @@ -75,7 +170,7 @@ public class Leader extends FObjMixed { case LeaderPattern.RULE: // the following properties only apply // for leader-pattern = "rule" - ruleThickness = getPropLength(PR_RULE_THICKNESS); + _ruleThickness = getPropLength(PR_RULE_THICKNESS); ruleStyle = getPropEnum(PR_RULE_STYLE); break; case LeaderPattern.DOTS: @@ -104,24 +199,73 @@ public class Leader extends FObjMixed { return length; } + public int getRuleThickness() { + return _ruleThickness; + } + + public Font getFontState() { + return fontState; + } + + public int getPatternWidth() { + return patternWidth; + } + + /** + * Return the Common Font Properties. + */ + public CommonFont getCommonFont() { + return commonFont; + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "rule-style" property. + */ public int getRuleStyle() { return ruleStyle; } - public int getRuleThickness() { + /** + * Return the "rule-thickness" property. + * TODO: 31699 + */ + public Length ___getRuleThickness() { return ruleThickness; } - public int getLeaderPattern() { - return leaderPattern; + /** + * Return the "leader-alignment" property. + */ + public int getLeaderAlignment() { + return leaderAlignment; } - public Font getFontState() { - return fontState; + /** + * Return the "leader-length" property. + */ + public LengthRangeProperty getLeaderLength() { + return leaderLength; } - public int getPatternWidth() { - return patternWidth; + /** + * Return the "leader-pattern" property. + */ + public int getLeaderPattern() { + return leaderPattern; + } + + /** + * Return the "leader-pattern-width" property. + */ + public Length getLeaderPatternWidth() { + return leaderPatternWidth; } /** diff --git a/src/java/org/apache/fop/fo/flow/ListBlock.java b/src/java/org/apache/fop/fo/flow/ListBlock.java index 952e9d044..6c99580aa 100644 --- a/src/java/org/apache/fop/fo/flow/ListBlock.java +++ b/src/java/org/apache/fop/fo/flow/ListBlock.java @@ -27,14 +27,38 @@ import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonMarginBlock; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.layoutmgr.list.ListBlockLayoutManager; /** * Class modelling the fo:list-block object. */ public class ListBlock extends FObj { + // The value of properties relevant for fo:list-block. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonMarginBlock commonMarginBlock; + private CommonRelativePosition commonRelativePosition; + private int breakAfter; + private int breakBefore; + private String id; + // private ToBeImplementedProperty intrusionDisplace; + private KeepProperty keepTogether; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private Length provisionalDistanceBetweenStarts; + private Length provisionalLabelSeparation; + // End of property values // used for child node validation private boolean hasListItem = false; @@ -46,6 +70,46 @@ public class ListBlock extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonMarginBlock = pList.getMarginBlockProps(); + commonRelativePosition = pList.getRelativePositionProps(); + breakAfter = pList.get(PR_BREAK_AFTER).getEnum(); + breakBefore = pList.get(PR_BREAK_BEFORE).getEnum(); + id = pList.get(PR_ID).getString(); + // intrusionDisplace = pList.get(PR_INTRUSION_DISPLACE); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + provisionalDistanceBetweenStarts = pList.get(PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getLength(); + provisionalLabelSeparation = pList.get(PR_PROVISIONAL_LABEL_SEPARATION).getLength(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startList(this); + } + + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (!hasListItem) { + missingChildElementError("marker* (list-item)+"); + } + getFOEventHandler().endList(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -60,27 +124,36 @@ public class ListBlock extends FObj { */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws SAXParseException { - if (nsURI == FO_URI && localName.equals("marker")) { - if (hasListItem) { - nodesOutOfOrderError(loc, "fo:marker", "fo:list-item"); - } - } else if (nsURI == FO_URI && localName.equals("list-item")) { - hasListItem = true; - } else { - invalidChildError(loc, nsURI, localName); + if (nsURI == FO_URI && localName.equals("marker")) { + if (hasListItem) { + nodesOutOfOrderError(loc, "fo:marker", "fo:list-item"); } + } else if (nsURI == FO_URI && localName.equals("list-item")) { + hasListItem = true; + } else { + invalidChildError(loc, nsURI, localName); + } } /** - * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. - * @see org.apache.fop.fo.FONode#endOfNode + * Return the Common Margin Properties-Block. */ - protected void endOfNode() throws SAXParseException { - if (!hasListItem) { - missingChildElementError("marker* (list-item)+"); - } - getFOEventHandler().endList(this); + public CommonMarginBlock getCommonMarginBlock() { + return commonMarginBlock; + } + + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; } /** diff --git a/src/java/org/apache/fop/fo/flow/ListItem.java b/src/java/org/apache/fop/fo/flow/ListItem.java index 3a46abe35..6b04f22e1 100644 --- a/src/java/org/apache/fop/fo/flow/ListItem.java +++ b/src/java/org/apache/fop/fo/flow/ListItem.java @@ -29,12 +29,34 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonMarginBlock; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.layoutmgr.list.ListItemLayoutManager; /** * Class modelling the fo:list-item object. */ public class ListItem extends FObj { + // The value of properties relevant for fo:list-item. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonMarginBlock commonMarginBlock; + private CommonRelativePosition commonRelativePosition; + private int breakAfter; + private int breakBefore; + private String id; + // private ToBeImplementedProperty intrusionDisplace; + private KeepProperty keepTogether; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private int relativeAlign; + // End of property values private ListItemLabel label = null; private ListItemBody body = null; @@ -46,6 +68,45 @@ public class ListItem extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonMarginBlock = pList.getMarginBlockProps(); + commonRelativePosition = pList.getRelativePositionProps(); + breakAfter = pList.get(PR_BREAK_AFTER).getEnum(); + breakBefore = pList.get(PR_BREAK_BEFORE).getEnum(); + id = pList.get(PR_ID).getString(); + // intrusionDisplace = pList.get(PR_INTRUSION_DISPLACE); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + relativeAlign = pList.get(PR_RELATIVE_ALIGN).getEnum(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startListItem(this); + } + + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (label == null || body == null) { + missingChildElementError("marker* (list-item-label,list-item-body)"); + } + getFOEventHandler().endListItem(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -60,23 +121,23 @@ public class ListItem extends FObj { */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws SAXParseException { - if (nsURI == FO_URI && localName.equals("marker")) { - if (label != null) { - nodesOutOfOrderError(loc, "fo:marker", "fo:list-item-label"); - } - } else if (nsURI == FO_URI && localName.equals("list-item-label")) { - if (label != null) { - tooManyNodesError(loc, "fo:list-item-label"); - } - } else if (nsURI == FO_URI && localName.equals("list-item-body")) { - if (label == null) { - nodesOutOfOrderError(loc, "fo:list-item-label", "fo:list-item-body"); - } else if (body != null) { - tooManyNodesError(loc, "fo:list-item-body"); - } - } else { - invalidChildError(loc, nsURI, localName); + if (nsURI == FO_URI && localName.equals("marker")) { + if (label != null) { + nodesOutOfOrderError(loc, "fo:marker", "fo:list-item-label"); + } + } else if (nsURI == FO_URI && localName.equals("list-item-label")) { + if (label != null) { + tooManyNodesError(loc, "fo:list-item-label"); } + } else if (nsURI == FO_URI && localName.equals("list-item-body")) { + if (label == null) { + nodesOutOfOrderError(loc, "fo:list-item-label", "fo:list-item-body"); + } else if (body != null) { + tooManyNodesError(loc, "fo:list-item-body"); + } + } else { + invalidChildError(loc, nsURI, localName); + } } /** @@ -97,15 +158,10 @@ public class ListItem extends FObj { } /** - * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. - * @see org.apache.fop.fo.FONode#endOfNode + * Return the "id" property. */ - protected void endOfNode() throws SAXParseException { - if (label == null || body == null) { - missingChildElementError("marker* (list-item-label,list-item-body)"); - } - getFOEventHandler().endListItem(this); + public String getId() { + return id; } /** diff --git a/src/java/org/apache/fop/fo/flow/ListItemBody.java b/src/java/org/apache/fop/fo/flow/ListItemBody.java index 73a7f47a3..2b936f68a 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemBody.java +++ b/src/java/org/apache/fop/fo/flow/ListItemBody.java @@ -18,15 +18,26 @@ package org.apache.fop.fo.flow; +// XML +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.KeepProperty; /** * Class modelling the fo:list-item-body object. * @todo implement validateChildNode() */ public class ListItemBody extends FObj { + // The value of properties relevant for fo:list-item-body. + private CommonAccessibility commonAccessibility; + private String id; + private KeepProperty keepTogether; + // End of property values /** * @param parent FONode that is the parent of this object @@ -35,6 +46,30 @@ public class ListItemBody extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + id = pList.get(PR_ID).getString(); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startListBody(); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + getFOEventHandler().endListBody(); + } + /** * @todo convert to addProperties() */ @@ -47,6 +82,16 @@ public class ListItemBody extends FObj { */ } + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * @see org.apache.fop.fo.FObj#getName() + */ public String getName() { return "fo:list-item-body"; } diff --git a/src/java/org/apache/fop/fo/flow/ListItemLabel.java b/src/java/org/apache/fop/fo/flow/ListItemLabel.java index 9f57ac212..f7e3ec063 100644 --- a/src/java/org/apache/fop/fo/flow/ListItemLabel.java +++ b/src/java/org/apache/fop/fo/flow/ListItemLabel.java @@ -25,12 +25,20 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.KeepProperty; /** * Class modelling the fo:list-item-label object. * @todo implement validateChildNode() */ public class ListItemLabel extends FObj { + // The value of properties relevant for fo:list-item-label. + private CommonAccessibility commonAccessibility; + private String id; + private KeepProperty keepTogether; + // End of property values /** * @param parent FONode that is the parent of this object @@ -39,6 +47,30 @@ public class ListItemLabel extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + id = pList.get(PR_ID).getString(); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startListLabel(); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + getFOEventHandler().endListLabel(); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -53,11 +85,16 @@ public class ListItemLabel extends FObj { */ } - protected void endOfNode() throws SAXParseException { - super.endOfNode(); - getFOEventHandler().endListLabel(); + /** + * Return the "id" property. + */ + public String getId() { + return id; } - + + /** + * @see org.apache.fop.fo.FObj#getName() + */ public String getName() { return "fo:list-item-label"; } diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java index 347b480af..066d40189 100644 --- a/src/java/org/apache/fop/fo/flow/Marker.java +++ b/src/java/org/apache/fop/fo/flow/Marker.java @@ -26,11 +26,15 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.PropertyList; /** * Marker formatting object. */ public class Marker extends FObjMixed { + // The value of properties relevant for fo:marker. + private String markerClassName; + // End of property values /** * Create a marker fo. @@ -40,6 +44,13 @@ public class Marker extends FObjMixed { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) throws SAXParseException { + markerClassName = pList.get(PR_MARKER_CLASS_NAME).getString(); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -62,6 +73,13 @@ public class Marker extends FObjMixed { } } + /** + * Return the "marker-class-name" property. + */ + public String getMarkerClassName() { + return markerClassName; + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/flow/MultiCase.java b/src/java/org/apache/fop/fo/flow/MultiCase.java index 4ec5ea6c1..5ad05fd0a 100644 --- a/src/java/org/apache/fop/fo/flow/MultiCase.java +++ b/src/java/org/apache/fop/fo/flow/MultiCase.java @@ -18,15 +18,27 @@ package org.apache.fop.fo.flow; +// XML +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; /** * Class modelling the fo:multi-case object. * @todo implement validateChildNode() */ public class MultiCase extends FObj { + // The value of properties relevant for fo:multi-case. + private CommonAccessibility commonAccessibility; + private String id; + // private ToBeImplementedProperty startingState; + // private ToBeImplementedProperty caseName; + // private ToBeImplementedProperty caseTitle; + // End of property values static boolean notImplementedWarningGiven = false; @@ -42,6 +54,24 @@ public class MultiCase extends FObj { } } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + id = pList.get(PR_ID).getString(); + // startingState = pList.get(PR_STARTING_STATE); + // caseName = pList.get(PR_CASE_NAME); + // caseTitle = pList.get(PR_CASE_TITLE); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/flow/MultiProperties.java b/src/java/org/apache/fop/fo/flow/MultiProperties.java index 7668ee648..9400df421 100644 --- a/src/java/org/apache/fop/fo/flow/MultiProperties.java +++ b/src/java/org/apache/fop/fo/flow/MultiProperties.java @@ -25,11 +25,17 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; /** * Class modelling the fo:multi-properties object. */ public class MultiProperties extends FObj { + // The value of properties relevant for fo:multi-properties. + private CommonAccessibility commonAccessibility; + private String id; + // End of property values static boolean notImplementedWarningGiven = false; @@ -49,6 +55,32 @@ public class MultiProperties extends FObj { } } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + id = pList.get(PR_ID).getString(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + } + + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (!hasMultiPropertySet || !hasWrapper) { + missingChildElementError("(multi-property-set+, wrapper)"); + } + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: (multi-property-set+, wrapper) @@ -73,16 +105,12 @@ public class MultiProperties extends FObj { } /** - * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. - * @see org.apache.fop.fo.FONode#endOfNode + * Return the "id" property. */ - protected void endOfNode() throws SAXParseException { - if (!hasMultiPropertySet || !hasWrapper) { - missingChildElementError("(multi-property-set+, wrapper)"); - } + public String getId() { + return id; } - + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java index 09a99fb10..f476d187d 100644 --- a/src/java/org/apache/fop/fo/flow/MultiPropertySet.java +++ b/src/java/org/apache/fop/fo/flow/MultiPropertySet.java @@ -25,11 +25,16 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; /** * Class modelling the fo:multi-property-set object. */ public class MultiPropertySet extends FObj { + // The value of properties relevant for fo:multi-property-set. + private String id; + // private ToBeImplementedProperty activeState; + // End of property values static boolean notImplementedWarningGiven = false; @@ -45,6 +50,21 @@ public class MultiPropertySet extends FObj { } } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + id = pList.get(PR_ID).getString(); + // activeState = pList.get(PR_ACTIVE_STATE); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty @@ -54,6 +74,13 @@ public class MultiPropertySet extends FObj { invalidChildError(loc, nsURI, localName); } + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/flow/MultiSwitch.java b/src/java/org/apache/fop/fo/flow/MultiSwitch.java index 77f859215..f0a72a0ad 100644 --- a/src/java/org/apache/fop/fo/flow/MultiSwitch.java +++ b/src/java/org/apache/fop/fo/flow/MultiSwitch.java @@ -25,12 +25,19 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; /** * Class modelling the fo:multi-switch object. * @todo needs implementation */ public class MultiSwitch extends FObj { + // The value of properties relevant for fo:multi-switch. + private CommonAccessibility commonAccessibility; + // private ToBeImplementedProperty autoRestore; + private String id; + // End of property values static boolean notImplementedWarningGiven = false; @@ -46,6 +53,32 @@ public class MultiSwitch extends FObj { } } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + // autoRestore = pList.get(PR_AUTO_RESTORE); + id = pList.get(PR_ID).getString(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + } + + /** + * Make sure content model satisfied. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (childNodes == null) { + missingChildElementError("(multi-case+)"); + } + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: (multi-case+) @@ -58,13 +91,10 @@ public class MultiSwitch extends FObj { } /** - * Make sure content model satisfied. - * @see org.apache.fop.fo.FONode#endOfNode + * Return the "id" property. */ - protected void endOfNode() throws SAXParseException { - if (childNodes == null) { - missingChildElementError("(multi-case+)"); - } + public String getId() { + return id; } /** diff --git a/src/java/org/apache/fop/fo/flow/MultiToggle.java b/src/java/org/apache/fop/fo/flow/MultiToggle.java index 3d78a7476..d4bc23628 100644 --- a/src/java/org/apache/fop/fo/flow/MultiToggle.java +++ b/src/java/org/apache/fop/fo/flow/MultiToggle.java @@ -21,13 +21,19 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; /** * Class modelling the fo:multi-toggle property. * @todo implement validateChildNode() */ public class MultiToggle extends FObj { - + // The value of properties relevant for fo:multi-toggle. + private CommonAccessibility commonAccessibility; + // public ToBeImplementedProperty prSwitchTo; + // End of property values + static boolean notImplementedWarningGiven = false; /** @@ -42,6 +48,19 @@ public class MultiToggle extends FObj { } } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + // prSwitchTo = pList.get(PR_SWITCH_TO); + + if (!notImplementedWarningGiven) { + getLogger().warn("fo:multi-toggle is not yet implemented."); + notImplementedWarningGiven = true; + } + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/flow/PageNumber.java b/src/java/org/apache/fop/fo/flow/PageNumber.java index 022d8dcf2..5671cddb2 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumber.java +++ b/src/java/org/apache/fop/fo/flow/PageNumber.java @@ -28,8 +28,18 @@ 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; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonMarginInline; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.SpaceProperty; import org.apache.fop.fonts.Font; import org.apache.fop.layoutmgr.PageNumberLayoutManager; @@ -37,13 +47,39 @@ import org.apache.fop.layoutmgr.PageNumberLayoutManager; * Class modelling the fo:page-number object. */ public class PageNumber extends FObj { + // The value of properties relevant for fo:page-number. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonFont commonFont; + private CommonMarginInline commonMarginInline; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty alignmentAdjust; + // private ToBeImplementedProperty alignmentBaseline; + private Length baselineShift; + // private ToBeImplementedProperty dominantBaseline; + private String id; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + // private ToBeImplementedProperty letterSpacing; + private Length lineHeight; + // private ToBeImplementedProperty scoreSpaces; + // private ToBeImplementedProperty textAltitude; + private int textDecoration; + // private ToBeImplementedProperty textDepth; + // private ToBeImplementedProperty textShadow; + private int textTransform; + // private ToBeImplementedProperty visibility; + private SpaceProperty wordSpacing; + private int wrapOption; + // End of property values + /** FontState for this object */ protected Font fontState; private float red; private float green; private float blue; - private int wrapOption; /** * @param parent FONode that is the parent of this object @@ -52,6 +88,51 @@ public class PageNumber extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonFont = pList.getFontProps(); + commonMarginInline = pList.getMarginInlineProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST); + // alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE); + baselineShift = pList.get(PR_BASELINE_SHIFT).getLength(); + // dominantBaseline = pList.get(PR_DOMINANT_BASELINE); + id = pList.get(PR_ID).getString(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + // letterSpacing = pList.get(PR_LETTER_SPACING); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + // scoreSpaces = pList.get(PR_SCORE_SPACES); + // textAltitude = pList.get(PR_TEXT_ALTITUDE); + textDecoration = pList.get(PR_TEXT_DECORATION).getEnum(); + // textDepth = pList.get(PR_TEXT_DEPTH); + // textShadow = pList.get(PR_TEXT_SHADOW); + textTransform = pList.get(PR_TEXT_TRANSFORM).getEnum(); + // visibility = pList.get(PR_VISIBILITY); + wordSpacing = pList.get(PR_WORD_SPACING).getSpace(); + wrapOption = pList.get(PR_WRAP_OPTION).getEnum(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startPageNumber(this); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + getFOEventHandler().endPageNumber(this); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty @@ -86,10 +167,34 @@ public class PageNumber extends FObj { return fontState; } - protected void endOfNode() throws SAXParseException { - getFOEventHandler().endPageNumber(this); + /** + * Return the Common Font Properties. + */ + public CommonFont getCommonFont() { + return commonFont; + } + + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; } - + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "text-decoration" property. + */ + public int getTextDecoration() { + return textDecoration; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ @@ -104,7 +209,10 @@ public class PageNumber extends FObj { public String getName() { return "fo:page-number"; } - + + /** + * @see org.apache.fop.fo.FObj#getNameId() + */ public int getNameId() { return FO_PAGE_NUMBER; } diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index c256cec75..89e2b6127 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -27,8 +27,18 @@ import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonMarginInline; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.SpaceProperty; import org.apache.fop.layoutmgr.PageNumberCitationLayoutManager; /** @@ -38,6 +48,33 @@ import org.apache.fop.layoutmgr.PageNumberCitationLayoutManager; * block referenced with the ref-id attribute. */ public class PageNumberCitation extends FObj { + // The value of properties relevant for fo:page-number-citation. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonFont commonFont; + private CommonMarginInline commonMarginInline; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty alignmentAdjust; + // private ToBeImplementedProperty alignmentBaseline; + private Length baselineShift; + // private ToBeImplementedProperty dominantBaseline; + private String id; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + // private ToBeImplementedProperty letterSpacing; + private Length lineHeight; + private String refId; + // private ToBeImplementedProperty scoreSpaces; + // private ToBeImplementedProperty textAltitude; + private int textDecoration; + // private ToBeImplementedProperty textDepth; + // private ToBeImplementedProperty textShadow; + private int textTransform; + // private ToBeImplementedProperty visibility; + private SpaceProperty wordSpacing; + private int wrapOption; + // End of property values /** * @param parent FONode that is the parent of this object @@ -47,12 +84,42 @@ public class PageNumberCitation extends FObj { } /** - * @see org.apache.fop.fo.FObj#addProperties + * @see org.apache.fop.fo.FObj#bind(PropertyList) */ - protected void addProperties(Attributes attlist) throws SAXParseException { - super.addProperties(attlist); + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonFont = pList.getFontProps(); + commonMarginInline = pList.getMarginInlineProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST); + // alignmentBaseline = pList.get(PR_ALIGNMENT_BASELINE); + baselineShift = pList.get(PR_BASELINE_SHIFT).getLength(); + // dominantBaseline = pList.get(PR_DOMINANT_BASELINE); + id = pList.get(PR_ID).getString(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + // letterSpacing = pList.get(PR_LETTER_SPACING); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + refId = pList.get(PR_REF_ID).getString(); + // scoreSpaces = pList.get(PR_SCORE_SPACES); + // textAltitude = pList.get(PR_TEXT_ALTITUDE); + textDecoration = pList.get(PR_TEXT_DECORATION).getEnum(); + // textDepth = pList.get(PR_TEXT_DEPTH); + // textShadow = pList.get(PR_TEXT_SHADOW); + textTransform = pList.get(PR_TEXT_TRANSFORM).getEnum(); + // visibility = pList.get(PR_VISIBILITY); + wordSpacing = pList.get(PR_WORD_SPACING).getSpace(); + wrapOption = pList.get(PR_WRAP_OPTION).getEnum(); + } - if (getPropString(PR_REF_ID) == null || getPropString(PR_REF_ID).equals("")) { + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + if (refId.equals("")) { missingPropertyError("ref-id"); } } @@ -66,6 +133,38 @@ public class PageNumberCitation extends FObj { invalidChildError(loc, nsURI, localName); } + /** + * @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() { + return commonFont; + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "ref-id" property. + */ + public String getRefId() { + return refId; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java index c983f6b5b..a944b69bd 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java @@ -29,6 +29,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.PropertyList; import org.apache.fop.layoutmgr.RetrieveMarkerLayoutManager; @@ -38,10 +39,11 @@ import org.apache.fop.layoutmgr.RetrieveMarkerLayoutManager; * a marker based on the information. */ public class RetrieveMarker extends FObjMixed { - + // The value of properties relevant for fo:retrieve-marker. private String retrieveClassName; private int retrievePosition; private int retrieveBoundary; + // End of property values /** * Create a retrieve marker object. @@ -52,6 +54,15 @@ public class RetrieveMarker extends FObjMixed { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString(); + retrievePosition = pList.get(PR_RETRIEVE_POSITION).getEnum(); + retrieveBoundary = pList.get(PR_RETRIEVE_BOUNDARY).getEnum(); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -71,18 +82,28 @@ public class RetrieveMarker extends FObjMixed { invalidChildError(loc, nsURI, localName); } + /** + * Return the "retrieve-class-name" property. + */ public String getRetrieveClassName() { return retrieveClassName; } + /** + * Return the "retrieve-position" property. + */ public int getRetrievePosition() { return retrievePosition; } + /** + * Return the "retrieve-boundry" property. + */ public int getRetrieveBoundary() { return retrieveBoundary; } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/Table.java b/src/java/org/apache/fop/fo/flow/Table.java index 2ccc2c00c..b9457a2e4 100644 --- a/src/java/org/apache/fop/fo/flow/Table.java +++ b/src/java/org/apache/fop/fo/flow/Table.java @@ -29,17 +29,55 @@ 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; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonMarginBlock; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.LengthPairProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; import org.apache.fop.layoutmgr.table.TableLayoutManager; import org.apache.fop.layoutmgr.table.Body; import org.apache.fop.layoutmgr.table.Column; -import org.apache.fop.fo.properties.LengthRangeProperty; /** * Class modelling the fo:table object. */ public class Table extends FObj { + // The value of properties relevant for fo:table. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonMarginBlock commonMarginBlock; + private CommonRelativePosition commonRelativePosition; + private LengthRangeProperty blockProgressionDimension; + // private ToBeImplementedProperty borderAfterPrecedence; + // private ToBeImplementedProperty borderBeforePrecedence; + private int borderCollapse; + // private ToBeImplementedProperty borderEndPrecedence; + private LengthPairProperty borderSeparation; + // private ToBeImplementedProperty borderStartPrecedence; + private int breakAfter; + private int breakBefore; + private String id; + private LengthRangeProperty inlineProgressionDimension; + // private ToBeImplementedProperty intrusionDisplace; + private Length height; + private KeepProperty keepTogether; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private int tableLayout; + private int tableOmitFooterAtBreak; + private int tableOmitHeaderAtBreak; + private Length width; + private int writingMode; + // End of property values + private static final int MINCOLWIDTH = 10000; // 10pt /** collection of columns in this table */ @@ -49,13 +87,11 @@ public class Table extends FObj { private boolean omitHeaderAtBreak = false; private boolean omitFooterAtBreak = false; - private int breakBefore; - private int breakAfter; private int spaceBefore; private int spaceAfter; private ColorType backgroundColor; private LengthRangeProperty ipd; - private int height; + private int _height; private boolean bAutoLayout = false; private int contentWidth = 0; // Sum of column widths @@ -73,6 +109,53 @@ public class Table extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonMarginBlock = pList.getMarginBlockProps(); + commonRelativePosition = pList.getRelativePositionProps(); + blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); + // borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE); + // borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE); + borderCollapse = pList.get(PR_BORDER_COLLAPSE).getEnum(); + // borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE); + borderSeparation = pList.get(PR_BORDER_SEPARATION).getLengthPair(); + // borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE); + breakAfter = pList.get(PR_BREAK_AFTER).getEnum(); + breakBefore = pList.get(PR_BREAK_BEFORE).getEnum(); + id = pList.get(PR_ID).getString(); + inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); + // intrusionDisplace = pList.get(PR_INTRUSION_DISPLACE); + height = pList.get(PR_HEIGHT).getLength(); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + tableLayout = pList.get(PR_TABLE_LAYOUT).getEnum(); + tableOmitFooterAtBreak = pList.get(PR_TABLE_OMIT_FOOTER_AT_BREAK).getEnum(); + tableOmitHeaderAtBreak = pList.get(PR_TABLE_OMIT_HEADER_AT_BREAK).getEnum(); + width = pList.get(PR_WIDTH).getLength(); + writingMode = pList.get(PR_WRITING_MODE).getEnum(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startTable(this); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + getFOEventHandler().endTable(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -86,7 +169,7 @@ public class Table extends FObj { this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); this.ipd = this.propertyList.get( PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); - this.height = getPropLength(PR_HEIGHT); + this._height = getPropLength(PR_HEIGHT); this.bAutoLayout = (getPropEnum(PR_TABLE_LAYOUT) == TableLayout.AUTO); this.omitHeaderAtBreak = getPropEnum(PR_TABLE_OMIT_HEADER_AT_BREAK) @@ -96,10 +179,6 @@ public class Table extends FObj { getFOEventHandler().startTable(this); } - protected void endOfNode() throws SAXParseException { - getFOEventHandler().endTable(this); - } - /** * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ @@ -131,6 +210,27 @@ public class Table extends FObj { return tableFooter; } + /** + * Return the Common Margin Properties-Block. + */ + public CommonMarginBlock getCommonMarginBlock() { + return commonMarginBlock; + } + + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) * @todo see if can/should move much of this logic into TableLayoutManager diff --git a/src/java/org/apache/fop/fo/flow/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/TableAndCaption.java index 45b15b1f8..beadf6279 100644 --- a/src/java/org/apache/fop/fo/flow/TableAndCaption.java +++ b/src/java/org/apache/fop/fo/flow/TableAndCaption.java @@ -25,13 +25,36 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonMarginBlock; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; /** * Class modelling the fo:table-and-caption property. * @todo needs implementation */ public class TableAndCaption extends FObj { - + // The value of properties relevant for fo:table-and-caption. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonMarginBlock commonMarginBlock; + private CommonRelativePosition commonRelativePosition; + private int breakAfter; + private int breakBefore; + private int captionSide; + private String id; + // private ToBeImplementedProperty intrusionDisplace; + private KeepProperty keepTogether; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + private int textAlign; + // End of property values + static boolean notImplementedWarningGiven = false; /** used for FO validation */ @@ -51,35 +74,30 @@ public class TableAndCaption extends FObj { } /** - * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) - * XSL Content Model: marker* table-caption? table + * @see org.apache.fop.fo.FObj#bind(PropertyList) */ - protected void validateChildNode(Locator loc, String nsURI, String localName) - throws SAXParseException { + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonMarginBlock = pList.getMarginBlockProps(); + commonRelativePosition = pList.getRelativePositionProps(); + breakAfter = pList.get(PR_BREAK_AFTER).getEnum(); + breakBefore = pList.get(PR_BREAK_BEFORE).getEnum(); + captionSide = pList.get(PR_CAPTION_SIDE).getEnum(); + id = pList.get(PR_ID).getString(); + // intrusionDisplace = pList.get(PR_INTRUSION_DISPLACE); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + textAlign = pList.get(PR_TEXT_ALIGN).getEnum(); + } - if (nsURI == FO_URI && localName.equals("marker")) { - if (tableCaptionFound) { - nodesOutOfOrderError(loc, "fo:marker", "fo:table-caption"); - } else if (tableFound) { - nodesOutOfOrderError(loc, "fo:marker", "fo:table"); - } - } else if (nsURI == FO_URI && localName.equals("table-caption")) { - if (tableCaptionFound) { - tooManyNodesError(loc, "fo:table-caption"); - } else if (tableFound) { - nodesOutOfOrderError(loc, "fo:table-caption", "fo:table"); - } else { - tableCaptionFound = true; - } - } else if (nsURI == FO_URI && localName.equals("table")) { - if (tableFound) { - tooManyNodesError(loc, "fo:table"); - } else { - tableFound = true; - } - } else { - invalidChildError(loc, nsURI, localName); - } + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); } /** @@ -93,6 +111,45 @@ public class TableAndCaption extends FObj { } } + /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + * XSL Content Model: marker* table-caption? table + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { + + if (nsURI == FO_URI && localName.equals("marker")) { + if (tableCaptionFound) { + nodesOutOfOrderError(loc, "fo:marker", "fo:table-caption"); + } else if (tableFound) { + nodesOutOfOrderError(loc, "fo:marker", "fo:table"); + } + } else if (nsURI == FO_URI && localName.equals("table-caption")) { + if (tableCaptionFound) { + tooManyNodesError(loc, "fo:table-caption"); + } else if (tableFound) { + nodesOutOfOrderError(loc, "fo:table-caption", "fo:table"); + } else { + tableCaptionFound = true; + } + } else if (nsURI == FO_URI && localName.equals("table")) { + if (tableFound) { + tooManyNodesError(loc, "fo:table"); + } else { + tableFound = true; + } + } else { + invalidChildError(loc, nsURI, localName); + } + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index fedd50321..80cc2e51d 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -29,6 +29,11 @@ import org.xml.sax.SAXParseException; import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonRelativePosition; import org.apache.fop.layoutmgr.table.Body; /** @@ -36,7 +41,18 @@ import org.apache.fop.layoutmgr.table.Body; * @todo implement validateChildNode() */ public class TableBody extends FObj { - + // The value of properties relevant for fo:table-body. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty borderAfterPrecedence; + // private ToBeImplementedProperty borderBeforePrecedence; + // private ToBeImplementedProperty borderEndPrecedence; + // private ToBeImplementedProperty borderStartPrecedence; + // private ToBeImplementedProperty visibility; + // End of property values + private int spaceBefore; private int spaceAfter; private ColorType backgroundColor; @@ -48,6 +64,35 @@ public class TableBody extends FObj { super(parent); } + /** + * @see FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE); + // borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE); + // borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE); + // borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE); + // visibility = pList.get(PR_VISIBILITY); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + getFOEventHandler().startBody(this); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + getFOEventHandler().endBody(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -60,8 +105,11 @@ public class TableBody extends FObj { getFOEventHandler().startBody(this); } - protected void endOfNode() throws SAXParseException { - getFOEventHandler().endBody(this); + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; } /** diff --git a/src/java/org/apache/fop/fo/flow/TableCaption.java b/src/java/org/apache/fop/fo/flow/TableCaption.java index 2681ef3d1..f73a8d936 100644 --- a/src/java/org/apache/fop/fo/flow/TableCaption.java +++ b/src/java/org/apache/fop/fo/flow/TableCaption.java @@ -23,14 +23,36 @@ import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; + /** * Class modelling the fo:table-caption object. * @todo needs implementation */ public class TableCaption extends FObj { + // The value of properties relevant for fo:table-caption. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonRelativePosition commonRelativePosition; + private LengthRangeProperty blockProgressionDimension; + private Length height; + private String id; + private LengthRangeProperty inlineProgressionDimension; + // private ToBeImplementedProperty intrusionDisplace; + private KeepProperty keepTogether; + private Length width; + // End of property values /** used for FO validation */ private boolean blockItemFound = false; @@ -49,6 +71,41 @@ public class TableCaption extends FObj { } } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonRelativePosition = pList.getRelativePositionProps(); + blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); + height = pList.get(PR_HEIGHT).getLength(); + id = pList.get(PR_ID).getString(); + inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); + // intrusionDisplace = pList.get(PR_INTRUSION_DISPLACE); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + width = pList.get(PR_WIDTH).getLength(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + } + + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (childNodes == null) { + missingChildElementError("marker* (%block;)"); + } + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: marker* (%block;) @@ -67,14 +124,10 @@ public class TableCaption extends FObj { } /** - * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. - * @see org.apache.fop.fo.FONode#endOfNode + * Return the "id" property. */ - protected void endOfNode() throws SAXParseException { - if (childNodes == null) { - missingChildElementError("marker* (%block;)"); - } + public String getId() { + return id; } /** diff --git a/src/java/org/apache/fop/fo/flow/TableCell.java b/src/java/org/apache/fop/fo/flow/TableCell.java index 84e226f79..d0917e36b 100644 --- a/src/java/org/apache/fop/fo/flow/TableCell.java +++ b/src/java/org/apache/fop/fo/flow/TableCell.java @@ -28,8 +28,17 @@ 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; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.LengthPairProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; import org.apache.fop.layoutmgr.table.Cell; import org.apache.fop.fo.properties.CommonBorderAndPadding; @@ -38,6 +47,31 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding; * @todo check need for all instance variables stored here */ public class TableCell extends FObj { + // The value of properties relevant for fo:table-cell. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty borderAfterPrecedence; + // private ToBeImplementedProperty borderBeforePrecedence; + // private ToBeImplementedProperty borderEndPrecedence; + // private ToBeImplementedProperty borderStartPrecedence; + private LengthRangeProperty blockProgressionDimension; + private int borderCollapse; + private LengthPairProperty borderSeparation; + private Numeric columnNumber; + private int displayAlign; + private int relativeAlign; + // private ToBeImplementedProperty emptyCells; + // private ToBeImplementedProperty endsRow; + private Length height; + private String id; + private LengthRangeProperty inlineProgressionDimension; + private Numeric numberColumnsSpanned; + private Numeric numberRowsSpanned; + // private ToBeImplementedProperty startsRow; + private Length width; + // End of property values // private int spaceBefore; // private int spaceAfter; @@ -60,7 +94,7 @@ public class TableCell extends FObj { * Dimension of allocation rectangle in inline-progression-direction, * determined by the width of the column(s) occupied by the cell */ - protected int width; + protected int _width; /** * Offset of content rectangle, in block-progression-direction, @@ -87,7 +121,7 @@ public class TableCell extends FObj { protected int minCellHeight = 0; /** Height of cell */ - protected int height = 0; + protected int _height = 0; /** Ypos of cell ??? */ protected int top; @@ -110,7 +144,7 @@ public class TableCell extends FObj { * Border separation value in the block-progression dimension. * Used in calculating cells height. */ - private int borderSeparation = 0; + private int _borderSeparation = 0; /** * @param parent FONode that is the parent of this object @@ -119,6 +153,55 @@ public class TableCell extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE); + // borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE); + // borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE); + // borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE); + blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); + borderCollapse = pList.get(PR_BORDER_COLLAPSE).getEnum(); + borderSeparation = pList.get(PR_BORDER_SEPARATION).getLengthPair(); + columnNumber = pList.get(PR_COLUMN_NUMBER).getNumeric(); + displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum(); + relativeAlign = pList.get(PR_RELATIVE_ALIGN).getEnum(); + // emptyCells = pList.get(PR_EMPTY_CELLS); + // endsRow = pList.get(PR_ENDS_ROW); + height = pList.get(PR_HEIGHT).getLength(); + id = pList.get(PR_ID).getString(); + inlineProgressionDimension = pList.get(PR_INLINE_PROGRESSION_DIMENSION).getLengthRange(); + numberColumnsSpanned = pList.get(PR_NUMBER_COLUMNS_SPANNED).getNumeric(); + numberRowsSpanned = pList.get(PR_NUMBER_ROWS_SPANNED).getNumeric(); + // startsRow = pList.get(PR_STARTS_ROW); + width = pList.get(PR_WIDTH).getLength(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startCell(this); + } + + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (!blockItemFound) { + missingChildElementError("marker* (%block;)+"); + } + getFOEventHandler().endCell(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -178,18 +261,6 @@ public class TableCell extends FObj { } } - /** - * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - if (!blockItemFound) { - missingChildElementError("marker* (%block;)+"); - } - getFOEventHandler().endCell(this); - } - /** * Set position relative to table (set by body?) */ @@ -204,7 +275,7 @@ public class TableCell extends FObj { * @param width the width of the cell (in millipoints ??) */ public void setWidth(int width) { - this.width = width; + this._width = width; } /** @@ -252,9 +323,9 @@ public class TableCell extends FObj { + bp.getPaddingEnd(false); // Offset of content rectangle in the block-progression direction - borderSeparation = getPropLength(PR_BORDER_SEPARATION | + _borderSeparation = getPropLength(PR_BORDER_SEPARATION | CP_BLOCK_PROGRESSION_DIRECTION); - this.beforeOffset = borderSeparation / 2 + this.beforeOffset = _borderSeparation / 2 + bp.getBorderBeforeWidth(false) + bp.getPaddingBefore(false); @@ -324,6 +395,42 @@ public class TableCell extends FObj { } } + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + + /** + * @return number of the column containing this cell + * TODO 31699 + */ + public int ___getColumnNumber() { + return columnNumber.getValue(); + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * @return the number of columns spanned by this cell + */ + public int getNumberColumnsSpanned() { + return numberColumnsSpanned.getValue(); + } + + /** + * @return the number of rows spanned by this cell + */ + public int getNumberRowsSpanned() { + return numberRowsSpanned.getValue(); + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java index a6e30f2dc..ad242ede0 100644 --- a/src/java/org/apache/fop/fo/flow/TableColumn.java +++ b/src/java/org/apache/fop/fo/flow/TableColumn.java @@ -26,16 +26,30 @@ 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; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; /** * Class modelling the fo:table-column object. */ public class TableColumn extends FObj { - - private ColorType backgroundColor; + // The value of properties relevant for fo:table-column. + private CommonBorderPaddingBackground commonBorderPaddingBackground; + // private ToBeImplementedProperty borderAfterPrecedence; + // private ToBeImplementedProperty borderBeforePrecedence; + // private ToBeImplementedProperty borderEndPrecedence; + // private ToBeImplementedProperty borderStartPrecedence; + private Numeric columnNumber; private Length columnWidth; + private Numeric numberColumnsRepeated; + private Numeric numberColumnsSpanned; + // private ToBeImplementedProperty visibility; + // End of property values + + private ColorType backgroundColor; private int columnOffset; private int numColumnsRepeated; private int iColumnNumber; @@ -47,6 +61,36 @@ public class TableColumn extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + // borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE); + // borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE); + // borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE); + // borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE); + columnNumber = pList.get(PR_COLUMN_NUMBER).getNumeric(); + columnWidth = pList.get(PR_COLUMN_WIDTH).getLength(); + numberColumnsRepeated = pList.get(PR_NUMBER_COLUMNS_REPEATED).getNumeric(); + numberColumnsSpanned = pList.get(PR_NUMBER_COLUMNS_SPANNED).getNumeric(); + // visibility = pList.get(PR_VISIBILITY); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode() + */ + protected void startOfNode() throws SAXParseException { + getFOEventHandler().startColumn(this); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + getFOEventHandler().endColumn(this); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty @@ -73,33 +117,40 @@ public class TableColumn extends FObj { } /** - * @see org.apache.fop.fo.FONode#endOfNode + * @return value for number of columns repeated */ - protected void endOfNode() throws SAXParseException { - getFOEventHandler().endColumn(this); + public int getNumColumnsRepeated() { + return numColumnsRepeated; + } + + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; } /** - * @return Length object containing column width + * Return the "column-width" property. */ public Length getColumnWidth() { return columnWidth; } /** - * @return column number + * Return the "column-number" property. */ public int getColumnNumber() { - return iColumnNumber; + return columnNumber.getValue(); } /** * @return value for number of columns repeated */ - public int getNumColumnsRepeated() { - return numColumnsRepeated; + public int getNumberColumnsRepeated() { + return numberColumnsRepeated.getValue(); } - + public String getName() { return "fo:table-column"; } diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java index ecae89376..e1c5774d3 100644 --- a/src/java/org/apache/fop/fo/flow/TableRow.java +++ b/src/java/org/apache/fop/fo/flow/TableRow.java @@ -29,8 +29,16 @@ 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; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonRelativePosition; +import org.apache.fop.fo.properties.KeepProperty; +import org.apache.fop.fo.properties.LengthRangeProperty; import org.apache.fop.layoutmgr.table.Row; import org.apache.fop.fo.Constants; import org.apache.fop.fo.properties.Property; @@ -40,15 +48,33 @@ import org.apache.fop.fo.properties.Property; * Class modelling the fo:table-row object. */ public class TableRow extends FObj { - + // The value of properties relevant for fo:table-row. + private CommonAccessibility commonAccessibility; + private LengthRangeProperty blockProgressionDimension; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty borderAfterPrecedence; + // private ToBeImplementedProperty borderBeforePrecedence; + // private ToBeImplementedProperty borderEndPrecedence; + // private ToBeImplementedProperty borderStartPrecedence; + private int breakAfter; + private int breakBefore; + private Length height; + private String id; + private KeepProperty keepTogether; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; + // private ToBeImplementedProperty visibility; + // End of property values + private boolean setup = false; - private int breakAfter; private ColorType backgroundColor; - private KeepValue keepWithNext; - private KeepValue keepWithPrevious; - private KeepValue keepTogether; + private KeepValue _keepWithNext; + private KeepValue _keepWithPrevious; + private KeepValue _keepTogether; private int minHeight = 0; // force row height @@ -59,6 +85,47 @@ public class TableRow extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonRelativePosition = pList.getRelativePositionProps(); + // borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE); + // borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE); + // borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE); + // borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE); + breakAfter = pList.get(PR_BREAK_AFTER).getEnum(); + breakBefore = pList.get(PR_BREAK_BEFORE).getEnum(); + id = pList.get(PR_ID).getString(); + height = pList.get(PR_HEIGHT).getLength(); + keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep(); + keepWithNext = pList.get(PR_KEEP_WITH_NEXT).getKeep(); + keepWithPrevious = pList.get(PR_KEEP_WITH_PREVIOUS).getKeep(); + // visibility = pList.get(PR_VISIBILITY); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + getFOEventHandler().startRow(this); + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (childNodes == null) { + missingChildElementError("(table-cell+)"); + } + getFOEventHandler().endRow(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -78,21 +145,11 @@ public class TableRow extends FObj { } } - /** - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - if (childNodes == null) { - missingChildElementError("(table-cell+)"); - } - getFOEventHandler().endRow(this); - } - /** * @return keepWithPrevious */ public KeepValue getKeepWithPrevious() { - return keepWithPrevious; + return _keepWithPrevious; } /** @@ -103,9 +160,9 @@ public class TableRow extends FObj { 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 = + 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); @@ -127,6 +184,49 @@ public class TableRow extends FObj { } } + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + + /** + * Return the "keep-with-previous" property. + * TODO: 31699 + */ + public KeepProperty ___getKeepWithPrevious() { + return keepWithPrevious; + } + + /** + * Return the "keep-with-next" property. + */ + public KeepProperty getKeepWithNext() { + return keepWithNext; + } + + /** + * Return the "keep-together" property. + */ + public KeepProperty getKeepTogether() { + return keepTogether; + } + + /** + * Return the "height" property. + */ + public Length getHeight() { + return height; + } + + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/flow/Wrapper.java b/src/java/org/apache/fop/fo/flow/Wrapper.java index 589711d07..27cf815be 100644 --- a/src/java/org/apache/fop/fo/flow/Wrapper.java +++ b/src/java/org/apache/fop/fo/flow/Wrapper.java @@ -22,9 +22,13 @@ package org.apache.fop.fo.flow; import java.util.List; import java.util.ListIterator; +// XML +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObjMixed; +import org.apache.fop.fo.PropertyList; /** * Implementation for fo:wrapper formatting object. @@ -36,7 +40,10 @@ import org.apache.fop.fo.FObjMixed; * @todo implement validateChildNode() */ public class Wrapper extends FObjMixed { - + // The value of properties relevant for fo:wrapper. + private String id; + // End of property values + /** * @param parent FONode that is the parent of this object */ @@ -44,6 +51,27 @@ public class Wrapper extends FObjMixed { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + id = pList.get(PR_ID).getString(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + checkId(id); + } + + /** + * Return the "id" property. + */ + public String getId() { + return id; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) * @todo remove null check when vCN() & endOfNode() implemented diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/java/org/apache/fop/fo/pagination/ColorProfile.java index 6a483bf49..ba99cdb38 100644 --- a/src/java/org/apache/fop/fo/pagination/ColorProfile.java +++ b/src/java/org/apache/fop/fo/pagination/ColorProfile.java @@ -33,14 +33,20 @@ import org.xml.sax.SAXParseException; import org.apache.fop.datatypes.ColorType; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; /** * The fo:color-profile formatting object. * This loads the color profile when needed and resolves a requested color. */ public class ColorProfile extends FObj { - private int intent; + // The value of properties relevant for fo:color-profile. private String src; + private String colorProfileName; + private int renderingIntent; + // End of property values + + private int intent; private String profileName; private ICC_ColorSpace colorSpace = null; @@ -52,12 +58,12 @@ public class ColorProfile extends FObj { } /** - * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) - XSL 1.0/FOP: EMPTY (no child nodes permitted) + * @see org.apache.fop.fo.FObj#bind(PropertyList) */ - protected void validateChildNode(Locator loc, String nsURI, String localName) - throws SAXParseException { - invalidChildError(loc, nsURI, localName); + public void bind(PropertyList pList) { + src = pList.get(PR_SRC).getString(); + colorProfileName = pList.get(PR_COLOR_PROFILE_NAME).getString(); + renderingIntent = pList.get(PR_RENDERING_INTENT).getEnum(); } /** @@ -72,6 +78,15 @@ public class ColorProfile extends FObj { this.propertyList = null; } + /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + XSL 1.0/FOP: EMPTY (no child nodes permitted) + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { + invalidChildError(loc, nsURI, localName); + } + /** * @return the name of this color profile. */ diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java index 18018eb58..33e2b5caa 100644 --- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java @@ -26,6 +26,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; /** * A conditional-page-master-reference formatting object. @@ -36,14 +37,16 @@ import org.apache.fop.fo.FObj; * element. */ public class ConditionalPageMasterReference extends FObj { - - private RepeatablePageMasterAlternatives repeatablePageMasterAlternatives; - - private String masterName; - + // The value of properties relevant for fo:conditional-page-master-reference. + private String masterReference; private int pagePosition; private int oddOrEven; private int blankOrNotBlank; + // End of property values + + private RepeatablePageMasterAlternatives repeatablePageMasterAlternatives; + + private String masterName; /** * @see org.apache.fop.fo.FONode#FONode(FONode) @@ -52,6 +55,23 @@ public class ConditionalPageMasterReference extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + masterReference = pList.get(PR_MASTER_REFERENCE).getString(); + pagePosition = pList.get(PR_PAGE_POSITION).getEnum(); + oddOrEven = pList.get(PR_ODD_OR_EVEN).getEnum(); + blankOrNotBlank = pList.get(PR_BLANK_OR_NOT_BLANK).getEnum(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + validateParent(parent); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) * XSL Content Model: empty @@ -172,6 +192,13 @@ public class ConditionalPageMasterReference extends FObj { } } + /** + * Returns the "master-reference" property. + */ + public String getMasterReference() { + return masterReference; + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java index d30dcfb4e..e859e5053 100644 --- a/src/java/org/apache/fop/fo/pagination/Declarations.java +++ b/src/java/org/apache/fop/fo/pagination/Declarations.java @@ -30,6 +30,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.XMLObj; @@ -53,6 +54,13 @@ public class Declarations extends FObj { ((Root) parent).setDeclarations(this); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + // No properties defined for fo:declarations + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL 1.0: (color-profile)+ (and non-XSL NS nodes) diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index aa751a9a6..09cafb357 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -30,6 +30,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; import org.apache.fop.layoutmgr.FlowLayoutManager; /** @@ -37,7 +38,10 @@ import org.apache.fop.layoutmgr.FlowLayoutManager; * @todo check need for markerSnapshot, contentWidth */ public class Flow extends FObj { - + // The value of properties relevant for fo:flow. + private String flowName; + // End of property values + /** * ArrayList to store snapshot */ @@ -58,6 +62,58 @@ public class Flow extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + flowName = pList.get(PR_FLOW_NAME).getString(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + if (!parent.getName().equals("fo:page-sequence")) { + throw new SAXParseException("flow must be child of " + + "page-sequence, not " + parent.getName(), locator); + } + + if (flowName == null || flowName.equals("")) { + missingPropertyError("flow-name"); + } + + // according to communication from Paul Grosso (XSL-List, + // 001228, Number 406), confusion in spec section 6.4.5 about + // multiplicity of fo:flow in XSL 1.0 is cleared up - one (1) + // fo:flow per fo:page-sequence only. + + /* if (pageSequence.isFlowSet()) { + if (this.name.equals("fo:flow")) { + throw new FOPException("Only a single fo:flow permitted" + + " per fo:page-sequence"); + } else { + throw new FOPException(this.name + + " not allowed after fo:flow"); + } + } + */ + // Now done in addChild of page-sequence + //pageSequence.addFlow(this); + getFOEventHandler().startFlow(this); + } + + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (!blockItemFound) { + missingChildElementError("marker* (%block;)+"); + } + getFOEventHandler().endFlow(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -91,18 +147,6 @@ public class Flow extends FObj { } } - /** - * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - if (!blockItemFound) { - missingChildElementError("marker* (%block;)+"); - } - getFOEventHandler().endFlow(this); - } - /** * @param contentWidth content width of this flow, in millipoints (??) */ @@ -125,6 +169,13 @@ public class Flow extends FObj { return true; } + /** + * @return the name of this flow + */ + public String getFlowName() { + return flowName; + } + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java index 426de60ad..7697a834d 100644 --- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java +++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java @@ -30,6 +30,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; /** * The layout-master-set formatting object. @@ -52,6 +53,36 @@ public class LayoutMasterSet extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + // No properties in layout-master-set. + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + 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); + } + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (childNodes == null) { + missingChildElementError("(simple-page-master|page-sequence-master)+"); + } + checkRegionNames(); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -86,16 +117,6 @@ public class LayoutMasterSet extends FObj { } } - /** - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - if (childNodes == null) { - missingChildElementError("(simple-page-master|page-sequence-master)+"); - } - checkRegionNames(); - } - /** * Section 7.25.7: check to see that if a region-name is a * duplicate, that it maps to the same fo region-class. diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 7d993964b..5205b0e77 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -29,6 +29,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.properties.Property; /** @@ -37,6 +38,19 @@ import org.apache.fop.fo.properties.Property; * The main entry point is the format method. */ public class PageSequence extends FObj { + // The value of properties relevant for fo:page-sequence. + private String country; + private String format; + private String language; + private int letterValue; + private char groupingSeparator; + private int groupingSize; + private String id; + private Property initialPageNumber; + private int forcePageCount; + private String masterReference; + // End of property values + // // initial-page-number types // @@ -77,7 +91,6 @@ public class PageSequence extends FObj { public int firstPageNumber = 0; // actual public PageNumberGenerator pageNumberGenerator; - public int forcePageCount = 0; private int pageCount = 0; private boolean isForcing = false; @@ -120,6 +133,77 @@ public class PageSequence extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + country = pList.get(PR_COUNTRY).getString(); + format = pList.get(PR_FORMAT).getString(); + language = pList.get(PR_LANGUAGE).getString(); + letterValue = pList.get(PR_LETTER_VALUE).getEnum(); + groupingSeparator = pList.get(PR_GROUPING_SEPARATOR).getCharacter(); + groupingSize = pList.get(PR_GROUPING_SIZE).getNumber().intValue(); + id = pList.get(PR_ID).getString(); + initialPageNumber = pList.get(PR_INITIAL_PAGE_NUMBER); + forcePageCount = pList.get(PR_FORCE_PAGE_COUNT).getEnum(); + masterReference = pList.get(PR_MASTER_REFERENCE).getString(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode() + */ + protected void startOfNode() throws SAXParseException { + this.root = (Root) parent; + layoutMasterSet = root.getLayoutMasterSet(); + flowMap = new HashMap(); + + // we are now on the first page of the page sequence + thisIsFirstPage = true; + + if (initialPageNumber.getEnum() != 0) { + // auto | auto-odd | auto-even. + pageNumberType = initialPageNumber.getEnum(); + } else { + pageNumberType = EXPLICIT; + int pageStart = initialPageNumber.getNumber().intValue(); + this.explicitFirstNumber = (pageStart > 0) ? pageStart : 1; + } + + this.simplePageMaster = + this.layoutMasterSet.getSimplePageMaster(masterReference); + if (this.simplePageMaster == null) { + this.pageSequenceMaster = + this.layoutMasterSet.getPageSequenceMaster(masterReference); + if (this.pageSequenceMaster == null) { + throw new SAXParseException("master-reference '" + masterReference + + "' for fo:page-sequence matches no" + + " simple-page-master or page-sequence-master", locator); + } + } + + // get the 'format' properties + this.pageNumberGenerator = + new PageNumberGenerator(format, groupingSeparator, groupingSize, letterValue); + + checkId(id); + //call startStructuredPageSequence to ensure, that startPageSequence is called + //before startFlow. + startStructuredPageSequence(); + } + + /** + * Signal end of this xml element. + * This passes the end page sequence to the structure handler + * so it can act upon that. + */ + protected void endOfNode() throws SAXParseException { + if (mainFlow == null) { + missingChildElementError("(title?,static-content*,flow)"); + } + + getFOEventHandler().endPageSequence(this); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -226,19 +310,6 @@ public class PageSequence extends FObj { } } - /** - * Signal end of this xml element. - * This passes the end page sequence to the structure handler - * so it can act upon that. - */ - protected void endOfNode() throws SAXParseException { - if (mainFlow == null) { - missingChildElementError("(title?,static-content*,flow)"); - } - - getFOEventHandler().endPageSequence(this); - } - /** * Add a flow or static content, mapped by its flow-name. * The flow-name is used to associate the flow with a region on a page, @@ -688,6 +759,13 @@ public class PageSequence extends FObj { return root; } + /** + * Return the "master-reference" property. + */ + public String getMasterReference() { + return masterReference; + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index 4bc92fafb..fcb2e0d97 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -29,6 +29,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FObj; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; import org.apache.fop.apps.FOPException; /** @@ -37,12 +38,14 @@ import org.apache.fop.apps.FOPException; * which are simple or complex references to page-masters. */ public class PageSequenceMaster extends FObj { - + // The value of properties relevant for fo:page-sequence-master. + private String masterName; + // End of property values + private LayoutMasterSet layoutMasterSet; private List subSequenceSpecifiers; private SubSequenceSpecifier currentSubSequence; private int currentSubSequenceNumber; - private String masterName; // The terminology may be confusing. A 'page-sequence-master' consists // of a sequence of what the XSL spec refers to as @@ -58,6 +61,43 @@ public class PageSequenceMaster extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + masterName = pList.get(PR_MASTER_NAME).getString(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode() + */ + protected void startOfNode() throws SAXParseException { + subSequenceSpecifiers = new java.util.ArrayList(); + if (parent.getName().equals("fo:layout-master-set")) { + this.layoutMasterSet = (LayoutMasterSet)parent; + 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#endOfNode() + */ + protected void endOfNode() throws SAXParseException { + if (childNodes == null) { + missingChildElementError("(single-page-master-reference|" + + "repeatable-page-master-reference|repeatable-page-master-alternatives)+"); + } + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -98,13 +138,6 @@ public class PageSequenceMaster extends FObj { } } - protected void endOfNode() throws SAXParseException { - if (childNodes == null) { - missingChildElementError("(single-page-master-reference|" + - "repeatable-page-master-reference|repeatable-page-master-alternatives)+"); - } - } - /** * Adds a new suqsequence specifier to the page sequence master. * @param pageMasterReference the subsequence to add diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java index 95a0ec5e2..a165dcf11 100644 --- a/src/java/org/apache/fop/fo/pagination/Region.java +++ b/src/java/org/apache/fop/fo/pagination/Region.java @@ -27,19 +27,28 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.datatypes.FODimension; +import org.apache.fop.datatypes.Numeric; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; /** * This is an abstract base class for pagination regions */ public abstract class Region extends FObj { - - private SimplePageMaster layoutMaster; + // The value of properties relevant for fo:region + private CommonBorderPaddingBackground commonBorderPaddingBackground; + // private ToBeImplementedProperty clip + private int displayAlign; + private int overflow; private String regionName; + private Numeric referenceOrientation; + private int writingMode; + // End of property values + + private SimplePageMaster layoutMaster; - /** Holds the overflow attribute */ - public int overflow; /** Holds the writing mode */ protected int wm; @@ -51,6 +60,35 @@ public abstract class Region extends FObj { layoutMaster = (SimplePageMaster) parent; } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) throws SAXParseException { + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + // clip = pList.get(PR_CLIP); + displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum(); + overflow = pList.get(PR_OVERFLOW).getEnum(); + regionName = pList.get(PR_REGION_NAME).getString(); + referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric(); + writingMode = pList.getWritingMode(); + + // regions may have name, or default + if (null == regionName) { + setRegionName(getDefaultRegionName()); + } else if (regionName.equals("")) { + setRegionName(getDefaultRegionName()); + } else { + setRegionName(regionName); + // 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); + } + } + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -95,15 +133,7 @@ public abstract class Region extends FObj { */ protected abstract String getDefaultRegionName(); - /** - * Returns the name of this region. - * @return the region name - */ - public String getRegionName() { - return this.regionName; - } - - /** + /** * Sets the name of the region. * @param name the name */ @@ -142,4 +172,39 @@ public abstract class Region extends FObj { // Ask parent for region return layoutMaster.getRegion(regionId); } + + /** + * Return the Common Border, Padding, and Background Properties. + */ + public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { + return commonBorderPaddingBackground; + } + + /** + * Return the "region-name" property. + */ + public String getRegionName() { + return this.regionName; + } + + /** + * Return the "writing-mode" property. + */ + public int getWritingMode() { + return writingMode; + } + + /** + * Return the "overflow" property. + */ + public int getOverflow() { + return overflow; + } + + /** + * Return the "reference-orientation" property. + */ + public int getReferenceOrientation() { + return referenceOrientation.getValue(); + } } diff --git a/src/java/org/apache/fop/fo/pagination/RegionBA.java b/src/java/org/apache/fop/fo/pagination/RegionBA.java index 9f61cf93a..4ad44e168 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBA.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBA.java @@ -26,13 +26,19 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; /** * Abstract base class for fo:region-before and fo:region-after. */ public abstract class RegionBA extends Region { - + // The value of properties relevant for fo:region-[before|after]. + private Length extent; + private int precedence; + // End of property values + /** * @see org.apache.fop.fo.FONode#FONode(FONode) */ @@ -40,6 +46,15 @@ public abstract class RegionBA extends Region { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) throws SAXParseException { + super.bind(pList); + extent = pList.get(PR_EXTENT).getLength(); + precedence = pList.get(PR_PRECEDENCE).getEnum(); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -47,6 +62,21 @@ public abstract class RegionBA extends Region { super.addProperties(attlist); } + /** + * Return the "extent" property. + */ + public Length getExtent() { + return extent; + } + + /** + * Return the "precedence" property. + * TODO: 31699 + */ + public int ___getPrecedence() { + return precedence; + } + /** * Adjust the viewport reference rectangle for a region as a function * of precedence. diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java index 8eeadcc81..4b732fb67 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionBody.java +++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java @@ -21,16 +21,27 @@ package org.apache.fop.fo.pagination; // Java import java.awt.Rectangle; +// XML +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.FODimension; +import org.apache.fop.datatypes.Length; +import org.apache.fop.datatypes.Numeric; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.properties.CommonMarginBlock; /** * The fo:region-body element. */ public class RegionBody extends Region { + // The value of properties relevant for fo:region-body. + private CommonMarginBlock commonMarginBlock; + private Numeric columnCount; + private Length columnGap; + // End of property values private ColorType backgroundColor; @@ -41,6 +52,37 @@ public class RegionBody extends Region { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) throws SAXParseException { + super.bind(pList); + commonMarginBlock = pList.getMarginBlockProps(); + columnCount = pList.get(PR_COLUMN_COUNT).getNumeric(); + columnGap = pList.get(PR_COLUMN_GAP).getLength(); + } + + /** + * Return the Common Margin Properties-Block. + */ + public CommonMarginBlock getCommonMarginBlock() { + return commonMarginBlock; + } + + /** + * Return the "column-count" property. + */ + public int getColumnCount() { + return columnCount.getValue(); + } + + /** + * Return the "column-gap" property. + */ + public int getColumnGap() { + return columnGap.getValue(); + } + /** * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension) */ diff --git a/src/java/org/apache/fop/fo/pagination/RegionSE.java b/src/java/org/apache/fop/fo/pagination/RegionSE.java index 21fa704ac..4ba8b1e7c 100644 --- a/src/java/org/apache/fop/fo/pagination/RegionSE.java +++ b/src/java/org/apache/fop/fo/pagination/RegionSE.java @@ -26,12 +26,17 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; /** * Abstract base class for fo:region-start and fo:region-end. */ public abstract class RegionSE extends Region { + // The value of properties relevant for fo:region-[start|end]. + private Length extent; + // End of property values /** * @see org.apache.fop.fo.FONode#FONode(FONode) @@ -40,6 +45,14 @@ public abstract class RegionSE extends Region { super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) throws SAXParseException { + super.bind(pList); + extent = pList.get(PR_EXTENT).getLength(); + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -47,6 +60,13 @@ public abstract class RegionSE extends Region { super.addProperties(attlist); } + /** + * Return the "extent" property. + */ + public Length getExtent() { + return extent; + } + /** * Adjust the viewport reference rectangle for a region as a function * of precedence. diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java index e1048eebd..c2d601551 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java @@ -29,6 +29,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.properties.Property; /** @@ -39,14 +40,17 @@ import org.apache.fop.fo.properties.Property; */ public class RepeatablePageMasterAlternatives extends FObj implements SubSequenceSpecifier { - + // The value of properties relevant for fo:repeatable-page-master-alternatives. + private Property maximumRepeats; + // End of property values + private static final int INFINITE = -1; /** * Max times this page master can be repeated. * INFINITE is used for the unbounded case */ - private int maximumRepeats; + private int _maximumRepeats; private int numberConsumed = 0; private ArrayList conditionalPageMasterRefs; @@ -58,6 +62,38 @@ public class RepeatablePageMasterAlternatives extends FObj super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + maximumRepeats = pList.get(PR_MAXIMUM_REPEATS); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + 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); + } + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (childNodes == null) { + missingChildElementError("(conditional-page-master-reference+)"); + } + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL/FOP: (conditional-page-master-reference+) @@ -71,11 +107,19 @@ public class RepeatablePageMasterAlternatives extends FObj } /** - * @see org.apache.fop.fo.FONode#endOfNode + * Return the "maximum-repeats" property. */ - protected void endOfNode() throws SAXParseException { - if (childNodes == null) { - missingChildElementError("(conditional-page-master-reference+)"); + public int getMaximumRepeats() { + if (maximumRepeats.getEnum() == NO_LIMIT) { + return INFINITE; + } else { + int mr = maximumRepeats.getNumeric().getValue(); + if (mr < 0) { + getLogger().debug("negative maximum-repeats: " + + this.maximumRepeats); + mr = 0; + } + return mr; } } @@ -98,13 +142,13 @@ public class RepeatablePageMasterAlternatives extends FObj Property mr = getProperty(PR_MAXIMUM_REPEATS); if (mr.getEnum() == NO_LIMIT) { - this.maximumRepeats = INFINITE; + this._maximumRepeats = INFINITE; } else { - this.maximumRepeats = mr.getNumber().intValue(); - if (this.maximumRepeats < 0) { + this._maximumRepeats = mr.getNumber().intValue(); + if (this._maximumRepeats < 0) { getLogger().debug("negative maximum-repeats: " + this.maximumRepeats); - this.maximumRepeats = 0; + this._maximumRepeats = 0; } } } @@ -117,8 +161,8 @@ public class RepeatablePageMasterAlternatives extends FObj public String getNextPageMasterName(boolean isOddPage, boolean isFirstPage, boolean isBlankPage) { - if (maximumRepeats != INFINITE) { - if (numberConsumed < maximumRepeats) { + if (_maximumRepeats != INFINITE) { + if (numberConsumed < _maximumRepeats) { numberConsumed++; } else { 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 4ad7ab074..d01422500 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java @@ -26,6 +26,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.properties.Property; /** @@ -36,10 +37,15 @@ import org.apache.fop.fo.properties.Property; public class RepeatablePageMasterReference extends FObj implements SubSequenceSpecifier { + // The value of properties relevant for fo:repeatable-page-master-reference. + private String masterReference; + private Property maximumRepeats; + // End of property values + private static final int INFINITE = -1; private PageSequenceMaster pageSequenceMaster; - private int maximumRepeats; + private int _maximumRepeats; private int numberConsumed = 0; /** @@ -49,6 +55,27 @@ public class RepeatablePageMasterReference extends FObj super(parent); } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + masterReference = pList.get(PR_MASTER_REFERENCE).getString(); + maximumRepeats = pList.get(PR_MAXIMUM_REPEATS); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent; + + if (masterReference == null) { + missingPropertyError("master-reference"); + } else { + pageSequenceMaster.addSubsequenceSpecifier(this); + } + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -66,13 +93,13 @@ public class RepeatablePageMasterReference extends FObj Property mr = getProperty(PR_MAXIMUM_REPEATS); if (mr.getEnum() == NO_LIMIT) { - this.maximumRepeats = INFINITE; + this._maximumRepeats = INFINITE; } else { - this.maximumRepeats = mr.getNumber().intValue(); - if (this.maximumRepeats < 0) { + this._maximumRepeats = mr.getNumber().intValue(); + if (this._maximumRepeats < 0) { getLogger().debug("negative maximum-repeats: " + this.maximumRepeats); - this.maximumRepeats = 0; + this._maximumRepeats = 0; } } } @@ -92,8 +119,8 @@ public class RepeatablePageMasterReference extends FObj public String getNextPageMasterName(boolean isOddPage, boolean isFirstPage, boolean isEmptyPage) { - if (maximumRepeats != INFINITE) { - if (numberConsumed < maximumRepeats) { + if (_maximumRepeats != INFINITE) { + if (numberConsumed < _maximumRepeats) { numberConsumed++; } else { return null; @@ -102,6 +129,23 @@ public class RepeatablePageMasterReference extends FObj return getPropString(PR_MASTER_REFERENCE); } + /** + * Return the "maximum-repeats" property. + */ + public int getMaximumRepeats() { + if (maximumRepeats.getEnum() == NO_LIMIT) { + return INFINITE; + } else { + int mr = maximumRepeats.getNumeric().getValue(); + if (mr < 0) { + getLogger().debug("negative maximum-repeats: " + + this.maximumRepeats); + mr = 0; + } + return mr; + } + } + /** * @see org.apache.fop.fo.pagination.SubSequenceSpecifier#reset() */ diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index 358fd4b2c..000173540 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -29,6 +29,7 @@ import org.xml.sax.SAXParseException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOEventHandler; +import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.extensions.ExtensionElementMapping; import org.apache.fop.fo.extensions.Bookmarks; @@ -36,6 +37,10 @@ import org.apache.fop.fo.extensions.Bookmarks; * The fo:root formatting object. Contains page masters, page-sequences. */ public class Root extends FObj { + // The value of properties relevant for fo:root. + // private ToBeImplementedProperty mediaUsage; + // End of property values + private LayoutMasterSet layoutMasterSet; private Declarations declarations; private Bookmarks bookmarks = null; @@ -66,6 +71,23 @@ public class Root extends FObj { } } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + // prMediaUsage = pList.get(PR_MEDIA_USAGE); + } + + /** + * Signal end of this xml element. + */ + protected void endOfNode() throws SAXParseException { + if (!pageSequenceFound || layoutMasterSet == null) { + missingChildElementError("(layout-master-set, declarations?, " + + "fox:bookmarks?, page-sequence+)"); + } + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL 1.0 Spec: (layout-master-set,declarations?,page-sequence+) @@ -112,16 +134,6 @@ public class Root extends FObj { } } - /** - * Signal end of this xml element. - */ - protected void endOfNode() throws SAXParseException { - if (!pageSequenceFound || layoutMasterSet == null) { - missingChildElementError("(layout-master-set, declarations?, " + - "fox:bookmarks?, page-sequence+)"); - } - } - /** * Sets the FOEventHandler object that this Root is attached to * @param foEventHandler the FOEventHandler object diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java index 31f3ca662..122f0866d 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -29,8 +29,12 @@ import org.xml.sax.Locator; import org.xml.sax.SAXParseException; // FOP +import org.apache.fop.datatypes.Length; +import org.apache.fop.datatypes.Numeric; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonMarginBlock; /** * A simple-page-master formatting object. @@ -38,14 +42,21 @@ import org.apache.fop.fo.FObj; * and attributes. */ public class SimplePageMaster extends FObj { + // The value of properties relevant for fo:simple-page-master. + private CommonMarginBlock commonMarginBlock; + private String masterName; + private Length pageHeight; + private Length pageWidth; + private Numeric referenceOrientation; + private int writingMode; + // End of property values + /** * Page regions (regionClass, Region) */ private Map regions; - private String masterName; - - // used for node validation + // used for node validation private boolean hasRegionBody = false; private boolean hasRegionBefore = false; private boolean hasRegionAfter = false; @@ -59,6 +70,45 @@ public class SimplePageMaster extends FObj { super(parent); } + /** + * @see org.apache.fop.fo.FObj#resolve + */ + public void bind(PropertyList pList) { + commonMarginBlock = pList.getMarginBlockProps(); + masterName = pList.get(PR_MASTER_NAME).getString(); + pageHeight = pList.get(PR_PAGE_HEIGHT).getLength(); + pageWidth = pList.get(PR_PAGE_WIDTH).getLength(); + referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric(); + writingMode = pList.getWritingMode(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + LayoutMasterSet layoutMasterSet = (LayoutMasterSet) parent; + + if (masterName == 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); + } + + /** + * Make sure content model satisfied. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (!hasRegionBody) { + missingChildElementError("(region-body, region-before?," + + " region-after?, region-start?, region-end?)"); + } + } + /** * @see org.apache.fop.fo.FObj#addProperties */ @@ -83,69 +133,58 @@ public class SimplePageMaster extends FObj { */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws SAXParseException { - if (nsURI == FO_URI && localName.equals("region-body")) { - if (hasRegionBody) { - tooManyNodesError(loc, "fo:region-body"); - } else { - hasRegionBody = true; - } - } else if (nsURI == FO_URI && localName.equals("region-before")) { - if (!hasRegionBody) { - nodesOutOfOrderError(loc, "fo:region-body", "fo:region-before"); - } else if (hasRegionBefore) { - tooManyNodesError(loc, "fo:region-before"); - } else if (hasRegionAfter) { - nodesOutOfOrderError(loc, "fo:region-before", "fo:region-after"); - } else if (hasRegionStart) { - nodesOutOfOrderError(loc, "fo:region-before", "fo:region-start"); - } else if (hasRegionEnd) { - nodesOutOfOrderError(loc, "fo:region-before", "fo:region-end"); - } else { - hasRegionBody = true; - } - } else if (nsURI == FO_URI && localName.equals("region-after")) { - if (!hasRegionBody) { - nodesOutOfOrderError(loc, "fo:region-body", "fo:region-after"); - } else if (hasRegionAfter) { - tooManyNodesError(loc, "fo:region-after"); - } else if (hasRegionStart) { - nodesOutOfOrderError(loc, "fo:region-after", "fo:region-start"); - } else if (hasRegionEnd) { - nodesOutOfOrderError(loc, "fo:region-after", "fo:region-end"); - } else { - hasRegionAfter = true; - } - } else if (nsURI == FO_URI && localName.equals("region-start")) { - if (!hasRegionBody) { - nodesOutOfOrderError(loc, "fo:region-body", "fo:region-start"); - } else if (hasRegionStart) { - tooManyNodesError(loc, "fo:region-start"); - } else if (hasRegionEnd) { - nodesOutOfOrderError(loc, "fo:region-start", "fo:region-end"); - } else { - hasRegionStart = true; - } - } else if (nsURI == FO_URI && localName.equals("region-end")) { - if (!hasRegionBody) { - nodesOutOfOrderError(loc, "fo:region-body", "fo:region-end"); - } else if (hasRegionEnd) { - tooManyNodesError(loc, "fo:region-end"); - } else { - hasRegionEnd = true; - } + if (nsURI == FO_URI && localName.equals("region-body")) { + if (hasRegionBody) { + tooManyNodesError(loc, "fo:region-body"); } else { - invalidChildError(loc, nsURI, localName); + hasRegionBody = true; } - } - - /** - * Make sure content model satisfied. - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - if (!hasRegionBody) { - missingChildElementError("(region-body, region-before?," + - " region-after?, region-start?, region-end?)"); + } else if (nsURI == FO_URI && localName.equals("region-before")) { + if (!hasRegionBody) { + nodesOutOfOrderError(loc, "fo:region-body", "fo:region-before"); + } else if (hasRegionBefore) { + tooManyNodesError(loc, "fo:region-before"); + } else if (hasRegionAfter) { + nodesOutOfOrderError(loc, "fo:region-before", "fo:region-after"); + } else if (hasRegionStart) { + nodesOutOfOrderError(loc, "fo:region-before", "fo:region-start"); + } else if (hasRegionEnd) { + nodesOutOfOrderError(loc, "fo:region-before", "fo:region-end"); + } else { + hasRegionBody = true; + } + } else if (nsURI == FO_URI && localName.equals("region-after")) { + if (!hasRegionBody) { + nodesOutOfOrderError(loc, "fo:region-body", "fo:region-after"); + } else if (hasRegionAfter) { + tooManyNodesError(loc, "fo:region-after"); + } else if (hasRegionStart) { + nodesOutOfOrderError(loc, "fo:region-after", "fo:region-start"); + } else if (hasRegionEnd) { + nodesOutOfOrderError(loc, "fo:region-after", "fo:region-end"); + } else { + hasRegionAfter = true; + } + } else if (nsURI == FO_URI && localName.equals("region-start")) { + if (!hasRegionBody) { + nodesOutOfOrderError(loc, "fo:region-body", "fo:region-start"); + } else if (hasRegionStart) { + tooManyNodesError(loc, "fo:region-start"); + } else if (hasRegionEnd) { + nodesOutOfOrderError(loc, "fo:region-start", "fo:region-end"); + } else { + hasRegionStart = true; + } + } else if (nsURI == FO_URI && localName.equals("region-end")) { + if (!hasRegionBody) { + nodesOutOfOrderError(loc, "fo:region-body", "fo:region-end"); + } else if (hasRegionEnd) { + tooManyNodesError(loc, "fo:region-end"); + } else { + hasRegionEnd = true; + } + } else { + invalidChildError(loc, nsURI, localName); } } @@ -156,14 +195,6 @@ public class SimplePageMaster extends FObj { return true; } - /** - * Returns the name of the simple-page-master. - * @return the page master name - */ - public String getMasterName() { - return getPropString(PR_MASTER_NAME); - } - /** * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ @@ -214,6 +245,49 @@ public class SimplePageMaster extends FObj { return false; } + /** + * Return the Common Margin Properties-Block. + */ + public CommonMarginBlock getCommonMarginBlock() { + return commonMarginBlock; + } + + /** + * Return "master-name" property. + */ + public String getMasterName() { + return getPropString(PR_MASTER_NAME); + } + + /** + * Return the "page-width" property. + */ + public Length getPageWidth() { + return pageWidth; + } + + /** + * Return the "page-height" property. + */ + public Length getPageHeight() { + return pageHeight; + } + + + /** + * Return the "writing-mode" property. + */ + public int getWritingMode() { + return writingMode; + } + + /** + * Return the "reference-orientation" property. + */ + public int getReferenceOrientation() { + return referenceOrientation.getValue(); + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java index 50acb9476..2abcbb565 100644 --- a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java @@ -26,6 +26,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; /** * A single-page-master-reference formatting object. @@ -35,6 +36,10 @@ import org.apache.fop.fo.FObj; public class SinglePageMasterReference extends FObj implements SubSequenceSpecifier { + // The value of properties relevant for fo:single-page-master-reference. + private String masterReference; + // End of property values + private static final int FIRST = 0; private static final int DONE = 1; @@ -48,6 +53,25 @@ public class SinglePageMasterReference extends FObj this.state = FIRST; } + /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + masterReference = pList.get(PR_MASTER_REFERENCE).getString(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent; + if (masterReference == null) { + missingPropertyError("master-reference"); + } else { + pageSequenceMaster.addSubsequenceSpecifier(this); + } + } + /** * @see org.apache.fop.fo.FObj#addProperties */ diff --git a/src/java/org/apache/fop/fo/pagination/StaticContent.java b/src/java/org/apache/fop/fo/pagination/StaticContent.java index 972744040..98364c5dc 100644 --- a/src/java/org/apache/fop/fo/pagination/StaticContent.java +++ b/src/java/org/apache/fop/fo/pagination/StaticContent.java @@ -38,14 +38,14 @@ public class StaticContent extends Flow { } /** - * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) - * XSL Content Model: (%block;)+ + * @see org.apache.fop.fo.FONode#startOfNode() */ - protected void validateChildNode(Locator loc, String nsURI, String localName) - throws SAXParseException { - if (!isBlockItem(nsURI, localName)) { - invalidChildError(loc, nsURI, localName); + protected void startOfNode() throws SAXParseException { + if (getFlowName() == null || getFlowName().equals("")) { + throw new SAXParseException("A 'flow-name' is required for " + + getName() + ".", locator); } + getFOEventHandler().startFlow(this); } /** @@ -60,6 +60,17 @@ public class StaticContent extends Flow { getFOEventHandler().endFlow(this); } + /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + * XSL Content Model: (%block;)+ + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { + if (!isBlockItem(nsURI, localName)) { + invalidChildError(loc, nsURI, localName); + } + } + /** * @see org.apache.fop.fo.FObj#getName() */ diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java index ce11dbab0..afe49a775 100644 --- a/src/java/org/apache/fop/fo/pagination/Title.java +++ b/src/java/org/apache/fop/fo/pagination/Title.java @@ -23,13 +23,30 @@ 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.FObjMixed; import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.properties.CommonAccessibility; +import org.apache.fop.fo.properties.CommonAural; +import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.CommonFont; +import org.apache.fop.fo.properties.CommonMarginInline; /** * Class modelling the fo:title object. */ public class Title extends FObjMixed { + // The value of properties relevant for fo:title. + private CommonAccessibility commonAccessibility; + private CommonAural commonAural; + private CommonBorderPaddingBackground commonBorderPaddingBackground; + private CommonFont commonFont; + private CommonMarginInline commonMarginInline; + private ColorType color; + private Length lineHeight; + // private ToBeImplementedProperty visibility; /** * @param parent FONode that is the parent of this object @@ -38,6 +55,17 @@ public class Title extends FObjMixed { super(parent); } + public void bind(PropertyList pList) { + commonAccessibility = pList.getAccessibilityProps(); + commonAural = pList.getAuralProps(); + commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); + commonFont = pList.getFontProps(); + commonMarginInline = pList.getMarginInlineProps(); + color = pList.get(PR_COLOR).getColorType(); + lineHeight = pList.get(PR_LINE_HEIGHT).getLength(); + // visibility = pList.get(PR_VISIBILITY); + } + /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) XSL/FOP: (#PCDATA|%inline;)* diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index b00e1cf2e..007c83157 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -859,7 +859,7 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager implements setRegionPosition(r, body, absRegVPRect); int columnCount = r.getProperty(PR_COLUMN_COUNT).getNumber().intValue(); - if ((columnCount > 1) && (r.overflow == Overflow.SCROLL)) { + if ((columnCount > 1) && (r.getOverflow() == Overflow.SCROLL)) { // recover by setting 'column-count' to 1. This is allowed but // not required by the spec. log.error("Setting 'column-count' to 1 because " -- 2.39.5