FileDocCategorySizeDatePackage
StyleDescription.javaAPI DocApache Poi 3.0.13487Mon Jan 01 18:55:24 GMT 2007org.apache.poi.hdf.extractor

StyleDescription

public class StyleDescription extends Object
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
PAP
_pap
CHP
_chp
Constructors Summary
public StyleDescription()


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

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

      infoShort = Utils.convertBytesToShort(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 = Utils.convertBytesToShort(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 = Utils.convertBytesToShort(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.extractor.CHPgetCHP()

      return _chp;
  
public byte[]getCHPX()

      return _chpx;
  
public org.apache.poi.hdf.extractor.PAPgetPAP()

      return _pap;
  
public byte[]getPAPX()

      return _papx;
  
public voidsetCHP(org.apache.poi.hdf.extractor.CHP chp)

      _chp = chp;
  
public voidsetPAP(org.apache.poi.hdf.extractor.PAP pap)

      _pap = pap;