void JoinWithNextLine() { if (IsLastLine) { return; } // TextLineBox lowerLine = _textFlowLayer.GetTextLine(_currentLineNumber + 1); this.LocalSuspendLineReArrange(); int cx = 0; Run lastTextRun = this.LastRun; if (lastTextRun != null) { cx = lastTextRun.Right; } foreach (Run r in lowerLine._runs) { this.AddLast(r); Run.DirectSetLocation(r, cx, 0); cx += r.Width; } this.LocalResumeLineReArrange(); this.EndWithLineBreak = lowerLine.EndWithLineBreak; _textFlowLayer.Remove(lowerLine._currentLineNumber); }
public void AddLineBreakAfter(Run afterTextRun) { if (afterTextRun == null) { this.EndWithLineBreak = true; TextLineBox newline = _textFlowLayer.InsertNewLine(_currentLineNumber + 1); // if (_textFlowLayer.LineCount - 1 != newline.LineNumber) { newline.EndWithLineBreak = true; } } else if (afterTextRun.NextRun == null) { this.EndWithLineBreak = true; TextLineBox newline = _textFlowLayer.InsertNewLine(_currentLineNumber + 1); // if (_textFlowLayer.LineCount - 1 != newline.LineNumber) { newline.EndWithLineBreak = true; } } else { using (RunListPool.Borrow(out List <Run> tempTextRuns)) { if (afterTextRun != null) { foreach (Run t in GetRunIterForward(afterTextRun.NextRun)) { tempTextRuns.Add(t); } } bool thisEndWithLineBreak = this.EndWithLineBreak; this.EndWithLineBreak = true; this.LocalSuspendLineReArrange(); TextLineBox newTextline = _textFlowLayer.InsertNewLine(_currentLineNumber + 1); newTextline.EndWithLineBreak = thisEndWithLineBreak; // int j = tempTextRuns.Count; newTextline.LocalSuspendLineReArrange(); int cx = 0; for (int i = 0; i < j; ++i) { Run t = tempTextRuns[i]; this.Remove(t); newTextline.AddLast(t); Run.DirectSetLocation(t, cx, 0); cx += t.Width; } newTextline.LocalResumeLineReArrange(); this.LocalResumeLineReArrange(); } } }
public void LocalResumeLineReArrange() { _lineFlags &= ~LOCAL_SUSPEND_LINE_REARRANGE; LinkedListNode <Run> curNode = this.First; int cx = 0; while (curNode != null) { Run r = curNode.Value; Run.DirectSetLocation(r, cx, 0); cx += r.Width; curNode = curNode.Next; } }
public void RefreshInlineArrange() { Run r = this.FirstRun; int lastestX = 0; while (r != null) { Run.DirectSetLocation( r, lastestX, r.Top); lastestX += r.Width; r = r.NextRun; } }