@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); }
private void addNumbering(Map<Integer, StyleListProperties> listPropertiesMap, int displayCount) { for (int i = 0; i < displayCount; i++) { StyleListProperties listProperties = StylableList.getListProperties(listPropertiesMap, i + 1); int value = headingNumbering.get(i); if (listProperties != null) { Chunk chunk = formatNumber(listProperties, value); addElement(chunk); } } }
public static int getFirst(Style style, int outlineLevel) { int first = 1; Map<Integer, StyleListProperties> listPropertiesMap = style != null ? style.getOutlinePropertiesMap() : null; if (listPropertiesMap != null) { StyleListProperties listProperties = StylableList.getListProperties(listPropertiesMap, outlineLevel); if (listProperties != null) { // start-value Integer startValue = listProperties.getStartValue(); if (startValue != null) { first = startValue; } } } return first; }