コード例 #1
0
ファイル: ViewSampleView.cs プロジェクト: vkarthim/FieldWorks
        /// <summary>
        /// Parse the text in hvoPara.Contents[vc.DestWs] and make words
        /// </summary>
        /// <param name="hvoPara"></param>
        public void Parse(int hvoPara)
        {
            ITsString tssSrc = m_sda.get_MultiStringAlt(hvoPara, ViewSampleVc.ktagParaContents, m_vc.DestWs);
            WordMaker wm = new WordMaker(tssSrc, m_wsf);
            int       ichMin, ichLim;
            int       cbundle = m_sda.get_VecSize(hvoPara, ViewSampleVc.ktagParaBundles);

            // Clean it out. This wouldn't normally be appropriate for an owning property, but we can get away
            // with it for a non-database cache.
            if (cbundle != 0)
            {
                m_sda.Replace(hvoPara, ViewSampleVc.ktagParaBundles, 0, cbundle, new int[0], 0);
            }
            int             ibundle = 0;
            ITsPropsFactory tpf     = (ITsPropsFactory) new FwKernelLib.TsPropsFactoryClass();
            ITsTextProps    ttp     = tpf.MakeProps(null, m_vc.SourceWs, 0);

            for (ITsString tssWord = wm.NextWord(out ichMin, out ichLim); tssWord != null;
                 tssWord = wm.NextWord(out ichMin, out ichLim))
            {
                // 4 is an arbitrary classid; this kind of cache does nothing with it.
                int hvoBundle = m_sda.MakeNewObject(4, hvoPara, ViewSampleVc.ktagParaBundles, ibundle);
                ibundle++;
                m_sda.SetString(hvoBundle, ViewSampleVc.ktagBundleBase, tssWord);
                ITsStrBldr tsb = tssWord.GetBldr();
                tsb.Replace(0, 0, "idiom(", ttp);
                tsb.Replace(tsb.get_Length(), tsb.get_Length(), ")", ttp);
                m_sda.SetString(hvoBundle, ViewSampleVc.ktagBundleIdiom, tsb.GetString());

                tsb = tssWord.GetBldr();
                tsb.Replace(0, 0, "ling(", ttp);
                tsb.Replace(tsb.get_Length(), tsb.get_Length(), ")", ttp);
                m_sda.SetString(hvoBundle, ViewSampleVc.ktagBundleLing, tsb.GetString());
            }
            m_sda.PropChanged(null, (int)FwViews.PropChangeType.kpctNotifyAll, hvoPara, ViewSampleVc.ktagParaBundles, 0, ibundle, cbundle);
        }
コード例 #2
0
ファイル: ViewSampleView.cs プロジェクト: bbriggs/FieldWorks
		/// <summary>
		/// Parse the text in hvoPara.Contents[vc.DestWs] and make words
		/// </summary>
		/// <param name="hvoPara"></param>
		public void Parse(int hvoPara)
		{
			ITsString tssSrc = m_sda.get_MultiStringAlt(hvoPara, ViewSampleVc.ktagParaContents, m_vc.DestWs);
			WordMaker wm = new WordMaker(tssSrc, m_wsf);
			int ichMin, ichLim;
			int cbundle = m_sda.get_VecSize(hvoPara, ViewSampleVc.ktagParaBundles);
			// Clean it out. This wouldn't normally be appropriate for an owning property, but we can get away
			// with it for a non-database cache.
			if (cbundle != 0)
				m_sda.Replace(hvoPara, ViewSampleVc.ktagParaBundles, 0, cbundle, new int[0], 0);
			int ibundle = 0;
			ITsPropsFactory tpf = (ITsPropsFactory) new FwKernelLib.TsPropsFactoryClass();
			ITsTextProps ttp = tpf.MakeProps(null, m_vc.SourceWs, 0);
			for (ITsString tssWord = wm.NextWord(out ichMin, out ichLim); tssWord != null;
				tssWord = wm.NextWord(out ichMin, out ichLim))
			{
				// 4 is an arbitrary classid; this kind of cache does nothing with it.
				int hvoBundle = m_sda.MakeNewObject(4, hvoPara, ViewSampleVc.ktagParaBundles, ibundle);
				ibundle++;
				m_sda.SetString(hvoBundle, ViewSampleVc.ktagBundleBase, tssWord);
				ITsStrBldr tsb = tssWord.GetBldr();
				tsb.Replace(0, 0, "idiom(", ttp);
				tsb.Replace(tsb.get_Length(), tsb.get_Length(), ")", ttp);
				m_sda.SetString(hvoBundle, ViewSampleVc.ktagBundleIdiom, tsb.GetString());

				tsb = tssWord.GetBldr();
				tsb.Replace(0, 0, "ling(", ttp);
				tsb.Replace(tsb.get_Length(), tsb.get_Length(), ")", ttp);
				m_sda.SetString(hvoBundle, ViewSampleVc.ktagBundleLing, tsb.GetString());
			}
			m_sda.PropChanged(null, (int)FwViews.PropChangeType.kpctNotifyAll, hvoPara, ViewSampleVc.ktagParaBundles, 0, ibundle, cbundle);
		}