KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > record > SheetPropertiesRecord


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19
20 package org.apache.poi.hssf.record;
21
22
23
24 import org.apache.poi.util.*;
25
26 /**
27  * Describes a chart sheet properties record.
28  * NOTE: This source is automatically generated please do not modify this file. Either subclass or
29  * remove the record in src/records/definitions.
30
31  * @author Glen Stampoultzis (glens at apache.org)
32  */

33 public class SheetPropertiesRecord
34     extends Record
35 {
36     public final static short sid = 0x1044;
37     private short field_1_flags;
38     private BitField chartTypeManuallyFormatted = new BitField(0x1);
39     private BitField plotVisibleOnly = new BitField(0x2);
40     private BitField doNotSizeWithWindow = new BitField(0x4);
41     private BitField defaultPlotDimensions = new BitField(0x8);
42     private BitField autoPlotArea = new BitField(0x10);
43     private byte field_2_empty;
44     public final static byte EMPTY_NOT_PLOTTED = 0;
45     public final static byte EMPTY_ZERO = 1;
46     public final static byte EMPTY_INTERPOLATED = 2;
47
48
49     public SheetPropertiesRecord()
50     {
51
52     }
53
54     /**
55      * Constructs a SheetProperties record and sets its fields appropriately.
56      *
57      * @param id id must be 0x1044 or an exception
58      * will be throw upon validation
59      * @param size size the size of the data area of the record
60      * @param data data of the record (should not contain sid/len)
61      */

62
63     public SheetPropertiesRecord(short id, short size, byte [] data)
64     {
65         super(id, size, data);
66     
67     }
68
69     /**
70      * Constructs a SheetProperties record and sets its fields appropriately.
71      *
72      * @param id id must be 0x1044 or an exception
73      * will be throw upon validation
74      * @param size size the size of the data area of the record
75      * @param data data of the record (should not contain sid/len)
76      * @param offset of the record's data
77      */

78
79     public SheetPropertiesRecord(short id, short size, byte [] data, int offset)
80     {
81         super(id, size, data, offset);
82     
83     }
84
85     /**
86      * Checks the sid matches the expected side for this record
87      *
88      * @param id the expected sid.
89      */

90     protected void validateSid(short id)
91     {
92         if (id != sid)
93         {
94             throw new RecordFormatException("Not a SheetProperties record");
95         }
96     }
97
98     protected void fillFields(byte [] data, short size, int offset)
99     {
100
101         int pos = 0;
102         field_1_flags = LittleEndian.getShort(data, pos + 0x0 + offset);
103         field_2_empty = data[ pos + 0x2 + offset ];
104
105     }
106
107     public String JavaDoc toString()
108     {
109         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
110
111         buffer.append("[SHTPROPS]\n");
112         buffer.append(" .flags = ")
113             .append("0x").append(HexDump.toHex( getFlags ()))
114             .append(" (").append( getFlags() ).append(" )");
115         buffer.append(System.getProperty("line.separator"));
116         buffer.append(" .chartTypeManuallyFormatted = ").append(isChartTypeManuallyFormatted()).append('\n');
117         buffer.append(" .plotVisibleOnly = ").append(isPlotVisibleOnly()).append('\n');
118         buffer.append(" .doNotSizeWithWindow = ").append(isDoNotSizeWithWindow()).append('\n');
119         buffer.append(" .defaultPlotDimensions = ").append(isDefaultPlotDimensions()).append('\n');
120         buffer.append(" .autoPlotArea = ").append(isAutoPlotArea()).append('\n');
121         buffer.append(" .empty = ")
122             .append("0x").append(HexDump.toHex( getEmpty ()))
123             .append(" (").append( getEmpty() ).append(" )");
124         buffer.append(System.getProperty("line.separator"));
125
126         buffer.append("[/SHTPROPS]\n");
127         return buffer.toString();
128     }
129
130     public int serialize(int offset, byte[] data)
131     {
132         int pos = 0;
133
134         LittleEndian.putShort(data, 0 + offset, sid);
135         LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
136
137         LittleEndian.putShort(data, 4 + offset + pos, field_1_flags);
138         data[ 6 + offset + pos ] = field_2_empty;
139
140         return getRecordSize();
141     }
142
143     /**
144      * Size of record (exluding 4 byte header)
145      */

146     public int getRecordSize()
147     {
148         return 4 + 2 + 1;
149     }
150
151     public short getSid()
152     {
153         return this.sid;
154     }
155
156     public Object JavaDoc clone() {
157         SheetPropertiesRecord rec = new SheetPropertiesRecord();
158     
159         rec.field_1_flags = field_1_flags;
160         rec.field_2_empty = field_2_empty;
161         return rec;
162     }
163
164
165
166
167     /**
168      * Get the flags field for the SheetProperties record.
169      */

170     public short getFlags()
171     {
172         return field_1_flags;
173     }
174
175     /**
176      * Set the flags field for the SheetProperties record.
177      */

178     public void setFlags(short field_1_flags)
179     {
180         this.field_1_flags = field_1_flags;
181     }
182
183     /**
184      * Get the empty field for the SheetProperties record.
185      *
186      * @return One of
187      * EMPTY_NOT_PLOTTED
188      * EMPTY_ZERO
189      * EMPTY_INTERPOLATED
190      */

191     public byte getEmpty()
192     {
193         return field_2_empty;
194     }
195
196     /**
197      * Set the empty field for the SheetProperties record.
198      *
199      * @param field_2_empty
200      * One of
201      * EMPTY_NOT_PLOTTED
202      * EMPTY_ZERO
203      * EMPTY_INTERPOLATED
204      */

205     public void setEmpty(byte field_2_empty)
206     {
207         this.field_2_empty = field_2_empty;
208     }
209
210     /**
211      * Sets the chart type manually formatted field value.
212      * Has the chart type been manually formatted?
213      */

214     public void setChartTypeManuallyFormatted(boolean value)
215     {
216         field_1_flags = chartTypeManuallyFormatted.setShortBoolean(field_1_flags, value);
217     }
218
219     /**
220      * Has the chart type been manually formatted?
221      * @return the chart type manually formatted field value.
222      */

223     public boolean isChartTypeManuallyFormatted()
224     {
225         return chartTypeManuallyFormatted.isSet(field_1_flags);
226     }
227
228     /**
229      * Sets the plot visible only field value.
230      * Only show visible cells on the chart.
231      */

232     public void setPlotVisibleOnly(boolean value)
233     {
234         field_1_flags = plotVisibleOnly.setShortBoolean(field_1_flags, value);
235     }
236
237     /**
238      * Only show visible cells on the chart.
239      * @return the plot visible only field value.
240      */

241     public boolean isPlotVisibleOnly()
242     {
243         return plotVisibleOnly.isSet(field_1_flags);
244     }
245
246     /**
247      * Sets the do not size with window field value.
248      * Do not size the chart when the window changes size
249      */

250     public void setDoNotSizeWithWindow(boolean value)
251     {
252         field_1_flags = doNotSizeWithWindow.setShortBoolean(field_1_flags, value);
253     }
254
255     /**
256      * Do not size the chart when the window changes size
257      * @return the do not size with window field value.
258      */

259     public boolean isDoNotSizeWithWindow()
260     {
261         return doNotSizeWithWindow.isSet(field_1_flags);
262     }
263
264     /**
265      * Sets the default plot dimensions field value.
266      * Indicates that the default area dimensions should be used.
267      */

268     public void setDefaultPlotDimensions(boolean value)
269     {
270         field_1_flags = defaultPlotDimensions.setShortBoolean(field_1_flags, value);
271     }
272
273     /**
274      * Indicates that the default area dimensions should be used.
275      * @return the default plot dimensions field value.
276      */

277     public boolean isDefaultPlotDimensions()
278     {
279         return defaultPlotDimensions.isSet(field_1_flags);
280     }
281
282     /**
283      * Sets the auto plot area field value.
284      * ??
285      */

286     public void setAutoPlotArea(boolean value)
287     {
288         field_1_flags = autoPlotArea.setShortBoolean(field_1_flags, value);
289     }
290
291     /**
292      * ??
293      * @return the auto plot area field value.
294      */

295     public boolean isAutoPlotArea()
296     {
297         return autoPlotArea.isSet(field_1_flags);
298     }
299
300
301 } // END OF CLASS
302

303
304
305
306
Popular Tags