]> source.dussan.org Git - poi.git/commitdiff
styles shall be applied after lists as well [as PAPX]
authorSergey Vladimirov <sergey@apache.org>
Wed, 21 Sep 2011 21:16:53 +0000 (21:16 +0000)
committerSergey Vladimirov <sergey@apache.org>
Wed, 21 Sep 2011 21:16:53 +0000 (21:16 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1173866 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java

index 1e741eb39c11e426e792542d0d742141ab16a791..11e91fa5e23ae22c130b1d232cf416207e61fb02 100644 (file)
@@ -98,14 +98,8 @@ public class Paragraph extends Range implements Cloneable {
         ParagraphProperties properties = new ParagraphProperties();
         properties.setIstd( papx.getIstd() );
 
-        if ( styleSheet != null )
-        {
-            int style = papx.getIstd();
-            byte[] grpprl = styleSheet.getPAPX( style );
-            properties = ParagraphSprmUncompressor.uncompressPAP( properties,
-                    grpprl, 2 );
-        }
-
+        properties = newParagraph_applyStyleProperties( styleSheet, papx,
+                properties );
         properties = ParagraphSprmUncompressor.uncompressPAP( properties,
                 papx.getGrpprl(), 2 );
 
@@ -120,7 +114,9 @@ public class Paragraph extends Range implements Cloneable {
             {
                 properties = ParagraphSprmUncompressor.uncompressPAP(
                         properties, listLevel.getGrpprlPapx(), 0 );
-                // reapply PAPX properties
+                // reapply style and local PAPX properties
+                properties = newParagraph_applyStyleProperties( styleSheet,
+                        papx, properties );
                 properties = ParagraphSprmUncompressor.uncompressPAP(
                         properties, papx.getGrpprl(), 2 );
             }
@@ -132,6 +128,17 @@ public class Paragraph extends Range implements Cloneable {
         return new Paragraph( papx, properties, parent );
     }
 
+    protected static ParagraphProperties newParagraph_applyStyleProperties(
+            StyleSheet styleSheet, PAPX papx, ParagraphProperties properties )
+    {
+        if ( styleSheet == null )
+            return properties;
+
+        int style = papx.getIstd();
+        byte[] grpprl = styleSheet.getPAPX( style );
+        return ParagraphSprmUncompressor.uncompressPAP( properties, grpprl, 2 );
+    }
+
   protected short _istd;
   protected ParagraphProperties _props;
   protected SprmBuffer _papx;