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.

LeftMarginRecord.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 left margin.
  22. */
  23. public final class LeftMarginRecord extends StandardRecord implements Margin {
  24. public static final short sid = 0x0026;
  25. private double field_1_margin;
  26. public LeftMarginRecord() {}
  27. public LeftMarginRecord(LeftMarginRecord other) {
  28. super(other);
  29. field_1_margin = other.field_1_margin;
  30. }
  31. public LeftMarginRecord(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. return sid;
  42. }
  43. /**
  44. * Get the margin field for the LeftMargin record.
  45. */
  46. public double getMargin() {
  47. return field_1_margin;
  48. }
  49. /**
  50. * Set the margin field for the LeftMargin record.
  51. */
  52. public void setMargin( double field_1_margin )
  53. {
  54. this.field_1_margin = field_1_margin;
  55. }
  56. @Override
  57. public LeftMarginRecord copy() {
  58. return new LeftMarginRecord(this);
  59. }
  60. @Override
  61. public HSSFRecordTypes getGenericRecordType() {
  62. return HSSFRecordTypes.LEFT_MARGIN;
  63. }
  64. @Override
  65. public Map<String, Supplier<?>> getGenericProperties() {
  66. return GenericRecordUtil.getGenericProperties("margin", this::getMargin);
  67. }
  68. }