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;
@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:
break;
}
}
+
+ if (ts.getSheet() instanceof MasterSheet) {
+ TextShape<?,? extends TextParagraph<?,?,TextRun>> ms = ts.getMetroShape();
+ if (ms == null) {
+ return null;
+ }
+ TextRun tr = ms.getTextParagraphs().get(0).getTextRuns().get(0);
+ return tr.getFieldType();
+ }
+
return null;
}
}
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;
*
* @return null, if there's no alternative representation, otherwise the text shape
*/
- public TextShape<?,?> getMetroShape() {
- HSLFMetroShape<TextShape<?,?>> mbs = new HSLFMetroShape<TextShape<?,?>>(this);
+ public TextShape<?,? extends TextParagraph<?,?,TextRun>> getMetroShape() {
+ HSLFMetroShape<TextShape<?,? extends TextParagraph<?,?,TextRun>>> mbs = new HSLFMetroShape<TextShape<?,? extends TextParagraph<?,?,TextRun>>>(this);
return mbs.getShape();
}
}
\ No newline at end of file