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.

FibRgLw95AbstractType.java 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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 java.util.Objects;
  17. import org.apache.poi.util.Internal;
  18. import org.apache.poi.util.LittleEndian;
  19. /**
  20. * The FibRgLw95 structure is the third section of the FIB for Word95.
  21. */
  22. @Internal
  23. public abstract class FibRgLw95AbstractType
  24. {
  25. protected int field_1_cbMac;
  26. @Deprecated
  27. protected int field_2_reserved1;
  28. @Deprecated
  29. protected int field_3_reserved2;
  30. @Deprecated
  31. protected int field_4_reserved3;
  32. @Deprecated
  33. protected int field_5_reserved4;
  34. protected int field_6_ccpText;
  35. protected int field_7_ccpFtn;
  36. protected int field_8_ccpHdd;
  37. protected int field_9_ccpMcr;
  38. protected int field_10_ccpAtn;
  39. protected int field_11_ccpEdn;
  40. protected int field_12_ccpTxbx;
  41. protected int field_13_ccpHdrTxbx;
  42. @Deprecated
  43. protected int field_14_reserved5;
  44. protected FibRgLw95AbstractType()
  45. {
  46. }
  47. protected void fillFields( byte[] data, int offset )
  48. {
  49. field_1_cbMac = LittleEndian.getInt( data, 0x0 + offset );
  50. field_2_reserved1 = LittleEndian.getInt( data, 0x4 + offset );
  51. field_3_reserved2 = LittleEndian.getInt( data, 0x8 + offset );
  52. field_4_reserved3 = LittleEndian.getInt( data, 0xc + offset );
  53. field_5_reserved4 = LittleEndian.getInt( data, 0x10 + offset );
  54. field_6_ccpText = LittleEndian.getInt( data, 0x14 + offset );
  55. field_7_ccpFtn = LittleEndian.getInt( data, 0x18 + offset );
  56. field_8_ccpHdd = LittleEndian.getInt( data, 0x1c + offset );
  57. field_9_ccpMcr = LittleEndian.getInt( data, 0x20 + offset );
  58. field_10_ccpAtn = LittleEndian.getInt( data, 0x24 + offset );
  59. field_11_ccpEdn = LittleEndian.getInt( data, 0x28 + offset );
  60. field_12_ccpTxbx = LittleEndian.getInt( data, 0x2c + offset );
  61. field_13_ccpHdrTxbx = LittleEndian.getInt( data, 0x30 + offset );
  62. field_14_reserved5 = LittleEndian.getInt( data, 0x34 + offset );
  63. }
  64. public void serialize( byte[] data, int offset )
  65. {
  66. LittleEndian.putInt( data, 0x0 + offset, field_1_cbMac );
  67. LittleEndian.putInt( data, 0x4 + offset, field_2_reserved1 );
  68. LittleEndian.putInt( data, 0x8 + offset, field_3_reserved2 );
  69. LittleEndian.putInt( data, 0xc + offset, field_4_reserved3 );
  70. LittleEndian.putInt( data, 0x10 + offset, field_5_reserved4 );
  71. LittleEndian.putInt( data, 0x14 + offset, field_6_ccpText );
  72. LittleEndian.putInt( data, 0x18 + offset, field_7_ccpFtn );
  73. LittleEndian.putInt( data, 0x1c + offset, field_8_ccpHdd );
  74. LittleEndian.putInt( data, 0x20 + offset, field_9_ccpMcr );
  75. LittleEndian.putInt( data, 0x24 + offset, field_10_ccpAtn );
  76. LittleEndian.putInt( data, 0x28 + offset, field_11_ccpEdn );
  77. LittleEndian.putInt( data, 0x2c + offset, field_12_ccpTxbx );
  78. LittleEndian.putInt( data, 0x30 + offset, field_13_ccpHdrTxbx );
  79. LittleEndian.putInt( data, 0x34 + offset, field_14_reserved5 );
  80. }
  81. public byte[] serialize()
  82. {
  83. final byte[] result = new byte[ getSize() ];
  84. serialize( result, 0 );
  85. return result;
  86. }
  87. /**
  88. * Size of record
  89. */
  90. public static int getSize()
  91. {
  92. return 0 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
  93. }
  94. @Override
  95. public boolean equals( Object obj )
  96. {
  97. if ( this == obj )
  98. return true;
  99. if ( obj == null )
  100. return false;
  101. if ( getClass() != obj.getClass() )
  102. return false;
  103. FibRgLw95AbstractType other = (FibRgLw95AbstractType) obj;
  104. if ( field_1_cbMac != other.field_1_cbMac )
  105. return false;
  106. if ( field_2_reserved1 != other.field_2_reserved1 )
  107. return false;
  108. if ( field_3_reserved2 != other.field_3_reserved2 )
  109. return false;
  110. if ( field_4_reserved3 != other.field_4_reserved3 )
  111. return false;
  112. if ( field_5_reserved4 != other.field_5_reserved4 )
  113. return false;
  114. if ( field_6_ccpText != other.field_6_ccpText )
  115. return false;
  116. if ( field_7_ccpFtn != other.field_7_ccpFtn )
  117. return false;
  118. if ( field_8_ccpHdd != other.field_8_ccpHdd )
  119. return false;
  120. if ( field_9_ccpMcr != other.field_9_ccpMcr )
  121. return false;
  122. if ( field_10_ccpAtn != other.field_10_ccpAtn )
  123. return false;
  124. if ( field_11_ccpEdn != other.field_11_ccpEdn )
  125. return false;
  126. if ( field_12_ccpTxbx != other.field_12_ccpTxbx )
  127. return false;
  128. if ( field_13_ccpHdrTxbx != other.field_13_ccpHdrTxbx )
  129. return false;
  130. if ( field_14_reserved5 != other.field_14_reserved5 )
  131. return false;
  132. return true;
  133. }
  134. @Override
  135. public int hashCode() {
  136. return Objects.hash(field_1_cbMac, field_2_reserved1, field_3_reserved2, field_4_reserved3, field_5_reserved4,
  137. field_6_ccpText, field_7_ccpFtn, field_8_ccpHdd, field_9_ccpMcr, field_10_ccpAtn, field_11_ccpEdn,
  138. field_12_ccpTxbx, field_13_ccpHdrTxbx, field_14_reserved5);
  139. }
  140. public String toString()
  141. {
  142. StringBuilder builder = new StringBuilder();
  143. builder.append("[FibRgLw95]\n");
  144. builder.append(" .cbMac = ");
  145. builder.append(" (").append(getCbMac()).append(" )\n");
  146. builder.append(" .reserved1 = ");
  147. builder.append(" (").append(getReserved1()).append(" )\n");
  148. builder.append(" .reserved2 = ");
  149. builder.append(" (").append(getReserved2()).append(" )\n");
  150. builder.append(" .reserved3 = ");
  151. builder.append(" (").append(getReserved3()).append(" )\n");
  152. builder.append(" .reserved4 = ");
  153. builder.append(" (").append(getReserved4()).append(" )\n");
  154. builder.append(" .ccpText = ");
  155. builder.append(" (").append(getCcpText()).append(" )\n");
  156. builder.append(" .ccpFtn = ");
  157. builder.append(" (").append(getCcpFtn()).append(" )\n");
  158. builder.append(" .ccpHdd = ");
  159. builder.append(" (").append(getCcpHdd()).append(" )\n");
  160. builder.append(" .ccpMcr = ");
  161. builder.append(" (").append(getCcpMcr()).append(" )\n");
  162. builder.append(" .ccpAtn = ");
  163. builder.append(" (").append(getCcpAtn()).append(" )\n");
  164. builder.append(" .ccpEdn = ");
  165. builder.append(" (").append(getCcpEdn()).append(" )\n");
  166. builder.append(" .ccpTxbx = ");
  167. builder.append(" (").append(getCcpTxbx()).append(" )\n");
  168. builder.append(" .ccpHdrTxbx = ");
  169. builder.append(" (").append(getCcpHdrTxbx()).append(" )\n");
  170. builder.append(" .reserved5 = ");
  171. builder.append(" (").append(getReserved5()).append(" )\n");
  172. builder.append("[/FibRgLw95]\n");
  173. return builder.toString();
  174. }
  175. /**
  176. * Get the cbMac field for the FibRgLw95 record.
  177. */
  178. @Internal
  179. public int getCbMac()
  180. {
  181. return field_1_cbMac;
  182. }
  183. /**
  184. * Set the cbMac field for the FibRgLw95 record.
  185. */
  186. @Internal
  187. public void setCbMac( int field_1_cbMac )
  188. {
  189. this.field_1_cbMac = field_1_cbMac;
  190. }
  191. /**
  192. * Get the reserved1 field for the FibRgLw95 record.
  193. */
  194. @Internal
  195. public int getReserved1()
  196. {
  197. return field_2_reserved1;
  198. }
  199. /**
  200. * Set the reserved1 field for the FibRgLw95 record.
  201. */
  202. @Internal
  203. public void setReserved1( int field_2_reserved1 )
  204. {
  205. this.field_2_reserved1 = field_2_reserved1;
  206. }
  207. /**
  208. * Get the reserved2 field for the FibRgLw95 record.
  209. */
  210. @Internal
  211. public int getReserved2()
  212. {
  213. return field_3_reserved2;
  214. }
  215. /**
  216. * Set the reserved2 field for the FibRgLw95 record.
  217. */
  218. @Internal
  219. public void setReserved2( int field_3_reserved2 )
  220. {
  221. this.field_3_reserved2 = field_3_reserved2;
  222. }
  223. /**
  224. * Get the reserved3 field for the FibRgLw95 record.
  225. */
  226. @Internal
  227. public int getReserved3()
  228. {
  229. return field_4_reserved3;
  230. }
  231. /**
  232. * Set the reserved3 field for the FibRgLw95 record.
  233. */
  234. @Internal
  235. public void setReserved3( int field_4_reserved3 )
  236. {
  237. this.field_4_reserved3 = field_4_reserved3;
  238. }
  239. /**
  240. * Get the reserved4 field for the FibRgLw95 record.
  241. */
  242. @Internal
  243. public int getReserved4()
  244. {
  245. return field_5_reserved4;
  246. }
  247. /**
  248. * Set the reserved4 field for the FibRgLw95 record.
  249. */
  250. @Internal
  251. public void setReserved4( int field_5_reserved4 )
  252. {
  253. this.field_5_reserved4 = field_5_reserved4;
  254. }
  255. /**
  256. * Get the ccpText field for the FibRgLw95 record.
  257. */
  258. @Internal
  259. public int getCcpText()
  260. {
  261. return field_6_ccpText;
  262. }
  263. /**
  264. * Set the ccpText field for the FibRgLw95 record.
  265. */
  266. @Internal
  267. public void setCcpText( int field_6_ccpText )
  268. {
  269. this.field_6_ccpText = field_6_ccpText;
  270. }
  271. /**
  272. * Get the ccpFtn field for the FibRgLw95 record.
  273. */
  274. @Internal
  275. public int getCcpFtn()
  276. {
  277. return field_7_ccpFtn;
  278. }
  279. /**
  280. * Set the ccpFtn field for the FibRgLw95 record.
  281. */
  282. @Internal
  283. public void setCcpFtn( int field_7_ccpFtn )
  284. {
  285. this.field_7_ccpFtn = field_7_ccpFtn;
  286. }
  287. /**
  288. * Get the ccpHdd field for the FibRgLw95 record.
  289. */
  290. @Internal
  291. public int getCcpHdd()
  292. {
  293. return field_8_ccpHdd;
  294. }
  295. /**
  296. * Set the ccpHdd field for the FibRgLw95 record.
  297. */
  298. @Internal
  299. public void setCcpHdd( int field_8_ccpHdd )
  300. {
  301. this.field_8_ccpHdd = field_8_ccpHdd;
  302. }
  303. /**
  304. * Get the ccpMcr field for the FibRgLw95 record.
  305. */
  306. @Internal
  307. public int getCcpMcr()
  308. {
  309. return field_9_ccpMcr;
  310. }
  311. /**
  312. * Set the ccpMcr field for the FibRgLw95 record.
  313. */
  314. @Internal
  315. public void setCcpMcr( int field_9_ccpMcr )
  316. {
  317. this.field_9_ccpMcr = field_9_ccpMcr;
  318. }
  319. /**
  320. * Get the ccpAtn field for the FibRgLw95 record.
  321. */
  322. @Internal
  323. public int getCcpAtn()
  324. {
  325. return field_10_ccpAtn;
  326. }
  327. /**
  328. * Set the ccpAtn field for the FibRgLw95 record.
  329. */
  330. @Internal
  331. public void setCcpAtn( int field_10_ccpAtn )
  332. {
  333. this.field_10_ccpAtn = field_10_ccpAtn;
  334. }
  335. /**
  336. * Get the ccpEdn field for the FibRgLw95 record.
  337. */
  338. @Internal
  339. public int getCcpEdn()
  340. {
  341. return field_11_ccpEdn;
  342. }
  343. /**
  344. * Set the ccpEdn field for the FibRgLw95 record.
  345. */
  346. @Internal
  347. public void setCcpEdn( int field_11_ccpEdn )
  348. {
  349. this.field_11_ccpEdn = field_11_ccpEdn;
  350. }
  351. /**
  352. * Get the ccpTxbx field for the FibRgLw95 record.
  353. */
  354. @Internal
  355. public int getCcpTxbx()
  356. {
  357. return field_12_ccpTxbx;
  358. }
  359. /**
  360. * Set the ccpTxbx field for the FibRgLw95 record.
  361. */
  362. @Internal
  363. public void setCcpTxbx( int field_12_ccpTxbx )
  364. {
  365. this.field_12_ccpTxbx = field_12_ccpTxbx;
  366. }
  367. /**
  368. * Get the ccpHdrTxbx field for the FibRgLw95 record.
  369. */
  370. @Internal
  371. public int getCcpHdrTxbx()
  372. {
  373. return field_13_ccpHdrTxbx;
  374. }
  375. /**
  376. * Set the ccpHdrTxbx field for the FibRgLw95 record.
  377. */
  378. @Internal
  379. public void setCcpHdrTxbx( int field_13_ccpHdrTxbx )
  380. {
  381. this.field_13_ccpHdrTxbx = field_13_ccpHdrTxbx;
  382. }
  383. /**
  384. * Get the reserved5 field for the FibRgLw95 record.
  385. */
  386. @Internal
  387. public int getReserved5()
  388. {
  389. return field_14_reserved5;
  390. }
  391. /**
  392. * Set the reserved5 field for the FibRgLw95 record.
  393. */
  394. @Internal
  395. public void setReserved5( int field_14_reserved5 )
  396. {
  397. this.field_14_reserved5 = field_14_reserved5;
  398. }
  399. } // END OF CLASS