FileDocCategorySizeDatePackage
StyleDescription.javaAPI DocApache Poi 3.0.13662Mon Jan 01 18:55:22 GMT 2007org.apache.poi.hdf.model.hdftypes

StyleDescription

public class StyleDescription extends Object implements HDFType
Comment me
author
Ryan Ackley

Fields Summary
private static int
PARAGRAPH_STYLE
private static int
CHARACTER_STYLE
int
_baseStyleIndex
int
_styleTypeCode
int
_numUPX
byte[]
_papx
byte[]
_chpx
ParagraphProperties
_pap
CharacterProperties
_chp
Constructors Summary
public StyleDescription()


   
  
      _pap = new ParagraphProperties();
      _chp = new CharacterProperties();
  
public StyleDescription(byte[] std, int baseLength, boolean word9)

      int infoShort = LittleEndian.getShort(std, 2);
      _styleTypeCode = (infoShort & 0xf);
      _baseStyleIndex = (infoShort & 0xfff0) >> 4;

      infoShort = LittleEndian.getShort(std, 4);
      _numUPX = infoShort & 0xf;

      //first byte(s) of variable length section of std is the length of the
      //style name and aliases string
      int nameLength = 0;
      int multiplier = 1;
      if(word9)
      {
          nameLength = LittleEndian.getShort(std, baseLength);
          multiplier = 2;
      }
      else
      {
          nameLength = std[baseLength];
      }
      //2 bytes for length, length then null terminator.
      int grupxStart = multiplier + ((nameLength + 1) * multiplier) + baseLength;

      int offset = 0;
      for(int x = 0; x < _numUPX; x++)
      {
          int upxSize = LittleEndian.getShort(std, grupxStart + offset);
          if(_styleTypeCode == PARAGRAPH_STYLE)
          {
              if(x == 0)
              {
                  _papx = new byte[upxSize];
                  System.arraycopy(std, grupxStart + offset + 2, _papx, 0, upxSize);
              }
              else if(x == 1)
              {
                  _chpx = new byte[upxSize];
                  System.arraycopy(std, grupxStart + offset + 2, _chpx, 0, upxSize);
              }
          }
          else if(_styleTypeCode == CHARACTER_STYLE && x == 0)
          {
              _chpx = new byte[upxSize];
              System.arraycopy(std, grupxStart + offset + 2, _chpx, 0, upxSize);
          }

          if(upxSize % 2 == 1)
          {
              ++upxSize;
          }
          offset += 2 + upxSize;
      }



  
Methods Summary
public intgetBaseStyle()

      return _baseStyleIndex;
  
public org.apache.poi.hdf.model.hdftypes.CharacterPropertiesgetCHP()

      return _chp;
  
public byte[]getCHPX()

      return _chpx;
  
public org.apache.poi.hdf.model.hdftypes.ParagraphPropertiesgetPAP()

      return _pap;
  
public byte[]getPAPX()

      return _papx;
  
public voidsetCHP(org.apache.poi.hdf.model.hdftypes.CharacterProperties chp)

      _chp = chp;
  
public voidsetPAP(org.apache.poi.hdf.model.hdftypes.ParagraphProperties pap)

      _pap = pap;