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: Save External Links record (BookBool)<P>
26 * Description: Contains a flag specifying whether the Gui should save externally
27 * linked values from other workbooks. <P>
28 * REFERENCE: PG 289 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
29 * @author Andrew C. Oliver (acoliver at apache dot org)
33 public class BookBoolRecord
36 public final static short sid
= 0xDA;
37 private short field_1_save_link_values
;
39 public BookBoolRecord()
44 * Constructs a BookBoolRecord and sets its fields appropriately
45 * @param in the RecordInputstream to read the record from
48 public BookBoolRecord(RecordInputStream in
)
53 protected void validateSid(short id
)
57 throw new RecordFormatException("NOT A BOOKBOOL RECORD");
61 protected void fillFields(RecordInputStream in
)
63 field_1_save_link_values
= in
.readShort();
67 * set the save ext links flag
69 * @param flag flag (0/1 -off/on)
72 public void setSaveLinkValues(short flag
)
74 field_1_save_link_values
= flag
;
78 * get the save ext links flag
80 * @return short 0/1 (off/on)
83 public short getSaveLinkValues()
85 return field_1_save_link_values
;
88 public String
toString()
90 StringBuffer buffer
= new StringBuffer();
92 buffer
.append("[BOOKBOOL]\n");
93 buffer
.append(" .savelinkvalues = ")
94 .append(Integer
.toHexString(getSaveLinkValues())).append("\n");
95 buffer
.append("[/BOOKBOOL]\n");
96 return buffer
.toString();
99 public int serialize(int offset
, byte [] data
)
101 LittleEndian
.putShort(data
, 0 + offset
, sid
);
102 LittleEndian
.putShort(data
, 2 + offset
,
103 (( short ) 0x02)); // 2 bytes (6 total)
104 LittleEndian
.putShort(data
, 4 + offset
, field_1_save_link_values
);
105 return getRecordSize();
108 public int getRecordSize()
113 public short getSid()