diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 8607c52c..2f383a63 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -1133,8 +1133,7 @@ namespace Volian.Print.Library float secTitlePos = (float)tOfC.TofCSecTitlePos + xAdjTitle; float secPagePos = (float)tOfC.TofCPageNumPos + xAdjNumber; float height = tOfC.Font.WindowsFont.Size * 1.5F; - //bool didAttachmentGroupingTitle = false; - //string attachmentGroupHeading = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCAttGroupingHeader; + string lastTOCGroupHeading = ""; if (ii.Sections != null) { foreach (SectionInfo mySection in ii.Sections) @@ -1143,14 +1142,29 @@ namespace Volian.Print.Library if ((mySection.MyDocStyle != null && mySection.MyDocStyle.IncludeInTOC && (sc == null || sc.Section_TOC != "Y")) || ((mySection.MyDocStyle == null || !mySection.MyDocStyle.IncludeInTOC) && (sc != null && sc.Section_TOC == "Y"))) { - //if (!didAttachmentGroupingTitle && mySection.MyContent.Text.StartsWith("ATTACHMENT") && attachmentGroupHeading.Length > 0) - //{ - // VE_Font grpingFont = new VE_Font(tOfC.Font.Family, (int)tOfC.Font.Size, (E_Style)tOfC.Font.Style | E_Style.Underline, (float)tOfC.Font.CPI); - // string rtfGrpingText = GetRtfToC(attachmentGroupHeading, tOfC, grpingFont); - // Paragraph myparagrapht = vlnPrintObject.RtfToParagraph(rtfGrpingText); - // width = secPagePos - adjSecTitlePos - 6; - // float retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + ((tOfC.TofCSecNumPos == tOfC.TofCSecTitlePos && tmptxt.Equals(" ")) ? secNumPos : adjSecTitlePos), yPageStart - yLocation, width, height, "", yBottomMargin); - //} + // The Group Title logic was added for V.C. Summer and Farley(new writer guide format) + // It allows the user to enter a Table of Contents Grouping Title on the Section Property (under automation) + // The grouping title will print if the same title wasn't last printed + string tocGrpHeading = sc.Section_TOC_Group_Title; // returns a "" if no title was entered + float yBottomMargin = yPageStart - (float)tocSection.MyDocStyle.Layout.PageLength + (2 * vlnPrintObject.SixLinesPerInch); + if (tocGrpHeading != lastTOCGroupHeading && tocGrpHeading.Length > 0) + { + lastTOCGroupHeading = tocGrpHeading; + VE_Font grpingFont = new VE_Font(tOfC.Font.Family, (int)tOfC.Font.Size, (E_Style)tOfC.Font.Style | E_Style.Underline, (float)tOfC.Font.CPI); + string rtfGrpingText = GetRtfToC(tocGrpHeading, tOfC, grpingFont); + Paragraph myparagraphtc = vlnPrintObject.RtfToParagraph(rtfGrpingText); + float w = secPagePos - 6; + if (yLocation > 0) yLocation += vlnPrintObject.SixLinesPerInch; // for two blank line between last TOC title and the new grouping title + float rtnval = Rtf2Pdf.TextAt(cb, myparagraphtc, leftMargin + secNumPos, yPageStart - yLocation, w, height, "", yBottomMargin); + if (rtnval == 0) // couldn't fit, flags need for a page break. + { + NewPage(); + _MyHelper.ResetSvg(); // needed to reset so that PSNotFirst pagelist justify flag gets used for BGE + yLocation = lastyLocation = 0; + rtnval = Rtf2Pdf.TextAt(cb, myparagraphtc, leftMargin + secNumPos, yPageStart - yLocation, w, height, "", yBottomMargin); + } + yLocation += (2 * vlnPrintObject.SixLinesPerInch); // new line + } // need to do the section number, section title & page number. Page number // has to be put on at end after number of page is known, so use a Template. string tmptxt = mySection.MyContent.Number == null || mySection.MyContent.Number == "" ? " " : mySection.MyContent.Number; @@ -1160,7 +1174,6 @@ namespace Volian.Print.Library foreach (Chunk chkt in myparagraphn.Chunks) width += chkt.GetWidthPoint(); float numwidth = width; - float yBottomMargin = yPageStart - (float)tocSection.MyDocStyle.Layout.PageLength + (2 * vlnPrintObject.SixLinesPerInch); Rtf2Pdf.Offset = new PointF(0, 2.5F); // for indenting of subsections, count up tree. Only start indenting @@ -1187,6 +1200,12 @@ namespace Volian.Print.Library if (secNumPos + numwidth + indentOffset > secTitlePos + indentOffset) adjSecTitlePos = secNumPos + numwidth + 18 - xAdjTitleIndent + indentOffset; + // logic put in for V.C. Summer who wants to their auto table of contents to print "OPERATOR ACTIONS" (set in the format) instead of "Procedure Steps" + // - note that Summer didn't want to change the section title because they want transition to say "procedure step" for the section title. 03/08/2016 + string tocSecTitle = mySection.MyContent.Text; + if (tocSecTitle.ToUpper() == "PROCEDURE STEPS" && tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle != "") + tocSecTitle = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCProcedureStepsTitle; + // Do the title first since it may wrap to 2nd line and this is an issue for // doing a pagebreak, i.e. may cause a page break when the number on a single line // would not. @@ -1194,10 +1213,10 @@ namespace Volian.Print.Library if (level == 0 && tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCUnderlineFirstLevelTitle) { VE_Font ovrFont = new VE_Font(tOfC.Font.Family, (int)tOfC.Font.Size,(E_Style)tOfC.Font.Style | E_Style.Underline, (float)tOfC.Font.CPI); - rtfText = GetRtfToC(mySection.MyContent.Text, tOfC, ovrFont); + rtfText = GetRtfToC(tocSecTitle, tOfC, ovrFont); } else - rtfText = GetRtfToC(mySection.MyContent.Text, tOfC); + rtfText = GetRtfToC(tocSecTitle, tOfC); Paragraph myparagrapht = vlnPrintObject.RtfToParagraph(rtfText); width = secPagePos - adjSecTitlePos - 6; float savTitleWid = width; diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index ce73408c..54f73198 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -272,7 +272,9 @@ namespace Volian.Print.Library if (!CreatingFoldoutPage) DrawRuler(writer.DirectContent); } - if (MySection.MyDocStyle.StructureStyle.Style==null || (MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) + // added the check for onBlankPage and Foldouts to fix bug found in V.C. Summer auto table of contents - 03/08/2016 + if (!onBlankPage && (MySection.MyDocStyle.StructureStyle.Style==null || (MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) && + !(MySection.ActiveFormat.PlantFormat.FormatData.PrintData.SectionLevelFoldouts && MySection.DisplayNumber.ToUpper() == "FOLDOUT")) CurrentTOCPageNumber++; if (MySection.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList) {