本文整理汇总了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);
}
}
}