Ejemplo n.º 1
0
 public void VisitPlaceholderTag(IPlaceholderTag tag)
 {
     if (tag.Properties.DisplayText.Length > 0)
     {
         RangeOfCharacterInfos item = new RangeOfCharacterInfos {
             start = _collectedText.Length, length = tag.Properties.DisplayText.Length
         };
         _listOfLockedRanges.Add(item);
         _collectedText += tag.Properties.DisplayText;
     }
 }
Ejemplo n.º 2
0
        public void VisitText(IText text)
        {
            //Exclude text of the revision for deleted text
            if (text.Parent is IRevisionMarker)
            {
                IRevisionMarker 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)
                    {
                        RangeOfCharacterInfos item = new RangeOfCharacterInfos {
                            start = _collectedText.Length, length = text.Properties.Text.Length
                        };
                        _listOfLockedRanges.Add(item);
                    }

                    //Get information about the range
                    if (_startOfRange != -1 && _endOfRange != -1)
                    {
                        int  startOfMarkup   = _collectedText.Length;
                        int  endOfMarkup     = _collectedText.Length + text.Properties.Text.Length;
                        bool 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;
                }
            }
        }