private void setAccessibleCounterpart(OoShapeObserver shape) { if (shape != null) { string oldName = shape.Name; string newName = shape.Name + "_" + shape.GetHashCode() + " "; shape.Name = newName; unoidl.com.sun.star.accessibility.XAccessible counterpart = null; if (shape.Parent != null && shape.Parent.AcccessibleCounterpart != null) { counterpart = OoAccessibility.GetAccessibleCounterpartFromHash(shape.Shape, shape.Parent.AcccessibleCounterpart as unoidl.com.sun.star.accessibility.XAccessibleContext); } else { counterpart = OoAccessibility.GetAccessibleCounterpartFromHash(shape.Shape, Document.AccComp as unoidl.com.sun.star.accessibility.XAccessibleContext); } if (counterpart != null) { shape.AcccessibleCounterpart = counterpart; } shape.Name = oldName; } }
/// <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); }
private void setAccessibleCounterpart(OoShapeObserver shape) { if (shape != null) { string oldName = shape.Name; string newName = shape.Name + "_" + shape.GetHashCode() + " "; shape.Name = newName; unoidl.com.sun.star.accessibility.XAccessible counterpart = null; if (shape.Parent != null && shape.Parent.AcccessibleCounterpart != null) { counterpart = OoAccessibility.GetAccessibleCounterpartFromHash(shape.Shape, shape.Parent.AcccessibleCounterpart as unoidl.com.sun.star.accessibility.XAccessibleContext); } else { counterpart = OoAccessibility.GetAccessibleCounterpartFromHash(shape.Shape, Document.AccComp as unoidl.com.sun.star.accessibility.XAccessibleContext); } if (counterpart != null) shape.AcccessibleCounterpart = counterpart; shape.Name = oldName; } }
/// <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; }