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.

TextRun.java 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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.sl.usermodel;
  16. import java.awt.Color;
  17. import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
  18. /**
  19. * Some text.
  20. */
  21. public interface TextRun {
  22. enum TextCap {
  23. NONE,
  24. SMALL,
  25. ALL
  26. }
  27. String getRawText();
  28. void setText(String text);
  29. TextCap getTextCap();
  30. /**
  31. * Returns the font color.
  32. * This usually returns a {@link SolidPaint}, but but also other classes are possible
  33. *
  34. * @return the font color/paint
  35. *
  36. * @see org.apache.poi.sl.draw.DrawPaint#getPaint(java.awt.Graphics2D, PaintStyle)
  37. * @see SolidPaint#getSolidColor()
  38. * @see org.apache.poi.sl.draw.DrawPaint#applyColorTransform(ColorStyle)
  39. */
  40. PaintStyle getFontColor();
  41. /**
  42. * Sets the (solid) font color - convenience function
  43. *
  44. * @param color the color
  45. */
  46. void setFontColor(Color color);
  47. /**
  48. * Sets the font color
  49. *
  50. * @param color the color
  51. *
  52. * @see org.apache.poi.sl.draw.DrawPaint#createSolidPaint(Color)
  53. */
  54. void setFontColor(PaintStyle color);
  55. /**
  56. * Returns the font size which is either set directly on this text run or
  57. * given from the slide layout
  58. *
  59. * @return font size in points or null if font size is not set.
  60. */
  61. Double getFontSize();
  62. /**
  63. * Sets the font size directly on this text run, if null is given, the
  64. * font size defaults to the values given from the slide layout
  65. *
  66. * @param fontSize font size in points, if null the underlying fontsize will be unset
  67. */
  68. void setFontSize(Double fontSize);
  69. /**
  70. * @return font family or null if not set
  71. */
  72. String getFontFamily();
  73. /**
  74. * Specifies the typeface, or name of the font that is to be used for this text run.
  75. *
  76. * @param typeface the font to apply to this text run.
  77. * The value of <code>null</code> unsets the Typeface attrubute from the underlying xml.
  78. */
  79. void setFontFamily(String typeface);
  80. /**
  81. * @return true, if text is bold
  82. */
  83. boolean isBold();
  84. /**
  85. * Sets the bold state
  86. *
  87. * @param bold set to true for bold text, false for normal weight
  88. */
  89. void setBold(boolean bold);
  90. /**
  91. * @return true, if text is italic
  92. */
  93. boolean isItalic();
  94. /**
  95. * Sets the italic state
  96. *
  97. * @param italic set to true for italic text, false for non-italics
  98. */
  99. void setItalic(boolean italic);
  100. /**
  101. * @return true, if text is underlined
  102. */
  103. boolean isUnderlined();
  104. /**
  105. * Sets the underlined state
  106. *
  107. * @param underlined set to true for underlined text, false for no underlining
  108. */
  109. void setUnderlined(boolean underlined);
  110. /**
  111. * @return true, if text is stroked
  112. */
  113. boolean isStrikethrough();
  114. /**
  115. * Sets the strikethrough state
  116. *
  117. * @param stroked set to true for stroked text, false for no stroking
  118. */
  119. void setStrikethrough(boolean stroked);
  120. /**
  121. * @return true, if text is sub scripted
  122. */
  123. boolean isSubscript();
  124. /**
  125. * @return true, if text is super scripted
  126. */
  127. boolean isSuperscript();
  128. /**
  129. * @return the pitch and family id or -1 if not applicable
  130. */
  131. byte getPitchAndFamily();
  132. /**
  133. * Return the associated hyperlink
  134. *
  135. * @return the associated hyperlink or null if no hyperlink was set
  136. */
  137. Hyperlink getHyperlink();
  138. }