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.

BottomMarginRecord.java 2.5KB

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. * Record for the bottom margin.
  22. */
  23. public final class BottomMarginRecord extends StandardRecord implements Margin {
  24. public static final short sid = 0x29;
  25. private double field_1_margin;
  26. public BottomMarginRecord() {}
  27. public BottomMarginRecord(BottomMarginRecord other) {
  28. super(other);
  29. field_1_margin = other.field_1_margin;
  30. }
  31. public BottomMarginRecord( RecordInputStream in ) {
  32. field_1_margin = in.readDouble();
  33. }
  34. public void serialize(LittleEndianOutput out) {
  35. out.writeDouble(field_1_margin);
  36. }
  37. protected int getDataSize() {
  38. return 8;
  39. }
  40. public short getSid()
  41. {
  42. return sid;
  43. }
  44. /**
  45. * Get the margin field for the BottomMargin record.
  46. */
  47. public double getMargin()
  48. {
  49. return field_1_margin;
  50. }
  51. /**
  52. * Set the margin field for the BottomMargin record.
  53. */
  54. public void setMargin( double field_1_margin )
  55. {
  56. this.field_1_margin = field_1_margin;
  57. }
  58. @Override
  59. public BottomMarginRecord copy() {
  60. return new BottomMarginRecord(this);
  61. }
  62. @Override
  63. public HSSFRecordTypes getGenericRecordType() {
  64. return HSSFRecordTypes.BOTTOM_MARGIN;
  65. }
  66. @Override
  67. public Map<String, Supplier<?>> getGenericProperties() {
  68. return GenericRecordUtil.getGenericProperties(
  69. "margin", this::getMargin
  70. );
  71. }
  72. }