FileDocCategorySizeDatePackage
WindowTwoRecord.javaAPI DocApache Poi 3.0.115795Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record

WindowTwoRecord

public class WindowTwoRecord extends Record
Title: Window Two Record

Description: sheet window settings

REFERENCE: PG 422 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)

author
Andrew C. Oliver (acoliver at apache dot org)
author
Jason Height (jheight at chariot dot net dot au)
version
2.0-pre

Fields Summary
public static final short
sid
private short
field_1_options
private BitField
displayFormulas
private BitField
displayGridlines
private BitField
displayRowColHeadings
private BitField
freezePanes
private BitField
displayZeros
private BitField
defaultHeader
private BitField
arabic
private BitField
displayGuts
private BitField
freezePanesNoSplit
private BitField
selected
private BitField
paged
private BitField
savedInPageBreakPreview
private short
field_2_top_row
private short
field_3_left_col
private int
field_4_header_color
private short
field_5_page_break_zoom
private short
field_6_normal_zoom
private int
field_7_reserved
Constructors Summary
public WindowTwoRecord()


     
    
    
public WindowTwoRecord(RecordInputStream in)
Constructs a WindowTwo record and sets its fields appropriately.

param
id id must be 0x23e or an exception will be throw upon validation
param
size the size of the data area of the record
param
data data of the record (should not contain sid/len)

        super(in);
    
Methods Summary
public java.lang.Objectclone()

      WindowTwoRecord rec = new WindowTwoRecord();
      rec.field_1_options = field_1_options;
      rec.field_2_top_row = field_2_top_row;
      rec.field_3_left_col = field_3_left_col;
      rec.field_4_header_color = field_4_header_color;
      rec.field_5_page_break_zoom = field_5_page_break_zoom;
      rec.field_6_normal_zoom = field_6_normal_zoom;
      rec.field_7_reserved = field_7_reserved;
      return rec;
    
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)

      int size = in.remaining();
        field_1_options      = in.readShort();
        field_2_top_row      = in.readShort();
        field_3_left_col     = in.readShort();
        field_4_header_color = in.readInt();
        if (size > 10)
        {
            field_5_page_break_zoom = in.readShort();
            field_6_normal_zoom     = in.readShort();
        }
        if (size > 14)
        {   // there is a special case of this record that has only 14 bytes...undocumented!
            field_7_reserved = in.readInt();
        }
    
public booleangetArabic()
is this arabic?

return
arabic or not

        return arabic.isSet(field_1_options);
    
public booleangetDefaultHeader()
get whether the window should display a default header

return
header or not

        return defaultHeader.isSet(field_1_options);
    
public booleangetDisplayFormulas()
get whether the window should display formulas

return
formulas or not

        return displayFormulas.isSet(field_1_options);
    
public booleangetDisplayGridlines()
get whether the window should display gridlines

return
gridlines or not

        return displayGridlines.isSet(field_1_options);
    
public booleangetDisplayGuts()
get whether the outline symbols are displaed

return
symbols or not

        return displayGuts.isSet(field_1_options);
    
public booleangetDisplayRowColHeadings()
get whether the window should display row and column headings

return
headings or not

        return displayRowColHeadings.isSet(field_1_options);
    
public booleangetDisplayZeros()
get whether the window should display zero values

return
zeros or not

        return displayZeros.isSet(field_1_options);
    
public booleangetFreezePanes()
get whether the window should freeze panes

return
freeze panes or not

        return freezePanes.isSet(field_1_options);
    
public booleangetFreezePanesNoSplit()
freeze unsplit panes or not

return
freeze or not

        return freezePanesNoSplit.isSet(field_1_options);
    
public intgetHeaderColor()
get the palette index for the header color

return
color

        return field_4_header_color;
    
public shortgetLeftCol()
get the leftmost column displayed in the window

return
leftmost

        return field_3_left_col;
    
public shortgetNormalZoom()
get the zoom magnification in normal view

return
zoom

        return field_6_normal_zoom;
    
public shortgetOptions()
get the options bitmask or just use the bit setters.

return
options

        return field_1_options;
    
public shortgetPageBreakZoom()
zoom magification in page break view

return
zoom

        return field_5_page_break_zoom;
    
public booleangetPaged()
is the sheet currently displayed in the window

return
displayed or not

        return paged.isSet(field_1_options);
    
public intgetRecordSize()

        return 22;
    
public intgetReserved()
get the reserved bits - why would you do this?

return
reserved stuff -probably garbage

        return field_7_reserved;
    
public booleangetSavedInPageBreakPreview()
was the sheet saved in page break view

return
pagebreaksaved or not

        return savedInPageBreakPreview.isSet(field_1_options);
    
public booleangetSelected()
sheet tab is selected

return
selected or not

        return selected.isSet(field_1_options);
    
public shortgetSid()

        return sid;
    
public shortgetTopRow()
get the top row visible in the window

return
toprow

        return field_2_top_row;
    
public intserialize(int offset, byte[] data)

        LittleEndian.putShort(data, 0 + offset, sid);
        LittleEndian.putShort(data, 2 + offset, ( short ) 18);
        LittleEndian.putShort(data, 4 + offset, getOptions());
        LittleEndian.putShort(data, 6 + offset, getTopRow());
        LittleEndian.putShort(data, 8 + offset, getLeftCol());
        LittleEndian.putInt(data, 10 + offset, getHeaderColor());
        LittleEndian.putShort(data, 14 + offset, getPageBreakZoom());
        LittleEndian.putShort(data, 16 + offset, getNormalZoom());
        LittleEndian.putInt(data, 18 + offset, getReserved());
        return getRecordSize();
    
public voidsetArabic(boolean isarabic)
is this arabic?

param
isarabic arabic or not

        field_1_options = arabic.setShortBoolean(field_1_options, isarabic);
    
public voidsetDefaultHeader(boolean header)
set whether the window should display a default header

param
header or not

        field_1_options = defaultHeader.setShortBoolean(field_1_options, header);
    
public voidsetDisplayFormulas(boolean formulas)
set whether the window should display formulas

param
formulas or not

        field_1_options = displayFormulas.setShortBoolean(field_1_options, formulas);
    
public voidsetDisplayGridlines(boolean gridlines)
set whether the window should display gridlines

param
gridlines or not

        field_1_options = displayGridlines.setShortBoolean(field_1_options, gridlines);
    
public voidsetDisplayGuts(boolean guts)
set whether the outline symbols are displaed

param
guts symbols or not

        field_1_options = displayGuts.setShortBoolean(field_1_options, guts);
    
public voidsetDisplayRowColHeadings(boolean headings)
set whether the window should display row and column headings

param
headings or not

        field_1_options = displayRowColHeadings.setShortBoolean(field_1_options, headings);
    
public voidsetDisplayZeros(boolean zeros)
set whether the window should display zero values

param
zeros or not

        field_1_options = displayZeros.setShortBoolean(field_1_options, zeros);
    
public voidsetFreezePanes(boolean freezepanes)
set whether the window should freeze panes

param
freezepanes freeze panes or not

        field_1_options = freezePanes.setShortBoolean(field_1_options, freezepanes);
    
public voidsetFreezePanesNoSplit(boolean freeze)
freeze unsplit panes or not

param
freeze or not

        field_1_options = freezePanesNoSplit.setShortBoolean(field_1_options, freeze);
    
public voidsetHeaderColor(int color)
set the palette index for the header color

param
color

        field_4_header_color = color;
    
public voidsetLeftCol(short leftCol)
set the leftmost column displayed in the window

param
leftCol leftmost column

        field_3_left_col = leftCol;
    
public voidsetNormalZoom(short zoom)
set the zoom magnification in normal view

param
zoom

        field_6_normal_zoom = zoom;
    
public voidsetOptions(short options)
set the options bitmask or just use the bit setters.

param
options

        field_1_options = options;
    
public voidsetPageBreakZoom(short zoom)
zoom magification in page break view

param
zoom

        field_5_page_break_zoom = zoom;
    
public voidsetPaged(boolean p)
is the sheet currently displayed in the window

param
p displayed or not

        field_1_options = paged.setShortBoolean(field_1_options, p);
    
public voidsetReserved(int reserved)
set the reserved (don't do this) value

        field_7_reserved = reserved;
    
public voidsetSavedInPageBreakPreview(boolean p)
was the sheet saved in page break view

param
p pagebreaksaved or not

        field_1_options = savedInPageBreakPreview.setShortBoolean(field_1_options, p);
    
public voidsetSelected(boolean sel)
sheet tab is selected

param
sel selected or not

        field_1_options = selected.setShortBoolean(field_1_options, sel);
    
public voidsetTopRow(short topRow)
set the top row visible in the window

param
topRow top row visible

        field_2_top_row = topRow;
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("[WINDOW2]\n");
        buffer.append("    .options        = ")
            .append(Integer.toHexString(getOptions())).append("\n");
        buffer.append("       .dispformulas= ").append(getDisplayFormulas())
            .append("\n");
        buffer.append("       .dispgridlins= ").append(getDisplayGridlines())
            .append("\n");
        buffer.append("       .disprcheadin= ")
            .append(getDisplayRowColHeadings()).append("\n");
        buffer.append("       .freezepanes = ").append(getFreezePanes())
            .append("\n");
        buffer.append("       .displayzeros= ").append(getDisplayZeros())
            .append("\n");
        buffer.append("       .defaultheadr= ").append(getDefaultHeader())
            .append("\n");
        buffer.append("       .arabic      = ").append(getArabic())
            .append("\n");
        buffer.append("       .displayguts = ").append(getDisplayGuts())
            .append("\n");
        buffer.append("       .frzpnsnosplt= ")
            .append(getFreezePanesNoSplit()).append("\n");
        buffer.append("       .selected    = ").append(getSelected())
            .append("\n");
        buffer.append("       .paged       = ").append(getPaged())
            .append("\n");
        buffer.append("       .svdinpgbrkpv= ")
            .append(getSavedInPageBreakPreview()).append("\n");
        buffer.append("    .toprow         = ")
            .append(Integer.toHexString(getTopRow())).append("\n");
        buffer.append("    .leftcol        = ")
            .append(Integer.toHexString(getLeftCol())).append("\n");
        buffer.append("    .headercolor    = ")
            .append(Integer.toHexString(getHeaderColor())).append("\n");
        buffer.append("    .pagebreakzoom  = ")
            .append(Integer.toHexString(getPageBreakZoom())).append("\n");
        buffer.append("    .normalzoom     = ")
            .append(Integer.toHexString(getNormalZoom())).append("\n");
        buffer.append("    .reserved       = ")
            .append(Integer.toHexString(getReserved())).append("\n");
        buffer.append("[/WINDOW2]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)

        if (id != sid)
        {
            throw new RecordFormatException("NOT A valid WindowTwo RECORD");
        }