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.

VBAInfoContainer.java 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.hslf.record;
  16. import java.io.IOException;
  17. import java.io.OutputStream;
  18. import org.apache.poi.util.LittleEndian;
  19. /**
  20. * A container record that specifies VBA information for the document.
  21. */
  22. public final class VBAInfoContainer extends RecordContainer {
  23. private byte[] _header;
  24. private static long _type = RecordTypes.VBAInfo.typeID;
  25. // Links to our more interesting children
  26. /**
  27. * Set things up, and find our more interesting children
  28. */
  29. protected VBAInfoContainer(byte[] source, int start, int len) {
  30. // Grab the header
  31. _header = new byte[8];
  32. System.arraycopy(source, start, _header, 0, 8);
  33. // Find our children
  34. _children = Record.findChildRecords(source, start + 8, len - 8);
  35. findInterestingChildren();
  36. }
  37. /**
  38. * Go through our child records, picking out the ones that are
  39. * interesting, and saving those for use by the easy helper
  40. * methods.
  41. */
  42. private void findInterestingChildren() {
  43. }
  44. /**
  45. * Create a new VBAInfoContainer, with blank fields - not yet supported
  46. */
  47. private VBAInfoContainer() {
  48. _header = new byte[8];
  49. _children = new Record[0];
  50. // Setup our header block
  51. _header[0] = 0x0f; // We are a container record
  52. LittleEndian.putShort(_header, 2, (short) _type);
  53. // Setup our child records
  54. findInterestingChildren();
  55. }
  56. /**
  57. * We are of type 0x3FF
  58. */
  59. public long getRecordType() {
  60. return _type;
  61. }
  62. /**
  63. * Write the contents of the record back, so it can be written
  64. * to disk
  65. */
  66. public void writeOut(OutputStream out) throws IOException {
  67. writeOut(_header[0], _header[1], _type, _children, out);
  68. }
  69. }