You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BookBoolRecord.java 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.hssf.record;
  16. import java.util.Map;
  17. import java.util.function.Supplier;
  18. import org.apache.poi.util.GenericRecordUtil;
  19. import org.apache.poi.util.LittleEndianOutput;
  20. /**
  21. * Contains a flag specifying whether the Gui should save externally linked values from other workbooks.
  22. *
  23. * @version 2.0-pre
  24. */
  25. public final class BookBoolRecord extends StandardRecord {
  26. public static final short sid = 0xDA;
  27. private short field_1_save_link_values;
  28. public BookBoolRecord() {}
  29. public BookBoolRecord(BookBoolRecord other) {
  30. super(other);
  31. field_1_save_link_values = other.field_1_save_link_values;
  32. }
  33. public BookBoolRecord(RecordInputStream in) {
  34. field_1_save_link_values = in.readShort();
  35. }
  36. /**
  37. * set the save ext links flag
  38. *
  39. * @param flag flag (0/1 -off/on)
  40. */
  41. public void setSaveLinkValues(short flag)
  42. {
  43. field_1_save_link_values = flag;
  44. }
  45. /**
  46. * get the save ext links flag
  47. *
  48. * @return short 0/1 (off/on)
  49. */
  50. public short getSaveLinkValues()
  51. {
  52. return field_1_save_link_values;
  53. }
  54. public void serialize(LittleEndianOutput out) {
  55. out.writeShort(field_1_save_link_values);
  56. }
  57. protected int getDataSize() {
  58. return 2;
  59. }
  60. public short getSid()
  61. {
  62. return sid;
  63. }
  64. @Override
  65. public BookBoolRecord copy() {
  66. return new BookBoolRecord(this);
  67. }
  68. @Override
  69. public HSSFRecordTypes getGenericRecordType() {
  70. return HSSFRecordTypes.BOOK_BOOL;
  71. }
  72. @Override
  73. public Map<String, Supplier<?>> getGenericProperties() {
  74. return GenericRecordUtil.getGenericProperties(
  75. "saveLinkValues", this::getSaveLinkValues
  76. );
  77. }
  78. }