You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by bc...@apache.org on 2004/10/01 11:19:15 UTC
cvs commit: xml-fop/src/java/org/apache/fop/render/rtf ListAttributesConverter.java
bckfnn 2004/10/01 02:19:15
Modified: src/java/org/apache/fop/render/rtf
ListAttributesConverter.java
Log:
Simplified the handling of length attributes.
Revision Changes Path
1.8 +6 -39 xml-fop/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java
Index: ListAttributesConverter.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/ListAttributesConverter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ListAttributesConverter.java 22 May 2004 21:44:38 -0000 1.7
+++ ListAttributesConverter.java 1 Oct 2004 09:19:15 -0000 1.8
@@ -22,8 +22,6 @@
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.properties.LengthProperty;
-import org.apache.fop.fo.properties.Property;
//RTF
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
@@ -47,43 +45,12 @@
static RtfAttributes convertAttributes(FObj fobj)
throws FOPException {
- RtfAttributes attrib = new RtfAttributes();
+ FOPRtfAttributes attrib = new FOPRtfAttributes();
- Property prop = null;
- int iStartIndentInTwips = 0;
-
- //start-indent
- if ((prop = fobj.getProperty(Constants.PR_START_INDENT)) != null) {
- LengthProperty lengthprop = (LengthProperty)prop;
-
- Float f = new Float(lengthprop.getLength().getValue() / 1000f);
- String sValue = f.toString() + "pt";
-
- iStartIndentInTwips = (int) FoUnitsConverter.getInstance().convertToTwips(sValue);
- } else {
- //set default
- iStartIndentInTwips = 360;
- }
- attrib.set(RtfListTable.LIST_INDENT, iStartIndentInTwips);
-
- //end-indent
- if ((prop = fobj.getProperty(Constants.PR_END_INDENT)) != null) {
- LengthProperty lengthprop = (LengthProperty)prop;
-
- Float f = new Float(lengthprop.getLength().getValue() / 1000f);
- String sValue = f.toString() + "pt";
-
- attrib.set(RtfText.LEFT_INDENT_BODY,
- (int) FoUnitsConverter.getInstance().convertToTwips(sValue));
- } else {
- if (iStartIndentInTwips >= 360) {
- //if the start indent is greater than default, set to the start indent
- attrib.set(RtfText.LEFT_INDENT_BODY, iStartIndentInTwips);
- } else {
- //else set to default
- attrib.set(RtfText.LEFT_INDENT_BODY, 360);
- }
- }
+ attrib.set(RtfListTable.LIST_INDENT,
+ fobj.getProperty(Constants.PR_START_INDENT).getLength());
+ attrib.set(RtfText.LEFT_INDENT_BODY,
+ fobj.getProperty(Constants.PR_END_INDENT).getLength());
/*
* set list table defaults
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org