Пример #1
0
 /// <summary>
 /// Adds a Paragraph, List, Table or another Section
 /// to this Section.
 /// </summary>
 /// <param name="o">an object of type Paragraph, List, Table or another Section</param>
 /// <returns>a bool</returns>
 public new bool Add(Object o)
 {
     try
     {
         IElement element = (IElement)o;
         if (element.Type == Element.SECTION)
         {
             Section section = (Section)o;
             section.SetNumbers(++subsections, numbers);
             base.Add(section);
             return(true);
         }
         else if (o is MarkedSection && ((MarkedObject)o).element.Type == Element.SECTION)
         {
             MarkedSection mo      = (MarkedSection)o;
             Section       section = (Section)(mo.element);
             section.SetNumbers(++subsections, numbers);
             base.Add(mo);
             return(true);
         }
         else if (element.IsNestable())
         {
             base.Add(o);
             return(true);
         }
         else
         {
             throw new Exception(element.Type.ToString());
         }
     }
     catch (Exception cce)
     {
         throw new Exception("Insertion of illegal Element: " + cce.Message);
     }
 }