From: Sergey Vladimirov Date: Wed, 21 Sep 2011 21:16:53 +0000 (+0000) Subject: styles shall be applied after lists as well [as PAPX] X-Git-Tag: REL_3_8_BETA5~130 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=173de1e812a4371a63072d7ee0e012469cd4e237;p=poi.git styles shall be applied after lists as well [as PAPX] git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1173866 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java index 1e741eb39c..11e91fa5e2 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Paragraph.java @@ -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;