bool NeedsEndingOnNextArea(int idx, Renderer renderer, Area remainingArea, bool isFirstOnPage) { LayoutInfo layoutInfo = renderer.RenderInfo.LayoutInfo; if (isFirstOnPage && layoutInfo.KeepTogether) return false; FormatInfo formatInfo = renderer.RenderInfo.FormatInfo; if (!formatInfo.EndingIsComplete) return false; if (layoutInfo.KeepWithNext) { remainingArea = remainingArea.Lower(layoutInfo.ContentArea.Height); return NextElementsDontFit(idx, remainingArea, layoutInfo.MarginBottom); } return false; }
/// <summary> /// Indicates that a break between areas has to be performed before the element with the given idx. /// </summary> /// <param name="idx">Index of the document element.</param> /// <param name="renderer">A formatted renderer for the document element.</param> /// <param name="remainingArea">The remaining area.</param> bool IsForcedAreaBreak(int idx, Renderer renderer, Area remainingArea) { FormatInfo formatInfo = renderer.RenderInfo.FormatInfo; LayoutInfo layoutInfo = renderer.RenderInfo.LayoutInfo; if (formatInfo.IsStarting && !formatInfo.StartingIsComplete) return true; if (layoutInfo.KeepTogether && !formatInfo.IsComplete) return true; if (layoutInfo.KeepTogether && layoutInfo.KeepWithNext) { Area area = remainingArea.Lower(layoutInfo.ContentArea.Height); return NextElementsDontFit(idx, area, layoutInfo.MarginBottom); } return false; }