Ejemplo n.º 1
0
        private Paragraph ReadParagraphTextContent(Paragraph paragraph)
        {
            try
            {
                ArrayList mixedContent = new ArrayList();
                foreach (XmlNode nodeChild in paragraph.Node.ChildNodes)
                {
                    //Check for IText content first
                    TextContentProcessor tcp = new TextContentProcessor();
                    IText iText = tcp.CreateTextObject(this.Chart.Document, nodeChild.CloneNode(true));

                    if (iText != null)
                    {
                        mixedContent.Add(iText);
                    }
                    else
                    {
                        //Check against IContent
                        IContent iContent = this.CreateContent(nodeChild);

                        if (iContent != null)
                        {
                            mixedContent.Add(iContent);
                        }
                    }
                }

                //Remove all
                paragraph.Node.InnerXml = "";

                foreach (Object ob in mixedContent)
                {
                    if (ob is IText)
                    {
                        XmlNode node = this.Chart.ChartDoc.ImportNode(((IText)ob).Node, true);
                        paragraph.Node.AppendChild(node);
                    }
                    else if (ob is IContent)
                    {
                        //paragraph.Content.Add(ob as IContent);
                        AddToCollection(ob as IContent, paragraph.Content);
                    }
                    else
                    {
                        if (this.OnWarning != null)
                        {
                            AODLWarning warning = new AODLWarning("Couldn't determine the type of a paragraph child node!.");
                            //warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                            warning.Node = paragraph.Node;
                            this.OnWarning(warning);
                        }
                    }
                }
                return(paragraph);
            }
            catch (Exception ex)
            {
                throw new AODLException("Exception while trying to create the Paragraph content.", ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a deep clone of this XLink object.
        /// </summary>
        /// <remarks>A possible Attached Style wouldn't be cloned!</remarks>
        /// <returns>
        /// A clone of this object.
        /// </returns>
        public object Clone()
        {
            XLink xLinkClone = null;

            if (Document != null && Node != null)
            {
                TextContentProcessor tcp = new TextContentProcessor();
                xLinkClone = tcp.CreateXLink(Document, new XElement(Node));
            }

            return(xLinkClone);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a deep clone of this XLink object.
        /// </summary>
        /// <remarks>A possible Attached Style wouldn't be cloned!</remarks>
        /// <returns>
        /// A clone of this object.
        /// </returns>
        public object Clone()
        {
            XLink xLinkClone = null;

            if (this.Document != null && this.Node != null)
            {
                TextContentProcessor tcp = new TextContentProcessor();
                xLinkClone = tcp.CreateXLink(this.Document, this.Node.CloneNode(true));
            }

            return(xLinkClone);
        }
Ejemplo n.º 4
0
        private Paragraph ReadParagraphTextContent(Paragraph paragraph)
        {
            try
            {
                IList <IContent> mixedContent = new List <IContent>();
                foreach (XElement nodeChild in paragraph.Node.Elements())
                {
                    //Check for IText content first
                    TextContentProcessor tcp = new TextContentProcessor();
                    IText iText = tcp.CreateTextObject(Chart.Document, new XElement(nodeChild));

                    if (iText != null)
                    {
                        mixedContent.Add(iText);
                    }
                    else
                    {
                        //Check against IContent
                        IContent iContent = CreateContent(nodeChild);

                        if (iContent != null)
                        {
                            mixedContent.Add(iContent);
                        }
                    }
                }

                //Remove all
                paragraph.Node.Value = "";

                foreach (IContent ob in mixedContent)
                {
                    if (ob is IText)
                    {
                        XNode textNode = ob.Node;
                        paragraph.Node.Add(textNode is XText
                                               ? (XNode) new XText((XText)textNode)
                                               : new XElement((XElement)textNode));
                    }
                    else
                    {
                        //paragraph.Content.Add(ob as IContent);
                        AddToCollection(ob, paragraph.Content);
                    }
                }
                return(paragraph);
            }
            catch (Exception ex)
            {
                throw new AODLException("Exception while trying to create the Paragraph content.", ex);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Create a deep clone of this Bookmark object.
        /// </summary>
        /// <remarks>A possible Attached Style wouldn't be cloned!</remarks>
        /// <returns>
        /// A clone of this object.
        /// </returns>
        public object Clone()
        {
            Bookmark bookmarkClone = null;

            if (this.Document != null && this.Node != null)
            {
                TextContentProcessor tcp = new TextContentProcessor();
                bookmarkClone = tcp.CreateBookmark(
                    this.Document, this.Node.CloneNode(true), this.BookmarkType);
            }

            return(bookmarkClone);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Create a deep clone of this SimpleText object.
        /// </summary>
        /// <remarks>A possible Attached Style wouldn't be cloned!</remarks>
        /// <returns>
        /// A clone of this object.
        /// </returns>
        public object Clone()
        {
            SimpleText simpleTextClone = null;

            if (this.Document != null && this.Node != null)
            {
                TextContentProcessor tcp = new TextContentProcessor();
                simpleTextClone = (SimpleText)tcp.CreateTextObject(
                    this.Document, this.Node.CloneNode(true));
            }

            return(simpleTextClone);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Create a deep clone of this FormatedText object.
        /// </summary>
        /// <remarks>A possible Attached Style wouldn't be cloned!</remarks>
        /// <returns>
        /// A clone of this object.
        /// </returns>
        public object Clone()
        {
            FormatedText formatedTextClone = null;

            if (Document != null && Node != null)
            {
                TextContentProcessor tcp = new TextContentProcessor();
                formatedTextClone = tcp.CreateFormatedText(
                    Document, new XElement(Node));
            }

            return(formatedTextClone);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Create a deep clone of this FormatedText object.
        /// </summary>
        /// <remarks>A possible Attached Style wouldn't be cloned!</remarks>
        /// <returns>
        /// A clone of this object.
        /// </returns>
        public object Clone()
        {
            FormatedText formatedTextClone = null;

            if (this.Document != null && this.Node != null)
            {
                TextContentProcessor tcp = new TextContentProcessor();
                formatedTextClone = tcp.CreateFormatedText(
                    this.Document, this.Node.CloneNode(true));
            }

            return(formatedTextClone);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Create a deep clone of this SimpleText object.
        /// </summary>
        /// <remarks>A possible Attached Style wouldn't be cloned!</remarks>
        /// <returns>
        /// A clone of this object.
        /// </returns>
        public object Clone()
        {
            SimpleText simpleTextClone = null;

            if (Document != null && Node != null)
            {
                TextContentProcessor tcp = new TextContentProcessor();
                simpleTextClone = (SimpleText)tcp.CreateTextObject(
                    Document, new XText(Node));
            }

            return(simpleTextClone);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Create a deep clone of this Bookmark object.
        /// </summary>
        /// <remarks>A possible Attached Style wouldn't be cloned!</remarks>
        /// <returns>
        /// A clone of this object.
        /// </returns>
        public object Clone()
        {
            Bookmark bookmarkClone = null;

            if (Document != null && Node != null)
            {
                TextContentProcessor tcp = new TextContentProcessor();
                bookmarkClone = tcp.CreateBookmark(
                    Document, new XElement(Node), BookmarkType);
            }

            return(bookmarkClone);
        }