aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2017-02-08 01:12:22 +0000
committerAndreas Beeker <kiwiwings@apache.org>2017-02-08 01:12:22 +0000
commita002b7287e84ff8d90d49218c764fb75ce4aa118 (patch)
tree708ac639f7f3e8e33a5a1ee4341873fdba39c3b2 /src/java
parent7ed2c1e85af772be8821524f9a5599be0f8f7bfa (diff)
downloadpoi-a002b7287e84ff8d90d49218c764fb75ce4aa118.tar.gz
poi-a002b7287e84ff8d90d49218c764fb75ce4aa118.zip
#60625 - Rendering issue with background and shape overlayed by image
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1782096 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawMasterSheet.java19
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawShape.java37
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawSheet.java16
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawSlide.java3
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawTextParagraph.java106
-rw-r--r--src/java/org/apache/poi/sl/draw/DrawTextShape.java1
-rw-r--r--src/java/org/apache/poi/sl/draw/Drawable.java6
-rw-r--r--src/java/org/apache/poi/sl/usermodel/Placeholder.java28
-rw-r--r--src/java/org/apache/poi/sl/usermodel/Slide.java10
-rw-r--r--src/java/org/apache/poi/sl/usermodel/TextRun.java13
10 files changed, 194 insertions, 45 deletions
diff --git a/src/java/org/apache/poi/sl/draw/DrawMasterSheet.java b/src/java/org/apache/poi/sl/draw/DrawMasterSheet.java
index 3bcedbe850..a39cf7d68e 100644
--- a/src/java/org/apache/poi/sl/draw/DrawMasterSheet.java
+++ b/src/java/org/apache/poi/sl/draw/DrawMasterSheet.java
@@ -17,7 +17,13 @@
package org.apache.poi.sl.draw;
-import org.apache.poi.sl.usermodel.*;
+import java.awt.Graphics2D;
+
+import org.apache.poi.sl.usermodel.MasterSheet;
+import org.apache.poi.sl.usermodel.Placeholder;
+import org.apache.poi.sl.usermodel.Shape;
+import org.apache.poi.sl.usermodel.SimpleShape;
+import org.apache.poi.sl.usermodel.Slide;
public class DrawMasterSheet extends DrawSheet {
@@ -33,12 +39,15 @@ public class DrawMasterSheet extends DrawSheet {
* for instance, slide masters and layouts don't display placeholders
*/
@Override
- protected boolean canDraw(Shape<?,?> shape) {
+ protected boolean canDraw(Graphics2D graphics, Shape<?,?> shape) {
if (shape instanceof SimpleShape) {
+ // in XSLF, slidenumber and date shapes aren't marked as placeholders opposed to HSLF
Placeholder ph = ((SimpleShape<?,?>)shape).getPlaceholder();
- return ph == null;
- } else {
- return true;
+ if (ph != null) {
+ Slide<?,?> slide = (Slide<?,?>)graphics.getRenderingHint(Drawable.CURRENT_SLIDE);
+ return slide.getDisplayPlaceholder(ph);
+ }
}
+ return true;
}
}
diff --git a/src/java/org/apache/poi/sl/draw/DrawShape.java b/src/java/org/apache/poi/sl/draw/DrawShape.java
index b7b0915c18..bb1f490bf6 100644
--- a/src/java/org/apache/poi/sl/draw/DrawShape.java
+++ b/src/java/org/apache/poi/sl/draw/DrawShape.java
@@ -39,17 +39,33 @@ public class DrawShape implements Drawable {
}
/**
+ * Sometimes it's necessary to distinguish between XSLF/HSLF for the rendering.
+ * Use this method on the shape to determine, if we work on the BIFF implementation
+ *
+ * @param shape the shape to render
+ * @return {@code true} if HSLF implementation is used
+ */
+ protected static boolean isHSLF(Shape<?,?> shape) {
+ return shape.getClass().getCanonicalName().toLowerCase(Locale.ROOT).contains("hslf");
+ }
+
+ /**
* Apply 2-D transforms before drawing this shape. This includes rotation and flipping.
*
* @param graphics the graphics whos transform matrix will be modified
*/
+ @Override
public void applyTransform(Graphics2D graphics) {
- if (!(shape instanceof PlaceableShape)) return;
+ if (!(shape instanceof PlaceableShape)) {
+ return;
+ }
PlaceableShape<?,?> ps = (PlaceableShape<?,?>)shape;
- final boolean isHSLF = ps.getClass().getCanonicalName().toLowerCase(Locale.ROOT).contains("hslf");
+ final boolean isHSLF = isHSLF(shape);
AffineTransform tx = (AffineTransform)graphics.getRenderingHint(Drawable.GROUP_TRANSFORM);
- if (tx == null) tx = new AffineTransform();
+ if (tx == null) {
+ tx = new AffineTransform();
+ }
final Rectangle2D anchor = tx.createTransformedShape(ps.getAnchor()).getBounds2D();
char cmds[] = isHSLF ? new char[]{ 'h','v','r' } : new char[]{ 'r','h','v' };
@@ -81,7 +97,9 @@ public class DrawShape implements Drawable {
// normalize rotation
rotation %= 360.;
- if (rotation < 0) rotation += 360.;
+ if (rotation < 0) {
+ rotation += 360.;
+ }
int quadrant = (((int)rotation+45)/90)%4;
double scaleX = 1.0, scaleY = 1.0;
@@ -148,9 +166,11 @@ public class DrawShape implements Drawable {
return (dim2 == 0.) ? 1 : dim1/dim2;
}
+ @Override
public void draw(Graphics2D graphics) {
}
+ @Override
public void drawContent(Graphics2D graphics) {
}
@@ -176,7 +196,10 @@ public class DrawShape implements Drawable {
protected static BasicStroke getStroke(StrokeStyle strokeStyle) {
float lineWidth = (float) strokeStyle.getLineWidth();
- if (lineWidth == 0.0f) lineWidth = 0.25f; // Both PowerPoint and OOo draw zero-length lines as 0.25pt
+ if (lineWidth == 0.0f) {
+ // Both PowerPoint and OOo draw zero-length lines as 0.25pt
+ lineWidth = 0.25f;
+ }
LineDash lineDash = strokeStyle.getLineDash();
if (lineDash == null) {
@@ -194,7 +217,9 @@ public class DrawShape implements Drawable {
}
LineCap lineCapE = strokeStyle.getLineCap();
- if (lineCapE == null) lineCapE = LineCap.FLAT;
+ if (lineCapE == null) {
+ lineCapE = LineCap.FLAT;
+ }
int lineCap;
switch (lineCapE) {
case ROUND:
diff --git a/src/java/org/apache/poi/sl/draw/DrawSheet.java b/src/java/org/apache/poi/sl/draw/DrawSheet.java
index dbe82ea6c8..5c8d76abeb 100644
--- a/src/java/org/apache/poi/sl/draw/DrawSheet.java
+++ b/src/java/org/apache/poi/sl/draw/DrawSheet.java
@@ -17,13 +17,14 @@
package org.apache.poi.sl.draw;
-import java.awt.Dimension;
import java.awt.Color;
+import java.awt.Dimension;
import java.awt.Graphics2D;
-
import java.awt.geom.AffineTransform;
-import org.apache.poi.sl.usermodel.*;
+import org.apache.poi.sl.usermodel.MasterSheet;
+import org.apache.poi.sl.usermodel.Shape;
+import org.apache.poi.sl.usermodel.Sheet;
public class DrawSheet implements Drawable {
@@ -34,6 +35,7 @@ public class DrawSheet implements Drawable {
this.sheet = sheet;
}
+ @Override
public void draw(Graphics2D graphics) {
Dimension dim = sheet.getSlideShow().getPageSize();
Color whiteTrans = new Color(1f,1f,1f,0f);
@@ -51,7 +53,9 @@ public class DrawSheet implements Drawable {
graphics.setRenderingHint(Drawable.GROUP_TRANSFORM, new AffineTransform());
for (Shape<?,?> shape : sheet.getShapes()) {
- if(!canDraw(shape)) continue;
+ if(!canDraw(graphics, shape)) {
+ continue;
+ }
// remember the initial transform and restore it after we are done with drawing
AffineTransform at = graphics.getTransform();
@@ -73,9 +77,11 @@ public class DrawSheet implements Drawable {
}
}
+ @Override
public void applyTransform(Graphics2D context) {
}
+ @Override
public void drawContent(Graphics2D context) {
}
@@ -85,7 +91,7 @@ public class DrawSheet implements Drawable {
* Subclasses can override it and skip certain shapes from drawings,
* for instance, slide masters and layouts don't display placeholders
*/
- protected boolean canDraw(Shape<?,?> shape){
+ protected boolean canDraw(Graphics2D graphics, Shape<?,?> shape){
return true;
}
}
diff --git a/src/java/org/apache/poi/sl/draw/DrawSlide.java b/src/java/org/apache/poi/sl/draw/DrawSlide.java
index ae4baa27fb..2320e907a6 100644
--- a/src/java/org/apache/poi/sl/draw/DrawSlide.java
+++ b/src/java/org/apache/poi/sl/draw/DrawSlide.java
@@ -29,6 +29,8 @@ public class DrawSlide extends DrawSheet {
}
public void draw(Graphics2D graphics) {
+ graphics.setRenderingHint(Drawable.CURRENT_SLIDE, this.sheet);
+
Background<?,?> bg = sheet.getBackground();
if(bg != null) {
DrawFactory drawFact = DrawFactory.getInstance(graphics);
@@ -37,5 +39,6 @@ public class DrawSlide extends DrawSheet {
}
super.draw(graphics);
+ graphics.setRenderingHint(Drawable.CURRENT_SLIDE, null);
}
}
diff --git a/src/java/org/apache/poi/sl/draw/DrawTextParagraph.java b/src/java/org/apache/poi/sl/draw/DrawTextParagraph.java
index b1fbd9b067..f2b24b0ff2 100644
--- a/src/java/org/apache/poi/sl/draw/DrawTextParagraph.java
+++ b/src/java/org/apache/poi/sl/draw/DrawTextParagraph.java
@@ -41,10 +41,12 @@ import org.apache.poi.sl.usermodel.PaintStyle;
import org.apache.poi.sl.usermodel.PlaceableShape;
import org.apache.poi.sl.usermodel.ShapeContainer;
import org.apache.poi.sl.usermodel.Sheet;
+import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.sl.usermodel.TextParagraph;
import org.apache.poi.sl.usermodel.TextParagraph.BulletStyle;
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
import org.apache.poi.sl.usermodel.TextRun;
+import org.apache.poi.sl.usermodel.TextRun.FieldType;
import org.apache.poi.sl.usermodel.TextRun.TextCap;
import org.apache.poi.sl.usermodel.TextShape;
import org.apache.poi.sl.usermodel.TextShape.TextDirection;
@@ -82,6 +84,7 @@ public class DrawTextParagraph implements Drawable {
/**
* Resolves instances being deserialized to the predefined constants.
*/
+ @Override
protected Object readResolve() throws InvalidObjectException {
if (HYPERLINK_HREF.getName().equals(getName())) {
return HYPERLINK_HREF;
@@ -116,8 +119,11 @@ public class DrawTextParagraph implements Drawable {
autoNbrIdx = index;
}
+ @Override
public void draw(Graphics2D graphics){
- if (lines.isEmpty()) return;
+ if (lines.isEmpty()) {
+ return;
+ }
double penY = y;
@@ -144,7 +150,9 @@ public class DrawTextParagraph implements Drawable {
//The vertical line spacing
Double spacing = paragraph.getLineSpacing();
- if (spacing == null) spacing = 100d;
+ if (spacing == null) {
+ spacing = 100d;
+ }
for(DrawTextFragment line : lines){
double penX;
@@ -176,7 +184,9 @@ public class DrawTextParagraph implements Drawable {
double rightInset = insets.right;
TextAlign ta = paragraph.getTextAlign();
- if (ta == null) ta = TextAlign.LEFT;
+ if (ta == null) {
+ ta = TextAlign.LEFT;
+ }
switch (ta) {
case CENTER:
penX += (anchor.getWidth() - line.getWidth() - leftInset - rightInset - leftMargin) / 2;
@@ -217,9 +227,11 @@ public class DrawTextParagraph implements Drawable {
return (lines.isEmpty() || rawText.trim().isEmpty());
}
+ @Override
public void applyTransform(Graphics2D graphics) {
}
+ @Override
public void drawContent(Graphics2D graphics) {
}
@@ -243,10 +255,14 @@ public class DrawTextParagraph implements Drawable {
double wrappingWidth = getWrappingWidth(lines.size() == 0, graphics) + 1; // add a pixel to compensate rounding errors
// shape width can be smaller that the sum of insets (this was proved by a test file)
- if(wrappingWidth < 0) wrappingWidth = 1;
+ if(wrappingWidth < 0) {
+ wrappingWidth = 1;
+ }
int nextBreak = text.indexOf("\n", startIndex + 1);
- if (nextBreak == -1) nextBreak = it.getEndIndex();
+ if (nextBreak == -1) {
+ nextBreak = it.getEndIndex();
+ }
TextLayout layout = measurer.nextLayout((float)wrappingWidth, nextBreak, true);
if (layout == null) {
@@ -279,7 +295,9 @@ public class DrawTextParagraph implements Drawable {
maxLineHeight = Math.max(maxLineHeight, line.getHeight());
- if(endIndex == it.getEndIndex()) break;
+ if(endIndex == it.getEndIndex()) {
+ break;
+ }
}
rawText = text.toString();
@@ -287,7 +305,9 @@ public class DrawTextParagraph implements Drawable {
protected DrawTextFragment getBullet(Graphics2D graphics, AttributedCharacterIterator firstLineAttr) {
BulletStyle bulletStyle = paragraph.getBulletStyle();
- if (bulletStyle == null) return null;
+ if (bulletStyle == null) {
+ return null;
+ }
String buCharacter;
AutoNumberingScheme ans = bulletStyle.getAutoNumberingScheme();
@@ -296,10 +316,14 @@ public class DrawTextParagraph implements Drawable {
} else {
buCharacter = bulletStyle.getBulletCharacter();
}
- if (buCharacter == null) return null;
+ if (buCharacter == null) {
+ return null;
+ }
String buFont = bulletStyle.getBulletFont();
- if (buFont == null) buFont = paragraph.getDefaultFontFamily();
+ if (buFont == null) {
+ buFont = paragraph.getDefaultFontFamily();
+ }
assert(buFont != null);
PlaceableShape<?,?> ps = getParagraphShape();
@@ -313,9 +337,14 @@ public class DrawTextParagraph implements Drawable {
float fontSize = (Float)firstLineAttr.getAttribute(TextAttribute.SIZE);
Double buSz = bulletStyle.getBulletFontSize();
- if (buSz == null) buSz = 100d;
- if (buSz > 0) fontSize *= buSz* 0.01;
- else fontSize = (float)-buSz;
+ if (buSz == null) {
+ buSz = 100d;
+ }
+ if (buSz > 0) {
+ fontSize *= buSz* 0.01;
+ } else {
+ fontSize = (float)-buSz;
+ }
AttributedString str = new AttributedString(mapFontCharset(buCharacter,buFont));
@@ -328,7 +357,11 @@ public class DrawTextParagraph implements Drawable {
return fact.getTextFragment(layout, str);
}
- protected String getRenderableText(TextRun tr) {
+ protected String getRenderableText(Graphics2D graphics, TextRun tr) {
+ if (tr.getFieldType() == FieldType.SLIDE_NUMBER) {
+ Slide<?,?> slide = (Slide<?,?>)graphics.getRenderingHint(Drawable.CURRENT_SLIDE);
+ return (slide == null) ? "" : Integer.toString(slide.getSlideNumber());
+ }
StringBuilder buf = new StringBuilder();
TextCap cap = tr.getTextCap();
String tabs = null;
@@ -364,18 +397,24 @@ public class DrawTextParagraph implements Drawable {
private String tab2space(TextRun tr) {
AttributedString string = new AttributedString(" ");
String fontFamily = tr.getFontFamily();
- if (fontFamily == null) fontFamily = "Lucida Sans";
+ if (fontFamily == null) {
+ fontFamily = "Lucida Sans";
+ }
string.addAttribute(TextAttribute.FAMILY, fontFamily);
Double fs = tr.getFontSize();
- if (fs == null) fs = 12d;
+ if (fs == null) {
+ fs = 12d;
+ }
string.addAttribute(TextAttribute.SIZE, fs.floatValue());
TextLayout l = new TextLayout(string.getIterator(), new FontRenderContext(null, true, true));
double wspace = l.getAdvance();
Double tabSz = paragraph.getDefaultTabSize();
- if (tabSz == null) tabSz = wspace*4;
+ if (tabSz == null) {
+ tabSz = wspace*4;
+ }
int numSpaces = (int)Math.ceil(tabSz / wspace);
StringBuilder buf = new StringBuilder();
@@ -449,10 +488,13 @@ public class DrawTextParagraph implements Drawable {
}
if (firstLine && !isHSLF()) {
if (bullet != null){
- if (indent > 0) width -= indent;
+ if (indent > 0) {
+ width -= indent;
+ }
} else {
- if (indent > 0) width -= indent; // first line indentation
- else if (indent < 0) { // hanging indentation: the first line start at the left margin
+ if (indent > 0) {
+ width -= indent; // first line indentation
+ } else if (indent < 0) { // hanging indentation: the first line start at the left margin
width += leftMargin;
}
}
@@ -480,25 +522,36 @@ public class DrawTextParagraph implements Drawable {
@SuppressWarnings("rawtypes")
private PlaceableShape<?,?> getParagraphShape() {
return new PlaceableShape(){
+ @Override
public ShapeContainer<?,?> getParent() { return null; }
+ @Override
public Rectangle2D getAnchor() { return paragraph.getParentShape().getAnchor(); }
+ @Override
public void setAnchor(Rectangle2D anchor) {}
+ @Override
public double getRotation() { return 0; }
+ @Override
public void setRotation(double theta) {}
+ @Override
public void setFlipHorizontal(boolean flip) {}
+ @Override
public void setFlipVertical(boolean flip) {}
+ @Override
public boolean getFlipHorizontal() { return false; }
+ @Override
public boolean getFlipVertical() { return false; }
+ @Override
public Sheet<?,?> getSheet() { return paragraph.getParentShape().getSheet(); }
};
}
protected AttributedString getAttributedString(Graphics2D graphics, StringBuilder text){
List<AttributedStringData> attList = new ArrayList<AttributedStringData>();
- if (text == null) text = new StringBuilder();
+ if (text == null) {
+ text = new StringBuilder();
+ }
PlaceableShape<?,?> ps = getParagraphShape();
-
DrawFontManager fontHandler = (DrawFontManager)graphics.getRenderingHint(Drawable.FONT_HANDLER);
@SuppressWarnings("unchecked")
Map<String,String> fontMap = (Map<String,String>)graphics.getRenderingHint(Drawable.FONT_MAP);
@@ -506,9 +559,11 @@ public class DrawTextParagraph implements Drawable {
Map<String,String> fallbackMap = (Map<String,String>)graphics.getRenderingHint(Drawable.FONT_FALLBACK);
for (TextRun run : paragraph){
- String runText = getRenderableText(run);
+ String runText = getRenderableText(graphics, run);
// skip empty runs
- if (runText.isEmpty()) continue;
+ if (runText.isEmpty()) {
+ continue;
+ }
// user can pass an custom object to convert fonts
String mappedFont = run.getFontFamily();
@@ -633,8 +688,11 @@ public class DrawTextParagraph implements Drawable {
return string;
}
+ /**
+ * @return {@code true} if the HSLF implementation is used
+ */
protected boolean isHSLF() {
- return paragraph.getClass().getName().contains("HSLF");
+ return DrawShape.isHSLF(paragraph.getParentShape());
}
/**
diff --git a/src/java/org/apache/poi/sl/draw/DrawTextShape.java b/src/java/org/apache/poi/sl/draw/DrawTextShape.java
index 3a1d8faeea..45819624bb 100644
--- a/src/java/org/apache/poi/sl/draw/DrawTextShape.java
+++ b/src/java/org/apache/poi/sl/draw/DrawTextShape.java
@@ -138,6 +138,7 @@ public class DrawTextShape extends DrawSimpleShape {
double y0 = y;
//noinspection RedundantCast
+ @SuppressWarnings("cast")
Iterator<? extends TextParagraph<?,?,? extends TextRun>> paragraphs =
(Iterator<? extends TextParagraph<?,?,? extends TextRun>>) getShape().iterator();
diff --git a/src/java/org/apache/poi/sl/draw/Drawable.java b/src/java/org/apache/poi/sl/draw/Drawable.java
index 7df8533b56..cc85dde905 100644
--- a/src/java/org/apache/poi/sl/draw/Drawable.java
+++ b/src/java/org/apache/poi/sl/draw/Drawable.java
@@ -130,6 +130,12 @@ public interface Drawable {
DrawableHint GSAVE = new DrawableHint(10);
DrawableHint GRESTORE = new DrawableHint(11);
+ /**
+ * The Common SL Draw API works sometimes cascading, but there are places
+ * where the current slide context need to be evaluated, e.g. when slide numbers
+ * are printed. In this situation we need to have a way to access the current slide
+ */
+ DrawableHint CURRENT_SLIDE = new DrawableHint(12);
/**
diff --git a/src/java/org/apache/poi/sl/usermodel/Placeholder.java b/src/java/org/apache/poi/sl/usermodel/Placeholder.java
index a3bc9c7c88..e546e8bee2 100644
--- a/src/java/org/apache/poi/sl/usermodel/Placeholder.java
+++ b/src/java/org/apache/poi/sl/usermodel/Placeholder.java
@@ -114,12 +114,30 @@ public enum Placeholder {
this.ooxmlId = ooxmlId;
}
- public static Placeholder lookupNative(int nativeId) {
+ public static Placeholder lookupNativeSlide(int nativeId) {
+ return lookupNative(nativeId, 0);
+ }
+
+ public static Placeholder lookupNativeSlideMaster(int nativeId) {
+ return lookupNative(nativeId, 1);
+ }
+
+ public static Placeholder lookupNativeNotes(int nativeId) {
+ return lookupNative(nativeId, 2);
+ }
+
+ public static Placeholder lookupNativeNotesMaster(int nativeId) {
+ return lookupNative(nativeId, 3);
+ }
+
+
+ private static Placeholder lookupNative(int nativeId, int type) {
for (Placeholder ph : values()) {
- if (ph.nativeSlideId == nativeId ||
- ph.nativeSlideMasterId == nativeId ||
- ph.nativeNotesId == nativeId ||
- ph.nativeNotesMasterId == nativeId
+ if (
+ type == 0 && ph.nativeSlideId == nativeId ||
+ type == 1 && ph.nativeSlideMasterId == nativeId ||
+ type == 2 && ph.nativeNotesId == nativeId ||
+ type == 3 && ph.nativeNotesMasterId == nativeId
) {
return ph;
}
diff --git a/src/java/org/apache/poi/sl/usermodel/Slide.java b/src/java/org/apache/poi/sl/usermodel/Slide.java
index dae2f42e67..1f77ba6e5d 100644
--- a/src/java/org/apache/poi/sl/usermodel/Slide.java
+++ b/src/java/org/apache/poi/sl/usermodel/Slide.java
@@ -43,4 +43,14 @@ public interface Slide<
*/
String getTitle();
+ /**
+ * In XSLF, slidenumber and date shapes aren't marked as placeholders
+ * whereas in HSLF they are activated via a HeadersFooter configuration.
+ * This method is used to generalize that handling.
+ *
+ * @param placeholder
+ * @return {@code true} if the placeholder should be displayed/rendered
+ * @since POI 3.16-beta2
+ */
+ boolean getDisplayPlaceholder(Placeholder placeholder);
}
diff --git a/src/java/org/apache/poi/sl/usermodel/TextRun.java b/src/java/org/apache/poi/sl/usermodel/TextRun.java
index 014d3036b3..32b9c9933d 100644
--- a/src/java/org/apache/poi/sl/usermodel/TextRun.java
+++ b/src/java/org/apache/poi/sl/usermodel/TextRun.java
@@ -20,6 +20,7 @@ package org.apache.poi.sl.usermodel;
import java.awt.Color;
import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
+import org.apache.poi.util.Internal;
/**
* Some text.
@@ -30,6 +31,10 @@ public interface TextRun {
SMALL,
ALL
}
+
+ enum FieldType {
+ SLIDE_NUMBER, DATE_TIME
+ }
String getRawText();
void setText(String text);
@@ -176,4 +181,12 @@ public interface TextRun {
* @since POI 3.14-Beta2
*/
Hyperlink<?,?> createHyperlink();
+
+ /**
+ * Experimental method to determine the field type, e.g. slide number
+ *
+ * @return the field type or {@code null} if text run is not a field
+ */
+ @Internal
+ FieldType getFieldType();
}