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.

ChartStartBlockRecord.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.chart;
  16. import org.apache.poi.hssf.record.RecordInputStream;
  17. import org.apache.poi.hssf.record.StandardRecord;
  18. import org.apache.poi.util.HexDump;
  19. import org.apache.poi.util.LittleEndianOutput;
  20. /**
  21. * STARTBLOCK - Chart Future Record Type Start Block (0x0852)<br/>
  22. *
  23. * @author Patrick Cheng
  24. */
  25. public final class ChartStartBlockRecord extends StandardRecord {
  26. public static final short sid = 0x0852;
  27. private short rt;
  28. private short grbitFrt;
  29. private short iObjectKind;
  30. private short iObjectContext;
  31. private short iObjectInstance1;
  32. private short iObjectInstance2;
  33. public ChartStartBlockRecord() {
  34. }
  35. public ChartStartBlockRecord(RecordInputStream in) {
  36. rt = in.readShort();
  37. grbitFrt = in.readShort();
  38. iObjectKind = in.readShort();
  39. iObjectContext = in.readShort();
  40. iObjectInstance1 = in.readShort();
  41. iObjectInstance2 = in.readShort();
  42. }
  43. @Override
  44. protected int getDataSize() {
  45. return 2 + 2 + 2 + 2 + 2 + 2;
  46. }
  47. @Override
  48. public short getSid() {
  49. return sid;
  50. }
  51. @Override
  52. public void serialize(LittleEndianOutput out) {
  53. out.writeShort(rt);
  54. out.writeShort(grbitFrt);
  55. out.writeShort(iObjectKind);
  56. out.writeShort(iObjectContext);
  57. out.writeShort(iObjectInstance1);
  58. out.writeShort(iObjectInstance2);
  59. }
  60. public String toString() {
  61. StringBuffer buffer = new StringBuffer();
  62. buffer.append("[STARTBLOCK]\n");
  63. buffer.append(" .rt =").append(HexDump.shortToHex(rt)).append('\n');
  64. buffer.append(" .grbitFrt =").append(HexDump.shortToHex(grbitFrt)).append('\n');
  65. buffer.append(" .iObjectKind =").append(HexDump.shortToHex(iObjectKind)).append('\n');
  66. buffer.append(" .iObjectContext =").append(HexDump.shortToHex(iObjectContext)).append('\n');
  67. buffer.append(" .iObjectInstance1=").append(HexDump.shortToHex(iObjectInstance1)).append('\n');
  68. buffer.append(" .iObjectInstance2=").append(HexDump.shortToHex(iObjectInstance2)).append('\n');
  69. buffer.append("[/STARTBLOCK]\n");
  70. return buffer.toString();
  71. }
  72. @Override
  73. public ChartStartBlockRecord clone() {
  74. ChartStartBlockRecord record = new ChartStartBlockRecord();
  75. record.rt = rt;
  76. record.grbitFrt = grbitFrt;
  77. record.iObjectKind = iObjectKind;
  78. record.iObjectContext = iObjectContext;
  79. record.iObjectInstance1 = iObjectInstance1;
  80. record.iObjectInstance2 = iObjectInstance2;
  81. return record;
  82. }
  83. }