示例#1
0
 /// <summary>
 /// overriding some of the ArrayList-methods
 /// </summary>
 /// <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);
     }
 }
示例#2
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.PARAGRAPH ||
             element.Type == Element.LIST ||
             element.Type == Element.CHUNK ||
             element.Type == Element.PHRASE ||
             element.Type == Element.ANCHOR ||
             element.Type == Element.ANNOTATION ||
             element.Type == Element.TABLE ||
             element.Type == Element.IMGTEMPLATE ||
             element.Type == Element.PTABLE ||
             element.Type == Element.GIF ||
             element.Type == Element.JPEG ||
             element.Type == Element.PNG ||
             element.Type == Element.IMGRAW)
         {
             base.Add(o);
             return(true);
         }
         else if (element.Type == Element.SECTION)
         {
             Section section = (Section)o;
             section.setNumbers(++subsections, numbers);
             base.Add(section);
             return(true);
         }
         else
         {
             throw new Exception(element.Type.ToString());
         }
     }
     catch (Exception cce) {
         throw new Exception("Insertion of illegal Element: " + cce.Message);
     }
 }