aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
diff options
context:
space:
mode:
authorPeter Herweg <pherweg@apache.org>2005-08-29 20:46:15 +0000
committerPeter Herweg <pherweg@apache.org>2005-08-29 20:46:15 +0000
commit8ff5b13709a136cb342b3271c8d71b0c8dc31f90 (patch)
tree318336419ef7442b1d72b97231115d4574e37554 /src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
parent0acbef0d3f65b1f2404cb2f507a7e2171f04726b (diff)
downloadxmlgraphics-fop-8ff5b13709a136cb342b3271c8d71b0c8dc31f90.tar.gz
xmlgraphics-fop-8ff5b13709a136cb342b3271c8d71b0c8dc31f90.zip
added support for text-decoration
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@264639 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/rtf/TextAttributesConverter.java')
-rw-r--r--src/java/org/apache/fop/render/rtf/TextAttributesConverter.java31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
index 0c2cc05b9..319059d4a 100644
--- a/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
+++ b/src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
@@ -25,6 +25,7 @@ import org.apache.commons.logging.impl.SimpleLog;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FOText;
import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.flow.BlockContainer;
import org.apache.fop.fo.flow.Character;
@@ -33,6 +34,7 @@ import org.apache.fop.fo.flow.PageNumber;
import org.apache.fop.fo.properties.ColorTypeProperty;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonFont;
+import org.apache.fop.fo.properties.CommonTextDecoration;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfAttributes;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable;
@@ -89,18 +91,15 @@ class TextAttributesConverter {
* @param fobj FObj whose properties are to be converted
*/
public static RtfAttributes convertCharacterAttributes(
- Character fobj) throws FOPException {
+ FOText fobj) throws FOPException {
FOPRtfAttributes attrib = new FOPRtfAttributes();
attrFont(fobj.getCommonFont(), attrib);
attrFontColor(fobj.getColor(), attrib);
- //TODO Fix text-decoration here!
- //attrTextDecoration(fobj.getTextDecoration(), attrib);
-
- attrBackgroundColor(fobj.getCommonBorderPaddingBackground(), attrib);
+ attrTextDecoration(fobj.getTextDecoration(), attrib);
return attrib;
}
-
+
/**
* Converts all character related FO properties to RtfAttributes.
* @param fobj FObj whose properties are to be converted
@@ -110,8 +109,7 @@ class TextAttributesConverter {
FOPRtfAttributes attrib = new FOPRtfAttributes();
attrFont(fobj.getCommonFont(), attrib);
- //TODO Fix text-decoration here!
- //attrTextDecoration(fobj.getTextDecoration(), attrib);
+ attrTextDecoration(fobj.getTextDecoration(), attrib);
attrBackgroundColor(fobj.getCommonBorderPaddingBackground(), attrib);
return attrib;
}
@@ -126,8 +124,7 @@ class TextAttributesConverter {
FOPRtfAttributes attrib = new FOPRtfAttributes();
attrFont(fobj.getCommonFont(), attrib);
attrFontColor(fobj.getColor(), attrib);
- //TODO Fix text-decoration here!
- //attrTextDecoration(fobj.getTextDecoration(), attrib);
+
attrBackgroundColor(fobj.getCommonBorderPaddingBackground(), attrib);
return attrib;
}
@@ -168,12 +165,22 @@ class TextAttributesConverter {
- private static void attrTextDecoration(int textDecoration, RtfAttributes rtfAttr) {
- if (textDecoration == Constants.EN_UNDERLINE) {
+ private static void attrTextDecoration(CommonTextDecoration textDecoration, RtfAttributes rtfAttr) {
+ if (textDecoration == null) {
+ return;
+ }
+
+ if (textDecoration.hasUnderline()) {
rtfAttr.set(RtfText.ATTR_UNDERLINE, 1);
} else {
rtfAttr.set(RtfText.ATTR_UNDERLINE, 0);
}
+
+ if (textDecoration.hasLineThrough()) {
+ rtfAttr.set(RtfText.ATTR_STRIKETHROUGH, 1);
+ } else {
+ rtfAttr.set(RtfText.ATTR_STRIKETHROUGH, 0);
+ }
}
private static void attrBlockMargin(CommonMarginBlock cmb, FOPRtfAttributes rtfAttr) {