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

Ref3DPtg

public class Ref3DPtg extends Ptg
Title: Reference 3D Ptg

Description: Defined a cell in extern sheet.

REFERENCE:

author
Libin Roman (Vista Portal LDT. Developer)
author
Jason Height (jheight at chariot dot net dot au)
version
1.0-pre

Fields Summary
public static final byte
sid
private static final int
SIZE
private short
field_1_index_extern_sheet
private short
field_2_row
private short
field_3_column
private BitField
rowRelative
private BitField
colRelative
Constructors Summary
public Ref3DPtg()
Creates new AreaPtg


        
      
public Ref3DPtg(RecordInputStream in)

        field_1_index_extern_sheet = in.readShort();
        field_2_row          = in.readShort();
        field_3_column        = in.readShort();
    
public Ref3DPtg(String cellref, short externIdx)

        CellReference c= new CellReference(cellref);
        setRow((short) c.getRow());
        setColumn((short) c.getCol());
        setColRelative(!c.isColAbsolute());
        setRowRelative(!c.isRowAbsolute());   
        setExternSheetIndex(externIdx);
    
Methods Summary
public java.lang.Objectclone()

     Ref3DPtg ptg = new Ref3DPtg();
     ptg.field_1_index_extern_sheet = field_1_index_extern_sheet;
     ptg.field_2_row = field_2_row;
     ptg.field_3_column = field_3_column;
     ptg.setClass(ptgClass);
     return ptg;
   
public shortgetColumn()

        return ( short ) (field_3_column & 0xFF);
    
public shortgetColumnRaw()

        return field_3_column;
    
public bytegetDefaultOperandClass()

return Ptg.CLASS_REF;
public shortgetExternSheetIndex()

        return field_1_index_extern_sheet;
    
public shortgetRow()

        return field_2_row;
    
public intgetSize()

        return SIZE;
    
public booleanisColRelative()

        return colRelative.isSet(field_3_column);
    
public booleanisRowRelative()

        return rowRelative.isSet(field_3_column);
    
public voidsetArea(java.lang.String ref)

        RangeAddress ra = new RangeAddress(ref);

        String from = ra.getFromCell();

        setColumn((short) (ra.getXPosition(from) -1));
        setRow((short) (ra.getYPosition(from) -1));

    
public voidsetColRelative(boolean rel)

        field_3_column=colRelative.setShortBoolean(field_3_column,rel);
    
public voidsetColumn(short column)

        field_3_column &= 0xFF00;
        field_3_column |= column & 0xFF;
    
public voidsetColumnRaw(short column)

        field_3_column = column;
    
public voidsetExternSheetIndex(short index)

        field_1_index_extern_sheet = index;
    
public voidsetRow(short row)

        field_2_row = row;
    
public voidsetRowRelative(boolean rel)

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

        StringBuffer retval = new StringBuffer();
        SheetReferences refs = book == null ? null : book.getSheetReferences();
        if (refs != null) {
        	String sheetName =refs.getSheetName((int)this.field_1_index_extern_sheet);
        	boolean appendQuotes = sheetName.indexOf(" ") >= 0;
        	if (appendQuotes)
        	  retval.append("'");
            retval.append(sheetName);
        	if (appendQuotes)
          	  retval.append("'");
            retval.append('!");
        }
        retval.append((new CellReference(getRow(),getColumn(),!isRowRelative(),!isColRelative())).toString()); 
        return retval.toString();
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("Ref3dPtg\n");
        buffer.append("Index to Extern Sheet = " + getExternSheetIndex()).append("\n");
        buffer.append("Row = " + getRow()).append("\n");
        buffer.append("Col  = " + getColumn()).append("\n");
        buffer.append("ColRowRel= "
        + isRowRelative()).append("\n");
        buffer.append("ColRel   = " + isColRelative()).append("\n");
        return buffer.toString();
    
public voidwriteBytes(byte[] array, int offset)

        array[ 0 + offset ] = (byte) (sid + ptgClass);
        LittleEndian.putShort(array, 1 + offset , getExternSheetIndex());
        LittleEndian.putShort(array, 3 + offset , getRow());
        LittleEndian.putShort(array, 5 + offset , getColumnRaw());