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

PAPX

public class PAPX extends PropertyNode
Comment me
author
Ryan Ackley

Fields Summary
private ParagraphHeight
_phe
private int
_hugeGrpprlOffset
Constructors Summary
public PAPX(int fcStart, int fcEnd, byte[] papx, ParagraphHeight phe, byte[] dataStream)


            
  
    super(fcStart, fcEnd, new SprmBuffer(papx));
    _phe = phe;
    SprmBuffer buf = findHuge(new SprmBuffer(papx), dataStream);
    if(buf != null)
      _buf = buf;
  
public PAPX(int fcStart, int fcEnd, SprmBuffer buf, byte[] dataStream)

    super(fcStart, fcEnd, buf);
    _phe = new ParagraphHeight();
    buf = findHuge(buf, dataStream);
    if(buf != null)
      _buf = buf;
  
Methods Summary
public booleanequals(java.lang.Object o)

    if (super.equals(o))
    {
      return _phe.equals(((PAPX)o)._phe);
    }
    return false;
  
private org.apache.poi.hwpf.sprm.SprmBufferfindHuge(org.apache.poi.hwpf.sprm.SprmBuffer buf, byte[] datastream)

    byte[] grpprl = buf.toByteArray();
    if(grpprl.length==8 && datastream!=null) // then check for sprmPHugePapx
    {
      SprmOperation sprm = new SprmOperation(grpprl, 2);
      if ((sprm.getOperation()==0x45 || sprm.getOperation()==0x46)
          && sprm.getSizeCode() == 3)
      {
        int hugeGrpprlOffset = sprm.getOperand();
        if(hugeGrpprlOffset+1 < datastream.length)
        {
          int grpprlSize = LittleEndian.getShort(datastream, hugeGrpprlOffset);
          if( hugeGrpprlOffset+grpprlSize < datastream.length)
          {
            byte[] hugeGrpprl = new byte[grpprlSize + 2];
            // copy original istd into huge Grpprl
            hugeGrpprl[0] = grpprl[0]; hugeGrpprl[1] = grpprl[1];
            // copy Grpprl from dataStream
            System.arraycopy(datastream, hugeGrpprlOffset + 2, hugeGrpprl, 2,
                             grpprlSize);
            // save a pointer to where we got the huge Grpprl from
            _hugeGrpprlOffset = hugeGrpprlOffset;
            return new SprmBuffer(hugeGrpprl);
          }
        }
      }
    }
    return null;
  
public byte[]getGrpprl()

    return ((SprmBuffer)_buf).toByteArray();
  
public intgetHugeGrpprlOffset()

    return _hugeGrpprlOffset;
  
public shortgetIstd()

    byte[] buf = getGrpprl();
    if (buf.length == 0)
    {
      return 0;
    }
    else
    {
      return LittleEndian.getShort(buf);
    }
  
public org.apache.poi.hwpf.model.ParagraphHeightgetParagraphHeight()

    return _phe;
  
public org.apache.poi.hwpf.usermodel.ParagraphPropertiesgetParagraphProperties(org.apache.poi.hwpf.model.StyleSheet ss)

    short istd = getIstd();
    ParagraphProperties baseStyle = ss.getParagraphStyle(istd);
    ParagraphProperties props = ParagraphSprmUncompressor.uncompressPAP(baseStyle, getGrpprl(), 2);
    return props;
  
public org.apache.poi.hwpf.sprm.SprmBuffergetSprmBuf()

    return (SprmBuffer)_buf;