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


C# ITsString.Style方法代码示例

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


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

示例1: IsLabelText

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Test whether a run in a TsString contains 'label' text which should cause a segment break.
		/// True if it has one of the interesting styles or the whole run is an ORC and
		/// fTreatOrcsAsLabels is true.
		/// Nb: this method won't detect hard line breaks. Hard line breaks are also forced
		/// (elsewhere) to be their own segment.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private static bool IsLabelText(ITsString tss, int irun, bool fTreatOrcsAsLabels)
		{
			return (IsLabelStyle(tss.Style(irun)) || (fTreatOrcsAsLabels && tss.get_IsRunOrc(irun)));
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:ITextUtils.cs

示例2: GetPreviousChapter

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Scan for previous chapter number run in a given ITsString.
		/// </summary>
		/// <param name="tss">given ITsString</param>
		/// <param name="ichMin">starting character index</param>
		/// <returns>value of previous chapter in tss, or 0 if no valid chapter found</returns>
		/// ------------------------------------------------------------------------------------
		private int GetPreviousChapter(ITsString tss, int ichMin)
		{
			for (int iRun = tss.get_RunAt(ichMin) - 1; iRun >= 0; iRun--)
			{
				if (tss.Style(iRun) == ScrStyleNames.ChapterNumber)
					return ScrReference.ChapterToInt(tss.get_RunText(iRun));
			}

			return 0;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:18,代码来源:TeEditingHelper.cs

示例3: FindRefRunMinLim

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Retrieve the extent of the current run if it is a chapter (optionally) or verse
		/// number.
		/// </summary>
		/// <param name="tss">paragraph</param>
		/// <param name="iRun">run index</param>
		/// <param name="fCheckForChapter">true if we want to include searching for chapters
		/// </param>
		/// <param name="ichMin">output: index at beginning of run</param>
		/// <param name="ichLim">output: index at limit of run</param>
		/// <param name="fIsVerseNumber">output: <c>true</c> if this run is a verse number run
		/// </param>
		/// <returns><c>true</c> if this run is a verse number/bridge (or chapter, if checking
		/// for that); <c>false</c> if not</returns>
		/// ------------------------------------------------------------------------------------
		private bool FindRefRunMinLim(ITsString tss, int iRun, bool fCheckForChapter,
			out int ichMin, out int ichLim, out bool fIsVerseNumber)
		{
			ichMin = -1;
			ichLim = -1;

			// Check current run to see if it's a verse (or chapter) number.
			fIsVerseNumber = tss.Style(iRun) == ScrStyleNames.VerseNumber;
			bool fIsChapterNumber = false;

			if (!fIsVerseNumber && fCheckForChapter)
				fIsChapterNumber = tss.Style(iRun) == ScrStyleNames.ChapterNumber;

			if (fIsVerseNumber || fIsChapterNumber)
			{
				ichMin = tss.get_MinOfRun(iRun);
				ichLim = tss.get_LimOfRun(iRun);
			}

			return (fIsVerseNumber || fIsChapterNumber);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:37,代码来源:TeEditingHelper.cs

示例4: ParaBeginsWithImplicitFirstVerse

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Checks to see if the given paragraph text, starting at the given run index,
		///  begins with an implicit first verse.
		/// </summary>
		/// <remarks>If the user chooses to enter the text of verse one without a verse number "1"
		/// run preceeding it, we call it an implicit verse one. In SF export, we need to
		/// explicitly output a \v 1 field for such an implicit first verse.</remarks>
		/// <param name="tssPara">The paragraph to check.</param>
		/// <param name="iChapterRun">The index of or just after the run of the chapter number.</param>
		/// <returns>True, if an implicit first verse exists, and \v1 should be added to the output.</returns>
		/// ------------------------------------------------------------------------------------
		private bool ParaBeginsWithImplicitFirstVerse(ITsString tssPara, int iChapterRun)
		{
			// Get the run after the chapter number.
			int indexOfNextRunAfterChapter = iChapterRun;
			if (tssPara.get_Properties(iChapterRun).Style() == ScrStyleNames.ChapterNumber)
				indexOfNextRunAfterChapter = iChapterRun + 1;

			// If there are no more runs after the chapter number then the chapter number
			// is by itself and we should not output an implied verse number
			if (indexOfNextRunAfterChapter >= tssPara.RunCount)
				return false;

			// Check if there is a verse number run directly after the chapter number.
			if (tssPara.Style(indexOfNextRunAfterChapter) == ScrStyleNames.VerseNumber)
				return false; // Real verse number found, so implicit verse not needed.

			// If not, check that there is no verse 1 later on in the paragraph.
			ITsTextProps runProps;
			string charStyleName;
			for (int iRun = iChapterRun; iRun < tssPara.RunCount; iRun++)
			{
				runProps = tssPara.get_Properties(iRun);
				charStyleName = runProps.Style();

				if (charStyleName == ScrStyleNames.VerseNumber)
				{
					int startVerse, endVerse;
					ScrReference.VerseToInt(tssPara.get_RunText(iRun), out startVerse, out endVerse);

					if (startVerse == 1)
						return false; // Explicit verse number found so implicit verse not needed.

					break;
				}
			}
			return true;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:49,代码来源:ExportUsfm.cs


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