Changed TofCLineSpacing from an INT to a FLOAT to allow for half line spacing

Logic to handle float TofCLineSpacing and to shift the section title to section number starting position if there is no section number
This commit is contained in:
John Jenko 2015-06-17 17:45:31 +00:00
parent a898601d26
commit eaa5d49b65
2 changed files with 8 additions and 6 deletions

View File

@ -3807,8 +3807,8 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _TofCSpaceChar, "@TofCSpaceChar");
}
}
private LazyLoad<int?> _TofCLineSpacing;
public int? TofCLineSpacing
private LazyLoad<float?> _TofCLineSpacing;
public float? TofCLineSpacing
{
get
{

View File

@ -1142,7 +1142,9 @@ namespace Volian.Print.Library
Paragraph myparagrapht = vlnPrintObject.RtfToParagraph(rtfText);
width = secPagePos - adjSecTitlePos - 6;
float savTitleWid = width;
float retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + adjSecTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin);
// for South Texas Table of Contents
// if there is no section number (we put a blank in tmptxt) then move the section title over to the section number position
float retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + ((tOfC.TofCSecNumPos == tOfC.TofCSecTitlePos && tmptxt.Equals(" "))? secNumPos : adjSecTitlePos), yPageStart - yLocation, width, height, "", yBottomMargin);
if (retval == 0) // couldn't fit, flags need for a page break.
{
NewPage();
@ -1157,7 +1159,7 @@ namespace Volian.Print.Library
// is put out.
retval = Rtf2Pdf.TextAt(cb, myparagraphn, leftMargin + secNumPos + indentOffset, yPageStart - yLocation, numwidth * 1.3F, height, "", yBottomMargin);
float lSpace = (tOfC.TofCLineSpacing == 2) ? 2 * vlnPrintObject.SixLinesPerInch : vlnPrintObject.SixLinesPerInch;
float lSpace = (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch;
// adjust ylocation for pagenumber - the ylocation will get reset if the
// section title split on 2 lines and the page number needs to be on the 2nd line.
@ -1229,7 +1231,7 @@ namespace Volian.Print.Library
AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, secPagePos, height, mySection);
}
yLocation += (tOfC.TofCLineSpacing == 2 ? 2 * vlnPrintObject.SixLinesPerInch : vlnPrintObject.SixLinesPerInch);
yLocation += (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch;
}
yLocation = AddSectionToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation);
}
@ -1240,7 +1242,7 @@ namespace Volian.Print.Library
private void AddTemplateTOCPageCounts(TableOfContentsData tOfC, float yLocation, float yPageStartAdj, float leftMargin, float secPagePos, float height, SectionInfo mySection)
{
string key = "TOC" + mySection.ItemID.ToString();
PdfTemplate tmp = _MyHelper.MyTOCPageCounts.AddToTemplateList(key, _MyHelper.MyPdfWriter, "{TOCPAGE}", tOfC.Font.WindowsFont, Element.ALIGN_LEFT, PrintOverride.TextColor);
PdfTemplate tmp = _MyHelper.MyTOCPageCounts.AddToTemplateList(key, _MyHelper.MyPdfWriter, "{TOCPAGE}", tOfC.Font.WindowsFont, (tOfC.TofCPageNumAlign.ToUpper() == "RIGHT") ? Element.ALIGN_RIGHT : Element.ALIGN_LEFT, PrintOverride.TextColor);
_MyHelper.MyPdfContentByte.AddTemplate(tmp, leftMargin + secPagePos, (yPageStartAdj - yLocation) - height / 2);
}