Skip to content

Commit

Permalink
rtf
Browse files Browse the repository at this point in the history
  • Loading branch information
eisbaer66 committed Apr 9, 2019
1 parent 6d2dd8c commit c302dc2
Show file tree
Hide file tree
Showing 27 changed files with 4,570 additions and 52 deletions.
72 changes: 72 additions & 0 deletions RtfWriter.Standard/RtfAbstract.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
namespace RtfWriter.Standard
{
/// <summary>
/// Internal use only.
/// Objects that are renderable can emit RTF code.
/// </summary>
abstract public class RtfRenderable
{
/// <summary>
/// Internal use only.
/// Emit RTF code.
/// </summary>
/// <returns>RTF code</returns>
abstract public string render();
}

/// <summary>
/// Internal use only.
/// RtfBlock is a content block that cannot contain other blocks.
/// For example, an image is an RtfBlock because it cannot contain
/// other content block such as another image, a paragraph, a table,
/// etc.
/// </summary>
abstract public class RtfBlock : RtfRenderable
{
/// <summary>
/// How this block is aligned in its containing block.
/// </summary>
abstract public Align Alignment { get; set; }
/// <summary>
/// By what distance this block is separated from others in
/// the containing block.
/// </summary>
abstract public Margins Margins { get; }
/// <summary>
/// Default character formats.
/// </summary>
abstract public RtfCharFormat DefaultCharFormat { get; }
/// <summary>
/// When set to true, this block will be arranged in the beginning
/// of a new page.
/// </summary>
abstract public bool StartNewPage { get; set; }
/// <summary>
/// Internal use only.
/// Beginning RTF control words for this block.
/// </summary>
abstract internal string BlockHead { set; }
/// <summary>
/// Internal use only.
/// Ending RTF control word for this block.
/// </summary>
abstract internal string BlockTail { set; }

protected string AlignmentCode()
{
switch (Alignment)
{
case Align.Left:
return @"\ql";
case Align.Right:
return @"\qr";
case Align.Center:
return @"\qc";
case Align.FullyJustify:
return @"\qj";
default:
return @"\qd";
}
}
}
}
Loading

0 comments on commit c302dc2

Please sign in to comment.