public Property getInherited(String propertyName) {
if (parentPropertyList != null
&& isInherited(namespace, elementName, propertyName)) {
- return parentPropertyList.get(propertyName);
+ int propertyId = FOPropertyMapping.getPropertyId(propertyName);
+ return parentPropertyList.get(propertyId);
} else {
// return the "initial" value
try {
* this will try to compute it based on other properties, or if it is
* inheritable, to return the inherited value. If all else fails, it returns
* the default value.
- * @param propertyName property name
+ * @param propId The Constants ID of the property whose value is desired.
* @return the Property corresponding to that name
*/
- public Property get(String propertyName) {
+ public Property get(int propId) {
+ String propertyName = FOPropertyMapping.getPropertyName(propId);
return get(propertyName, true, true);
}
+ /**
+ * TEMPORARY until conversion to int's complete
+ * Return the property on the current FlowObject. If it isn't set explicitly,
+ * this will try to compute it based on other properties, or if it is
+ * inheritable, to return the inherited value. If all else fails, it returns
+ * the default value.
+ * @param propertyName The name of the property whose value is desired.
+ * @return the Property corresponding to that name
+ */
+ public Property get(String propertyName) {
+ return get(propertyName, true, true);
+ }
+
/**
* Return the property on the current FlowObject. Depending on the passed flags,
* this will try to compute it based on other properties, or if it is
/**
* Return the value of this property on the parent of this FO.
* Implements the from-parent function.
- * @param propertyName The name of the property whose value is desired.
+ * @param propId The Constants ID of the property whose value is desired.
* @return The computed value on the parent or the initial value if this
* FO is the root or is in a different namespace from its parent.
*/
- public Property getFromParent(String propertyName) {
+ public Property getFromParent(int propId) {
+ String propertyName = FOPropertyMapping.getPropertyName(propId);
+
if (parentPropertyList != null) {
- return parentPropertyList.get(propertyName);
+ return parentPropertyList.get(propId);
} else {
try {
return makeProperty(namespace, elementName, propertyName);
/**
* Helper class for managing groups of properties.
*/
-public class PropertyManager {
+public class PropertyManager implements Constants {
private PropertyList propertyList;
private FOTreeControl foTreeControl = null;
}
/**@todo this is ugly. need to improve. */
- String fontFamily = propertyList.get("font-family").getString();
- String fontStyle = propertyList.get("font-style").getString();
- String fw = propertyList.get("font-weight").getString();
+ String fontFamily = propertyList.get(PR_FONT_FAMILY).getString();
+ String fontStyle = propertyList.get(PR_FONT_STYLE).getString();
+ String fw = propertyList.get(PR_FONT_WEIGHT).getString();
int fontWeight = 400;
if (fw.equals("bolder")) {
// +100 from inherited
// NOTE: this is incomplete. font-size may be specified with
// various kinds of keywords too
- int fontSize = propertyList.get("font-size").getLength().getValue();
+ int fontSize = propertyList.get(PR_FONT_SIZE).getLength().getValue();
//int fontVariant = propertyList.get("font-variant").getEnum();
String fname = foTreeControl.fontLookup(fontFamily, fontStyle,
fontWeight);
if (hyphProps == null) {
this.hyphProps = new CommonHyphenation();
hyphProps.hyphenate =
- this.propertyList.get("hyphenate").getEnum();
+ this.propertyList.get(PR_HYPHENATE).getEnum();
hyphProps.hyphenationChar = this.propertyList.get(
- "hyphenation-character").getCharacter();
+ PR_HYPHENATION_CHARACTER).getCharacter();
hyphProps.hyphenationPushCharacterCount = this.propertyList.get(
- "hyphenation-push-character-count").getNumber().
+ PR_HYPHENATION_PUSH_CHARACTER_COUNT).getNumber().
intValue();
hyphProps.hyphenationRemainCharacterCount = this.propertyList.get(
- "hyphenation-remain-character-count").getNumber().
+ PR_HYPHENATION_REMAIN_CHARACTER_COUNT).getNumber().
intValue();
hyphProps.language =
- this.propertyList.get("language").getString();
- hyphProps.country = this.propertyList.get("country").getString();
+ this.propertyList.get(PR_LANGUAGE).getString();
+ hyphProps.country = this.propertyList.get(PR_COUNTRY).getString();
}
return hyphProps;
}
// Common Margin Properties-Block
props.marginTop =
- this.propertyList.get("margin-top").getLength().getValue();
+ this.propertyList.get(PR_MARGIN_TOP).getLength().getValue();
props.marginBottom =
- this.propertyList.get("margin-bottom").getLength().getValue();
+ this.propertyList.get(PR_MARGIN_BOTTOM).getLength().getValue();
props.marginLeft =
- this.propertyList.get("margin-left").getLength().getValue();
+ this.propertyList.get(PR_MARGIN_LEFT).getLength().getValue();
props.marginRight =
- this.propertyList.get("margin-right").getLength().getValue();
+ this.propertyList.get(PR_MARGIN_RIGHT).getLength().getValue();
// For now, we only get the optimum value for space-before and after
- props.spaceBefore = this.propertyList.get("space-before").
+ props.spaceBefore = this.propertyList.get(PR_SPACE_BEFORE).
getSpace().getOptimum().getLength().getValue();
- props.spaceAfter = this.propertyList.get("space-after").
+ props.spaceAfter = this.propertyList.get(PR_SPACE_AFTER).
getSpace().getOptimum().getLength().getValue();
- props.startIndent = this.propertyList.get("start-indent").
+ props.startIndent = this.propertyList.get(PR_START_INDENT).
getLength().getValue();
- props.endIndent = this.propertyList.get("end-indent").
+ props.endIndent = this.propertyList.get(PR_END_INDENT).
getLength().getValue();
return props;
*/
public CommonBackground getBackgroundProps() {
CommonBackground bp = new CommonBackground();
- bp.backAttachment = propertyList.get("background-attachment").getEnum();
- bp.backColor = propertyList.get("background-color").getColorType();
+ bp.backAttachment = propertyList.get(PR_BACKGROUND_ATTACHMENT).getEnum();
+ bp.backColor = propertyList.get(PR_BACKGROUND_COLOR).getColorType();
if (bp.backColor.getAlpha() == 0) {
bp.backColor = null;
}
- bp.backImage = propertyList.get("background-image").getString();
+ bp.backImage = propertyList.get(PR_BACKGROUND_IMAGE).getString();
if (bp.backImage == null || NONE.equals(bp.backImage)) {
bp.backImage = null;
} else {
- bp.backRepeat = propertyList.get("background-repeat").getEnum();
- Property prop = propertyList.get("background-position-horizontal");
+ bp.backRepeat = propertyList.get(PR_BACKGROUND_REPEAT).getEnum();
+ Property prop = propertyList.get(PR_BACKGROUND_POSITION_HORIZONTAL);
if (prop != null) {
bp.backPosHorizontal = prop.getLength();
}
- prop = propertyList.get("background-position-vertical");
+ prop = propertyList.get(PR_BACKGROUND_POSITION_VERTICAL);
if (prop != null) {
bp.backPosVertical = prop.getLength();
}
*/
public InlineProps getInlineProps() {
InlineProps props = new InlineProps();
- props.spaceStart = new SpaceVal(propertyList.get("space-start").getSpace());
- props.spaceEnd = new SpaceVal(propertyList.get("space-end").getSpace());
+ props.spaceStart = new SpaceVal(propertyList.get(PR_SPACE_START).getSpace());
+ props.spaceEnd = new SpaceVal(propertyList.get(PR_SPACE_END).getSpace());
return props;
}
public CommonAccessibility getAccessibilityProps() {
CommonAccessibility props = new CommonAccessibility();
String str;
- str = this.propertyList.get("source-document").getString();
+ str = this.propertyList.get(PR_SOURCE_DOCUMENT).getString();
if (!NONE.equals(str)) {
props.sourceDoc = str;
}
- str = this.propertyList.get("role").getString();
+ str = this.propertyList.get(PR_ROLE).getString();
if (!NONE.equals(str)) {
props.role = str;
}
public CommonAbsolutePosition getAbsolutePositionProps() {
CommonAbsolutePosition props = new CommonAbsolutePosition();
props.absolutePosition =
- this.propertyList.get("absolute-position").getEnum();
- props.top = this.propertyList.get("top").getLength().getValue();
- props.bottom = this.propertyList.get("bottom").getLength().getValue();
- props.left = this.propertyList.get("left").getLength().getValue();
- props.right = this.propertyList.get("right").getLength().getValue();
+ this.propertyList.get(PR_ABSOLUTE_POSITION).getEnum();
+ props.top = this.propertyList.get(PR_TOP).getLength().getValue();
+ props.bottom = this.propertyList.get(PR_BOTTOM).getLength().getValue();
+ props.left = this.propertyList.get(PR_LEFT).getLength().getValue();
+ props.right = this.propertyList.get(PR_RIGHT).getLength().getValue();
return props;
}
*/
public BlockProps getBlockProps() {
BlockProps props = new BlockProps();
- props.firstIndent = this.propertyList.get("text-indent").getLength().getValue();
+ props.firstIndent = this.propertyList.get(PR_TEXT_INDENT).getLength().getValue();
props.lastIndent = 0;
/*this.propertyList.get("last-line-end-indent").getLength().mvalue(); */
- props.textAlign = this.propertyList.get("text-align").getEnum();
- props.textAlignLast = this.propertyList.get("text-align-last").getEnum();
- props.lineStackType = this.propertyList.get("line-stacking-strategy").getEnum();
+ props.textAlign = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
+ props.textAlignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
+ props.lineStackType = this.propertyList.get(PR_LINE_STACKING_STRATEGY).getEnum();
return props;
}
*/
public LayoutProps getLayoutProps() {
LayoutProps props = new LayoutProps();
- props.breakBefore = this.propertyList.get("break-before").getEnum();
- props.breakAfter = this.propertyList.get("break-after").getEnum();
- props.bIsSpan = (this.propertyList.get("span").getEnum() == Span.ALL);
+ props.breakBefore = this.propertyList.get(PR_BREAK_BEFORE).getEnum();
+ props.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum();
+ props.bIsSpan = (this.propertyList.get(PR_SPAN).getEnum() == Span.ALL);
props.spaceBefore = new SpaceVal(
- this.propertyList.get("space-before").getSpace());
+ this.propertyList.get(PR_SPACE_BEFORE).getSpace());
props.spaceAfter = new SpaceVal(
- this.propertyList.get("space-after").getSpace());
+ this.propertyList.get(PR_SPACE_AFTER).getSpace());
return props;
}
if (textInfo == null) {
textInfo = new TextInfo();
textInfo.fs = getFontState(foTreeControl);
- textInfo.color = propertyList.get("color").getColorType();
+ textInfo.color = propertyList.get(PR_COLOR).getColorType();
textInfo.verticalAlign =
- propertyList.get("vertical-align").getEnum();
+ propertyList.get(PR_VERTICAL_ALIGN).getEnum();
- textInfo.wrapOption = propertyList.get("wrap-option").getEnum();
+ textInfo.wrapOption = propertyList.get(PR_WRAP_OPTION).getEnum();
textInfo.bWrap = (textInfo.wrapOption == Constants.WRAP);
textInfo.wordSpacing = new SpaceVal(
- propertyList.get("word-spacing").getSpace());
+ propertyList.get(PR_WORD_SPACING).getSpace());
/* textInfo.letterSpacing =
new SpaceVal(propertyList.get("letter-spacing").getSpace());*/
textInfo.whiteSpaceCollapse =
- propertyList.get("white-space-collapse").getEnum();
+ propertyList.get(PR_WHITE_SPACE_COLLAPSE).getEnum();
textInfo.lineHeight = this.propertyList.get(
- "line-height").getLength().getValue();
+ PR_LINE_HEIGHT).getLength().getValue();
textInfo.textTransform
- = this.propertyList.get("text-transform").getEnum();
+ = this.propertyList.get(PR_TEXT_TRANSFORM).getEnum();
}
return textInfo;
* @return the enumerated reference-orientation
*/
public int getAbsRefOrient() {
- return propertyList.get("reference-orientation").getNumber().intValue();
+ return propertyList.get(PR_REFERENCE_ORIENTATION).getNumber().intValue();
}
/**
* @return the enumerated writing-mode
*/
public int getWritingMode() {
- return propertyList.get("writing-mode").getEnum();
+ return propertyList.get(PR_WRITING_MODE).getEnum();
}
}
*/
public void handleAttrs(Attributes attlist) throws FOPException {
super.handleAttrs(attlist);
- this.span = this.propertyList.get("span").getEnum();
+ this.span = this.propertyList.get(PR_SPAN).getEnum();
this.wsTreatment =
- this.propertyList.get("white-space-treatment").getEnum();
+ this.propertyList.get(PR_WHITE_SPACE_TREATMENT).getEnum();
this.bWScollapse =
- (this.propertyList.get("white-space-collapse").getEnum()
+ (this.propertyList.get(PR_WHITE_SPACE_COLLAPSE).getEnum()
== Constants.TRUE);
this.lfTreatment =
- this.propertyList.get("linefeed-treatment").getEnum();
+ this.propertyList.get(PR_LINEFEED_TREATMENT).getEnum();
setupID();
// this.propertyList.get("wrap-option");
// this.propertyList.get("z-index");
- this.align = this.propertyList.get("text-align").getEnum();
+ this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
this.alignLast =
- this.propertyList.get("text-align-last").getEnum();
- this.breakAfter = this.propertyList.get("break-after").getEnum();
+ this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
+ this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum();
this.lineHeight = this.propertyList.get(
- "line-height").getLength().getValue();
+ PR_LINE_HEIGHT).getLength().getValue();
this.startIndent = this.propertyList.get(
- "start-indent").getLength().getValue();
+ PR_START_INDENT).getLength().getValue();
this.endIndent = this.propertyList.get(
- "end-indent").getLength().getValue();
+ PR_END_INDENT).getLength().getValue();
this.spaceBefore = this.propertyList.get(
- "space-before.optimum").getLength().getValue();
+ PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
this.spaceAfter = this.propertyList.get(
- "space-after.optimum").getLength().getValue();
+ PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
this.textIndent = this.propertyList.get(
- "text-indent").getLength().getValue();
+ PR_TEXT_INDENT).getLength().getValue();
this.keepWithNext =
- this.propertyList.get("keep-with-next").getEnum();
+ this.propertyList.get(PR_KEEP_WITH_NEXT).getEnum();
this.blockWidows =
- this.propertyList.get("widows").getNumber().intValue();
+ this.propertyList.get(PR_WIDOWS).getNumber().intValue();
this.blockOrphans =
- this.propertyList.get("orphans").getNumber().intValue();
+ this.propertyList.get(PR_ORPHANS).getNumber().intValue();
}