diff --git a/src/main/java/w2phtml/office/ListCounter.java b/src/main/java/w2phtml/office/ListCounter.java index 44609a7..db8eb25 100644 --- a/src/main/java/w2phtml/office/ListCounter.java +++ b/src/main/java/w2phtml/office/ListCounter.java @@ -111,13 +111,13 @@ public class ListCounter { } public String getLabelAndSuffix() { + String sLabel=""; if (style != null && style.isNumber(nLevel)) { - String sLabel=""; if (sNumFormat[nLevel]==null) return ""; int nLevels = Misc.getPosInteger(style.getLevelProperty(nLevel, XMLString.TEXT_DISPLAY_LEVELS),1); - String sSuffix = style.getLevelProperty(nLevel,XMLString.STYLE_NUM_SUFFIX); - String sSpace = "nothing".equals(style.getLevelStyleProperty(nLevel, XMLString.TEXT_LABEL_FOLLOWED_BY)) ? "" : " "; + String sSuffix = getSuffix(); + String sSpace = getSpace(); for (int j=nLevel-nLevels+1; j0 && sSpace!=null) { sLabel+=sSpace; } - return sLabel; } else if (style != null && style.isBullet(nLevel)) { - return style.getLevelProperty(nLevel,XMLString.TEXT_BULLET_CHAR); + sLabel = style.getLevelProperty(nLevel,XMLString.TEXT_BULLET_CHAR); + String sSpace = getSpace(); + if (sLabel.length()>0 && sSpace!=null) { sLabel+=sSpace; } } - else { - return ""; - } + + return sLabel; } + + private String getSpace() { + return "nothing".equals(style.getLevelStyleProperty(nLevel, XMLString.TEXT_LABEL_FOLLOWED_BY)) ? "" : " "; + } + + private String getSuffix() { + return style.getLevelProperty(nLevel,XMLString.STYLE_NUM_SUFFIX); + } // Utility method to generate number private String formatNumber(int number,String sStyle,boolean bLetterSync) {