FileDocCategorySizeDatePackage
AreaPtg.javaAPI DocApache Poi 3.0.19144Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record.formula

AreaPtg

public class AreaPtg extends Ptg
Specifies a rectangular area of cells A1:A4 for instance.
author
andy
author
Jason Height (jheight at chariot dot net dot au)

(Omit source code)

Fields Summary
public static final short
sid
private static final int
SIZE
private short
field_1_first_row
private short
field_2_last_row
private short
field_3_first_column
private short
field_4_last_column
private BitField
rowRelative
private BitField
colRelative
private BitField
column
Constructors Summary
protected AreaPtg()


      
      //Required for clone methods
    
public AreaPtg(String arearef)

        AreaReference ar = new AreaReference(arearef);
        setFirstRow((short)ar.getCells()[0].getRow());
        setFirstColumn((short)ar.getCells()[0].getCol());
        setLastRow((short)ar.getCells()[1].getRow());
        setLastColumn((short)ar.getCells()[1].getCol());
        setFirstColRelative(!ar.getCells()[0].isColAbsolute());
        setLastColRelative(!ar.getCells()[1].isColAbsolute());
        setFirstRowRelative(!ar.getCells()[0].isRowAbsolute());
        setLastRowRelative(!ar.getCells()[1].isRowAbsolute());        
    
public AreaPtg(short firstRow, short lastRow, short firstColumn, short lastColumn, boolean firstRowRelative, boolean lastRowRelative, boolean firstColRelative, boolean lastColRelative)

      setFirstRow(firstRow);
      setLastRow(lastRow);
      setFirstColumn(firstColumn);
      setLastColumn(lastColumn);
      setFirstRowRelative(firstRowRelative);
      setLastRowRelative(lastRowRelative);
      setFirstColRelative(firstColRelative);
      setLastColRelative(lastColRelative);
    
public AreaPtg(RecordInputStream in)

        field_1_first_row    = in.readShort();
        field_2_last_row     = in.readShort();
        field_3_first_column = in.readShort();
        field_4_last_column  = in.readShort();
        //System.out.println(toString());
    
Methods Summary
public java.lang.Objectclone()

      AreaPtg ptg = new AreaPtg();
      ptg.field_1_first_row = field_1_first_row;
      ptg.field_2_last_row = field_2_last_row;
      ptg.field_3_first_column = field_3_first_column;
      ptg.field_4_last_column = field_4_last_column;
      ptg.setClass(ptgClass);
      return ptg;
    
public java.lang.StringgetAreaPtgName()

      return "AreaPtg";
    
public bytegetDefaultOperandClass()

        return Ptg.CLASS_REF;
    
public shortgetFirstColumn()

return
the first column number in the area.

        return column.getShortValue(field_3_first_column);
    
public shortgetFirstColumnRaw()

return
the first column number + the options bit settings unstripped

        return field_3_first_column;
    
public shortgetFirstRow()

return
the first row in the area

        return field_1_first_row;
    
public shortgetLastColumn()

return
lastcolumn in the area

        return column.getShortValue(field_4_last_column);
    
public shortgetLastColumnRaw()

return
last column and bitmask (the raw field)

        return field_4_last_column;
    
public shortgetLastRow()

return
last row in the range (x2 in x1,y1-x2,y2)

        return field_2_last_row;
    
public intgetSize()

        return SIZE;
    
public booleanisFirstColRelative()

return
isrelative first column to relative or not

        return colRelative.isSet(field_3_first_column);
    
public booleanisFirstRowRelative()

return
whether or not the first row is a relative reference or not.

        return rowRelative.isSet(field_3_first_column);
    
public booleanisLastColRelative()

return
lastcol relative or not

        return colRelative.isSet(field_4_last_column);
    
public booleanisLastRowRelative()

return
last row relative or not

        return rowRelative.isSet(field_4_last_column);
    
public voidsetFirstColRelative(boolean rel)
set whether the first column is relative

        field_3_first_column=colRelative.setShortBoolean(field_3_first_column,rel);
    
public voidsetFirstColumn(short column)
set the first column in the area

        field_3_first_column = column;   // fixme
    
public voidsetFirstColumnRaw(short column)
set the first column irespective of the bitmasks

        field_3_first_column = column;
    
public voidsetFirstRow(short row)
sets the first row

param
row number (0-based)

        field_1_first_row = row;
    
public voidsetFirstRowRelative(boolean rel)
sets the first row to relative or not

param
rel is relative or not.

        field_3_first_column=rowRelative.setShortBoolean(field_3_first_column,rel);
    
public voidsetLastColRelative(boolean rel)
set whether the last column should be relative or not

        field_4_last_column=colRelative.setShortBoolean(field_4_last_column,rel);
    
public voidsetLastColumn(short column)
set the last column in the area

        field_4_last_column = column;   // fixme
    
public voidsetLastColumnRaw(short column)
set the last column irrespective of the bitmasks

        field_4_last_column = column;
    
public voidsetLastRow(short row)

param
row last row number in the area

        field_2_last_row = row;
    
public voidsetLastRowRelative(boolean rel)
set whether the last row is relative or not

param
rel true if the last row relative, else false

        field_4_last_column=rowRelative.setShortBoolean(field_4_last_column,rel);
    
public java.lang.StringtoFormulaString(org.apache.poi.hssf.model.Workbook book)

         return (new CellReference(getFirstRow(),getFirstColumn(),!isFirstRowRelative(),!isFirstColRelative())).toString() + ":" +
                (new CellReference(getLastRow(),getLastColumn(),!isLastRowRelative(),!isLastColRelative())).toString();
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append(getAreaPtgName());
        buffer.append("\n");
        buffer.append("firstRow = " + getFirstRow()).append("\n");
        buffer.append("lastRow  = " + getLastRow()).append("\n");
        buffer.append("firstCol = " + getFirstColumn()).append("\n");
        buffer.append("lastCol  = " + getLastColumn()).append("\n");
        buffer.append("firstColRowRel= "
                      + isFirstRowRelative()).append("\n");
        buffer.append("lastColRowRel = "
                      + isLastRowRelative()).append("\n");
        buffer.append("firstColRel   = " + isFirstColRelative()).append("\n");
        buffer.append("lastColRel    = " + isLastColRelative()).append("\n");
        return buffer.toString();
    
public voidwriteBytes(byte[] array, int offset)

        array[offset] = (byte) (sid + ptgClass);
        LittleEndian.putShort(array,offset+1,field_1_first_row);
        LittleEndian.putShort(array,offset+3,field_2_last_row);
        LittleEndian.putShort(array,offset+5,field_3_first_column);
        LittleEndian.putShort(array,offset+7,field_4_last_column);