]> source.dussan.org Git - poi.git/commitdiff
#60625 - Rendering issue with background and shape overlayed by image
authorAndreas Beeker <kiwiwings@apache.org>
Mon, 13 Feb 2017 00:52:38 +0000 (00:52 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Mon, 13 Feb 2017 00:52:38 +0000 (00:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1782712 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java
src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextShape.java

index fb0b60e44a4d4120b572ad135806571a202800a3..7af81ce2f203d20ae88cbfe34a32fbb4434d058b 100644 (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;
     }
 }
index 4992d1bd45428bc52edc8af583f630cd0e5732be..6756e9ec968013d2806a3d5b8114022e9705bbad 100644 (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();
     }
 }
\ No newline at end of file