]> source.dussan.org Git - poi.git/commitdiff
common-crawl-regression-fix: fallback to higher template level for default font,...
authorAndreas Beeker <kiwiwings@apache.org>
Fri, 24 Jun 2016 00:12:25 +0000 (00:12 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Fri, 24 Jun 2016 00:12:25 +0000 (00:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1750034 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java

index e276a8a52cd696164f01c6f085cacb316a6b2694..edd17dec5554fc84f96ae4749cfea4ba65e5cab3 100644 (file)
@@ -784,37 +784,19 @@ public class XSLFTextParagraph implements TextParagraph<XSLFShape,XSLFTextParagr
                 cur.push();\r
                 if ((cur.toChild(nsPML, "txStyles") && cur.toChild(nsPML, defaultStyleSelector)) ||\r
                        (cur.pop() && cur.toChild(nsPML, "notesStyle"))) {\r
-                       if (cur.toChild(nsDML, "lvl" +(level+1)+ "pPr")) {\r
-                               return (CTTextParagraphProperties)cur.getObject();\r
-                       }\r
+                    while (level >= 0) {\r
+                        cur.push();\r
+                       if (cur.toChild(nsDML, "lvl" +(level+1)+ "pPr")) {\r
+                               return (CTTextParagraphProperties)cur.getObject();\r
+                       }\r
+                       cur.pop();\r
+                       level--;\r
+                    }\r
                 }\r
             } finally {\r
                cur.dispose();\r
             }\r
         }\r
-\r
-        \r
-//        for (CTTextBody txBody : (CTTextBody[])xo.selectPath(nsDecl+".//p:txBody")) {\r
-//            CTTextParagraphProperties defaultPr = null, lastPr = null;\r
-//            boolean hasLvl = false;\r
-//            for (CTTextParagraph p : txBody.getPArray()) {\r
-//                CTTextParagraphProperties pr = p.getPPr();\r
-//                if (pr.isSetLvl()) {\r
-//                    hasLvl |= true;\r
-//                    lastPr = pr;\r
-//                    if (pr.getLvl() == level) return pr;\r
-//                } else {\r
-//                    defaultPr = pr;\r
-//                }\r
-//            }\r
-//            if (!hasLvl) continue;\r
-//            if (level == 0 && defaultPr != null) return defaultPr;\r
-//            if (lastPr != null) return lastPr;\r
-//            break;\r
-//        }\r
-//           \r
-//        String err = "Failed to fetch default style for " + defaultStyleSelector + " and level=" + level;\r
-//        throw new IllegalArgumentException(err);\r
         \r
         return null;\r
     }\r