Inspired by bug #44958 - Record level support for Data Tables. (No formula parser...
[poi.git] / src / java / org / apache / poi / hssf / record / AreaRecord.java
blob32aa57eed2641b50dad0469f247a1aed36a550ba
2 /* ====================================================================
3 Licensed to the Apache Software Foundation (ASF) under one or more
4 contributor license agreements. See the NOTICE file distributed with
5 this work for additional information regarding copyright ownership.
6 The ASF licenses this file to You under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with
8 the License. You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================== */
20 package org.apache.poi.hssf.record;
24 import org.apache.poi.util.*;
26 /**
27 * The area record is used to define a area chart.
28 * NOTE: This source is automatically generated please do not modify this file. Either subclass or
29 * remove the record in src/records/definitions.
31 * @author Glen Stampoultzis (glens at apache.org)
33 public class AreaRecord
34 extends Record
36 public final static short sid = 0x101A;
37 private short field_1_formatFlags;
38 private BitField stacked = BitFieldFactory.getInstance(0x1);
39 private BitField displayAsPercentage = BitFieldFactory.getInstance(0x2);
40 private BitField shadow = BitFieldFactory.getInstance(0x4);
43 public AreaRecord()
48 /**
49 * Constructs a Area record and sets its fields appropriately.
51 * @param in the RecordInputstream to read the record from
54 public AreaRecord(RecordInputStream in)
56 super(in);
60 /**
61 * Checks the sid matches the expected side for this record
63 * @param id the expected sid.
65 protected void validateSid(short id)
67 if (id != sid)
69 throw new RecordFormatException("Not a Area record");
73 protected void fillFields(RecordInputStream in)
76 field_1_formatFlags = in.readShort();
79 public String toString()
81 StringBuffer buffer = new StringBuffer();
83 buffer.append("[AREA]\n");
84 buffer.append(" .formatFlags = ")
85 .append("0x").append(HexDump.toHex( getFormatFlags ()))
86 .append(" (").append( getFormatFlags() ).append(" )");
87 buffer.append(System.getProperty("line.separator"));
88 buffer.append(" .stacked = ").append(isStacked()).append('\n');
89 buffer.append(" .displayAsPercentage = ").append(isDisplayAsPercentage()).append('\n');
90 buffer.append(" .shadow = ").append(isShadow()).append('\n');
92 buffer.append("[/AREA]\n");
93 return buffer.toString();
96 public int serialize(int offset, byte[] data)
98 int pos = 0;
100 LittleEndian.putShort(data, 0 + offset, sid);
101 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
103 LittleEndian.putShort(data, 4 + offset + pos, field_1_formatFlags);
105 return getRecordSize();
109 * Size of record (exluding 4 byte header)
111 public int getRecordSize()
113 return 4 + 2;
116 public short getSid()
118 return sid;
121 public Object clone() {
122 AreaRecord rec = new AreaRecord();
124 rec.field_1_formatFlags = field_1_formatFlags;
125 return rec;
132 * Get the format flags field for the Area record.
134 public short getFormatFlags()
136 return field_1_formatFlags;
140 * Set the format flags field for the Area record.
142 public void setFormatFlags(short field_1_formatFlags)
144 this.field_1_formatFlags = field_1_formatFlags;
148 * Sets the stacked field value.
149 * series is stacked
151 public void setStacked(boolean value)
153 field_1_formatFlags = stacked.setShortBoolean(field_1_formatFlags, value);
157 * series is stacked
158 * @return the stacked field value.
160 public boolean isStacked()
162 return stacked.isSet(field_1_formatFlags);
166 * Sets the display as percentage field value.
167 * results displayed as percentages
169 public void setDisplayAsPercentage(boolean value)
171 field_1_formatFlags = displayAsPercentage.setShortBoolean(field_1_formatFlags, value);
175 * results displayed as percentages
176 * @return the display as percentage field value.
178 public boolean isDisplayAsPercentage()
180 return displayAsPercentage.isSet(field_1_formatFlags);
184 * Sets the shadow field value.
185 * display a shadow for the chart
187 public void setShadow(boolean value)
189 field_1_formatFlags = shadow.setShortBoolean(field_1_formatFlags, value);
193 * display a shadow for the chart
194 * @return the shadow field value.
196 public boolean isShadow()
198 return shadow.isSet(field_1_formatFlags);
202 } // END OF CLASS