From ac7083febd2907727ccd1fe57f6ae65f4699cf6b Mon Sep 17 00:00:00 2001 From: Rich Date: Mon, 31 Mar 2014 16:39:26 +0000 Subject: [PATCH] Changed logic for ComponentList Page Breaks If a page break in the RNO column falls within the range of an AER step, use the AER Step for the page break. Dont break at the first substep if the first substep is an OR or Explicit AND --- PROMS/Volian.Print.Library/Pagination.cs | 21 +++++++++++++++++++++ PROMS/Volian.Print.Library/vlnParagraph.cs | 7 ++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 96146123..9341f80b 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -184,6 +184,12 @@ namespace Volian.Print.Library //if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins) // Don't Paginate if there is enough room, will fit on page // Pagination Fix - Break1LineShort1 float yExtra = (yWithinMargins == yPageSize ? 0 : SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0; + // Adjust yExtra and mySize for Component List items. + if (MyItemInfo.ActiveSection.MyDocStyle.ComponentList && yExtra > 0) + { + yExtra = 0; + if (mySize < Height) mySize = Height * MyPageHelper.YMultiplier; + } float yExtra2 = (SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0; if (KeepStepsOnPage && ySizeIncludingFirst > yWithinMargins) KeepStepsOnPage = false; @@ -421,6 +427,21 @@ namespace Volian.Print.Library { throw (new Exception(string.Format("Pagination Infinite Loop {0}",lastBreak.MyItemInfo.ShortPath))); } + // If the paraBreak is in an RNO and the location of the RNO is within the range of the AER parent, then break on the AER. + if (paraBreak.MyItemInfo.IsInRNO) + { + vlnParagraph aerParent = paraBreak.MyParent; + while (aerParent.MyItemInfo.IsInRNO) aerParent = aerParent.MyParent; + if (aerParent.YOffset + aerParent.Height > paraBreak.YOffset) + { + if (aerParent.ChildrenAbove != null && aerParent.ChildrenAbove.Count > 0) // If the aerParent has caution or note + aerParent = aerParent.ChildrenAbove[0];//, break on the caution or note. + if (aerParent != lastBreak) + { + paraBreak = aerParent; + } + } + } // If the break is going to happen on a table, and the tables parent would fit on a page with the table // and the text in the parent includes the word table, then break on the parent //if (lastBreak != paraBreak.MyParent && paraBreak.MyItemInfo.IsTable && paraBreak.YSize < ySpaceOnCurPage && paraBreak.MyParent.MyItemInfo.DisplayText.ToUpper().Contains("TABLE")) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 54dd16a0..080f73d2 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -1331,7 +1331,12 @@ namespace Volian.Print.Library vlnParagraph para = this; if (!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.PaginateOnFirstSubstep && ChildrenBelow != null && ChildrenBelow.Count > 0) { - para = ChildrenBelow[0].GetFirstPieceLastPart(); + // If the substep has a separator (OR, AND) then return the last substep rather than the first. + string mySep = ChildrenBelow[0].MyItemInfo.FormatStepData.Sep ?? "{Null}"; + if (mySep != "{Null}" && mySep != "") + para = ChildrenBelow[ChildrenBelow.Count - 1].GetFirstPieceLastPart(); + else + para = ChildrenBelow[0].GetFirstPieceLastPart(); } if (ChildrenRight != null && ChildrenRight.Count > 0) {