Add() private method

add node
private Add ( RTFNode node ) : void
node RTFNode node
return void
Exemplo n.º 1
0
 private void AddAllNodes(RTFNodeList list, bool IncludeGroupNode)
 {
     foreach (RTFNode node in myNodes)
     {
         if (node is RTFNodeGroup)
         {
             if (IncludeGroupNode)
             {
                 list.Add(node);
             }
             (( RTFNodeGroup )node).AddAllNodes(list, IncludeGroupNode);
         }
         else
         {
             list.Add(node);
         }
     }
 }
Exemplo n.º 2
0
 private void AddAllNodes(RTFNodeList list, bool includeGroupNode)
 {
     foreach (var node in MyNodes)
     {
         if (node is RTFNodeGroup)
         {
             if (includeGroupNode)
                 list.Add(node);
             ((RTFNodeGroup) node).AddAllNodes(list, includeGroupNode);
         }
         else
             list.Add(node);
     }
 }
Exemplo n.º 3
0
        internal void MergeText()
        {
            var list = new RTFNodeList();
            var myStr = new StringBuilder();
            var buffer = new ByteBuffer();
            //System.IO.MemoryStream ms = new System.IO.MemoryStream();
            //System.Text.Encoding encode = myOwnerDocument.Encoding ;
            foreach (var node in MyNodes)
            {
                if (node.Type == RTFNodeType.Text)
                {
                    AddString(myStr, buffer);
                    myStr.Append(node.Keyword);
                    continue;
                }
                if (node.Type == RTFNodeType.Control
                    && node.Keyword == "\'"
                    && node.HasParameter)
                {
                    buffer.Add((byte) node.Parameter);
                    continue;
                }
                if (node.Type == RTFNodeType.Control || node.Type == RTFNodeType.Keyword)
                {
                    if (node.Keyword == "tab")
                    {
                        AddString(myStr, buffer);
                        myStr.Append('\t');
                        continue;
                    }
                    if (node.Keyword == "emdash")
                    {
                        AddString(myStr, buffer);
                        // notice!! This code may cause compiler error in OS which not support chinese character.
                        // you can change to myStr.Append('-');
                        myStr.Append('j');
                        continue;
                    }
                    if (node.Keyword == "")
                    {
                        AddString(myStr, buffer);
                        // notice!! This code may cause compiler error in OS which not support chinese character.
                        // you can change to myStr.Append('-');
                        myStr.Append('Ƀ');
                        continue;
                    }
                }
                AddString(myStr, buffer);
                if (myStr.Length > 0)
                {
                    list.Add(new RTFNode(RTFNodeType.Text, myStr.ToString()));
                    myStr = new StringBuilder();
                }
                list.Add(node);
            } //foreach( RTFNode node in myNodes )

            AddString(myStr, buffer);
            if (myStr.Length > 0)
            {
                list.Add(new RTFNode(RTFNodeType.Text, myStr.ToString()));
            }
            MyNodes.Clear();
            foreach (var node in list)
            {
                node.Parent = this;
                node.OwnerDocument = MyOwnerDocument;
                MyNodes.Add(node);
            }
        }
Exemplo n.º 4
0
        internal void MergeText()
        {
            RTFNodeList list = new RTFNodeList();

            System.Text.StringBuilder myStr = new System.Text.StringBuilder();
            ByteBuffer buffer = new ByteBuffer();

            //System.IO.MemoryStream ms = new System.IO.MemoryStream();
            //System.Text.Encoding encode = myOwnerDocument.Encoding ;
            foreach (RTFNode node in myNodes)
            {
                if (node.Type == RTFNodeType.Text)
                {
                    AddString(myStr, buffer);
                    myStr.Append(node.Keyword);
                    continue;
                }
                if (node.Type == RTFNodeType.Control &&
                    node.Keyword == "\'" &&
                    node.HasParameter)
                {
                    buffer.Add(( byte )node.Parameter);
                    continue;
                }
                else if (node.Type == RTFNodeType.Control || node.Type == RTFNodeType.Keyword)
                {
                    if (node.Keyword == "tab")
                    {
                        AddString(myStr, buffer);
                        myStr.Append('\t');
                        continue;
                    }
                    if (node.Keyword == "emdash")
                    {
                        AddString(myStr, buffer);
                        // notice!! This code may cause compiler error in OS which not support chinese character.
                        // you can change to myStr.Append('-');
                        myStr.Append('j');
                        continue;
                    }
                    if (node.Keyword == "")
                    {
                        AddString(myStr, buffer);
                        // notice!! This code may cause compiler error in OS which not support chinese character.
                        // you can change to myStr.Append('-');
                        myStr.Append('Ƀ');
                        continue;
                    }
                }
                AddString(myStr, buffer);
                if (myStr.Length > 0)
                {
                    list.Add(new RTFNode(RTFNodeType.Text, myStr.ToString()));
                    myStr = new System.Text.StringBuilder();
                }
                list.Add(node);
            }            //foreach( RTFNode node in myNodes )

            AddString(myStr, buffer);
            if (myStr.Length > 0)
            {
                list.Add(new RTFNode(RTFNodeType.Text, myStr.ToString()));
            }
            myNodes.Clear();
            foreach (RTFNode node in list)
            {
                node.Parent        = this;
                node.OwnerDocument = myOwnerDocument;
                myNodes.Add(node);
            }
        }