From a5c961841124731be6c531a6b12a1d8673e7f4f6 Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Sat, 26 Apr 2008 20:19:59 +0000 Subject: [PATCH] Basic activation of keep-* properties on Character and AbstractGraphics + javadoc updates git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@651855 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/fo/flow/AbstractGraphics.java | 93 +++++++--------- .../org/apache/fop/fo/flow/Character.java | 103 +++++++----------- 2 files changed, 79 insertions(+), 117 deletions(-) diff --git a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java b/src/java/org/apache/fop/fo/flow/AbstractGraphics.java index a58cc08f2..19cea1510 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractGraphics.java +++ b/src/java/org/apache/fop/fo/flow/AbstractGraphics.java @@ -26,15 +26,18 @@ import org.apache.fop.fo.FObj; import org.apache.fop.fo.GraphicsProperties; import org.apache.fop.fo.PropertyList; import org.apache.fop.fo.properties.CommonBorderPaddingBackground; +import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fo.properties.LengthRangeProperty; import org.apache.fop.fo.properties.SpaceProperty; /** - * Common base class for instream-foreign-object and external-graphics - * flow formatting objects. + * Common base class for the + * fo:instream-foreign-object + * and + * fo:external-graphic flow formatting objects. */ public abstract class AbstractGraphics extends FObj implements GraphicsProperties { - + // The value of properties relevant for fo:instream-foreign-object // and external-graphics. private CommonBorderPaddingBackground commonBorderPaddingBackground; @@ -50,6 +53,8 @@ public abstract class AbstractGraphics extends FObj implements GraphicsPropertie private Length height; private String id; private LengthRangeProperty inlineProgressionDimension; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; private SpaceProperty lineHeight; private int overflow; private int scaling; @@ -61,8 +66,6 @@ public abstract class AbstractGraphics extends FObj implements GraphicsPropertie // private CommonMarginInline commonMarginInline; // private CommonRelativePosition commonRelativePosition; // private String contentType; - // private KeepProperty keepWithNext; - // private KeepProperty keepWithPrevious; // private int scalingMethod; // End of property values @@ -77,9 +80,7 @@ public abstract class AbstractGraphics extends FObj implements GraphicsPropertie super(parent); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public void bind(PropertyList pList) throws FOPException { commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST).getLength(); @@ -94,6 +95,8 @@ public abstract class AbstractGraphics extends FObj implements GraphicsPropertie 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).getSpace(); overflow = pList.get(PR_OVERFLOW).getEnum(); scaling = pList.get(PR_SCALING).getEnum(); @@ -108,60 +111,52 @@ public abstract class AbstractGraphics extends FObj implements GraphicsPropertie return id; } - /** - * @return the Common Border, Padding, and Background Properties. - */ + /** @return the {@link CommonBorderPaddingBackground} */ public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { return commonBorderPaddingBackground; } - /** - * @return the "line-height" property. - */ + /** @return the "line-height" property */ public SpaceProperty getLineHeight() { return lineHeight; } - /** {@inheritDoc} */ + /** @return the "inline-progression-dimension" property */ public LengthRangeProperty getInlineProgressionDimension() { return inlineProgressionDimension; } - /** {@inheritDoc} */ + /** @return the "block-progression-dimension" property */ public LengthRangeProperty getBlockProgressionDimension() { return blockProgressionDimension; } - /** - * @return the "height" property. - */ + /** @return the "height" property */ public Length getHeight() { return height; } - /** - * @return the "width" property. - */ + /** @return the "width" property */ public Length getWidth() { return width; } - /** {@inheritDoc} */ + /** @return the "content-height" property */ public Length getContentHeight() { return contentHeight; } - /** {@inheritDoc} */ + /** @return the "content-width" property */ public Length getContentWidth() { return contentWidth; } - /** {@inheritDoc} */ + /** @return the "scaling" property */ public int getScaling() { return scaling; } - /** {@inheritDoc} */ + /** @return the "overflow" property */ public int getOverflow() { return overflow; } @@ -176,9 +171,7 @@ public abstract class AbstractGraphics extends FObj implements GraphicsPropertie return textAlign; } - /** - * @return the "alignment-adjust" property - */ + /** @return the "alignment-adjust" property */ public Length getAlignmentAdjust() { if (alignmentAdjust.getEnum() == EN_AUTO) { final Length intrinsicAlignmentAdjust = this.getIntrinsicAlignmentAdjust(); @@ -188,40 +181,38 @@ public abstract class AbstractGraphics extends FObj implements GraphicsPropertie } return alignmentAdjust; } - - /** - * @return the "alignment-baseline" property - */ + + /** @return the "alignment-baseline" property */ public int getAlignmentBaseline() { return alignmentBaseline; } - - /** - * @return the "baseline-shift" property - */ + + /** @return the "baseline-shift" property */ public Length getBaselineShift() { return baselineShift; } - - /** - * @return the "dominant-baseline" property - */ + + /** @return the "dominant-baseline" property */ public int getDominantBaseline() { return dominantBaseline; } - - /** - * @return the graphics intrinsic width in millipoints - */ + + /** @return the "keep-with-next" property */ + public KeepProperty getKeepWithNext() { + return keepWithNext; + } + + /** @return the "keep-with-previous" property */ + public KeepProperty getKeepWithPrevious() { + return keepWithPrevious; + } + + /** @return the graphic's intrinsic width in millipoints */ public abstract int getIntrinsicWidth(); - /** - * @return the graphics intrinsic height in millipoints - */ + /** @return the graphic's intrinsic height in millipoints */ public abstract int getIntrinsicHeight(); - /** - * @return the graphics intrinsic alignment-adjust - */ + /** @return the graphic's intrinsic alignment-adjust */ public abstract Length getIntrinsicAlignmentAdjust(); } diff --git a/src/java/org/apache/fop/fo/flow/Character.java b/src/java/org/apache/fop/fo/flow/Character.java index aad4209f9..7fd98b0ef 100644 --- a/src/java/org/apache/fop/fo/flow/Character.java +++ b/src/java/org/apache/fop/fo/flow/Character.java @@ -35,22 +35,13 @@ 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.CommonTextDecoration; +import org.apache.fop.fo.properties.KeepProperty; import org.apache.fop.fo.properties.Property; import org.apache.fop.fo.properties.SpaceProperty; /** - * Class modelling the fo:character object. - * Its use is defined by the spec: - * "The fo:character flow object represents a character that is mapped to - * a glyph for presentation. It is an atomic unit to the formatter. - * When the result tree is interpreted as a tree of formatting objects, - * a character in the result tree is treated as if it were an empty - * element of type fo:character with a character attribute - * equal to the Unicode representation of the character. - * The semantics of an "auto" value for character properties, which is - * typically their initial value, are based on the Unicode codepoint. - * Overrides may be specified in an implementation-specific manner." (6.6.3) - * + * Class modelling the + * fo:character object. */ public class Character extends FObj { // The value of properties relevant for fo:character. @@ -63,8 +54,8 @@ public class Character extends FObj { private char character; private Color color; private int dominantBaseline; - // private ToBeImplementedProperty glyphOrientationHorizontal; - // private ToBeImplementedProperty glyphOrientationVertical; + private KeepProperty keepWithNext; + private KeepProperty keepWithPrevious; private Property letterSpacing; private SpaceProperty lineHeight; /** Holds the text decoration values. May be null */ @@ -75,11 +66,11 @@ public class Character extends FObj { // private CommonAural commonAural; // private CommonMarginInline commonMarginInline; // private CommonRelativePosition commonRelativePosition; + // private ToBeImplementedProperty glyphOrientationHorizontal; + // private ToBeImplementedProperty glyphOrientationVertical; // private int treatAsWordSpace; // private Length textDepth; // private Length textAltitude; - // private KeepProperty keepWithNext; - // private KeepProperty keepWithPrevious; // private int scoreSpaces; // private int suppressAtLineBreak; // private int textTransform; @@ -92,15 +83,13 @@ public class Character extends FObj { public static final int DOESNOT_FIT = 1; /** - * @param parent FONode that is the parent of this object + * @param parent {@link FONode} that is the parent of this object */ public Character(FONode parent) { super(parent); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public void bind(PropertyList pList) throws FOPException { super.bind(pList); commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps(); @@ -113,18 +102,15 @@ public class Character extends FObj { character = pList.get(PR_CHARACTER).getCharacter(); color = pList.get(PR_COLOR).getColor(getUserAgent()); dominantBaseline = pList.get(PR_DOMINANT_BASELINE).getEnum(); - // glyphOrientationHorizontal = pList.get(PR_GLYPH_ORIENTATION_HORIZONTAL); - // glyphOrientationVertical = pList.get(PR_GLYPH_ORIENTATION_VERTICAL); + 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).getSpace(); textDecoration = pList.getTextDecorationProps(); - // textShadow = pList.get(PR_TEXT_SHADOW); wordSpacing = pList.get(PR_WORD_SPACING); } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ protected void startOfNode() throws FOPException { super.startOfNode(); getFOEventHandler().character(this); @@ -132,7 +118,7 @@ public class Character extends FObj { /** * {@inheritDoc} - * XSL Content Model: empty + *
XSL Content Model: empty */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { @@ -141,86 +127,62 @@ public class Character extends FObj { } } - /** - * {@inheritDoc} - */ + /** {@inheritDoc} */ public CharIterator charIterator() { return new FOCharIterator(this); } - /** - * @return the Common Border, Padding, and Background Properties. - */ + /** @return the Common Border, Padding, and Background Properties */ public CommonBorderPaddingBackground getCommonBorderPaddingBackground() { return commonBorderPaddingBackground; } - /** - * @return the Common Font Properties. - */ + /** @return the Common Font Properties */ public CommonFont getCommonFont() { return commonFont; } - /** - * @return the Common Hyphenation Properties. - */ + /** @return the Common Hyphenation Properties */ public CommonHyphenation getCommonHyphenation() { return commonHyphenation; } - /** - * @return the "character" property. - */ + /** @return the "character" property */ public char getCharacter() { return character; } - /** - * @return the "color" property. - */ + /** @return the "color" property */ public Color getColor() { return color; } - /** - * @return the "alignment-adjust" property - */ + /** @return the "alignment-adjust" property */ public Length getAlignmentAdjust() { return alignmentAdjust; } - /** - * @return the "alignment-baseline" property - */ + /** @return the "alignment-baseline" property */ public int getAlignmentBaseline() { return alignmentBaseline; } - /** - * @return the "baseline-shift" property - */ + /** @return the "baseline-shift" property */ public Length getBaselineShift() { return baselineShift; } - /** - * @return the "dominant-baseline" property - */ + /** @return the "dominant-baseline" property */ public int getDominantBaseline() { return dominantBaseline; } - /** - * @return the "letter-spacing" property. - */ + /** @return the "letter-spacing" property */ public Property getLetterSpacing() { return letterSpacing; } - /** - * @return the "line-height" property. - */ + /** @return the "line-height" property */ public SpaceProperty getLineHeight() { return lineHeight; } @@ -230,13 +192,21 @@ public class Character extends FObj { return textDecoration; } - /** - * @return the "word-spacing" property. - */ + /** @return the "word-spacing" property */ public Property getWordSpacing() { return wordSpacing; } + /** @return the "keep-with-next" property */ + public KeepProperty getKeepWithNext() { + return keepWithNext; + } + + /** @return the "keep-with-previous" property */ + public KeepProperty getKeepWithPrevious() { + return keepWithPrevious; + } + /** {@inheritDoc} */ public String getLocalName() { return "character"; @@ -244,6 +214,7 @@ public class Character extends FObj { /** * {@inheritDoc} + * @return {@link org.apache.fop.fo.Constants#FO_CHARACTER} */ public int getNameId() { return FO_CHARACTER; -- 2.39.5