SIL.FieldWorks.XWorks.InterestingTextList.TextPosition C# (CSharp) Method

TextPosition() private method

Return an index we can use to order StTexts in Scripture. Take the book index * 10,000. if not in the title, add (section index + 1)*2. If in contents add 1.
private TextPosition ( IStText text ) : int
text IStText
return int
		int TextPosition(IStText text)
		{
			ICmObject owner = text.Owner;
			int flid = text.OwningFlid;
			if (flid != ScrSectionTags.kflidContent &&
				flid != ScrSectionTags.kflidHeading
				&& flid != ScrBookTags.kflidTitle)
			{
				return -1;
			}
			if (flid == ScrBookTags.kflidTitle)
				return BookPosition((IScrBook)owner);
			var section = (IScrSection)owner;
			var book = (IScrBook)section.Owner;
			return BookPosition(book)
				   + section.IndexInOwner * 2 + 2
				   + (flid == ScrSectionTags.kflidContent ? 1 : 0);
		}