package org.apache.fop.datatypes;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
/**
public int getBaseLength() {
switch (iBaseType) {
case FONTSIZE:
- return propertyList.get("font-size").getLength().getValue();
+ return propertyList.get(Constants.PR_FONT_SIZE).getLength().getValue();
case INH_FONTSIZE:
return propertyList.getInherited("font-size").getLength().getValue();
//case CONTAINING_BOX:
*/
public Property get(String propertyName) {
return get(propertyName, true, true);
- }
+ }
/**
* Return the property on the current FlowObject. Depending on the passed flags,
*/
package org.apache.fop.fo.expr;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.Property;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.flow.ListItem;
public Property eval(Property[] args,
PropertyInfo pInfo) throws PropertyException {
Numeric distance =
- pInfo.getPropertyList().get("provisional-distance-between-starts").getNumeric();
+ pInfo.getPropertyList().get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric();
FONode item = pInfo.getFO();
while (item != null && !(item instanceof ListItem)) {
}
Numeric startIndent =
- ((ListItem)item).propertyList.get("start-indent").getNumeric();
+ ((ListItem)item).propertyList.get(Constants.PR_START_INDENT).getNumeric();
return new NumericProperty(distance.add(startIndent));
}
import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.datatypes.LinearCombinationLength;
import org.apache.fop.datatypes.PercentLength;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.Property;
import org.apache.fop.fo.LengthProperty;
import org.apache.fop.fo.FONode;
PropertyInfo pInfo) throws PropertyException {
Length distance =
- pInfo.getPropertyList().get("provisional-distance-between-starts").getLength();
+ pInfo.getPropertyList().get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getLength();
Length separation =
pInfo.getPropertyList().getNearestSpecified("provisional-label-separation").getLength();
if (item == null) {
throw new PropertyException("label-end() called from outside an fo:list-item");
}
- Length startIndent = ((ListItem)item).propertyList.get("start-indent").getLength();
+ Length startIndent = ((ListItem)item).propertyList.get(Constants.PR_START_INDENT).getLength();
LinearCombinationLength labelEnd = new LinearCombinationLength();
import java.util.Stack;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.Property;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.FObj;
* @return the current font-size value as base units (milli-points).
*/
public int currentFontSize() {
- return plist.get("font-size").getLength().getValue();
+ return plist.get(Constants.PR_FONT_SIZE).getLength().getValue();
}
/**
// FOP
import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.FOTreeVisitor;
super.handleAttrs(attlist);
this.markerClassName =
- this.propertyList.get(Constants.PR_MARKER_CLASS_NAME).getString();
+ this.propertyList.get(PR_MARKER_CLASS_NAME).getString();
}
/**
// this.propertyList.get("keep-with-previous");
- this.breakAfter = this.propertyList.get("break-after").getEnum();
+ this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum();
this.backgroundColor =
- this.propertyList.get("background-color").getColorType();
+ this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
this.keepTogether = getKeepValue("keep-together.within-column");
this.keepWithNext = getKeepValue("keep-with-next.within-column");
this.keepWithPrevious =
getKeepValue("keep-with-previous.within-column");
- this.minHeight = this.propertyList.get("height").getLength().getValue();
+ this.minHeight = this.propertyList.get(PR_HEIGHT).getLength().getValue();
setup = true;
}
import org.xml.sax.Attributes;
// FOP
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOTreeVisitor;
if (parent.getName().equals("fo:layout-master-set")) {
this.layoutMasterSet = (LayoutMasterSet)parent;
- String pm = this.propertyList.get("master-name").getString();
+ String pm = this.propertyList.get(Constants.PR_MASTER_NAME).getString();
if (pm == null) {
getLogger().warn("page-sequence-master does not have "
+ "a master-name and so is being ignored");
import org.apache.fop.area.Area;
import org.apache.fop.area.Resolveable;
import org.apache.fop.area.PageViewport;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyManager;
import org.apache.avalon.framework.logger.Logger;
/**
* The base class for all LayoutManagers.
*/
-public abstract class AbstractLayoutManager implements LayoutProcessor {
+public abstract class AbstractLayoutManager implements LayoutProcessor, Constants {
protected FOUserAgent userAgent;
protected LayoutProcessor parentLM = null;
protected FObj fobj;
import org.apache.fop.area.inline.Viewport;
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.FOTreeVisitor;
};
lm.setUserAgent(node.getUserAgent());
lm.setFObj(node);
- lm.setAlignment(node.propertyList.get("leader-alignment").getEnum());
+ lm.setAlignment(node.propertyList.get(Constants.PR_LEADER_ALIGNMENT).getEnum());
currentLMList.add(lm);
}
}
public InlineArea getCharacterInlineArea(Character node) {
- String str = node.propertyList.get("character").getString();
+ String str = node.propertyList.get(Constants.PR_CHARACTER).getString();
if (str.length() == 1) {
org.apache.fop.area.inline.Character ch =
new org.apache.fop.area.inline.Character(
lm.setUserAgent(node.getUserAgent());
lm.setFObj(node);
lm.setCurrentArea(area);
- lm.setAlignment(node.propertyList.get("vertical-align").getEnum());
+ lm.setAlignment(node.propertyList.get(Constants.PR_VERTICAL_ALIGN).getEnum());
lm.setLead(node.getViewHeight());
currentLMList.add(lm);
}
BlockContainerLayoutManager blm = new BlockContainerLayoutManager();
blm.setUserAgent(node.getUserAgent());
blm.setFObj(node);
- blm.setOverflow(node.propertyList.get("overflow").getEnum());
+ blm.setOverflow(node.propertyList.get(Constants.PR_OVERFLOW).getEnum());
currentLMList.add(blm);
}
lm.setUserAgent(node.getUserAgent());
lm.setFObj(node);
lm.setCurrentArea(areaCurrent);
- lm.setAlignment(node.propertyList.get("vertical-align").getEnum());
+ lm.setAlignment(node.propertyList.get(Constants.PR_VERTICAL_ALIGN).getEnum());
lm.setLead(areaCurrent.getHeight());
currentLMList.add(lm);
}
int ipd = -1;
boolean bpdauto = false;
if (hasLH) {
- bpd = node.propertyList.get("line-height").getLength().getValue();
+ bpd = node.propertyList.get(Constants.PR_LINE_HEIGHT).getLength().getValue();
} else {
// this property does not apply when the line-height applies
// isn't the block-progression-dimension always in the same
// direction as the line height?
- len = node.propertyList.get("block-progression-dimension.optimum").getLength();
+ len = node.propertyList.get(Constants.PR_BLOCK_PROGRESSION_DIMENSION | Constants.CP_OPTIMUM).getLength();
if (!len.isAuto()) {
bpd = len.getValue();
} else {
- len = node.propertyList.get("height").getLength();
+ len = node.propertyList.get(Constants.PR_HEIGHT).getLength();
if (!len.isAuto()) {
bpd = len.getValue();
}
}
}
- len = node.propertyList.get("inline-progression-dimension.optimum").getLength();
+ len = node.propertyList.get(Constants.PR_INLINE_PROGRESSION_DIMENSION | Constants.CP_OPTIMUM).getLength();
if (!len.isAuto()) {
ipd = len.getValue();
} else {
- len = node.propertyList.get("width").getLength();
+ len = node.propertyList.get(Constants.PR_WIDTH).getLength();
if (!len.isAuto()) {
ipd = len.getValue();
}
// to the content-height and content-width
int cwidth = -1;
int cheight = -1;
- len = node.propertyList.get("content-width").getLength();
+ len = node.propertyList.get(Constants.PR_CONTENT_WIDTH).getLength();
if (!len.isAuto()) {
/*if(len.scaleToFit()) {
if(ipd != -1) {
} else {*/
cwidth = len.getValue();
}
- len = node.propertyList.get("content-height").getLength();
+ len = node.propertyList.get(Constants.PR_CONTENT_HEIGHT).getLength();
if (!len.isAuto()) {
/*if(len.scaleToFit()) {
if(bpd != -1) {
if (cheight == -1) {
cheight = (int)size.getY() * 1000;
}
- int scaling = node.propertyList.get("scaling").getEnum();
+ int scaling = node.propertyList.get(Constants.PR_SCALING).getEnum();
if (scaling == Scaling.UNIFORM) {
// adjust the larger
double rat1 = cwidth / (size.getX() * 1000f);
boolean clip = false;
if (cwidth > ipd || cheight > bpd) {
- int overflow = node.propertyList.get("overflow").getEnum();
+ int overflow = node.propertyList.get(Constants.PR_OVERFLOW).getEnum();
if (overflow == Overflow.HIDDEN) {
clip = true;
} else if (overflow == Overflow.ERROR_IF_OVERFLOW) {
absoluteCTM = CTM.getCTMandRelDims(pm.getAbsRefOrient(),
pm.getWritingMode(), rect, relDims);
}
- height = pm.getPropertyList().get("height").getLength();
- width = pm.getPropertyList().get("width").getLength();
+ height = pm.getPropertyList().get(PR_HEIGHT).getLength();
+ width = pm.getPropertyList().get(PR_WIDTH).getLength();
}
protected int getRotatedIPD() {
PropertyList props = propManager.getPropertyList();
- int height = props.get("height").getLength().getValue();
- height = props.get("inline-progression-dimension.optimum").getLength().getValue();
+ int height = props.get(PR_HEIGHT).getLength().getValue();
+ height = props.get(PR_INLINE_PROGRESSION_DIMENSION | CP_OPTIMUM).getLength().getValue();
return height;
}
import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.flow.Marker;
-
import org.apache.fop.fo.pagination.PageNumberGenerator;
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
-import org.apache.fop.fo.Constants;
import org.apache.fop.fo.properties.Overflow;
import java.util.ArrayList;
private PageViewport createPageAreas(SimplePageMaster spm) {
int pageWidth =
- spm.propertyList.get("page-width").getLength().getValue();
+ spm.propertyList.get(PR_PAGE_WIDTH).getLength().getValue();
int pageHeight =
- spm.propertyList.get("page-height").getLength().getValue();
+ spm.propertyList.get(PR_PAGE_HEIGHT).getLength().getValue();
// Get absolute margin properties (top, left, bottom, right)
CommonMarginBlock mProps = spm.getPropertyManager().getMarginProps();
BodyRegion body = new BodyRegion();
setRegionPosition(r, body, absRegVPRect);
int columnCount =
- r.propertyList.get("column-count").getNumber().intValue();
+ r.propertyList.get(PR_COLUMN_COUNT).getNumber().intValue();
if ((columnCount > 1) && (r.overflow == Overflow.SCROLL)) {
// recover by setting 'column-count' to 1. This is allowed but
// not required by the spec.
body.setColumnCount(columnCount);
int columnGap =
- r.propertyList.get("column-gap").getLength().getValue();
+ r.propertyList.get(PR_COLUMN_GAP).getLength().getValue();
body.setColumnGap(columnGap);
return body;
}
//FOP
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.Property;
import org.apache.fop.fo.LengthProperty;
import org.apache.fop.fo.PropertyList;
int iStartIndentInTwips = 0;
//start-indent
- if ((prop = propertyList.get("start-indent")) != null) {
+ if ((prop = propertyList.get(Constants.PR_START_INDENT)) != null) {
LengthProperty lengthprop = (LengthProperty)prop;
Float f = new Float(lengthprop.getLength().getValue() / 1000f);
attrib.set(RtfListTable.LIST_INDENT, iStartIndentInTwips);
//end-indent
- if ((prop = propertyList.get("end-indent")) != null) {
+ if ((prop = propertyList.get(Constants.PR_END_INDENT)) != null) {
LengthProperty lengthprop = (LengthProperty)prop;
Float f = new Float(lengthprop.getLength().getValue() / 1000f);
//FOP
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.Property;
+import org.apache.fop.fo.PropertyList;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfPage;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.Property;
/** Converts simple-page-master attributes into strings as defined in RtfPage.
attrib = new RtfAttributes();
}
- if ((p = props.get("page-width")) != null) {
+ if ((p = props.get(Constants.PR_PAGE_WIDTH)) != null) {
Float f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.PAGE_WIDTH,
(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() + "pt"));
}
- if ((p = props.get("page-height")) != null) {
+ if ((p = props.get(Constants.PR_PAGE_HEIGHT)) != null) {
Float f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.PAGE_HEIGHT,
(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() + "pt"));
}
- if ((p = props.get("margin-top")) != null) {
+ if ((p = props.get(Constants.PR_MARGIN_TOP)) != null) {
Float f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.MARGIN_TOP,
(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() + "pt"));
}
- if ((p = props.get("margin-bottom")) != null) {
+ if ((p = props.get(Constants.PR_MARGIN_BOTTOM)) != null) {
Float f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.MARGIN_BOTTOM,
(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() + "pt"));
}
- if ((p = props.get("margin-left")) != null) {
+ if ((p = props.get(Constants.PR_MARGIN_LEFT)) != null) {
Float f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.MARGIN_LEFT,
(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() + "pt"));
}
- if ((p = props.get("margin-right")) != null) {
+ if ((p = props.get(Constants.PR_MARGIN_RIGHT)) != null) {
Float f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.MARGIN_RIGHT,
(int)FoUnitsConverter.getInstance().convertToTwips(f.toString() + "pt"));
//read page size and margins, if specified
Property prop;
- if ((prop = pageSeq.propertyList.get("master-reference")) != null) {
+ if ((prop = pageSeq.propertyList.get(Constants.PR_MASTER_REFERENCE)) != null) {
String reference = prop.getString();
SimplePageMaster pagemaster
//process number-rows-spanned attribute
Property p = null;
- if ((p = tc.propertyList.get("number-rows-spanned")) != null) {
+ if ((p = tc.propertyList.get(Constants.PR_NUMBER_ROWS_SPANNED)) != null) {
// Start vertical merge
cell.setVMerge(RtfTableCell.MERGE_START);
Property p = null;
//get source file
- if ((p = eg.propertyList.get("src")) != null) {
+ if ((p = eg.propertyList.get(Constants.PR_SRC)) != null) {
newGraphic.setURL (p.getString());
} else {
log.error("The attribute 'src' of <fo:external-graphic> is required.");
}
//get scaling
- if ((p = eg.propertyList.get("scaling")) != null) {
+ if ((p = eg.propertyList.get(Constants.PR_SCALING)) != null) {
EnumProperty e = (EnumProperty)p;
if (p.getEnum() == Constants.UNIFORM) {
newGraphic.setScaling ("uniform");
}
//get width
- if ((p = eg.propertyList.get("width")) != null) {
+ if ((p = eg.propertyList.get(Constants.PR_WIDTH)) != null) {
LengthProperty lengthProp = (LengthProperty)p;
if (lengthProp.getLength() instanceof FixedLength) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
}
//get height
- if ((p = eg.propertyList.get("height")) != null) {
+ if ((p = eg.propertyList.get(Constants.PR_HEIGHT)) != null) {
LengthProperty lengthProp = (LengthProperty)p;
if (lengthProp.getLength() instanceof FixedLength) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
LengthProperty lengthProp = null;
// margin-left
- lengthProp = (LengthProperty)propertyList.get("margin-left");
+ lengthProp = (LengthProperty)propertyList.get(Constants.PR_MARGIN_LEFT);
if (lengthProp != null) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
final String sValue = f.toString() + "pt";
}
// Border styles do not inherit from parent
- if ((p = props.get("border-style")) != null) {
+ if ((p = props.get(Constants.PR_BORDER_STYLE)) != null) {
log.warn("border-style not implemented. Please use border-style-left, "
+ "...-right, ...-top or ...-bottom");
/*
isBorderPresent = true;
}
- if ((p = props.get("border-width")) != null) {
+ if ((p = props.get(Constants.PR_BORDER_WIDTH)) != null) {
ListProperty listprop = (ListProperty)p;
LengthProperty lengthprop = (LengthProperty)listprop.getList().get(0);
//need to set a default width
//check for keep-together row attribute
- if ((p = props.get("keep-together.within-page")) != null) {
+ if ((p = props.get(Constants.PR_KEEP_TOGETHER | Constants.CP_WITHIN_PAGE)) != null) {
attrib.set(ITableAttributes.ROW_KEEP_TOGETHER);
}
- if ((p = props.get("keep-together")) != null) {
+ if ((p = props.get(Constants.PR_KEEP_TOGETHER)) != null) {
attrib.set(ITableAttributes.ROW_KEEP_TOGETHER);
}
//Check for keep-with-next row attribute.
- if ((p = props.get("keep-together")) != null) {
+ if ((p = props.get(Constants.PR_KEEP_WITH_NEXT)) != null) {
attrib.set(ITableAttributes.ROW_KEEP_WITH_NEXT);
}
//Check for keep-with-previous row attribute.
- if ((p = props.get("keep-with-previous")) != null) {
+ if ((p = props.get(Constants.PR_KEEP_WITH_PREVIOUS)) != null) {
attrib.set(ITableAttributes.ROW_KEEP_WITH_PREVIOUS);
}
//Check for height row attribute.
- if ((p = props.get("height")) != null) {
+ if ((p = props.get(Constants.PR_HEIGHT)) != null) {
Float f = new Float(p.getLength().getValue() / 1000);
attrValue = f.toString() + "pt";
attrib.set(ITableAttributes.ROW_HEIGHT,
* it is implemented that the border type is the value of the border
* place.
*/
- if ((p = props.get("border-style")) != null) {
+ if ((p = props.get(Constants.PR_BORDER_STYLE)) != null) {
log.warn("border-style not implemented. Please use border-style-left, "
+ "...-right, ...-top or ...-bottom");
/*
isBorderPresent = true;
}
- if ((p = props.get("border-width")) != null) {
+ if ((p = props.get(Constants.PR_BORDER_WIDTH)) != null) {
ListProperty listprop = (ListProperty)p;
LengthProperty lengthprop = (LengthProperty)listprop.getList().get(0);
private static void attrBlockFontFamily(PropertyList propertyList, RtfAttributes rtfAttr) {
- String fopValue = propertyList.get("font-family").getString();
+ String fopValue = propertyList.get(Constants.PR_FONT_FAMILY).getString();
if (fopValue != null) {
rtfAttr.set(RtfText.ATTR_FONT_FAMILY,
}
private static void attrBlockFontSize(PropertyList propertyList, RtfAttributes rtfAttr) {
- int fopValue = propertyList.get("font-size").getLength().getValue() / 500;
+ int fopValue = propertyList.get(Constants.PR_FONT_SIZE).getLength().getValue() / 500;
rtfAttr.set("fs", fopValue);
}
private static void attrBlockFontWeight(PropertyList propertyList, RtfAttributes rtfAttr) {
- String fopValue = propertyList.get("font-weight").getString();
+ String fopValue = propertyList.get(Constants.PR_FONT_WEIGHT).getString();
if (fopValue == "bold" || fopValue == "700") {
rtfAttr.set("b", 1);
} else {
}
private static void attrBlockFontItalic(PropertyList propertyList, RtfAttributes rtfAttr) {
- String fopValue = propertyList.get("font-style").getString();
+ String fopValue = propertyList.get(Constants.PR_FONT_STYLE).getString();
if (fopValue.equals("italic")) {
rtfAttr.set(RtfText.ATTR_ITALIC, 1);
} else {
}
private static void attrBlockFontUnderline(PropertyList propertyList, RtfAttributes rtfAttr) {
- EnumProperty enumProp = (EnumProperty)propertyList.get("text-decoration");
+ EnumProperty enumProp = (EnumProperty) propertyList.get(Constants.PR_TEXT_DECORATION);
if (enumProp.getEnum() == Constants.UNDERLINE) {
rtfAttr.set(RtfText.ATTR_UNDERLINE, 1);
} else {
SpaceProperty spaceProp = null;
//space-before
- spaceProp = (SpaceProperty)propertyList.get("space-before");
+ spaceProp = (SpaceProperty)propertyList.get(Constants.PR_SPACE_BEFORE);
if (spaceProp != null) {
Float f = new Float(
spaceProp.getLengthRange().getOptimum().getLength().getValue() / 1000f);
private static void attrBlockTextAlign(PropertyList propertyList, RtfAttributes rtfAttr) {
- int fopValue = propertyList.get("text-align").getEnum();
+ int fopValue = propertyList.get(Constants.PR_TEXT_ALIGN).getEnum();
String rtfValue = null;
switch (fopValue) {
case Constants.CENTER:
* @param rtfAttr the RtfAttributes object the attributes are written to
*/
private static void attrBlockBackgroundColor(PropertyList propertyList, RtfAttributes rtfAttr) {
- ColorType fopValue = propertyList.get("background-color").getColorType();
+ ColorType fopValue = propertyList.get(Constants.PR_BACKGROUND_COLOR).getColorType();
int rtfColor = 0;
/* FOP uses a default background color of "transparent", which is
actually a transparent black, which is generally not suitable as a