public void AddElement(IElement element) {
if (cellgroup) {
if (element is SimpleCell) {
if (((SimpleCell)element).Cellgroup) {
throw new BadElementException("You can't add one row to another row.");
}
content.Add(element);
return;
}
else {
throw new BadElementException("You can only add cells to rows, no objects of type " + element.GetType().ToString());
}
}
if (element.Type == Element.PARAGRAPH
|| element.Type == Element.PHRASE
|| element.Type == Element.ANCHOR
|| element.Type == Element.CHUNK
|| element.Type == Element.LIST
|| element.Type == Element.MARKED
|| element.Type == Element.JPEG
|| element.Type == Element.JPEG2000
|| element.Type == Element.JBIG2
|| element.Type == Element.IMGRAW
|| element.Type == Element.IMGTEMPLATE) {
content.Add(element);
}
else {
throw new BadElementException("You can't add an element of type " + element.GetType().ToString() + " to a SimpleCell.");
}
}