本文整理汇总了C#中SIL.FieldWorks.Common.RootSites.SelectionHelper.SetNumberOfLevels方法的典型用法代码示例。如果您正苦于以下问题:C# SelectionHelper.SetNumberOfLevels方法的具体用法?C# SelectionHelper.SetNumberOfLevels怎么用?C# SelectionHelper.SetNumberOfLevels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.Common.RootSites.SelectionHelper
的用法示例。
在下文中一共展示了SelectionHelper.SetNumberOfLevels方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupSelectionFor
/// ------------------------------------------------------------------------------------
/// <summary>
/// Sets up the specifed SelectionHelper for the specified paragraph and StText.
/// </summary>
/// <param name="helper">The SelectionHelper.</param>
/// <param name="text">The StText.</param>
/// <param name="para">The para.</param>
/// <param name="limit">The limit.</param>
/// <param name="view">The view</param>
/// ------------------------------------------------------------------------------------
private void SetupSelectionFor(SelectionHelper helper, IStText text, IStTxtPara para,
SelectionHelper.SelLimitType limit, FwRootSite view)
{
Debug.Assert((view is DraftView && ((DraftView)view).TeEditingHelper != null) ||
(view is FootnoteView && ((FootnoteView)view).EditingHelper != null));
helper.SetTextPropId(limit, StTxtParaTags.kflidContents);
if (view is DraftView)
{
DraftView draftView = (DraftView)view;
if ((text.OwningFlid == ScrSectionTags.kflidContent ||
text.OwningFlid == ScrSectionTags.kflidHeading))
{
// text belongs to section heading or contents
IScrSection section = (IScrSection)text.Owner;
Debug.Assert(section.OwningFlid == ScrBookTags.kflidSections);
helper.SetNumberOfLevels(limit, 4);
SelLevInfo[] info = helper.GetLevelInfo(limit);
info[0].ihvo = para.IndexInOwner;
info[0].tag = StTextTags.kflidParagraphs;
info[1].ihvo = 0;
info[1].tag = text.OwningFlid;
info[2].ihvo = section.IndexInOwner;
info[2].tag = ScrBookTags.kflidSections;
info[3].ihvo = draftView.TeEditingHelper.BookFilter.GetBookIndex((IScrBook)section.Owner);
info[3].tag = draftView.TeEditingHelper.BookFilter.Tag;
}
else
{
// text belongs to a book title
Debug.Assert(text.OwningFlid == ScrBookTags.kflidTitle);
IScrBook book = (IScrBook)text.Owner;
helper.SetNumberOfLevels(limit, 3);
SelLevInfo[] info = helper.GetLevelInfo(limit);
info[0].ihvo = para.IndexInOwner;
info[0].tag = StTextTags.kflidParagraphs;
info[1].ihvo = 0;
info[1].tag = text.OwningFlid;
info[2].ihvo = draftView.TeEditingHelper.BookFilter.GetBookIndex(book);
info[2].tag = draftView.TeEditingHelper.BookFilter.Tag;
}
}
else if (view is FootnoteView && text.OwningFlid == ScrBookTags.kflidFootnotes)
{
// text belongs to a footnote
FootnoteView footnoteView = (FootnoteView)view;
IStFootnote footnote = (IStFootnote)para.Owner;
IScrBook book = (IScrBook)text.Owner;
helper.SetNumberOfLevels(limit, 3);
SelLevInfo[] info = helper.GetLevelInfo(limit);
info[0].hvo = text.Hvo;
info[0].tag = StTextTags.kflidParagraphs;
info[1].hvo = footnote.Hvo;
info[1].ihvo = footnote.IndexInOwner;
info[1].tag = ScrBookTags.kflidFootnotes;
info[2].hvo = book.Hvo;
info[2].ihvo = footnoteView.BookFilter.GetBookIndex(book);
info[2].tag = footnoteView.BookFilter.Tag;
info[0].ich = info[1].ich = info[2].ich = -1;
}
}
示例2: SetupSelectionFor
/// ------------------------------------------------------------------------------------
/// <summary>
/// Setups the specifed SelectionHelper for the specified paragraph and StText.
/// </summary>
/// <param name="helper">The SelectionHelper.</param>
/// <param name="text">The StText.</param>
/// <param name="para">The para.</param>
/// <param name="limit">The limit.</param>
/// <param name="view">The view</param>
/// ------------------------------------------------------------------------------------
private void SetupSelectionFor(SelectionHelper helper, StText text, StTxtPara para,
SelectionHelper.SelLimitType limit, FwRootSite view)
{
Debug.Assert((view is DraftView && ((DraftView)view).TeEditingHelper != null) ||
(view is FootnoteView && ((FootnoteView)view).EditingHelper != null));
if (view is DraftView)
{
DraftView draftView = (DraftView)view;
if ((text.OwningFlid == (int)ScrSection.ScrSectionTags.kflidContent ||
text.OwningFlid == (int)ScrSection.ScrSectionTags.kflidHeading))
{
// text belongs to section heading or contents
ScrSection section = new ScrSection(m_fdoCache, text.OwnerHVO);
Debug.Assert(section.OwningFlid == (int)ScrBook.ScrBookTags.kflidSections);
helper.SetNumberOfLevels(limit, 4);
SelLevInfo[] info = helper.GetLevelInfo(limit);
info[0].ihvo = para.IndexInOwner;
info[0].tag = (int)StText.StTextTags.kflidParagraphs;
info[1].ihvo = text.IndexInOwner;
info[1].tag = text.OwningFlid;
info[2].ihvo = section.IndexInBook;
info[2].tag = (int)ScrBook.ScrBookTags.kflidSections;
info[3].ihvo = draftView.TeEditingHelper.BookFilter.GetBookIndex(section.OwnerHVO);
info[3].tag = draftView.TeEditingHelper.BookFilter.Tag;
helper.SetLevelInfo(SelectionHelper.SelLimitType.End, info);
}
else
{
// text belongs to a book title
Debug.Assert(text.OwningFlid == (int)ScrBook.ScrBookTags.kflidTitle);
ScrBook book = new ScrBook(m_fdoCache, text.OwnerHVO);
helper.SetNumberOfLevels(limit, 3);
SelLevInfo[] info = helper.GetLevelInfo(limit);
info[0].ihvo = para.IndexInOwner;
info[0].tag = (int)StText.StTextTags.kflidParagraphs;
info[1].ihvo = text.IndexInOwner;
info[1].tag = text.OwningFlid;
info[2].ihvo = draftView.TeEditingHelper.BookFilter.GetBookIndex(book.Hvo);
info[2].tag = draftView.TeEditingHelper.BookFilter.Tag;
helper.SetLevelInfo(SelectionHelper.SelLimitType.End, info);
}
}
else if (view is FootnoteView && text.OwningFlid == (int)ScrBook.ScrBookTags.kflidFootnotes)
{
// text belongs to a footnote
FootnoteView footnoteView = (FootnoteView)view;
StFootnote footnote = new StFootnote(m_fdoCache, para.OwnerHVO);
ScrBook book = new ScrBook(m_fdoCache, text.OwnerHVO);
helper.SetNumberOfLevels(limit, 3);
SelLevInfo[] info = helper.GetLevelInfo(limit);
info[0].hvo = text.Hvo;
info[0].tag = (int)StText.StTextTags.kflidParagraphs;
info[1].hvo = footnote.Hvo;
info[1].ihvo = footnote.IndexInOwner;
info[1].tag = (int)ScrBook.ScrBookTags.kflidFootnotes;
info[2].hvo = book.Hvo;
info[2].ihvo = footnoteView.BookFilter.GetBookIndex(book.Hvo);
info[2].tag = footnoteView.BookFilter.Tag;
info[0].ich = info[1].ich = info[2].ich = -1;
helper.SetLevelInfo(SelectionHelper.SelLimitType.End, info);
}
}