/// <summary>
 ///
 /// </summary>
 /// <param name="hvoOwn"></param>
 /// <param name="flid"></param>
 /// <param name="hvo"></param>
 /// <returns></returns>
 public int GetObjIndex(int hvoOwn, int flid, int hvo)
 {
     return(m_sda.GetObjIndex(hvoOwn, flid, hvo));
 }
Example #2
0
		/// <summary>
		/// Given that idxCurSeg is the index of a segment of curPara, adjust both until it is the index of the
		/// next segment (possibly in a later paragraph). Return false if no earlier segment exists in
		/// the current text.
		/// </summary
		private static bool GetNextSeg(ref int idxCurSeg, ISilDataAccess sda,
			ref StTxtPara curPara, int ktagParaSegments)
		{
			idxCurSeg++;
			// This for usually exits early in the first iteration, and all we do in the method is increment idxCurSeg.
			// It is even rarer to have more than one full iteration but could happen if there is an empty paragraph.
			for (; ; )
			{
				int csegs = sda.get_VecSize(curPara.Hvo, ktagParaSegments);
				if (idxCurSeg < csegs)
					return true;
				// set curPara to next para in StText. If there is none, fail.
				int idxPara = sda.GetObjIndex(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, curPara.Hvo);
				int cpara = sda.get_VecSize(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs);
				if (idxPara >= cpara - 1)
					return false;
				int hvoNext = sda.get_VecItem(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, idxPara + 1);
				curPara = CmObject.CreateFromDBObject(curPara.Cache, hvoNext, false) as StTxtPara;
				idxCurSeg = 0;
			}
		}
Example #3
0
 /// <summary> Return the index of hvo in the flid vector of hvoOwn.</summary>
 /// <param name='hvoOwn'>The object ID of the owner.</param>
 /// <param name='flid'>The parameter on hvoOwn that owns hvo.</param>
 /// <param name='hvo'>The target object ID we are looking for.</param>
 /// <returns>
 /// The index, or -1 if not found.
 /// </returns>
 public virtual int GetObjIndex(int hvoOwn, int flid, int hvo)
 {
     return(m_baseSda.GetObjIndex(hvoOwn, flid, hvo));
 }
Example #4
0
		/// <summary>
		/// Given that idxCurSeg is the index of a segment of curPara, adjust both until it is the index of the
		/// previous segment (possibly in an earlier paragraph). Return false if no earlier segment exists in
		/// the current text.
		/// </summary
		private static bool GetPrevSeg(ref int idxCurSeg, ISilDataAccess sda,
			ref StTxtPara curPara, int ktagParaSegments)
		{
			idxCurSeg--;
			// This while usually has no iterations, and all we do in the method is decrement idxCurSeg.
			// It is even rarer to have more than one iteration but could happen if there is an empty paragraph.
			while (idxCurSeg < 0)
			{
				// set curPara to previous para in StText. If there is none, fail.
				int idxPara = sda.GetObjIndex(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, curPara.Hvo);
				if (idxPara == 0)
					return false;
				int hvoPrev = sda.get_VecItem(curPara.OwnerHVO, (int)StText.StTextTags.kflidParagraphs, idxPara - 1);
				curPara = CmObject.CreateFromDBObject(curPara.Cache, hvoPrev, false) as StTxtPara;
				idxCurSeg = sda.get_VecSize(curPara.Hvo, ktagParaSegments) - 1;
			}
			return true;
		}