/** * Constructs a RtfParagraph belonging to a RtfDocument based on a Paragraph. * * @param doc The RtfDocument this RtfParagraph belongs to * @param paragraph The Paragraph that this RtfParagraph is based on */ public RtfParagraph(RtfDocument doc, Paragraph paragraph) : base(doc) { ST.RtfFont baseFont = null; if (paragraph.Font is ST.RtfParagraphStyle) { this.paragraphStyle = this.document.GetDocumentHeader().GetRtfParagraphStyle(((ST.RtfParagraphStyle) paragraph.Font).GetStyleName()); baseFont = this.paragraphStyle; } else { baseFont = new ST.RtfFont(this.document, paragraph.Font); this.paragraphStyle = new ST.RtfParagraphStyle(this.document, this.document.GetDocumentHeader().GetRtfParagraphStyle("Normal")); this.paragraphStyle.SetAlignment(paragraph.Alignment); this.paragraphStyle.SetFirstLineIndent((int) (paragraph.FirstLineIndent * RtfElement.TWIPS_FACTOR)); this.paragraphStyle.SetIndentLeft((int) (paragraph.IndentationLeft * RtfElement.TWIPS_FACTOR)); this.paragraphStyle.SetIndentRight((int) (paragraph.IndentationRight * RtfElement.TWIPS_FACTOR)); this.paragraphStyle.SetSpacingBefore((int) (paragraph.SpacingBefore * RtfElement.TWIPS_FACTOR)); this.paragraphStyle.SetSpacingAfter((int) (paragraph.SpacingAfter * RtfElement.TWIPS_FACTOR)); if (paragraph.HasLeading()) { this.paragraphStyle.SetLineLeading((int) (paragraph.Leading * RtfElement.TWIPS_FACTOR)); } this.paragraphStyle.SetKeepTogether(paragraph.KeepTogether); } for (int i = 0; i < paragraph.Count; i++) { IElement chunk = (IElement) paragraph[i]; if (chunk is Chunk) { ((Chunk) chunk).Font = baseFont.Difference(((Chunk) chunk).Font); } else if (chunk is RtfImage) { ((RtfImage) chunks[i]).SetAlignment(this.paragraphStyle.GetAlignment()); } try { IRtfBasicElement[] rtfElements = doc.GetMapper().MapElement(chunk); for(int j = 0; j < rtfElements.Length; j++) { chunks.Add(rtfElements[j]); } } catch (DocumentException) { } } }
public RtfListLevel(RtfDocument doc, RtfList parent) : base(doc) { this.parent = parent; templateID = document.GetRandomInt(); SetFontNumber( new RtfFont(document, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, new Color(0, 0, 0)))); SetBulletFont(new Font(Font.SYMBOL, 10, Font.NORMAL, new Color(0, 0, 0))); }
/** * Sets the RtfDocument this RtfPhrase belongs to. Also sets the RtfDocument for all child * elements. * * @param doc The RtfDocument to use */ public override void SetRtfDocument(RtfDocument doc) { base.SetRtfDocument(doc); for (int i = 0; i < this.chunks.Count; i++) { ((IRtfBasicElement) this.chunks[i]).SetRtfDocument(this.document); } }
/** * A basically empty constructor that is used by the RtfParagraph. * * @param doc The RtfDocument this RtfPhrase belongs to. */ protected internal RtfPhrase(RtfDocument doc) : base(doc) { }
/** * Sets the RtfDocument this RtfChunk belongs to. * * @param doc The RtfDocument to use */ public override void SetRtfDocument(RtfDocument doc) { base.SetRtfDocument(doc); this.font.SetRtfDocument(this.document); }
/** * Sets the RtfDocument this RtfElement belongs to * * @param doc The RtfDocument to use */ public void SetRtfDocument(RtfDocument doc) { this.document = doc; this.font.SetRtfDocument(this.document); }
/** * Constructs a <code>RtfGenerator</code> belonging to a RtfDocument * * @param doc The <code>RtfDocument</code> this <code>RtfGenerator</code> belongs to */ public RtfGenerator(RtfDocument doc) : base(doc) { }
/** * Closes the RtfDocument. This causes the document to be written * to the specified Stream */ public override void Close() { if (open) { rtfDoc.WriteDocument(os); base.Close(); this.rtfDoc = new RtfDocument(); } }
/** * Construct an RtfCodePage * * @param doc The RtfDocument this RtfCodePage belongs to */ public RtfCodePage(RtfDocument doc) : base(doc) { }
/** * Sets the RtfDocument this RtfElement belongs to * * @param doc The RtfDocument to use */ public void SetRtfDocument(RtfDocument doc) { this.document = doc; if (this.document != null) { for (int i = 0; i < this.content.Length; i++) { try { if (this.content[i] is Element) { this.content[i] = this.document.GetMapper().MapElement((IElement) this.content[i])[0]; ((IRtfBasicElement) this.content[i]).SetInHeader(true); } else if (this.content[i] is IRtfBasicElement){ ((IRtfBasicElement) this.content[i]).SetRtfDocument(this.document); ((IRtfBasicElement) this.content[i]).SetInHeader(true); } } catch (DocumentException) { } } } }
/// <summary> /// Constructs a RtfProtectionSetting belonging to a RtfDocument /// @since 2.1.1 /// @author Howard Shank ([email protected]) /// </summary> /// <param name="doc">The RtfDocument this RtfProtectionSetting belongs to</param> public RtfProtectionSetting(RtfDocument doc) : base(doc) { }
/** * Constructs a new RtfDocumentSettings object. * * @param document The RtfDocument this RtfDocumentSettings belong to. */ public RtfDocumentSettings(RtfDocument document) { this.document = document; }
/// <summary> /// Constructs a RtfInfoElement based on the given Meta object /// </summary> /// <param name="doc">The RtfDocument this RtfInfoElement belongs to</param> /// <param name="meta">The Meta object this RtfInfoElement is based on</param> public RtfInfoElement(RtfDocument doc, Meta meta) : base(doc) { _infoType = meta.Type; _content = meta.Content; }
/// <summary> /// Constructs a new RtfPageSetting object belonging to a RtfDocument. /// </summary> /// <param name="doc">The RtfDocument this RtfPageSetting belongs to</param> public RtfPageSetting(RtfDocument doc) : base(doc) { }
/** * Constructs a RtfListItem for a ListItem belonging to a RtfDocument. * * @param doc The RtfDocument this RtfListItem belongs to. * @param listItem The ListItem this RtfListItem is based on. */ public RtfListItem(RtfDocument doc, ListItem listItem) : base(doc, listItem) { }
/** * Constructs a RtfInfoElement based on the given Meta object * * @param doc The RtfDocument this RtfInfoElement belongs to * @param meta The Meta object this RtfInfoElement is based on */ public RtfInfoElement(RtfDocument doc, Meta meta) : base(doc) { infoType = meta.Type; content = meta.Content; }
public RtfPictureList(RtfDocument doc) : base(doc) { }
/** * Constructs a RtfDocumentHeader for a RtfDocument * * @param doc The RtfDocument this RtfDocumentHeader belongs to */ protected internal RtfDocumentHeader(RtfDocument doc) : base(doc) { }
/** * Constructor only for use when initializing the RtfColorList * * @param doc The RtfDocument this RtfColor belongs to * @param red The red value to use * @param green The green value to use * @param blue The blue value to use * @param colorNumber The number of the colour in the colour list */ protected internal RtfColor(RtfDocument doc, int red, int green, int blue, int colorNumber) : base(doc) { this.red = red; this.blue = blue; this.green = green; this.colorNumber = colorNumber; }
/** * Constructs a RtfField for a RtfDocument. This is not very usefull, * since the RtfField by itself does not do anything. Use one of the * subclasses instead. * * @param doc The RtfDocument this RtfField belongs to. * @param font The Font this RtfField should use */ protected RtfField(RtfDocument doc, Font font) : base("", font) { this.document = doc; this.font = new ST.RtfFont(this.document, font); }
/** * Constructs a RtfColor based on the Color * * @param doc The RtfDocument this RtfColor belongs to * @param col The Color to base this RtfColor on */ public RtfColor(RtfDocument doc, Color col) : base(doc) { if (col != null) { this.red = col.R; this.blue = col.B; this.green = col.G; } if (this.document != null) { this.colorNumber = this.document.GetDocumentHeader().GetColorNumber(this); } }
/** * Constructs a RtfChunk based on the content of a Chunk * * @param doc The RtfDocument that this Chunk belongs to * @param chunk The Chunk that this RtfChunk is based on */ public RtfChunk(RtfDocument doc, Chunk chunk) : base(doc) { if (chunk == null) { return; } if (chunk.Attributes != null && chunk.Attributes[Chunk.SUBSUPSCRIPT] != null) { this.superSubScript = (float)chunk.Attributes[Chunk.SUBSUPSCRIPT]; } if (chunk.Attributes != null && chunk.Attributes[Chunk.BACKGROUND] != null) { this.background = new RtfColor(this.document, (Color) ((Object[]) chunk.Attributes[Chunk.BACKGROUND])[0]); } font = new ST.RtfFont(doc, chunk.Font); content = chunk.Content; }
/** * Constructs a RtfColor based on the red/green/blue values * * @param doc The RtfDocument this RtfColor belongs to * @param red The red value to use * @param green The green value to use * @param blue The blue value to use */ public RtfColor(RtfDocument doc, int red, int green, int blue) : base(doc) { this.red = red; this.blue = blue; this.green = green; if (this.document != null) { this.colorNumber = this.document.GetDocumentHeader().GetColorNumber(this); } }
/** * Constructs a RtfInfoGroup belonging to a RtfDocument * * @param doc The RtfDocument this RtfInfoGroup belongs to */ public RtfInfoGroup(RtfDocument doc) : base(doc) { infoElements = new ArrayList(); }
/** * Sets the RtfDocument this RtfColor belongs to * * @param doc The RtfDocument to use */ public override void SetRtfDocument(RtfDocument doc) { base.SetRtfDocument(doc); if (document != null) { this.colorNumber = document.GetDocumentHeader().GetColorNumber(this); } }
/** * Constructs a new RtfPhrase for the RtfDocument with the given Phrase * * @param doc The RtfDocument this RtfPhrase belongs to * @param phrase The Phrase this RtfPhrase is based on */ public RtfPhrase(RtfDocument doc, Phrase phrase) : base(doc) { if (phrase == null) { return; } if (phrase.HasLeading()) { this.lineLeading = (int) (phrase.Leading * TWIPS_FACTOR); } else { this.lineLeading = 0; } ST.RtfFont phraseFont = new ST.RtfFont(null, phrase.Font); for (int i = 0; i < phrase.Count; i++) { IElement chunk = (IElement) phrase[i]; if (chunk is Chunk) { ((Chunk) chunk).Font = phraseFont.Difference(((Chunk) chunk).Font); } try { IRtfBasicElement[] rtfElements = doc.GetMapper().MapElement(chunk); for (int j = 0; j < rtfElements.Length; j++) { chunks.Add(rtfElements[j]); } } catch (DocumentException) { } } }
/** * Constructs a RtfCell based on a Cell. * * @param doc The RtfDocument this RtfCell belongs to * @param row The RtfRow this RtfCell lies in * @param cell The PdfPCell to base this RtfCell on * @since 2.1.3 */ protected internal RtfCell(RtfDocument doc, RtfRow row, PdfPCell cell) { this.document = doc; this.parentRow = row; ImportCell(cell); }
/** * Constructs a RtfAnnotation based on an Annotation. * * @param doc The RtfDocument this RtfAnnotation belongs to * @param annotation The Annotation this RtfAnnotation is based off */ public RtfAnnotation(RtfDocument doc, Annotation annotation) : base(doc) { title = annotation.Title; content = annotation.Content; }
/** * Sets the RtfDocument this RtfCell belongs to * * @param doc The RtfDocument to use */ public void SetRtfDocument(RtfDocument doc) { this.document = doc; }
/** * Constructs a new RtfStylesheetList for the RtfDocument. * * @param doc The RtfDocument this RtfStylesheetList belongs to. */ public RtfStylesheetList(RtfDocument doc) : base(doc) { this.styleMap = new Hashtable(); }
/** * Creates a RtfFontList * * @param doc The RtfDocument this RtfFontList belongs to */ public RtfFontList(RtfDocument doc) : base(doc) { fontList.Add(new RtfFont(document, 0)); }
/** * Constructs a RtfRow for a Row. * * @param doc The RtfDocument this RtfRow belongs to * @param rtfTable The RtfTable this RtfRow belongs to * @param row The Row this RtfRow is based on * @param rowNumber The number of this row * @since 2.1.3 */ protected internal RtfRow(RtfDocument doc, RtfTable rtfTable, PdfPRow row, int rowNumber) : base(doc) { this.parentTable = rtfTable; this.rowNumber = rowNumber; ImportRow(row); }
/** * Constructs a new RtfPageSetting object belonging to a RtfDocument. * * @param doc The RtfDocument this RtfPageSetting belongs to */ public RtfPageSetting(RtfDocument doc) : base(doc) { }
/** * Constructs a new RtfWriter that listens to the specified Document and * writes its output to the Stream. * * @param doc The Document that this RtfWriter listens to * @param os The Stream to write to */ protected RtfWriter2(Document doc, Stream os) : base(doc, os) { doc.AddDocListener(this); rtfDoc = new RtfDocument(); }
/** * Constructs a RtfField for a RtfDocument. This is not very usefull, * since the RtfField by itself does not do anything. Use one of the * subclasses instead. * * @param doc The RtfDocument this RtfField belongs to. */ protected RtfField(RtfDocument doc) : this(doc, new Font()) { }
/** * 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 new RtfDocumentSettings object. /// </summary> /// <param name="document">The RtfDocument this RtfDocumentSettings belong to.</param> public RtfDocumentSettings(RtfDocument document) { _document = document; }