* @throws DocumentException
*/
private void writeList(com.lowagie.text.List list, ByteArrayOutputStream out) throws IOException, DocumentException {
int type = 0;
int align = 0;
int fontNr = addFont(new Font(Font.SYMBOL, 10, Font.NORMAL, new Color(0, 0, 0)));
if (!list.isNumbered()) type = 23;
if (listLevel == 0) {
maxListLevel = 0;
listtable.write(openGroup);
listtable.write(escape);
listtable.write(listDefinition);
int i = getRandomInt();
listtable.write(escape);
listtable.write(listTemplateID);
writeInt(listtable, i);
listtable.write(escape);
listtable.write(hybridList);
listtable.write((byte) '\n');
}
if (listLevel >= maxListLevel) {
maxListLevel++;
listtable.write(openGroup);
listtable.write(escape);
listtable.write(listLevelDefinition);
listtable.write(escape);
listtable.write(listLevelTypeOld);
writeInt(listtable, type);
listtable.write(escape);
listtable.write(listLevelTypeNew);
writeInt(listtable, type);
listtable.write(escape);
listtable.write(listLevelAlignOld);
writeInt(listtable, align);
listtable.write(escape);
listtable.write(listLevelAlignNew);
writeInt(listtable, align);
listtable.write(escape);
listtable.write(listLevelStartAt);
writeInt(listtable, 1);
listtable.write(openGroup);
listtable.write(escape);
listtable.write(listLevelTextDefinition);
listtable.write(escape);
listtable.write(listLevelTextLength);
if (list.isNumbered()) {
writeInt(listtable, 2);
} else {
writeInt(listtable, 1);
}
listtable.write(escape);
if (list.isNumbered()) {
listtable.write(listLevelTextStyleNumbers);
} else {
listtable.write(listLevelTextStyleBullet);
}
listtable.write(commaDelimiter);
listtable.write(closeGroup);
listtable.write(openGroup);
listtable.write(escape);
listtable.write(listLevelNumbersDefinition);
if (list.isNumbered()) {
listtable.write(delimiter);
listtable.write(listLevelNumbers);
writeInt(listtable, listLevel + 1);
}
listtable.write(commaDelimiter);
listtable.write(closeGroup);
if (!list.isNumbered()) {
listtable.write(escape);
listtable.write(fontNumber);
writeInt(listtable, fontNr);
}
listtable.write(escape);
listtable.write(firstIndent);
writeInt(listtable, (int) (list.getIndentationLeft() * TWIPSFACTOR * -1));
listtable.write(escape);
listtable.write(listIndent);
writeInt(listtable, (int) ((list.getIndentationLeft() + list.getSymbolIndent()) * TWIPSFACTOR));
listtable.write(escape);
listtable.write(rightIndent);
writeInt(listtable, (int) (list.getIndentationRight() * TWIPSFACTOR));
listtable.write(escape);
listtable.write(tabStop);
writeInt(listtable, (int) (list.getSymbolIndent() * TWIPSFACTOR));
listtable.write(closeGroup);
listtable.write((byte) '\n');
}
// Actual List Begin in Content
out.write(escape);
out.write(paragraphDefaults);
out.write(escape);
out.write(alignLeft);
out.write(escape);
out.write(firstIndent);
writeInt(out, (int) (list.getIndentationLeft() * TWIPSFACTOR * -1));
out.write(escape);
out.write(listIndent);
writeInt(out, (int) ((list.getIndentationLeft() + list.getSymbolIndent()) * TWIPSFACTOR));
out.write(escape);
out.write(rightIndent);
writeInt(out, (int) (list.getIndentationRight() * TWIPSFACTOR));
out.write(escape);
out.write(fontSize);
writeInt(out, 20);
out.write(escape);
out.write(listBegin);
writeInt(out, currentListID);
if (listLevel > 0) {
out.write(escape);
out.write(listCurrentLevel);
writeInt(out, listLevel);
}
out.write(openGroup);
ListIterator listItems = list.getItems().listIterator();
Element listElem;
int count = 1;
while (listItems.hasNext()) {
listElem = (Element) listItems.next();
if (listElem.type() == Element.CHUNK) {
listElem = new ListItem((Chunk) listElem);
}
if (listElem.type() == Element.LISTITEM) {
out.write(openGroup);
out.write(escape);
out.write(listTextOld);
out.write(escape);
out.write(paragraphDefaults);
out.write(escape);
out.write(fontNumber);
if (list.isNumbered()) {
writeInt(out, addFont(new Font(Font.TIMES_ROMAN, Font.NORMAL, 10, new Color(0, 0, 0))));
} else {
writeInt(out, fontNr);
}
out.write(escape);
out.write(firstIndent);