Package com.lowagie.text.rtf.style
Class RtfParagraphStyle
java.lang.Object
com.lowagie.text.Font
com.lowagie.text.rtf.style.RtfFont
com.lowagie.text.rtf.style.RtfParagraphStyle
- All Implemented Interfaces:
RtfBasicElement,RtfExtendedElement,Comparable
The RtfParagraphStyle stores all style/formatting attributes of a RtfParagraph.
Additionally it also supports the style name system available in RTF. The RtfParagraphStyle
is a Font and can thus be used as such. To use the stylesheet functionality
it needs to be set as the font of a Paragraph. Otherwise it will work like a
RtfFont. It also supports inheritance of styles.
- Version:
- $Id: RtfParagraphStyle.java 3580 2008-08-06 15:52:00Z howard_s $
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte[]Constant for center alignmentstatic final byte[]Constant for justified alignmentstatic final byte[]Constant for left alignmentstatic final byte[]Constant for right alignmentprivate intThe alignment of the paragraph.private StringThe name of the RtfParagraphStyle this RtfParagraphStyle is based on.private RtfParagraphStyleThe RtfParagraphStyle this RtfParagraphStyle is based on.static final byte[]Constant for the first line indentationprivate intThe indentation for the first linestatic final byte[]Constant for left indentationstatic final byte[]Constant for right indentationprivate intThe left indentation of the paragraph.private intThe right indentation of the paragraph.static final byte[]Constant for keeping the paragraph together on one pagestatic final byte[]Constant for keeping the paragraph together with the next one on one pageprivate booleanWhether this RtfParagraph must stay on one page.private booleanWhether this RtfParagraph must stay on the same page as the next paragraph.private intThe line leading of the paragraph.private intWhich properties have been modified when compared to the base style.private static final intThe alignment has been modified.private static final intThe font color has been modified.private static final intThe font name has been modified.private static final intThe font style has been modified.private static final intThe font size has been modified.private static final intThe left indentation has been modified.private static final intThe right indentation has been modified.private static final intThe paragraph keep together setting has been modified.private static final intThe paragraph keep together with next setting has been modified.private static final intThe line leading has been modified.private static final intNo modification has taken place when compared to the RtfParagraphStyle this RtfParagraphStyle is based on.private static final intThe spacing after a paragraph has been modified.private static final intThe spacing before a paragraph has been modified.static final byte[]Constant for the space after the paragraph.static final byte[]Constant for the space before the paragraph.private intThe spacing after a paragraph.private intThe spacing before a paragraph.static final RtfParagraphStyleThe style for level 1 headings.static final RtfParagraphStyleThe style for level 2 headings.static final RtfParagraphStyleThe style for level 3 headings.static final RtfParagraphStyleThe NORMAL/STANDARD style.private final StringThe name of this RtfParagraphStyle.private intThe number of this RtfParagraphStyle in the stylesheet list.Fields inherited from class com.lowagie.text.rtf.style.RtfFont
DEFAULT_FONT, document, FONT_SIZE, STYLE_BOLD, STYLE_DOUBLE_STRIKETHROUGH, STYLE_EMBOSSED, STYLE_ENGRAVED, STYLE_HIDDEN, STYLE_ITALIC, STYLE_NONE, STYLE_OUTLINE, STYLE_SHADOW, STYLE_STRIKETHROUGH, STYLE_UNDERLINEFields inherited from class com.lowagie.text.Font
BOLD, BOLDITALIC, COURIER, DEFAULTSIZE, HELVETICA, ITALIC, NORMAL, STRIKETHRU, SYMBOL, TIMES_ROMAN, UNDEFINED, UNDERLINE, ZAPFDINGBATSFields inherited from interface com.lowagie.text.rtf.RtfBasicElement
CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR -
Constructor Summary
ConstructorsConstructorDescriptionRtfParagraphStyle(RtfDocument doc, RtfParagraphStyle style) Constructs a RtfParagraphStyle from another RtfParagraphStyle.RtfParagraphStyle(String styleName, String basedOnName) Constructs a new RtfParagraphStyle that is based on an existing RtfParagraphStyle.RtfParagraphStyle(String styleName, String fontName, int fontSize, int fontStyle, Color fontColor) Constructs a new RtfParagraphStyle with the given attributes. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests whether two RtfParagraphStyles are equal.intGets the alignment of this RtfParagraphStyle.Gets the name of the RtfParagraphStyle this RtfParagraphStyle is based on.intGets the first line indentation of this RtfParagraphStyle.intGets the left indentation of this RtfParagraphStyle.intGets the right indentation of this RtfParagraphStyle.booleanGets whether the lines in the paragraph should be kept together in this RtfParagraphStyle.booleanGets whether the paragraph should be kept together with the next in this RtfParagraphStyle.intGets the line leading of this RtfParagraphStyle.intGets the space after the paragraph of this RtfParagraphStyle.intGets the space before the paragraph of this RtfParagraphStyle..Gets the name of this RtfParagraphStyle.private intGets the number of this RtfParagraphStyle in the stylesheet list.voidHandles the inheritance of paragraph style settings.inthashCode()Gets the hash code of this RtfParagraphStyle.voidsetAlignment(int alignment) Sets the alignment of this RtfParagraphStyle.voidSets the color of this RtfParagraphStyle.voidsetFirstLineIndent(int firstLineIndent) Sets the first line indentation of this RtfParagraphStyle.voidsetFontName(String fontName) Sets the font name of this RtfParagraphStyle.voidsetIndentLeft(int indentLeft) Sets the left indentation of this RtfParagraphStyle.voidsetIndentRight(int indentRight) Sets the right indentation of this RtfParagraphStyle.voidsetKeepTogether(boolean keepTogether) Sets whether the lines in the paragraph should be kept together in this RtfParagraphStyle.voidsetKeepTogetherWithNext(boolean keepTogetherWithNext) Sets whether the paragraph should be kept together with the next in this RtfParagraphStyle.voidsetLineLeading(int lineLeading) Sets the line leading of this RtfParagraphStyle.voidsetSize(float fontSize) Sets the font size of this RtfParagraphStyle.voidsetSpacingAfter(int spacingAfter) Sets the space after the paragraph of this RtfParagraphStyle.voidsetSpacingBefore(int spacingBefore) Sets the space before the paragraph of this RtfParagraphStyle.voidsetStyle(int fontStyle) Sets the font style of this RtfParagraphStyle.protected voidsetStyleNumber(int styleNumber) Sets the number of this RtfParagraphStyle in the stylesheet list.voidwriteBegin(OutputStream result) Writes the start information of this RtfParagraphStyle.voidwriteContent(OutputStream out) unusedvoidwriteDefinition(OutputStream result) Writes the definition of this RtfParagraphStyle for the stylesheet list.voidwriteEnd(OutputStream result) Unusedprivate voidwriteParagraphSettings(OutputStream result) Writes the settings of this RtfParagraphStyle.Methods inherited from class com.lowagie.text.rtf.style.RtfFont
compareTo, difference, getCharset, getFamilyname, getFontName, getFontNumber, getFontSize, getFontStyle, intToByteArray, isStandardFont, setCharset, setColor, setFamily, setInHeader, setInTable, setRtfDocument, setStyleMethods inherited from class com.lowagie.text.Font
getBaseFont, getBaseFontStyle, getCalculatedBaseFont, getCalculatedLeading, getCalculatedSize, getCalculatedStyle, getColor, getCombinedStyle, getFamily, getFamilyIndex, getFontStyleFromName, getSize, getStyle, getStyleValue, isBold, isItalic, isStrikethru, isUnderlined
-
Field Details
-
ALIGN_LEFT
public static final byte[] ALIGN_LEFTConstant for left alignment -
ALIGN_RIGHT
public static final byte[] ALIGN_RIGHTConstant for right alignment -
ALIGN_CENTER
public static final byte[] ALIGN_CENTERConstant for center alignment -
ALIGN_JUSTIFY
public static final byte[] ALIGN_JUSTIFYConstant for justified alignment -
FIRST_LINE_INDENT
public static final byte[] FIRST_LINE_INDENTConstant for the first line indentation -
INDENT_LEFT
public static final byte[] INDENT_LEFTConstant for left indentation -
INDENT_RIGHT
public static final byte[] INDENT_RIGHTConstant for right indentation -
KEEP_TOGETHER
public static final byte[] KEEP_TOGETHERConstant for keeping the paragraph together on one page -
KEEP_TOGETHER_WITH_NEXT
public static final byte[] KEEP_TOGETHER_WITH_NEXTConstant for keeping the paragraph together with the next one on one page -
SPACING_AFTER
public static final byte[] SPACING_AFTERConstant for the space after the paragraph. -
SPACING_BEFORE
public static final byte[] SPACING_BEFOREConstant for the space before the paragraph. -
STYLE_NORMAL
The NORMAL/STANDARD style. -
STYLE_HEADING_1
The style for level 1 headings. -
STYLE_HEADING_2
The style for level 2 headings. -
STYLE_HEADING_3
The style for level 3 headings. -
MODIFIED_NONE
private static final int MODIFIED_NONENo modification has taken place when compared to the RtfParagraphStyle this RtfParagraphStyle is based on. These modification markers are used to determine what needs to be inherited and what not from the parent RtfParagraphStyle.- See Also:
-
MODIFIED_ALIGNMENT
private static final int MODIFIED_ALIGNMENTThe alignment has been modified.- See Also:
-
MODIFIED_INDENT_LEFT
private static final int MODIFIED_INDENT_LEFTThe left indentation has been modified.- See Also:
-
MODIFIED_INDENT_RIGHT
private static final int MODIFIED_INDENT_RIGHTThe right indentation has been modified.- See Also:
-
MODIFIED_SPACING_BEFORE
private static final int MODIFIED_SPACING_BEFOREThe spacing before a paragraph has been modified.- See Also:
-
MODIFIED_SPACING_AFTER
private static final int MODIFIED_SPACING_AFTERThe spacing after a paragraph has been modified.- See Also:
-
MODIFIED_FONT_NAME
private static final int MODIFIED_FONT_NAMEThe font name has been modified.- See Also:
-
MODIFIED_FONT_SIZE
private static final int MODIFIED_FONT_SIZEThe font style has been modified.- See Also:
-
MODIFIED_FONT_STYLE
private static final int MODIFIED_FONT_STYLEThe font size has been modified.- See Also:
-
MODIFIED_FONT_COLOR
private static final int MODIFIED_FONT_COLORThe font color has been modified.- See Also:
-
MODIFIED_LINE_LEADING
private static final int MODIFIED_LINE_LEADINGThe line leading has been modified.- See Also:
-
MODIFIED_KEEP_TOGETHER
private static final int MODIFIED_KEEP_TOGETHERThe paragraph keep together setting has been modified.- See Also:
-
MODIFIED_KEEP_TOGETHER_WITH_NEXT
private static final int MODIFIED_KEEP_TOGETHER_WITH_NEXTThe paragraph keep together with next setting has been modified.- See Also:
-
alignment
private int alignmentThe alignment of the paragraph. -
firstLineIndent
private int firstLineIndentThe indentation for the first line -
indentLeft
private int indentLeftThe left indentation of the paragraph. -
indentRight
private int indentRightThe right indentation of the paragraph. -
spacingBefore
private int spacingBeforeThe spacing before a paragraph. -
spacingAfter
private int spacingAfterThe spacing after a paragraph. -
lineLeading
private int lineLeadingThe line leading of the paragraph. -
keepTogether
private boolean keepTogetherWhether this RtfParagraph must stay on one page. -
keepTogetherWithNext
private boolean keepTogetherWithNextWhether this RtfParagraph must stay on the same page as the next paragraph. -
styleName
The name of this RtfParagraphStyle. -
basedOnName
The name of the RtfParagraphStyle this RtfParagraphStyle is based on. -
baseStyle
The RtfParagraphStyle this RtfParagraphStyle is based on. -
modified
private int modifiedWhich properties have been modified when compared to the base style. -
styleNumber
private int styleNumberThe number of this RtfParagraphStyle in the stylesheet list.
-
-
Constructor Details
-
RtfParagraphStyle
public RtfParagraphStyle(String styleName, String fontName, int fontSize, int fontStyle, Color fontColor) Constructs a new RtfParagraphStyle with the given attributes.- Parameters:
styleName- The name of this RtfParagraphStyle.fontName- The name of the font to use for this RtfParagraphStyle.fontSize- The size of the font to use for this RtfParagraphStyle.fontStyle- The style of the font to use for this RtfParagraphStyle.fontColor- The color of the font to use for this RtfParagraphStyle.
-
RtfParagraphStyle
Constructs a new RtfParagraphStyle that is based on an existing RtfParagraphStyle.- Parameters:
styleName- The name of this RtfParagraphStyle.basedOnName- The name of the RtfParagraphStyle this RtfParagraphStyle is based on.
-
RtfParagraphStyle
Constructs a RtfParagraphStyle from another RtfParagraphStyle. INTERNAL USE ONLY- Parameters:
doc- The RtfDocument this RtfParagraphStyle belongs to.style- The RtfParagraphStyle to copy settings from.
-
-
Method Details
-
getStyleName
Gets the name of this RtfParagraphStyle.- Returns:
- The name of this RtfParagraphStyle.
-
getBasedOnName
Gets the name of the RtfParagraphStyle this RtfParagraphStyle is based on.- Returns:
- The name of the base RtfParagraphStyle.
-
getAlignment
public int getAlignment()Gets the alignment of this RtfParagraphStyle.- Returns:
- The alignment of this RtfParagraphStyle.
-
setAlignment
public void setAlignment(int alignment) Sets the alignment of this RtfParagraphStyle.- Parameters:
alignment- The alignment to use.
-
getFirstLineIndent
public int getFirstLineIndent()Gets the first line indentation of this RtfParagraphStyle.- Returns:
- The first line indentation of this RtfParagraphStyle.
-
setFirstLineIndent
public void setFirstLineIndent(int firstLineIndent) Sets the first line indentation of this RtfParagraphStyle. It is relative to the left indentation.- Parameters:
firstLineIndent- The first line indentation to use.
-
getIndentLeft
public int getIndentLeft()Gets the left indentation of this RtfParagraphStyle.- Returns:
- The left indentation of this RtfParagraphStyle.
-
setIndentLeft
public void setIndentLeft(int indentLeft) Sets the left indentation of this RtfParagraphStyle.- Parameters:
indentLeft- The left indentation to use.
-
getIndentRight
public int getIndentRight()Gets the right indentation of this RtfParagraphStyle.- Returns:
- The right indentation of this RtfParagraphStyle.
-
setIndentRight
public void setIndentRight(int indentRight) Sets the right indentation of this RtfParagraphStyle.- Parameters:
indentRight- The right indentation to use.
-
getSpacingBefore
public int getSpacingBefore()Gets the space before the paragraph of this RtfParagraphStyle..- Returns:
- The space before the paragraph.
-
setSpacingBefore
public void setSpacingBefore(int spacingBefore) Sets the space before the paragraph of this RtfParagraphStyle.- Parameters:
spacingBefore- The space before to use.
-
getSpacingAfter
public int getSpacingAfter()Gets the space after the paragraph of this RtfParagraphStyle.- Returns:
- The space after the paragraph.
-
setSpacingAfter
public void setSpacingAfter(int spacingAfter) Sets the space after the paragraph of this RtfParagraphStyle.- Parameters:
spacingAfter- The space after to use.
-
setFontName
Sets the font name of this RtfParagraphStyle.- Overrides:
setFontNamein classRtfFont- Parameters:
fontName- The font name to use
-
setSize
public void setSize(float fontSize) Sets the font size of this RtfParagraphStyle. -
setStyle
public void setStyle(int fontStyle) Sets the font style of this RtfParagraphStyle. -
setColor
Sets the color of this RtfParagraphStyle. -
getLineLeading
public int getLineLeading()Gets the line leading of this RtfParagraphStyle.- Returns:
- The line leading of this RtfParagraphStyle.
-
setLineLeading
public void setLineLeading(int lineLeading) Sets the line leading of this RtfParagraphStyle.- Parameters:
lineLeading- The line leading to use.
-
getKeepTogether
public boolean getKeepTogether()Gets whether the lines in the paragraph should be kept together in this RtfParagraphStyle.- Returns:
- Whether the lines in the paragraph should be kept together.
-
setKeepTogether
public void setKeepTogether(boolean keepTogether) Sets whether the lines in the paragraph should be kept together in this RtfParagraphStyle.- Parameters:
keepTogether- Whether the lines in the paragraph should be kept together.
-
getKeepTogetherWithNext
public boolean getKeepTogetherWithNext()Gets whether the paragraph should be kept together with the next in this RtfParagraphStyle.- Returns:
- Whether the paragraph should be kept together with the next.
-
setKeepTogetherWithNext
public void setKeepTogetherWithNext(boolean keepTogetherWithNext) Sets whether the paragraph should be kept together with the next in this RtfParagraphStyle.- Parameters:
keepTogetherWithNext- Whether the paragraph should be kept together with the next.
-
handleInheritance
public void handleInheritance()Handles the inheritance of paragraph style settings. All settings that have not been modified will be inherited from the base RtfParagraphStyle. If this RtfParagraphStyle is not based on another one, then nothing happens. -
writeParagraphSettings
Writes the settings of this RtfParagraphStyle.- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException- On i/o errors.
-
writeDefinition
Writes the definition of this RtfParagraphStyle for the stylesheet list.- Specified by:
writeDefinitionin interfaceRtfExtendedElement- Overrides:
writeDefinitionin classRtfFont- Parameters:
result- TheOutputStreamto write the element definition to- Throws:
IOException
-
writeBegin
Writes the start information of this RtfParagraphStyle.- Overrides:
writeBeginin classRtfFont- Parameters:
result- TheOutputStreamto write to.- Throws:
IOException- On i/o errors.
-
writeEnd
Unused- Overrides:
writeEndin classRtfFont- Parameters:
result- TheOutputStreamthat nothing is written to- Throws:
IOException- On i/o errors.
-
writeContent
unused- Specified by:
writeContentin interfaceRtfBasicElement- Overrides:
writeContentin classRtfFont- Parameters:
out- TheOutputStreamto write the content to- Throws:
IOException
-
equals
Tests whether two RtfParagraphStyles are equal. Equality is determined via the name. -
hashCode
public int hashCode()Gets the hash code of this RtfParagraphStyle. -
getStyleNumber
private int getStyleNumber()Gets the number of this RtfParagraphStyle in the stylesheet list.- Returns:
- The number of this RtfParagraphStyle in the stylesheet list.
-
setStyleNumber
protected void setStyleNumber(int styleNumber) Sets the number of this RtfParagraphStyle in the stylesheet list.- Parameters:
styleNumber- The number to use.
-