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.

FontFormatting.java 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*
  2. * ====================================================================
  3. * Licensed to the Apache Software Foundation (ASF) under one or more
  4. * contributor license agreements. See the NOTICE file distributed with
  5. * this work for additional information regarding copyright ownership.
  6. * The ASF licenses this file to You under the Apache License, Version 2.0
  7. * (the "License"); you may not use this file except in compliance with
  8. * the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. * ====================================================================
  18. */
  19. package org.apache.poi.ss.usermodel;
  20. import org.apache.poi.util.Removal;
  21. /**
  22. * High level representation for Font Formatting component
  23. * of Conditional Formatting settings
  24. */
  25. public interface FontFormatting {
  26. // TODO: refactor and unify Font & FontFormatting in POI 5.0.0
  27. /**
  28. * Escapement type - None
  29. *
  30. * @deprecated use {@link Font#SS_NONE} instead
  31. */
  32. @Deprecated
  33. @Removal(version = "5.0.0")
  34. short SS_NONE = 0;
  35. /**
  36. * Escapement type - Superscript
  37. *
  38. * @deprecated use {@link Font#SS_SUPER} instead
  39. */
  40. @Deprecated
  41. @Removal(version = "5.0.0")
  42. short SS_SUPER = 1;
  43. /**
  44. * Escapement type - Subscript
  45. *
  46. * @deprecated use {@link Font#SS_SUB} instead
  47. */
  48. @Deprecated
  49. @Removal(version = "5.0.0")
  50. short SS_SUB = 2;
  51. /**
  52. * Underline type - None
  53. *
  54. * @deprecated use {@link Font#U_NONE} instead
  55. */
  56. @Deprecated
  57. @Removal(version = "5.0.0")
  58. byte U_NONE = 0;
  59. /**
  60. * Underline type - Single
  61. *
  62. * @deprecated use {@link Font#U_SINGLE} instead
  63. */
  64. @Deprecated
  65. @Removal(version = "5.0.0")
  66. byte U_SINGLE = 1;
  67. /**
  68. * Underline type - Double
  69. *
  70. * @deprecated use {@link Font#U_DOUBLE} instead
  71. */
  72. @Deprecated
  73. @Removal(version = "5.0.0")
  74. byte U_DOUBLE = 2;
  75. /**
  76. * Underline type - Single Accounting
  77. *
  78. * @deprecated use {@link Font#U_SINGLE_ACCOUNTING} instead
  79. */
  80. @Deprecated
  81. @Removal(version = "5.0.0")
  82. byte U_SINGLE_ACCOUNTING = 0x21;
  83. /**
  84. * Underline type - Double Accounting
  85. *
  86. * @deprecated use {@link Font#U_DOUBLE_ACCOUNTING} instead
  87. */
  88. @Deprecated
  89. @Removal(version = "5.0.0")
  90. byte U_DOUBLE_ACCOUNTING = 0x22;
  91. /**
  92. * get the type of super or subscript for the font
  93. *
  94. * @return super or subscript option
  95. * @see Font#SS_NONE
  96. * @see Font#SS_SUPER
  97. * @see Font#SS_SUB
  98. */
  99. short getEscapementType();
  100. /**
  101. * set the escapement type for the font
  102. *
  103. * @param escapementType super or subscript option
  104. * @see Font#SS_NONE
  105. * @see Font#SS_SUPER
  106. * @see Font#SS_SUB
  107. */
  108. void setEscapementType(short escapementType);
  109. /**
  110. * @return font colour index, or 0 if not indexed (XSSF only)
  111. */
  112. short getFontColorIndex();
  113. /**
  114. * Sets the indexed colour to use
  115. * @param color font colour index
  116. */
  117. void setFontColorIndex(short color);
  118. /**
  119. * @return The colour of the font, or null if no colour applied
  120. */
  121. Color getFontColor();
  122. /**
  123. * Sets the colour to use
  124. * @param color font colour to use
  125. */
  126. void setFontColor(Color color);
  127. /**
  128. * gets the height of the font in 1/20th point units
  129. *
  130. * @return fontheight (in points/20); or -1 if not modified
  131. */
  132. int getFontHeight();
  133. /**
  134. * Sets the height of the font in 1/20th point units
  135. *
  136. * @param height the height in twips (in points/20)
  137. */
  138. void setFontHeight(int height);
  139. /**
  140. * get the type of underlining for the font
  141. *
  142. * @return font underlining type
  143. *
  144. * @see Font#U_NONE
  145. * @see Font#U_SINGLE
  146. * @see Font#U_DOUBLE
  147. * @see Font#U_SINGLE_ACCOUNTING
  148. * @see Font#U_DOUBLE_ACCOUNTING
  149. */
  150. short getUnderlineType();
  151. /**
  152. * set the type of underlining type for the font
  153. *
  154. * @param underlineType super or subscript option
  155. *
  156. * @see Font#U_NONE
  157. * @see Font#U_SINGLE
  158. * @see Font#U_DOUBLE
  159. * @see Font#U_SINGLE_ACCOUNTING
  160. * @see Font#U_DOUBLE_ACCOUNTING
  161. */
  162. void setUnderlineType(short underlineType);
  163. /**
  164. * get whether the font weight is set to bold or not
  165. *
  166. * @return bold - whether the font is bold or not
  167. */
  168. boolean isBold();
  169. /**
  170. * @return true if font style was set to <i>italic</i>
  171. */
  172. boolean isItalic();
  173. /**
  174. * @return true if font strikeout is on
  175. */
  176. boolean isStruckout();
  177. /**
  178. * set font style options.
  179. *
  180. * @param italic - if true, set posture style to italic, otherwise to normal
  181. * @param bold if true, set font weight to bold, otherwise to normal
  182. */
  183. void setFontStyle(boolean italic, boolean bold);
  184. /**
  185. * set font style options to default values (non-italic, non-bold)
  186. */
  187. void resetFontStyle();
  188. }