Exemple #1
0
        private void handleAccessibleChildEvent(OoAccessibleDocWnd doc, object p, uno.Any newValue, uno.Any oldValue)
        {
            Task t = new Task(() =>
            {
                util.Debug.GetAllInterfacesOfObject(p);
                if (doc != null && !newValue.hasValue() && oldValue.hasValue())
                {
                    // shape was deleted!

                    var oldShapeAcc = oldValue.Value;

                    util.Debug.GetAllInterfacesOfObject(oldShapeAcc);


                    if (p != null && p is XAccessibleComponent)
                    {
                        var shapeObs = doc.GetRegisteredShapeObserver(p as XAccessibleComponent);
                        if (shapeObs != null && !shapeObs.IsValid(true))
                        {
                            shapeObs.Dispose();
                        }
                        else
                        {
                            doc.Update();
                        }
                    }
                }
            });

            t.Start();
        }
        /// <summary>
        /// Gets the shape for modification from the given Draw page child object.
        /// </summary>
        /// <param name="c">The component to search its shape observer for [<see cref="OoAccComponent"/>], [<see cref="OoShapeObserver"/>], [XShape].</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 registered shape observer</returns>
        public OoShapeObserver GetShapeForModification(Object c, OoAccessibleDocWnd observed, OoDrawPageObserver page = null, bool silent = false, bool immediately = true)
        {
            if (c is OoAccComponent)
            {
                return(GetShapeForModification(c as OoAccComponent, observed, silent, immediately));
            }
            else if (c is OoShapeObserver)
            {
                return(GetShapeForModification(c as OoShapeObserver, observed, silent, immediately));
            }
            else if (observed != null)
            {
                return(observed.GetRegisteredShapeObserver(c, page != null ? page : observed.GetActivePage()));
            }

            return(null);
        }
        /// <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);
        }