当前位置: 首页>>代码示例>>C#>>正文


C# IStTxtPara.GetOrCreateBT方法代码示例

本文整理汇总了C#中IStTxtPara.GetOrCreateBT方法的典型用法代码示例。如果您正苦于以下问题:C# IStTxtPara.GetOrCreateBT方法的具体用法?C# IStTxtPara.GetOrCreateBT怎么用?C# IStTxtPara.GetOrCreateBT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IStTxtPara的用法示例。


在下文中一共展示了IStTxtPara.GetOrCreateBT方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FixtureSetupInternal

		private void FixtureSetupInternal()
		{
			//IWritingSystem wsEn = Cache.WritingSystemFactory.get_Engine("en");
			// Setup default analysis ws
			//m_wsEn = Cache.ServiceLocator.GetInstance<ILgWritingSystemRepository>().GetObject(wsEn.WritingSystem);
			m_wsVern = Cache.DefaultVernWs;
			m_wsTrans = Cache.DefaultAnalWs;

			m_text = Cache.ServiceLocator.GetInstance<ITextFactory>().Create();
			//Cache.LangProject.TextsOC.Add(m_text);
			var stText = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create();
			m_text.ContentsOA = stText;
			m_para = Cache.ServiceLocator.GetInstance<IScrTxtParaFactory>().CreateWithStyle(stText, ScrStyleNames.NormalParagraph);

			m_trans = m_para.GetOrCreateBT();
			Cache.LangProject.TranslatedScriptureOA.UseScriptDigits = false;
			m_tsf = Cache.TsStrFactory;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:18,代码来源:BtConverterTests.cs

示例2: InsertTestBtFootnote

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a footnote reference marker (ref orc)
		/// </summary>
		/// <param name="footnote">given footnote</param>
		/// <param name="para">paragraph owning the translation to insert footnote marker into</param>
		/// <param name="ws">given writing system for the back translation</param>
		/// <param name="ichPos">The 0-based character offset into the translation</param>
		/// ------------------------------------------------------------------------------------
		protected void InsertTestBtFootnote(IStFootnote footnote, IStTxtPara para, int ws,
			int ichPos)
		{
			ICmTranslation trans = para.GetOrCreateBT();
			ITsStrBldr bldr = trans.Translation.get_String(ws).GetBldr();
			footnote.InsertRefORCIntoTrans(bldr, ichPos, ws);
			trans.Translation.set_String(ws, bldr.GetString());
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:17,代码来源:FdoScriptureTests.cs

示例3: SetIpAtEndOfPara

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Set the IP to the end of the section. Check for vernacular or BT.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void SetIpAtEndOfPara(int bookIndex, int sectionIndex, int paraIndex, IStTxtPara para)
		{
			int paraLength;
			if (IsBackTranslation)
			{
				ICmTranslation trans = para.GetOrCreateBT();
				paraLength = trans.Translation.get_String(ViewConstructorWS).Length;
			}
			else
				paraLength = para.Contents.Length;

			SetInsertionPoint(bookIndex, sectionIndex, paraIndex, paraLength, true);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:18,代码来源:TeEditingHelper.cs

示例4: AppendRunToBt

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Append a run of text to a back translation of a paragraph.
		/// </summary>
		/// <param name="para">given paragraph</param>
		/// <param name="ws">given writing system for the back translation</param>
		/// <param name="runText">given text to append to back translation</param>
		/// ------------------------------------------------------------------------------------
		public void AppendRunToBt(IStTxtPara para, int ws, string runText)
		{
			ICmTranslation trans = para.GetOrCreateBT();
			ITsStrBldr bldr = trans.Translation.get_String(ws).GetBldr();
			ITsTextProps ttp = StyleUtils.CharStyleTextProps(null, ws);
			int bldrLength = bldr.Length;
			bldr.ReplaceRgch(bldrLength, bldrLength, runText, runText.Length, ttp);
			trans.Translation.set_String(ws, bldr.GetString());
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:17,代码来源:FdoTestBase.cs

示例5: AddBtToMockedParagraph

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add an empty back translation to the paragraph, or return the existing one.
		/// </summary>
		/// <param name="owner">the owning paragraph</param>
		/// <param name="wsTrans"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected ICmTranslation AddBtToMockedParagraph(IStTxtPara owner, int wsTrans)
		{
			ICmTranslation trans = owner.GetOrCreateBT();
			trans.Translation.set_String(wsTrans, Cache.TsStrFactory.MakeString(string.Empty, wsTrans));
			return trans;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:FdoTestBase.cs

示例6: VerifyBtFootnote

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make sure the marker for a footnote exists in the back translation and refers to the
		/// footnote properly.
		/// </summary>
		/// <param name="footnote">given footnote whose marker we want to verify in the BT</param>
		/// <param name="para">vernacular paragraph which owns the back translation</param>
		/// <param name="ws">writing system of the back transltion</param>
		/// <param name="ich">Character position where ORC should be in the specified back
		/// translation</param>
		/// ------------------------------------------------------------------------------------
		public static void VerifyBtFootnote(IStFootnote footnote, IStTxtPara para, int ws, int ich)
		{
			Guid guid = footnote.Cache.GetGuidFromId(footnote.Hvo);
			ITsString tss = para.Contents.UnderlyingTsString;
			ICmTranslation trans = para.GetOrCreateBT();
			ITsString btTss = trans.Translation.GetAlternative(ws).UnderlyingTsString;

			int iRun = btTss.get_RunAt(ich);
			string sOrc = btTss.get_RunText(iRun);
			Assert.AreEqual(StringUtils.kchObject, sOrc[0]);
			ITsTextProps orcPropsParaFootnote = btTss.get_Properties(iRun);
			string objData = orcPropsParaFootnote.GetStrPropValue(
				(int)FwTextPropType.ktptObjData);
			Assert.IsNotNull(objData);
			Assert.AreEqual((char)(int)FwObjDataTypes.kodtNameGuidHot, objData[0]);
			// Send the objData string without the first character because the first character
			// is the object replacement character and the rest of the string is the GUID.
			Guid newFootnoteGuid = MiscUtils.GetGuidFromObjData(objData.Substring(1));
			Assert.AreEqual(guid, newFootnoteGuid);
			Assert.AreEqual(footnote.Hvo, footnote.Cache.GetIdFromGuid(newFootnoteGuid));
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:32,代码来源:StTxtParaTests.cs

示例7: SetupRangeSelection

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up a range selection in the specified back translation.
		/// </summary>
		/// <param name="wsStart">The writing system of the BT where the selection is to start,
		/// or -1 to start in the vernacular.</param>
		/// <param name="wsEnd">The writing system of the BT where the selection is to end,
		/// or -1 to end in the vernacular.</param>
		/// <param name="bookStart">The starting book.</param>
		/// <param name="iBookStart">The index of the starting book.</param>
		/// <param name="sectionStart">The starting section.</param>
		/// <param name="iSecStart">The index of the starting section.</param>
		/// <param name="paraStart">The starting paragraph.</param>
		/// <param name="iParaStart">The index of the starting paragraph.</param>
		/// <param name="ichStart">The starting character offset.</param>
		/// <param name="setupForHeadingStart">if set to <c>true</c> setup selection to start in
		/// section heading; otherwise, set up selection in contents.</param>
		/// <param name="bookEnd">The ending book.</param>
		/// <param name="iBookEnd">The index of the ending book.</param>
		/// <param name="sectionEnd">The ending section.</param>
		/// <param name="iSecEnd">The index of the ending section.</param>
		/// <param name="paraEnd">The ending paragraph.</param>
		/// <param name="iParaEnd">The index of the para end.</param>
		/// <param name="ichEnd">The ending character offset.</param>
		/// <param name="setupForHeadingEnd">if set to <c>true</c> setup selection to end in
		/// section heading; otherwise, set up selection in contents.</param>
		/// ------------------------------------------------------------------------------------
		public void SetupRangeSelection(int wsStart, int wsEnd, IScrBook bookStart, int iBookStart,
			IScrSection sectionStart, int iSecStart, IStTxtPara paraStart, int iParaStart, int ichStart,
			bool setupForHeadingStart, IScrBook bookEnd, int iBookEnd, IScrSection sectionEnd,
			int iSecEnd, IStTxtPara paraEnd, int iParaEnd, int ichEnd, bool setupForHeadingEnd)
		{
			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			int cLevelsTop = wsStart > 0 ? 5 : 4;
			// Setup the anchor
			SelLevInfo[] topInfo = new SelLevInfo[cLevelsTop];
			int iLev = 0;
			if (wsStart > 0)
			{
				topInfo[iLev].tag = -1;
				topInfo[iLev].ihvo = 0;
				topInfo[iLev].hvo = paraStart.GetOrCreateBT().Hvo;
				iLev++;
			}
			topInfo[iLev].tag = StTextTags.kflidParagraphs;
			topInfo[iLev].ihvo = iParaStart;
			topInfo[iLev].hvo = paraStart.Hvo;
			topInfo[++iLev].tag = setupForHeadingStart ? ScrSectionTags.kflidHeading :
				ScrSectionTags.kflidContent;
			topInfo[iLev].ihvo = 0;
			topInfo[iLev].hvo = setupForHeadingStart ? sectionStart.HeadingOA.Hvo :
				sectionStart.ContentOA.Hvo;
			topInfo[++iLev].tag = ScrBookTags.kflidSections;
			topInfo[iLev].ihvo = iSecStart;
			topInfo[iLev].hvo = sectionStart.Hvo;
			topInfo[++iLev].tag = BookFilter.Tag;
			topInfo[iLev].ihvo = iBookStart;
			topInfo[iLev].hvo = bookStart.Hvo;

			// Setup the end
			int cLevelsBottom = wsEnd > 0 ? 5 : 4;
			SelLevInfo[] bottomInfo = new SelLevInfo[cLevelsBottom];
			iLev = 0;
			if (wsEnd > 0)
			{
				bottomInfo[iLev].tag = -1;
				bottomInfo[iLev].ihvo = 0;
				bottomInfo[iLev].hvo = paraEnd.GetOrCreateBT().Hvo;
				iLev++;
			}
			bottomInfo[iLev].tag = StTextTags.kflidParagraphs;
			bottomInfo[iLev].ihvo = iParaEnd;
			bottomInfo[iLev].hvo = paraEnd.Hvo;
			bottomInfo[++iLev].tag = setupForHeadingEnd ? ScrSectionTags.kflidHeading :
				ScrSectionTags.kflidContent;
			bottomInfo[iLev].ihvo = 0;
			bottomInfo[iLev].hvo = setupForHeadingEnd ? sectionEnd.HeadingOA.Hvo :
				sectionEnd.ContentOA.Hvo;
			bottomInfo[++iLev].tag = ScrBookTags.kflidSections;
			bottomInfo[iLev].ihvo = iSecEnd;
			bottomInfo[iLev].hvo = sectionEnd.Hvo;
			bottomInfo[++iLev].tag = BookFilter.Tag;
			bottomInfo[iLev].ihvo = iBookEnd;
			bottomInfo[iLev].hvo = bookEnd.Hvo;

			fakeSelHelper.SetupResult("NumberOfLevels", cLevelsTop);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsTop,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsTop,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsBottom,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsBottom,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResult("ReduceSelectionToIp", fakeSelHelper.MockInstance,
				typeof(SelectionHelper.SelLimitType), typeof(bool), typeof(bool));
			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichStart);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			fakeSelHelper.SetupResult("Ws", wsStart);
//.........这里部分代码省略.........
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:101,代码来源:TeEditingHelperTests.cs


注:本文中的IStTxtPara.GetOrCreateBT方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。