private bool GetLineInfo(ISegment curSeg, INote curNote, int tag, int ichAnchor, int ichEnd, int wid,
out int id, out int lineNum, out WhichEnd where, out bool isRightToLeft, out bool hasPrompt)
{
isRightToLeft = false;
hasPrompt = false;
var wsf = Cache.WritingSystemFactory;
var ws = wsf.get_EngineOrNull(wid);
if (ws != null)
isRightToLeft = ws.RightToLeftScript;
id = 0;
lineNum = -1;
where = WhichEnd.Neither;
switch (tag)
{
case SegmentTags.kflidFreeTranslation:
id = InterlinLineChoices.kflidFreeTrans;
where = ExtremePositionInString(ichAnchor, ichEnd, curSeg.FreeTranslation.get_String(wid).Length, isRightToLeft);
break;
case SegmentTags.kflidLiteralTranslation:
id = InterlinLineChoices.kflidLitTrans;
where = ExtremePositionInString(ichAnchor, ichEnd, curSeg.LiteralTranslation.get_String(wid).Length, isRightToLeft);
break;
case NoteTags.kflidContent:
Debug.Assert(curNote != null, "Moving from a non-exisiting note in interlinear Doc.");
id = InterlinLineChoices.kflidNote;
where = ExtremePositionInString(ichAnchor, ichEnd, curNote.Content.get_String(wid).Length, isRightToLeft);
break;
case kTagUserPrompt: // user prompt property for empty translation annotations
// Is this free or literal?
hasPrompt = true;
id = m_vc.ActiveFreeformFlid;
id = (id == SegmentTags.kflidLiteralTranslation) ?
InterlinLineChoices.kflidLitTrans : InterlinLineChoices.kflidFreeTrans;
if (wid == 0)
wid = m_vc.ActiveFreeformWs;
where = WhichEnd.Both;
break;
default: // not expected
return false;
}
if (wid > 0)
lineNum = LineChoices.IndexOf(id, wid);
if (lineNum == -1)
lineNum = LineChoices.IndexOf(id);
return true;
}