您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

GrfhicAbstractType.java 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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.BitField;
  18. import org.apache.poi.util.Internal;
  19. /**
  20. * The grfhic structure is a set of HTML incompatibility flags that specify the HTML
  21. * incompatibilities of a list structure. The values specify possible incompatibilities between
  22. * an LVL or LVLF and HTML lists. The values do not define list properties.
  23. */
  24. @Internal
  25. public abstract class GrfhicAbstractType
  26. {
  27. protected byte field_1_grfhic;
  28. /**/private static final BitField fHtmlChecked = new BitField(0x01);
  29. /**/private static final BitField fHtmlUnsupported = new BitField(0x02);
  30. /**/private static final BitField fHtmlListTextNotSharpDot = new BitField(0x04);
  31. /**/private static final BitField fHtmlNotPeriod = new BitField(0x08);
  32. /**/private static final BitField fHtmlFirstLineMismatch = new BitField(0x10);
  33. /**/private static final BitField fHtmlTabLeftIndentMismatch = new BitField(0x20);
  34. /**/private static final BitField fHtmlHangingIndentBeneathNumber = new BitField(0x40);
  35. /**/private static final BitField fHtmlBuiltInBullet = new BitField(0x80);
  36. protected GrfhicAbstractType()
  37. {
  38. }
  39. protected void fillFields( byte[] data, int offset )
  40. {
  41. field_1_grfhic = data[ 0x0 + offset ];
  42. }
  43. public void serialize( byte[] data, int offset )
  44. {
  45. data[ 0x0 + offset ] = field_1_grfhic;
  46. }
  47. public byte[] serialize()
  48. {
  49. final byte[] result = new byte[ getSize() ];
  50. serialize( result, 0 );
  51. return result;
  52. }
  53. /**
  54. * Size of record
  55. */
  56. public static int getSize()
  57. {
  58. return 1;
  59. }
  60. @Override
  61. public boolean equals( Object obj )
  62. {
  63. if ( this == obj )
  64. return true;
  65. if ( obj == null )
  66. return false;
  67. if ( getClass() != obj.getClass() )
  68. return false;
  69. GrfhicAbstractType other = (GrfhicAbstractType) obj;
  70. return field_1_grfhic == other.field_1_grfhic;
  71. }
  72. @Override
  73. public int hashCode() {
  74. return Objects.hash(field_1_grfhic);
  75. }
  76. public String toString()
  77. {
  78. String builder = "[Grfhic]\n" +
  79. " .grfhic = " +
  80. " ( " + field_1_grfhic + " )\n" +
  81. " .fHtmlChecked = " + isFHtmlChecked() + '\n' +
  82. " .fHtmlUnsupported = " + isFHtmlUnsupported() + '\n' +
  83. " .fHtmlListTextNotSharpDot = " + isFHtmlListTextNotSharpDot() + '\n' +
  84. " .fHtmlNotPeriod = " + isFHtmlNotPeriod() + '\n' +
  85. " .fHtmlFirstLineMismatch = " + isFHtmlFirstLineMismatch() + '\n' +
  86. " .fHtmlTabLeftIndentMismatch = " + isFHtmlTabLeftIndentMismatch() + '\n' +
  87. " .fHtmlHangingIndentBeneathNumber = " + isFHtmlHangingIndentBeneathNumber() + '\n' +
  88. " .fHtmlBuiltInBullet = " + isFHtmlBuiltInBullet() + '\n' +
  89. "[/Grfhic]";
  90. return builder;
  91. }
  92. /**
  93. * HTML compatibility flags.
  94. */
  95. @Internal
  96. public byte getGrfhic()
  97. {
  98. return field_1_grfhic;
  99. }
  100. /**
  101. * HTML compatibility flags.
  102. */
  103. @Internal
  104. public void setGrfhic( byte field_1_grfhic )
  105. {
  106. this.field_1_grfhic = field_1_grfhic;
  107. }
  108. /**
  109. * Sets the fHtmlChecked field value.
  110. * Checked
  111. */
  112. @Internal
  113. public void setFHtmlChecked( boolean value )
  114. {
  115. field_1_grfhic = (byte)fHtmlChecked.setBoolean(field_1_grfhic, value);
  116. }
  117. /**
  118. * Checked
  119. * @return the fHtmlChecked field value.
  120. */
  121. @Internal
  122. public boolean isFHtmlChecked()
  123. {
  124. return fHtmlChecked.isSet(field_1_grfhic);
  125. }
  126. /**
  127. * Sets the fHtmlUnsupported field value.
  128. * The numbering sequence or format is unsupported (includes tab & size)
  129. */
  130. @Internal
  131. public void setFHtmlUnsupported( boolean value )
  132. {
  133. field_1_grfhic = (byte)fHtmlUnsupported.setBoolean(field_1_grfhic, value);
  134. }
  135. /**
  136. * The numbering sequence or format is unsupported (includes tab & size)
  137. * @return the fHtmlUnsupported field value.
  138. */
  139. @Internal
  140. public boolean isFHtmlUnsupported()
  141. {
  142. return fHtmlUnsupported.isSet(field_1_grfhic);
  143. }
  144. /**
  145. * Sets the fHtmlListTextNotSharpDot field value.
  146. * The list text is not "#."
  147. */
  148. @Internal
  149. public void setFHtmlListTextNotSharpDot( boolean value )
  150. {
  151. field_1_grfhic = (byte)fHtmlListTextNotSharpDot.setBoolean(field_1_grfhic, value);
  152. }
  153. /**
  154. * The list text is not "#."
  155. * @return the fHtmlListTextNotSharpDot field value.
  156. */
  157. @Internal
  158. public boolean isFHtmlListTextNotSharpDot()
  159. {
  160. return fHtmlListTextNotSharpDot.isSet(field_1_grfhic);
  161. }
  162. /**
  163. * Sets the fHtmlNotPeriod field value.
  164. * Something other than a period is used
  165. */
  166. @Internal
  167. public void setFHtmlNotPeriod( boolean value )
  168. {
  169. field_1_grfhic = (byte)fHtmlNotPeriod.setBoolean(field_1_grfhic, value);
  170. }
  171. /**
  172. * Something other than a period is used
  173. * @return the fHtmlNotPeriod field value.
  174. */
  175. @Internal
  176. public boolean isFHtmlNotPeriod()
  177. {
  178. return fHtmlNotPeriod.isSet(field_1_grfhic);
  179. }
  180. /**
  181. * Sets the fHtmlFirstLineMismatch field value.
  182. * First line indent mismatch
  183. */
  184. @Internal
  185. public void setFHtmlFirstLineMismatch( boolean value )
  186. {
  187. field_1_grfhic = (byte)fHtmlFirstLineMismatch.setBoolean(field_1_grfhic, value);
  188. }
  189. /**
  190. * First line indent mismatch
  191. * @return the fHtmlFirstLineMismatch field value.
  192. */
  193. @Internal
  194. public boolean isFHtmlFirstLineMismatch()
  195. {
  196. return fHtmlFirstLineMismatch.isSet(field_1_grfhic);
  197. }
  198. /**
  199. * Sets the fHtmlTabLeftIndentMismatch field value.
  200. * The list tab and the dxaLeft don't match (need table?)
  201. */
  202. @Internal
  203. public void setFHtmlTabLeftIndentMismatch( boolean value )
  204. {
  205. field_1_grfhic = (byte)fHtmlTabLeftIndentMismatch.setBoolean(field_1_grfhic, value);
  206. }
  207. /**
  208. * The list tab and the dxaLeft don't match (need table?)
  209. * @return the fHtmlTabLeftIndentMismatch field value.
  210. */
  211. @Internal
  212. public boolean isFHtmlTabLeftIndentMismatch()
  213. {
  214. return fHtmlTabLeftIndentMismatch.isSet(field_1_grfhic);
  215. }
  216. /**
  217. * Sets the fHtmlHangingIndentBeneathNumber field value.
  218. * The hanging indent falls beneath the number (need plain text)
  219. */
  220. @Internal
  221. public void setFHtmlHangingIndentBeneathNumber( boolean value )
  222. {
  223. field_1_grfhic = (byte)fHtmlHangingIndentBeneathNumber.setBoolean(field_1_grfhic, value);
  224. }
  225. /**
  226. * The hanging indent falls beneath the number (need plain text)
  227. * @return the fHtmlHangingIndentBeneathNumber field value.
  228. */
  229. @Internal
  230. public boolean isFHtmlHangingIndentBeneathNumber()
  231. {
  232. return fHtmlHangingIndentBeneathNumber.isSet(field_1_grfhic);
  233. }
  234. /**
  235. * Sets the fHtmlBuiltInBullet field value.
  236. * A built-in HTML bullet
  237. */
  238. @Internal
  239. public void setFHtmlBuiltInBullet( boolean value )
  240. {
  241. field_1_grfhic = (byte)fHtmlBuiltInBullet.setBoolean(field_1_grfhic, value);
  242. }
  243. /**
  244. * A built-in HTML bullet
  245. * @return the fHtmlBuiltInBullet field value.
  246. */
  247. @Internal
  248. public boolean isFHtmlBuiltInBullet()
  249. {
  250. return fHtmlBuiltInBullet.isSet(field_1_grfhic);
  251. }
  252. } // END OF CLASS