Example #1
0
        /// <summary>
        /// Get the actual ws of the WritingSystem based on the given hvo.
        /// If the WritingSystem is not magic, it'll just return WritingSystem.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="hvo"></param>
        /// <param name="wsPreferred">the ws to prefer over the standard sequence in current writing systems list. also used as a default
        /// if no alternative ws can be found.</param>
        /// <returns></returns>
        public int GetActualWs(FdoCache cache, int hvo, int wsPreferred)
        {
            int wsActual = 0;

            if (this.StringFlid == -1)
            {
                // we depend upon someone else to determine the ws.
                return(0);
            }
            if (this.WritingSystem == LangProject.kwsFirstVern && wsPreferred != 0)
            {
                // first try the preferred hvo before looking for one in the standard sequence of the writing systems list.
                MultiAccessor ma = MultiAccessor.CreateMultiAccessor(cache, hvo, this.StringFlid, "");
                ma.GetAlternativeOrBestTss(wsPreferred, out wsActual);
            }
            if (wsActual == 0)
            {
                wsActual = cache.LangProject.ActualWs(this.WritingSystem, hvo, this.StringFlid);
            }
            if (wsActual == 0)
            {
                wsActual = wsPreferred;
            }
            return(wsActual);
        }
Example #2
0
        protected static ITsString GetTssLabel(FdoCache cache, int hvoItem, int flidName, int wsName)
        {
            MultiAccessor ma = MultiAccessor.CreateMultiAccessor(cache, hvoItem, flidName);
            int           wsActual;
            ITsString     tssLabel = ma.GetAlternativeOrBestTss(wsName, out wsActual);

            return(tssLabel);
        }