private readonly ITextProvider2 publicITextProvider2; // AccessibleObject as ITextProvider2 /// <summary> /// Create a new wrapper. /// </summary> internal InternalAccessibleObject(AccessibleObject accessibleImplemention) { // Get all the casts done here to catch any issues early publicIAccessible = (IAccessible)accessibleImplemention; publicIEnumVariant = (Oleaut32.IEnumVariant)accessibleImplemention; publicIOleWindow = (Ole32.IOleWindow)accessibleImplemention; publicIReflect = (IReflect)accessibleImplemention; publicIServiceProvider = (Ole32.IServiceProvider)accessibleImplemention; publicIAccessibleEx = (IAccessibleEx)accessibleImplemention; publicIRawElementProviderSimple = (IRawElementProviderSimple)accessibleImplemention; publicIRawElementProviderFragment = (IRawElementProviderFragment)accessibleImplemention; publicIRawElementProviderFragmentRoot = (IRawElementProviderFragmentRoot)accessibleImplemention; publicIInvokeProvider = (IInvokeProvider)accessibleImplemention; publicIValueProvider = (IValueProvider)accessibleImplemention; publicIRangeValueProvider = (IRangeValueProvider)accessibleImplemention; publicIExpandCollapseProvider = (IExpandCollapseProvider)accessibleImplemention; publicIToggleProvider = (IToggleProvider)accessibleImplemention; publicITableProvider = (ITableProvider)accessibleImplemention; publicITableItemProvider = (ITableItemProvider)accessibleImplemention; publicIGridProvider = (IGridProvider)accessibleImplemention; publicIGridItemProvider = (IGridItemProvider)accessibleImplemention; publicILegacyIAccessibleProvider = (ILegacyIAccessibleProvider)accessibleImplemention; publicISelectionProvider = (ISelectionProvider)accessibleImplemention; publicISelectionItemProvider = (ISelectionItemProvider)accessibleImplemention; publicIScrollItemProvider = (IScrollItemProvider)accessibleImplemention; publicIRawElementProviderHwndOverride = (IRawElementProviderHwndOverride)accessibleImplemention; publicIMultiViewProvider = (IMultipleViewProvider)accessibleImplemention; publicITextProvider = (ITextProvider)accessibleImplemention; publicITextProvider2 = (ITextProvider2)accessibleImplemention; // Note: Deliberately not holding onto AccessibleObject to enforce all access through the interfaces }
/// <summary> /// Given an IEnumVariant interface, this method jumps to a specific /// item in the collection and extracts the result for that one item. /// </summary> private unsafe static bool GotoItem(Oleaut32.IEnumVariant iev, int index, IntPtr variantPtr) { uint celtFetched = 0; iev.Reset(); iev.Skip((uint)index); iev.Next(1, variantPtr, &celtFetched); return(celtFetched == 1); }