001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.hssf.record;
019:
020: import org.apache.poi.util.*;
021:
022: /**
023: * Describes a chart sheet properties record.
024: * NOTE: This source is automatically generated please do not modify this file. Either subclass or
025: * remove the record in src/records/definitions.
026:
027: * @author Glen Stampoultzis (glens at apache.org)
028: */
029: public class SheetPropertiesRecord extends Record {
030: public final static short sid = 0x1044;
031: private short field_1_flags;
032: private BitField chartTypeManuallyFormatted = BitFieldFactory
033: .getInstance(0x1);
034: private BitField plotVisibleOnly = BitFieldFactory.getInstance(0x2);
035: private BitField doNotSizeWithWindow = BitFieldFactory
036: .getInstance(0x4);
037: private BitField defaultPlotDimensions = BitFieldFactory
038: .getInstance(0x8);
039: private BitField autoPlotArea = BitFieldFactory.getInstance(0x10);
040: private byte field_2_empty;
041: public final static byte EMPTY_NOT_PLOTTED = 0;
042: public final static byte EMPTY_ZERO = 1;
043: public final static byte EMPTY_INTERPOLATED = 2;
044:
045: public SheetPropertiesRecord() {
046:
047: }
048:
049: /**
050: * Constructs a SheetProperties record and sets its fields appropriately.
051: *
052: * @param in the RecordInputstream to read the record from
053: */
054:
055: public SheetPropertiesRecord(RecordInputStream in) {
056: super (in);
057:
058: }
059:
060: /**
061: * Checks the sid matches the expected side for this record
062: *
063: * @param id the expected sid.
064: */
065: protected void validateSid(short id) {
066: if (id != sid) {
067: throw new RecordFormatException(
068: "Not a SheetProperties record");
069: }
070: }
071:
072: protected void fillFields(RecordInputStream in) {
073: field_1_flags = in.readShort();
074: field_2_empty = in.readByte();
075: }
076:
077: public String toString() {
078: StringBuffer buffer = new StringBuffer();
079:
080: buffer.append("[SHTPROPS]\n");
081: buffer.append(" .flags = ").append("0x")
082: .append(HexDump.toHex(getFlags())).append(" (").append(
083: getFlags()).append(" )");
084: buffer.append(System.getProperty("line.separator"));
085: buffer.append(" .chartTypeManuallyFormatted = ")
086: .append(isChartTypeManuallyFormatted()).append('\n');
087: buffer.append(" .plotVisibleOnly = ").append(
088: isPlotVisibleOnly()).append('\n');
089: buffer.append(" .doNotSizeWithWindow = ").append(
090: isDoNotSizeWithWindow()).append('\n');
091: buffer.append(" .defaultPlotDimensions = ").append(
092: isDefaultPlotDimensions()).append('\n');
093: buffer.append(" .autoPlotArea = ").append(
094: isAutoPlotArea()).append('\n');
095: buffer.append(" .empty = ").append("0x")
096: .append(HexDump.toHex(getEmpty())).append(" (").append(
097: getEmpty()).append(" )");
098: buffer.append(System.getProperty("line.separator"));
099:
100: buffer.append("[/SHTPROPS]\n");
101: return buffer.toString();
102: }
103:
104: public int serialize(int offset, byte[] data) {
105: int pos = 0;
106:
107: LittleEndian.putShort(data, 0 + offset, sid);
108: LittleEndian.putShort(data, 2 + offset,
109: (short) (getRecordSize() - 4));
110:
111: LittleEndian.putShort(data, 4 + offset + pos, field_1_flags);
112: data[6 + offset + pos] = field_2_empty;
113:
114: return getRecordSize();
115: }
116:
117: /**
118: * Size of record (exluding 4 byte header)
119: */
120: public int getRecordSize() {
121: return 4 + 2 + 1;
122: }
123:
124: public short getSid() {
125: return sid;
126: }
127:
128: public Object clone() {
129: SheetPropertiesRecord rec = new SheetPropertiesRecord();
130:
131: rec.field_1_flags = field_1_flags;
132: rec.field_2_empty = field_2_empty;
133: return rec;
134: }
135:
136: /**
137: * Get the flags field for the SheetProperties record.
138: */
139: public short getFlags() {
140: return field_1_flags;
141: }
142:
143: /**
144: * Set the flags field for the SheetProperties record.
145: */
146: public void setFlags(short field_1_flags) {
147: this .field_1_flags = field_1_flags;
148: }
149:
150: /**
151: * Get the empty field for the SheetProperties record.
152: *
153: * @return One of
154: * EMPTY_NOT_PLOTTED
155: * EMPTY_ZERO
156: * EMPTY_INTERPOLATED
157: */
158: public byte getEmpty() {
159: return field_2_empty;
160: }
161:
162: /**
163: * Set the empty field for the SheetProperties record.
164: *
165: * @param field_2_empty
166: * One of
167: * EMPTY_NOT_PLOTTED
168: * EMPTY_ZERO
169: * EMPTY_INTERPOLATED
170: */
171: public void setEmpty(byte field_2_empty) {
172: this .field_2_empty = field_2_empty;
173: }
174:
175: /**
176: * Sets the chart type manually formatted field value.
177: * Has the chart type been manually formatted?
178: */
179: public void setChartTypeManuallyFormatted(boolean value) {
180: field_1_flags = chartTypeManuallyFormatted.setShortBoolean(
181: field_1_flags, value);
182: }
183:
184: /**
185: * Has the chart type been manually formatted?
186: * @return the chart type manually formatted field value.
187: */
188: public boolean isChartTypeManuallyFormatted() {
189: return chartTypeManuallyFormatted.isSet(field_1_flags);
190: }
191:
192: /**
193: * Sets the plot visible only field value.
194: * Only show visible cells on the chart.
195: */
196: public void setPlotVisibleOnly(boolean value) {
197: field_1_flags = plotVisibleOnly.setShortBoolean(field_1_flags,
198: value);
199: }
200:
201: /**
202: * Only show visible cells on the chart.
203: * @return the plot visible only field value.
204: */
205: public boolean isPlotVisibleOnly() {
206: return plotVisibleOnly.isSet(field_1_flags);
207: }
208:
209: /**
210: * Sets the do not size with window field value.
211: * Do not size the chart when the window changes size
212: */
213: public void setDoNotSizeWithWindow(boolean value) {
214: field_1_flags = doNotSizeWithWindow.setShortBoolean(
215: field_1_flags, value);
216: }
217:
218: /**
219: * Do not size the chart when the window changes size
220: * @return the do not size with window field value.
221: */
222: public boolean isDoNotSizeWithWindow() {
223: return doNotSizeWithWindow.isSet(field_1_flags);
224: }
225:
226: /**
227: * Sets the default plot dimensions field value.
228: * Indicates that the default area dimensions should be used.
229: */
230: public void setDefaultPlotDimensions(boolean value) {
231: field_1_flags = defaultPlotDimensions.setShortBoolean(
232: field_1_flags, value);
233: }
234:
235: /**
236: * Indicates that the default area dimensions should be used.
237: * @return the default plot dimensions field value.
238: */
239: public boolean isDefaultPlotDimensions() {
240: return defaultPlotDimensions.isSet(field_1_flags);
241: }
242:
243: /**
244: * Sets the auto plot area field value.
245: * ??
246: */
247: public void setAutoPlotArea(boolean value) {
248: field_1_flags = autoPlotArea.setShortBoolean(field_1_flags,
249: value);
250: }
251:
252: /**
253: * ??
254: * @return the auto plot area field value.
255: */
256: public boolean isAutoPlotArea() {
257: return autoPlotArea.isSet(field_1_flags);
258: }
259:
260: } // END OF CLASS
|