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.

HideObjRecord.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. * Flag defines whether to hide placeholders and object
  22. *
  23. * @version 2.0-pre
  24. */
  25. public final class HideObjRecord extends StandardRecord {
  26. public static final short sid = 0x8d;
  27. public static final short HIDE_ALL = 2;
  28. public static final short SHOW_PLACEHOLDERS = 1;
  29. public static final short SHOW_ALL = 0;
  30. private short field_1_hide_obj;
  31. public HideObjRecord() {}
  32. public HideObjRecord(HideObjRecord other) {
  33. super(other);
  34. field_1_hide_obj = other.field_1_hide_obj;
  35. }
  36. public HideObjRecord(RecordInputStream in) {
  37. field_1_hide_obj = in.readShort();
  38. }
  39. /**
  40. * set hide object options
  41. *
  42. * @param hide options
  43. * @see #HIDE_ALL
  44. * @see #SHOW_PLACEHOLDERS
  45. * @see #SHOW_ALL
  46. */
  47. public void setHideObj(short hide)
  48. {
  49. field_1_hide_obj = hide;
  50. }
  51. /**
  52. * get hide object options
  53. *
  54. * @return hide options
  55. * @see #HIDE_ALL
  56. * @see #SHOW_PLACEHOLDERS
  57. * @see #SHOW_ALL
  58. */
  59. public short getHideObj()
  60. {
  61. return field_1_hide_obj;
  62. }
  63. public void serialize(LittleEndianOutput out) {
  64. out.writeShort(getHideObj());
  65. }
  66. protected int getDataSize() {
  67. return 2;
  68. }
  69. public short getSid()
  70. {
  71. return sid;
  72. }
  73. @Override
  74. public HideObjRecord copy() {
  75. return new HideObjRecord(this);
  76. }
  77. @Override
  78. public HSSFRecordTypes getGenericRecordType() {
  79. return HSSFRecordTypes.HIDE_OBJ;
  80. }
  81. @Override
  82. public Map<String, Supplier<?>> getGenericProperties() {
  83. return GenericRecordUtil.getGenericProperties("hideObj", this::getHideObj);
  84. }
  85. }