本文整理汇总了C#中ITsString.get_RunAt方法的典型用法代码示例。如果您正苦于以下问题:C# ITsString.get_RunAt方法的具体用法?C# ITsString.get_RunAt怎么用?C# ITsString.get_RunAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITsString
的用法示例。
在下文中一共展示了ITsString.get_RunAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVernVerseNumberToInsert
/// ------------------------------------------------------------------------------------
/// <summary>
/// Given a position and selection in a vernacular paragraph string, use the current
/// reference and context to build the appropriate verse number string to insert at the
/// ich position. Ususally the current verse reference + 1.
/// </summary>
/// <param name="tss">The string</param>
/// <param name="ich">The character position we would like to insert a verse number at.
/// This is either on the current selection, or moved to a nearby "word" boundary.
/// </param>
/// <param name="selHelper">The selection helper on or near the ich</param>
/// <param name="fInVerse">true if ich is at an existing verse number</param>
/// <returns>The verse number string to insert, or null if the verse number would be
/// out of range</returns>
/// ------------------------------------------------------------------------------------
private string GetVernVerseNumberToInsert(ITsString tss, int ich, SelectionHelper selHelper,
bool fInVerse)
{
//Get the BCV end ref at the current selection
ScrReference refToInsert = CurrentEndRef;
// Note that our ich may be at a "word" boundary near the selection.
// If the ich is on a verse number, update refToInsert.Verse to its end value.
if (fInVerse)
{
string sVerseRun = tss.get_RunText(tss.get_RunAt(ich));
refToInsert.Verse = ScrReference.VerseToIntEnd(sVerseRun);
}
// If verse number is already at the end of this chapter (or beyond), quit now!
if (refToInsert.Verse >= refToInsert.LastVerse)
return null;
// Calculate the default next verse number: current verse ref + 1
string sVerseNum = m_scr.ConvertToString(refToInsert.Verse + 1);
// If we are already in a verse, we are done; this is the usual case for a verse num update
if (fInVerse)
return sVerseNum;
// we are inserting in text at ich...
// If we are at the beginning of the first scripture section, we insert verse 1.
if (selHelper.LevelInfo[0].ihvo == 0 && ich == 0 &&
IsFirstScriptureSection())
{
sVerseNum = m_scr.ConvertToString(1);
}
// If we directly follow a chapter number, we insert verse 1!
if (ich > 0)
{
ITsTextProps ttpPrev = tss.get_PropertiesAt(ich - 1);
if (ttpPrev.GetStrPropValue(
(int)FwTextPropType.ktptNamedStyle) ==
ScrStyleNames.ChapterNumber)
{
sVerseNum = m_scr.ConvertToString(1);
}
}
return sVerseNum;
}
示例2: GetIchLimRef_IfIchInRefAtParaStart
/// ------------------------------------------------------------------------------------
/// <summary>
/// Determine if the paragraph starts with chapter/verse run and the ich is within one
/// of these runs.
/// </summary>
/// <param name="tss">paragraph string</param>
/// <param name="ich">character offset</param>
/// <returns>ich after the reference or -1 if the paragraph does not begin with a
/// chapter/verse run</returns>
/// ------------------------------------------------------------------------------------
private static int GetIchLimRef_IfIchInRefAtParaStart(ITsString tss, int ich)
{
int iRun = tss.get_RunAt(ich);
ITsTextProps firstTtp = tss.get_Properties(0);
ITsTextProps ttp = tss.get_PropertiesAt(ich);
if ((StStyle.IsStyle(ttp, ScrStyleNames.VerseNumber) ||
StStyle.IsStyle(ttp, ScrStyleNames.ChapterNumber)) && iRun == 0)
{
return GetLimOfReference(tss, iRun, ref ttp);
}
else if (StStyle.IsStyle(firstTtp, ScrStyleNames.ChapterNumber) &&
StStyle.IsStyle(ttp, ScrStyleNames.VerseNumber) && iRun == 1)
{
// The first run is a chapter and the next is a verse number run.
// Return the lim of the verse number (current) run.
return tss.get_LimOfRun(iRun);
}
else if (iRun == 0 && IsBlank(tss, iRun))
{
// The first run contains only white space.
// Ignore this run and check the following runs.
if (tss.RunCount > 1)
{
ttp = tss.get_Properties(iRun + 1);
if (StStyle.IsStyle(ttp, ScrStyleNames.VerseNumber) ||
StStyle.IsStyle(ttp, ScrStyleNames.ChapterNumber))
{
return GetLimOfReference(tss, iRun + 1, ref ttp);
}
}
}
// Paragraph doesn't begin with a chapter/verse number run (or the ich
// wasn't in it).
return -1;
}
示例3: UpdateExistingVerseNumberInVern
/// ------------------------------------------------------------------------------------
/// <summary>
/// Given a verse number run in a vernacular paragraph string, create or extend a verse
/// bridge.
/// </summary>
/// <param name="hvoObj">The id of the paragraph being modified</param>
/// <param name="propTag">The flid (i.e., Contents)</param>
/// <param name="selHelper">The selection helper</param>
/// <param name="ichMin">The character offset at the beginning of the verse number
/// run</param>
/// <param name="ichLim">the end of the verse number run </param>
/// <param name="tss">The given string, in which we will update the verse number</param>
/// <param name="sVerseNumIns">output: String representation of the new end number appended
/// to verse bridge</param>
/// <param name="ichLimIns">output: the end offset of the updated verse number run</param>
/// <returns><c>true</c> if we updated a verse number/bridge; false if not</returns>
/// ------------------------------------------------------------------------------------
private bool UpdateExistingVerseNumberInVern(int hvoObj, int propTag,
SelectionHelper selHelper, int ichMin, int ichLim, ref ITsString tss,
out string sVerseNumIns, out int ichLimIns)
{
Debug.Assert(ichMin < ichLim);
ichLimIns = -1;
// Determine the appropriate verse number string to insert here
sVerseNumIns = GetVernVerseNumberToInsert(tss, ichMin, selHelper, true);
if (sVerseNumIns == null)
{
MiscUtils.ErrorBeep();
return false;
}
int iRun = tss.get_RunAt(ichMin);
string sCurrVerseNumber = tss.get_RunText(iRun);
string bridgeJoiner = m_scr.BridgeForWs(m_cache.DefaultVernWs);
int bridgePos = sCurrVerseNumber.IndexOf(bridgeJoiner, StringComparison.Ordinal);
int ichInsAt;
ITsTextProps ttpVerse = StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
m_cache.DefaultVernWs);
if (bridgePos != -1)
{
// Add to existing verse bridge (add an additional pylon or two)
ichInsAt = ichMin + bridgePos + bridgeJoiner.Length;
ReplaceInParaOrBt(hvoObj, propTag, 0, sVerseNumIns, ttpVerse, ichInsAt, ichLim,
ref tss, out ichLimIns);
}
else
{
// Create a verse bridge by adding to the existing number
ichInsAt = ichLim;
ReplaceInParaOrBt(hvoObj, propTag, 0, bridgeJoiner + sVerseNumIns, ttpVerse,
ichInsAt, ichInsAt, ref tss, out ichLimIns);
}
return true;
}
示例4: GetPreviousChapter
/// ------------------------------------------------------------------------------------
/// <summary>
/// Scan for previous chapter number run in a given ITsString.
/// </summary>
/// <param name="tss">given ITsString</param>
/// <param name="ichMin">starting character index</param>
/// <returns>value of previous chapter in tss, or 0 if no valid chapter found</returns>
/// ------------------------------------------------------------------------------------
private int GetPreviousChapter(ITsString tss, int ichMin)
{
for (int iRun = tss.get_RunAt(ichMin) - 1; iRun >= 0; iRun--)
{
ITsTextProps ttp = tss.get_Properties(iRun);
if (ttp.GetStrPropValue((int)FwTextPropType.ktptNamedStyle) ==
ScrStyleNames.ChapterNumber)
{
return ScrReference.ChapterToInt(tss.get_RunText(iRun));
}
}
return 0;
}
示例5: IsEditable
/// ------------------------------------------------------------------------------------
/// <summary>
/// Determines whether the specified string is editable.
/// </summary>
/// <param name="tss">The string.</param>
/// <param name="ichMin">The ich min.</param>
/// <param name="ichLim">The ich lim.</param>
/// <returns>
/// <c>true</c> if the specified string is editable; otherwise, <c>false</c>.
/// </returns>
/// ------------------------------------------------------------------------------------
private bool IsEditable(ITsString tss, int ichMin, int ichLim)
{
if (m_fReadOnly)
return false;
int irunLim = tss.get_RunAt(ichLim);
if (tss.get_RunAt(ichMin) == irunLim)
irunLim++;
for (int irun = tss.get_RunAt(ichMin); irun < irunLim; irun++)
{
ITsTextProps ttp = tss.get_Properties(irun);
int nVar;
if (ttp != null)
{
int nVal = ttp.GetIntPropValues((int)FwTextPropType.ktptEditable, out nVar);
if (nVal == (int)TptEditable.ktptNotEditable ||
nVal == (int)TptEditable.ktptSemiEditable)
return false;
}
}
return true;
}
示例6: InsertMissingVerseNumberInVern
/// ------------------------------------------------------------------------------------
/// <summary>
/// Given an IP selection in a vernacular paragraph, and a following verse number run,
/// determine if a verse number is missing and if so insert it at the IP.
/// </summary>
/// <param name="hvoObj">The id of the paragraph being modified</param>
/// <param name="propTag">The flid (i.e. Contents)</param>
/// <param name="selHelper">The selection helper, the IP where the insert verse command
/// was made</param>
/// <param name="ichIp">The character position of the selHelper</param>
/// <param name="ichMinNextVerse">The character offset at the beginning of the following
/// verse number run</param>
/// <param name="tss">The given string, in which we will update the verse number</param>
/// <param name="sVerseNumIns">output: String representation of the new verse number
/// inserted, or null if none inserted</param>
/// <param name="ichLimInserted">output: set to the end of the inserted verse number
/// run, or -1 if none inserted </param>
/// ------------------------------------------------------------------------------------
private void InsertMissingVerseNumberInVern(int hvoObj, int propTag,
SelectionHelper selHelper, int ichIp, int ichMinNextVerse,
ref ITsString tss, out string sVerseNumIns, out int ichLimInserted)
{
sVerseNumIns = null;
ichLimInserted = -1;
// get info on the following verse number run
string sVerseNumNext = tss.get_RunText(tss.get_RunAt(ichMinNextVerse));
if (sVerseNumNext == null) //should never be null, but just in case, we check
return;
int startVerseNext = ScrReference.VerseToIntStart(sVerseNumNext);
// Determine the appropriate verse number string to consider inserting at the IP
sVerseNumIns = GetVernVerseNumberToInsert(tss, ichIp, selHelper, false);
if (sVerseNumIns == null)
return;
int startVerseInsert = ScrReference.VerseToIntStart(sVerseNumIns);
// Is number to insert less than the next existing verse number?
if (startVerseInsert < startVerseNext)
{
// If so, the number to insert is missing! We need to insert it at the IP.
// Add space, if needed, before verse is inserted.
int ichIns = ichIp;
InsertSpaceIfNeeded(hvoObj, propTag, ichIns, 0, ref tss, ref ichIns);
// Now insert the new verse number
ITsTextProps ttpVerse = StyleUtils.CharStyleTextProps(ScrStyleNames.VerseNumber,
m_cache.DefaultVernWs);
ReplaceInParaOrBt(hvoObj, propTag, m_cache.DefaultVernWs, sVerseNumIns, ttpVerse,
ichIns, ichIns, ref tss, out ichLimInserted);
}
else
sVerseNumIns = null; // nothing inserted
}
示例7: FindFirstFootnoteInString
/// ------------------------------------------------------------------------------------
/// <summary>
/// Searches TsString forwards for first footnote reference.
/// </summary>
/// <param name="cache"></param>
/// <param name="tss"></param>
/// <param name="ich">Character index to start search.</param>
/// <param name="fSkipCurrentPosition">If <c>true</c> we search forward starting with the
/// run after ich, otherwise we start with the current run.</param>
/// <returns>First footnote in string after ich, or <c>null</c> if footnote can't be found.</returns>
/// ------------------------------------------------------------------------------------
public static ScrFootnote FindFirstFootnoteInString(FdoCache cache, ITsString tss,
ref int ich, bool fSkipCurrentPosition)
{
int irun = tss.get_RunAt(ich);
int runCount = tss.RunCount;
ITsTextProps tprops;
int footnoteHvo;
if (fSkipCurrentPosition)
irun++;
while (irun < runCount)
{
tprops = tss.get_Properties(irun);
footnoteHvo = GetFootnoteFromProps(cache, tprops);
if (footnoteHvo > 0)
{
ich = tss.get_LimOfRun(irun);
return new ScrFootnote(cache, footnoteHvo);
}
irun++;
}
return null;
}
示例8: InReference
/// ------------------------------------------------------------------------------------
/// <summary>
/// Determine if the given character position is in or next to a chapter/verse number
/// run in the given ITsString.
/// If we are, check the run beyond so we can locate the entire chapt
/// </summary>
/// <param name="tss">The string to examine</param>
/// <param name="ich">character index to look at</param>
/// <param name="fCheckForChapter">true if we want to include searching for chapters</param>
/// <param name="ichMin">output: Gets set to the beginning of the chapter/verse number
/// run if we find a verse/chapter number; otherwise -1</param>
/// <param name="ichLim">output: Gets set to the Lim of the chapter/verse number run if
/// we find a verse/chapter number; otherwise -1</param>
/// <param name="ichBetweenChapterAndVerse">NO LONGER USED
/// Was output: set to the position between the
/// chapter and verse number runs if we find a verse number and chapter number run
/// at (near) ich; otherwise -1</param>
/// <param name="fVerseAtIch">output: true if ich is in or next to a verse number</param>
/// <returns><c>true</c> if we find a verse number/bridge (and/or chapter);
/// <c>false</c> if not</returns>
/// ------------------------------------------------------------------------------------
private bool InReference(ITsString tss, int ich, bool fCheckForChapter, out int ichMin,
out int ichLim, out int ichBetweenChapterAndVerse, out bool fVerseAtIch)
{
ichMin = -1;
ichLim = -1;
ichBetweenChapterAndVerse = -1;
fVerseAtIch = false;
if (tss.Length == 0)
return false;
// Check the run to the right of ich
int iRun = tss.get_RunAt(ich);
if (FindRefRunMinLim(tss, iRun, fCheckForChapter,
out ichMin, out ichLim, out fVerseAtIch))
{
// We found a verse (or chapter) run. Check following run too.
if (tss.RunCount > iRun + 1)
{
bool dummy;
int ichMinNext, ichLimNext;
if (FindRefRunMinLim(tss, iRun + 1, fCheckForChapter,
out ichMinNext, out ichLimNext, out dummy))
{
// found another reference run. extend the ichLim.
ichLim = ichLimNext;
}
}
}
// if iRun is the first run: we are done, return our result
if (iRun == 0)
return (ichMin > -1);
// Is the char to the left of ich in the same run as ich??
int iRunPrevChar = tss.get_RunAt(ich - 1);
if (iRunPrevChar == iRun)
return (ichMin > -1); //no adjacent ref to the left, so we are done
// Check the run to the left of ich
bool dummy2;
int ichMinPrev, ichLimPrev;
if (FindRefRunMinLim(tss, iRunPrevChar, fCheckForChapter,
out ichMinPrev, out ichLimPrev, out dummy2))
{
// We found a verse (or chapter) run.
ichMin = ichMinPrev; // set or extend the ichMin
if (ichLim == -1) // reference not found after ich
ichLim = ichLimPrev;
// check an additional previous run, too
if (iRunPrevChar >= 1)
{
if (FindRefRunMinLim(tss, iRunPrevChar - 1, fCheckForChapter,
out ichMinPrev, out ichLimPrev, out dummy2))
{
// found a second previous reference run. extend the ichMin.
ichMin = ichMinPrev;
}
}
}
return (ichMin > -1);
}
示例9: HasLabelText
/// <summary>
/// Test whether a run of text in a TsString contains 'label' text which should cause a segment break.
/// (Current definition is that there are characters in the range with the Scripture styles VerseNumber
/// or ChapterNumber, or the range being tested is a single character (possibly part of a longer run)
/// which is a hard line break.
/// </summary>
internal static bool HasLabelText(ITsString tss, int ichMin, int ichLim)
{
// True if the run at ichMin has one of the interesting styles or is an ORC.
int irun = tss.get_RunAt(ichMin);
if (IsLabelText(tss, irun, false))
return true;
// See if any later run in the character range has the required style or is an ORC.
int crun = tss.RunCount;
for (irun++; irun < crun && tss.get_MinOfRun(irun) < ichLim; irun++)
{
if (IsLabelText(tss, irun, false))
return true;
}
// All other ways it might be treated as a label have failed, so return false
// unless it is a one-character range containing a hard line break.
if (ichLim == ichMin + 1)
return tss.GetChars(ichMin, ichLim) == StringUtils.kChHardLB.ToString();
return false;
}
示例10: GetWsFromString
private static int GetWsFromString(ITsString tss, int ichMin, int ichLim)
{
if (tss == null || tss.Length == 0 || ichMin >= ichLim)
return 0;
int runMin = tss.get_RunAt(ichMin);
int runMax = tss.get_RunAt(ichLim - 1);
int ws = tss.get_WritingSystem(runMin);
if (runMin == runMax)
return ws;
for (int i = runMin + 1; i <= runMax; ++i)
{
int wsT = tss.get_WritingSystem(i);
if (wsT != ws)
return 0;
}
return ws;
}
示例11: VerifyObjData
private void VerifyObjData(ITsString tss, int ichMin, int ichLim, string newPath)
{
var objData = tss.get_StringPropertyAt(ichMin, (int)FwTextPropType.ktptObjData);
Assert.That(objData, Is.Not.Null);
Assert.That(objData.Length, Is.GreaterThan(1));
Assert.That(objData[0], Is.EqualTo(Convert.ToChar((int)FwObjDataTypes.kodtExternalPathName)));
Assert.That(objData.Substring(1), Is.EqualTo(newPath));
int ichMinActual, ichLimActual;
tss.GetBoundsOfRun(tss.get_RunAt(ichMin), out ichMinActual, out ichLimActual);
Assert.That(ichLimActual, Is.EqualTo(ichLim));
}
示例12: FindBtFootnoteIndex
/// ------------------------------------------------------------------------------------
/// <summary>
/// Determine the zero-based index within a paragraph of a footnote to be inserted in
/// the back translation.</summary>
/// <param name="ichBtSel">the character offset in the back translation paragraph</param>
/// <param name="btTss">back translation ITsString</param>
/// <returns>zero-based index of a footnote to be inserted</returns>
/// ------------------------------------------------------------------------------------
private int FindBtFootnoteIndex(int ichBtSel, ITsString btTss)
{
// Scan through the back translation paragraph to find the index of the footnote
// to insert
int iRun = 0;
int iBtFootnote = 0;
int cFullRunsBeforeIchBtSel = (ichBtSel < btTss.Length) ? btTss.get_RunAt(ichBtSel) : btTss.RunCount;
while (iRun < cFullRunsBeforeIchBtSel)
{
if (TsStringUtils.GetHotObjectGuidFromProps(btTss.get_Properties(iRun)) != Guid.Empty)
{
// Found footnote ORC in back translation
iBtFootnote++;
}
iRun++;
}
return iBtFootnote;
}
示例13: GetPreviousChapter
/// ------------------------------------------------------------------------------------
/// <summary>
/// Scan for previous chapter number run in a given ITsString.
/// </summary>
/// <param name="tss">given ITsString</param>
/// <param name="ichMin">starting character index</param>
/// <returns>value of previous chapter in tss, or 0 if no valid chapter found</returns>
/// ------------------------------------------------------------------------------------
private int GetPreviousChapter(ITsString tss, int ichMin)
{
for (int iRun = tss.get_RunAt(ichMin) - 1; iRun >= 0; iRun--)
{
if (tss.Style(iRun) == ScrStyleNames.ChapterNumber)
return ScrReference.ChapterToInt(tss.get_RunText(iRun));
}
return 0;
}
示例14: GetMatchingVerseNumberFromVern
/// ------------------------------------------------------------------------------------
/// <summary>
/// Given a BT string and ich, find the matching verse number string in the given
/// vernacular string (or the next one if fGetNext is true).
/// </summary>
/// <param name="tssBt">given BT string</param>
/// <param name="ich">character offset in BT string</param>
/// <param name="wsBt">writing system of the BT</param>
/// <param name="vernTss">given vernacular string</param>
/// <param name="fGetNext">if false, we get the associated verse number from the
/// vernacular; if true, we get the next verse number after the associated one</param>
/// <param name="sChapterRunVern">the string of a chapter number run,
/// if one was found just before the verse number we found; else null</param>
/// <returns>The verse number string found in the vernacular, or null if none</returns>
/// <remarks>If associated verse number match in vernacular is within bridge,
/// its usefulness depends on fGetNext and whether we match the beginning or the end.
/// Details are documented in the code. Unuseable matches will return null.</remarks>
/// ------------------------------------------------------------------------------------
private string GetMatchingVerseNumberFromVern(ITsString tssBt, int ich, int wsBt,
ITsString vernTss, bool fGetNext, out string sChapterRunVern)
{
string sVerseRunVern = null;
sChapterRunVern = null;
BCVRef curRefStartBt;
BCVRef curRefEndBt;
// Get the current verse/chapter in the BT at ich
ChapterVerseFound CvFoundBt = ScrTxtPara.GetBCVRefAtPosWithinTss(tssBt, ich,
true, out curRefStartBt, out curRefEndBt);
// If we found a verse...
if (CvFoundBt == ChapterVerseFound.Verse
|| CvFoundBt == (ChapterVerseFound.Chapter | ChapterVerseFound.Verse))
{
// Find the associated verse number in the vernacular para
int ichLimVern;
// First, find the same verse number in the vernacular para
// note: param chapterFoundVern is set true because we assume our parent
// paragraph is in the right chapter.
bool chapterFoundVern = true;
bool verseFoundVern;
int verseStartVern, verseEndVern;
verseFoundVern = FindVerseNumberInTss(curRefStartBt, vernTss, false,
ref chapterFoundVern, out ichLimVern, out verseStartVern, out verseEndVern);
// Did we find matching verse number run in the vernacular para?
if (verseFoundVern)
{
// ichLimVern is already at the Lim of the associated verse number
Debug.Assert(ichLimVern > 0);
if (fGetNext)
{
// we want to get the following verse
// if we found a bridge, we can use it only if we match the end of bridge
if (verseStartVern != verseEndVern && verseEndVern != curRefEndBt.Verse)
{
// the end references do not match-- this is not a useful match.
sVerseRunVern = null;
}
else // most common case - get the following verse number
{
sVerseRunVern = GetNextVerseNumberRun (vernTss, ichLimVern,
out sChapterRunVern);
}
}
else
{
// get the one we found
sVerseRunVern = vernTss.get_RunText(vernTss.get_RunAt(ichLimVern - 1));
// if we found a bridge, we can use it only if we match the start of bridge
ScrReference.VerseToInt(sVerseRunVern, out verseStartVern, out verseEndVern);
if (verseStartVern != curRefStartBt.Verse)
{
// our match is deep within a bridged verse number; we can't use it
sVerseRunVern = null;
}
}
}
else if (ichLimVern > 0)
{
// We did not find curRefStartBt in the vernacular, but we did find a
// higher verse number.
Debug.Assert(false, "FindVerseNumberInTss should never find a greater verse");
}
else
{
// No match and no larger verse number in the vernacular.
// In this case, user should begin inserting at start of BT para to synchronize
// with the vernacular translation.
sVerseRunVern = null;
}
}
else if (CvFoundBt == ChapterVerseFound.Chapter)
{
MiscUtils.ErrorBeep(); // TODO TE-2278: Need to implement this scenario
return "400 CHAPTER FOUND, NO VERSE";
}
else // No chapter or verse found in the back translation
{
//.........这里部分代码省略.........
示例15: FindLastFootnoteInString
/// ------------------------------------------------------------------------------------
/// <summary>
/// Searches TsString backwards for last footnote reference.
/// </summary>
/// <param name="cache"></param>
/// <param name="tss"></param>
/// <param name="ich">Character index to start search, or -1 to start at the end of
/// the string.</param>
/// <param name="fSkipCurrentPosition">If <c>true</c> we search backwards starting with the
/// run before ich, otherwise we start with the run ich is in.</param>
/// <returns>Last footnote in string, or <c>null</c> if footnote can't be found.</returns>
/// ------------------------------------------------------------------------------------
public static ScrFootnote FindLastFootnoteInString(FdoCache cache, ITsString tss,
ref int ich, bool fSkipCurrentPosition)
{
if (ich == -1)
{
fSkipCurrentPosition = false;
ich = tss.Length;
}
ITsTextProps tprops = (fSkipCurrentPosition ? null : tss.get_PropertiesAt(ich));
int footnoteHvo = (fSkipCurrentPosition ? 0 : GetFootnoteFromProps(cache, tprops));
//TODO: TE-4199 if ich beyond the text, we must fix this so we do not skip the last run
int irun = tss.get_RunAt(ich);
while (footnoteHvo <= 0 && irun > 0)
{
irun--;
tprops = tss.get_Properties(irun);
footnoteHvo = GetFootnoteFromProps(cache, tprops);
}
ich = tss.get_MinOfRun(irun);
return footnoteHvo <= 0 ? null : new ScrFootnote(cache, footnoteHvo);
}