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

WindowOneRecord

public class WindowOneRecord extends Record
Title: Window1 Record

Description: Stores the attributes of the workbook window. This is basically so the gui knows how big to make the window holding the spreadsheet document.

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

author
Andrew C. Oliver (acoliver at apache dot org)
version
2.0-pre

Fields Summary
public static final short
sid
private short
field_1_h_hold
private short
field_2_v_hold
private short
field_3_width
private short
field_4_height
private short
field_5_options
private static final BitField
hidden
private static final BitField
iconic
private static final BitField
reserved
private static final BitField
hscroll
private static final BitField
vscroll
private static final BitField
tabs
private short
field_6_selected_tab
private short
field_7_displayed_tab
private short
field_8_num_selected_tabs
private short
field_9_tab_width_ratio
Constructors Summary
public WindowOneRecord()


     
    
    
public WindowOneRecord(RecordInputStream in)
Constructs a WindowOne record and sets its fields appropriately.

param
id id must be 0x3d 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
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)

        field_1_h_hold            = in.readShort();
        field_2_v_hold            = in.readShort();
        field_3_width             = in.readShort();
        field_4_height            = in.readShort();
        field_5_options           = in.readShort();
        field_6_selected_tab      = in.readShort();
        field_7_displayed_tab     = in.readShort();
        field_8_num_selected_tabs = in.readShort();
        field_9_tab_width_ratio   = in.readShort();
    
public booleangetDisplayHorizontalScrollbar()
get whether to display the horizontal scrollbar or not

return
display or not

        return hscroll.isSet(field_5_options);
    
public booleangetDisplayTabs()
get whether to display the tabs or not

return
display or not

        return tabs.isSet(field_5_options);
    
public booleangetDisplayVerticalScrollbar()
get whether to display the vertical scrollbar or not

return
display or not

        return vscroll.isSet(field_5_options);
    
public shortgetDisplayedTab()
get the displayed tab number

return
Tab number

        return field_7_displayed_tab;
    
public shortgetHeight()
get the height of the window

return
height

        return field_4_height;
    
public booleangetHidden()
get whether the window is hidden or not

return
ishidden or not

        return hidden.isSet(field_5_options);
    
public shortgetHorizontalHold()
get the horizontal position of the window (in 1/20ths of a point)

return
h - horizontal location

        return field_1_h_hold;
    
public booleangetIconic()
get whether the window has been iconized or not

return
iconize or not

        return iconic.isSet(field_5_options);
    
public shortgetNumSelectedTabs()
get the number of selected tabs

return
number of tabs

        return field_8_num_selected_tabs;
    
public shortgetOptions()
get the options bitmask (see bit setters)

return
o - the bitmask

        return field_5_options;
    
public intgetRecordSize()

        return 22;
    
public shortgetSelectedTab()
get the selected tab number

return
Tab number

        return field_6_selected_tab;
    
public shortgetSid()

        return sid;
    
public shortgetTabWidthRatio()
ratio of the width of the tabs to the horizontal scrollbar

return
ratio

        return field_9_tab_width_ratio;
    
public shortgetVerticalHold()
get the vertical position of the window (in 1/20ths of a point)

return
v - vertical location

        return field_2_v_hold;
    
public shortgetWidth()
get the width of the window

return
width

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

        LittleEndian.putShort(data, 0 + offset, sid);
        LittleEndian.putShort(data, 2 + offset,
                              (( short ) 0x12));   // 18 bytes (22 total)
        LittleEndian.putShort(data, 4 + offset, getHorizontalHold());
        LittleEndian.putShort(data, 6 + offset, getVerticalHold());
        LittleEndian.putShort(data, 8 + offset, getWidth());
        LittleEndian.putShort(data, 10 + offset, getHeight());
        LittleEndian.putShort(data, 12 + offset, getOptions());
        LittleEndian.putShort(data, 14 + offset, getSelectedTab());
        LittleEndian.putShort(data, 16 + offset, getDisplayedTab());
        LittleEndian.putShort(data, 18 + offset, getNumSelectedTabs());
        LittleEndian.putShort(data, 20 + offset, getTabWidthRatio());
        return getRecordSize();
    
public voidsetDisplayHorizonalScrollbar(boolean scroll)
set whether to display the horizontal scrollbar or not

param
scroll display or not

        field_5_options = hscroll.setShortBoolean(field_5_options, scroll);
    
public voidsetDisplayTabs(boolean disptabs)
set whether to display the tabs or not

param
disptabs display or not

        field_5_options = tabs.setShortBoolean(field_5_options, disptabs);
    
public voidsetDisplayVerticalScrollbar(boolean scroll)
set whether to display the vertical scrollbar or not

param
scroll display or not

        field_5_options = vscroll.setShortBoolean(field_5_options, scroll);
    
public voidsetDisplayedTab(short t)
set the displayed tab number

param
t tab number

        field_7_displayed_tab = t;
    
public voidsetHeight(short h)
set teh height of the window

param
h height

        field_4_height = h;
    
public voidsetHidden(boolean ishidden)
set whether the window is hidden or not

param
ishidden or not

        field_5_options = hidden.setShortBoolean(field_5_options, ishidden);
    
public voidsetHorizontalHold(short h)
set the horizontal position of the window (in 1/20ths of a point)

param
h - horizontal location

        field_1_h_hold = h;
    
public voidsetIconic(boolean isiconic)
set whether the window has been iconized or not

param
isiconic iconize or not

        field_5_options = iconic.setShortBoolean(field_5_options, isiconic);
    
public voidsetNumSelectedTabs(short n)
set the number of selected tabs

param
n number of tabs

        field_8_num_selected_tabs = n;
    
public voidsetOptions(short o)
set the options bitmask (see bit setters)

param
o - the bitmask

        field_5_options = o;
    
public voidsetSelectedTab(short s)
set the selected tab number

param
s tab number

        field_6_selected_tab = s;
    
public voidsetTabWidthRatio(short r)
ratio of the width of the tabs to the horizontal scrollbar

param
r ratio

        field_9_tab_width_ratio = r;
    
public voidsetVerticalHold(short v)
set the vertical position of the window (in 1/20ths of a point)

param
v - vertical location

        field_2_v_hold = v;
    
public voidsetWidth(short w)
set the width of the window

param
w width

        field_3_width = w;
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("[WINDOW1]\n");
        buffer.append("    .h_hold          = ")
            .append(Integer.toHexString(getHorizontalHold())).append("\n");
        buffer.append("    .v_hold          = ")
            .append(Integer.toHexString(getVerticalHold())).append("\n");
        buffer.append("    .width           = ")
            .append(Integer.toHexString(getWidth())).append("\n");
        buffer.append("    .height          = ")
            .append(Integer.toHexString(getHeight())).append("\n");
        buffer.append("    .options         = ")
            .append(Integer.toHexString(getOptions())).append("\n");
        buffer.append("        .hidden      = ").append(getHidden())
            .append("\n");
        buffer.append("        .iconic      = ").append(getIconic())
            .append("\n");
        buffer.append("        .hscroll     = ")
            .append(getDisplayHorizontalScrollbar()).append("\n");
        buffer.append("        .vscroll     = ")
            .append(getDisplayVerticalScrollbar()).append("\n");
        buffer.append("        .tabs        = ").append(getDisplayTabs())
            .append("\n");
        buffer.append("    .selectedtab     = ")
            .append(Integer.toHexString(getSelectedTab())).append("\n");
        buffer.append("    .displayedtab    = ")
            .append(Integer.toHexString(getDisplayedTab())).append("\n");
        buffer.append("    .numselectedtabs = ")
            .append(Integer.toHexString(getNumSelectedTabs())).append("\n");
        buffer.append("    .tabwidthratio   = ")
            .append(Integer.toHexString(getTabWidthRatio())).append("\n");
        buffer.append("[/WINDOW1]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)

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