Ejemplo n.º 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();
        }
        private void handleChild(object sender, uno.Any newValue, uno.Any oldValue)
        {
            System.Diagnostics.Debug.WriteLine("[INFO] OoDrawPagesObserver: handle accessible child ID");

            if (newValue.hasValue())
            {
                if (oldValue.hasValue()) // change
                {
                    //System.Diagnostics.Debug.WriteLine("child changed");
                }
                else // added
                {
                    addNewShape(newValue.Value as XAccessible);
                }
            }
            //else if (oldValue.hasValue() && oldValue.Value is XAccessible)
            //{

            //    // FIXME: this does not work properly because sometimes the page itself do this and there is no way to check if this is the page.
            //    //          So we have to leave the corresponding shape and its observer as a dead body in the lists ...
            //    //          Maybe the OoShapeObeservers can detect their disposing by their own and handle a clean up of the lists

            //    //// child deleted;
            //    ////System.Diagnostics.Debug.WriteLine("child deleted");

            //    //XAccessible oldValAcc = oldValue.Value as XAccessible;

            //    //if (oldValAcc != null)
            //    //{
            //    //    if (accshapes.ContainsKey((oldValAcc.getAccessibleContext())))
            //    //    {
            //    //        //TODO: remove ....
            //    //        System.Diagnostics.Debug.WriteLine("have to remove observer");
            //    //    }
            //    //    else
            //    //    {
            //    //        string Name = OoAccessibility.GetAccessibleName(oldValAcc);
            //    //        if (shapes.ContainsKey(Name))
            //    //        {
            //    //            removeChild(shapes[Name]);
            //    //        }
            //    //    }
            //    //}

            //}
        }