aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2011-10-28 14:25:53 +0000
committerYegor Kozlov <yegor@apache.org>2011-10-28 14:25:53 +0000
commitb1cb335834fc9c89102540dcde439d4186462e6b (patch)
tree8f5ef9720704dd7b12696b2b9c103148a68dc098 /src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
parentd3ca235708e88ba575d276d41dcaf3b0b4093c67 (diff)
downloadpoi-b1cb335834fc9c89102540dcde439d4186462e6b.tar.gz
poi-b1cb335834fc9c89102540dcde439d4186462e6b.zip
more progress with PPTX2PNG: support for gradient and texture fill, also refactored usages of colors in drawingML
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1190347 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java')
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
index c4ac046070..a67dc0d34a 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
@@ -19,28 +19,27 @@ package org.apache.poi.xslf.usermodel;
import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal;
import org.apache.poi.util.Units;
-import org.apache.poi.xslf.model.PropertyFetcher;
import org.apache.poi.xslf.model.ParagraphPropertyFetcher;
import org.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextField;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraphProperties;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextSpacing;
import org.openxmlformats.schemas.drawingml.x2006.main.STTextAlignType;
-import org.openxmlformats.schemas.drawingml.x2006.main.CTTextField;
import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
import java.awt.*;
-import java.awt.geom.Rectangle2D;
-import java.awt.font.TextLayout;
-import java.awt.font.TextAttribute;
import java.awt.font.LineBreakMeasurer;
-import java.text.AttributedString;
+import java.awt.font.TextAttribute;
+import java.awt.font.TextLayout;
+import java.awt.geom.Rectangle2D;
import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
/**
* Represents a paragraph of text within the containing text body.
@@ -187,7 +186,8 @@ public class XSLFTextParagraph implements Iterable<XSLFTextRun>{
ParagraphPropertyFetcher<Color> fetcher = new ParagraphPropertyFetcher<Color>(getLevel()){
public boolean fetch(CTTextParagraphProperties props){
if(props.isSetBuClr()){
- setValue(theme.getColor(props.getBuClr()));
+ XSLFColor c = new XSLFColor(props.getBuClr(), theme);
+ setValue(c.getColor());
return true;
}
return false;
@@ -580,7 +580,7 @@ public class XSLFTextParagraph implements Iterable<XSLFTextRun>{
string.addAttribute(TextAttribute.FOREGROUND, run.getFontColor(), startIndex, endIndex);
string.addAttribute(TextAttribute.FAMILY, run.getFontFamily(), startIndex, endIndex);
- string.addAttribute(TextAttribute.SIZE, run.getFontSize(), startIndex, endIndex);
+ string.addAttribute(TextAttribute.SIZE, (float)run.getFontSize(), startIndex, endIndex);
if(run.isBold()) {
string.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, startIndex, endIndex);
}
@@ -589,10 +589,17 @@ public class XSLFTextParagraph implements Iterable<XSLFTextRun>{
}
if(run.isUnderline()) {
string.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, startIndex, endIndex);
+ string.addAttribute(TextAttribute.INPUT_METHOD_UNDERLINE, TextAttribute.UNDERLINE_LOW_TWO_PIXEL, startIndex, endIndex);
}
if(run.isStrikethrough()) {
string.addAttribute(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON, startIndex, endIndex);
}
+ if(run.isSubscript()) {
+ string.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUB, startIndex, endIndex);
+ }
+ if(run.isSuperscript()) {
+ string.addAttribute(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER, startIndex, endIndex);
+ }
startIndex = endIndex;
}
@@ -646,8 +653,8 @@ public class XSLFTextParagraph implements Iterable<XSLFTextRun>{
bit.getAttribute(TextAttribute.FOREGROUND) : buColor);
str.addAttribute(TextAttribute.FAMILY, buFont);
- double fontSize = (Double)bit.getAttribute(TextAttribute.SIZE);
- double buSz = getBulletFontSize();
+ float fontSize = (Float)bit.getAttribute(TextAttribute.SIZE);
+ float buSz = (float)getBulletFontSize();
if(buSz > 0) fontSize *= buSz* 0.01;
else fontSize = -buSz;