/// <summary> /// NOTE: this routine is ignorant of calling context, so caller must provide NoteDependency to the possibleVariant and the sense /// (e.g. vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidSense }, 1); /// vwenv.NoteDependency(new[] { wfiMorphBundle.Hvo }, new[] { WfiMorphBundleTags.kflidInflType }, 1); /// </summary> /// <param name="vwenv"></param> /// <param name="possibleVariant"></param> /// <param name="sense"></param> /// <param name="spec"></param> /// <param name="inflType"></param> /// <returns>true if there was anything to display </returns> internal bool DisplayLexGlossWithInflType(IVwEnv vwenv, ILexEntry possibleVariant, ILexSense sense, InterlinLineSpec spec, ILexEntryInflType inflType) { int iLineChoice = m_lineChoices.IndexOf(spec); ILexEntryRef ler; if (possibleVariant.IsVariantOfSenseOrOwnerEntry(sense, out ler)) { var wsPreferred = GetRealWsOrBestWsForContext(sense.Hvo, spec); var wsGloss = Cache.ServiceLocator.WritingSystemManager.Get(wsPreferred); var wsUser = Cache.ServiceLocator.WritingSystemManager.UserWritingSystem; var testGloss = sense.Gloss.get_String(wsPreferred); // don't bother adding anything for an empty gloss. if (testGloss.Text != null && testGloss.Text.Length >= 0) { vwenv.OpenParagraph(); // see if we have an irregularly inflected form type reference var leitFirst = ler.VariantEntryTypesRS.Where( let => let.ClassID == LexEntryInflTypeTags.kClassId).FirstOrDefault(); // add any GlossPrepend info if (leitFirst != null) { vwenv.OpenInnerPile(); // TODO: add dependency to VariantType GlossPrepend/Append names vwenv.NoteDependency(new[] { ler.Hvo }, new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1); vwenv.OpenParagraph(); ITsString tssPrepend = null; if (inflType != null) { tssPrepend = MorphServices.AddTssGlossAffix(null, inflType.GlossPrepend, wsGloss, wsUser); } else { ITsIncStrBldr sbPrepend; ITsIncStrBldr sbAppend; JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend, out sbAppend); if (sbPrepend.Text != null) tssPrepend = sbPrepend.GetString(); } if (tssPrepend != null) vwenv.AddString(tssPrepend); vwenv.CloseParagraph(); vwenv.CloseInnerPile(); } // add gloss of main entry or sense { vwenv.OpenInnerPile(); // NOTE: remember to NoteDependency from OuterObject vwenv.AddObj(sense.Hvo, this, kfragLineChoices + iLineChoice); vwenv.CloseInnerPile(); } // now add variant type info if (leitFirst != null) { vwenv.OpenInnerPile(); // TODO: add dependency to VariantType GlossPrepend/Append names vwenv.NoteDependency(new[] { ler.Hvo }, new[] { LexEntryRefTags.kflidVariantEntryTypes }, 1); vwenv.OpenParagraph(); ITsString tssAppend = null; if (inflType != null) { tssAppend = MorphServices.AddTssGlossAffix(null, inflType.GlossAppend, wsGloss, wsUser); } else { ITsIncStrBldr sbPrepend; ITsIncStrBldr sbAppend; JoinGlossAffixesOfInflVariantTypes(ler, wsPreferred, out sbPrepend, out sbAppend); if (sbAppend.Text != null) tssAppend = sbAppend.GetString(); } { // Use AddProp/DisplayVariant to store GlossAppend with m_tssPendingGlossAffix // this allows InterlinearExporter to know to export a glsAppend item try { if (tssAppend != null) m_tssPendingGlossAffix = tssAppend; else m_tssPendingGlossAffix = m_tssMissingGlossAppend; vwenv.AddProp(ktagGlossAppend, this, 0); } finally { m_tssPendingGlossAffix = null; } } vwenv.CloseParagraph(); vwenv.CloseInnerPile(); } vwenv.CloseParagraph(); return true; } } return false; }