aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r--src/java/org/apache/fop/datatypes/LengthBase.java3
-rw-r--r--src/java/org/apache/fop/fo/PropertyList.java2
-rw-r--r--src/java/org/apache/fop/fo/expr/BodyStartFunction.java5
-rw-r--r--src/java/org/apache/fop/fo/expr/LabelEndFunction.java5
-rw-r--r--src/java/org/apache/fop/fo/expr/PropertyInfo.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/Marker.java3
-rw-r--r--src/java/org/apache/fop/fo/flow/TableRow.java6
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java3
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java3
-rw-r--r--src/java/org/apache/fop/layoutmgr/AddLMVisitor.java29
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java8
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageLayoutManager.java11
-rw-r--r--src/java/org/apache/fop/render/rtf/ListAttributesConverter.java5
-rw-r--r--src/java/org/apache/fop/render/rtf/PageAttributesConverter.java17
-rw-r--r--src/java/org/apache/fop/render/rtf/RTFHandler.java12
-rw-r--r--src/java/org/apache/fop/render/rtf/TableAttributesConverter.java20
-rw-r--r--src/java/org/apache/fop/render/rtf/TextAttributesConverter.java16
17 files changed, 79 insertions, 72 deletions
diff --git a/src/java/org/apache/fop/datatypes/LengthBase.java b/src/java/org/apache/fop/datatypes/LengthBase.java
index f3aa146c0..705603762 100644
--- a/src/java/org/apache/fop/datatypes/LengthBase.java
+++ b/src/java/org/apache/fop/datatypes/LengthBase.java
@@ -51,6 +51,7 @@
package org.apache.fop.datatypes;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
/**
@@ -139,7 +140,7 @@ public class LengthBase implements PercentBase {
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:
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java
index 22feefe02..9c4a09261 100644
--- a/src/java/org/apache/fop/fo/PropertyList.java
+++ b/src/java/org/apache/fop/fo/PropertyList.java
@@ -310,7 +310,7 @@ public class PropertyList extends HashMap {
*/
public Property get(String propertyName) {
return get(propertyName, true, true);
- }
+ }
/**
* Return the property on the current FlowObject. Depending on the passed flags,
diff --git a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java b/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
index 989211458..6a68d42b3 100644
--- a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
+++ b/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
@@ -50,6 +50,7 @@
*/
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;
@@ -77,7 +78,7 @@ public class BodyStartFunction extends FunctionBase {
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)) {
@@ -88,7 +89,7 @@ public class BodyStartFunction extends FunctionBase {
}
Numeric startIndent =
- ((ListItem)item).propertyList.get("start-indent").getNumeric();
+ ((ListItem)item).propertyList.get(Constants.PR_START_INDENT).getNumeric();
return new NumericProperty(distance.add(startIndent));
}
diff --git a/src/java/org/apache/fop/fo/expr/LabelEndFunction.java b/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
index 7856d05f7..29e40d51e 100644
--- a/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
+++ b/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
@@ -54,6 +54,7 @@ import org.apache.fop.datatypes.Length;
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;
@@ -84,7 +85,7 @@ public class LabelEndFunction extends FunctionBase {
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();
@@ -95,7 +96,7 @@ public class LabelEndFunction extends FunctionBase {
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();
diff --git a/src/java/org/apache/fop/fo/expr/PropertyInfo.java b/src/java/org/apache/fop/fo/expr/PropertyInfo.java
index 02fee893a..61b1ede2a 100644
--- a/src/java/org/apache/fop/fo/expr/PropertyInfo.java
+++ b/src/java/org/apache/fop/fo/expr/PropertyInfo.java
@@ -52,6 +52,7 @@ package org.apache.fop.fo.expr;
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;
@@ -107,7 +108,7 @@ public class PropertyInfo {
* @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();
}
/**
diff --git a/src/java/org/apache/fop/fo/flow/Marker.java b/src/java/org/apache/fop/fo/flow/Marker.java
index e41504c77..9ee08ade3 100644
--- a/src/java/org/apache/fop/fo/flow/Marker.java
+++ b/src/java/org/apache/fop/fo/flow/Marker.java
@@ -55,7 +55,6 @@ import org.xml.sax.Attributes;
// 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;
@@ -90,7 +89,7 @@ public class Marker extends FObjMixed {
super.handleAttrs(attlist);
this.markerClassName =
- this.propertyList.get(Constants.PR_MARKER_CLASS_NAME).getString();
+ this.propertyList.get(PR_MARKER_CLASS_NAME).getString();
}
/**
diff --git a/src/java/org/apache/fop/fo/flow/TableRow.java b/src/java/org/apache/fop/fo/flow/TableRow.java
index 1ae293c00..272262da6 100644
--- a/src/java/org/apache/fop/fo/flow/TableRow.java
+++ b/src/java/org/apache/fop/fo/flow/TableRow.java
@@ -128,16 +128,16 @@ public class TableRow extends FObj {
// 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;
}
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
index d3f2bc5c8..e253fed0a 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
@@ -57,6 +57,7 @@ import java.util.List;
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;
@@ -99,7 +100,7 @@ public class PageSequenceMaster extends FObj {
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");
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index cc8f85d07..750b5f87b 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -56,6 +56,7 @@ import org.apache.fop.fo.flow.Marker;
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;
@@ -66,7 +67,7 @@ import java.util.Map;
/**
* 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;
diff --git a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
index 908537d05..c502d71b7 100644
--- a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
+++ b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
@@ -73,6 +73,7 @@ import org.apache.fop.area.inline.UnresolvedPageNumber;
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;
@@ -352,7 +353,7 @@ public class AddLMVisitor implements 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);
}
@@ -460,7 +461,7 @@ public class AddLMVisitor implements FOTreeVisitor {
}
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(
@@ -482,7 +483,7 @@ public class AddLMVisitor implements FOTreeVisitor {
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);
}
@@ -520,7 +521,7 @@ public class AddLMVisitor implements FOTreeVisitor {
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);
}
@@ -538,7 +539,7 @@ public class AddLMVisitor implements FOTreeVisitor {
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);
}
@@ -580,27 +581,27 @@ public class AddLMVisitor implements FOTreeVisitor {
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();
}
@@ -610,7 +611,7 @@ public class AddLMVisitor implements FOTreeVisitor {
// 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) {
@@ -619,7 +620,7 @@ public class AddLMVisitor implements FOTreeVisitor {
} 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) {
@@ -642,7 +643,7 @@ public class AddLMVisitor implements FOTreeVisitor {
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);
@@ -664,7 +665,7 @@ public class AddLMVisitor implements FOTreeVisitor {
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) {
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index 189d28c67..86870754a 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -107,14 +107,14 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
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;
}
diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
index bdc72a8ad..37becb59a 100644
--- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -70,8 +70,8 @@ import org.apache.fop.area.Resolveable;
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;
@@ -81,7 +81,6 @@ import org.apache.fop.fo.pagination.StaticContent;
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;
@@ -770,9 +769,9 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
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();
@@ -858,7 +857,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
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.
@@ -869,7 +868,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
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;
}
diff --git a/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java b/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
index a31bf8067..5b153127a 100644
--- a/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
@@ -51,6 +51,7 @@ package org.apache.fop.render.rtf;
//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;
@@ -83,7 +84,7 @@ public class ListAttributesConverter {
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);
@@ -97,7 +98,7 @@ public class ListAttributesConverter {
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);
diff --git a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java b/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
index 2a3734b32..f3030911b 100644
--- a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
@@ -55,10 +55,11 @@ import org.apache.avalon.framework.logger.ConsoleLogger;
//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.
@@ -83,32 +84,32 @@ class PageAttributesConverter {
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"));
diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java
index ce21c4d8c..d1bf6e58f 100644
--- a/src/java/org/apache/fop/render/rtf/RTFHandler.java
+++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java
@@ -183,7 +183,7 @@ public class RTFHandler extends FOInputHandler {
//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
@@ -580,7 +580,7 @@ public class RTFHandler extends FOInputHandler {
//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);
@@ -757,7 +757,7 @@ public class RTFHandler extends FOInputHandler {
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.");
@@ -765,7 +765,7 @@ public class RTFHandler extends FOInputHandler {
}
//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");
@@ -773,7 +773,7 @@ public class RTFHandler extends FOInputHandler {
}
//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);
@@ -783,7 +783,7 @@ public class RTFHandler extends FOInputHandler {
}
//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);
diff --git a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
index 3eda1b35a..9aa1ae403 100644
--- a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
@@ -120,7 +120,7 @@ public class TableAttributesConverter {
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";
@@ -218,7 +218,7 @@ public class TableAttributesConverter {
}
// 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");
/*
@@ -254,7 +254,7 @@ public class TableAttributesConverter {
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);
@@ -312,26 +312,26 @@ public class TableAttributesConverter {
//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,
@@ -351,7 +351,7 @@ public class TableAttributesConverter {
* 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");
/*
@@ -424,7 +424,7 @@ public class TableAttributesConverter {
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);
diff --git a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
index 6abd4897c..33c9771a7 100644
--- a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
@@ -140,7 +140,7 @@ class TextAttributesConverter {
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,
@@ -149,7 +149,7 @@ class TextAttributesConverter {
}
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);
}
@@ -176,7 +176,7 @@ class TextAttributesConverter {
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 {
@@ -185,7 +185,7 @@ class TextAttributesConverter {
}
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 {
@@ -194,7 +194,7 @@ class TextAttributesConverter {
}
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 {
@@ -206,7 +206,7 @@ class TextAttributesConverter {
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);
@@ -275,7 +275,7 @@ class TextAttributesConverter {
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:
@@ -302,7 +302,7 @@ class TextAttributesConverter {
* @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