*/
public OdfTextList(OdfFileDom ownerDoc, String[] itemList,
char indentDelim, String listStyleName) {
super(ownerDoc);
OdfTextList[] listArray = new OdfTextList[10];
TextListItemElement listItem;
OdfTextParagraph para;
String item;
int level = 0;
int lastLevel = 0;
int lev; // loop counter
listArray[0] = this;
for (int i = 0; i < itemList.length; i++) {
level = 0;
item = itemList[i];
// determine level of indenting by counting delimiters,
// then get rid of the delimiters
while (level < item.length() && item.charAt(level) == indentDelim) {
level++;
}
item = item.substring(level);
if (level > lastLevel) // open the sub-levels
{
for (lev = lastLevel + 1; lev <= level; lev++) {
listArray[lev] = new OdfTextList(ownerDoc);
listArray[lev].setTextStyleNameAttribute(listStyleName);
}
} else if (level < lastLevel) // close off the intervening lists
{
closeLevels(ownerDoc, listArray, lastLevel, level);
}
// now that we are at the proper level, add the item.
listArray[level].setTextStyleNameAttribute(listStyleName);
listItem = new TextListItemElement(ownerDoc);
para = new OdfTextParagraph(ownerDoc);
para.setTextContent(item);
listItem.appendChild(para);
listArray[level].appendChild(listItem);
lastLevel = level;
}
// close off any remaining open lists