XUnit ProbeAfterDecimalAlignedTab(XUnit tabStopPosition, out bool notFitting)
{
notFitting = false;
ParagraphIterator savedLeaf = this.currentLeaf;
//Extra for auto tab after list symbol
if (IsTab(this.currentLeaf.Current))
this.currentLeaf = this.currentLeaf.GetNextLeaf();
if (this.currentLeaf == null)
{
this.currentLeaf = savedLeaf;
return this.currentXPosition + tabStopPosition;
}
VerticalLineInfo newVerticalInfo = CalcCurrentVerticalInfo();
Rectangle fittingRect = this.formattingArea.GetFittingRect(this.currentYPosition, newVerticalInfo.height);
if (fittingRect == null)
{
notFitting = true;
this.currentLeaf = savedLeaf;
return this.currentXPosition;
}
if (IsPlainText(this.currentLeaf.Current))
{
Text text = (Text)this.currentLeaf.Current;
string word = text.Content;
int lastIndex = text.Content.LastIndexOfAny(new char[] { ',', '.' });
if (lastIndex > 0)
word = word.Substring(0, lastIndex);
XUnit wordLength = MeasureString(word);
notFitting = this.currentXPosition + wordLength >= formattingArea.X + formattingArea.Width + Tolerance;
if (!notFitting)
return this.formattingArea.X + tabStopPosition - wordLength;
else
return this.currentXPosition;
}
this.currentLeaf = savedLeaf;
return ProbeAfterRightAlignedTab(tabStopPosition, out notFitting);
}