From 8ac98b2816efe98c4ffc494e21cdb2cc8c89c8da Mon Sep 17 00:00:00 2001 From: Kathy Date: Mon, 2 Mar 2020 15:32:35 +0000 Subject: [PATCH] F2018-033: Auto TOC for Farley. Note that this is check in for release note from 2/28/2020 (was missed during initial checking). --- PROMS/Volian.Print.Library/PromsPrinter.cs | 38 +++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index a9491b5e..0e3095d2 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -938,6 +938,11 @@ namespace Volian.Print.Library InsertBlankPage(cb); } GenerateTOC(mySection, myProcedure, cb, _TextLayer); + // F2018-033: Farley Auto TOC. If doing foldouts or supinfo facing pages, add a blank page after also: + if (((cb.PdfWriter.CurrentPageNumber % 2 == 0 && !_MyHelper.CreatingFoldoutPage) || myProcedure.ProcHasSupInfoData) && InsertBlankPages) // Bug Fix: B2016-181 - add blank page if page count is even + { + InsertBlankPage(cb); + } } else { @@ -1433,7 +1438,11 @@ namespace Volian.Print.Library string rtfGrpingText = GetRtfToC(tocGrpHeading, tOfC, grpingFont); Paragraph myparagraphGrpTitle = vlnPrintObject.RtfToParagraph(rtfGrpingText); float w = secPagePos - 6; - int lnaftergroup = ((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 0) > 0) ? 1 : 2; + // F2018-033: Farley Auto TOC. If line spacing is less than 0, then spacing is double spaced if on section items (such as + // Purpose, Proc Steps; and spacing is single spaced if within groups. If not less than 0, just use what is in format file. + int lnaftergroup = 1; + float lnsp = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacing ?? 0; + if (lnsp < 0) lnaftergroup = ((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 0) > 0) ? 1 : 2; float yLocAfterGrpTitleAndFirstItem = yLocation + (lnaftergroup * vlnPrintObject.SixLinesPerInch) + vlnPrintObject.GetHeight(cb, myparagraphGrpTitle, string.Empty, w, false) + vlnPrintObject.GetHeight(cb, myparagraphSecTitle, string.Empty, savTitleWid, false); // if group heading and first item under it does not fit on the page, do a page break if ((yPageStart - yLocAfterGrpTitleAndFirstItem) < yBottomMargin) @@ -1445,7 +1454,7 @@ namespace Volian.Print.Library //if (yLocation > 0) yLocation += vlnPrintObject.SixLinesPerInch;// commented out for B2016-200 // for two blank line between last TOC title and the new grouping title float rtnval = Rtf2Pdf.TextAt(cb, myparagraphGrpTitle, leftMargin + secNumPos, yPageStart - yLocation, w, height, "", yBottomMargin); // print the Group Title yLocation += vlnPrintObject.SixLinesPerInch; // for two blank line between last TOC title and the new grouping title - added for B2016-200 - yLocation += (lnaftergroup * vlnPrintObject.SixLinesPerInch); // new line + if (lnsp > -1) yLocation += (lnaftergroup * vlnPrintObject.SixLinesPerInch); // new line } // Print the section title float retval = Rtf2Pdf.TextAt(cb, myparagraphSecTitle, leftMargin + ((tOfC.TofCSecNumPos == tOfC.TofCSecTitlePos && tmptxt.Equals(" "))? secNumPos : adjSecTitlePos), yPageStart - yLocation, width, height, "", yBottomMargin); @@ -1547,10 +1556,31 @@ namespace Volian.Print.Library doSubY = (((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 1) > 0) && (mySection.MyParent.IsSection && (/* mySection.Sections == null && */ sectCnt < ii.Sections.Count))) // B2016-205 || didGrp; + //float spc = (float)(tOfC.TofCLineSpacing ?? 1); if (doSubY) - yLocation += (float)(tOfC.TofCLineSpacingSub ?? 1) * vlnPrintObject.SixLinesPerInch; + { + 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 != "") + spcs = 1; + else + spcs = 2; + } + yLocation += (spcs * vlnPrintObject.SixLinesPerInch); + } else - yLocation += (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch; + { + 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 != "") + spc = 1; + else + spc = 2; + } + yLocation += (spc * vlnPrintObject.SixLinesPerInch); + } } float savYLoc = yLocation; yLocation = AddSectionToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation, doSubY);