Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. * Refers to a string in the shared string table and is a column value.
  22. */
  23. public final class LabelSSTRecord extends CellRecord {
  24. public static final short sid = 0xfd;
  25. private int field_4_sst_index;
  26. public LabelSSTRecord() {}
  27. public LabelSSTRecord(LabelSSTRecord other) {
  28. super(other);
  29. field_4_sst_index = other.field_4_sst_index;
  30. }
  31. public LabelSSTRecord(RecordInputStream in) {
  32. super(in);
  33. field_4_sst_index = in.readInt();
  34. }
  35. /**
  36. * set the index to the string in the SSTRecord
  37. *
  38. * @param index - of string in the SST Table
  39. * @see org.apache.poi.hssf.record.SSTRecord
  40. */
  41. public void setSSTIndex(int index) {
  42. field_4_sst_index = index;
  43. }
  44. /**
  45. * get the index to the string in the SSTRecord
  46. *
  47. * @return index of string in the SST Table
  48. * @see org.apache.poi.hssf.record.SSTRecord
  49. */
  50. public int getSSTIndex() {
  51. return field_4_sst_index;
  52. }
  53. @Override
  54. protected String getRecordName() {
  55. return "LABELSST";
  56. }
  57. @Override
  58. protected void serializeValue(LittleEndianOutput out) {
  59. out.writeInt(getSSTIndex());
  60. }
  61. @Override
  62. protected int getValueDataSize() {
  63. return 4;
  64. }
  65. @Override
  66. public short getSid() {
  67. return sid;
  68. }
  69. @Override
  70. public LabelSSTRecord copy() {
  71. return new LabelSSTRecord(this);
  72. }
  73. @Override
  74. public HSSFRecordTypes getGenericRecordType() {
  75. return HSSFRecordTypes.LABEL_SST;
  76. }
  77. @Override
  78. public Map<String, Supplier<?>> getGenericProperties() {
  79. return GenericRecordUtil.getGenericProperties(
  80. "base", super::getGenericProperties,
  81. "sstIndex", this::getSSTIndex
  82. );
  83. }
  84. }