final OutputProcessor outputProcessor = getOutputProcessor();
// next: perform pagination.
final LogicalPageBox pageBox = getPageBox();
// final long sizeBeforePagination = pageBox.getHeight();
//final LogicalPageBox clone = (LogicalPageBox) pageBox.deriveForAdvance(true);
final PaginationResult pageBreak = paginationStep.performPagebreak(pageBox);
if (pageBreak.isOverflow() == false && pageBox.isOpen())
{
return false;
}
setLastStateKey(pageBreak.getLastVisibleState());
// final long sizeAfterPagination = pageBox.getHeight();
setPagebreaks(getPagebreaks() + 1);
pageBox.setAllVerticalBreaks(pageBreak.getAllBreaks());
flowCount += 1;
debugPrint(pageBox);
// A new page has been started. Recover the page-grid, then restart
// everything from scratch. (We have to recompute, as the pages may
// be different now, due to changed margins or page definitions)
final long nextOffset = pageBox.computePageEnd();
pageBox.setPageEnd(nextOffset);
final long pageOffset = pageBox.getPageOffset();
if (performOutput)
{
if (outputProcessor.isNeedAlignedPage())
{
final LogicalPageBox box = fillPhysicalPagesStep.compute(pageBox, pageOffset, nextOffset);
logger.debug("Processing contents for Page " + flowCount + " Page-Offset: " + pageOffset + " -> " + nextOffset);
outputProcessor.processContent(box);
}
else
{
logger.debug("Processing fast contents for Page " + flowCount + " Page-Offset: " + pageOffset + " -> " + nextOffset);
outputProcessor.processContent(pageBox);
}
}
else
{
logger.debug("Recomputing contents for Page " + flowCount + " Page-Offset: " + pageOffset + " -> " + nextOffset);
outputProcessor.processRecomputedContent(pageBox);
}
// Now fire the pagebreak. This goes through all layers and informs all
// components, that a pagebreak has been encountered and possibly a
// new page has been set. It does not save the state or perform other
// expensive operations. However, it updates the 'isPagebreakEncountered'
// flag, which will be active until the input-feed received a new event.
// Log.debug("PageTime " + (currentPageAge - lastPageAge));
final boolean repeat = pageBox.isOpen() || pageBreak.isOverflow();
if (repeat)
{
// pageBox.setAllVerticalBreaks(pageBreak.getAllBreaks());
// First clean all boxes that have been marked as finished. This reduces the overall complexity of the
// pagebox and improves performance on huge reports.
countBoxesStep.process(pageBox);
cleanFlowBoxesStep.compute(pageBox);
//cleanPaginatedBoxesStep.compute(pageBox);
pageBox.setPageOffset(nextOffset);
// todo PRD-4606
pageBox.resetCacheState(true);
if (pageBreak.isNextPageContainsContent())
{
if (layoutPagebreakHandler != null)
{
layoutPagebreakHandler.pageStarted();
}