Ejemplo n.º 1
0
        // convert a range given by TextPointers to a UIA TextRange
        // (helper method for raising ActiveTextPositionChanged event)
        internal ITextRangeProvider TextRangeFromTextPointers(ITextPointer rangeStart, ITextPointer rangeEnd)
        {
            // special case for the entire range
            if (rangeStart == null && rangeEnd == null)
            {
                return(null);
            }

            // map null into the appropriate endpoint
            rangeStart = rangeStart ?? _textContainer.Start;
            rangeEnd   = rangeEnd ?? _textContainer.End;

            // if either pointer belongs to the wrong tree, return null (meaning "entire range")
            if (rangeStart.TextContainer != _textContainer || rangeEnd.TextContainer != _textContainer)
            {
                return(null);
            }

            // swap the pointers, if necessary
            if (rangeStart.CompareTo(rangeEnd) > 0)
            {
                ITextPointer temp = rangeStart;
                rangeStart = rangeEnd;
                rangeEnd   = rangeStart;
            }

            // return the resulting range, wrapped so that it's ready for use by UIA
            ITextRangeProvider textRange = new TextRangeAdaptor(this, rangeStart, rangeEnd, _textPeer);

            return(TextRangeProviderWrapper.WrapArgument(textRange, _textPeer));
        }
Ejemplo n.º 2
0
        private object FindText(object arg)
        {
            object[] args       = (object[])arg;
            string   text       = (string)args[0];
            bool     backward   = (bool)args[1];
            bool     ignoreCase = (bool)args[2];

            return(TextRangeProviderWrapper.WrapArgument(_iface.FindText(text, backward, ignoreCase), _peer));
        }
Ejemplo n.º 3
0
        private object FindAttribute(object arg)
        {
            object[] args      = (object[])arg;
            int      attribute = (int)args[0];
            object   val       = args[1];
            bool     backward  = (bool)args[2];

            return(TextRangeProviderWrapper.WrapArgument(_iface.FindAttribute(attribute, val, backward), _peer));
        }
Ejemplo n.º 4
0
        private object CompareEndpoints(object arg)
        {
            object[] args = (object[])arg;
            TextPatternRangeEndpoint endpoint       = (TextPatternRangeEndpoint)args[0];
            ITextRangeProvider       targetRange    = (ITextRangeProvider)args[1];
            TextPatternRangeEndpoint targetEndpoint = (TextPatternRangeEndpoint)args[2];

            return(_iface.CompareEndpoints(endpoint, TextRangeProviderWrapper.UnwrapArgument(targetRange), targetEndpoint));
        }
Ejemplo n.º 5
0
        private object MoveEndpointByRange(object arg)
        {
            object[] args = (object[])arg;
            TextPatternRangeEndpoint endpoint       = (TextPatternRangeEndpoint)args[0];
            ITextRangeProvider       targetRange    = (ITextRangeProvider)args[1];
            TextPatternRangeEndpoint targetEndpoint = (TextPatternRangeEndpoint)args[2];

            _iface.MoveEndpointByRange(endpoint, TextRangeProviderWrapper.UnwrapArgument(targetRange), targetEndpoint);
            return(null);
        }
Ejemplo n.º 6
0
 private object GetDocumentRange(object unused)
 {
     return(TextRangeProviderWrapper.WrapArgument(_iface.DocumentRange, _peer));
 }
Ejemplo n.º 7
0
        private object RangeFromPoint(object arg)
        {
            Point screenLocation = (Point)arg;

            return(TextRangeProviderWrapper.WrapArgument(_iface.RangeFromPoint(screenLocation), _peer));
        }
Ejemplo n.º 8
0
        private object RangeFromChild(object arg)
        {
            IRawElementProviderSimple childElement = (IRawElementProviderSimple)arg;

            return(TextRangeProviderWrapper.WrapArgument(_iface.RangeFromChild(childElement), _peer));
        }
Ejemplo n.º 9
0
 private object GetVisibleRanges(object unused)
 {
     return(TextRangeProviderWrapper.WrapArgument(_iface.GetVisibleRanges(), _peer));
 }
Ejemplo n.º 10
0
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        private object GetSelection(object unused)
        {
            return(TextRangeProviderWrapper.WrapArgument(_iface.GetSelection(), _peer));
        }
Ejemplo n.º 11
0
        private object Compare(object arg)
        {
            ITextRangeProvider range = (ITextRangeProvider)arg;

            return(_iface.Compare(TextRangeProviderWrapper.UnwrapArgument(range)));
        }
Ejemplo n.º 12
0
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        private object Clone(object unused)
        {
            return(TextRangeProviderWrapper.WrapArgument(_iface.Clone(), _peer));
        }