private List CreateList(XmlNode listNode)
{
try
{
#region Old code Todo: delete
// string stylename = null;
// XmlNode stylenode = null;
// ListStyles liststyles = ListStyles.Bullet; //as default
// string paragraphstylename = null;
//
// if (outerlist == null)
// {
// stylename = this.GetStyleName(listNode.OuterXml);
// stylenode = this.GetAStyleNode("text:list-style", stylename);
// liststyles = this.GetListStyle(listNode);
// }
// List list = null;
//
// if (listNode.ChildNodes.Count > 0)
// {
// try
// {
// paragraphstylename = this.GetAValueFromAnAttribute(listNode.ChildNodes.Item(0).ChildNodes.Item(0), "@style:style-name");
// }
// catch(Exception ex)
// {
// paragraphstylename = "P1";
// }
// }
#endregion
//Create a new List
List list = new List(this._document, listNode);
ContentCollection iColl = new ContentCollection();
//Revieve the ListStyle
IStyle listStyle = this._document.Styles.GetStyleByName(list.StyleName);
if (listStyle != null)
list.Style = listStyle;
foreach(XmlNode nodeChild in list.Node.ChildNodes)
{
IContent iContent = this.CreateContent(nodeChild);
if (iContent != null)
AddToCollection(iContent, iColl);
//iColl.Add(iContent);
}
list.Node.InnerXml = "";
foreach(IContent iContent in iColl)
AddToCollection(iContent, list.Content);
//list.Content.Add(iContent);
return list;
}
catch(Exception ex)
{
throw new AODLException("Exception while trying to create a List.", ex);
}
}