/// <summary>
 /// Communicates the last selection to the user as detail-region-message and audio output.
 /// </summary>
 /// <param name="immediately">if set to <c>true</c> immediately.</param>
 public void CommunicateLastSelection(bool immediately = true)
 {
     if (OoDrawAccessibilityObserver.Instance != null)
     {
         OoAccessibilitySelection selection = null;
         bool success = OoDrawAccessibilityObserver.Instance.TryGetSelection(GetActiveDocument(), out selection);
         if (success && selection != null)
         {
             CommunicateSelection(selection.SelectedItems, immediately);
         }
     }
 }
        /// <summary>
        /// Gets the current GUI selection.
        /// </summary>
        /// <returns></returns>
        public OoShapeObserver GetCurrentSelection()
        {
            if (OoDrawAccessibilityObserver.Instance != null)
            {
                OoAccessibilitySelection selection = null;
                bool success = OoDrawAccessibilityObserver.Instance.TryGetSelection(GetActiveDocument(), out selection);

                if (success && selection != null && selection.Count > 0)
                {
                    return(selection.SelectedItems[0]);
                }
            }
            return(null);
        }
        //private List<OoShapeObserver> currentSelection = new List<OoShapeObserver>();
        void Instance_DrawSelectionChanged(object sender, OoAccessibilitySelectionChangedEventArgs e)
        {
            if (e != null /*&& e.SelectedItems != null*/)
            {
                if (windowManager.FocusMode == FollowFocusModes.FOLLOW_MOUSE_FOCUS)
                {
                    if (e != null && sender != null && e.Source != null)
                    {
                        OoAccessibilitySelection selection;

                        bool success = OoDrawAccessibilityObserver.Instance.TryGetSelection(e.Source, out selection);
                        if (success)
                        {
                            if (selection != null && selection.Count > 0)
                            {
                                if (shapeManipulatorFunctionProxy != null && shapeManipulatorFunctionProxy.Active &&
                                    this.DrawSelectFocusRenderer != null)
                                {
                                    StartDrawSelectFocusHighlightingMode(selection);
                                }

                                if (
                                    (!e.Silent && (selection.Count > 0)) ||
                                    _lastRegisterdSelection == null ||
                                    selection != _lastRegisterdSelection
                                    )
                                {
                                    CommunicateSelection(selection.SelectedItems);
                                }

                                _lastRegisterdSelection = selection;
                            }
                            else
                            {
                                _lastRegisterdSelection = null;
                                if (this.DrawSelectFocusRenderer != null)
                                {
                                    this.DrawSelectFocusRenderer.SetSelection(null);
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Starts the draw select focus highlighting mode.
        /// The current (GUI ?) selections will be observed and highlighted
        /// with a blinking frame on the non-visual output devices.
        /// </summary>
        public void StartDrawSelectFocusHighlightingMode(OoAccessibilitySelection selection = null)
        {
            if (OoDrawAccessibilityObserver.Instance != null)
            {
                if (selection == null)
                {
                    bool success = OoDrawAccessibilityObserver.Instance.TryGetSelection(GetActiveDocument(), out selection);
                }
            }

            this.DrawSelectFocusRenderer.DoRenderBoundingBox = true;
            this.DrawSelectFocusHighlightMode = true;
            this.DrawSelectFocusRenderer.SetSelection(selection);

            // TODO: center selection on the pin-matrix device
            //if (selection != null)
            //{
            //    System.Drawing.Rectangle bb = new Rectangle();
            //    bb = selection.SelectionBounds; // TODO: SelectionBounds are always 0
            //    if (windowManager != null && bb != null && bb.Width > 0 && bb.Height > 0) windowManager.MoveToObject(bb);
            //}
        }
Exemplo n.º 5
0
 /// <summary>
 /// Sets the current selection.
 /// To clear, simply set the selection to <c>null</c>.
 /// </summary>
 /// <param name="selection">The selection.</param>
 public void SetSelection(OoAccessibilitySelection selection)
 {
     _lastSelection = selection;
 }