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


C# IStTxtPara.OwnerOfClass方法代码示例

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


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

示例1: SelectRangeOfChars

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Selects the text in the given paragraph in the specified scripture book at
		/// the specified offsets. The selection will be "installed" and scrolled into view.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void SelectRangeOfChars(int iBook, IStTxtPara para, int ichStart, int ichEnd)
		{
			// The text still exists at the same position, so highlight it.
			IStText text = (IStText)para.Owner;
			int iSection = -1;

			if (text.OwningFlid != ScrBookTags.kflidTitle)
				iSection = text.Owner.IndexInOwner;

			if (para.OwnerOfClass(ScrDraftTags.kClassId) != null)
				return; // The paragraph is owned by a ScrDraft. We don't want to use it!

			SelectRangeOfChars(iBook, iSection, text.OwningFlid, para.IndexInOwner,
				ichStart, ichEnd, true, true, false, VwScrollSelOpts.kssoDefault);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:21,代码来源:TeEditingHelper.cs

示例2: ExportParagraph

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Export a paragraph of a title, section heading, or section contents.
		/// </summary>
		/// <param name="para">the given paragraph</param>
		/// <param name="owningBook">The book that owns the paragraph</param>
		/// ------------------------------------------------------------------------------------
		protected void ExportParagraph(IStTxtPara para, IScrBook owningBook)
		{
			ExportMode exportMode = ExportMode.VernacularOnly;
			ITsString paraText;
			List<IScrFootnote> footnotes = null;
			if (m_exportScripture)
				paraText = para.Contents;
			else
			{	// get the tss of the requested back translation
				if (!m_exportBackTrans)
					return;

				footnotes = owningBook.FootnotesOS.Where(f => f.ParaContainingOrcRA == para).ToList();

				ICmTranslation trans = para.GetBT();
				paraText = (trans != null ?
					trans.Translation.get_String(m_nonInterleavedBtWs) : null);

				if (paraText == null)
				{
					// No useful translation. However, we still want to export the marker for
					// the paragraph, so create a dummy string so we have something to export.
					ITsStrFactory fact = TsStrFactoryClass.Create();
					paraText = fact.MakeString(string.Empty, m_nonInterleavedBtWs);
				}
				exportMode = ExportMode.BackTransOnly;
			}

			bool isEmptyPara = (paraText.Length == 0);

			// Pre-process this paragraph. If it begins with a chapter number, we need to export
			// the chapter marker before the paragraph marker.
			RefElement runTypeFound;
			ProcessParaStart(paraText, 0, out runTypeFound);

			// Get the paragraph style name.
			// TODO: if para.StyleRules is null, get the default paragraph style
			string styleName = null;
			if (para.StyleRules != null)
			{
				styleName = para.StyleRules.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
			}
			else
			{
				Debug.Fail("StyleRules should never be null.");
			}

			// If this is a section head style and it is for chapter 1 and there is no
			// text, then we skip it.
			IStStyle style = m_scr.FindStyle(styleName);
			if (style != null && style.Structure == StructureValues.Heading)
			{
				// Only skip the first section in intro or Scripture if it is the very first one.
				IScrSection section = para.OwnerOfClass<IScrSection>();
				if (section.IsIntro && !m_fFoundFirstIntroSection)
				{
					m_fFoundFirstIntroSection = true;
					if (isEmptyPara)
						return;
				}
				else if (!section.IsIntro && !m_fFoundFirstScrSection)
				{
					m_fFoundFirstScrSection = true;
					if (isEmptyPara)
						return;
				}
			}

			// Determine the marker for the paragraph.
			string paraMarker = GetMarkerForStyle(styleName);

			// Get the back translation if it exists and the options are enabled to export it
			// interleaved with scripture.
			ICmTranslation backTranslation = null;
			if (m_markupSystem == MarkupType.Toolbox && m_exportScripture && m_exportBackTrans)
			{
				backTranslation = para.GetBT(); //may return null if no BT exists
				exportMode = ExportMode.InterleavedVernAndBt;
			}

			// Export the fields of the paragraph,
			//  also the interleaved back translation if appropriate
			ExportParagraphDetails(paraMarker, paraText, backTranslation, para.Hvo, exportMode, footnotes);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:91,代码来源:ExportUsfm.cs


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