Inheritance: MarkedObject
Example #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(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));
     }
 }
Example #2
0
        /**
         * Creates a <CODE>Section</CODE>, add it to this <CODE>Section</CODE> and returns it.
         *
         * @param   numberDepth the numberDepth of the section
         * @return  a new Section object
         */
        virtual public MarkedSection AddSection(int numberDepth)
        {
            MarkedSection section = ((Section)element).AddMarkedSection();

            section.NumberDepth = numberDepth;
            return(section);
        }
Example #3
0
        /**
         * Creates a <CODE>Section</CODE>, adds it to this <CODE>Section</CODE> and returns it.
         *
         * @param   indentation the indentation of the new section
         * @return  a new Section object
         */

        virtual public MarkedSection AddSection(float indentation)
        {
            MarkedSection section = ((Section)element).AddMarkedSection();

            section.Indentation = indentation;
            return(section);
        }
Example #4
0
        /**
         * Adds a marked section. For use in class MarkedSection only!
         */
        public MarkedSection AddMarkedSection()
        {
            MarkedSection section = new MarkedSection(new Section(null, numberDepth + 1));

            Add(section);
            return(section);
        }
Example #5
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);
     }
 }
Example #6
0
        /**
         * Creates a <CODE>Section</CODE>, adds it to this <CODE>Section</CODE> and returns it.
         *
         * @param   indentation the indentation of the new section
         * @param   numberDepth the numberDepth of the section
         * @return  a new Section object
         */

        public MarkedSection AddSection(float indentation, int numberDepth)
        {
            MarkedSection section = ((Section)element).AddMarkedSection();

            section.Indentation = indentation;
            section.NumberDepth = numberDepth;
            return(section);
        }
Example #7
0
 /**
 * Adds a marked section. For use in class MarkedSection only!
 */
 public MarkedSection AddMarkedSection()
 {
     MarkedSection section = new MarkedSection(new Section(null, numberDepth + 1));
     Add(section);
     return section;
 }