aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java18
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java2
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java24
-rw-r--r--test-data/slideshow/bug55030.pptbin0 -> 15360 bytes
4 files changed, 36 insertions, 8 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java
index 8460a5b979..f1443ccfe0 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextParagraph.java
@@ -680,10 +680,16 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText
* Fetch the value of the given Paragraph related TextProp. Returns null if
* that TextProp isn't present. If the TextProp isn't present, the value
* from the appropriate Master Sheet will apply.
+ *
+ * The propName can be a comma-separated list, in case multiple equivalent values
+ * are queried
*/
protected static TextProp getPropVal(TextPropCollection props, String propName, HSLFTextParagraph paragraph) {
- TextProp prop = props.findByName(propName);
- if (prop != null) return prop;
+ String propNames[] = propName.split(",");
+ for (String pn : propNames) {
+ TextProp prop = props.findByName(pn);
+ if (prop != null) return prop;
+ }
BitMaskTextProp maskProp = (BitMaskTextProp) props.findByName(ParagraphFlagsTextProp.NAME);
boolean hardAttribute = (maskProp != null && maskProp.getValue() == 0);
@@ -698,7 +704,13 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText
}
boolean isChar = props.getTextPropType() == TextPropType.character;
- return master.getStyleAttribute(txtype, paragraph.getIndentLevel(), propName, isChar);
+
+ for (String pn : propNames) {
+ TextProp prop = master.getStyleAttribute(txtype, paragraph.getIndentLevel(), pn, isChar);
+ if (prop != null) return prop;
+ }
+
+ return null;
}
/**
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 5e6a705def..437fb745b8 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFTextRun.java
@@ -319,7 +319,7 @@ public final class HSLFTextRun implements TextRun {
if (sheet == null || slideShow == null) {
return _fontFamily;
}
- TextProp tp = getPropVal(characterStyle, "font.index", parentParagraph);
+ TextProp tp = getPropVal(characterStyle, "font.index,asian.font.index,ansi.font.index,symbol.font.index", parentParagraph);
if (tp == null) { return null; }
return slideShow.getFontCollection().getFontWithId(tp.getValue());
}
diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
index b57d9e4f2f..2c166ebf1f 100644
--- a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
+++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
@@ -43,9 +43,7 @@ import org.apache.poi.hslf.exceptions.OldPowerPointFormatException;
import org.apache.poi.hslf.extractor.PowerPointExtractor;
import org.apache.poi.hslf.model.HeadersFooters;
import org.apache.poi.hslf.record.Document;
-import org.apache.poi.hslf.record.OEPlaceholderAtom;
import org.apache.poi.hslf.record.Record;
-import org.apache.poi.hslf.record.RoundTripHFPlaceholder12;
import org.apache.poi.hslf.record.SlideListWithText;
import org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet;
import org.apache.poi.hslf.record.TextHeaderAtom;
@@ -783,8 +781,7 @@ public final class TestBugs {
@Test
public void bug58159() throws IOException {
- File sample = HSLFTestDataSamples.getSampleFile("bug58159_headers-and-footers.ppt");
- HSLFSlideShow ppt = (HSLFSlideShow)SlideShowFactory.create(sample);
+ HSLFSlideShow ppt = open("bug58159_headers-and-footers.ppt");
HeadersFooters hf = ppt.getSlideHeadersFooters();
assertNull(hf.getHeaderText());
assertEquals("Slide footer", hf.getFooterText());
@@ -806,6 +803,25 @@ public final class TestBugs {
}
ppt.close();
}
+
+ @Test
+ public void bug55030() throws IOException {
+ HSLFSlideShow ppt = open("bug55030.ppt");
+
+ String expFamily = "\u96b6\u4e66";
+
+ HSLFSlide sl = ppt.getSlides().get(0);
+ for (List<HSLFTextParagraph> paraList : sl.getTextParagraphs()) {
+ for (HSLFTextParagraph htp : paraList) {
+ for (HSLFTextRun htr : htp) {
+ String actFamily = htr.getFontFamily();
+ assertEquals(expFamily, actFamily);
+ }
+ }
+ }
+
+ ppt.close();
+ }
private static HSLFSlideShow open(String fileName) throws IOException {
File sample = HSLFTestDataSamples.getSampleFile(fileName);
diff --git a/test-data/slideshow/bug55030.ppt b/test-data/slideshow/bug55030.ppt
new file mode 100644
index 0000000000..1f2f22b004
--- /dev/null
+++ b/test-data/slideshow/bug55030.ppt
Binary files differ