public void VisitPlaceholderTag(IPlaceholderTag tag) { if (tag.Properties.DisplayText.Length > 0) { var item = new RangeOfCharacterInfos { start = CollectedText.Length, length = tag.Properties.DisplayText.Length }; ListOfLockedRanges.Add(item); CollectedText += tag.Properties.DisplayText; } }
public void VisitText(IText text) { //Exclude text of the revision for deleted text if (text.Parent is IRevisionMarker) { var parent = text.Parent as IRevisionMarker; if (parent != null && parent.Properties.RevisionType == RevisionType.Delete) { return; } } if (!ListContainsMarkupData(text)) { _markupsListVisited.Add(text); if (text.Properties.Text.Length > 0) { //get the information about ranges of locked text if (_inLockedContent) { var item = new RangeOfCharacterInfos { start = CollectedText.Length, length = text.Properties.Text.Length }; ListOfLockedRanges.Add(item); } //Get information about the range if (_startOfRange != -1 && _endOfRange != -1) { var startOfMarkup = CollectedText.Length; var endOfMarkup = CollectedText.Length + text.Properties.Text.Length; var isMarkupInRange = false; //set start of the range if (_startOfRange >= startOfMarkup && _startOfRange <= endOfMarkup) { isMarkupInRange = !(_startOfRange != _endOfRange && //exclude not empty range _startOfRange == endOfMarkup); //which begin at the end of the markup data if (isMarkupInRange) { _startOffsetOfFirstElemInRange = _startOfRange - startOfMarkup; } } //set end of the range if (_endOfRange >= startOfMarkup && _endOfRange <= endOfMarkup) { isMarkupInRange = !(_startOfRange != _endOfRange && //exclude not empty range _endOfRange == startOfMarkup); //which begin at the start of the markup data if (isMarkupInRange) { _endOffsetOfLastElemInRange = _endOfRange - startOfMarkup; } } //All the markup data is in the range if (startOfMarkup >= _startOfRange && endOfMarkup <= _endOfRange) { isMarkupInRange = true; } if (isMarkupInRange) { _markupsListInRange.Add(text); } } //Collect the text CollectedText += text.Properties.Text; } } }