public void FindBreakPoint(IVwGraphics vg, IVwTextSource _ts, IVwJustifier _vjus, int ichMin, int ichLim,
int ichLimBacktrack, bool fNeedFinalBreak, bool fStartLine, int dxMaxWidth, LgLineBreak lbPref,
LgLineBreak lbMax, LgTrailingWsHandling twsh, bool fParaRightToLeft,
out ILgSegment segRet, out int dichLimSeg, out int dxWidth, out LgEndSegmentType est, ILgSegment _segPrev)
{
MockSegment seg;
var key = new MockSegKey(ichMin, ichLim);
if (lbPref != LgLineBreak.klbClipBreak && m_failOnPartialLine.Contains(key))
{
// fail.
segRet = null;
dichLimSeg = 0;
dxWidth = 0;
est = LgEndSegmentType.kestNothingFit;
return;
}
if (m_potentialSegs.TryGetValue(key, out seg))
{
if (seg.Width < dxMaxWidth) // otherwise we meant it for the next line.
{
segRet = seg;
dichLimSeg = seg.get_Lim(ichMin);
dxWidth = seg.get_Width(ichMin, vg);
est = seg.EndSegType;
return;
}
}
switch(OtherSegPolicy)
{
case UnexpectedSegments.DontFit:
default: // to make compiler happy
Assert.AreNotEqual(LgLineBreak.klbClipBreak, lbMax,
"FindBreakPoint called with unexpected arguments.");
// If we aren't pre-prepared for the requested break, assume nothing fits with these arguments.
segRet = null;
dichLimSeg = 0;
dxWidth = 0;
est = LgEndSegmentType.kestNothingFit;
break;
case UnexpectedSegments.MakeOneCharSeg:
// Make a very narrow segment that will fit and allow more stuff. This will usually give a test failure if not intentional.
seg = new MockSegment(1, 2, 1, LgEndSegmentType.kestOkayBreak);
// If we aren't pre-prepared for the requested break, assume nothing fits with these arguments.
segRet = seg;
dichLimSeg = 1;
dxWidth = 2;
est = LgEndSegmentType.kestOkayBreak;
break;
}
}