/// <summary> /// Gets the registered shape observer. /// </summary> /// <param name="shape">The shape.</param> /// <returns></returns> internal OoShapeObserver GetRegisteredShapeObserver(unoidl.com.sun.star.accessibility.XAccessibleContext shape) { if (shape == null) { return(null); } if (accshapes.ContainsKey(shape)) { return(accshapes[shape]); } String name = OoAccessibility.GetAccessibleName(shape); String desc = OoAccessibility.GetAccessibleDesc(shape); OoShapeObserver sObs = searchRegisterdSapeObserverByAccessibleName(name, shape); if (sObs != null) { // TODO: handle what? } else { //shape is unknown or the name was changed!! Logger.Instance.Log(LogPriority.IMPORTANT, this, "Asking for a not registered Element '" + name + "' "); } return(sObs); }
/// <summary> /// Check if the accessible object is corresponding to the given shape observer. /// </summary> /// <param name="acc">The accessible object to test.</param> /// <param name="sObs">The shape observer to test.</param> /// <returns><c>true</c> if the acc is related to changes in the observer. If this is true, /// the AccessibleCounterpart field of the OoShapeObserver is updated as well</returns> internal static bool AccCorrespondsToShapeObserver(XAccessible acc, OoShapeObserver sObs) { bool result = false; if (acc != null && sObs != null) { String hash = sObs.GetHashCode().ToString() + "_"; if (sObs.IsText) { // use description string oldDescription = sObs.Description; sObs.Description = hash + oldDescription; if (OoAccessibility.GetAccessibleDesc(acc).StartsWith(hash)) { result = true; } sObs.Description = oldDescription; } else { // use name string oldName = sObs.Name; sObs.Name = hash + oldName; if (OoAccessibility.GetAccessibleName(acc).StartsWith(hash)) { result = true; } sObs.Name = oldName; } } if (result) { sObs.AcccessibleCounterpart = acc; } return(result); }
/// <summary> /// Registers a new draw window. /// </summary> /// <param name="source">The source.</param> /// <param name="dw">The dw.</param> private void registerNewDrawWindow(XAccessible source, Object dw) { if (source != null && dw != null && !dw.Equals(false)) { Logger.Instance.Log(LogPriority.DEBUG, this, "Draw window check: '" + OoAccessibility.GetAccessibleName(source)); if (getCorrespondingAccessibleDocForXaccessible(source) == null) { Logger.Instance.Log(LogPriority.DEBUG, this, "Register new Draw window: '" + OoAccessibility.GetAccessibleName(source)); OoAccessibleDocWnd doc = new OoAccessibleDocWnd(source, dw as XAccessible); drawWnds[source] = doc; // add main window to list if (doc.Document != null) { drawDocs[source] = doc; } if (doc.DocumentWindow != null) { drawDocWnds[doc.DocumentWindow] = doc; } //drawPgSuppl.Clear(); //drawPgSuppl.AddRange(OoDrawUtils.GetDrawPageSuppliers(OO.GetDesktop())); //TODO: call the observers addListeners(doc); fireDrawWindowOpendEvent(doc); } } }