private bool CanAddWordGlosses(out ISegment seg, out int ws)
{
seg = null;
ws = 0; // actually meaningless unless it returns true, but make compiler happy.
if (RootBox.Selection == null)
return false;
if (!Focused)
return false;
ITsString tss;
int ich;
int tag;
bool fAssocPrev;
int hvoSeg;
RootBox.Selection.TextSelInfo(false, out tss, out ich, out fAssocPrev, out hvoSeg, out tag, out ws);
if (tag != kTagUserPrompt)
return false; // no good if not in a prompt for an empty translation.
seg = Cache.ServiceLocator.GetInstance<ISegmentRepository>().GetObject(hvoSeg);
if (seg == null)
return false; // And must be a property of a segment (we only use these prompts for the two translation props)
int dummy;
if (ws == 0) // a prompt, use ws of first character.
ws = tss.get_Properties(0).GetIntPropValues((int)FwTextPropType.ktptWs, out dummy);
return true;
}