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.

FibRgLw97.java 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.hwpf.model;
  16. import org.apache.poi.hwpf.model.types.FibRgLw97AbstractType;
  17. import org.apache.poi.util.Internal;
  18. /**
  19. * The FibRgLw97 structure is the third section of the FIB. This contains an
  20. * array of 4-byte values.
  21. * <p>
  22. * Class and fields descriptions are quoted from Microsoft Office Word 97-2007
  23. * Binary File Format and [MS-DOC] - v20110608 Word (.doc) Binary File Format
  24. */
  25. @Internal
  26. public class FibRgLw97 extends FibRgLw97AbstractType implements FibRgLw
  27. {
  28. public FibRgLw97()
  29. {
  30. }
  31. public FibRgLw97( byte[] std, int offset )
  32. {
  33. fillFields( std, offset );
  34. }
  35. @SuppressWarnings( "deprecation" )
  36. public int getSubdocumentTextStreamLength( SubdocumentType subdocumentType )
  37. {
  38. switch ( subdocumentType )
  39. {
  40. case MAIN:
  41. return getCcpText();
  42. case FOOTNOTE:
  43. return getCcpFtn();
  44. case HEADER:
  45. return getCcpHdd();
  46. case MACRO:
  47. return field_7_reserved3;
  48. case ANNOTATION:
  49. return getCcpAtn();
  50. case ENDNOTE:
  51. return getCcpEdn();
  52. case TEXTBOX:
  53. return getCcpTxbx();
  54. case HEADER_TEXTBOX:
  55. return getCcpHdrTxbx();
  56. }
  57. throw new UnsupportedOperationException( "Unsupported: "
  58. + subdocumentType );
  59. }
  60. @SuppressWarnings( "deprecation" )
  61. public void setSubdocumentTextStreamLength(
  62. SubdocumentType subdocumentType, int newLength )
  63. {
  64. switch ( subdocumentType )
  65. {
  66. case MAIN:
  67. setCcpText( newLength );
  68. return;
  69. case FOOTNOTE:
  70. setCcpFtn( newLength );
  71. return;
  72. case HEADER:
  73. setCcpHdd( newLength );
  74. return;
  75. case MACRO:
  76. field_7_reserved3 = newLength;
  77. return;
  78. case ANNOTATION:
  79. setCcpAtn( newLength );
  80. return;
  81. case ENDNOTE:
  82. setCcpEdn( newLength );
  83. return;
  84. case TEXTBOX:
  85. setCcpTxbx( newLength );
  86. return;
  87. case HEADER_TEXTBOX:
  88. setCcpHdrTxbx( newLength );
  89. return;
  90. }
  91. throw new UnsupportedOperationException( "Unsupported: "
  92. + subdocumentType );
  93. }
  94. }