本文整理汇总了C#中SIL.FieldWorks.Common.RootSites.SelectionHelper.SetIch方法的典型用法代码示例。如果您正苦于以下问题:C# SelectionHelper.SetIch方法的具体用法?C# SelectionHelper.SetIch怎么用?C# SelectionHelper.SetIch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.Common.RootSites.SelectionHelper
的用法示例。
在下文中一共展示了SelectionHelper.SetIch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeParasInTable
/// ------------------------------------------------------------------------------------
/// <summary>
/// Merges the paras in table.
/// </summary>
/// <param name="helper">The helper.</param>
/// <param name="dpt">The problem deletion type.</param>
/// <returns><c>true</c> if we merged the paras, otherwise <c>false</c>.</returns>
/// ------------------------------------------------------------------------------------
internal protected bool MergeParasInTable(SelectionHelper helper, VwDelProbType dpt)
{
SelLevInfo[] levInfo = helper.GetLevelInfo(SelectionHelper.SelLimitType.Top);
if (levInfo[0].tag != (int)StText.StTextTags.kflidParagraphs)
return false;
ILocationTracker tracker = ((ITeView)Control).LocationTracker;
IScrBook book = new ScrBook(m_cache, tracker.GetBookHvo(
helper, SelectionHelper.SelLimitType.Anchor));
SelLevInfo tmpInfo;
IStText text;
if (helper.GetLevelInfoForTag((int)ScrBook.ScrBookTags.kflidTitle, out tmpInfo))
text = book.TitleOA;
else
{
IScrSection section = book.SectionsOS[tracker.GetSectionIndexInBook(
helper, SelectionHelper.SelLimitType.Anchor)];
text = (levInfo[1].tag == (int)ScrSection.ScrSectionTags.kflidHeading ?
section.HeadingOA : text = section.ContentOA);
}
int iPara = helper.GetLevelInfoForTag((int)StText.StTextTags.kflidParagraphs).ihvo;
StTxtPara currPara = (StTxtPara)text.ParagraphsOS[iPara];
ITsStrBldr bldr;
// Backspace at beginning of paragraph
if (dpt == VwDelProbType.kdptBsAtStartPara)
{
if (iPara <= 0)
{
MiscUtils.ErrorBeep();
return false;
}
StTxtPara prevPara = (StTxtPara)text.ParagraphsOS[iPara - 1];
int prevParaLen = prevPara.Contents.Length;
// Need to make sure we move the back translations
AboutToDelete(helper, currPara.Hvo, text.Hvo,
(int)StText.StTextTags.kflidParagraphs, iPara, false);
bldr = prevPara.Contents.UnderlyingTsString.GetBldr();
bldr.ReplaceTsString(prevPara.Contents.Length, prevPara.Contents.Length,
currPara.Contents.UnderlyingTsString);
prevPara.Contents.UnderlyingTsString = bldr.GetString();
text.ParagraphsOS.RemoveAt(iPara);
helper.SetIch(SelectionHelper.SelLimitType.Top, prevParaLen);
helper.SetIch(SelectionHelper.SelLimitType.Bottom, prevParaLen);
levInfo[0].ihvo = iPara - 1;
helper.SetLevelInfo(SelectionHelper.SelLimitType.Top, levInfo);
helper.SetLevelInfo(SelectionHelper.SelLimitType.Bottom, levInfo);
helper.SetSelection(true);
return true;
}
// delete at end of a paragraph
int cParas = text.ParagraphsOS.Count;
if (iPara + 1 >= cParas)
return false; // We don't handle merging across StTexts
StTxtPara nextPara = (StTxtPara)text.ParagraphsOS[iPara + 1];
// Need to make sure we move the back translations
AboutToDelete(helper, nextPara.Hvo, text.Hvo,
(int)StText.StTextTags.kflidParagraphs, iPara + 1, false);
bldr = currPara.Contents.UnderlyingTsString.GetBldr();
bldr.ReplaceTsString(currPara.Contents.Length, currPara.Contents.Length,
nextPara.Contents.UnderlyingTsString);
currPara.Contents.UnderlyingTsString = bldr.GetString();
text.ParagraphsOS.RemoveAt(iPara + 1);
helper.SetSelection(true);
return true;
}
示例2: MergeParasInTable
/// ------------------------------------------------------------------------------------
/// <summary>
/// Merges the paras in table.
/// </summary>
/// <param name="helper">The helper.</param>
/// <param name="dpt">The problem deletion type.</param>
/// <returns><c>true</c> if we merged the paras, otherwise <c>false</c>.</returns>
/// ------------------------------------------------------------------------------------
protected internal bool MergeParasInTable(SelectionHelper helper, VwDelProbType dpt)
{
SelLevInfo[] levInfo = helper.GetLevelInfo(SelectionHelper.SelLimitType.Top);
if (levInfo[0].tag != StTextTags.kflidParagraphs)
return false;
IStText text;
int iPara;
int tag;
IStTxtPara currPara = GetPara(helper, out text, out iPara, out tag);
// Backspace at beginning of paragraph
ITsStrBldr bldr;
if (dpt == VwDelProbType.kdptBsAtStartPara)
{
if (iPara <= 0)
{
MiscUtils.ErrorBeep();
return false;
}
IStTxtPara prevPara = text[iPara - 1];
int prevParaLen = prevPara.Contents.Length;
prevPara.MergeParaWithNext();
helper.SetIch(SelectionHelper.SelLimitType.Top, prevParaLen);
helper.SetIch(SelectionHelper.SelLimitType.Bottom, prevParaLen);
levInfo[0].ihvo = iPara - 1;
helper.SetLevelInfo(SelectionHelper.SelLimitType.Top, levInfo);
helper.SetLevelInfo(SelectionHelper.SelLimitType.Bottom, levInfo);
if (DeferSelectionUntilEndOfUOW)
{
// We are within a unit of work, so setting the selection will not work now.
// we request that a selection be made after the unit of work.
Debug.Assert(!helper.IsRange,
"Currently, a selection made during a unit of work can only be an insertion point.");
helper.SetIPAfterUOW(EditedRootBox.Site);
}
else
{
helper.SetSelection(true);
}
return true;
}
// delete at end of a paragraph
int cParas = text.ParagraphsOS.Count;
if (iPara + 1 >= cParas)
return false; // We don't handle merging across StTexts
currPara.MergeParaWithNext();
if (DeferSelectionUntilEndOfUOW)
{
// We are within a unit of work, so setting the selection will not work now.
// we request that a selection be made after the unit of work.
Debug.Assert(!helper.IsRange,
"Currently, a selection made during a unit of work can only be an insertion point.");
helper.SetIPAfterUOW(EditedRootBox.Site);
}
else
{
helper.SetSelection(true);
}
return true;
}