Constructor: |
public RtfParagraphStyle(String styleName,
String basedOnName) {
super(null, new Font());
this.styleName = styleName;
this.basedOnName = basedOnName;
}
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.
|
public RtfParagraphStyle(RtfDocument doc,
RtfParagraphStyle style) {
super(doc, style);
this.document = doc;
this.styleName = style.getStyleName();
this.alignment = style.getAlignment();
this.firstLineIndent = (int)(style.getFirstLineIndent() * RtfBasicElement.TWIPS_FACTOR);
this.indentLeft = (int) (style.getIndentLeft() * RtfBasicElement.TWIPS_FACTOR);
this.indentRight = (int) (style.getIndentRight() * RtfBasicElement.TWIPS_FACTOR);
this.spacingBefore = (int) (style.getSpacingBefore() * RtfBasicElement.TWIPS_FACTOR);
this.spacingAfter = (int) (style.getSpacingAfter() * RtfBasicElement.TWIPS_FACTOR);
this.lineLeading = (int) (style.getLineLeading() * RtfBasicElement.TWIPS_FACTOR);
this.keepTogether = style.getKeepTogether();
this.keepTogetherWithNext = style.getKeepTogetherWithNext();
this.basedOnName = style.basedOnName;
this.modified = style.modified;
this.styleNumber = style.getStyleNumber();
if(this.document != null) {
setRtfDocument(this.document);
}
}
Constructs a RtfParagraphStyle from another RtfParagraphStyle.
INTERNAL USE ONLY Parameters:
doc - The RtfDocument this RtfParagraphStyle belongs to.
style - The RtfParagraphStyle to copy settings from.
|
public RtfParagraphStyle(String styleName,
String fontName,
int fontSize,
int fontStyle,
Color fontColor) {
super(null, new RtfFont(fontName, fontSize, fontStyle, fontColor));
this.styleName = styleName;
}
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.
|
Method from com.lowagie.text.rtf.style.RtfParagraphStyle Detail: |
public boolean equals(Object o) {
if(!(o instanceof RtfParagraphStyle)) {
return false;
}
RtfParagraphStyle paragraphStyle = (RtfParagraphStyle) o;
boolean result = this.getStyleName().equals(paragraphStyle.getStyleName());
return result;
}
Tests whether two RtfParagraphStyles are equal. Equality
is determined via the name. |
public int getAlignment() {
return this.alignment;
}
Gets the alignment of this RtfParagraphStyle. |
public String getBasedOnName() {
return this.basedOnName;
}
Gets the name of the RtfParagraphStyle this RtfParagraphStyle is based on. |
public int getFirstLineIndent() {
return this.firstLineIndent;
}
Gets the first line indentation of this RtfParagraphStyle. |
public int getIndentLeft() {
return this.indentLeft;
}
Gets the left indentation of this RtfParagraphStyle. |
public int getIndentRight() {
return this.indentRight;
}
Gets the right indentation of this RtfParagraphStyle. |
public boolean getKeepTogether() {
return this.keepTogether;
}
Gets whether the lines in the paragraph should be kept together in
this RtfParagraphStyle. |
public boolean getKeepTogetherWithNext() {
return this.keepTogetherWithNext;
}
Gets whether the paragraph should be kept together with the next in
this RtfParagraphStyle. |
public int getLineLeading() {
return this.lineLeading;
}
Gets the line leading of this RtfParagraphStyle. |
public int getSpacingAfter() {
return this.spacingAfter;
}
Gets the space after the paragraph of this RtfParagraphStyle. |
public int getSpacingBefore() {
return this.spacingBefore;
}
Gets the space before the paragraph of this RtfParagraphStyle.. |
public String getStyleName() {
return this.styleName;
}
Gets the name of this RtfParagraphStyle. |
public void handleInheritance() {
if(this.basedOnName != null && this.document.getDocumentHeader().getRtfParagraphStyle(this.basedOnName) != null) {
this.baseStyle = this.document.getDocumentHeader().getRtfParagraphStyle(this.basedOnName);
this.baseStyle.handleInheritance();
if(!((this.modified & MODIFIED_ALIGNMENT) == MODIFIED_ALIGNMENT)) {
this.alignment = this.baseStyle.getAlignment();
}
if(!((this.modified & MODIFIED_INDENT_LEFT) == MODIFIED_INDENT_LEFT)) {
this.indentLeft = this.baseStyle.getIndentLeft();
}
if(!((this.modified & MODIFIED_INDENT_RIGHT) == MODIFIED_INDENT_RIGHT)) {
this.indentRight = this.baseStyle.getIndentRight();
}
if(!((this.modified & MODIFIED_SPACING_BEFORE) == MODIFIED_SPACING_BEFORE)) {
this.spacingBefore = this.baseStyle.getSpacingBefore();
}
if(!((this.modified & MODIFIED_SPACING_AFTER) == MODIFIED_SPACING_AFTER)) {
this.spacingAfter = this.baseStyle.getSpacingAfter();
}
if(!((this.modified & MODIFIED_FONT_NAME) == MODIFIED_FONT_NAME)) {
setFontName(this.baseStyle.getFontName());
}
if(!((this.modified & MODIFIED_FONT_SIZE) == MODIFIED_FONT_SIZE)) {
setSize(this.baseStyle.getFontSize());
}
if(!((this.modified & MODIFIED_FONT_STYLE) == MODIFIED_FONT_STYLE)) {
setStyle(this.baseStyle.getFontStyle());
}
if(!((this.modified & MODIFIED_FONT_COLOR) == MODIFIED_FONT_COLOR)) {
setColor(this.baseStyle.getColor());
}
if(!((this.modified & MODIFIED_LINE_LEADING) == MODIFIED_LINE_LEADING)) {
setLineLeading(this.baseStyle.getLineLeading());
}
if(!((this.modified & MODIFIED_KEEP_TOGETHER) == MODIFIED_KEEP_TOGETHER)) {
setKeepTogether(this.baseStyle.getKeepTogether());
}
if(!((this.modified & MODIFIED_KEEP_TOGETHER_WITH_NEXT) == MODIFIED_KEEP_TOGETHER_WITH_NEXT)) {
setKeepTogetherWithNext(this.baseStyle.getKeepTogetherWithNext());
}
}
}
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. |
public int hashCode() {
return this.styleName.hashCode();
}
Gets the hash code of this RtfParagraphStyle. |
public void setAlignment(int alignment) {
this.modified = this.modified | MODIFIED_ALIGNMENT;
this.alignment = alignment;
}
Sets the alignment of this RtfParagraphStyle. |
public void setColor(Color color) {
this.modified = this.modified | MODIFIED_FONT_COLOR;
super.setColor(color);
}
Sets the color of this RtfParagraphStyle. |
public void setFirstLineIndent(int firstLineIndent) {
this.firstLineIndent = firstLineIndent;
}
Sets the first line indentation of this RtfParagraphStyle. It
is relative to the left indentation. |
public void setFontName(String fontName) {
this.modified = this.modified | MODIFIED_FONT_NAME;
super.setFontName(fontName);
}
Sets the font name of this RtfParagraphStyle. |
public void setIndentLeft(int indentLeft) {
this.modified = this.modified | MODIFIED_INDENT_LEFT;
this.indentLeft = indentLeft;
}
Sets the left indentation of this RtfParagraphStyle. |
public void setIndentRight(int indentRight) {
this.modified = this.modified | MODIFIED_INDENT_RIGHT;
this.indentRight = indentRight;
}
Sets the right indentation of this RtfParagraphStyle. |
public void setKeepTogether(boolean keepTogether) {
this.keepTogether = keepTogether;
this.modified = this.modified | MODIFIED_KEEP_TOGETHER;
}
Sets whether the lines in the paragraph should be kept together in
this RtfParagraphStyle. |
public void setKeepTogetherWithNext(boolean keepTogetherWithNext) {
this.keepTogetherWithNext = keepTogetherWithNext;
this.modified = this.modified | MODIFIED_KEEP_TOGETHER_WITH_NEXT;
}
Sets whether the paragraph should be kept together with the next in
this RtfParagraphStyle. |
public void setLineLeading(int lineLeading) {
this.lineLeading = lineLeading;
this.modified = this.modified | MODIFIED_LINE_LEADING;
}
Sets the line leading of this RtfParagraphStyle. |
public void setSize(float fontSize) {
this.modified = this.modified | MODIFIED_FONT_SIZE;
super.setSize(fontSize);
}
Sets the font size of this RtfParagraphStyle. |
public void setSpacingAfter(int spacingAfter) {
this.modified = this.modified | MODIFIED_SPACING_AFTER;
this.spacingAfter = spacingAfter;
}
Sets the space after the paragraph of this RtfParagraphStyle. |
public void setSpacingBefore(int spacingBefore) {
this.modified = this.modified | MODIFIED_SPACING_BEFORE;
this.spacingBefore = spacingBefore;
}
Sets the space before the paragraph of this RtfParagraphStyle. |
public void setStyle(int fontStyle) {
this.modified = this.modified | MODIFIED_FONT_STYLE;
super.setStyle(fontStyle);
}
Sets the font style of this RtfParagraphStyle. |
protected void setStyleNumber(int styleNumber) {
this.styleNumber = styleNumber;
}
Sets the number of this RtfParagraphStyle in the stylesheet list. |
public void writeBegin(OutputStream result) throws IOException {
result.write(DocWriter.getISOBytes("\\s"));
result.write(intToByteArray(this.styleNumber));
writeParagraphSettings(result);
}
Writes the start information of this RtfParagraphStyle. |
public void writeContent(OutputStream out) throws IOException {
}
|
public void writeDefinition(OutputStream result) throws IOException {
result.write(DocWriter.getISOBytes("{"));
result.write(DocWriter.getISOBytes("\\style"));
result.write(DocWriter.getISOBytes("\\s"));
result.write(intToByteArray(this.styleNumber));
result.write(RtfBasicElement.DELIMITER);
writeParagraphSettings(result);
super.writeBegin(result);
result.write(RtfBasicElement.DELIMITER);
result.write(DocWriter.getISOBytes(this.styleName));
result.write(DocWriter.getISOBytes(";"));
result.write(DocWriter.getISOBytes("}"));
this.document.outputDebugLinebreak(result);
}
Writes the definition of this RtfParagraphStyle for the stylesheet list. |
public void writeEnd(OutputStream result) throws IOException {
}
|