SIL.FieldWorks.SharpViews.SharpViewsTests.MockRenderEngine.FindBreakPoint C# (CSharp) Method

FindBreakPoint() public method

public 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, ILgSegment &segRet, int &dichLimSeg, int &dxWidth, LgEndSegmentType &est, ILgSegment _segPrev ) : void
vg IVwGraphics
_ts IVwTextSource
_vjus IVwJustifier
ichMin int
ichLim int
ichLimBacktrack int
fNeedFinalBreak bool
fStartLine bool
dxMaxWidth int
lbPref LgLineBreak
lbMax LgLineBreak
twsh LgTrailingWsHandling
fParaRightToLeft bool
segRet ILgSegment
dichLimSeg int
dxWidth int
est LgEndSegmentType
_segPrev ILgSegment
return void
		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;
			}
		}