aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/rtf
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 /src/java/org/apache/fop/render/rtf
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
Diffstat (limited to 'src/java/org/apache/fop/render/rtf')
-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
6 files changed, 115 insertions, 164 deletions
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