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
;
22 import org
.apache
.poi
.util
.LittleEndian
;
25 * Title: Hide Object Record<P>
26 * Description: flag defines whether to hide placeholders and object<P>
27 * REFERENCE: PG 321 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
28 * @author Andrew C. Oliver (acoliver at apache dot org)
32 public class HideObjRecord
35 public final static short sid
= 0x8d;
36 public final static short HIDE_ALL
= 2;
37 public final static short SHOW_PLACEHOLDERS
= 1;
38 public final static short SHOW_ALL
= 0;
39 private short field_1_hide_obj
;
41 public HideObjRecord()
46 * Constructs an HideObj record and sets its fields appropriately.
47 * @param in the RecordInputstream to read the record from
50 public HideObjRecord(RecordInputStream in
)
55 protected void validateSid(short id
)
59 throw new RecordFormatException("NOT A HIDEOBJ RECORD");
63 protected void fillFields(RecordInputStream in
)
65 field_1_hide_obj
= in
.readShort();
69 * set hide object options
73 * @see #SHOW_PLACEHOLDERS
77 public void setHideObj(short hide
)
79 field_1_hide_obj
= hide
;
83 * get hide object options
85 * @return hide options
87 * @see #SHOW_PLACEHOLDERS
91 public short getHideObj()
93 return field_1_hide_obj
;
96 public String
toString()
98 StringBuffer buffer
= new StringBuffer();
100 buffer
.append("[HIDEOBJ]\n");
101 buffer
.append(" .hideobj = ")
102 .append(Integer
.toHexString(getHideObj())).append("\n");
103 buffer
.append("[/HIDEOBJ]\n");
104 return buffer
.toString();
107 public int serialize(int offset
, byte [] data
)
109 LittleEndian
.putShort(data
, 0 + offset
, sid
);
110 LittleEndian
.putShort(data
, 2 + offset
,
111 (( short ) 0x02)); // 2 bytes (6 total)
112 LittleEndian
.putShort(data
, 4 + offset
, getHideObj());
113 return getRecordSize();
116 public int getRecordSize()
121 public short getSid()