/// <summary>
        /// Gets the parent of the given element in the user interface hierarchy.
        /// </summary>
        /// <param name="element">The element whose parent is needed.</param>
        /// <returns>The parent element or null if the element passed is the
        /// root element in this technology.</returns>
        public override IUITechnologyElement GetParent(IUITechnologyElement element)
        {
            WordRange wordRange = element as WordRange;

            if (wordRange != null)
            {
                return(wordRange.Parent);
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Determines whether the specified object is equal to the current object.
        /// </summary>
        /// <param name="element">The object to compare with the current object.</param>
        /// <returns>True if the specified object is equal to the current object; otherwise, false.</returns>
        public override bool Equals(IUITechnologyElement element)
        {
            WordRange otherRange = element as WordRange;

            if (otherRange != null)
            {
                // Compare Name as window handle is sometime of hidden Word window.
                return(string.Equals(this.Name, otherRange.Name, StringComparison.Ordinal));
            }

            return(false);
        }
        /// <summary>
        /// Gets the enumerator for children of the given IUITechnologyElement.
        /// </summary>
        /// <param name="element">The IUITechnologyElement whose child enumerator is needed.</param>
        /// <param name="parsedQueryIdCookie">The cookie of previously parsed QueryId to filter matching children.</param>
        /// <returns>The enumerator for children.</returns>
        /// <seealso cref="ParseQueryId"/>
        public override System.Collections.IEnumerator GetChildren(IUITechnologyElement element, object parsedQueryIdCookie)
        {
            WordRange    wordRange = element as WordRange;
            AndCondition condition = parsedQueryIdCookie as AndCondition;

            if (wordRange != null)
            {
                if (condition != null)
                {
                    return(wordRange.GetChildren(condition));
                }

                return(new UITechnologyElement[] { }.GetEnumerator());
            }

            return(null);
        }