PageRenderTime 60ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/src/org/apache/poi/hwpf/model/types/LFOAbstractType.java

https://github.com/minstrelsy/SimpleAndroidDocView
Java | 290 lines | 186 code | 28 blank | 76 comment | 26 complexity | a3fadc46038e7b7c16d48887b8abe6af MD5 | raw file
Possible License(s): Apache-2.0
  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.hwpf.model.Grfhic;
  17. import org.apache.poi.util.Internal;
  18. import org.apache.poi.util.LittleEndian;
  19. /**
  20. * List Format Override (LFO). <p>Class and fields descriptions are quoted from
  21. [MS-DOC] --v20110315; Word (.doc) Binary File Format
  22. * <p>
  23. * NOTE: This source is automatically generated please do not modify this file. Either subclass or
  24. * remove the record in src/types/definitions.
  25. * <p>
  26. * This class is internal. It content or properties may change without notice
  27. * due to changes in our knowledge of internal Microsoft Word binary structures.
  28. * @author Sergey Vladimirov; according to [MS-DOC] --v20110315; Word (.doc) Binary File Format;
  29. Copyright (c) Microsoft Corporation
  30. */
  31. @Internal
  32. public abstract class LFOAbstractType
  33. {
  34. protected int field_1_lsid;
  35. protected int field_2_unused1;
  36. protected int field_3_unused2;
  37. protected byte field_4_clfolvl;
  38. protected byte field_5_ibstFltAutoNum;
  39. protected Grfhic field_6_grfhic;
  40. protected byte field_7_unused3;
  41. protected LFOAbstractType()
  42. {
  43. this.field_6_grfhic = new Grfhic();
  44. }
  45. protected void fillFields( byte[] data, int offset )
  46. {
  47. field_1_lsid = LittleEndian.getInt( data, 0x0 + offset );
  48. field_2_unused1 = LittleEndian.getInt( data, 0x4 + offset );
  49. field_3_unused2 = LittleEndian.getInt( data, 0x8 + offset );
  50. field_4_clfolvl = data[ 0xc + offset ];
  51. field_5_ibstFltAutoNum = data[ 0xd + offset ];
  52. field_6_grfhic = new Grfhic( data, 0xe + offset );
  53. field_7_unused3 = data[ 0xf + offset ];
  54. }
  55. public void serialize( byte[] data, int offset )
  56. {
  57. LittleEndian.putInt( data, 0x0 + offset, field_1_lsid );
  58. LittleEndian.putInt( data, 0x4 + offset, field_2_unused1 );
  59. LittleEndian.putInt( data, 0x8 + offset, field_3_unused2 );
  60. data[ 0xc + offset ] = field_4_clfolvl;
  61. data[ 0xd + offset ] = field_5_ibstFltAutoNum;
  62. field_6_grfhic.serialize( data, 0xe + offset );
  63. data[ 0xf + offset ] = field_7_unused3;
  64. }
  65. public byte[] serialize()
  66. {
  67. final byte[] result = new byte[ getSize() ];
  68. serialize( result, 0 );
  69. return result;
  70. }
  71. /**
  72. * Size of record
  73. */
  74. public static int getSize()
  75. {
  76. return 0 + 4 + 4 + 4 + 1 + 1 + 1 + 1;
  77. }
  78. @Override
  79. public boolean equals( Object obj )
  80. {
  81. if ( this == obj )
  82. return true;
  83. if ( obj == null )
  84. return false;
  85. if ( getClass() != obj.getClass() )
  86. return false;
  87. LFOAbstractType other = (LFOAbstractType) obj;
  88. if ( field_1_lsid != other.field_1_lsid )
  89. return false;
  90. if ( field_2_unused1 != other.field_2_unused1 )
  91. return false;
  92. if ( field_3_unused2 != other.field_3_unused2 )
  93. return false;
  94. if ( field_4_clfolvl != other.field_4_clfolvl )
  95. return false;
  96. if ( field_5_ibstFltAutoNum != other.field_5_ibstFltAutoNum )
  97. return false;
  98. if ( field_6_grfhic == null )
  99. {
  100. if ( other.field_6_grfhic != null )
  101. return false;
  102. }
  103. else if ( !field_6_grfhic.equals( other.field_6_grfhic ) )
  104. return false;
  105. if ( field_7_unused3 != other.field_7_unused3 )
  106. return false;
  107. return true;
  108. }
  109. @Override
  110. public int hashCode()
  111. {
  112. final int prime = 31;
  113. int result = 1;
  114. result = prime * result + field_1_lsid;
  115. result = prime * result + field_2_unused1;
  116. result = prime * result + field_3_unused2;
  117. result = prime * result + field_4_clfolvl;
  118. result = prime * result + field_5_ibstFltAutoNum;
  119. result = prime * result
  120. + ((field_6_grfhic == null) ? 0 : field_6_grfhic.hashCode());
  121. result = prime * result + field_7_unused3;
  122. return result;
  123. }
  124. public String toString()
  125. {
  126. StringBuilder builder = new StringBuilder();
  127. builder.append("[LFO]\n");
  128. builder.append( " .lsid = " );
  129. builder.append(" ( ").append( field_1_lsid ).append( " )\n" );
  130. builder.append( " .unused1 = " );
  131. builder.append(" ( ").append( field_2_unused1 ).append( " )\n" );
  132. builder.append( " .unused2 = " );
  133. builder.append(" ( ").append( field_3_unused2 ).append( " )\n" );
  134. builder.append( " .clfolvl = " );
  135. builder.append(" ( ").append( field_4_clfolvl ).append( " )\n" );
  136. builder.append( " .ibstFltAutoNum = " );
  137. builder.append(" ( ").append( field_5_ibstFltAutoNum ).append( " )\n" );
  138. builder.append( " .grfhic = " );
  139. builder.append(" ( ").append( field_6_grfhic == null ? "null" : field_6_grfhic.toString().replaceAll( "\n", "\n " ) ).append( " )\n" );
  140. builder.append( " .unused3 = " );
  141. builder.append(" ( ").append( field_7_unused3 ).append( " )\n" );
  142. builder.append("[/LFO]");
  143. return builder.toString();
  144. }
  145. /**
  146. * A signed integer that specifies the list identifier of an LSTF. This LFO corresponds to the LSTF in PlfLst.rgLstf that has an lsid whose value is equal to this value..
  147. */
  148. @Internal
  149. public int getLsid()
  150. {
  151. return field_1_lsid;
  152. }
  153. /**
  154. * A signed integer that specifies the list identifier of an LSTF. This LFO corresponds to the LSTF in PlfLst.rgLstf that has an lsid whose value is equal to this value..
  155. */
  156. @Internal
  157. public void setLsid( int field_1_lsid )
  158. {
  159. this.field_1_lsid = field_1_lsid;
  160. }
  161. /**
  162. * This field MUST be ignored.
  163. */
  164. @Internal
  165. public int getUnused1()
  166. {
  167. return field_2_unused1;
  168. }
  169. /**
  170. * This field MUST be ignored.
  171. */
  172. @Internal
  173. public void setUnused1( int field_2_unused1 )
  174. {
  175. this.field_2_unused1 = field_2_unused1;
  176. }
  177. /**
  178. * This field MUST be ignored.
  179. */
  180. @Internal
  181. public int getUnused2()
  182. {
  183. return field_3_unused2;
  184. }
  185. /**
  186. * This field MUST be ignored.
  187. */
  188. @Internal
  189. public void setUnused2( int field_3_unused2 )
  190. {
  191. this.field_3_unused2 = field_3_unused2;
  192. }
  193. /**
  194. * An unsigned integer that specifies the field that this LFO represents..
  195. */
  196. @Internal
  197. public byte getClfolvl()
  198. {
  199. return field_4_clfolvl;
  200. }
  201. /**
  202. * An unsigned integer that specifies the field that this LFO represents..
  203. */
  204. @Internal
  205. public void setClfolvl( byte field_4_clfolvl )
  206. {
  207. this.field_4_clfolvl = field_4_clfolvl;
  208. }
  209. /**
  210. * Used for AUTONUM field emulation.
  211. */
  212. @Internal
  213. public byte getIbstFltAutoNum()
  214. {
  215. return field_5_ibstFltAutoNum;
  216. }
  217. /**
  218. * Used for AUTONUM field emulation.
  219. */
  220. @Internal
  221. public void setIbstFltAutoNum( byte field_5_ibstFltAutoNum )
  222. {
  223. this.field_5_ibstFltAutoNum = field_5_ibstFltAutoNum;
  224. }
  225. /**
  226. * HTML compatibility flags.
  227. */
  228. @Internal
  229. public Grfhic getGrfhic()
  230. {
  231. return field_6_grfhic;
  232. }
  233. /**
  234. * HTML compatibility flags.
  235. */
  236. @Internal
  237. public void setGrfhic( Grfhic field_6_grfhic )
  238. {
  239. this.field_6_grfhic = field_6_grfhic;
  240. }
  241. /**
  242. * This field MUST be ignored.
  243. */
  244. @Internal
  245. public byte getUnused3()
  246. {
  247. return field_7_unused3;
  248. }
  249. /**
  250. * This field MUST be ignored.
  251. */
  252. @Internal
  253. public void setUnused3( byte field_7_unused3 )
  254. {
  255. this.field_7_unused3 = field_7_unused3;
  256. }
  257. } // END OF CLASS