Been busy attempting to complete the deferral mechanism.
By itself, not very complicated changes (only 2 affected classes), but all sorts of other issues keep arising... There is some progress, but not as much as I'd hoped.
It seems to require some more invasive refactoring than I had in mind.
One interesting scenario that keeps boggling me is:
-> a regular block with span="none", taking up a bit more than a page, followed by
-> a block with span="all" that, by itself, would take up exactly one page
The first block will be split, and leaves a deferred part, to which column-balancing should be applied.
I at least got that working for the minimized sample file. To my dismay, then noticed the original one (with two span changes on the last page) exhibits some other weirdness.
Apart from that, my current approach does not solve the case described above.
Since I do not yet process the trailing sequence until the preceding deferred part is processed, it seems I can no longer accurately determine the last page condition. hasMoreContent() has been refactored here, to take into account the deferred part, so the last page condition would never be reached (it will only return false if the breaker is currently processing the last part, so as long as there's still a deferred part...)
Using childFLM.isFinished() offers relief to trigger last page handling, but then this still requires at least running the trailing sequence through the algorithm /first/, to see if there is more than one page-break in combination with the deferred part. If not, only then can we safely add the deferred areas to what we know will be the last page.
If so, then we will have processed the deferred part three times. Once with the initial run, where the sequence is deferred. A second time to check whether it would cause a page-break in the following sequence, then a third time to actually add the areas.
Writing this, it becomes apparent that I'll probably have to go in the direction of instantiating the BreakingAlgorithm, but deferring it, rather than deferring the original block list...