View | Details | Raw Unified | Return to bug 50052
Collapse All | Expand All

(-)src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java (-3 / +31 lines)
Lines 22-27 Link Here
22
import org.apache.poi.hwpf.model.ListLevel;
22
import org.apache.poi.hwpf.model.ListLevel;
23
import org.apache.poi.hwpf.model.ListTables;
23
import org.apache.poi.hwpf.model.ListTables;
24
import org.apache.poi.hwpf.model.PAPX;
24
import org.apache.poi.hwpf.model.PAPX;
25
import org.apache.poi.hwpf.sprm.CharacterSprmUncompressor;
26
import org.apache.poi.hwpf.sprm.ParagraphSprmUncompressor;
25
import org.apache.poi.util.POILogFactory;
27
import org.apache.poi.util.POILogFactory;
26
import org.apache.poi.util.POILogger;
28
import org.apache.poi.util.POILogger;
27
29
Lines 32-46 Link Here
32
34
33
	ListLevel _level;
35
	ListLevel _level;
34
	ListFormatOverrideLevel _overrideLevel;
36
	ListFormatOverrideLevel _overrideLevel;
35
37
	
38
	CharacterProperties _numberProps;
39
	
36
  ListEntry(PAPX papx, Range parent, ListTables tables)
40
  ListEntry(PAPX papx, Range parent, ListTables tables)
37
  {
41
  {
38
    super(papx, parent);
42
    super(papx, parent);
39
43
    
40
    if(tables != null) {
44
    if(tables != null) {
41
	    ListFormatOverride override = tables.getOverride(_props.getIlfo());
45
	    ListFormatOverride override = tables.getOverride(_props.getIlfo());
42
	    _overrideLevel = override.getOverrideLevel(_props.getIlvl());
46
	    _overrideLevel = override.getOverrideLevel(_props.getIlvl());
43
	    _level = tables.getLevel(override.getLsid(), _props.getIlvl());
47
	    if (_overrideLevel != null && _overrideLevel.isFormatting())
48
	      _level = _overrideLevel.getLevel();
49
	    else
50
	      _level = tables.getLevel(override.getLsid(), _props.getIlvl());
51
	    
52
	    // first process SPRMs from the level, then from papx
53
	    _props = ParagraphSprmUncompressor.uncompressPAP(_doc.getStyleSheet().getParagraphStyle(papx.getIstd()), _level.getLevelProperties(), 0);
54
	    _props = ParagraphSprmUncompressor.uncompressPAP(_props, papx.getGrpprl(), 2);
55
	    
56
	    // FIXME Base character properties are taken from the first CharacterRun in the paragraph. This is not fully correct, but
57
	    // I don't know a better way. If whole paragraph is formatted some way, the number gets formatted as well, but the SPRM
58
	    // is not stored in _level.getNumberProperties(), but is somehow taken from the paragraph. If we base it on StyleSheet,
59
	    // we do not take this formatting. But if only the first word is formatted (i.e. the first CharacterRun), we format the number
60
	    // incorrectly.
61
	    CharacterProperties baseCharacterProperties;
62
	    if (numCharacterRuns() > 0)
63
	      baseCharacterProperties = getCharacterRun(0).cloneProperties();
64
	    else
65
	      baseCharacterProperties = _doc.getStyleSheet().getCharacterStyle(getStyleIndex());
66
      _numberProps = CharacterSprmUncompressor.uncompressCHP(baseCharacterProperties, _level.getNumberProperties(), 0);
44
    } else {
67
    } else {
45
    	log.log(POILogger.WARN, "No ListTables found for ListEntry - document probably partly corrupt, and you may experience problems");
68
    	log.log(POILogger.WARN, "No ListTables found for ListEntry - document probably partly corrupt, and you may experience problems");
46
    }
69
    }
Lines 50-53 Link Here
50
  {
73
  {
51
    return TYPE_LISTENTRY;
74
    return TYPE_LISTENTRY;
52
  }
75
  }
76
  
77
  public CharacterProperties getNumberProperties() {
78
    return _numberProps;
79
  }
80
  
53
}
81
}
(-)src/scratchpad/src/org/apache/poi/hwpf/model/ListLevel.java (-2 / +70 lines)
Lines 91-97 Link Here
91
    System.arraycopy(buf, offset, _rgbxchNums, 0, RGBXCH_NUMS_SIZE);
91
    System.arraycopy(buf, offset, _rgbxchNums, 0, RGBXCH_NUMS_SIZE);
92
    offset += RGBXCH_NUMS_SIZE;
92
    offset += RGBXCH_NUMS_SIZE;
93
93
94
    _ixchFollow = buf[offset++];
94
   _ixchFollow = buf[offset++];
95
    _dxaSpace = LittleEndian.getInt(buf, offset);
95
    _dxaSpace = LittleEndian.getInt(buf, offset);
96
    offset += LittleEndian.INT_SIZE;
96
    offset += LittleEndian.INT_SIZE;
97
    _dxaIndent = LittleEndian.getInt(buf, offset);
97
    _dxaIndent = LittleEndian.getInt(buf, offset);
Lines 129-134 Link Here
129
    return _iStartAt;
129
    return _iStartAt;
130
  }
130
  }
131
131
132
  /**
133
   * From specification:
134
   *
135
   * <table>
136
   * <tr><th>nfc value</th><th style='text-align:left'>Numbering scheme </td></tr>
137
   * <tr><td>0</td><td>Arabic (1, 2, 3) </td></tr>
138
   * <tr><td>1</td><td>Uppercase Roman numeral (I, II, III) </td></tr>
139
   * <tr><td>2</td><td>Lowercase Roman numeral (i, ii, iii) </td></tr>
140
   * <tr><td>3</td><td>Uppercase letter (A, B, C) </td></tr>
141
   * <tr><td>4</td><td>Lowercase letter (a, b, c) </td></tr>
142
   * <tr><td>5</td><td>Ordinal number (1st, 2nd, 3rd) </td></tr>
143
   * <tr><td>6</td><td>Cardinal text number (One, Two Three) </td></tr>
144
   * <tr><td>7</td><td>Ordinal text number (First, Second, Third) </td></tr>
145
   * <tr><td>10</td><td>Kanji numbering without the digit character (dbnum1). </td></tr>
146
   * <tr><td>11</td><td>Kanji numbering with the digit character (dbnum2). </td></tr>
147
   * <tr><td>12</td><td>46 phonetic Katakana characters in "aiueo" order (aiueo). </td></tr>
148
   * <tr><td>13</td><td>46 phonetic katakana characters in "iroha" order (iroha). </td></tr>
149
   * <tr><td>14</td><td>Double Byte character </td></tr>
150
   * <tr><td>15</td><td>Single Byte character </td></tr>
151
   * <tr><td>16</td><td>Kanji numbering 3 (dbnum3). </td></tr>
152
   * <tr><td>17</td><td>Kanji numbering 4 (dbnum4). </td></tr>
153
   * <tr><td>18</td><td>Circle numbering (circlenum). </td></tr>
154
   * <tr><td>19</td><td>Double-byte Arabic numbering </td></tr>
155
   * <tr><td>20</td><td>46 phonetic double-byte Katakana characters (*aiueo*dbchar). </td></tr>
156
   * <tr><td>21</td><td>46 phonetic double-byte katakana characters (*iroha*dbchar). </td></tr>
157
   * <tr><td>22</td><td>Arabic with leading zero (01, 02, 03, ..., 10, 11) </td></tr>
158
   * <tr><td>23</td><td>Bullet (no number at all) </td></tr>
159
   * <tr><td>24</td><td>Korean numbering 2 (ganada). </td></tr>
160
   * <tr><td>25</td><td>Korean numbering 1 (chosung). </td></tr>
161
   * <tr><td>26</td><td>Chinese numbering 1 (gb1). </td></tr>
162
   * <tr><td>27</td><td>Chinese numbering 2 (gb2). </td></tr>
163
   * <tr><td>28</td><td>Chinese numbering 3 (gb3). </td></tr>
164
   * <tr><td>29</td><td>Chinese numbering 4 (gb4). </td></tr>
165
   * <tr><td>30</td><td>Chinese Zodiac numbering 1 </td></tr>
166
   * <tr><td>31</td><td>Chinese Zodiac numbering 2 </td></tr>
167
   * <tr><td>32</td><td>Chinese Zodiac numbering 3 </td></tr>
168
   * <tr><td>33</td><td>Taiwanese double-byte numbering 1 </td></tr>
169
   * <tr><td>34</td><td>Taiwanese double-byte numbering 2 </td></tr>
170
   * <tr><td>35</td><td>Taiwanese double-byte numbering 3 </td></tr>
171
   * <tr><td>36</td><td>Taiwanese double-byte numbering 4 </td></tr>
172
   * <tr><td>37</td><td>Chinese double-byte numbering 1 </td></tr>
173
   * <tr><td>38</td><td>Chinese double-byte numbering 2 </td></tr>
174
   * <tr><td>39</td><td>Chinese double-byte numbering 3 </td></tr>
175
   * <tr><td>40</td><td>Chinese double-byte numbering 4 </td></tr>
176
   * <tr><td>41</td><td>Korean double-byte numbering 1 </td></tr>
177
   * <tr><td>42</td><td>Korean double-byte numbering 2 </td></tr>
178
   * <tr><td>43</td><td>Korean double-byte numbering 3 </td></tr>
179
   * <tr><td>44</td><td>Korean double-byte numbering 4 </td></tr>
180
   * <tr><td>45</td><td>Hebrew non-standard decimal  </td></tr>
181
   * <tr><td>46</td><td>Arabic Alif Ba Tah </td></tr>
182
   * <tr><td>47</td><td>Hebrew Biblical standard </td></tr>
183
   * <tr><td>48</td><td>Arabic Abjad style </td></tr>
184
   * <tr><td>49</td><td>Hindi vowels </td></tr>
185
   * <tr><td>50</td><td>Hindi consonants </td></tr>
186
   * <tr><td>51</td><td>Hindi numbers </td></tr>
187
   * <tr><td>52</td><td>Hindi descriptive (cardinals) </td></tr>
188
   * <tr><td>53</td><td>Thai letters </td></tr>
189
   * <tr><td>54</td><td>Thai numbers </td></tr>
190
   * <tr><td>55</td><td>Thai descriptive (cardinals </td></tr>
191
   * <tr><td>56</td><td>Vietnamese descriptive (cardinals) </td></tr>
192
   * <tr><td>57</td><td>Page Number format - # - </td></tr>
193
   * <tr><td>58</td><td>Lower case Russian alphabet </td></tr>
194
   * <tr><td>59</td><td>Upper case Russian alphabet </td></tr>
195
   * </table>
196
   */
132
  public int getNumberFormat()
197
  public int getNumberFormat()
133
  {
198
  {
134
    return _nfc;
199
    return _nfc;
Lines 162-169 Link Here
162
  public void setNumberProperties(byte[] grpprl)
227
  public void setNumberProperties(byte[] grpprl)
163
  {
228
  {
164
    _grpprlChpx = grpprl;
229
    _grpprlChpx = grpprl;
165
166
  }
230
  }
231
  
232
  public byte[] getNumberProperties() {
233
    return _grpprlChpx;
234
  }
167
235
168
  public void setLevelProperties(byte[] grpprl)
236
  public void setLevelProperties(byte[] grpprl)
169
  {
237
  {

Return to bug 50052