void AddLineBreakAfter(EditableRun afterTextRun) { if (afterTextRun == null) { this.EndWithLineBreak = true; EditableTextLine newline = editableFlowLayer.InsertNewLine(currentLineNumber + 1); // if (editableFlowLayer.LineCount - 1 != newline.LineNumber) { newline.EndWithLineBreak = true; } return; } if (afterTextRun.NextTextRun == null) { this.EndWithLineBreak = true; EditableTextLine newline = editableFlowLayer.InsertNewLine(currentLineNumber + 1); // if (editableFlowLayer.LineCount - 1 != newline.LineNumber) { newline.EndWithLineBreak = true; } } else { List <EditableRun> tempTextRuns = new List <EditableRun>(this.Count); if (afterTextRun != null) { foreach (EditableRun t in GetVisualElementForward(afterTextRun.NextTextRun)) { tempTextRuns.Add(t); } } this.EndWithLineBreak = true; this.LocalSuspendLineReArrange(); EditableTextLine newTextline = editableFlowLayer.InsertNewLine(currentLineNumber + 1); // int j = tempTextRuns.Count; newTextline.LocalSuspendLineReArrange(); int cx = 0; for (int i = 0; i < j; ++i) { EditableRun t = tempTextRuns[i]; this.Remove(t); newTextline.AddLast(t); t.SetLocation(cx, 0); cx += t.Width; } newTextline.LocalResumeLineReArrange(); this.LocalResumeLineReArrange(); } }
public void RefreshInlineArrange() { EditableRun r = this.FirstRun; int lastestX = 0; while (r != null) { r.SetLocation( lastestX, r.Y); lastestX += r.Width; r = r.NextTextRun; } }
public void LocalResumeLineReArrange() { lineFlags &= ~LOCAL_SUSPEND_LINE_REARRANGE; LinkedListNode <EditableRun> curNode = this.First; int cx = 0; while (curNode != null) { EditableRun ve = curNode.Value; ve.SetLocation(cx, 0); cx += ve.Width; curNode = curNode.Next; } }