Пример #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);
            }
        }
Пример #2
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);
            }
        }
Пример #3
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);
        }
Пример #4
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);
        }