Added logic to keep section headers with their steps.

This commit is contained in:
Rich 2015-02-24 19:45:12 +00:00
parent 7f923ff0c5
commit d761df73cd

View File

@ -10,6 +10,12 @@ namespace Volian.Print.Library
{ {
public partial class vlnParagraph public partial class vlnParagraph
{ {
private bool _BreakHighLevelStepWithSection = false;
public bool BreakHighLevelStepWithSection
{
get { return _BreakHighLevelStepWithSection; }
set { _BreakHighLevelStepWithSection = value; }
}
/// <summary> /// <summary>
/// This variable is used to match 16 bit pagination /// This variable is used to match 16 bit pagination
/// </summary> /// </summary>
@ -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; 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)) if (ySizeIncludingFirstStep < yWithinMargins && ySizeIncludingFirst > yWithinMargins && yWithinMargins > (yPageSize/2))
ySizeIncludingFirst = ySizeIncludingFirstStep; 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); ShowPageBreak(4, "Page Break Before Continuous Step Section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
return 1; 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 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) if (KeepStepsOnPage && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel && ySizeIncludingFirst > yWithinMargins)
KeepStepsOnPage = false; KeepStepsOnPage = false;
bool KeepWithHeader = isFirstChild && nearTheTop; 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 if (!ManualPageBreak && (mySize + yEndMsg <= yWithinMargins + yExtra) || // Don't Paginate if there is enough room, will fit on page
(mySize <= yWithinMargins + yExtra && SpecialCaseForRobinson())) (mySize <= yWithinMargins + yExtra && SpecialCaseForRobinson()))
//if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins + SixLinesPerInch) // Don't Paginate if there is enough room, will fit on page //if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins + SixLinesPerInch) // Don't Paginate if there is enough room, will fit on page