Ejemplo n.º 1
0
        public void Copy(TextBodySelection textSel)
        {
            this.method_4(textSel.TextBody.Document);
            int itemStartIndex = textSel.ItemStartIndex;
            int itemEndIndex   = textSel.ItemEndIndex;

            for (int i = itemStartIndex; i <= itemEndIndex; i++)
            {
                BodyRegion entity = (BodyRegion)textSel.TextBody.Items[i].Clone();
                if ((i == itemStartIndex) || (i == itemEndIndex))
                {
                    if (entity.DocumentObjectType == DocumentObjectType.StructureDocumentTag)
                    {
                        if (i == itemStartIndex)
                        {
                            StructureDocumentTag tag = entity as StructureDocumentTag;
                            for (int j = textSel.ItemStartIndexInSDT - 1; j >= 0; j--)
                            {
                                tag.ChildObjects.InnerList.RemoveAt(j);
                            }
                            DocumentObject firstItem = tag.ChildObjects.FirstItem;
                            if (firstItem is Paragraph)
                            {
                                Paragraph paragraph3 = firstItem as Paragraph;
                                for (int k = textSel.ParagraphItemStartIndex - 1; k >= 0; k--)
                                {
                                    paragraph3.Items.InnerList.RemoveAt(k);
                                }
                            }
                        }
                        if (i == itemEndIndex)
                        {
                            StructureDocumentTag tag2 = entity as StructureDocumentTag;
                            int index = textSel.ItemEndIndexInSDT + 1;
                            while (index < tag2.ChildObjects.Count)
                            {
                                tag2.ChildObjects.InnerList.RemoveAt(index);
                            }
                            DocumentObject lastItem = tag2.ChildObjects.LastItem;
                            if (lastItem is Paragraph)
                            {
                                Paragraph paragraph = lastItem as Paragraph;
                                int       num5      = textSel.ParagraphItemEndIndex + 1;
                                while (num5 < paragraph.Items.Count)
                                {
                                    paragraph.Items.InnerList.RemoveAt(num5);
                                }
                            }
                        }
                    }
                    else if (entity.DocumentObjectType == DocumentObjectType.Paragraph)
                    {
                        Paragraph paragraph2 = entity as Paragraph;
                        if (i == itemEndIndex)
                        {
                            int num4 = textSel.ParagraphItemEndIndex + 1;
                            while (num4 < paragraph2.Items.Count)
                            {
                                paragraph2.Items.InnerList.RemoveAt(num4);
                            }
                        }
                        if (i == itemStartIndex)
                        {
                            for (int m = textSel.ParagraphItemStartIndex - 1; m >= 0; m--)
                            {
                                paragraph2.Items.InnerList.RemoveAt(m);
                            }
                        }
                    }
                }
                this.body_0.Items.Add(entity);
            }
        }
Ejemplo n.º 2
0
 public TextBodyPart(TextBodySelection textBodySelection)
 {
     this.Copy(textBodySelection);
 }