Ejemplo n.º 1
0
  @Override
  public void applyStyles(Style style) {
    super.applyStyles(style);

    int outlineLevel = headingNumbering.size();
    Map<Integer, StyleListProperties> listPropertiesMap = style.getOutlinePropertiesMap();
    if (listPropertiesMap != null) {
      int displayCount = 1;
      StyleListProperties listProperties =
          StylableList.getListProperties(listPropertiesMap, outlineLevel);
      if (listProperties != null) {
        // display-levels
        Integer displayLevels = listProperties.getDisplayLevels();
        if (displayLevels != null && displayLevels > 1) {
          displayCount = Math.min(displayLevels, outlineLevel);
        }
      }

      // add leading numbering ie 1.2.3.
      addNumbering(listPropertiesMap, displayCount);
    }

    // add implicit bookmark
    Chunk chunk = new Chunk(ODFUtils.TAB_STR);
    chunk.setLocalDestination(generateImplicitDestination(headingNumbering));
    addElement(chunk);
  }