From 6098140d2644739608ec693848ba22181b72f46a Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 22 Oct 2014 15:29:21 +0000 Subject: [PATCH] Support the impact of the Section Continue Message on Pagination Added logic to determine if the Section Continue Message would be printed. --- PROMS/Volian.Print.Library/Pagination.cs | 18 +++++++++++++++++- PROMS/Volian.Print.Library/vlnParagraph.cs | 16 ++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 9927e0c1..35a0441f 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -171,6 +171,13 @@ namespace Volian.Print.Library return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page } if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level + bool doSectionTitleContinued = false; + if (MyItemInfo.InList(1148, 391)) Console.Write("Here"); + if (MyItemInfo.MyPrevious != null && !MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) + { + SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; + doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; + } // Document style: DSS_PageBreakHLS breaks on hls. if (MyItemInfo.IsHigh && (MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageBreakHLS) == E_DocStructStyle.DSS_PageBreakHLS) { @@ -267,7 +274,14 @@ namespace Volian.Print.Library // Keep figure (the only figure, i.e. count==1) with its parent. if (ChildrenBelow.Count == 1 && ChildrenBelow[0].MyItemInfo.IsFigure) KeepStepsOnPage = false; - + float sectionSpace = 0; + if (doSectionTitleContinued) + { + sectionSpace = 2 * SixLinesPerInch;// this should actuall use the physical size of the continue messsage. + yPageSizeNextPage -= sectionSpace; + yExtra -= sectionSpace; + yExtra2 -= sectionSpace; + } if (!KeepWithHeader && !KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break { // Don't want extra line before step @@ -450,6 +464,8 @@ namespace Volian.Print.Library // if this paragraph is flagged to pagebreakonstep (i.e. these are used by background documents // to get each hls/caution/note to be on its own page), then any of the children above should // also have the flag set and be added to the pagebreakonsteplist so that a break occurs. + if (MyItemInfo.InList(391)) + Console.WriteLine("here"); List PageBreakOnStepList = new List(); if (PageBreakOnStep) { diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 57d587ad..b4e4c526 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -1076,7 +1076,7 @@ namespace Volian.Print.Library if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) { SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y"); + doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; } MyPageHelper.YMultiplier = 1; break; @@ -1179,13 +1179,13 @@ namespace Volian.Print.Library else { SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y"); + doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; } } else { SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y"); + doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; } } if (!doSectionTitleContinued) @@ -1258,7 +1258,7 @@ namespace Volian.Print.Library if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) { SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; - doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y"); + doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; } } // if printing the section title, we already have the y location (note that only do this for the @@ -1321,14 +1321,18 @@ namespace Volian.Print.Library } float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); if (sectContPara.SectionContinuePrinted) - yPageStart -= sectContPara.Height * 2; + yPageStart -= sectContPara.Height + SixLinesPerInch; + else + Console.WriteLine("'No Header 1','{0}',{1},{2}",MyItemInfo.ShortPath,MyItemInfo.MyDocStyle.CancelSectTitle,MyItemInfo.MyDocStyle.SpecialStepsFoldout); } else { sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false); float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); if (sectContPara.SectionContinuePrinted) - yPageStart -= sectContPara.Height * 2; + yPageStart -= sectContPara.Height + SixLinesPerInch; + else + Console.WriteLine("'No Header 1','{0}',{1},{2}", MyItemInfo.ShortPath, MyItemInfo.MyDocStyle.CancelSectTitle, MyItemInfo.MyDocStyle.SpecialStepsFoldout); } } yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);