/// <summary> /// Reads a selected oo acc item aloud. /// </summary> /// <param name="observed">The observed Open Office window.</param> /// <param name="p">The point to check.</param> private void handleSelectedOoAccItem(Accessibility.OoAccessibleDocWnd observed, Point p, GestureEventArgs eventData = null) { if (observed != null && observed.DocumentComponent != null) { //try to get the touched element tud.mci.tangram.Accessibility.OoAccComponent c = observed.DocumentComponent.GetAccessibleFromScreenPos(p); if (eventData == null || ( // selection for reading eventData.PressedGenericKeys.Count < 1 && eventData.ReleasedGenericKeys.Count == 1 && eventData.ReleasedGeneralKeys.Contains(BrailleIO_DeviceButton.Gesture) )) { // try to get a shape observer for better audio output if (c != null && observed.DrawPagesObs != null) { OoShapeObserver sObs = observed.DrawPagesObs.GetRegisteredShapeObserver(c); String text = ""; if (sObs != null) { text = OoElementSpeaker.PlayElementTitleAndDescriptionImmediately(sObs); } else { text = OoElementSpeaker.PlayElementImmediately(c); } SetDetailRegionContent(text); } } else if (eventData != null && eventData.ReleasedGenericKeys.Contains("hbr")) { OoShapeObserver shape = OoConnector.Instance.Observer.GetShapeForModification(c, observed); //TODO: what to do if shape is null? } } }
/// <summary> /// Sets the shape for modification to the given observer. /// </summary> /// <param name="shape">The shape.</param> /// <param name="silent">if set to <c>true</c> no audio feedback about the selection is given.</param> /// <param name="immediatly">if set to <c>true</c> the audio feedback is immediately given and all other audio feedback is aborted.</param> /// <returns> /// the currently selected Shape observer /// </returns> public bool SetShapeForModification(OoShapeObserver shape, bool silent = true, bool immediately = true) { if (shape != null) { if (shapeManipulatorFunctionProxy != null && !ImageData.Instance.Active) { if (!silent) { if (immediately) { OoElementSpeaker.PlayElementImmediately(shape, LL.GetTrans("tangram.lector.oo_observer.selected", String.Empty)); } else { OoElementSpeaker.PlayElement(shape, LL.GetTrans("tangram.lector.oo_observer.selected", String.Empty)); } } //audioRenderer.PlaySound("Form kann manipuliert werden"); shapeManipulatorFunctionProxy.LastSelectedShape = shape; return(shapeManipulatorFunctionProxy.LastSelectedShape == shape); } else // title+desc dialog handling { ImageData.Instance.NewSelectionHandling(shape); } } return(false); }
/// <summary> /// Brings the last selected shape to the audio output. /// <param name="immediately">determine if the text should palyed immediately or not.</param> /// </summary> public void SayLastSelectedShape(bool immediately = true) { if (LastSelectedShape != null) { if (immediately) { OoElementSpeaker.PlayElementImmediately(LastSelectedShape, LL.GetTrans("tangram.oomanipulation.selected")); } else { OoElementSpeaker.PlayElement(LastSelectedShape, LL.GetTrans("tangram.oomanipulation.selected")); } } else { play(LL.GetTrans("tangram.oomanipulation.no_element_selected"), immediately); } }
/// <summary> /// Gets the shape observer for modification. /// </summary> /// <param name="c">The component to get the corresponding observer to.</param> /// <param name="observed">The observed window / draw document.</param> /// <param name="silent">if set to <c>true</c> no audio feedback about the selection is given.</param> /// <param name="immediatly">if set to <c>true</c> the audio feedback is immediately given and all other audio feedback is aborted.</param> /// <returns>The corresponding observer to the shape in the given Draw document.</returns> public OoShapeObserver GetShapeForModification(OoAccComponent c, OoAccessibleDocWnd observed, bool silent = true, bool immediately = true) { if (observed != null && c.Role != AccessibleRole.INVALID) { //TODO: prepare name: OoShapeObserver shape = observed.GetRegisteredShapeObserver(c); if (shape != null) { return(GetShapeForModification(shape, observed, silent, immediately)); //if (shapeManipulatorFunctionProxy != null && !ImageData.Instance.Active) //{ // OoElementSpeaker.PlayElementImmediately(shape, LL.GetTrans("tangram.lector.oo_observer.selected", String.Empty)); // //audioRenderer.PlaySound("Form kann manipuliert werden"); // shapeManipulatorFunctionProxy.LastSelectedShape = shape; // return shape; //} //else // title+desc dialog handling //{ // ImageData.Instance.NewSelectionHandling(shape); //} } else { // disable the pageShapes if (c.Name.StartsWith("PageShape:")) { return(null); } OoElementSpeaker.PlayElementImmediately(c, LL.GetTrans("tangram.lector.oo_observer.selected")); audioRenderer.PlaySound(LL.GetTrans("tangram.lector.oo_observer.selected_element.locked")); } } return(null); }