summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-06-24 00:12:25 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-06-24 00:12:25 +0000
commit81dbf1edc94a73678c3720a1689405323b14e0ae (patch)
tree9334c8dcdf4e4279acde5875dad6cf05622c4f5a
parent5eb18f4a83a637df3014f4dd9dacf5b4d57cb809 (diff)
downloadpoi-81dbf1edc94a73678c3720a1689405323b14e0ae.tar.gz
poi-81dbf1edc94a73678c3720a1689405323b14e0ae.zip
common-crawl-regression-fix: fallback to higher template level for default font, in case the style reference can't be determined
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1750034 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
index e276a8a52c..edd17dec55 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java
@@ -784,37 +784,19 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
cur.push();
if ((cur.toChild(nsPML, "txStyles") && cur.toChild(nsPML, defaultStyleSelector)) ||
(cur.pop() && cur.toChild(nsPML, "notesStyle"))) {
- if (cur.toChild(nsDML, "lvl" +(level+1)+ "pPr")) {
- return (CTTextParagraphProperties)cur.getObject();
- }
+ while (level >= 0) {
+ cur.push();
+ if (cur.toChild(nsDML, "lvl" +(level+1)+ "pPr")) {
+ return (CTTextParagraphProperties)cur.getObject();
+ }
+ cur.pop();
+ level--;
+ }
}
} finally {
cur.dispose();
}
}
-
-
-// for (CTTextBody txBody : (CTTextBody[])xo.selectPath(nsDecl+".//p:txBody")) {
-// CTTextParagraphProperties defaultPr = null, lastPr = null;
-// boolean hasLvl = false;
-// for (CTTextParagraph p : txBody.getPArray()) {
-// CTTextParagraphProperties pr = p.getPPr();
-// if (pr.isSetLvl()) {
-// hasLvl |= true;
-// lastPr = pr;
-// if (pr.getLvl() == level) return pr;
-// } else {
-// defaultPr = pr;
-// }
-// }
-// if (!hasLvl) continue;
-// if (level == 0 && defaultPr != null) return defaultPr;
-// if (lastPr != null) return lastPr;
-// break;
-// }
-//
-// String err = "Failed to fetch default style for " + defaultStyleSelector + " and level=" + level;
-// throw new IllegalArgumentException(err);
return null;
}