If a blank paragraph is followed by a large table and both will not fit on a page, but the table will fit by itself, move the break directl in front of the table.

This commit is contained in:
Rich 2015-02-27 10:51:13 +00:00
parent 6d94bfb5f4
commit 0477c09d03

View File

@ -816,6 +816,8 @@ namespace Volian.Print.Library
// yTopNew is y Location of this page break. YTopMost is top of HLS, including any Cautions/Notes/Boxes/etc // yTopNew is y Location of this page break. YTopMost is top of HLS, including any Cautions/Notes/Boxes/etc
//float yTopNew = paraBreak.YVeryTop - YTopMost; //float yTopNew = paraBreak.YVeryTop - YTopMost;
//float yTopNew = paraBreak.YTopMost - YTopMost; //float yTopNew = paraBreak.YTopMost - YTopMost;
if (JustATableThatWillFit(paraBreak, yPageSize - (myTopMsgSpace + yEndMsg)))
paraBreak = paraBreak.ChildrenBelow[0];
float yTopNew = Math.Min(paraBreak.YTopMost, paraBreak.YVeryTop) - YTopMost; float yTopNew = Math.Min(paraBreak.YTopMost, paraBreak.YVeryTop) - YTopMost;
// This is for formats that break on all HLS, Cautions & Notes (often backgrounds): // This is for formats that break on all HLS, Cautions & Notes (often backgrounds):
@ -857,6 +859,21 @@ namespace Volian.Print.Library
} }
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
} }
private bool JustATableThatWillFit(vlnParagraph paraBreak, float ypagesize)
{
if (paraBreak.MyItemInfo.MyContent.Text.Replace(" ", "").Replace(@"\u160?", "").Replace(@"\'A0", "") != "") return false;
if (paraBreak.YSize < ypagesize) return false;
if (paraBreak.ChildrenAbove.Count > 0) return false;
if (paraBreak.ChildrenLeft.Count > 0) return false;
if (paraBreak.ChildrenRight.Count > 0) return false;
if (paraBreak.ChildrenBelow.Count != 1) return false;
if (!paraBreak.ChildrenBelow[0].MyItemInfo.IsTable) return false;
vlnParagraph paraTable = paraBreak.ChildrenBelow[0];
if (paraTable.YSize < ypagesize)
return true;
return false;
}
/// <summary> /// <summary>
/// Finds the highest StepLevel (lowest StepLevel number, 0 = HLS, 1 = first substep) that /// Finds the highest StepLevel (lowest StepLevel number, 0 = HLS, 1 = first substep) that
/// fills the page sufficiently (more than half-full) /// fills the page sufficiently (more than half-full)