internal static bool TryGetLexGlossWithInflTypeTss(ILexEntry possibleVariant, ILexSense sense, InterlinLineSpec spec, InterlinLineChoices lineChoices, int vernWsContext, ILexEntryInflType inflType, out ITsString result) { FdoCache cache = possibleVariant.Cache; using (var vcLexGlossFrag = new InterlinVc(cache)) { vcLexGlossFrag.LineChoices = lineChoices; vcLexGlossFrag.PreferredVernWs = vernWsContext; result = null; var collector = new TsStringCollectorEnv(null, vcLexGlossFrag.Cache.MainCacheAccessor, possibleVariant.Hvo) { RequestAppendSpaceForFirstWordInNewParagraph = false }; if (vcLexGlossFrag.DisplayLexGlossWithInflType(collector, possibleVariant, sense, spec, inflType)) { result = collector.Result; return true; } return false; } }
/// <summary> /// /// </summary> /// <param name="cache"></param> /// <param name="hvoEntryToDisplay"></param> /// <param name="wsVern"></param> /// <param name="ler"></param> /// <returns></returns> static public ITsString GetLexEntryTss(FdoCache cache, int hvoEntryToDisplay, int wsVern, ILexEntryRef ler) { LexEntryVc vcEntry = new LexEntryVc(cache); vcEntry.WritingSystemCode = wsVern; TsStringCollectorEnv collector = new TsStringCollectorEnv(null, cache.MainCacheAccessor, hvoEntryToDisplay); collector.RequestAppendSpaceForFirstWordInNewParagraph = false; vcEntry.Display(collector, hvoEntryToDisplay, (int)VcFrags.kfragHeadWord); if (ler != null) vcEntry.Display(collector, ler.Hvo, LexEntryVc.kfragVariantTypes); return collector.Result; }
/// <summary> /// /// </summary> /// <param name="morphBundle"></param> /// <param name="wsVern"></param> /// <returns></returns> static public ITsString GetLexEntryTss(IWfiMorphBundle morphBundle, int wsVern) { FdoCache cache = morphBundle.Cache; LexEntryVc vcEntry = new LexEntryVc(cache); vcEntry.WritingSystemCode = wsVern; TsStringCollectorEnv collector = new TsStringCollectorEnv(null, cache.MainCacheAccessor, morphBundle.Hvo); collector.RequestAppendSpaceForFirstWordInNewParagraph = false; vcEntry.Display(collector, morphBundle.Hvo, (int)LexEntryVc.kfragEntryAndVariant); return collector.Result; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Keys the specified item. /// </summary> /// <param name="item">The item.</param> /// <param name="fForSorting">if set to <c>true</c> [f for sorting].</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ public ITsString Key(ManyOnePathSortItem item, bool fForSorting) { CheckDisposed(); if (m_cache == null) throw new ApplicationException("There's no way the browse VC (m_vc) can get a string in its current state."); int hvo = item.RootObject.Hvo; TsStringCollectorEnv collector; if (fForSorting) { collector = new SortCollectorEnv(null, m_cache.MainCacheAccessor, hvo); } else { collector = new TsStringCollectorEnv(null, m_cache.MainCacheAccessor, hvo); } // This will check to see if the VC is either null or disposed. The disposed check is neccesary because // there are several instances where we can have a reference to an instance that was disposed, which will // cause problems later on. // Enhance CurtisH/EricP: If this VC gets used in other places, rather than adding more checks like this one, // it may be better to refactor XWorksViewBase to cause it to reload the sorter and filter from persistence // every time the tool is changed if (m_vc == null || m_vc.IsDisposed) { m_vc = new XmlBrowseViewBaseVc(m_cache, m_stringTbl); } else { if (m_vc.Cache == null) m_vc.Cache = m_cache; if (m_vc.Cache == null) throw new ApplicationException("There's no way the browse VC (m_vc) can get a string in its current state."); if (m_vc.StringTbl == null) m_vc.StringTbl = m_stringTbl; } m_vc.DisplayCell(item, m_colSpec, hvo, collector); return collector.Result; }