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


C# IVwSelection.get_ParagraphOffset方法代码示例

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


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

示例1: HandleFootnoteAnchorIconSelected

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Performs the delegated action if the given selection is for a footnote anchor icon.
		/// ENHANCE: This code currently assumes that any iconic representation of an ORC is
		/// for a footnote anchor. When we support showing picture anchors (or anything else)
		/// iconically, this will have to be changed to account for that.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected static void HandleFootnoteAnchorIconSelected(IVwSelection sel,
			FootnoteAnchorFoundDelegate action)
		{
			if (sel == null)
				throw new ArgumentNullException("sel");
			if (action == null)
				throw new ArgumentNullException("action");

			if (sel.SelType == VwSelType.kstPicture)
			{
				// See if this is a ORC-replacement picture, in which case we treat it
				// as a clickable object rather than a picture.
				int ichAnchor = sel.get_ParagraphOffset(false);
				int ichEnd = sel.get_ParagraphOffset(true);
				if (ichAnchor >= 0 && ichAnchor < ichEnd)
				{
					SelectionHelper selHelperOrc = SelectionHelper.Create(sel, sel.RootBox.Site);
					SelLevInfo info;
					bool found = false;
					switch (selHelperOrc.TextPropId)
					{
						case StTxtParaTags.kflidContents:
							found = selHelperOrc.GetLevelInfoForTag(StTextTags.kflidParagraphs, out info);
							break;
						case CmTranslationTags.kflidTranslation:
							found = (selHelperOrc.GetLevelInfoForTag(-1, out info) && selHelperOrc.Ws > 0);
							break;
						case SegmentTags.kflidFreeTranslation:
							if (selHelperOrc.GetLevelInfoForTag(StTxtParaTags.kflidSegments, out info) && selHelperOrc.Ws > 0)
							{
								// adjust anchor offset to be a segment offset - need to subtract off the beginning offset
								// for the segment.
								SelectionHelper selHelperStartOfSeg = new SelectionHelper(selHelperOrc);
								selHelperStartOfSeg.IchAnchor = selHelperStartOfSeg.IchEnd = 0;
								IVwSelection selSegStart = selHelperStartOfSeg.SetSelection(selHelperOrc.RootSite, false, false);
								ichAnchor -= selSegStart.get_ParagraphOffset(false);
								found = true;
							}
							break;
						default:
							// Ignore everything else because it doesn't have footnotes.
							return;
					}
					if (found)
						action(info.hvo, selHelperOrc.TextPropId, selHelperOrc.Ws, ichAnchor);
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:56,代码来源:RootSiteEditingHelper.cs


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