Example #1
0
        private void Setup(int hvoPara)
        {
            int vernWs = StTxtPara.GetWsAtParaOffset(m_cache, hvoPara, 0);

            if (vernWs == m_vernWs)
            {
                return;                 // already setup.
            }
            m_vernWs = vernWs;
            string        sql = string.Format("select txt from WfiWordform_Form where ws={0}", vernWs);
            IOleDbCommand odc = DbOps.MakeRowSet(m_cache, sql, null);

            m_maxChars = 0;
            try
            {
                bool fMoreRows;
                odc.NextRow(out fMoreRows);
                while (fMoreRows)
                {
                    string word = DbOps.ReadString(odc, 0);
                    m_words.Add(word);
                    m_maxChars = Math.Max(m_maxChars, word.Length);
                    odc.NextRow(out fMoreRows);
                }
            }
            finally
            {
                DbOps.ShutdownODC(ref odc);
            }
        }
Example #2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Gets the writing system and direction to use for the given paragraph (depending on
 /// the value of <see cref="BaseDirectionOnParaContents"/>, this can be based on the
 /// paragraph itself or simply derived from the VC).
 /// </summary>
 /// <param name="hvoPara">The HVO of the paragraph.</param>
 /// <param name="fIsRightToLeftPara">flag indicating whether direction is right to left.
 /// </param>
 /// <param name="wsPara">The writing system.</param>
 /// ------------------------------------------------------------------------------------
 protected void GetWsAndDirectionForPara(int hvoPara, out bool fIsRightToLeftPara,
                                         out int wsPara)
 {
     fIsRightToLeftPara = RightToLeft;
     wsPara             = DefaultWs;
     if (BaseDirectionOnParaContents)
     {
         // we'll infer the direction of the paragraph from the ws of the first run (offset 0).
         wsPara = StTxtPara.GetWsAtParaOffset(m_cache, hvoPara, 0);
         if (wsPara <= 0)
         {
             wsPara = DefaultWs;
         }
         else
         {
             IWritingSystem wsObj = m_cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(wsPara);
             if (wsObj != null)
             {
                 fIsRightToLeftPara = wsObj.RightToLeft;
             }
         }
     }
 }