Inheritance: EditableRun
Exemplo n.º 1
0
        public EditableRun CreateEditableTextRun(char[] charBuffer)
        {
            var span = new EditableTextRun(this.Root, charBuffer, this.currentSpanStyle);

            span.UpdateRunWidth();
            return(span);
        }
Exemplo n.º 2
0
        public EditableRun CreateEditableTextRun(string str)
        {
            var span = new EditableTextRun(this.Root, str, this.currentSpanStyle);

            span.UpdateRunWidth();
            return(span);
        }
Exemplo n.º 3
0
 EditableRun MakeTextRun(int sourceIndex, int length)
 {
     if (length > 0)
     {
         EditableRun newTextRun = null;
         char[]      newContent = new char[length];
         Array.Copy(this.mybuffer, sourceIndex, newContent, 0, length);
         newTextRun             = new EditableTextRun(this.Root, newContent, this.SpanStyle);
         newTextRun.IsLineBreak = this.IsLineBreak;
         newTextRun.UpdateRunWidth();
         return(newTextRun);
     }
     else
     {
         throw new Exception("string must be null or zero length");
     }
 }
Exemplo n.º 4
0
 EditableRun MakeTextRun(int sourceIndex, int length)
 {
     if (length > 0)
     {
         EditableRun newTextRun = null;
         char[] newContent = new char[length];
         Array.Copy(this.mybuffer, sourceIndex, newContent, 0, length);
         newTextRun = new EditableTextRun(this.Root, newContent, this.SpanStyle);
         newTextRun.IsLineBreak = this.IsLineBreak;
         newTextRun.UpdateRunWidth();
         return newTextRun;
     }
     else
     {
         throw new Exception("string must be null or zero length");
     }
 }
Exemplo n.º 5
0
        public void AddCharacter(char c)
        {
            if (CurrentLine.IsBlankLine)
            {
                //1. new
                EditableRun t = new EditableTextRun(this.Root,
                                                    c,
                                                    this.CurrentSpanStyle);

                var owner = this.FlowLayer.OwnerRenderElement;

                CurrentLine.AddLast(t);

                SetCurrentTextRun(t);
            }
            else
            {
                EditableRun cRun = CurrentTextRun;
                if (cRun != null)
                {
                    if (cRun.IsInsertable)
                    {
                        cRun.InsertAfter(CurrentTextRunCharIndex, c);
                    }
                    else
                    {
                        AddTextSpan(new EditableTextRun(this.Root, c, this.CurrentSpanStyle));
                        return;
                    }
                }
                else
                {
                    throw new NotSupportedException();
                }
            }

            CurrentLine.TextLineReCalculateActualLineSize();
            CurrentLine.RefreshInlineArrange();

            CharIndex++;
        }
Exemplo n.º 6
0
        public void SplitToNewLine()
        {
            EditableRun lineBreakRun = new EditableTextRun(this.Root, '\n', this.CurrentSpanStyle);
            EditableRun currentRun   = CurrentTextRun;

            if (CurrentLine.IsBlankLine)
            {
                CurrentLine.AddLast(lineBreakRun);
            }
            else
            {
                if (CharIndex == -1)
                {
                    CurrentLine.AddFirst(lineBreakRun);
                    SetCurrentTextRun(null);
                }
                else
                {
                    EditableRun rightSplitedPart = EditableRun.InnerRemove(currentRun,
                                                                           CurrentTextRunCharIndex + 1, true);
                    if (rightSplitedPart != null)
                    {
                        CurrentLine.AddAfter(currentRun, rightSplitedPart);
                    }
                    CurrentLine.AddAfter(currentRun, lineBreakRun);

                    if (currentRun.CharacterCount == 0)
                    {
                        CurrentLine.Remove(currentRun);
                    }
                }
            }


            this.TextLayer.TopDownReCalculateContentSize();
            EnsureCurrentTextRun();
        }
 public EditableRun CreateEditableTextRun(char[] charBuffer)
 {
     var span = new EditableTextRun(this.Root, charBuffer, this.currentSpanStyle);
     span.UpdateRunWidth();
     return span;
 }
 public EditableRun CreateEditableTextRun(string str)
 {
     var span = new EditableTextRun(this.Root, str, this.currentSpanStyle);
     span.UpdateRunWidth();
     return span;
 }
Exemplo n.º 9
0
        public void SplitToNewLine()
        {
            EditableRun lineBreakRun = new EditableTextRun(this.Root, '\n', this.CurrentSpanStyle);
            EditableRun currentRun = CurrentTextRun;
            if (CurrentLine.IsBlankLine)
            {
                CurrentLine.AddLast(lineBreakRun);
            }
            else
            {
                if (CharIndex == -1)
                {
                    CurrentLine.AddFirst(lineBreakRun);
                    SetCurrentTextRun(null);
                }
                else
                {
                    EditableRun rightSplitedPart = EditableRun.InnerRemove(currentRun,
                        CurrentTextRunCharIndex + 1, true);
                    if (rightSplitedPart != null)
                    {
                        CurrentLine.AddAfter(currentRun, rightSplitedPart);
                    }
                    CurrentLine.AddAfter(currentRun, lineBreakRun);
                    if (currentRun.CharacterCount == 0)
                    {
                        CurrentLine.Remove(currentRun);
                    }
                }
            }


            this.TextLayer.TopDownReCalculateContentSize();
            EnsureCurrentTextRun();
        }
Exemplo n.º 10
0
        public void AddCharacter(char c)
        {
            if (CurrentLine.IsBlankLine)
            {
                //1. new 
                EditableRun t = new EditableTextRun(this.Root,
                    c,
                    this.CurrentSpanStyle);
                var owner = this.FlowLayer.OwnerRenderElement;
                CurrentLine.AddLast(t);
                SetCurrentTextRun(t);
            }
            else
            {
                EditableRun cRun = CurrentTextRun;
                if (cRun != null)
                {
                    if (cRun.IsInsertable)
                    {
                        cRun.InsertAfter(CurrentTextRunCharIndex, c);
                    }
                    else
                    {
                        AddTextSpan(new EditableTextRun(this.Root, c, this.CurrentSpanStyle));
                        return;
                    }
                }
                else
                {
                    throw new NotSupportedException();
                }
            }

            CurrentLine.TextLineReCalculateActualLineSize();
            CurrentLine.RefreshInlineArrange();
            CharIndex++;
        }