From b78ac79324a0ba01eccc5c5654df4d7d451a39da Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Wed, 21 Sep 2011 21:16:53 +0000 Subject: [PATCH] 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 --- .../apache/poi/hwpf/usermodel/Paragraph.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) 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 1e741eb39..11e91fa5e 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;