if (logicalPageBox.isNormalFlowActive() == false)
{
// this is the first (the normal) flow. A document always starts
// with a start-document and then a start-flow event.
logicalPageBox.setNormalFlowActive(true);
final DefaultRenderableTextFactory textFactory = new DefaultRenderableTextFactory(layoutProcess);
textFactory.startText();
final FlowContext flowContext = new FlowContext
(textFactory, logicalPageBox.getNormalFlow());
flowContexts.push(flowContext);
}
else
{
// now check, what flow you are. A flow-top?
// position: running(header); New headers replace old ones.
// how to differentiate that (so that style-definitions are not that
// complicated.
// For now, we keep it simple. running(header) means go to header
final CSSValue value = context.getValue(PositioningStyleKeys.POSITION);
if (value instanceof CSSFunctionValue)
{
final CSSFunctionValue fnvalue = (CSSFunctionValue) value;
final CSSValue[] parameters = fnvalue.getParameters();
if (parameters.length > 0)
{
// Todo: Oh, thats so primitive ...
final CSSValue targetValue = parameters[0];
startHeaderFlow(targetValue.getCSSText(), context);
return;
}
}
// The receiving element would define the content property as
// 'content: elements(header)'
// an ordinary flow?
final BoxDefinition contentRoot =
boxDefinitionFactory.createBlockBoxDefinition
(context, layoutProcess.getOutputMetaData());
final NormalFlowRenderBox newFlow = new NormalFlowRenderBox(contentRoot);
newFlow.appyStyle(context, layoutProcess.getOutputMetaData());
newFlow.setPageContext(pageContext.getPageContext());
final RenderBox currentBox = getInsertationPoint();
currentBox.addChild(newFlow.getPlaceHolder());
currentBox.getNormalFlow().addFlow(newFlow);
final DefaultRenderableTextFactory textFactory =
new DefaultRenderableTextFactory(layoutProcess);
textFactory.startText();
final FlowContext flowContext = new FlowContext
(textFactory, newFlow);
flowContexts.push(flowContext);