本文整理汇总了C#中IScrBook.FindCurrentFootnote方法的典型用法代码示例。如果您正苦于以下问题:C# IScrBook.FindCurrentFootnote方法的具体用法?C# IScrBook.FindCurrentFootnote怎么用?C# IScrBook.FindCurrentFootnote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScrBook
的用法示例。
在下文中一共展示了IScrBook.FindCurrentFootnote方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindFootnoteNearSelection
/// ------------------------------------------------------------------------------------
/// <summary>
/// Finds the nearest footnote before the given selection.
/// </summary>
/// <param name="helper">The selection helper.</param>
/// <param name="book">The book that owns the footnote collection.</param>
/// <param name="fSearchForward">True to also search forward within the current paragraph</param>
/// <returns></returns>
/// ------------------------------------------------------------------------------------
private IStFootnote FindFootnoteNearSelection(SelectionHelper helper, IScrBook book,
bool fSearchForward)
{
CheckDisposed();
if (helper == null)
helper = CurrentSelection;
if (helper == null || book == null)
return null;
SelLevInfo[] levels = helper.GetLevelInfo(SelectionHelper.SelLimitType.Anchor);
int iParagraph = -1;
int tag = 0;
int ich = helper.IchAnchor;
int paraLev = helper.GetLevelForTag(StTextTags.kflidParagraphs);
int contentLev = helper.GetLevelForTag(StTxtParaTags.kflidContents);
Debug.Assert(paraLev != -1, "Need a paragraph for this method");
iParagraph = levels[paraLev].ihvo;
int iSection = ((ITeView)Control).LocationTracker.GetSectionIndexInBook(
helper, SelectionHelper.SelLimitType.Anchor);
if (iSection < 0)
tag = ScrBookTags.kflidTitle;
else
{
tag = (helper.GetLevelForTag(ScrSectionTags.kflidContent) >= 0 ?
ScrSectionTags.kflidContent : ScrSectionTags.kflidHeading);
}
// Special case: if we're in the caption of a picture, get the ich from
// the first level instead of the anchor. (TE-4696)
if (contentLev >= 0 && levels[contentLev].ihvo == -1)
ich = levels[contentLev].ich;
IScrFootnote prevFootnote = null;
if (fSearchForward) // look first at our current position, if we are searching foward
prevFootnote = book.FindCurrentFootnote(iSection, iParagraph, ich, (int)tag);
if (prevFootnote == null)
{
IScrTxtPara para = m_repoScrTxtPara.GetObject(levels[paraLev].hvo);
ITsString tss = para.Contents;
if (ich != 0)
{
// look backwards in our current paragraph - skip the current run, except when
// at the end of the text.
prevFootnote = para.FindPrevFootnoteInContents(ref ich, ich < tss.Length);
}
else if (iParagraph > 0)
{
// look at the previous paragraph for a footnote at the end
IStText text = m_repoStText.GetObject(levels[paraLev + 1].hvo);
IScrTxtPara prevPara = (IScrTxtPara)text[iParagraph - 1];
ITsString prevTss = prevPara.Contents;
int ichTmp = -1;
prevFootnote = prevPara.FindPrevFootnoteInContents(ref ichTmp, false);
if (prevFootnote != null)
{
if (ichTmp == prevTss.Length - 1)
ich = ichTmp;
else
prevFootnote = null;
}
// ENHANCE: Look across contexts.
}
}
if (prevFootnote == null && fSearchForward)
{
// look ahead in the same paragraph
IScrTxtPara para = m_repoScrTxtPara.GetObject(levels[paraLev].hvo);
ITsString tss = para.Contents;
prevFootnote = para.FindNextFootnoteInContents(ref ich, true);
}
if (prevFootnote == null)
{
// just go back until we find one
prevFootnote = book.FindPrevFootnote(ref iSection, ref iParagraph, ref ich, ref tag);
}
return prevFootnote;
}