fix: Add space before bullet list if set in settings

This commit is contained in:
Georgy Litvinov 2021-10-15 20:17:46 +02:00
parent 8b676491fe
commit 334c569332

View file

@ -111,13 +111,13 @@ public class ListCounter {
}
public String getLabelAndSuffix() {
if (style != null && style.isNumber(nLevel)) {
String sLabel="";
if (style != null && style.isNumber(nLevel)) {
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; j<nLevel; j++) {
sLabel+=formatNumber(nCounter[j],sNumFormat[j],true)+".";
}
@ -125,14 +125,22 @@ public class ListCounter {
sLabel+=formatNumber(nCounter[nLevel],sNumFormat[nLevel],true);
if (sSuffix!=null) { sLabel+=sSuffix; }
if (sLabel.length()>0 && 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