FileDocCategorySizeDatePackage
ListData.javaAPI DocApache Poi 3.0.13929Mon Jan 01 18:55:32 GMT 2007org.apache.poi.hwpf.model

ListData

public class ListData extends Object

Fields Summary
private int
_lsid
private int
_tplc
private short[]
_rgistd
private byte
_info
private static BitField
_fSimpleList
private static BitField
_fRestartHdn
private byte
_reserved
ListLevel[]
_levels
Constructors Summary
public ListData(int listID, boolean numbered)


      
  
    _lsid = listID;
    _rgistd = new short[9];

    for (int x = 0; x < 9; x++)
    {
      _rgistd[x] = StyleSheet.NIL_STYLE;
    }

    _levels = new ListLevel[9];

    for (int x = 0; x < _levels.length; x++)
    {
      _levels[x] = new ListLevel(x, numbered);
    }
  
ListData(byte[] buf, int offset)

    _lsid = LittleEndian.getInt(buf, offset);
    offset += LittleEndian.INT_SIZE;
    _tplc = LittleEndian.getInt(buf, offset);
    offset += LittleEndian.INT_SIZE;
    _rgistd = new short[9];
    for (int x = 0; x < 9; x++)
    {
      _rgistd[x] = LittleEndian.getShort(buf, offset);
      offset += LittleEndian.SHORT_SIZE;
    }
    _info = buf[offset++];
    _reserved = buf[offset];
    if (_fSimpleList.getValue(_info) > 0)
    {
      _levels = new ListLevel[1];
    }
    else
    {
      _levels = new ListLevel[9];
    }

  
Methods Summary
public booleanequals(java.lang.Object obj)

    if (obj == null)
    {
      return false;
    }

    ListData lst = (ListData)obj;
    return lst._info == _info && Arrays.equals(lst._levels, _levels) &&
      lst._lsid == _lsid && lst._reserved == _reserved && lst._tplc == _tplc &&
      Arrays.equals(lst._rgistd, _rgistd);
  
public org.apache.poi.hwpf.model.ListLevelgetLevel(int index)
Gets the level associated to a particular List at a particular index.

param
index 1-based index
return
a list level

    return _levels[index - 1];
  
public intgetLevelStyle(int index)

    return _rgistd[index];
  
public org.apache.poi.hwpf.model.ListLevel[]getLevels()

    return _levels;
  
public intgetLsid()

    return _lsid;
  
public intnumLevels()

    return _levels.length;
  
intresetListID()

    _lsid = (int)(Math.random() * (double)System.currentTimeMillis());
    return _lsid;
  
public voidsetLevel(int index, org.apache.poi.hwpf.model.ListLevel level)

    _levels[index] = level;
  
public voidsetLevelStyle(int index, int styleIndex)

    _rgistd[index] = (short)styleIndex;
  
public byte[]toByteArray()

    byte[] buf = new byte[28];
    int offset = 0;
    LittleEndian.putInt(buf, _lsid);
    offset += LittleEndian.INT_SIZE;
    LittleEndian.putInt(buf, offset, _tplc);
    offset += LittleEndian.INT_SIZE;
    for (int x = 0; x < 9; x++)
    {
      LittleEndian.putShort(buf, offset, _rgistd[x]);
      offset += LittleEndian.SHORT_SIZE;
    }
    buf[offset++] = _info;
    buf[offset] = _reserved;
    return buf;