diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 0e214df0..bb8869e5 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -10,6 +10,12 @@ namespace Volian.Print.Library { public partial class vlnParagraph { + private bool _BreakHighLevelStepWithSection = false; + public bool BreakHighLevelStepWithSection + { + get { return _BreakHighLevelStepWithSection; } + set { _BreakHighLevelStepWithSection = value; } + } /// /// This variable is used to match 16 bit pagination /// @@ -168,11 +174,20 @@ namespace Volian.Print.Library float ySectionEndMsg = !_skipEndMessage && MyItemInfo.IsSection && MyItemInfo.Steps != null && MyItemInfo.Steps.Count == 1 && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0; if (ySizeIncludingFirstStep < yWithinMargins && ySizeIncludingFirst > yWithinMargins && yWithinMargins > (yPageSize/2)) ySizeIncludingFirst = ySizeIncludingFirstStep; - if (!KeepStepsOnPage && (ySizeIncludingFirst + ySectionEndMsg) > (yLocation - yBottomMargin)&& ! nearTheTop) + if (!KeepStepsOnPage && (ySizeIncludingFirst + ySectionEndMsg) > (yLocation - yBottomMargin) && !nearTheTop) { ShowPageBreak(4, "Page Break Before Continuous Step Section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); return 1; } + else + { + if (ChildrenBelow.Count > 0) + { + vlnParagraph firstHLS = ChildrenBelow[0]; + if (firstHLS.MyItemInfo.IsHigh) + firstHLS.BreakHighLevelStepWithSection = true; + } + } } return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page } @@ -240,6 +255,7 @@ namespace Volian.Print.Library if (KeepStepsOnPage && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel && ySizeIncludingFirst > yWithinMargins) KeepStepsOnPage = false; bool KeepWithHeader = isFirstChild && nearTheTop; + if (BreakHighLevelStepWithSection) KeepWithHeader = true; if (!ManualPageBreak && (mySize + yEndMsg <= yWithinMargins + yExtra) || // Don't Paginate if there is enough room, will fit on page (mySize <= yWithinMargins + yExtra && SpecialCaseForRobinson())) //if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins + SixLinesPerInch) // Don't Paginate if there is enough room, will fit on page