/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.sl.usermodel;
import java.awt.Color;
import org.apache.poi.common.usermodel.fonts.FontGroup;
import org.apache.poi.common.usermodel.fonts.FontInfo;
import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
import org.apache.poi.util.Internal;
Some text.
/**
* Some text.
*/
@SuppressWarnings("unused")
public interface TextRun {
Type of text capitals
/**
* Type of text capitals
*/
enum TextCap {
NONE,
SMALL,
ALL
}
Type of placeholder fields
/**
* Type of placeholder fields
*/
enum FieldType {
SLIDE_NUMBER, DATE_TIME
}
String getRawText();
void setText(String text);
TextCap getTextCap();
Returns the font color. This usually returns a SolidPaint
, but but also other classes are possible See Also: Returns: the font color/paint
/**
* Returns the font color.
* This usually returns a {@link SolidPaint}, but but also other classes are possible
*
* @return the font color/paint
*
* @see org.apache.poi.sl.draw.DrawPaint#getPaint(java.awt.Graphics2D, PaintStyle)
* @see SolidPaint#getSolidColor()
* @see org.apache.poi.sl.draw.DrawPaint#applyColorTransform(ColorStyle)
*/
PaintStyle getFontColor();
Sets the (solid) font color - convenience function
Params: - color – the color
/**
* Sets the (solid) font color - convenience function
*
* @param color the color
*/
void setFontColor(Color color);
Sets the font color
Params: - color – the color
See Also:
/**
* Sets the font color
*
* @param color the color
*
* @see org.apache.poi.sl.draw.DrawPaint#createSolidPaint(Color)
*/
void setFontColor(PaintStyle color);
Returns the font size which is either set directly on this text run or
given from the slide layout
Returns: font size in points or null if font size is not set.
/**
* Returns the font size which is either set directly on this text run or
* given from the slide layout
*
* @return font size in points or null if font size is not set.
*/
Double getFontSize();
Sets the font size directly on this text run, if null is given, the
font size defaults to the values given from the slide layout
Params: - fontSize – font size in points, if null the underlying fontsize will be unset
/**
* Sets the font size directly on this text run, if null is given, the
* font size defaults to the values given from the slide layout
*
* @param fontSize font size in points, if null the underlying fontsize will be unset
*/
void setFontSize(Double fontSize);
Get the font family - convenience method for getFontInfo(FontGroup)
Returns: font family or null if not set
/**
* Get the font family - convenience method for {@link #getFontInfo(FontGroup)}
*
* @return font family or null if not set
*/
String getFontFamily();
Get the font family - convenience method for getFontInfo(FontGroup)
Params: - fontGroup – the font group, i.e. the range of glpyhs to be covered. if
null
, the font group matching the first character will be returned
Returns: font family or null if not set
/**
* Get the font family - convenience method for {@link #getFontInfo(FontGroup)}
*
* @param fontGroup the font group, i.e. the range of glpyhs to be covered.
* if {@code null}, the font group matching the first character will be returned
*
* @return font family or null if not set
*/
String getFontFamily(FontGroup fontGroup);
Specifies the typeface, or name of the font that is to be used for this text run - convenience method for calling setFontInfo(FontInfo, FontGroup)
with just a font name Params: - typeface – the font to apply to this text run. The value of
null
removes the run specific font setting, so the default setting is activated again.
/**
* Specifies the typeface, or name of the font that is to be used for this text run -
* convenience method for calling {@link #setFontInfo(FontInfo, FontGroup)} with just a font name
*
* @param typeface the font to apply to this text run.
* The value of {@code null} removes the run specific font setting, so the default setting is activated again.
*/
void setFontFamily(String typeface);
Specifies the typeface, or name of the font that is to be used for this text run - convenience method for calling setFontInfo(FontInfo, FontGroup)
with just a font name Params: - typeface – the font to apply to this text run. The value of
null
removes the run specific font setting, so the default setting is activated again. - fontGroup – the font group, i.e. the range of glpyhs to be covered. if
null
, the font group matching the first character will be returned
/**
* Specifies the typeface, or name of the font that is to be used for this text run -
* convenience method for calling {@link #setFontInfo(FontInfo, FontGroup)} with just a font name
*
* @param typeface the font to apply to this text run.
* The value of {@code null} removes the run specific font setting, so the default setting is activated again.
* @param fontGroup the font group, i.e. the range of glpyhs to be covered.
* if {@code null}, the font group matching the first character will be returned
*/
void setFontFamily(String typeface, FontGroup fontGroup);
Get the font info for the given font group
Params: - fontGroup – the font group, i.e. the range of glpyhs to be covered. if
null
, the font group matching the first character will be returned
Returns: font info or null
if not set Since: POI 3.17-beta2
/**
* Get the font info for the given font group
*
* @param fontGroup the font group, i.e. the range of glpyhs to be covered.
* if {@code null}, the font group matching the first character will be returned
* @return font info or {@code null} if not set
*
* @since POI 3.17-beta2
*/
FontInfo getFontInfo(FontGroup fontGroup);
Specifies the font to be used for this text run.
Params: - fontInfo – the font to apply to this text run. The value of
null
removes the run specific font setting, so the default setting is activated again. - fontGroup – the font group, i.e. the range of glpyhs to be covered. defaults to latin, if
null
.
Since: POI 3.17-beta2
/**
* Specifies the font to be used for this text run.
*
* @param fontInfo the font to apply to this text run.
* The value of {@code null} removes the run specific font setting, so the default setting is activated again.
* @param fontGroup the font group, i.e. the range of glpyhs to be covered. defaults to latin, if {@code null}.
*
* @since POI 3.17-beta2
*/
void setFontInfo(FontInfo fontInfo, FontGroup fontGroup);
Returns: true, if text is bold
/**
* @return true, if text is bold
*/
boolean isBold();
Sets the bold state
Params: - bold – set to true for bold text, false for normal weight
/**
* Sets the bold state
*
* @param bold set to true for bold text, false for normal weight
*/
void setBold(boolean bold);
Returns: true, if text is italic
/**
* @return true, if text is italic
*/
boolean isItalic();
Sets the italic state
Params: - italic – set to true for italic text, false for non-italics
/**
* Sets the italic state
*
* @param italic set to true for italic text, false for non-italics
*/
void setItalic(boolean italic);
Returns: true, if text is underlined
/**
* @return true, if text is underlined
*/
boolean isUnderlined();
Sets the underlined state
Params: - underlined – set to true for underlined text, false for no underlining
/**
* Sets the underlined state
*
* @param underlined set to true for underlined text, false for no underlining
*/
void setUnderlined(boolean underlined);
Returns: true, if text is stroked
/**
* @return true, if text is stroked
*/
boolean isStrikethrough();
Sets the strikethrough state
Params: - stroked – set to true for stroked text, false for no stroking
/**
* Sets the strikethrough state
*
* @param stroked set to true for stroked text, false for no stroking
*/
void setStrikethrough(boolean stroked);
Returns: true, if text is sub scripted
/**
* @return true, if text is sub scripted
*/
boolean isSubscript();
Returns: true, if text is super scripted
/**
* @return true, if text is super scripted
*/
boolean isSuperscript();
Returns: the pitch and family id or -1 if not applicable
/**
* @return the pitch and family id or -1 if not applicable
*/
byte getPitchAndFamily();
Return the associated hyperlink
Returns: the associated hyperlink or null if no hyperlink was set Since: POI 3.14-Beta2
/**
* Return the associated hyperlink
*
* @return the associated hyperlink or null if no hyperlink was set
*
* @since POI 3.14-Beta2
*/
Hyperlink<?,?> getHyperlink();
Creates a new hyperlink and assigns it to this text run.
If the text run has already a hyperlink assigned, return it instead
Returns: the associated hyperlink Since: POI 3.14-Beta2
/**
* Creates a new hyperlink and assigns it to this text run.
* If the text run has already a hyperlink assigned, return it instead
*
* @return the associated hyperlink
*
* @since POI 3.14-Beta2
*/
Hyperlink<?,?> createHyperlink();
Experimental method to determine the field type, e.g. slide number
Returns: the field type or null
if text run is not a field
/**
* Experimental method to determine the field type, e.g. slide number
*
* @return the field type or {@code null} if text run is not a field
*/
@Internal
FieldType getFieldType();
Returns: the paragraph which contains this TextRun Since: POI 4.1.0
/**
* @return the paragraph which contains this TextRun
*
* @since POI 4.1.0
*/
TextParagraph<?,?,?> getParagraph();
}