From 8c5703de652debda70feacb6df33df81180d94c7 Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 15 Aug 2014 22:31:30 +0000 Subject: [PATCH] Logic for page breaks before Condition/Response steps Logic for page breaks within Condition/Response steps --- PROMS/Volian.Print.Library/Pagination.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index baa6ad46..602c20e4 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -361,6 +361,15 @@ namespace Volian.Print.Library } // Console.WriteLine("{0},{1}", MyItemInfo.DBSequence, IsFirstSubStep(MyItemInfo)); //,instance); } + private bool ParentHasCalvertMacro + { + get + { + if (HasCalvertMacro) return true; + if (MyParent != null) return MyParent.ParentHasCalvertMacro; + return false; + } + } private void BuildPageBreakList(float ySpaceOnCurPage, float yPageSize, bool KeepStepsOnPage) { // if this paragraph is flagged to pagebreakonstep (i.e. these are used by background documents @@ -452,6 +461,17 @@ namespace Volian.Print.Library , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); break; } + // if first condition/response and the parent has caution, notes or warnings then move the break to the caution, note or warning + if (paraBreak.ParentHasCalvertMacro && paraBreak.MyParent.HasCalvertMacro && paraBreak.MyItemInfo.MyPrevious == null && paraBreak.MyParent.ChildrenAbove.Count > 0) + { + paraBreak = paraBreak.MyParent.ChildrenAbove[0]; + } + // If the lastbreak was part of a condition response and the location is part of a condition response account for the size of the footer. + if (lastBreak != null && lastBreak.ParentHasCalvertMacro && paraBreak.ParentHasCalvertMacro) + { + paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - 12 * 4, yLowerLimit, myList, paraBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, + myBottomMsgSpace,MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); + } if (lastBreak == paraBreak) { throw (new Exception(string.Format("Pagination Infinite Loop {0}",lastBreak.MyItemInfo.ShortPath)));