void AddLineBreakAfter(EditableRun afterTextRun) { if (afterTextRun == null) { //add line break on the last end this.EndWithLineBreak = true; EditableTextLine newline = EditableFlowLayer.InsertNewLine(_currentLineNumber + 1); // if (EditableFlowLayer.LineCount - 1 != newline.LineNumber) { newline.EndWithLineBreak = true; } } else 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.RunCount); 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); RenderElement.DirectSetLocation(t, cx, 0); cx += t.Width; } newTextline.LocalResumeLineReArrange(); this.LocalResumeLineReArrange(); } }
public void RefreshInlineArrange() { EditableRun r = this.FirstRun; int lastestX = 0; while (r != null) { RenderElement.DirectSetLocation( r, lastestX, r.Y); lastestX += r.Width; r = r.NextTextRun; } }