1 16 17 package org.apache.poi.hwpf.usermodel; 18 19 import org.apache.poi.hwpf.HWPFDocument; 20 import org.apache.poi.hwpf.model.ListTables; 21 import org.apache.poi.hwpf.model.ListLevel; 22 import org.apache.poi.hwpf.model.ListData; 23 import org.apache.poi.hwpf.model.ListFormatOverride; 24 import org.apache.poi.hwpf.model.StyleSheet; 25 26 import org.apache.poi.hwpf.sprm.CharacterSprmCompressor; 27 import org.apache.poi.hwpf.sprm.ParagraphSprmCompressor; 28 29 45 public class HWPFList 46 { 47 private ListData _listData; 48 private ListFormatOverride _override; 49 private boolean _registered; 50 private StyleSheet _styleSheet; 51 52 58 public HWPFList(boolean numbered, StyleSheet styleSheet) 59 { 60 _listData = new ListData((int)(Math.random() * (double)System.currentTimeMillis()), numbered); 61 _override = new ListFormatOverride(_listData.getLsid()); 62 _styleSheet = styleSheet; 63 } 64 65 71 public void setLevelNumberProperties(int level, CharacterProperties chp) 72 { 73 ListLevel listLevel = _listData.getLevel(level); 74 int styleIndex = _listData.getLevelStyle(level); 75 CharacterProperties base = _styleSheet.getCharacterStyle(styleIndex); 76 77 byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(chp, base); 78 listLevel.setNumberProperties(grpprl); 79 } 80 81 87 public void setLevelParagraphProperties(int level, ParagraphProperties pap) 88 { 89 ListLevel listLevel = _listData.getLevel(level); 90 int styleIndex = _listData.getLevelStyle(level); 91 ParagraphProperties base = _styleSheet.getParagraphStyle(styleIndex); 92 93 byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(pap, base); 94 listLevel.setLevelProperties(grpprl); 95 } 96 97 public void setLevelStyle(int level, int styleIndex) 98 { 99 _listData.setLevelStyle(level, styleIndex); 100 } 101 102 public ListData getListData() 103 { 104 return _listData; 105 } 106 107 public ListFormatOverride getOverride() 108 { 109 return _override; 110 } 111 112 } 113 | Popular Tags |