/// <summary>Gets the collection of child elements of the <see cref="T:System.Windows.Controls.FlowDocumentScrollViewer" /> that is associated with this <see cref="T:System.Windows.Automation.Peers.FlowDocumentScrollViewerAutomationPeer" />. This method is called by <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetChildren" />.</summary>
        /// <returns>The collection of child elements.</returns>
        // Token: 0x06002690 RID: 9872 RVA: 0x000B76CC File Offset: 0x000B58CC
        protected override List <AutomationPeer> GetChildrenCore()
        {
            List <AutomationPeer> list = base.GetChildrenCore();

            if (!(base.Owner is IFlowDocumentViewer))
            {
                FlowDocument document = ((FlowDocumentScrollViewer)base.Owner).Document;
                if (document != null)
                {
                    AutomationPeer automationPeer = ContentElementAutomationPeer.CreatePeerForElement(document);
                    if (this._documentPeer != automationPeer)
                    {
                        if (this._documentPeer != null)
                        {
                            this._documentPeer.OnDisconnected();
                        }
                        this._documentPeer = (automationPeer as DocumentAutomationPeer);
                    }
                    if (automationPeer != null)
                    {
                        if (list == null)
                        {
                            list = new List <AutomationPeer>();
                        }
                        list.Add(automationPeer);
                    }
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        /// <summary>
        /// <see cref="AutomationPeer.GetChildrenCore"/>
        /// </summary>
        /// <remarks>
        /// AutomationPeer associated with FlowDocumentScrollViewer returns an AutomationPeer
        /// for hosted Document and for elements in the style.
        /// </remarks>
        protected override List <AutomationPeer> GetChildrenCore()
        {
            // Get children for all elements in the style.
            List <AutomationPeer> children = base.GetChildrenCore();

            // Add AutomationPeer associated with the document.
            // Make it the first child of the collection.
            FlowDocument document = ((FlowDocumentReader)Owner).Document;

            if (document != null)
            {
                AutomationPeer documentPeer = ContentElementAutomationPeer.CreatePeerForElement(document);
                if (_documentPeer != documentPeer)
                {
                    if (_documentPeer != null)
                    {
                        _documentPeer.OnDisconnected();
                    }
                    _documentPeer = documentPeer as DocumentAutomationPeer;
                }
                if (documentPeer != null)
                {
                    if (children == null)
                    {
                        children = new List <AutomationPeer>();
                    }
                    children.Add(documentPeer);
                }
            }

            return(children);
        }
Exemplo n.º 3
0
        /// <summary>Retrieves the UI Automation provider for the specified cell.</summary>
        /// <param name="row"> The ordinal number of the row of interest.</param>
        /// <param name="column"> The ordinal number of the column of interest.</param>
        /// <returns>The UI Automation provider for the specified cell.</returns>
        // Token: 0x06002821 RID: 10273 RVA: 0x000BB9EC File Offset: 0x000B9BEC
        IRawElementProviderSimple IGridProvider.GetItem(int row, int column)
        {
            if (row < 0 || row >= ((IGridProvider)this).RowCount)
            {
                throw new ArgumentOutOfRangeException("row");
            }
            if (column < 0 || column >= ((IGridProvider)this).ColumnCount)
            {
                throw new ArgumentOutOfRangeException("column");
            }
            int   num   = 0;
            Table table = (Table)base.Owner;

            foreach (TableRowGroup tableRowGroup in ((IEnumerable <TableRowGroup>)table.RowGroups))
            {
                if (num + tableRowGroup.Rows.Count < row)
                {
                    num += tableRowGroup.Rows.Count;
                }
                else
                {
                    foreach (TableRow tableRow in ((IEnumerable <TableRow>)tableRowGroup.Rows))
                    {
                        if (num == row)
                        {
                            foreach (TableCell tableCell in ((IEnumerable <TableCell>)tableRow.Cells))
                            {
                                if (tableCell.ColumnIndex <= column && tableCell.ColumnIndex + tableCell.ColumnSpan > column)
                                {
                                    return(base.ProviderFromPeer(ContentElementAutomationPeer.CreatePeerForElement(tableCell)));
                                }
                            }
                            foreach (TableCell tableCell2 in tableRow.SpannedCells)
                            {
                                if (tableCell2.ColumnIndex <= column && tableCell2.ColumnIndex + tableCell2.ColumnSpan > column)
                                {
                                    return(base.ProviderFromPeer(ContentElementAutomationPeer.CreatePeerForElement(tableCell2)));
                                }
                            }
                        }
                        else
                        {
                            num++;
                        }
                    }
                }
            }
            return(null);
        }
        /// <summary>
        /// Retrieves AutomationPeer for the document.
        /// </summary>
        /// <returns></returns>
        private AutomationPeer GetDocumentAutomationPeer()
        {
            AutomationPeer           documentPeer = null;
            IDocumentPaginatorSource document     = ((DocumentViewerBase)Owner).Document;

            if (document != null)
            {
                if (document is UIElement)
                {
                    documentPeer = UIElementAutomationPeer.CreatePeerForElement((UIElement)document);
                }
                else if (document is ContentElement)
                {
                    documentPeer = ContentElementAutomationPeer.CreatePeerForElement((ContentElement)document);
                }
            }
            return(documentPeer);
        }
Exemplo n.º 5
0
        /// <summary>
        /// <see cref="AutomationPeer.GetChildrenCore"/>
        /// </summary>
        /// <remarks>
        /// AutomationPeer associated with FlowDocumentScrollViewer returns an AutomationPeer
        /// for hosted Document and for elements in the style.
        /// </remarks>
        protected override List <AutomationPeer> GetChildrenCore()
        {
            // Get children for all elements in the style.
            List <AutomationPeer> children = base.GetChildrenCore();

            // If the owner is IFlowDocumentViewer, it means that it is embedded inside
            // FlowDocumentReaer. In this case DocumentAutumationPeer is already exposed.
            // Hence there is no need to add it to children collection.
            if (!(Owner is IFlowDocumentViewer))
            {
                // Add AutomationPeer associated with the document.
                // Make it the first child of the collection.
                FlowDocument document = ((FlowDocumentScrollViewer)Owner).Document;
                if (document != null)
                {
                    AutomationPeer documentPeer = ContentElementAutomationPeer.CreatePeerForElement(document);
                    if (_documentPeer != documentPeer)
                    {
                        if (_documentPeer != null)
                        {
                            _documentPeer.OnDisconnected();
                        }
                        _documentPeer = documentPeer as DocumentAutomationPeer;
                    }
                    if (documentPeer != null)
                    {
                        if (children == null)
                        {
                            children = new List <AutomationPeer>();
                        }
                        children.Add(documentPeer);
                    }
                }
            }

            return(children);
        }