📄 commonobjectdatasubrecord.java
字号:
/* ==================================================================== Copyright 2002-2004 Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.==================================================================== */ package org.apache.poi.hssf.record;import org.apache.poi.util.*;/** * The common object data record is used to store all common preferences for an excel object. * NOTE: This source is automatically generated please do not modify this file. Either subclass or * remove the record in src/records/definitions. * @author Glen Stampoultzis (glens at apache.org) */public class CommonObjectDataSubRecord extends SubRecord{ public final static short sid = 0x15; private short field_1_objectType; public final static short OBJECT_TYPE_GROUP = 0; public final static short OBJECT_TYPE_LINE = 1; public final static short OBJECT_TYPE_RECTANGLE = 2; public final static short OBJECT_TYPE_OVAL = 3; public final static short OBJECT_TYPE_ARC = 4; public final static short OBJECT_TYPE_CHART = 5; public final static short OBJECT_TYPE_TEXT = 6; public final static short OBJECT_TYPE_BUTTON = 7; public final static short OBJECT_TYPE_PICTURE = 8; public final static short OBJECT_TYPE_POLYGON = 9; public final static short OBJECT_TYPE_RESERVED1 = 10; public final static short OBJECT_TYPE_CHECKBOX = 11; public final static short OBJECT_TYPE_OPTION_BUTTON = 12; public final static short OBJECT_TYPE_EDIT_BOX = 13; public final static short OBJECT_TYPE_LABEL = 14; public final static short OBJECT_TYPE_DIALOG_BOX = 15; public final static short OBJECT_TYPE_SPINNER = 16; public final static short OBJECT_TYPE_SCROLL_BAR = 17; public final static short OBJECT_TYPE_LIST_BOX = 18; public final static short OBJECT_TYPE_GROUP_BOX = 19; public final static short OBJECT_TYPE_COMBO_BOX = 20; public final static short OBJECT_TYPE_RESERVED2 = 21; public final static short OBJECT_TYPE_RESERVED3 = 22; public final static short OBJECT_TYPE_RESERVED4 = 23; public final static short OBJECT_TYPE_RESERVED5 = 24; public final static short OBJECT_TYPE_COMMENT = 25; public final static short OBJECT_TYPE_RESERVED6 = 26; public final static short OBJECT_TYPE_RESERVED7 = 27; public final static short OBJECT_TYPE_RESERVED8 = 28; public final static short OBJECT_TYPE_RESERVED9 = 29; public final static short OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 30; private short field_2_objectId; private short field_3_option; private BitField locked = new BitField(0x1); private BitField printable = new BitField(0x10); private BitField autofill = new BitField(0x2000); private BitField autoline = new BitField(0x4000); private int field_4_reserved1; private int field_5_reserved2; private int field_6_reserved3; public CommonObjectDataSubRecord() { } /** * Constructs a CommonObjectData record and sets its fields appropriately. * * @param id id must be 0x15 or an exception * will be throw upon validation * @param size size the size of the data area of the record * @param data data of the record (should not contain sid/len) */ public CommonObjectDataSubRecord(short id, short size, byte [] data) { super(id, size, data); } /** * Constructs a CommonObjectData record and sets its fields appropriately. * * @param id id must be 0x15 or an exception * will be throw upon validation * @param size size the size of the data area of the record * @param data data of the record (should not contain sid/len) * @param offset of the record's data */ public CommonObjectDataSubRecord(short id, short size, byte [] data, int offset) { super(id, size, data, offset); } /** * Checks the sid matches the expected side for this record * * @param id the expected sid. */ protected void validateSid(short id) { if (id != sid) { throw new RecordFormatException("Not a CommonObjectData record"); } } protected void fillFields(byte [] data, short size, int offset) { int pos = 0; field_1_objectType = LittleEndian.getShort(data, pos + 0x0 + offset); field_2_objectId = LittleEndian.getShort(data, pos + 0x2 + offset); field_3_option = LittleEndian.getShort(data, pos + 0x4 + offset); field_4_reserved1 = LittleEndian.getInt(data, pos + 0x6 + offset); field_5_reserved2 = LittleEndian.getInt(data, pos + 0xa + offset); field_6_reserved3 = LittleEndian.getInt(data, pos + 0xe + offset); } public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("[ftCmo]\n"); buffer.append(" .objectType = ") .append("0x").append(HexDump.toHex( getObjectType ())) .append(" (").append( getObjectType() ).append(" )"); buffer.append(System.getProperty("line.separator")); buffer.append(" .objectId = ") .append("0x").append(HexDump.toHex( getObjectId ())) .append(" (").append( getObjectId() ).append(" )"); buffer.append(System.getProperty("line.separator")); buffer.append(" .option = ") .append("0x").append(HexDump.toHex( getOption ())) .append(" (").append( getOption() ).append(" )"); buffer.append(System.getProperty("line.separator")); buffer.append(" .locked = ").append(isLocked()).append('\n'); buffer.append(" .printable = ").append(isPrintable()).append('\n'); buffer.append(" .autofill = ").append(isAutofill()).append('\n'); buffer.append(" .autoline = ").append(isAutoline()).append('\n'); buffer.append(" .reserved1 = ") .append("0x").append(HexDump.toHex( getReserved1 ())) .append(" (").append( getReserved1() ).append(" )"); buffer.append(System.getProperty("line.separator")); buffer.append(" .reserved2 = ") .append("0x").append(HexDump.toHex( getReserved2 ())) .append(" (").append( getReserved2() ).append(" )"); buffer.append(System.getProperty("line.separator")); buffer.append(" .reserved3 = ") .append("0x").append(HexDump.toHex( getReserved3 ())) .append(" (").append( getReserved3() ).append(" )"); buffer.append(System.getProperty("line.separator")); buffer.append("[/ftCmo]\n"); return buffer.toString(); } public int serialize(int offset, byte[] data) { int pos = 0; LittleEndian.putShort(data, 0 + offset, sid); LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4)); LittleEndian.putShort(data, 4 + offset + pos, field_1_objectType); LittleEndian.putShort(data, 6 + offset + pos, field_2_objectId); LittleEndian.putShort(data, 8 + offset + pos, field_3_option); LittleEndian.putInt(data, 10 + offset + pos, field_4_reserved1); LittleEndian.putInt(data, 14 + offset + pos, field_5_reserved2); LittleEndian.putInt(data, 18 + offset + pos, field_6_reserved3); return getRecordSize(); } /** * Size of record (exluding 4 byte header) */ public int getRecordSize() { return 4 + 2 + 2 + 2 + 4 + 4 + 4; } public short getSid() { return this.sid; } public Object clone() { CommonObjectDataSubRecord rec = new CommonObjectDataSubRecord(); rec.field_1_objectType = field_1_objectType; rec.field_2_objectId = field_2_objectId; rec.field_3_option = field_3_option; rec.field_4_reserved1 = field_4_reserved1; rec.field_5_reserved2 = field_5_reserved2; rec.field_6_reserved3 = field_6_reserved3; return rec; } /** * Get the object type field for the CommonObjectData record. * * @return One of * OBJECT_TYPE_GROUP * OBJECT_TYPE_LINE * OBJECT_TYPE_RECTANGLE * OBJECT_TYPE_OVAL * OBJECT_TYPE_ARC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -