protected void processInlineLevelNode(final RenderNode node) {
    if (lineBreakState.isInsideParagraph() == false) {
      throw new InvalidReportStateException(
          "A inline-level box outside of a paragraph box is not allowed.");
    }

    final int nodeType = node.getNodeType();
    if (nodeType == LayoutNodeTypes.TYPE_NODE_FINISHEDNODE) {
      final FinishedRenderNode finNode = (FinishedRenderNode) node;
      node.setCachedWidth(finNode.getLayoutedWidth());
      return;
    }

    if (nodeType == LayoutNodeTypes.TYPE_NODE_TEXT) {
      lineBreakState.add(TextSequenceElement.INSTANCE, node);
    } else if (nodeType == LayoutNodeTypes.TYPE_NODE_SPACER) {
      final StyleSheet styleSheet = node.getStyleSheet();
      if (WhitespaceCollapse.PRESERVE.equals(
              styleSheet.getStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE))
          && styleSheet.getBooleanStyleProperty(TextStyleKeys.TRIM_TEXT_CONTENT) == false) {
        // bug-alert: This condition could indicate a workaround for a logic-flaw in the
        // text-processor
        lineBreakState.add(SpacerSequenceElement.INSTANCE, node);
      } else if (lineBreakState.isContainsContent()) {
        lineBreakState.add(SpacerSequenceElement.INSTANCE, node);
      }
    } else {
      lineBreakState.add(InlineNodeSequenceElement.INSTANCE, node);
    }
  }
  protected boolean startInlineLevelBox(final RenderBox box) {
    if (lineBreakState.isInsideParagraph() == false) {
      throw new InvalidReportStateException(
          "A inline-level box outside of a paragraph box is not allowed.");
    }

    final int nodeType = box.getLayoutNodeType();
    if (nodeType == LayoutNodeTypes.TYPE_BOX_CONTENT) {
      lineBreakState.add(ReplacedContentSequenceElement.INSTANCE, box);
      return false;
    }

    lineBreakState.add(StartSequenceElement.INSTANCE, box);
    return true;
  }
  protected void finishInlineLevelBox(final RenderBox box) {
    if (lineBreakState.isInsideParagraph() == false) {
      throw new InvalidReportStateException(
          "A inline-level box outside of a paragraph box is not allowed.");
    }

    final int nodeType = box.getLayoutNodeType();
    if (nodeType == LayoutNodeTypes.TYPE_BOX_CONTENT) {
      return;
    }

    lineBreakState.add(EndSequenceElement.INSTANCE, box);
  }
  private boolean startLine(final RenderBox inlineRenderBox) {
    final MinorAxisParagraphBreakState breakState = getLineBreakState();
    if (breakState.isInsideParagraph() == false) {
      return false;
    }

    if (breakState.isSuspended()) {
      return false;
    }

    breakState.clear();
    breakState.add(StartSequenceElement.INSTANCE, inlineRenderBox);
    return true;
  }
  private void finishLine(
      final RenderBox inlineRenderBox,
      final MinorAxisNodeContext nodeContext,
      final MinorAxisParagraphBreakState breakState) {
    if (breakState.isInsideParagraph() == false || breakState.isSuspended()) {
      throw new IllegalStateException("No active breakstate, finish-line cannot continue.");
    }

    final PageGrid pageGrid = getPageGrid();
    final OutputProcessorMetaData metaData = getMetaData();
    breakState.add(EndSequenceElement.INSTANCE, inlineRenderBox);

    final ParagraphRenderBox paragraph = breakState.getParagraph();

    final ElementAlignment textAlignment = paragraph.getTextAlignment();
    final long textIndent = paragraph.getTextIndent();
    final long firstLineIndent = paragraph.getFirstLineIndent();
    // This aligns all direct childs. Once that is finished, we have to
    // check, whether possibly existing inner-paragraphs are still valid
    // or whether moving them violated any of the inner-pagebreak constraints.
    final TextAlignmentProcessor processor = create(textAlignment);

    final SequenceList sequence = breakState.getSequence();

    final long lineEnd;
    final boolean overflowX = paragraph.getStaticBoxLayoutProperties().isOverflowX();
    if (overflowX) {
      lineEnd = nodeContext.getX1() + OVERFLOW_DUMMY_WIDTH;
    } else {
      lineEnd = nodeContext.getX2();
    }

    long lineStart = Math.min(lineEnd, nodeContext.getX1() + firstLineIndent);
    if (lineEnd - lineStart <= 0) {
      final long minimumChunkWidth = paragraph.getPool().getMinimumChunkWidth();
      processor.initialize(
          metaData, sequence, lineStart, lineStart + minimumChunkWidth, pageGrid, overflowX);
      nodeContext.updateX2(lineStart + minimumChunkWidth);
      logger.warn("Auto-Corrected zero-width first-line on paragraph - " + paragraph.getName());
    } else {
      processor.initialize(metaData, sequence, lineStart, lineEnd, pageGrid, overflowX);
      if (overflowX == false) {
        nodeContext.updateX2(lineEnd);
      }
    }

    while (processor.hasNext()) {
      final RenderNode linebox = processor.next();
      if (linebox.getLayoutNodeType() != LayoutNodeTypes.TYPE_BOX_LINEBOX) {
        throw new IllegalStateException("Line must not be null");
      }

      paragraph.addGeneratedChild(linebox);

      if (processor.hasNext()) {
        lineStart = Math.min(lineEnd, nodeContext.getX1() + textIndent);

        if (lineEnd - lineStart <= 0) {
          final long minimumChunkWidth = paragraph.getPool().getMinimumChunkWidth();
          processor.updateLineSize(lineStart, lineStart + minimumChunkWidth);
          nodeContext.updateX2(lineStart + minimumChunkWidth);
          logger.warn(
              "Auto-Corrected zero-width text-line on paragraph continuation - "
                  + paragraph.getName());
        } else {
          processor.updateLineSize(lineStart, lineEnd);
          if (overflowX == false) {
            nodeContext.updateX2(lineEnd);
          }
        }
      }
    }

    processor.deinitialize();
  }