SetNumbers() private method

Sets the number of this section.
private SetNumbers ( int number, ArrayList numbers ) : void
number int the number of this section
numbers System.Collections.ArrayList an ArrayList, containing the numbers of the Parent
return void
Ejemplo n.º 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.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.JPEG ||
             element.Type == Element.PHRASE ||
             element.Type == Element.GRAPHIC ||
             element.Type == Element.ANCHOR ||
             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);
     }
 }
Ejemplo n.º 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(IElement element)
 {
     try {
         if (element.Type == Element.SECTION)
         {
             Section section = (Section)element;
             section.SetNumbers(++subsections, numbers);
             base.Add(section);
             return(true);
         }
         else if (element is MarkedSection && ((MarkedObject)element).element.Type == Element.SECTION)
         {
             MarkedSection mo      = (MarkedSection)element;
             Section       section = (Section)(mo.element);
             section.SetNumbers(++subsections, numbers);
             base.Add(mo);
             return(true);
         }
         else if (element.IsNestable())
         {
             base.Add(element);
             return(true);
         }
         else
         {
             throw new InvalidCastException(MessageLocalization.GetComposedMessage("you.can.t.add.a.1.to.a.section", element.Type.ToString()));
         }
     }
     catch (InvalidCastException cce) {
         throw new InvalidCastException(MessageLocalization.GetComposedMessage("insertion.of.illegal.element.1", cce.Message));
     }
 }
Ejemplo n.º 3
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);
     }
 }