This commit is contained in:
2010-06-16 14:12:14 +00:00
parent ef5f141b03
commit 7b018d1abb
5 changed files with 110 additions and 41 deletions

View File

@@ -8,16 +8,12 @@ using VEPROMS.CSLA.Library;
namespace Volian.Print.Library
{
public partial class vlnTab : vlnPrintObject
public partial class vlnTab : vlnText
{
public float TabWidth
{
get { return _CharsToTwips * TabText.Length; }
}
private float? _TabAlign;
/// <summary>
/// Used to Align Tabs for numeric tabs that can go to 2 digits
/// </summary>
private float? _TabAlign;
public float TabAlign // Offset to Last printable character
{
get
@@ -25,13 +21,13 @@ namespace Volian.Print.Library
if (_TabAlign == null)
{
_TabAlign = 0;
if (_TabText != null)
if (Text != null)
{
while (_TabText[(int)_TabAlign] == ' ')
while (Text[(int)_TabAlign] == ' ')
_TabAlign++;
if ("0123456789".Contains(_TabText[(int)_TabAlign].ToString()))
if ("0123456789".Contains(Text[(int)_TabAlign].ToString()))
{
while ("0123456789".Contains(_TabText[(int)_TabAlign].ToString()))
while ("0123456789".Contains(Text[(int)_TabAlign].ToString()))
_TabAlign++;
_TabAlign--;
}
@@ -48,38 +44,28 @@ namespace Volian.Print.Library
if (_TabOffset == null)
{
_TabOffset = 0;
if (_TabText != null)
while (_TabText[(int)_TabOffset] == ' ')
if (Text != null)
while (Text[(int)_TabOffset] == ' ')
_TabOffset++;
}
return (float)_TabOffset * _CharsToTwips;
}
}
private string _TabText;
public string TabText
{
get { return _TabText; }
set { _TabText = value; }
}
private VE_Font _MyFont;
public VE_Font MyFont
{
get { return _MyFont; }
set { _MyFont = value; }
}
public vlnTab(PdfContentByte cb, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont)
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont)
{
MyContentByte = cb;
MyParent = myparent;
YOffset = yoffset;
TabText = cleanTab;
Text = cleanTab;
Width = _CharsToTwips * Text.Length;
Rtf = GetRtf(origTab, vFont);
XOffset = xoffset - TabWidth;
XOffset = xoffset - Width;
MyFont = vFont;
}
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, TabWidth, 100, "");
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin);
return yPageStart;
}
}