/// <summary> /// 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. /// </summary> public void HandleInheritance() { if (_basedOnName != null && Document.GetDocumentHeader().GetRtfParagraphStyle(_basedOnName) != null) { _baseStyle = Document.GetDocumentHeader().GetRtfParagraphStyle(_basedOnName); _baseStyle.HandleInheritance(); if (!((_modified & ModifiedAlignment) == ModifiedAlignment)) { _alignment = _baseStyle.GetAlignment(); } if (!((_modified & ModifiedIndentLeft) == ModifiedIndentLeft)) { _indentLeft = _baseStyle.GetIndentLeft(); } if (!((_modified & ModifiedIndentRight) == ModifiedIndentRight)) { _indentRight = _baseStyle.GetIndentRight(); } if (!((_modified & ModifiedSpacingBefore) == ModifiedSpacingBefore)) { _spacingBefore = _baseStyle.GetSpacingBefore(); } if (!((_modified & ModifiedSpacingAfter) == ModifiedSpacingAfter)) { _spacingAfter = _baseStyle.GetSpacingAfter(); } if (!((_modified & ModifiedFontName) == ModifiedFontName)) { SetFontName(_baseStyle.GetFontName()); } if (!((_modified & ModifiedFontSize) == ModifiedFontSize)) { Size = _baseStyle.GetFontSize(); } if (!((_modified & ModifiedFontStyle) == ModifiedFontStyle)) { SetStyle(_baseStyle.GetFontStyle()); } if (!((_modified & ModifiedFontColor) == ModifiedFontColor)) { SetColor(_baseStyle.Color); } if (!((_modified & ModifiedLineLeading) == ModifiedLineLeading)) { SetLineLeading(_baseStyle.GetLineLeading()); } if (!((_modified & ModifiedKeepTogether) == ModifiedKeepTogether)) { SetKeepTogether(_baseStyle.GetKeepTogether()); } if (!((_modified & ModifiedKeepTogetherWithNext) == ModifiedKeepTogetherWithNext)) { SetKeepTogetherWithNext(_baseStyle.GetKeepTogetherWithNext()); } } }
/** * Constructs a RtfParagraphStyle from another RtfParagraphStyle. * * INTERNAL USE ONLY * * @param doc The RtfDocument this RtfParagraphStyle belongs to. * @param style The RtfParagraphStyle to copy settings from. */ public RtfParagraphStyle(RtfDocument doc, RtfParagraphStyle style) : base(doc, style) { this.document = doc; this.styleName = style.GetStyleName(); this.alignment = style.GetAlignment(); this.indentLeft = (int)(style.GetIndentLeft() * RtfElement.TWIPS_FACTOR); this.indentRight = (int)(style.GetIndentRight() * RtfElement.TWIPS_FACTOR); this.spacingBefore = (int)(style.GetSpacingBefore() * RtfElement.TWIPS_FACTOR); this.spacingAfter = (int)(style.GetSpacingAfter() * RtfElement.TWIPS_FACTOR); this.lineLeading = (int)(style.GetLineLeading() * RtfElement.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); } }
/// <summary> /// Constructs a RtfParagraphStyle from another RtfParagraphStyle. /// INTERNAL USE ONLY /// </summary> /// <param name="doc">The RtfDocument this RtfParagraphStyle belongs to.</param> /// <param name="style">The RtfParagraphStyle to copy settings from.</param> public RtfParagraphStyle(RtfDocument doc, RtfParagraphStyle style) : base(doc, style) { Document = doc; _styleName = style.GetStyleName(); _alignment = style.GetAlignment(); _firstLineIndent = (int)(style.GetFirstLineIndent() * RtfElement.TWIPS_FACTOR); _indentLeft = (int)(style.GetIndentLeft() * RtfElement.TWIPS_FACTOR); _indentRight = (int)(style.GetIndentRight() * RtfElement.TWIPS_FACTOR); _spacingBefore = (int)(style.GetSpacingBefore() * RtfElement.TWIPS_FACTOR); _spacingAfter = (int)(style.GetSpacingAfter() * RtfElement.TWIPS_FACTOR); _lineLeading = (int)(style.GetLineLeading() * RtfElement.TWIPS_FACTOR); _keepTogether = style.GetKeepTogether(); _keepTogetherWithNext = style.GetKeepTogetherWithNext(); _basedOnName = style._basedOnName; _modified = style._modified; _styleNumber = style.getStyleNumber(); if (Document != null) { SetRtfDocument(Document); } }
/** * Constructs a RtfParagraphStyle from another RtfParagraphStyle. * * INTERNAL USE ONLY * * @param doc The RtfDocument this RtfParagraphStyle belongs to. * @param style The RtfParagraphStyle to copy settings from. */ public RtfParagraphStyle(RtfDocument doc, RtfParagraphStyle style) : base(doc, style) { this.document = doc; this.styleName = style.GetStyleName(); this.alignment = style.GetAlignment(); this.indentLeft = (int) (style.GetIndentLeft() * RtfElement.TWIPS_FACTOR); this.indentRight = (int) (style.GetIndentRight() * RtfElement.TWIPS_FACTOR); this.spacingBefore = (int) (style.GetSpacingBefore() * RtfElement.TWIPS_FACTOR); this.spacingAfter = (int) (style.GetSpacingAfter() * RtfElement.TWIPS_FACTOR); this.lineLeading = (int) (style.GetLineLeading() * RtfElement.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); } }