• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IStTxtPara类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: XmlNotePara

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="XmlNotePara"/> class based on the given
		/// StTxtPara.
		/// </summary>
		/// <param name="stTxtPara">The FDO paragraph.</param>
		/// <param name="wsDefault">The default (analysis) writing system.</param>
		/// <param name="lgwsf">The writing system factory.</param>
		/// ------------------------------------------------------------------------------------
		public XmlNotePara(IStTxtPara stTxtPara, int wsDefault, ILgWritingSystemFactory lgwsf)
		{
			// REVIEW: Ask TomB about this. The only paragraph style allowed in
			// TE for notes is "Remark" so is it necessary to write it to the XML?
			// It causes a problem for the OXES validator.
			//StyleName = stTxtPara.StyleName;

			ITsString tssParaContents = stTxtPara.Contents;
			if (tssParaContents.RunCount == 0)
				return;

			int dummy;
			int wsFirstRun = tssParaContents.get_Properties(0).GetIntPropValues(
				(int)FwTextPropType.ktptWs, out dummy);

			//if (wsFirstRun != wsDefault)
			IcuLocale = lgwsf.GetStrFromWs(wsFirstRun);

			for (int iRun = 0; iRun < tssParaContents.RunCount; iRun++)
			{
				ITsTextProps props = tssParaContents.get_Properties(iRun);
				string text = tssParaContents.get_RunText(iRun);
				if (TsStringUtils.IsHyperlink(props))
					Runs.Add(new XmlHyperlinkRun(wsFirstRun, lgwsf, text, props));
				else
					Runs.Add(new XmlTextRun(wsFirstRun, lgwsf, text, props));
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:37,代码来源:XmlNotePara.cs


示例2: DoSetupFixture

		/// <summary>
		/// non-undoable task
		/// </summary>
		private void DoSetupFixture()
		{
			var textFactory = Cache.ServiceLocator.GetInstance<ITextFactory>();
			var stTextFactory = Cache.ServiceLocator.GetInstance<IStTextFactory>();
			m_text = textFactory.Create();
			//Cache.LangProject.TextsOC.Add(m_text);
			m_stText = stTextFactory.Create();
			m_text.ContentsOA = m_stText;
			m_para0 = m_stText.AddNewTextPara(null);
			m_para0.Contents = TsStringUtils.MakeTss("Xxxhope xxxthis xxxwill xxxdo. xxxI xxxhope.", Cache.DefaultVernWs);
			m_para1 = m_stText.AddNewTextPara(null);
			m_para1.Contents = TsStringUtils.MakeTss("Xxxcertain xxxto xxxcatch xxxa xxxfrog. xxxCertainly xxxcan. xxxOn xxxLake xxxMonroe.", Cache.DefaultVernWs);
			m_para2 = null;

			using (ParagraphParser pp = new ParagraphParser(Cache))
				foreach (IStTxtPara para in m_stText.ParagraphsOS)
					pp.Parse(para);

			m_expectedAnOcs = new List<AnalysisOccurrence>();
			foreach (IStTxtPara para in m_stText.ParagraphsOS)
				foreach (ISegment seg in para.SegmentsOS)
					for (int i = 0; i < seg.AnalysesRS.Count; i++)
						m_expectedAnOcs.Add(new AnalysisOccurrence(seg, i));

			m_expectedAnOcsPara0 = new List<AnalysisOccurrence>();
			foreach (ISegment seg in m_para0.SegmentsOS)
				for (int i = 0; i < seg.AnalysesRS.Count; i++)
					m_expectedAnOcsPara0.Add(new AnalysisOccurrence(seg, i));
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:32,代码来源:AnalysisOccurrenceTests.cs


示例3: BtConverter

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make one for converting the specified paragraph.
		/// </summary>
		/// <param name="para">The paragraph.</param>
		/// <param name="wsBt">The writing system for which to do the conversion.</param>
		/// ------------------------------------------------------------------------------------
		private BtConverter(IStTxtPara para, int wsBt)
		{
			m_para = para;
			m_cache = para.Cache;
			m_cpe = m_cache.ServiceLocator.UnicodeCharProps;
			m_scr = para.Cache.LangProject.TranslatedScriptureOA;
			m_wsBt = wsBt;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:15,代码来源:BtConverter.cs


示例4: FdoParaToLfPara

 /// <summary>
 /// Make an LfParagraph object from an FDO StTxtPara.
 /// </summary>
 /// <returns>The LFParagraph.</returns>
 /// <param name="fdoPara">FDO StTxtPara object to convert.</param>
 public static LfParagraph FdoParaToLfPara(IStTxtPara fdoPara, ILgWritingSystemFactory wsf)
 {
     var lfPara = new LfParagraph();
     lfPara.Guid = fdoPara.Guid;
     lfPara.StyleName = fdoPara.StyleName;
     lfPara.Content = ConvertFdoToMongoTsStrings.TextFromTsString(fdoPara.Contents, wsf);
     return lfPara;
 }
开发者ID:ermshiperete,项目名称:LfMerge,代码行数:13,代码来源:ConvertUtilities.cs


示例5: BtConverter

		/// <summary>
		/// Make one for converting the specified paragraph.
		/// </summary>
		/// <param name="para"></param>
		public BtConverter(IStTxtPara para)
		{
			m_para = para;
			m_cache = para.Cache;
			kflidFT = StTxtPara.SegmentFreeTranslationFlid(m_cache);
			kflidSegments = StTxtPara.SegmentsFlid(m_cache);
			m_cpe = m_cache.LanguageWritingSystemFactoryAccessor.UnicodeCharProps;
			m_scr = para.Cache.LangProject.TranslatedScriptureOA;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:13,代码来源:BtConverter.cs


示例6: FixtureSetupInternal

		private void FixtureSetupInternal()
		{
			// Setup default analysis ws
			m_wsEn = Cache.ServiceLocator.WritingSystemManager.Get("en").Handle;
			m_text = Cache.ServiceLocator.GetInstance<ITextFactory>().Create();
			//Cache.LangProject.TextsOC.Add(m_text);
			Cache.LangProject.TranslatedScriptureOA = Cache.ServiceLocator.GetInstance<IScriptureFactory>().Create();
			m_para = Cache.ServiceLocator.GetInstance<IStTxtParaFactory>().Create();
			IStText text = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create();
			m_text.ContentsOA = text;
			text.ParagraphsOS.Add(m_para);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:12,代码来源:CollectSegmentsTests.cs


示例7: GetParaAnalyses

		private static AnalysisOccurrence[] GetParaAnalyses(IStTxtPara para)
		{
			var result = new List<AnalysisOccurrence>();
			var point1 = new AnalysisOccurrence(para.SegmentsOS[0], 0);
			if (!point1.IsValid)
				return result.ToArray();
			do
			{
				if (point1.HasWordform)
					result.Add(point1);
				point1 = point1.NextWordform();
			} while (point1 != null && point1.IsValid);
			return result.ToArray();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:InterlinRibbonTests.cs


示例8: GetNextSegment

		/// <summary>
		/// Get the next segment with either a non-null annotation that is configured or
		/// a non-punctuation analysis. Also skip segments that are Scripture labels (like
		/// Chapter/Verse/Footnote numbers.
		/// It tries the next one after the SelectedOccurrence.Segment
		/// then tries the next paragraph, etc..
		/// Use this version if the calling code already has the actual para/seg objects.
		/// </summary>
		/// <param name="currentPara"></param>
		/// <param name="seg"></param>
		/// <param name="upward">true if moving up and left, false otherwise</param>
		/// <param name="realAnalysis">the first or last real analysis found in the next segment</param>
		/// <returns>A segment meeting the criteria or null if not found.</returns>
		private ISegment GetNextSegment(IStTxtPara currentPara, ISegment seg, bool upward,
				out AnalysisOccurrence realAnalysis)
		{
			ISegment nextSeg = null;
			realAnalysis = null;
			var currentText = currentPara.Owner as IStText;
			Debug.Assert(currentText != null, "Paragraph not owned by a text.");
			var lines = LineChoices.m_specs as IEnumerable<InterlinLineSpec>;
			var delta = upward ? -1 : 1;
			var nextSegIndex = delta + seg.IndexInOwner;
			do
			{
				if (0 <= nextSegIndex && nextSegIndex < currentPara.SegmentsOS.Count)
				{
					nextSeg = currentPara.SegmentsOS[nextSegIndex];
					nextSegIndex += delta; // increment for next loop in case it doesn't check out
				}
				else
				{   // try the first (last) segment in the next (previous) paragraph
					int nextParaIndex = delta + currentPara.IndexInOwner;
					nextSeg = null;
					IStTxtPara nextPara = null;
					if (0 <= nextParaIndex && nextParaIndex < currentText.ParagraphsOS.Count)
					{   // try to find this paragraph's first (last) segment
						currentPara = (IStTxtPara)currentText.ParagraphsOS[nextParaIndex];
						nextSegIndex = upward ? currentPara.SegmentsOS.Count - 1 : 0;
					}
					else
					{	// no more paragraphs in this text
						break;
					}
				}
				realAnalysis = FindRealAnalysisInSegment(nextSeg, !upward);
			} while (nextSeg == null || (realAnalysis == null && !HasVisibleTranslationOrNote(nextSeg, lines)));
			return nextSeg;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:49,代码来源:InterlinDocForAnalysis.cs


示例9: CompareFootnoteTrans

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Compares the translations of the footnote.
		/// </summary>
		/// <param name="expectedTrans">The expected translation</param>
		/// <param name="currentPara">The current footnote paragraph.</param>
		/// ------------------------------------------------------------------------------------
		private void CompareFootnoteTrans(ICmTranslation expectedTrans, IStTxtPara currentPara)
		{
			ICmTranslation actualTrans = currentPara.GetBT();

			if (expectedTrans == null)
			{
				Assert.IsNull(actualTrans, "Found an unexpected translation for footnote paragraph " +
					currentPara.IndexInOwner + " having text: " + currentPara.Contents.Text);
				return;
			}
			Assert.IsNotNull(actualTrans, "Translation missing for paragraph " +
					currentPara.IndexInOwner + " having text: " + currentPara.Contents.Text);

			foreach (int ws in actualTrans.Translation.AvailableWritingSystemIds)
			{
				ITsString tssExpected = expectedTrans.Translation.get_String(ws);
				ITsString tssActual = actualTrans.Translation.get_String(ws);

				if (tssExpected == null || tssExpected.Length == 0)
				{
					Assert.IsTrue(tssActual == null || tssActual.Length == 0,
						"Found an unexpected translation for WS " + ws);
					continue;
				}

				AssertEx.AreTsStringsEqual(tssExpected, tssActual);
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:35,代码来源:StFootnoteTests.cs


示例10: OnParagraphContentsChanged

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Allows this StText to perform any side-effects when the contents of one of its
		/// paragraphs changes.
		/// </summary>
		/// <param name="stTxtPara">The changed paragraph.</param>
		/// <param name="originalValue">The original value.</param>
		/// <param name="newValue">The new value.</param>
		/// ------------------------------------------------------------------------------------
		internal virtual void OnParagraphContentsChanged(IStTxtPara stTxtPara,
			ITsString originalValue, ITsString newValue)
		{
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:StText.cs


示例11: DeleteParagraph

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Delete a paragraph from this StText.
		/// </summary>
		/// <param name="para">paragraph to delete</param>
		/// ------------------------------------------------------------------------------------
		public void DeleteParagraph(IStTxtPara para)
		{
			// delete any linked objects (footnotes or pictures)
			((StTxtPara)para).RemoveOwnedObjectsForString(0, para.Contents.Length);
			// delete the paragraph
			((IStText)para.Owner).ParagraphsOS.Remove(para);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:StText.cs


示例12: VerifyPicture

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make sure picture exists and is referred to properly in the paragraph contents
		/// </summary>
		/// <param name="pictureOrig">The original picture</param>
		/// <param name="para"></param>
		/// <param name="ich">Character position where ORC should be</param>
		/// ------------------------------------------------------------------------------------
		private void VerifyPicture(ICmPicture pictureOrig, IStTxtPara para, int ich)
		{
			ITsString tss = para.Contents.UnderlyingTsString;
			int iRun = tss.get_RunAt(ich);
			ITsTextProps orcPropsParaFootnote = tss.get_Properties(iRun);
			string objData = orcPropsParaFootnote.GetStrPropValue(
				(int)FwTextPropType.ktptObjData);
			Assert.AreEqual((char)(int)FwObjDataTypes.kodtGuidMoveableObjDisp, 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 newPicGuid = MiscUtils.GetGuidFromObjData(objData.Substring(1));
			int newPicHvo = m_fdoCache.GetIdFromGuid(newPicGuid);
			Assert.IsTrue(pictureOrig.Guid != newPicGuid);
			Assert.IsTrue(pictureOrig.Hvo != newPicHvo);
			string sOrc = tss.get_RunText(iRun);
			Assert.AreEqual(StringUtils.kchObject, sOrc[0]);

			CmPicture pictureNew = new CmPicture(m_fdoCache, newPicHvo);
			Assert.IsTrue(pictureOrig.PictureFileRAHvo != pictureNew.PictureFileRAHvo);
			Assert.AreEqual(pictureOrig.PictureFileRA.InternalPath,
				pictureNew.PictureFileRA.InternalPath);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:31,代码来源:FdoScriptureTests.cs


示例13: VerifyFootnote

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make sure footnote exists and is referred to properly in the paragraph contents
		/// </summary>
		/// <param name="footnote">The footnote to verify</param>
		/// <param name="para">The paragraph that is expected to contain the footnote ORC</param>
		/// <param name="ich">Character position where ORC should be</param>
		/// ------------------------------------------------------------------------------------
		protected void VerifyFootnote(IStFootnote footnote, IStTxtPara para, int ich)
		{
			StTxtParaTests.VerifyFootnote(footnote, para, ich);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:12,代码来源:FdoScriptureTests.cs


示例14: InsertTestFootnote

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a mindless footnote (i.e., it's marker, paragraph style, etc. won't be set).
		/// </summary>
		/// <param name="book">Book to insert footnote into</param>
		/// <param name="para">Paragraph to insert footnote into</param>
		/// <param name="iFootnotePos">The 0-based index of the new footnote in the collection
		/// of footnotes owned by the book</param>
		/// <param name="ichPos">The 0-based character offset into the paragraph</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected StFootnote InsertTestFootnote(IScrBook book, IStTxtPara para,
			int iFootnotePos, int ichPos)
		{
			// Create the footnote
			StFootnote footnote = new StFootnote();
			book.FootnotesOS.InsertAt(footnote, iFootnotePos);

			// Update the paragraph contents to include the footnote marker
			ITsStrBldr tsStrBldr = para.Contents.UnderlyingTsString.GetBldr();
			footnote.InsertOwningORCIntoPara(tsStrBldr, ichPos, 0); // Don't care about ws
			para.Contents.UnderlyingTsString = tsStrBldr.GetString();

			return footnote;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:25,代码来源:FdoScriptureTests.cs


示例15: SetParaContents

		void SetParaContents(IStTxtPara para, string contents)
		{
			para.Contents = Cache.TsStrFactory.MakeString(contents, Cache.DefaultVernWs);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:4,代码来源:ClientServerTests.cs


示例16: Initialize

		public override void Initialize()
		{
			CheckDisposed();
			base.Initialize();
			//m_inMemoryCache.InitializeAnnotationDefs();
			InstallVirtuals(@"Language Explorer\Configuration\Words\AreaConfiguration.xml",
				new string[] { "SIL.FieldWorks.IText.ParagraphSegmentsVirtualHandler", "SIL.FieldWorks.IText.OccurrencesInTextsVirtualHandler" });
			m_wsVern = Cache.DefaultVernWs;
			m_wsTrans = Cache.DefaultAnalWs;
			m_text = new Text();
			Cache.LangProject.TextsOC.Add(m_text);
			m_para = new StTxtPara();
			StText text = new StText();
			m_text.ContentsOA = text;
			text.ParagraphsOS.Append(m_para);
			m_trans = new CmTranslation();
			m_para.TranslationsOC.Add(m_trans);
			kflidFT = StTxtPara.SegmentFreeTranslationFlid(Cache);
			kflidSegments = StTxtPara.SegmentsFlid(Cache);
			m_btPoss = Cache.LangProject.TranslationTagsOA.LookupPossibilityByGuid(
				LangProject.kguidTranBackTranslation);
			m_trans.TypeRA = m_btPoss;
			m_fWasUseScriptDigits = Cache.LangProject.TranslatedScriptureOA.UseScriptDigits;
			Cache.LangProject.TranslatedScriptureOA.UseScriptDigits = false;
			// do we need to set status?
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:26,代码来源:BtConverterTests.cs


示例17: CreateTestData

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create minimal test data required for every test.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			base.CreateTestData();
			m_helper = new DiscourseTestHelper(Cache);
			m_firstPara = m_helper.FirstPara;
			m_stText = m_firstPara.Owner as IStText;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:12,代码来源:InMemoryDiscourseTestBase.cs


示例18: TestTearDown

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Override to end the undoable UOW, Undo everything, and 'commit',
		/// which will essentially clear out the Redo stack.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void TestTearDown()
		{
			m_philemon = null;
			m_section = null;
			m_para = null;

			base.TestTearDown();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:14,代码来源:TeEditingHelper_FindFootnoteNearSelectionTests.cs


示例19: TestSetup

		/// <summary>
		///
		/// </summary>
		public override void TestSetup()
		{
			base.TestSetup();

			m_wsVern = Cache.DefaultVernWs;
			m_wsTrans = Cache.DefaultAnalWs;
			m_book = Cache.ServiceLocator.GetInstance<IScrBookFactory>().Create(1);
			m_section = Cache.ServiceLocator.GetInstance<IScrSectionFactory>().Create();
			m_book.SectionsOS.Add(m_section);
			m_section.ContentOA = m_text = Cache.ServiceLocator.GetInstance<IStTextFactory>().Create(); ;
			m_para = m_text.AddNewTextPara(ScrStyleNames.NormalParagraph);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:15,代码来源:FreeTransEditMonitorTests.cs


示例20: TestSetup

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Override to start an undoable UOW.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void TestSetup()
		{
			base.TestSetup();

			m_editingHelper.m_fUsingMockedSelection = true;
			m_philemon = AddBookToMockedScripture(57, "Philemon");
			AddTitleToMockedBook(m_philemon, "Philemon");
			m_section = AddSectionToMockedBook(m_philemon);
			m_para = AddParaToMockedSectionContent(m_section,
				ScrStyleNames.NormalParagraph);
			AddRunToMockedPara(m_para, "this is text", null);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:17,代码来源:TeEditingHelper_FindFootnoteNearSelectionTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IState类代码示例发布时间:2022-05-24
下一篇:
C# IStText类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap