B2020-033: Auto table of contents line spacing

This commit is contained in:
Kathy Ruffing 2020-03-17 13:22:11 +00:00
parent ae1396bf5a
commit 8c4f36566c

View File

@ -1329,12 +1329,14 @@ namespace Volian.Print.Library
float secPagePos = (float)tOfC.TofCPageNumPos + xAdjNumber;
float height = tOfC.Font.WindowsFont.Size * 1.5F;
string lastTOCGroupHeading = "";
bool firstGroupHeading = true;
if (ii.Sections != null)
{
int sectCnt = 0; // keep count of which section/sub-section we are processing
bool doSubY = false;
// C2018-004 create meta file for baseline compares
Volian.Base.Library.BaselineMetaFile.WriteLine("TOC Ystart {0} LeftMar {1} ScNmPos {2} ScTtlPos {3} ScPgPos {4}", yPageStart, leftMargin, secNumPos, secTitlePos, secPagePos);
bool inGroup = false;
foreach (SectionInfo mySection in ii.Sections)
{
sectCnt++;
@ -1375,8 +1377,14 @@ namespace Volian.Print.Library
if (tocGrpHeading != lastTOCGroupHeading && tocGrpHeading.Length > 0)
{
doGroupHeading = true;
if (lastTOCGroupHeading != "")
inGroup = true;
// B2020-033: for single spacing, add an extra line before a grouping title:
float tmpspc = (float)(tOfC.TofCLineSpacing ?? 1);
if (lastTOCGroupHeading != "" || (firstGroupHeading && tmpspc==1))
{
yLocation += vlnPrintObject.SixLinesPerInch;
firstGroupHeading = false;
}
lastTOCGroupHeading = tocGrpHeading;
}
// need to do the section number, section title & page number. Page number
@ -1562,7 +1570,7 @@ namespace Volian.Print.Library
float spcs = (float)(tOfC.TofCLineSpacingSub ?? 1);
if (spcs == -1) // F2018-033: Allow for single & double spacing for Farley (if in group or not)
{
if (sc.Section_TOC_Group_Title != null && sc.Section_TOC_Group_Title != "")
if (inGroup) // Do not require a title to be placed on each section in group for Farley. If in group from above, single space
spcs = 1;
else
spcs = 2;
@ -1574,7 +1582,7 @@ namespace Volian.Print.Library
float spc = (float)(tOfC.TofCLineSpacing ?? 1);
if (spc == -1) // F2018-033: Allow for single & double spacing for Farley (if in group or not)
{
if (sc.Section_TOC_Group_Title != null && sc.Section_TOC_Group_Title != "")
if (inGroup) // Do not require a title to be placed on each section in group for Farley. If in group from above, single space
spc = 1;
else
spc = 2;