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.

StdfPost2000AbstractType.java 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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.types;
  16. import org.apache.poi.util.BitField;
  17. import org.apache.poi.util.Internal;
  18. import org.apache.poi.util.LittleEndian;
  19. /**
  20. * The StdfPost2000 structure specifies general information about a style.
  21. */
  22. @Internal
  23. public abstract class StdfPost2000AbstractType
  24. {
  25. protected short field_1_info1;
  26. /**/private static final BitField istdLink = new BitField(0x0FFF);
  27. /**/private static final BitField fHasOriginalStyle = new BitField(0x1000);
  28. /**/private static final BitField fSpare = new BitField(0xE000);
  29. protected long field_2_rsid;
  30. protected short field_3_info3;
  31. /**/private static final BitField iftcHtml = new BitField(0x0007);
  32. /**/private static final BitField unused = new BitField(0x0008);
  33. /**/private static final BitField iPriority = new BitField(0xFFF0);
  34. protected StdfPost2000AbstractType()
  35. {
  36. }
  37. protected void fillFields( byte[] data, int offset )
  38. {
  39. field_1_info1 = LittleEndian.getShort(data, 0x0 + offset);
  40. field_2_rsid = LittleEndian.getUInt(data, 0x2 + offset);
  41. field_3_info3 = LittleEndian.getShort(data, 0x6 + offset);
  42. }
  43. public void serialize( byte[] data, int offset )
  44. {
  45. LittleEndian.putShort(data, 0x0 + offset, field_1_info1);
  46. LittleEndian.putUInt(data, 0x2 + offset, field_2_rsid);
  47. LittleEndian.putShort(data, 0x6 + offset, field_3_info3);
  48. }
  49. /**
  50. * Size of record
  51. */
  52. public static int getSize()
  53. {
  54. return 0 + 2 + 4 + 2;
  55. }
  56. public String toString()
  57. {
  58. StringBuilder builder = new StringBuilder();
  59. builder.append("[StdfPost2000]\n");
  60. builder.append(" .info1 = ");
  61. builder.append(" (").append(getInfo1()).append(" )\n");
  62. builder.append(" .istdLink = ").append(getIstdLink()).append('\n');
  63. builder.append(" .fHasOriginalStyle = ").append(isFHasOriginalStyle()).append('\n');
  64. builder.append(" .fSpare = ").append(getFSpare()).append('\n');
  65. builder.append(" .rsid = ");
  66. builder.append(" (").append(getRsid()).append(" )\n");
  67. builder.append(" .info3 = ");
  68. builder.append(" (").append(getInfo3()).append(" )\n");
  69. builder.append(" .iftcHtml = ").append(getIftcHtml()).append('\n');
  70. builder.append(" .unused = ").append(isUnused()).append('\n');
  71. builder.append(" .iPriority = ").append(getIPriority()).append('\n');
  72. builder.append("[/StdfPost2000]\n");
  73. return builder.toString();
  74. }
  75. /**
  76. * Get the info1 field for the StdfPost2000 record.
  77. */
  78. @Internal
  79. public short getInfo1()
  80. {
  81. return field_1_info1;
  82. }
  83. /**
  84. * Set the info1 field for the StdfPost2000 record.
  85. */
  86. @Internal
  87. public void setInfo1( short field_1_info1 )
  88. {
  89. this.field_1_info1 = field_1_info1;
  90. }
  91. /**
  92. * An unsigned integer that specifies the revision save identifier of the session when this style definition was last modified.
  93. */
  94. @Internal
  95. public long getRsid()
  96. {
  97. return field_2_rsid;
  98. }
  99. /**
  100. * An unsigned integer that specifies the revision save identifier of the session when this style definition was last modified.
  101. */
  102. @Internal
  103. public void setRsid( long field_2_rsid )
  104. {
  105. this.field_2_rsid = field_2_rsid;
  106. }
  107. /**
  108. * Get the info3 field for the StdfPost2000 record.
  109. */
  110. @Internal
  111. public short getInfo3()
  112. {
  113. return field_3_info3;
  114. }
  115. /**
  116. * Set the info3 field for the StdfPost2000 record.
  117. */
  118. @Internal
  119. public void setInfo3( short field_3_info3 )
  120. {
  121. this.field_3_info3 = field_3_info3;
  122. }
  123. /**
  124. * Sets the istdLink field value.
  125. * An unsigned integer that specifies the istd of the style that is linked to this one, or 0x0000 if this style is not linked to any other style in the document.
  126. */
  127. @Internal
  128. public void setIstdLink( short value )
  129. {
  130. field_1_info1 = (short)istdLink.setValue(field_1_info1, value);
  131. }
  132. /**
  133. * An unsigned integer that specifies the istd of the style that is linked to this one, or 0x0000 if this style is not linked to any other style in the document.
  134. * @return the istdLink field value.
  135. */
  136. @Internal
  137. public short getIstdLink()
  138. {
  139. return ( short )istdLink.getValue(field_1_info1);
  140. }
  141. /**
  142. * Sets the fHasOriginalStyle field value.
  143. * Specifies whether the style is revision-marked. A revision-marked style stores the pre-revision formatting in addition to the current formatting. If this bit is set to 1, the cupx member of StdfBase MUST include the formatting sets that specify that pre-revision formatting
  144. */
  145. @Internal
  146. public void setFHasOriginalStyle( boolean value )
  147. {
  148. field_1_info1 = (short)fHasOriginalStyle.setBoolean(field_1_info1, value);
  149. }
  150. /**
  151. * Specifies whether the style is revision-marked. A revision-marked style stores the pre-revision formatting in addition to the current formatting. If this bit is set to 1, the cupx member of StdfBase MUST include the formatting sets that specify that pre-revision formatting
  152. * @return the fHasOriginalStyle field value.
  153. */
  154. @Internal
  155. public boolean isFHasOriginalStyle()
  156. {
  157. return fHasOriginalStyle.isSet(field_1_info1);
  158. }
  159. /**
  160. * Sets the fSpare field value.
  161. * Specifies whether the paragraph height information in the fcPlcfPhe field of FibRgFcLcb97
  162. */
  163. @Internal
  164. public void setFSpare( byte value )
  165. {
  166. field_1_info1 = (short)fSpare.setValue(field_1_info1, value);
  167. }
  168. /**
  169. * Specifies whether the paragraph height information in the fcPlcfPhe field of FibRgFcLcb97
  170. * @return the fSpare field value.
  171. */
  172. @Internal
  173. public byte getFSpare()
  174. {
  175. return ( byte )fSpare.getValue(field_1_info1);
  176. }
  177. /**
  178. * Sets the iftcHtml field value.
  179. * This field is undefined and MUST be ignored
  180. */
  181. @Internal
  182. public void setIftcHtml( byte value )
  183. {
  184. field_3_info3 = (short)iftcHtml.setValue(field_3_info3, value);
  185. }
  186. /**
  187. * This field is undefined and MUST be ignored
  188. * @return the iftcHtml field value.
  189. */
  190. @Internal
  191. public byte getIftcHtml()
  192. {
  193. return ( byte )iftcHtml.getValue(field_3_info3);
  194. }
  195. /**
  196. * Sets the unused field value.
  197. * This value MUST be zero and MUST be ignored
  198. */
  199. @Internal
  200. public void setUnused( boolean value )
  201. {
  202. field_3_info3 = (short)unused.setBoolean(field_3_info3, value);
  203. }
  204. /**
  205. * This value MUST be zero and MUST be ignored
  206. * @return the unused field value.
  207. */
  208. @Internal
  209. public boolean isUnused()
  210. {
  211. return unused.isSet(field_3_info3);
  212. }
  213. /**
  214. * Sets the iPriority field value.
  215. * An unsigned integer that specifies the priority value that is assigned to this style and that is used when ordering the styles by priority in the user interface
  216. */
  217. @Internal
  218. public void setIPriority( short value )
  219. {
  220. field_3_info3 = (short)iPriority.setValue(field_3_info3, value);
  221. }
  222. /**
  223. * An unsigned integer that specifies the priority value that is assigned to this style and that is used when ordering the styles by priority in the user interface
  224. * @return the iPriority field value.
  225. */
  226. @Internal
  227. public short getIPriority()
  228. {
  229. return ( short )iPriority.getValue(field_3_info3);
  230. }
  231. } // END OF CLASS