Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

SaveRecalcRecord.java 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. * Defines whether to recalculate before saving (set to true)
  22. *
  23. * @version 2.0-pre
  24. */
  25. public final class SaveRecalcRecord extends StandardRecord {
  26. public static final short sid = 0x5f;
  27. private short field_1_recalc;
  28. public SaveRecalcRecord() {
  29. }
  30. public SaveRecalcRecord(SaveRecalcRecord other) {
  31. super(other);
  32. field_1_recalc = other.field_1_recalc;
  33. }
  34. public SaveRecalcRecord(RecordInputStream in) {
  35. field_1_recalc = in.readShort();
  36. }
  37. /**
  38. * set whether to recalculate formulas/etc before saving or not
  39. *
  40. * @param recalc - whether to recalculate or not
  41. */
  42. public void setRecalc(boolean recalc) {
  43. field_1_recalc = (short) (recalc ? 1 : 0);
  44. }
  45. /**
  46. * get whether to recalculate formulas/etc before saving or not
  47. *
  48. * @return recalc - whether to recalculate or not
  49. */
  50. public boolean getRecalc() {
  51. return (field_1_recalc == 1);
  52. }
  53. public void serialize(LittleEndianOutput out) {
  54. out.writeShort(field_1_recalc);
  55. }
  56. protected int getDataSize() {
  57. return 2;
  58. }
  59. public short getSid() {
  60. return sid;
  61. }
  62. @Override
  63. public SaveRecalcRecord copy() {
  64. return new SaveRecalcRecord(this);
  65. }
  66. @Override
  67. public HSSFRecordTypes getGenericRecordType() {
  68. return HSSFRecordTypes.SAVE_RECALC;
  69. }
  70. @Override
  71. public Map<String, Supplier<?>> getGenericProperties() {
  72. return GenericRecordUtil.getGenericProperties("recalc", this::getRecalc);
  73. }
  74. }