#60625 - Rendering issue with background and shape overlayed by image

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1782712 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2017-02-13 00:52:38 +00:00
parent 967a3b0e0c
commit 41d7483ae3
2 changed files with 20 additions and 3 deletions

View File

@ -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<?,? 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;
}
}

View File

@ -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<HSLFShape,HSLFTextParagraph> {
*
* @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();
}
}