Exemplo n.º 1
0
        private void method_35()
        {
            string text = string.Empty;

            if ((this.Text != Class816.string_9) && this.Text.Contains(Class816.string_9))
            {
                ParagraphItemCollection items = (base.Owner is SDTInlineContent) ? (base.Owner as SDTInlineContent).Items : ((base.OwnerParagraph != null) ? base.OwnerParagraph.Items : null);
                if (items != null)
                {
                    int index = this.Text.IndexOf(Class816.string_9);
                    text = this.Text;
                    int       num    = items.IndexOf(this);
                    string    str2   = text.Substring(index + 1);
                    TextRange entity = base.Clone() as TextRange;
                    if (index > 0)
                    {
                        entity.Text = text.Substring(index);
                        this.Text   = text.Substring(0, index);
                    }
                    else if (str2 != string.Empty)
                    {
                        entity.Text = str2;
                        this.Text   = Class816.string_9;
                    }
                    items.Insert(num + 1, entity);
                }
            }
        }
 /// <summary>
 /// Iterates into paragraph items.
 /// </summary>
 /// <param name="paragraph">The paragraph.</param>
 /// <param name="fieldType">Type of field.</param>
 private void RemoveFieldCodesInParagraph(ParagraphItemCollection paraItems)
 {
     for (int i = 0; i < paraItems.Count; i++)
     {
         if (paraItems[i] is WField)
         {
             WField field = paraItems[i] as WField;
             field.Unlink();
         }
         else if (paraItems[i] is WTextBox)
         {
             //If paragraph item is textbox, iterates into textbody of textbox.
             WTextBox textBox = paraItems[i] as WTextBox;
             RemoveFieldCodesInTextBody(textBox.TextBoxBody);
         }
         else if (paraItems[i] is Shape)
         {
             //If paragraph item is shape, iterates into textbody of shape.
             Shape shape = paraItems[i] as Shape;
             RemoveFieldCodesInTextBody(shape.TextBody);
         }
         else if (paraItems[i] is InlineContentControl)
         {
             //If paragraph item is inline content control, iterates into its item.
             InlineContentControl inlineContentControl = paraItems[i] as InlineContentControl;
             RemoveFieldCodesInParagraph(inlineContentControl.ParagraphItems);
         }
     }
 }
Exemplo n.º 3
0
 internal void method_32(ParagraphItemCollection A_0)
 {
     if (this.SDTContent.Items.Count > 0)
     {
         for (int i = 0; i < this.SDTContent.Items.Count; i++)
         {
             if (this.SDTContent.Items[i] is StructureDocumentTagInline)
             {
                 (this.SDTContent.Items[i] as StructureDocumentTagInline).UpdateDataBinding();
                 (this.SDTContent.Items[i] as StructureDocumentTagInline).method_32(A_0);
             }
             else
             {
                 A_0.InnerList.Add(this.SDTContent.Items[i]);
             }
         }
     }
     else
     {
         TextRange range = (TextRange)base.Document.CreateParagraphItem(ParagraphItemType.TextRange);
         range.Text = "";
         range.CharacterFormat.ApplyBase(base.m_charFormat);
         A_0.InnerList.Add(range);
         range.OwnerEmptyParagraph = base.OwnerParagraph;
     }
 }
Exemplo n.º 4
0
        private void method_37()
        {
            string text = this.Text;

            if (!string.IsNullOrEmpty(text) && text.Contains(Class816.string_6))
            {
                int       index  = text.IndexOf(Class816.string_6);
                string    str2   = text.Substring(index + 1);
                TextRange entity = base.Clone() as TextRange;
                if (index > 0)
                {
                    entity.Text = text.Substring(index + 1);
                    this.Text   = text.Substring(0, index);
                }
                else if (str2 != string.Empty)
                {
                    entity.Text = str2;
                    this.Text   = string.Empty;
                }
                ParagraphItemCollection items = (base.Owner is SDTInlineContent) ? (base.Owner as SDTInlineContent).Items : ((base.OwnerParagraph != null) ? base.OwnerParagraph.Items : null);
                if (items != null)
                {
                    int   num    = base.method_5();
                    Break @break = new Break(base.Document, BreakType.LineBreak);
                    items.Insert(++num, @break);
                    if (index < (text.Length - 1))
                    {
                        items.Insert(++num, entity);
                    }
                }
            }
        }
Exemplo n.º 5
0
    internal static int smethod_2(SDTInlineContent A_0, Regex A_1, string A_2)
    {
        Paragraph ownerParagraph      = A_0.OwnerParagraph;
        ParagraphItemCollection items = A_0.Items;
        string          text          = A_0.Text;
        MatchCollection matchs        = A_1.Matches(text);

        if (matchs.Count > 0)
        {
            int num    = 0;
            int num2   = 0;
            int length = A_2.Length;
            int num4   = 0;
            int num5   = 0;
            foreach (Match match in matchs)
            {
                TextRange range2;
                num4 = match.Index + num;
                num5 = match.Length;
                num2 = length - match.Length;
                A_0.method_24(num4, num5, A_2);
                int num7 = Class191.smethod_4(A_0, num4 + 1, out range2);
                int num9 = range2.StartPos + range2.TextLength;
                range2.SafeText = false;
                if ((num9 <= (num4 + num5)) && ((range2.NextSibling == null) || (range2.NextSibling.DocumentObjectType == DocumentObjectType.TextRange)))
                {
                    ParagraphBase base2;
                    smethod_4(A_0, num4 + num5, num7 + 1, out base2);
                    int num8 = num4 + num5;
                    if (base2 is TextRange)
                    {
                        TextRange range = base2 as TextRange;
                        range.TextLength -= num8 - range.StartPos;
                        range.StartPos    = num8 + num2;
                        num7++;
                    }
                    range2.TextLength = (num8 + num2) - range2.StartPos;
                }
                else
                {
                    range2.TextLength += num2;
                }
                smethod_6(A_0, num7 + 1, num2);
                num += num2;
                if (ownerParagraph.Document.ReplaceFirst)
                {
                    break;
                }
            }
        }
        int count = matchs.Count;

        if (ownerParagraph.Document.ReplaceFirst && (count > 0))
        {
            return(count);
        }
        return(count + smethod_3(A_0, A_1, A_2));
    }
Exemplo n.º 6
0
    protected void method_9(ParagraphItemCollection A_0)
    {
        int num   = 0;
        int count = A_0.Count;

        while (num < count)
        {
            this.method_10(A_0[num]);
            num++;
        }
    }
Exemplo n.º 7
0
    private static void smethod_7(ParagraphItemCollection A_0, int A_1, int A_2)
    {
        int num   = A_1;
        int count = A_0.Count;

        while (num < count)
        {
            ParagraphBase base2 = A_0[num];
            base2.StartPos += A_2;
            num++;
        }
    }
Exemplo n.º 8
0
 internal override void Close()
 {
     base.Close();
     if (this.m_textBody != null)
     {
         this.m_textBody.method_28();
         this.m_textBody = null;
     }
     this.m_format                  = null;
     this.textBodyPart_0            = null;
     this.paragraphItemCollection_1 = null;
     this.commentsCollection_0      = null;
 }
Exemplo n.º 9
0
 public MergeField(IDocument doc) : base(doc)
 {
     this.m_fieldName               = "";
     this.string_18                 = "";
     this.string_19                 = "";
     this.string_22                 = "";
     this.string_23                 = "";
     this.string_24                 = "";
     base.m_paraItemType            = ParagraphItemType.MergeField;
     this.paragraphItemCollection_1 = new ParagraphItemCollection(doc as Document);
     this.paragraphItemCollection_1.method_0(this);
     base.m_fieldType = FieldType.FieldMergeField;
 }
Exemplo n.º 10
0
        protected override object CloneImpl()
        {
            Comment comment = (Comment)base.CloneImpl();

            comment.m_format   = this.Format.Clone(comment.Document);
            comment.m_textBody = (Spire.Doc.Body) this.Body.Clone();
            comment.m_textBody.method_0(comment);
            foreach (BodyRegion region in comment.Body.ChildObjects)
            {
                region.method_0(comment.m_textBody);
            }
            this.paragraphItemCollection_1 = null;
            this.textBodyPart_0            = null;
            return(comment);
        }
Exemplo n.º 11
0
        private CommentMark method_33(int A_0, int A_1, ParagraphItemCollection A_2)
        {
            ParagraphBase base2 = null;

            for (int i = A_0; i > 0; i--)
            {
                base2 = A_2[i];
                if (base2 is CommentMark)
                {
                    CommentMark mark2 = base2 as CommentMark;
                    if ((mark2.Type == CommentMarkType.CommentStart) && (mark2.CommentId == A_1))
                    {
                        return(mark2);
                    }
                }
            }
            return(null);
        }
Exemplo n.º 12
0
    private static void smethod_5(ParagraphItemCollection A_0, int A_1, int A_2, out ParagraphBase A_3)
    {
        int startPos = 0;

        A_3 = null;
        for (int i = A_2; i < A_0.Count; i++)
        {
            A_3      = A_0[i];
            startPos = A_3.StartPos;
            if (A_3 is TextRange)
            {
                TextRange range = A_3 as TextRange;
                startPos = range.StartPos + range.TextLength;
            }
            if (startPos >= A_1)
            {
                return;
            }
            A_0.method_23(i);
            i--;
        }
    }
Exemplo n.º 13
0
        private void method_43(ParagraphItemCollection A_0, string A_1, int A_2)
        {
            int num = 15;

            if (this.dictionary_0 == null)
            {
                this.dictionary_0 = new Dictionary <string, TextRange>();
            }
            string    key   = A_1 + BookmarkStart.b("樴", num) + A_2;
            TextRange range = null;

            if (this.dictionary_0.ContainsKey(key))
            {
                range = this.dictionary_0[key];
            }
            else
            {
                range = new TextRange(base.Document);
                range.CharacterFormat.ApplyBase(this.CharacterFormat);
                range.method_0(base.Owner);
                range.characterCategory_0 = this.CharacterCategory;
                range.StartPos            = A_2;
                range.int_4       = A_1.Length;
                range.string_9    = A_1;
                range.string_8    = A_1;
                range.textRange_0 = this;
                if (!string.IsNullOrEmpty(A_1))
                {
                    range.bool_12 = Class57.smethod_11(A_1[0]);
                    range.bool_13 = Class57.smethod_11(A_1[A_1.Length - 1]);
                    range.bool_14 = Class57.smethod_12(A_1[0]);
                    range.bool_15 = Class57.smethod_12(A_1[A_1.Length - 1]);
                    range.bool_10 = Class57.smethod_6(A_1[0]) == Spire.Doc.CharacterCategory.FarEast;
                    range.bool_11 = Class57.smethod_6(A_1[A_1.Length - 1]) == Spire.Doc.CharacterCategory.FarEast;
                }
                this.dictionary_0.Add(key, range);
            }
            A_0.InnerList.Add(range);
        }
Exemplo n.º 14
0
    public int method_0(Paragraph A_0, Regex A_1, string A_2)
    {
        int num = 0x12;
        ParagraphItemCollection items = A_0.Items;
        string          text          = A_0.Text;
        MatchCollection matchs        = A_1.Matches(text);

        if (matchs.Count > 0)
        {
            int num2   = 0;
            int num3   = 0;
            int length = A_2.Length;
            int num5   = 0;
            int num6   = 0;
            foreach (Match match in matchs)
            {
                ParagraphBase base2;
                num5 = match.Index + num2;
                num6 = match.Length;
                num3 = length - match.Length;
                A_0.method_66(num5, num6, A_2);
                TextRange entity = null;
                int       num9   = Class191.smethod_3(A_0, num5 + 1, out base2);
                if (base2 is TextRange)
                {
                    entity = base2 as TextRange;
                }
                else if (base2 is Break)
                {
                    entity = (base2 as Break).TextRange;
                }
                int num8 = entity.StartPos + entity.TextLength;
                entity.SafeText = false;
                if (num8 > (num5 + num6))
                {
                    entity.TextLength += num3;
                }
                else
                {
                    ParagraphBase base3;
                    this.method_5(A_0, num5 + num6, num9 + 1, out base3);
                    int num10 = num5 + num6;
                    if (base3 is TextRange)
                    {
                        TextRange range2 = base3 as TextRange;
                        range2.TextLength -= num10 - range2.StartPos;
                        range2.StartPos    = num10 + num3;
                        num9++;
                    }
                    entity.TextLength = (num10 + num3) - entity.StartPos;
                }
                this.method_6(A_0, num9 + 1, num3);
                num2 += num3;
                if (base2 is Break)
                {
                    int       index  = A_0.ChildObjects.IndexOf(base2);
                    TextRange range3 = new TextRange(entity.Document)
                    {
                        StartPos   = base2.StartPos,
                        TextLength = A_2.Length
                    };
                    range3.CharacterFormat.ApplyBase(base2.CharacterFormat.method_23());
                    A_0.ChildObjects.InnerList.RemoveAt(index);
                    A_0.ChildObjects.InnerList.Insert(index, range3);
                    range3.method_0(A_0);
                    entity = range3;
                }
                else if (((entity != null) && (entity.DocumentObjectType == DocumentObjectType.TextRange)) && (entity.Text == BookmarkStart.b("㌷", num)))
                {
                    int   num11  = A_0.ChildObjects.IndexOf(entity);
                    Break @break = new Break(entity.Document)
                    {
                        StartPos = entity.StartPos
                    };
                    A_0.ChildObjects.InnerList.RemoveAt(num11);
                    A_0.ChildObjects.InnerList.Insert(num11, @break);
                    @break.method_0(A_0);
                }
                if (entity != null)
                {
                    entity.method_39();
                }
                if (A_0.Document.ReplaceFirst)
                {
                    break;
                }
            }
        }
        int count = matchs.Count;

        if (A_0.Document.ReplaceFirst && (count > 0))
        {
            return(count);
        }
        return(count + smethod_1(A_0, A_1, A_2));
    }
Exemplo n.º 15
0
 internal void method_42(ParagraphItemCollection A_0)
 {
     if ((((this.CharacterCategory == Spire.Doc.CharacterCategory.FarEast) && (this.LetterOrDigitPosition.Count > 0)) && (((base.interface23_0 != null) && !base.interface23_0.imethod_4()) || (base.interface23_0 == null))) && (!(base.PreviousSibling is FieldMark) || !(base.NextSibling is FieldMark)))
     {
         string text       = this.Text;
         int    startPos   = this.StartPos;
         int    startIndex = 0;
         int    num3       = 0;
         int    count      = this.LetterOrDigitPosition.Count;
         while (num3 < count)
         {
             Class217 class2 = this.LetterOrDigitPosition[num3];
             Class217 class3 = null;
             if (num3 < (count - 1))
             {
                 class3 = this.LetterOrDigitPosition[num3 + 1];
             }
             if ((num3 == 0) && !class2.method_6())
             {
                 string str3 = text.Substring(startIndex, class2.method_2().Value);
                 this.method_43(A_0, str3, startPos);
                 startPos   += str3.Length;
                 startIndex += str3.Length;
                 str3        = text.Substring(startIndex, (class2.method_0().Value - class2.method_2().Value) + 1);
                 this.method_43(A_0, str3, startPos);
                 startPos   += str3.Length;
                 startIndex += str3.Length;
                 if (class3 == null)
                 {
                     str3 = text.Substring(startIndex);
                 }
                 else if ((class3.method_2().Value - class2.method_0().Value) > 1)
                 {
                     str3 = text.Substring(startIndex, (class3.method_2().Value - class2.method_0().Value) - 1);
                 }
                 if (str3.Length > 0)
                 {
                     this.method_43(A_0, str3, startPos);
                     startPos   += str3.Length;
                     startIndex += str3.Length;
                 }
             }
             else
             {
                 string str = text.Substring(startIndex, (class2.method_0().Value - class2.method_2().Value) + 1);
                 this.method_43(A_0, str, startPos);
                 startPos   += str.Length;
                 startIndex += str.Length;
                 if (class3 == null)
                 {
                     str = text.Substring(startIndex);
                 }
                 else if ((class3.method_2().Value - class2.method_0().Value) > 1)
                 {
                     str = text.Substring(startIndex, (class3.method_2().Value - class2.method_0().Value) - 1);
                 }
                 if (str.Length > 0)
                 {
                     this.method_43(A_0, str, startPos);
                     startPos   += str.Length;
                     startIndex += str.Length;
                 }
             }
             num3++;
         }
     }
     else
     {
         A_0.InnerList.Add(this);
     }
 }
Exemplo n.º 16
0
 protected ParagraphBase(Document doc) : base(doc, null)
 {
     this.paragraphItemCollection_0 = new ParagraphItemCollection(doc);
 }
Exemplo n.º 17
0
        internal void method_0(bool A_0, bool A_1)
        {
            int num = 1;

            if (this.CurrentBookmark == null)
            {
                throw new InvalidOperationException();
            }
            BookmarkStart bookmarkStart = this.CurrentBookmark.BookmarkStart;
            BookmarkEnd   bookmarkEnd   = this.CurrentBookmark.BookmarkEnd;

            if (bookmarkEnd != null)
            {
                Paragraph ownerParagraph = bookmarkStart.OwnerParagraph;
                Paragraph paragraph      = bookmarkEnd.OwnerParagraph;
                if (ownerParagraph.Owner != paragraph.Owner)
                {
                    throw new NotSupportedException(BookmarkStart.b("椦䘨弪ബ尮䐰䌲䔴堶䬸伺堼嬾慀❂⁄⭆ⱈ㽊⑌ⅎ㙐獒㙔㡖㝘⽚㡜ㅞᕠ䍢ݤɦᵨᱪ࡬੮ὰ卲᝴ᡶᙸၺၼṾꞆ권ﺚ膠펢쒤햦좨첪\udfac\uceae솰\udbb2\uc6b4", num));
                }
                Body owner = (Body)ownerParagraph.Owner;
                BodyRegionCollection regions = owner.Items;
                int index = ownerParagraph.method_5() + 1;
                if (ownerParagraph != paragraph)
                {
                    while (regions.Count > index)
                    {
                        if (regions[index] == paragraph)
                        {
                            break;
                        }
                        regions.RemoveAt(index);
                    }
                }
                ParagraphItemCollection items = ownerParagraph.Items;
                int num4 = bookmarkStart.method_5() + 1;
                if (A_0 && (items.Count > num4))
                {
                    TextRange range = items[num4] as TextRange;
                    if (range != null)
                    {
                        range.Text = "";
                        num4++;
                    }
                }
                while (items.Count > num4)
                {
                    if (items[num4] == bookmarkEnd)
                    {
                        break;
                    }
                    items.RemoveAt(num4);
                    if (this.int_1 > 0)
                    {
                        this.int_1--;
                    }
                }
                if (ownerParagraph != paragraph)
                {
                    int num2 = bookmarkEnd.method_5();
                    if (num2 != 0)
                    {
                        while (num2 < paragraph.Items.Count)
                        {
                            DocumentObject entity = paragraph.Items[num2];
                            ownerParagraph.Items.Add(entity);
                        }
                        paragraph.RemoveSelf();
                    }
                    else if (A_1)
                    {
                        if (num4 == 1)
                        {
                            ownerParagraph.RemoveSelf();
                            paragraph.Items.RemoveAt(num2);
                        }
                        if ((num4 == 2) && (items[0] is BookmarkEnd))
                        {
                            paragraph.Items.RemoveAt(num2);
                            BookmarkEnd end2 = items[0] as BookmarkEnd;
                            ((Paragraph)regions[index]).Items.Insert(0, end2);
                            ownerParagraph.RemoveSelf();
                        }
                    }
                }
            }
            if (this.document_0.Bookmarks.InnerList.Contains(this.CurrentBookmark))
            {
                this.MoveToBookmark(this.CurrentBookmark.Name, this.bool_0, this.bool_1);
            }
        }
Exemplo n.º 18
0
 private void method_36()
 {
     if (!this.bool_8)
     {
         string str = string.Empty;
         if (this.Text.Replace(Class816.string_4, Class816.string_27).Replace('\n', '\r').Contains(Class816.string_27))
         {
             ParagraphItemCollection items = (base.Owner is SDTInlineContent) ? (base.Owner as SDTInlineContent).Items : ((base.OwnerParagraph != null) ? base.OwnerParagraph.Items : null);
             if (items != null)
             {
                 TextRange entity = (this.textRange_0 != null) ? this.textRange_0 : this;
                 str = entity.Text.Replace(Class816.string_4, Class816.string_27).Replace('\n', '\r');
                 int       index  = str.IndexOf(Class816.string_27);
                 string    str2   = str.Substring(index + 1);
                 TextRange range2 = entity.Clone() as TextRange;
                 if ((this.textRange_0 != null) && (this.int_4 > 0))
                 {
                     this.int_4--;
                 }
                 if (index > 0)
                 {
                     range2.Text = str.Substring(index + 1);
                     entity.Text = str.Substring(0, index);
                 }
                 else if (str2 != string.Empty)
                 {
                     range2.Text = str2;
                     entity.Text = string.Empty;
                 }
                 if (str == Class816.string_27)
                 {
                     entity.Text = string.Empty;
                     range2.Text = string.Empty;
                 }
                 Paragraph paragraph2 = (base.Owner is SDTInlineContent) ? (base.Owner as SDTInlineContent).OwnerParagraph : base.OwnerParagraph;
                 Paragraph paragraph  = paragraph2.Clone() as Paragraph;
                 paragraph.method_57();
                 int num7 = paragraph2.method_5();
                 paragraph2.OwnerTextBody.Items.Insert(num7 + 1, paragraph);
                 (paragraph2.interface23_0 as Class213).method_38(false);
                 paragraph.Items.Add(range2);
                 int num2 = items.IndexOf(entity);
                 if (num2 > -1)
                 {
                     int num = (base.Document != null) ? base.Document.ClonedFields.Count : 0;
                     paragraph.method_67(items, num2 + 1);
                     int num5 = (base.Document != null) ? base.Document.ClonedFields.Count : 0;
                     int num4 = 0;
                     int num6 = num5 - num;
                     while (num4 < num6)
                     {
                         base.Document.ClonedFields.Pop();
                         num4++;
                     }
                     if (base.IsAddForIfField)
                     {
                         paragraph.IsAddForIfField = true;
                         base.m_doc.LayoutVariables.method_1().Add(paragraph);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 19
0
 internal SDTInlineContent(Document A_0, StructureDocumentTagInline A_1) : base(A_0, A_1)
 {
     this.stringBuilder_0           = new StringBuilder(1);
     this.paragraphItemCollection_0 = new ParagraphItemCollection(A_0);
     this.paragraphItemCollection_0.method_0(this);
 }