diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java index fb0b60e44..7af81ce2f 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java @@ -26,10 +26,13 @@ import org.apache.poi.hslf.model.textproperties.TextProp; import org.apache.poi.hslf.model.textproperties.TextPropCollection; import org.apache.poi.hslf.model.textproperties.TextPropCollection.TextPropType; import org.apache.poi.sl.draw.DrawPaint; +import org.apache.poi.sl.usermodel.MasterSheet; import org.apache.poi.sl.usermodel.PaintStyle; import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint; import org.apache.poi.sl.usermodel.Placeholder; +import org.apache.poi.sl.usermodel.TextParagraph; import org.apache.poi.sl.usermodel.TextRun; +import org.apache.poi.sl.usermodel.TextShape; import org.apache.poi.util.Internal; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; @@ -426,7 +429,9 @@ public final class HSLFTextRun implements TextRun { @Override public FieldType getFieldType() { - Placeholder ph = getTextParagraph().getParentShape().getPlaceholder(); + HSLFTextShape ts = getTextParagraph().getParentShape(); + Placeholder ph = ts.getPlaceholder(); + if (ph != null) { switch (ph) { case SLIDE_NUMBER: @@ -437,6 +442,16 @@ public final class HSLFTextRun implements TextRun { break; } } + + if (ts.getSheet() instanceof MasterSheet) { + TextShape> ms = ts.getMetroShape(); + if (ms == null) { + return null; + } + TextRun tr = ms.getTextParagraphs().get(0).getTextRuns().get(0); + return tr.getFieldType(); + } + return null; } } diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java index 4992d1bd4..6756e9ec9 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java +++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java @@ -47,6 +47,8 @@ import org.apache.poi.sl.draw.DrawTextShape; import org.apache.poi.sl.usermodel.Insets2D; import org.apache.poi.sl.usermodel.Placeholder; import org.apache.poi.sl.usermodel.ShapeContainer; +import org.apache.poi.sl.usermodel.TextParagraph; +import org.apache.poi.sl.usermodel.TextRun; import org.apache.poi.sl.usermodel.TextShape; import org.apache.poi.sl.usermodel.VerticalAlignment; import org.apache.poi.util.POILogFactory; @@ -925,8 +927,8 @@ implements TextShape { * * @return null, if there's no alternative representation, otherwise the text shape */ - public TextShape getMetroShape() { - HSLFMetroShape> mbs = new HSLFMetroShape>(this); + public TextShape> getMetroShape() { + HSLFMetroShape>> mbs = new HSLFMetroShape>>(this); return mbs.getShape(); } } \ No newline at end of file