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
.*;
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
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);
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
)
61 * Checks the sid matches the expected side for this record
63 * @param id the expected sid.
65 protected void validateSid(short id
)
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
)
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()
116 public short getSid()
121 public Object
clone() {
122 AreaRecord rec
= new AreaRecord();
124 rec
.field_1_formatFlags
= field_1_formatFlags
;
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.
151 public void setStacked(boolean value
)
153 field_1_formatFlags
= stacked
.setShortBoolean(field_1_formatFlags
, value
);
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
);