diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 520a792d..35cd6019 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -783,10 +783,19 @@ namespace Volian.Print.Library //} float lastyLocation = 0; private string GetRtfToC(string txt, TableOfContentsData tOfCData) + { + return GetRtfToC(txt, tOfCData, null); + } + private string GetRtfToC(string txt, TableOfContentsData tOfCData, VE_Font overrideFont) { StringBuilder _RtfSB = new StringBuilder(); Volian.Controls.Library.DisplayText toctxt = new Volian.Controls.Library.DisplayText(txt, tOfCData.Font, false); System.Drawing.Font myFont = toctxt.TextFont.WindowsFont; + if (overrideFont != null) + { + toctxt = new Volian.Controls.Library.DisplayText(txt, overrideFont, false); + myFont = overrideFont.WindowsFont;//toctxt.TextFont.WindowsFont; + } _RtfSB.Append(vlnPrintObject.AddFontTable(myFont)); _RtfSB.Append(toctxt.StartText); _RtfSB.Append("}"); @@ -843,7 +852,9 @@ namespace Volian.Print.Library int tofCNumLevels = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCNumLevels ?? 0; if (tofCNumLevels > 0 && level > tofCNumLevels) return yLocation; - level = level <= 2 ? 0 : level - 2; // no indenting until third level + int startIndentAfterLevel = tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCStartIndentAfterLevel ?? 2; // + //level = level <= 2 ? 0 : level - 2; // no indenting until third level + level = level <= startIndentAfterLevel ? 0 : level - startIndentAfterLevel; float indentOffset = (level * (secTitlePos - secNumPos)); // if the starting column of text would be in 'middle of' the number, just put it @@ -855,7 +866,14 @@ namespace Volian.Print.Library // 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. - rtfText = GetRtfToC(mySection.MyContent.Text, tOfC); + //if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData + 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); + } + else + rtfText = GetRtfToC(mySection.MyContent.Text, 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 584cd4b3..50e7f501 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -210,7 +210,7 @@ namespace Volian.Print.Library if (!CreatingFoldoutPage) DrawRuler(writer.DirectContent); } - if (MySection.MyDocStyle.StructureStyle.Style==null || (MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) + if (MySection.MyDocStyle.StructureStyle.Style == null || (MySection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DontCountInTabOfCont) == 0) CurrentTOCPageNumber++; if (MySection.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList) { @@ -647,8 +647,8 @@ namespace Volian.Print.Library _MySection = value; MySectionTitle = ((_MySection.DisplayNumber ?? "")=="" ? "" : _MySection.DisplayNumber + " - ") + _MySection.DisplayText; bool forceLoadSvg = false; - //if (value.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate && value.MyDocStyle.ResetFirstPageOnSection) - // DidFirstPageDocStyle = false; + if (value.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate && value.MyDocStyle.ResetFirstPageOnSection) + DidFirstPageDocStyle = false; if (DidFirstPageDocStyle) forceLoadSvg = SetDocStyleAndValues(); // this method also gets the SVG (the 'else' part of this) Volian.Svg.Library.Svg sectSvg = BuildSvg(_MySection, forceLoadSvg); @@ -895,7 +895,7 @@ namespace Volian.Print.Library MyPdfContentByte.AddTemplate(MyPageCounts.AddToTemplateList(key, MyPdfWriter, txt, args.MySvgText.Font, args.MySvgText.Align, args.MySvgText.FillColor), args.MySvgScale.X(args.MySvgText.X), args.MySvgScale.Y(MyPdfContentByte, args.MySvgText.Y)); return string.Empty; } - string tocKey = "TOC" + MySection.ItemID.ToString(); + //string tocKey = "TOC" + MySection.ItemID.ToString(); if (args.MyText.Contains("{PAGE}") || args.MyText.Contains("{OF}")) { @@ -1747,13 +1747,13 @@ namespace Volian.Print.Library plstr = plstr.Replace(match, line); else { - //if (cnt == 1) - //{ - // plstr = plstr.Replace(match, line); - // svgGroup.Add(PageItemToSvgText(pageItem, plstr, yOffset)); - // plstr = ""; - //} - //else + if (cnt == 1) + { + plstr = plstr.Replace(match, line); // include preceeding text with the first line v.c. summer + svgGroup.Add(PageItemToSvgText(pageItem, plstr, yOffset)); + plstr = ""; + } + else svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset)); plstr = plstr.Replace(match, ""); } diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 7feaa1c4..50e1611a 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -478,7 +478,13 @@ namespace Volian.Print.Library if (MyItemInfo.MyContent.MyGrid != null) retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); else - if (doprint) retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); + { + if (doprint) + { + retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); + SectionContinuePrinted = true; + } + } if (MyItemInfo.IsHigh) { MyPageHelper.PageBookmarks.Add(MyItemInfo, (MyItemInfo.MyTab == null) ? "" : MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, @@ -499,7 +505,8 @@ namespace Volian.Print.Library if (MyPageHelper.MyTOCPageCounts.ContainsKey(tocKey)) { PageCount pc = MyPageHelper.MyTOCPageCounts[tocKey]; - pc.Total = MyPageHelper.CurrentTOCPageNumber + 1; + if (pc.Total == 0) + pc.Total = MyPageHelper.CurrentTOCPageNumber + 1; pc.DrawTemplates(); } } @@ -513,6 +520,13 @@ namespace Volian.Print.Library //if (localYPageStart != yPageStart) DebugText.WriteLine("ParToPdf-yPagestartDiff:{0},{1},{2}", MyItemInfo.ItemID, localYPageStart, yPageStart); return yPageStart; } + private bool _SectionContinuePrinted = false; + + public bool SectionContinuePrinted + { + get { return _SectionContinuePrinted; } + set { _SectionContinuePrinted = value; } + } private void DrawChkOrValveTableLines(PdfContentByte cb, ItemInfo ii, float yPageStart, float yTopMargin, float yBottomMargin, float yLocation) { if (!ii.IsStep || ii.IsCaution || ii.IsNote) return; @@ -775,12 +789,13 @@ namespace Volian.Print.Library } } // if printing checklist header, adjust ypagestart & ylocation so that won't get forced pagination (pagination is already ok) + //Console.WriteLine("'Q1',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); if (PrintHeader) { yPageStart = yTopMargin + YVeryTop; yLocation = yPageStart - YOffset; // yLocation is physical location from bottom of page. } - if (yLocation - Height < 24) _MyLog.WarnFormat("Very Low {0},{1},{2},{3},{4},{5}",MyItemInfo.ShortPath,MyItemInfo.ItemID,yLocation,Height,yLocation-Height,yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength); + if (yLocation - Height < 24) _MyLog.WarnFormat("Very Low {0},{1},{2},{3},{4},{5}",MyItemInfo.ShortPath,MyItemInfo.ItemID,yLocation,Height,yLocation-Height,yTopMargin - MyItemInfo.MyDocStyle.Layout.PageLength); retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}",YSize/SixLinesPerInch), yBottomMargin); if (retval == 0) // problem occurred - paragraph was not able to be printed on page { // pagination logic needs to be fixed. @@ -1002,7 +1017,11 @@ namespace Volian.Print.Library yPageStart = yTopMargin; } else if (MyItemInfo.IsSection || (MyItemInfo.IsHigh && MyItemInfo.MyPrevious != null)) //do not reset for 1st step + { + //Console.WriteLine("'b1',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); + //Console.WriteLine("'a1',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); + } DebugText.WriteLine("Paginate1"); if (MyItemInfo.IsSection) { @@ -1084,7 +1103,10 @@ namespace Volian.Print.Library } } //_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber); + //Console.WriteLine("'b2',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); + //Console.WriteLine("'a2',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); + DebugText.WriteLine("Paginate2"); if (MyItemInfo.MyHLS.FoldoutIndex() > -1) PromsPrinter.DoFoldoutPage(cb, "Break within Step", MyPageHelper.TextLayer, MyPageHelper, MyItemInfo.MyHLS.FoldoutIndex(), false); // temporary foldout @@ -1169,7 +1191,9 @@ namespace Volian.Print.Library OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); cb.PdfDocument.NewPage(); // HLS (7 lpi) breakif (MyItemInfo.IsSection) //_MyLog.InfoFormat("NewPage 12 {0}", cb.PdfWriter.CurrentPageNumber); + //Console.WriteLine("'b3',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); + //Console.WriteLine("'a3',{0},'{1}',{2},{3},{4},{5},{6}", MyItemInfo.ItemID, MyItemInfo.ShortPath, yTopMargin, yPageStart, yLocation, YTopMost, YOffset); DebugText.WriteLine("Paginate3"); if (MyItemInfo.IsSection) { @@ -1213,9 +1237,12 @@ namespace Volian.Print.Library // format must have ContinueSectinHeader format flag set to true if (doSectionTitleContinued) { - vlnParagraph sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0); + vlnParagraph sectContPara; + string contMsg = MyItemInfo.MyActiveSection.MyDocStyle.Continue.SectionTitle.AppendToTitle; + sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null ||contMsg == "")?" (Continued)":contMsg, 0); float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); - yPageStart -= sectContPara.Height * 2; + if (sectContPara.SectionContinuePrinted) + yPageStart -= sectContPara.Height * 2; } yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); @@ -1267,7 +1294,7 @@ namespace Volian.Print.Library if (si.MyActiveParent.IsSection) // is this meta/subsection. Only put end message out on last section { ItemInfo mysect = si as ItemInfo; - if (mysect.GetNextItem() != null) _lastSect = false; + if (mysect.GetNextItem() != null && !docstyle.End.EndMessageOnEachSubSection) _lastSect = false; } string myMsg = (docstyle.End == null) ? null : docstyle.End.FixedMessage; if (myMsg != null && !_skipEndMessage && _lastSect) @@ -1381,6 +1408,19 @@ namespace Volian.Print.Library if (myMsg.IndexOf(@"%c") > -1) myMsg = myMsg.Replace(@"%c", " "); + // Top Continue message includes high level step text + // - was going to use for V.C. Summer but ended up not needing it + // - leaving it here for future use - jsj 10/7/2014 + // + //if ((docstyle.Continue.Top.HLS ?? 0) == 1) + //{ + // string hlsText = ""; + // ItemInfo parentStep = MyItemInfo; + // while (!parentStep.IsHigh && parentStep.MyParent != null && !parentStep.IsSection) parentStep = parentStep.MyParent; + // if (parentStep.IsHigh) hlsText = parentStep.FormattedDisplayText;// .DisplayText; + // myMsg = hlsText + myMsg; + //} + // Calvert Alarms, step description have the alarm number as part of the top continue message // Also, if the break is within the CONDITION/RESPONSE, there are continue messages in both columns at the top // of the table, note that the continue messages WITHIN table are only printed when the