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.

AutoFilterInfoRecord.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. * The AutoFilterInfo record specifies the number of columns that have AutoFilter enabled
  22. * and indicates the beginning of the collection of AutoFilter records.
  23. */
  24. public final class AutoFilterInfoRecord extends StandardRecord {
  25. public static final short sid = 0x9D;
  26. /**
  27. * Number of AutoFilter drop-down arrows on the sheet
  28. */
  29. private short _cEntries;
  30. public AutoFilterInfoRecord() {}
  31. public AutoFilterInfoRecord(AutoFilterInfoRecord other) {
  32. super(other);
  33. _cEntries = other._cEntries;
  34. }
  35. public AutoFilterInfoRecord(RecordInputStream in) {
  36. _cEntries = in.readShort();
  37. }
  38. /**
  39. * set the number of AutoFilter drop-down arrows on the sheet
  40. *
  41. * @param num the number of AutoFilter drop-down arrows on the sheet
  42. */
  43. public void setNumEntries(short num)
  44. {
  45. _cEntries = num;
  46. }
  47. /**
  48. * get the number of AutoFilter drop-down arrows on the sheet
  49. *
  50. * @return the number of AutoFilter drop-down arrows on the sheet
  51. */
  52. public short getNumEntries()
  53. {
  54. return _cEntries;
  55. }
  56. public void serialize(LittleEndianOutput out) {
  57. out.writeShort(_cEntries);
  58. }
  59. protected int getDataSize() {
  60. return 2;
  61. }
  62. public short getSid()
  63. {
  64. return sid;
  65. }
  66. @Override
  67. public AutoFilterInfoRecord copy() {
  68. return new AutoFilterInfoRecord(this);
  69. }
  70. @Override
  71. public HSSFRecordTypes getGenericRecordType() {
  72. return HSSFRecordTypes.AUTO_FILTER_INFO;
  73. }
  74. @Override
  75. public Map<String, Supplier<?>> getGenericProperties() {
  76. return GenericRecordUtil.getGenericProperties(
  77. "numEntries", this::getNumEntries
  78. );
  79. }
  80. }