aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-05-22 21:44:38 +0000
committerGlen Mazza <gmazza@apache.org>2004-05-22 21:44:38 +0000
commit63afbbbd99eced56126e226e117f33652d8067b4 (patch)
tree5034fc18f721ed36ca773f5c0555a0ec3cba2d82
parent579ea70d54fbd5a82bc0afe59686c57dae37bc6c (diff)
downloadxmlgraphics-fop-63afbbbd99eced56126e226e117f33652d8067b4.tar.gz
xmlgraphics-fop-63afbbbd99eced56126e226e117f33652d8067b4.zip
PR:
Obtained from: Submitted by: Reviewed by: Made propertyList member variable of fo.FObj protected (instead of public). Property value queries routed through FObj instead of PropertyList. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197614 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fo/FObj.java45
-rw-r--r--src/java/org/apache/fop/fo/PropertyList.java46
-rw-r--r--src/java/org/apache/fop/fo/expr/BodyStartFunction.java2
-rw-r--r--src/java/org/apache/fop/fo/expr/LabelEndFunction.java2
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBody.java2
-rw-r--r--src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java20
-rw-r--r--src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java4
-rw-r--r--src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java7
-rw-r--r--src/java/org/apache/fop/layoutmgr/AddLMVisitor.java28
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageLayoutManager.java8
-rw-r--r--src/java/org/apache/fop/render/rtf/BuilderContext.java1
-rw-r--r--src/java/org/apache/fop/render/rtf/ListAttributesConverter.java8
-rw-r--r--src/java/org/apache/fop/render/rtf/PageAttributesConverter.java31
-rw-r--r--src/java/org/apache/fop/render/rtf/RTFHandler.java34
-rw-r--r--src/java/org/apache/fop/render/rtf/TableAttributesConverter.java98
-rw-r--r--src/java/org/apache/fop/render/rtf/TextAttributesConverter.java107
16 files changed, 220 insertions, 223 deletions
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java
index c1cc9891e..cec89be12 100644
--- a/src/java/org/apache/fop/fo/FObj.java
+++ b/src/java/org/apache/fop/fo/FObj.java
@@ -42,7 +42,7 @@ public class FObj extends FONode implements Constants {
/**
* Formatting properties for this fo element.
*/
- public PropertyList propertyList;
+ protected PropertyList propertyList;
/**
* Property manager for handling some common properties.
@@ -292,10 +292,51 @@ public class FObj extends FONode implements Constants {
* @return the property
*/
public Property getProperty(int propId) {
- return (propertyList.get(propId));
+ return propertyList.get(propId);
}
/**
+ * Return the "nearest" specified value for the given property.
+ * Implements the from-nearest-specified-value function.
+ * @param propertyName The name of the property whose value is desired.
+ * @return The computed value if the property is explicitly set on some
+ * ancestor of the current FO, else the initial value.
+ */
+ public Property getNearestSpecifiedProperty(int propId) {
+ return propertyList.getNearestSpecified(propId);
+ }
+
+ /**
+ * Return the value explicitly specified on this FO.
+ * @param propertyName The name of the property whose value is desired.
+ * It may be a compound name, such as space-before.optimum.
+ * @return The value if the property is explicitly set, otherwise null.
+ */
+ public Property getExplicitProperty(int propId) {
+ return propertyList.getExplicit(propId);
+ }
+
+ /**
+ * Uses the stored writingMode.
+ * @param absdir an absolute direction (top, bottom, left, right)
+ * @return the corresponding writing model relative direction name
+ * for the flow object.
+ */
+ public int getWritingMode(int lrtb, int rltb, int tbrl) {
+ return propertyList.getWritingMode(lrtb, rltb, tbrl);
+ }
+
+
+ /**
+ * Uses the stored writingMode.
+ * @param relativeWritingMode relative direction (start, end, before, after)
+ * @return the corresponding absolute direction name for the flow object.
+ */
+ public String getAbsoluteWritingMode(int relativeWritingMode) {
+ return propertyList.getAbsoluteWritingMode(relativeWritingMode);
+ }
+
+ /**
* Setup the id for this formatting object.
* Most formatting objects can have an id that can be referenced.
* This methods checks that the id isn't already used by another
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java
index 373dca8be..d5421c085 100644
--- a/src/java/org/apache/fop/fo/PropertyList.java
+++ b/src/java/org/apache/fop/fo/PropertyList.java
@@ -33,9 +33,11 @@ import org.apache.fop.fo.properties.PropertyMaker;
public class PropertyList extends HashMap {
// writing-mode values
- private byte[] wmtable = null;
+ private byte[] writingModeTable = null;
+
// writing-mode index
private int writingMode;
+
private static boolean[] inheritableProperty;
// absolute directions and dimensions
@@ -66,11 +68,11 @@ public class PropertyList extends HashMap {
/** constant for dimension "inline-progression-dimension" */
public static final int INLINEPROGDIM = 5;
- private static final String[] ABS_NAMES = new String[] {
+ private static final String[] ABS_WM_NAMES = new String[] {
"left", "right", "top", "bottom", "height", "width"
};
- private static final String[] REL_NAMES = new String[] {
+ private static final String[] REL_WM_NAMES = new String[] {
"start", "end", "before", "after", "block-progression-dimension",
"inline-progression-dimension"
};
@@ -307,16 +309,25 @@ public class PropertyList extends HashMap {
}
/**
+ * Set the writing mode traits for the FO with this property list.
+ * @param writingMode the writing-mode property to be set for this object
+ */
+ public void setWritingMode(int writingMode) {
+ this.writingMode = writingMode;
+ this.writingModeTable = (byte[])WRITING_MODE_TABLES.get(new Integer(writingMode));
+ }
+
+ /**
* Uses the stored writingMode.
* @param absdir an absolute direction (top, bottom, left, right)
* @return the corresponding writing model relative direction name
* for the flow object.
*/
- public int wmMap(int lrtb, int rltb, int tbrl) {
+ public int getWritingMode(int lrtb, int rltb, int tbrl) {
switch (writingMode) {
- case Constants.WritingMode.LR_TB: return lrtb;
- case Constants.WritingMode.RL_TB: return rltb;
- case Constants.WritingMode.TB_RL: return tbrl;
+ case Constants.WritingMode.LR_TB: return lrtb;
+ case Constants.WritingMode.RL_TB: return rltb;
+ case Constants.WritingMode.TB_RL: return tbrl;
}
return -1;
}
@@ -324,14 +335,14 @@ public class PropertyList extends HashMap {
/**
* Uses the stored writingMode.
- * @param reldir a writing mode relative direction (start, end, before, after)
+ * @param relativeWritingMode relative direction (start, end, before, after)
* @return the corresponding absolute direction name for the flow object.
*/
- public String wmRelToAbs(int reldir) {
- if (wmtable != null) {
- for (int i = 0; i < wmtable.length; i++) {
- if (wmtable[i] == reldir) {
- return ABS_NAMES[i];
+ public String getAbsoluteWritingMode(int relativeWritingMode) {
+ if (writingModeTable != null) {
+ for (int i = 0; i < writingModeTable.length; i++) {
+ if (writingModeTable[i] == relativeWritingMode) {
+ return ABS_WM_NAMES[i];
}
}
}
@@ -339,15 +350,6 @@ public class PropertyList extends HashMap {
}
/**
- * Set the writing mode traits for the FO with this property list.
- * @param writingMode the writing-mode property to be set for this object
- */
- public void setWritingMode(int writingMode) {
- this.writingMode = writingMode;
- this.wmtable = (byte[])WRITING_MODE_TABLES.get(new Integer(writingMode));
- }
-
- /**
*
* @param attributes Collection of attributes passed to us from the parser.
* @throws FOPException If an error occurs while building the PropertyList
diff --git a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java b/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
index 23ad8d6df..f58b17718 100644
--- a/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
+++ b/src/java/org/apache/fop/fo/expr/BodyStartFunction.java
@@ -58,7 +58,7 @@ public class BodyStartFunction extends FunctionBase {
}
Numeric startIndent =
- ((ListItem)item).propertyList.get(Constants.PR_START_INDENT).getNumeric();
+ ((ListItem)item).getProperty(Constants.PR_START_INDENT).getNumeric();
return (Property) NumericOp.addition(distance, startIndent);
}
diff --git a/src/java/org/apache/fop/fo/expr/LabelEndFunction.java b/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
index 06c9d8327..5e88418e2 100644
--- a/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
+++ b/src/java/org/apache/fop/fo/expr/LabelEndFunction.java
@@ -63,7 +63,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(Constants.PR_START_INDENT).getLength();
+ Length startIndent = ((ListItem)item).getProperty(Constants.PR_START_INDENT).getLength();
// Should be CONTAINING_REFAREA but that doesn't work
LengthBase base = new LengthBase((ListItem)item, pInfo.getPropertyList(),
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java
index 6de00eb60..cb7de1642 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBody.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java
@@ -79,7 +79,7 @@ public class RegionBody extends Region {
private int getRelMargin(int reldir, int relPropId) {
FObj parent = (FObj) getParent();
String sPropName = "margin-"
- + parent.propertyList.wmRelToAbs(reldir);
+ + parent.getAbsoluteWritingMode(reldir);
int propId = FOPropertyMapping.getPropertyId(sPropName);
Property prop = propertyList.getExplicitOrShorthand(propId);
if (prop == null) {
diff --git a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java
index ee202e9ff..9d0292668 100644
--- a/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/CorrespondingPropertyMaker.java
@@ -69,19 +69,21 @@ public class CorrespondingPropertyMaker {
* direction has been specified in the input properties
*/
public boolean isCorrespondingForced(PropertyList propertyList) {
+
if (!relative) {
return false;
}
- PropertyList pList;
- if (useParent) {
- pList = propertyList.getParentFObj().propertyList;
+
+ PropertyList pList = (useParent) ? propertyList.getParentPropertyList() :
+ propertyList;
+
+ int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
+
+ if (pList.getExplicit(correspondingId) != null) {
+ return true;
} else {
- pList = propertyList;
+ return false;
}
- int correspondingId = pList.wmMap(lr_tb, rl_tb, tb_rl);
- if (propertyList.getExplicit(correspondingId) != null)
- return true;
- return false;
}
/**
@@ -104,7 +106,7 @@ public class CorrespondingPropertyMaker {
} else {
pList = propertyList;
}
- int correspondingId = pList.wmMap(lr_tb, rl_tb, tb_rl);
+ int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
Property p = propertyList.getExplicitOrShorthand(correspondingId);
if (p != null) {
diff --git a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java b/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java
index 43c04ce56..c228f256c 100644
--- a/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/DimensionPropertyMaker.java
@@ -58,7 +58,7 @@ public class DimensionPropertyMaker extends CorrespondingPropertyMaker {
}
// Based on min-[width|height]
- int wmcorr = propertyList.wmMap(extraCorresponding[0][0],
+ int wmcorr = propertyList.getWritingMode(extraCorresponding[0][0],
extraCorresponding[0][1],
extraCorresponding[0][2]);
Property subprop = propertyList.getExplicitOrShorthand(wmcorr);
@@ -67,7 +67,7 @@ public class DimensionPropertyMaker extends CorrespondingPropertyMaker {
}
// Based on max-[width|height]
- wmcorr = propertyList.wmMap(extraCorresponding[1][0],
+ wmcorr = propertyList.getWritingMode(extraCorresponding[1][0],
extraCorresponding[1][1],
extraCorresponding[1][2]);
subprop = propertyList.getExplicitOrShorthand(wmcorr);
diff --git a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java b/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
index 3ed94be69..cd04c0ebf 100644
--- a/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
+++ b/src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java
@@ -70,7 +70,8 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker {
*/
public Property compute(PropertyList propertyList) throws FOPException {
// TODO: bckfnn reenable
- if (propertyList.getExplicitOrShorthand(propertyList.wmMap(lr_tb, rl_tb, tb_rl)) == null) {
+ if (propertyList.getExplicitOrShorthand(
+ propertyList.getWritingMode(lr_tb, rl_tb, tb_rl)) == null) {
return null;
}
// Calculate the values as described in 5.3.2.
@@ -82,7 +83,7 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker {
v = v.add(propertyList.getInherited(propName).getNumeric());
}
*/
- v = NumericOp.addition(v, propertyList.get(propertyList.wmMap(lr_tb, rl_tb, tb_rl)).getNumeric());
+ v = NumericOp.addition(v, propertyList.get(propertyList.getWritingMode(lr_tb, rl_tb, tb_rl)).getNumeric());
v = NumericOp.addition(v, getCorresponding(paddingCorresponding, propertyList).getNumeric());
v = NumericOp.addition(v, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
return (Property) v;
@@ -94,7 +95,7 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker {
}
private Property getCorresponding(int[] corresponding, PropertyList propertyList) {
- int wmcorr = propertyList.wmMap(corresponding[0], corresponding[1], corresponding[2]);
+ int wmcorr = propertyList.getWritingMode(corresponding[0], corresponding[1], corresponding[2]);
return propertyList.get(wmcorr);
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
index c60144072..6b98673ff 100644
--- a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
+++ b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
@@ -296,7 +296,7 @@ public class AddLMVisitor implements FOTreeVisitor {
}
}*/
};
- lm.setAlignment(node.propertyList.get(Constants.PR_LEADER_ALIGNMENT).getEnum());
+ lm.setAlignment(node.getProperty(Constants.PR_LEADER_ALIGNMENT).getEnum());
currentLMList.add(lm);
}
@@ -397,7 +397,7 @@ public class AddLMVisitor implements FOTreeVisitor {
}
public InlineArea getCharacterInlineArea(Character node) {
- String str = node.propertyList.get(Constants.PR_CHARACTER).getString();
+ String str = node.getProperty(Constants.PR_CHARACTER).getString();
if (str.length() == 1) {
org.apache.fop.area.inline.Character ch =
new org.apache.fop.area.inline.Character(
@@ -417,7 +417,7 @@ public class AddLMVisitor implements FOTreeVisitor {
node.setupID();
LeafNodeLayoutManager lm = new LeafNodeLayoutManager(node);
lm.setCurrentArea(area);
- lm.setAlignment(node.propertyList.get(Constants.PR_VERTICAL_ALIGN).getEnum());
+ lm.setAlignment(node.getProperty(Constants.PR_VERTICAL_ALIGN).getEnum());
lm.setLead(node.getViewHeight());
currentLMList.add(lm);
}
@@ -453,7 +453,7 @@ public class AddLMVisitor implements FOTreeVisitor {
public void serveBlockContainer(BlockContainer node) {
BlockContainerLayoutManager blm = new BlockContainerLayoutManager(node);
- blm.setOverflow(node.propertyList.get(Constants.PR_OVERFLOW).getEnum());
+ blm.setOverflow(node.getProperty(Constants.PR_OVERFLOW).getEnum());
currentLMList.add(blm);
}
@@ -467,7 +467,7 @@ public class AddLMVisitor implements FOTreeVisitor {
if (areaCurrent != null) {
LeafNodeLayoutManager lm = new LeafNodeLayoutManager(node);
lm.setCurrentArea(areaCurrent);
- lm.setAlignment(node.propertyList.get(Constants.PR_VERTICAL_ALIGN).getEnum());
+ lm.setAlignment(node.getProperty(Constants.PR_VERTICAL_ALIGN).getEnum());
lm.setLead(areaCurrent.getHeight());
currentLMList.add(lm);
}
@@ -509,27 +509,27 @@ public class AddLMVisitor implements FOTreeVisitor {
int ipd = -1;
boolean bpdauto = false;
if (hasLH) {
- bpd = node.propertyList.get(Constants.PR_LINE_HEIGHT).getLength().getValue();
+ bpd = node.getProperty(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(Constants.PR_BLOCK_PROGRESSION_DIMENSION | Constants.CP_OPTIMUM).getLength();
+ len = node.getProperty(Constants.PR_BLOCK_PROGRESSION_DIMENSION | Constants.CP_OPTIMUM).getLength();
if (!len.isAuto()) {
bpd = len.getValue();
} else {
- len = node.propertyList.get(Constants.PR_HEIGHT).getLength();
+ len = node.getProperty(Constants.PR_HEIGHT).getLength();
if (!len.isAuto()) {
bpd = len.getValue();
}
}
}
- len = node.propertyList.get(Constants.PR_INLINE_PROGRESSION_DIMENSION | Constants.CP_OPTIMUM).getLength();
+ len = node.getProperty(Constants.PR_INLINE_PROGRESSION_DIMENSION | Constants.CP_OPTIMUM).getLength();
if (!len.isAuto()) {
ipd = len.getValue();
} else {
- len = node.propertyList.get(Constants.PR_WIDTH).getLength();
+ len = node.getProperty(Constants.PR_WIDTH).getLength();
if (!len.isAuto()) {
ipd = len.getValue();
}
@@ -539,7 +539,7 @@ public class AddLMVisitor implements FOTreeVisitor {
// to the content-height and content-width
int cwidth = -1;
int cheight = -1;
- len = node.propertyList.get(Constants.PR_CONTENT_WIDTH).getLength();
+ len = node.getProperty(Constants.PR_CONTENT_WIDTH).getLength();
if (!len.isAuto()) {
/*if(len.scaleToFit()) {
if(ipd != -1) {
@@ -548,7 +548,7 @@ public class AddLMVisitor implements FOTreeVisitor {
} else {*/
cwidth = len.getValue();
}
- len = node.propertyList.get(Constants.PR_CONTENT_HEIGHT).getLength();
+ len = node.getProperty(Constants.PR_CONTENT_HEIGHT).getLength();
if (!len.isAuto()) {
/*if(len.scaleToFit()) {
if(bpd != -1) {
@@ -571,7 +571,7 @@ public class AddLMVisitor implements FOTreeVisitor {
if (cheight == -1) {
cheight = (int)size.getY() * 1000;
}
- int scaling = node.propertyList.get(Constants.PR_SCALING).getEnum();
+ int scaling = node.getProperty(Constants.PR_SCALING).getEnum();
if (scaling == Constants.Scaling.UNIFORM) {
// adjust the larger
double rat1 = cwidth / (size.getX() * 1000f);
@@ -593,7 +593,7 @@ public class AddLMVisitor implements FOTreeVisitor {
boolean clip = false;
if (cwidth > ipd || cheight > bpd) {
- int overflow = node.propertyList.get(Constants.PR_OVERFLOW).getEnum();
+ int overflow = node.getProperty(Constants.PR_OVERFLOW).getEnum();
if (overflow == Constants.Overflow.HIDDEN) {
clip = true;
} else if (overflow == Constants.Overflow.ERROR_IF_OVERFLOW) {
diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
index 08122754d..d866023ec 100644
--- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -739,9 +739,9 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
private PageViewport createPageAreas(SimplePageMaster spm) {
int pageWidth =
- spm.propertyList.get(PR_PAGE_WIDTH).getLength().getValue();
+ spm.getProperty(PR_PAGE_WIDTH).getLength().getValue();
int pageHeight =
- spm.propertyList.get(PR_PAGE_HEIGHT).getLength().getValue();
+ spm.getProperty(PR_PAGE_HEIGHT).getLength().getValue();
// Set the page dimension as the toplevel containing block for margin.
((FObj) fobj.getParent()).setLayoutDimension(PercentBase.BLOCK_IPD, pageWidth);
((FObj) fobj.getParent()).setLayoutDimension(PercentBase.BLOCK_BPD, pageHeight);
@@ -833,7 +833,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
BodyRegion body = new BodyRegion();
setRegionPosition(r, body, absRegVPRect);
int columnCount =
- r.propertyList.get(PR_COLUMN_COUNT).getNumber().intValue();
+ r.getProperty(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.
@@ -844,7 +844,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
body.setColumnCount(columnCount);
int columnGap =
- r.propertyList.get(PR_COLUMN_GAP).getLength().getValue();
+ r.getProperty(PR_COLUMN_GAP).getLength().getValue();
body.setColumnGap(columnGap);
return body;
}
diff --git a/src/java/org/apache/fop/render/rtf/BuilderContext.java b/src/java/org/apache/fop/render/rtf/BuilderContext.java
index ffb37450c..768532d00 100644
--- a/src/java/org/apache/fop/render/rtf/BuilderContext.java
+++ b/src/java/org/apache/fop/render/rtf/BuilderContext.java
@@ -33,7 +33,6 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer;
* for the JFOR project and is now integrated into FOP.
*/
-
class BuilderContext {
/** stack of RtfContainers */
private final Stack containers = new Stack();
diff --git a/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java b/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
index 19f1489bd..80b2ecc1a 100644
--- a/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
@@ -21,7 +21,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.PropertyList;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.properties.LengthProperty;
import org.apache.fop.fo.properties.Property;
@@ -44,7 +44,7 @@ import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfText;
public class ListAttributesConverter {
- static RtfAttributes convertAttributes(PropertyList propertyList)
+ static RtfAttributes convertAttributes(FObj fobj)
throws FOPException {
RtfAttributes attrib = new RtfAttributes();
@@ -53,7 +53,7 @@ public class ListAttributesConverter {
int iStartIndentInTwips = 0;
//start-indent
- if ((prop = propertyList.get(Constants.PR_START_INDENT)) != null) {
+ if ((prop = fobj.getProperty(Constants.PR_START_INDENT)) != null) {
LengthProperty lengthprop = (LengthProperty)prop;
Float f = new Float(lengthprop.getLength().getValue() / 1000f);
@@ -67,7 +67,7 @@ public class ListAttributesConverter {
attrib.set(RtfListTable.LIST_INDENT, iStartIndentInTwips);
//end-indent
- if ((prop = propertyList.get(Constants.PR_END_INDENT)) != null) {
+ if ((prop = fobj.getProperty(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 5220bb1bc..24eaa3b38 100644
--- a/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/PageAttributesConverter.java
@@ -28,7 +28,6 @@ import org.apache.fop.fo.Constants;
import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.SimplePageMaster;
import org.apache.fop.fo.properties.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;
@@ -51,7 +50,6 @@ class PageAttributesConverter {
float fPageTop = 0;
float fPageBottom = 0;
- PropertyList props = null;
Property p = null;
Float f = null;
@@ -59,35 +57,32 @@ class PageAttributesConverter {
Region body = pagemaster.getRegion(Region.BODY_CODE);
Region after = pagemaster.getRegion(Region.AFTER_CODE);
- //page attributes
- props = pagemaster.propertyList;
-
- if ((p = props.get(Constants.PR_PAGE_WIDTH)) != null) {
+ if ((p = pagemaster.getProperty(Constants.PR_PAGE_WIDTH)) != null) {
f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.PAGE_WIDTH,
(int)converter.convertToTwips(f.toString() + "pt"));
}
- if ((p = props.get(Constants.PR_PAGE_HEIGHT)) != null) {
+ if ((p = pagemaster.getProperty(Constants.PR_PAGE_HEIGHT)) != null) {
f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.PAGE_HEIGHT,
(int)converter.convertToTwips(f.toString() + "pt"));
}
- if ((p = props.get(Constants.PR_MARGIN_TOP)) != null) {
+ if ((p = pagemaster.getProperty(Constants.PR_MARGIN_TOP)) != null) {
fPageTop = p.getLength().getValue() / 1000f;
}
- if ((p = props.get(Constants.PR_MARGIN_BOTTOM)) != null) {
+ if ((p = pagemaster.getProperty(Constants.PR_MARGIN_BOTTOM)) != null) {
fPageBottom = p.getLength().getValue() / 1000f;
}
- if ((p = props.get(Constants.PR_MARGIN_LEFT)) != null) {
+ if ((p = pagemaster.getProperty(Constants.PR_MARGIN_LEFT)) != null) {
f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.MARGIN_LEFT,
(int)converter.convertToTwips(f.toString() + "pt"));
}
- if ((p = props.get(Constants.PR_MARGIN_RIGHT)) != null) {
+ if ((p = pagemaster.getProperty(Constants.PR_MARGIN_RIGHT)) != null) {
f = new Float(p.getLength().getValue() / 1000f);
attrib.set(RtfPage.MARGIN_RIGHT,
(int)converter.convertToTwips(f.toString() + "pt"));
@@ -98,13 +93,11 @@ class PageAttributesConverter {
float fBodyBottom = fPageBottom;
if (body != null) {
- props = body.propertyList;
-
- if ((p = props.get(Constants.PR_MARGIN_TOP)) != null) {
+ if ((p = body.getProperty(Constants.PR_MARGIN_TOP)) != null) {
fBodyTop += p.getLength().getValue() / 1000f;
}
- if ((p = props.get(Constants.PR_MARGIN_BOTTOM)) != null) {
+ if ((p = body.getProperty(Constants.PR_MARGIN_BOTTOM)) != null) {
fBodyBottom += p.getLength().getValue() / 1000f;
}
}
@@ -121,9 +114,7 @@ class PageAttributesConverter {
float fBeforeTop = fPageTop;
if (before != null) {
- props = before.propertyList;
-
- if ((p = props.get(Constants.PR_MARGIN_TOP)) != null) {
+ if ((p = before.getProperty(Constants.PR_MARGIN_TOP)) != null) {
fBeforeTop += p.getLength().getValue() / 1000f;
}
}
@@ -136,9 +127,7 @@ class PageAttributesConverter {
float fAfterBottom = fPageBottom;
if (after != null) {
- props = after.propertyList;
-
- if ((p = props.get(Constants.PR_MARGIN_BOTTOM)) != null) {
+ if ((p = after.getProperty(Constants.PR_MARGIN_BOTTOM)) != null) {
fAfterBottom += p.getLength().getValue() / 1000f;
}
}
diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java
index f0b89f709..a57f91fba 100644
--- a/src/java/org/apache/fop/render/rtf/RTFHandler.java
+++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java
@@ -174,7 +174,7 @@ public class RTFHandler extends FOInputHandler {
//read page size and margins, if specified
Property prop;
- if ((prop = pageSeq.propertyList.get(Constants.PR_MASTER_REFERENCE)) != null) {
+ if ((prop = pageSeq.getProperty(Constants.PR_MASTER_REFERENCE)) != null) {
String reference = prop.getString();
SimplePageMaster pagemaster
@@ -330,7 +330,7 @@ public class RTFHandler extends FOInputHandler {
try {
RtfAttributes rtfAttr
- = TextAttributesConverter.convertAttributes(bl.propertyList, null);
+ = TextAttributesConverter.convertAttributes(bl);
IRtfTextrunContainer container
= (IRtfTextrunContainer)builderContext.getContainer(
@@ -410,7 +410,7 @@ public class RTFHandler extends FOInputHandler {
try {
RtfAttributes atts
- = TableAttributesConverter.convertTableAttributes(tbl.propertyList);
+ = TableAttributesConverter.convertTableAttributes(tbl);
final IRtfTableContainer tc
= (IRtfTableContainer)builderContext.getContainer(
@@ -503,7 +503,7 @@ public class RTFHandler extends FOInputHandler {
try {
RtfAttributes rtfAttr
- = TextAttributesConverter.convertCharacterAttributes(inl.propertyList, null);
+ = TextAttributesConverter.convertCharacterAttributes(inl);
IRtfTextrunContainer container
= (IRtfTextrunContainer)builderContext.getContainer(
@@ -557,7 +557,7 @@ public class RTFHandler extends FOInputHandler {
}
try {
- RtfAttributes atts = TableAttributesConverter.convertRowAttributes (tb.propertyList,
+ RtfAttributes atts = TableAttributesConverter.convertRowAttributes (tb,
null);
RtfTable tbl = (RtfTable)builderContext.getContainer(RtfTable.class, true, this);
@@ -598,7 +598,7 @@ public class RTFHandler extends FOInputHandler {
final RtfTable tbl = (RtfTable)builderContext.getContainer(RtfTable.class,
true, null);
- RtfAttributes atts = TableAttributesConverter.convertRowAttributes(tr.propertyList,
+ RtfAttributes atts = TableAttributesConverter.convertRowAttributes(tr,
tbl.getHeaderAttribs());
if (tr.getParent() instanceof TableHeader) {
@@ -654,12 +654,12 @@ public class RTFHandler extends FOInputHandler {
float width = tctx.getColumnWidth();
// create an RtfTableCell in the current RtfTableRow
- RtfAttributes atts = TableAttributesConverter.convertCellAttributes(tc.propertyList);
+ RtfAttributes atts = TableAttributesConverter.convertCellAttributes(tc);
RtfTableCell cell = row.newTableCell((int)width, atts);
//process number-rows-spanned attribute
Property p = null;
- if ((p = tc.propertyList.get(Constants.PR_NUMBER_ROWS_SPANNED)) != null) {
+ if ((p = tc.getProperty(Constants.PR_NUMBER_ROWS_SPANNED)) != null) {
// Start vertical merge
cell.setVMerge(RtfTableCell.MERGE_START);
@@ -704,7 +704,7 @@ public class RTFHandler extends FOInputHandler {
= (IRtfListContainer)builderContext.getContainer(
IRtfListContainer.class, true, this);
final RtfList newList = c.newList(
- ListAttributesConverter.convertAttributes(lb.propertyList));
+ ListAttributesConverter.convertAttributes(lb));
builderContext.pushContainer(newList);
} catch (IOException ioe) {
log.error("startList: " + ioe.getMessage());
@@ -854,9 +854,9 @@ public class RTFHandler extends FOInputHandler {
RtfHyperLink link=textrun.addHyperlink(new RtfAttributes());
StringProperty internal
- = (StringProperty)basicLink.propertyList.get(Constants.PR_INTERNAL_DESTINATION);
+ = (StringProperty)basicLink.getProperty(Constants.PR_INTERNAL_DESTINATION);
StringProperty external
- = (StringProperty)basicLink.propertyList.get(Constants.PR_EXTERNAL_DESTINATION);
+ = (StringProperty)basicLink.getProperty(Constants.PR_EXTERNAL_DESTINATION);
if(external != null) {
link.setExternalURL(external.getString());
@@ -906,7 +906,7 @@ public class RTFHandler extends FOInputHandler {
Property p = null;
//get source file
- if ((p = eg.propertyList.get(Constants.PR_SRC)) != null) {
+ if ((p = eg.getProperty(Constants.PR_SRC)) != null) {
newGraphic.setURL (p.getString());
} else {
log.error("The attribute 'src' of <fo:external-graphic> is required.");
@@ -914,7 +914,7 @@ public class RTFHandler extends FOInputHandler {
}
//get scaling
- if ((p = eg.propertyList.get(Constants.PR_SCALING)) != null) {
+ if ((p = eg.getProperty(Constants.PR_SCALING)) != null) {
EnumProperty e = (EnumProperty)p;
if (p.getEnum() == Constants.UNIFORM) {
newGraphic.setScaling ("uniform");
@@ -922,7 +922,7 @@ public class RTFHandler extends FOInputHandler {
}
//get width
- if ((p = eg.propertyList.get(Constants.PR_WIDTH)) != null) {
+ if ((p = eg.getProperty(Constants.PR_WIDTH)) != null) {
LengthProperty lengthProp = (LengthProperty)p;
if (lengthProp.getLength() instanceof FixedLength) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
@@ -932,7 +932,7 @@ public class RTFHandler extends FOInputHandler {
}
//get height
- if ((p = eg.propertyList.get(Constants.PR_HEIGHT)) != null) {
+ if ((p = eg.getProperty(Constants.PR_HEIGHT)) != null) {
LengthProperty lengthProp = (LengthProperty)p;
if (lengthProp.getLength() instanceof FixedLength) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
@@ -977,7 +977,7 @@ public class RTFHandler extends FOInputHandler {
try {
RtfAttributes rtfAttr
- = TextAttributesConverter.convertAttributes(footnote.propertyList, null);
+ = TextAttributesConverter.convertAttributes(footnote);
IRtfTextrunContainer container
= (IRtfTextrunContainer)builderContext.getContainer(
@@ -1103,7 +1103,7 @@ public class RTFHandler extends FOInputHandler {
try {
RtfAttributes rtfAttr
= TextAttributesConverter.convertCharacterAttributes(
- pagenum.propertyList, null);
+ pagenum);
IRtfTextrunContainer container
= (IRtfTextrunContainer)builderContext.getContainer(
diff --git a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
index c8c88927c..a10748500 100644
--- a/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
@@ -33,7 +33,7 @@ import org.apache.fop.fo.properties.ListProperty;
import org.apache.fop.fo.properties.NumberProperty;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.FObj;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
@@ -82,13 +82,13 @@ public class TableAttributesConverter {
*
* @throws ConverterException On convertion error
*/
- static RtfAttributes convertTableAttributes(PropertyList propertyList)
+ static RtfAttributes convertTableAttributes(FObj fobj)
throws FOPException {
RtfAttributes attrib = new RtfAttributes();
LengthProperty lengthProp = null;
// margin-left
- lengthProp = (LengthProperty)propertyList.get(Constants.PR_MARGIN_LEFT);
+ lengthProp = (LengthProperty)fobj.getProperty(Constants.PR_MARGIN_LEFT);
if (lengthProp != null) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
final String sValue = f.toString() + "pt";
@@ -103,14 +103,13 @@ public class TableAttributesConverter {
/**
* Converts cell attributes to rtf attributes.
- * @param attrs Given attributes
- * @param defaultAttributes Default rtf attributes
+ * @param fobj FObj whose properties are to be converted
*
* @return All valid rtf attributes together
*
- * @throws ConverterException On convertion error
+ * @throws ConverterException On conversion error
*/
- static RtfAttributes convertCellAttributes(PropertyList props)
+ static RtfAttributes convertCellAttributes(FObj fobj)
throws FOPException {
Property p;
@@ -119,12 +118,12 @@ public class TableAttributesConverter {
RtfAttributes attrib = null;
- attrib = new RtfAttributes();
+ attrib = new RtfAttributes();
boolean isBorderPresent = false;
// Cell background color
- if ((p = props.getNearestSpecified(Constants.PR_BACKGROUND_COLOR)) != null) {
+ if ((p = fobj.getNearestSpecifiedProperty(Constants.PR_BACKGROUND_COLOR)) != null) {
ColorType color = p.getColorType();
if (color != null) {
if (color.getAlpha() != 0
@@ -142,7 +141,7 @@ public class TableAttributesConverter {
}
// Cell borders :
- if ((p = props.getExplicit(Constants.PR_BORDER_COLOR)) != null) {
+ if ((p = fobj.getExplicitProperty(Constants.PR_BORDER_COLOR)) != null) {
ListProperty listprop = (ListProperty) p;
ColorType color = null;
if (listprop.getList().get(0) instanceof NCnameProperty) {
@@ -156,28 +155,28 @@ public class TableAttributesConverter {
colorTable.getColorNumber((int)color.getRed(), (int)color.getGreen(),
(int)color.getBlue()).intValue());
}
- if ((p = props.getExplicit(Constants.PR_BORDER_TOP_COLOR)) != null) {
+ if ((p = fobj.getExplicitProperty(Constants.PR_BORDER_TOP_COLOR)) != null) {
ColorType color = p.getColorType();
attrib.set(
BorderAttributesConverter.BORDER_COLOR,
colorTable.getColorNumber((int)color.getRed(), (int)color.getGreen(),
(int)color.getBlue()).intValue());
}
- if ((p = props.getExplicit(Constants.PR_BORDER_BOTTOM_COLOR)) != null) {
+ if ((p = fobj.getExplicitProperty(Constants.PR_BORDER_BOTTOM_COLOR)) != null) {
ColorType color = p.getColorType();
attrib.set(
BorderAttributesConverter.BORDER_COLOR,
colorTable.getColorNumber((int)color.getRed(), (int)color.getGreen(),
(int)color.getBlue()).intValue());
}
- if ((p = props.getExplicit(Constants.PR_BORDER_LEFT_COLOR)) != null) {
+ if ((p = fobj.getExplicitProperty(Constants.PR_BORDER_LEFT_COLOR)) != null) {
ColorType color = p.getColorType();
attrib.set(
BorderAttributesConverter.BORDER_COLOR,
colorTable.getColorNumber((int)color.getRed(), (int)color.getGreen(),
(int)color.getBlue()).intValue());
}
- if ((p = props.getExplicit(Constants.PR_BORDER_RIGHT_COLOR)) != null) {
+ if ((p = fobj.getExplicitProperty(Constants.PR_BORDER_RIGHT_COLOR)) != null) {
ColorType color = p.getColorType();
attrib.set(
BorderAttributesConverter.BORDER_COLOR,
@@ -187,25 +186,25 @@ public class TableAttributesConverter {
// Border styles do not inherit from parent
- ep = (EnumProperty)props.get(Constants.PR_BORDER_TOP_STYLE);
+ ep = (EnumProperty)fobj.getProperty(Constants.PR_BORDER_TOP_STYLE);
if (ep != null && ep.getEnum() != Constants.NONE) {
attrib.set(ITableAttributes.CELL_BORDER_TOP, "\\"
+ convertAttributetoRtf(ep.getEnum()));
isBorderPresent = true;
}
- ep = (EnumProperty)props.get(Constants.PR_BORDER_BOTTOM_STYLE);
+ ep = (EnumProperty)fobj.getProperty(Constants.PR_BORDER_BOTTOM_STYLE);
if (ep != null && ep.getEnum() != Constants.NONE) {
attrib.set(ITableAttributes.CELL_BORDER_BOTTOM, "\\"
+ convertAttributetoRtf(ep.getEnum()));
isBorderPresent = true;
}
- ep = (EnumProperty)props.get(Constants.PR_BORDER_LEFT_STYLE);
+ ep = (EnumProperty)fobj.getProperty(Constants.PR_BORDER_LEFT_STYLE);
if (ep != null && ep.getEnum() != Constants.NONE) {
attrib.set(ITableAttributes.CELL_BORDER_LEFT, "\\"
+ convertAttributetoRtf(ep.getEnum()));
isBorderPresent = true;
}
- ep = (EnumProperty)props.get(Constants.PR_BORDER_RIGHT_STYLE);
+ ep = (EnumProperty)fobj.getProperty(Constants.PR_BORDER_RIGHT_STYLE);
if (ep != null && ep.getEnum() != Constants.NONE) {
attrib.set(ITableAttributes.CELL_BORDER_RIGHT, "\\"
+ convertAttributetoRtf(ep.getEnum()));
@@ -213,15 +212,15 @@ public class TableAttributesConverter {
}
//Currently there is only one border width supported in each cell.
- p = props.get(Constants.PR_BORDER_LEFT_WIDTH);
+ p = fobj.getProperty(Constants.PR_BORDER_LEFT_WIDTH);
if(p == null) {
- p = props.get(Constants.PR_BORDER_RIGHT_WIDTH);
+ p = fobj.getProperty(Constants.PR_BORDER_RIGHT_WIDTH);
}
if(p == null) {
- p = props.get(Constants.PR_BORDER_TOP_WIDTH);
+ p = fobj.getProperty(Constants.PR_BORDER_TOP_WIDTH);
}
if(p == null) {
- p = props.get(Constants.PR_BORDER_BOTTOM_WIDTH);
+ p = fobj.getProperty(Constants.PR_BORDER_BOTTOM_WIDTH);
}
if (p != null) {
LengthProperty lengthprop = (LengthProperty)p;
@@ -240,7 +239,7 @@ public class TableAttributesConverter {
// Column spanning :
- NumberProperty n = (NumberProperty)props.get(Constants.PR_NUMBER_COLUMNS_SPANNED);
+ NumberProperty n = (NumberProperty)fobj.getProperty(Constants.PR_NUMBER_COLUMNS_SPANNED);
if (n != null && n.getNumber().intValue() > 1) {
attrib.set(ITableAttributes.COLUMN_SPAN, n.getNumber().intValue());
}
@@ -252,14 +251,13 @@ public class TableAttributesConverter {
/**
* Converts table and row attributes to rtf attributes.
*
- * @param attrs Given attributes
+ * @param fobj FObj to be converted
* @param defaultAttributes Default rtf attributes
*
* @return All valid rtf attributes together
- *
- * @throws ConverterException On convertion error
+ * @throws ConverterException On converion error
*/
- static RtfAttributes convertRowAttributes(PropertyList props,
+ static RtfAttributes convertRowAttributes(FObj fobj,
RtfAttributes rtfatts)
throws FOPException {
@@ -280,26 +278,26 @@ public class TableAttributesConverter {
//need to set a default width
//check for keep-together row attribute
- if ((p = props.get(Constants.PR_KEEP_TOGETHER | Constants.CP_WITHIN_PAGE)) != null) {
+ if ((p = fobj.getProperty(Constants.PR_KEEP_TOGETHER | Constants.CP_WITHIN_PAGE)) != null) {
attrib.set(ITableAttributes.ROW_KEEP_TOGETHER);
}
- if ((p = props.get(Constants.PR_KEEP_TOGETHER)) != null) {
+ if ((p = fobj.getProperty(Constants.PR_KEEP_TOGETHER)) != null) {
attrib.set(ITableAttributes.ROW_KEEP_TOGETHER);
}
//Check for keep-with-next row attribute.
- if ((p = props.get(Constants.PR_KEEP_WITH_NEXT)) != null) {
+ if ((p = fobj.getProperty(Constants.PR_KEEP_WITH_NEXT)) != null) {
attrib.set(ITableAttributes.ROW_KEEP_WITH_NEXT);
}
//Check for keep-with-previous row attribute.
- if ((p = props.get(Constants.PR_KEEP_WITH_PREVIOUS)) != null) {
+ if ((p = fobj.getProperty(Constants.PR_KEEP_WITH_PREVIOUS)) != null) {
attrib.set(ITableAttributes.ROW_KEEP_WITH_PREVIOUS);
}
//Check for height row attribute.
- if ((p = props.get(Constants.PR_HEIGHT)) != null) {
+ if ((p = fobj.getProperty(Constants.PR_HEIGHT)) != null) {
Float f = new Float(p.getLength().getValue() / 1000);
attrValue = f.toString() + "pt";
attrib.set(ITableAttributes.ROW_HEIGHT,
@@ -320,7 +318,7 @@ public class TableAttributesConverter {
* place.
*/
- ep = (EnumProperty)props.get(Constants.PR_BORDER_TOP_STYLE);
+ ep = (EnumProperty)fobj.getProperty(Constants.PR_BORDER_TOP_STYLE);
if (ep != null && ep.getEnum() != Constants.NONE) {
attrib.set(ITableAttributes.ROW_BORDER_TOP, "\\"
+ convertAttributetoRtf(ep.getEnum()));
@@ -328,7 +326,7 @@ public class TableAttributesConverter {
+ convertAttributetoRtf(ep.getEnum()));
isBorderPresent = true;
}
- ep = (EnumProperty)props.get(Constants.PR_BORDER_BOTTOM_STYLE);
+ ep = (EnumProperty)fobj.getProperty(Constants.PR_BORDER_BOTTOM_STYLE);
if (ep != null && ep.getEnum() != Constants.NONE) {
attrib.set(ITableAttributes.ROW_BORDER_BOTTOM, "\\"
+ convertAttributetoRtf(ep.getEnum()));
@@ -336,7 +334,7 @@ public class TableAttributesConverter {
+ convertAttributetoRtf(ep.getEnum()));
isBorderPresent = true;
}
- ep = (EnumProperty)props.get(Constants.PR_BORDER_LEFT_STYLE);
+ ep = (EnumProperty)fobj.getProperty(Constants.PR_BORDER_LEFT_STYLE);
if (ep != null && ep.getEnum() != Constants.NONE) {
attrib.set(ITableAttributes.ROW_BORDER_LEFT, "\\"
+ convertAttributetoRtf(ep.getEnum()));
@@ -344,7 +342,7 @@ public class TableAttributesConverter {
+ convertAttributetoRtf(ep.getEnum()));
isBorderPresent = true;
}
- ep = (EnumProperty)props.get(Constants.PR_BORDER_RIGHT_STYLE);
+ ep = (EnumProperty)fobj.getProperty(Constants.PR_BORDER_RIGHT_STYLE);
if (ep != null && ep.getEnum() != Constants.NONE) {
attrib.set(ITableAttributes.ROW_BORDER_RIGHT, "\\"
+ convertAttributetoRtf(ep.getEnum()));
@@ -352,37 +350,17 @@ public class TableAttributesConverter {
+ convertAttributetoRtf(ep.getEnum()));
isBorderPresent = true;
}
- ep = (EnumProperty)props.get("border-horizontal-style");
- if (ep != null && ep.getEnum() != Constants.NONE) {
- attrib.set(ITableAttributes.ROW_BORDER_HORIZONTAL, "\\"
- + convertAttributetoRtf(ep.getEnum()));
- attrib.set(ITableAttributes.ROW_BORDER_TOP, "\\"
- + convertAttributetoRtf(ep.getEnum()));
- attrib.set(ITableAttributes.ROW_BORDER_BOTTOM, "\\"
- + convertAttributetoRtf(ep.getEnum()));
- isBorderPresent = true;
- }
- ep = (EnumProperty)props.get("border-vertical-style");
- if (ep != null && ep.getEnum() != Constants.NONE) {
- attrib.set(ITableAttributes.ROW_BORDER_VERTICAL, "\\"
- + convertAttributetoRtf(ep.getEnum()));
- attrib.set(ITableAttributes.ROW_BORDER_LEFT, "\\"
- + convertAttributetoRtf(ep.getEnum()));
- attrib.set(ITableAttributes.ROW_BORDER_RIGHT, "\\"
- + convertAttributetoRtf(ep.getEnum()));
- isBorderPresent = true;
- }
//Currently there is only one border width supported in each cell.
- p = props.get(Constants.PR_BORDER_LEFT_WIDTH);
+ p = fobj.getProperty(Constants.PR_BORDER_LEFT_WIDTH);
if(p == null) {
- p = props.get(Constants.PR_BORDER_RIGHT_WIDTH);
+ p = fobj.getProperty(Constants.PR_BORDER_RIGHT_WIDTH);
}
if(p == null) {
- p = props.get(Constants.PR_BORDER_TOP_WIDTH);
+ p = fobj.getProperty(Constants.PR_BORDER_TOP_WIDTH);
}
if(p == null) {
- p = props.get(Constants.PR_BORDER_BOTTOM_WIDTH);
+ p = fobj.getProperty(Constants.PR_BORDER_BOTTOM_WIDTH);
}
if (p != null) {
LengthProperty lengthprop = (LengthProperty)p;
diff --git a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
index f53bc937d..0fc3902df 100644
--- a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
@@ -24,7 +24,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.impl.SimpleLog;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.properties.ColorTypeProperty;
import org.apache.fop.fo.properties.EnumProperty;
import org.apache.fop.fo.properties.LengthProperty;
@@ -54,62 +54,47 @@ class TextAttributesConverter {
/**
* Converts all known text FO properties to RtfAttributes
* @param props list of FO properites, which are to be converted
- * @param props list of default FO properites (usally null)
*/
- public static RtfAttributes convertAttributes(PropertyList props, PropertyList defProps)
+ public static RtfAttributes convertAttributes(FObj fobj)
throws FOPException {
RtfAttributes attrib = null;
- if (defProps != null) {
- attrib = convertAttributes(defProps, null);
- } else {
- attrib = new RtfAttributes();
- }
-
- attrBlockFontFamily(props, attrib);
- attrBlockFontWeight(props, attrib);
- attrBlockFontSize(props, attrib);
- attrBlockFontColor(props, attrib);
- attrBlockFontItalic(props, attrib);
- attrBlockFontUnderline(props, attrib);
- attrBlockBackgroundColor(props, attrib);
- attrBlockSpaceBeforeAfter(props, attrib);
- attrBlockMargins(props, attrib);
- attrBlockTextAlign(props, attrib);
+ attrib = new RtfAttributes();
+ attrBlockFontFamily(fobj, attrib);
+ attrBlockFontWeight(fobj, attrib);
+ attrBlockFontSize(fobj, attrib);
+ attrBlockFontColor(fobj, attrib);
+ attrBlockFontItalic(fobj, attrib);
+ attrBlockFontUnderline(fobj, attrib);
+ attrBlockBackgroundColor(fobj, attrib);
+ attrBlockSpaceBeforeAfter(fobj, attrib);
+ attrBlockMargins(fobj, attrib);
+ attrBlockTextAlign(fobj, attrib);
return attrib;
}
/**
* Converts all character related FO properties to RtfAttributes.
- * @param props list of FO properites, which are to be converted
- * @param props list of default FO properites (usally null)
+ * @param fobj FObj whose properties are to be converted
*/
public static RtfAttributes convertCharacterAttributes(
- PropertyList props, PropertyList defProps) throws FOPException {
-
- RtfAttributes attrib = null;
-
- if (defProps != null) {
- attrib = convertCharacterAttributes(defProps, null);
- } else {
- attrib = new RtfAttributes();
- }
-
- attrBlockFontFamily(props, attrib);
- attrBlockFontWeight(props, attrib);
- attrBlockFontSize(props, attrib);
- attrBlockFontColor(props, attrib);
- attrBlockFontItalic(props, attrib);
- attrBlockFontUnderline(props, attrib);
- attrBlockBackgroundColor(props, attrib);
-
+ FObj fobj) throws FOPException {
+
+ RtfAttributes attrib = new RtfAttributes();
+ attrBlockFontFamily(fobj, attrib);
+ attrBlockFontWeight(fobj, attrib);
+ attrBlockFontSize(fobj, attrib);
+ attrBlockFontColor(fobj, attrib);
+ attrBlockFontItalic(fobj, attrib);
+ attrBlockFontUnderline(fobj, attrib);
+ attrBlockBackgroundColor(fobj, attrib);
return attrib;
}
- private static void attrBlockFontFamily(PropertyList propertyList, RtfAttributes rtfAttr) {
- String fopValue = propertyList.get(Constants.PR_FONT_FAMILY).getString();
+ private static void attrBlockFontFamily(FObj fobj, RtfAttributes rtfAttr) {
+ String fopValue = fobj.getProperty(Constants.PR_FONT_FAMILY).getString();
if (fopValue != null) {
rtfAttr.set(RtfText.ATTR_FONT_FAMILY,
@@ -117,14 +102,14 @@ class TextAttributesConverter {
}
}
- private static void attrBlockFontSize(PropertyList propertyList, RtfAttributes rtfAttr) {
- int fopValue = propertyList.get(Constants.PR_FONT_SIZE).getLength().getValue() / 500;
+ private static void attrBlockFontSize(FObj fobj, RtfAttributes rtfAttr) {
+ int fopValue = fobj.getProperty(Constants.PR_FONT_SIZE).getLength().getValue() / 500;
rtfAttr.set("fs", fopValue);
}
- private static void attrBlockFontColor(PropertyList propertyList, RtfAttributes rtfAttr) {
+ private static void attrBlockFontColor(FObj fobj, RtfAttributes rtfAttr) {
// Cell background color
- ColorTypeProperty colorTypeProp = (ColorTypeProperty)propertyList.get(Constants.PR_COLOR);
+ ColorTypeProperty colorTypeProp = (ColorTypeProperty)fobj.getProperty(Constants.PR_COLOR);
if (colorTypeProp != null) {
ColorType colorType = colorTypeProp.getColorType();
if (colorType != null) {
@@ -144,8 +129,8 @@ class TextAttributesConverter {
- private static void attrBlockFontWeight(PropertyList propertyList, RtfAttributes rtfAttr) {
- String fopValue = propertyList.get(Constants.PR_FONT_WEIGHT).getString();
+ private static void attrBlockFontWeight(FObj fobj, RtfAttributes rtfAttr) {
+ String fopValue = fobj.getProperty(Constants.PR_FONT_WEIGHT).getString();
if (fopValue == "bold" || fopValue == "700") {
rtfAttr.set("b", 1);
} else {
@@ -153,8 +138,8 @@ class TextAttributesConverter {
}
}
- private static void attrBlockFontItalic(PropertyList propertyList, RtfAttributes rtfAttr) {
- String fopValue = propertyList.get(Constants.PR_FONT_STYLE).getString();
+ private static void attrBlockFontItalic(FObj fobj, RtfAttributes rtfAttr) {
+ String fopValue = fobj.getProperty(Constants.PR_FONT_STYLE).getString();
if (fopValue.equals("italic")) {
rtfAttr.set(RtfText.ATTR_ITALIC, 1);
} else {
@@ -162,8 +147,8 @@ class TextAttributesConverter {
}
}
- private static void attrBlockFontUnderline(PropertyList propertyList, RtfAttributes rtfAttr) {
- EnumProperty enumProp = (EnumProperty) propertyList.get(Constants.PR_TEXT_DECORATION);
+ private static void attrBlockFontUnderline(FObj fobj, RtfAttributes rtfAttr) {
+ EnumProperty enumProp = (EnumProperty) fobj.getProperty(Constants.PR_TEXT_DECORATION);
if (enumProp.getEnum() == Constants.UNDERLINE) {
rtfAttr.set(RtfText.ATTR_UNDERLINE, 1);
} else {
@@ -171,11 +156,11 @@ class TextAttributesConverter {
}
}
- private static void attrBlockSpaceBeforeAfter(PropertyList propertyList, RtfAttributes rtfAttr) {
+ private static void attrBlockSpaceBeforeAfter(FObj fobj, RtfAttributes rtfAttr) {
SpaceProperty spaceProp = null;
//space-before
- spaceProp = (SpaceProperty)propertyList.get(Constants.PR_SPACE_BEFORE);
+ spaceProp = (SpaceProperty)fobj.getProperty(Constants.PR_SPACE_BEFORE);
if (spaceProp != null) {
Float f = new Float(
spaceProp.getLengthRange().getOptimum().getLength().getValue() / 1000f);
@@ -191,7 +176,7 @@ class TextAttributesConverter {
}
//space-after
- spaceProp = (SpaceProperty)propertyList.get(Constants.PR_SPACE_AFTER);
+ spaceProp = (SpaceProperty)fobj.getProperty(Constants.PR_SPACE_AFTER);
if (spaceProp != null) {
Float f = new Float(
spaceProp.getLengthRange().getOptimum().getLength().getValue() / 1000f);
@@ -207,12 +192,12 @@ class TextAttributesConverter {
}
}
- private static void attrBlockMargins(PropertyList propertyList, RtfAttributes rtfAttr) {
+ private static void attrBlockMargins(FObj fobj, RtfAttributes rtfAttr) {
try {
LengthProperty lengthProp = null;
// margin-left
- lengthProp = (LengthProperty)propertyList.get(Constants.PR_MARGIN_LEFT);
+ lengthProp = (LengthProperty)fobj.getProperty(Constants.PR_MARGIN_LEFT);
if (lengthProp != null) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
String sValue = f.toString() + "pt";
@@ -225,7 +210,7 @@ class TextAttributesConverter {
}
// margin-right
- lengthProp = (LengthProperty)propertyList.get(Constants.PR_MARGIN_RIGHT);
+ lengthProp = (LengthProperty)fobj.getProperty(Constants.PR_MARGIN_RIGHT);
if (lengthProp != null) {
Float f = new Float(lengthProp.getLength().getValue() / 1000f);
String sValue = f.toString() + "pt";
@@ -243,8 +228,8 @@ class TextAttributesConverter {
- private static void attrBlockTextAlign(PropertyList propertyList, RtfAttributes rtfAttr) {
- int fopValue = propertyList.get(Constants.PR_TEXT_ALIGN).getEnum();
+ private static void attrBlockTextAlign(FObj fobj, RtfAttributes rtfAttr) {
+ int fopValue = fobj.getProperty(Constants.PR_TEXT_ALIGN).getEnum();
String rtfValue = null;
switch (fopValue) {
case Constants.CENTER:
@@ -270,8 +255,8 @@ class TextAttributesConverter {
* @param bl the Block object the properties are read from
* @param rtfAttr the RtfAttributes object the attributes are written to
*/
- private static void attrBlockBackgroundColor(PropertyList propertyList, RtfAttributes rtfAttr) {
- ColorType fopValue = propertyList.get(Constants.PR_BACKGROUND_COLOR).getColorType();
+ private static void attrBlockBackgroundColor(FObj fobj, RtfAttributes rtfAttr) {
+ ColorType fopValue = fobj.getProperty(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