@Internal ListLevel getLVL( char level ) { if ( level >= _listData.numLevels() ) { throw new IllegalArgumentException( "Required level " + ( (int) level ) + " is more than number of level for list (" + _listData.numLevels() + ")" ); } return _listData.getLevels()[level]; }
public void writeListDataTo( FileInformationBlock fib, ByteArrayOutputStream tableStream ) throws IOException { final int startOffset = tableStream.size(); fib.setFcPlfLst( startOffset ); int listSize = _listMap.size(); // use this stream as a buffer for the levels since their size varies. ByteArrayOutputStream levelBuf = new ByteArrayOutputStream(); byte[] shortHolder = new byte[2]; LittleEndian.putShort(shortHolder, 0, (short)listSize); tableStream.write(shortHolder); for(ListData lst : _listMap.values()) { tableStream.write(lst.toByteArray()); ListLevel[] lvls = lst.getLevels(); for (int y = 0; y < lvls.length; y++) { levelBuf.write(lvls[y].toByteArray()); } } /* * An array of LVLs is appended to the PlfLst. lcbPlfLst does not * account for the array of LVLs. -- Page 76 of 621 -- [MS-DOC] -- * v20110315 Word (.doc) Binary File Format */ fib.setLcbPlfLst( tableStream.size() - startOffset ); tableStream.write( levelBuf.toByteArray() ); }
public ListLevel getLevel(int listID, int level) { ListData lst = _listMap.get(Integer.valueOf(listID)); if(level < lst.numLevels()) { ListLevel lvl = lst.getLevels()[level]; return lvl; } log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")"); return null; }
/** * Get the ListLevel for a given lsid and level * @param lsid * @param level * @return ListLevel if found, or <code>null</code> if ListData can't be found or if level is > that available */ public ListLevel getLevel(int lsid, int level) { ListData lst = _listMap.get(Integer.valueOf(lsid)); if (lst == null) { if (log.check(POILogger.WARN)) { log.log(POILogger.WARN, "ListData for " + lsid + " was null."); } return null; } if(level < lst.numLevels()) { return lst.getLevels()[level]; } if (log.check(POILogger.WARN)) { log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")"); } return null; }
ListLevel[] listlevel = listdata.getLevels();
public void writeListDataTo( FileInformationBlock fib, HWPFOutputStream tableStream ) throws IOException { final int startOffset = tableStream.getOffset(); fib.setFcPlcfLst( startOffset ); int listSize = _listMap.size(); // use this stream as a buffer for the levels since their size varies. ByteArrayOutputStream levelBuf = new ByteArrayOutputStream(); byte[] shortHolder = new byte[2]; LittleEndian.putShort(shortHolder, (short)listSize); tableStream.write(shortHolder); for(Integer x : _listMap.sortedKeys()) { ListData lst = _listMap.get(x); tableStream.write(lst.toByteArray()); ListLevel[] lvls = lst.getLevels(); for (int y = 0; y < lvls.length; y++) { levelBuf.write(lvls[y].toByteArray()); } } /* * An array of LVLs is appended to the PlfLst. lcbPlfLst does not * account for the array of LVLs. -- Page 76 of 621 -- [MS-DOC] -- * v20110315 Word (.doc) Binary File Format */ fib.setLcbPlcfLst( tableStream.getOffset() - startOffset ); tableStream.write( levelBuf.toByteArray() ); }