Exemplo n.º 1
0
		/// <summary>
		/// given the bounds of cba, return the offset of the first character of the first segment break.
		/// If none was found, we return the EndOffset of the given cba.
		/// </summary>
		/// <param name="cba"></param>
		/// <param name="ichMinSegBreaksInPara"></param>
		/// <returns> the ichMin of the segment break marker falling within the offsets of cba.
		/// -1 if cba is null, but will return cba.EndOffset if it couldn't find a segment break in the cba range.</returns>
		private static int GetSegmentBreakInCbaRange(TsStringSegment cba, List<int> ichMinSegBreaksInPara)
		{
			if (cba == null)
				return -1;
			int ichMin = cba.BeginOffset;
			int ichLim = cba.EndOffset;
			return GetSegmentBreakInRange(ichMin, ichLim, ichMinSegBreaksInPara);
		}
Exemplo n.º 2
0
		private static void AdjustSegmentToNewSegmentBounds(ICmBaseAnnotation cbaToAdjust, TsStringSegment newSeg)
		{
			if (newSeg == null)
				return; // or Assert.Fail? should not happen, but be defensive.
			if (cbaToAdjust.BeginOffset != newSeg.BeginOffset)
				cbaToAdjust.BeginOffset = newSeg.BeginOffset;
			if (cbaToAdjust.EndOffset != newSeg.EndOffset)
				cbaToAdjust.EndOffset = newSeg.EndOffset;
		}
Exemplo n.º 3
0
		/// <summary>
		///
		/// </summary>
		/// <param name="cba"></param>
		/// <param name="segBreakBeginOffsetsAfterEdit"></param>
		/// <param name="segmentsAfterEdit"></param>
		/// <param name="closestSegAfterEdit">the dummy segment corresponding to cba in a list of dummy segments marking the bounds after the edit.</param>
		/// <param name="ichMinSegBreakAfterEdit">the ichMin of the segment break marker falling within the offsets of cba.
		/// -1 if cba is null, but will return cba.EndOffset if it couldn't find a segment break in the cba range.</param>
		private static void GetClosestSegmentInfoAfterEdit(ICmBaseAnnotation cba, List<int> segBreakBeginOffsetsAfterEdit, List<TsStringSegment> segmentsAfterEdit, out TsStringSegment closestSegAfterEdit, out int ichMinSegBreakAfterEdit)
		{
			closestSegAfterEdit = GetClosestSegment(cba, segmentsAfterEdit);
			ichMinSegBreakAfterEdit = GetSegmentBreakInCbaRange(closestSegAfterEdit, segBreakBeginOffsetsAfterEdit);
		}