File: Windows.Win32.ITextProvider.g.cs
Project: src\src\System.Windows.Forms.Primitives\src\System.Windows.Forms.Primitives.csproj (System.Windows.Forms.Primitives)
// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{
	namespace UI.Accessibility
	{
		[Guid("3589C92C-63F3-4367-99BB-ADA653B77CF2")]
		[SupportedOSPlatform("windows5.1.2600")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct ITextProvider
			:IVTable<ITextProvider,ITextProvider.Vtbl>,IComIID		{
			/// <inheritdoc cref="QueryInterface(global::System.Guid*, void**)"/>
			internal unsafe winmdroot.Foundation.HRESULT QueryInterface(in global::System.Guid riid, out void* ppvObject)
			{
				fixed (void** ppvObjectLocal = &ppvObject)
				{
					fixed (global::System.Guid* riidLocal = &riid)
					{
						winmdroot.Foundation.HRESULT __result = this.QueryInterface(riidLocal, ppvObjectLocal);
						return __result;
					}
				}
			}

			public unsafe winmdroot.Foundation.HRESULT QueryInterface(global::System.Guid* riid, void** ppvObject)
			{
				return ((delegate *unmanaged [Stdcall]<ITextProvider*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((ITextProvider*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

			public uint AddRef()
			{
				return ((delegate *unmanaged [Stdcall]<ITextProvider*,uint>)lpVtbl[1])((ITextProvider*)Unsafe.AsPointer(ref this));
			}

			public uint Release()
			{
				return ((delegate *unmanaged [Stdcall]<ITextProvider*,uint>)lpVtbl[2])((ITextProvider*)Unsafe.AsPointer(ref this));
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT GetSelection(ITextProvider* pThis, winmdroot.System.Com.SAFEARRAY** pRetVal)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.GetSelection(pRetVal);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves a collection of text ranges that represents the currently selected text in a text-based control. (ITextProvider.GetSelection)</summary>
			/// <returns>
			/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/WinProg/windows-data-types">HRESULT</a></b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
			/// </returns>
			/// <remarks>
			/// <para>For UI Automation providers that support text selection, the provider should implement this method and also return a <a href="https://docs.microsoft.com/windows/desktop/api/uiautomationcore/nf-uiautomationcore-itextprovider-get_supportedtextselection">ITextProvider::SupportedTextSelection</a> value.</para>
			/// <para>If the control contains only a single span of selected text, the <i>pRetVal</i> array should contain a single text range. If the control contains a text insertion point but no text is selected,  the <i>pRetVal</i> array should contain a degenerate (empty) text range at the position of the text insertion point. If the control contains no selected text, or if the control does not contain a text insertion point, set <i>pRetVal</i> to <b>NULL</b>.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-getselection#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.System.Com.SAFEARRAY* GetSelection()
			{
				winmdroot.System.Com.SAFEARRAY* __retVal = default(winmdroot.System.Com.SAFEARRAY*);
				((delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.System.Com.SAFEARRAY** ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((ITextProvider*)Unsafe.AsPointer(ref this), &__retVal).ThrowOnFailure();
				return __retVal;
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT GetVisibleRanges(ITextProvider* pThis, winmdroot.System.Com.SAFEARRAY** pRetVal)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.GetVisibleRanges(pRetVal);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves an array of disjoint text ranges from a text-based control where each text range represents a contiguous span of visible text. (ITextProvider.GetVisibleRanges)</summary>
			/// <returns>
			/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/WinProg/windows-data-types">HRESULT</a></b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
			/// </returns>
			/// <remarks>
			/// <para>If the visible text consists of one contiguous span of text, the <i>pRetVal</i> array should contain a single text range that represents all of the visible text. If the visible text consists of multiple, disjoint spans of text, the <i>pRetVal</i> array should contain one text range for each visible span, beginning with the first visible span, and ending with the last visible span. Disjoint spans of visible text can occur when the content of a text-based control is partially obscured by an overlapping window or other object, or when a text-based  control with multiple pages or columns has content that is partially scrolled out of view.</para>
			/// <para><b>ITextProvider::GetVisibleRanges</b> should return  a degenerate (empty) text range if no text is visible, if all text is scrolled out of view, or if the text-based control contains no text.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-getvisibleranges#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.System.Com.SAFEARRAY* GetVisibleRanges()
			{
				winmdroot.System.Com.SAFEARRAY* __retVal = default(winmdroot.System.Com.SAFEARRAY*);
				((delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.System.Com.SAFEARRAY** ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((ITextProvider*)Unsafe.AsPointer(ref this), &__retVal).ThrowOnFailure();
				return __retVal;
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT RangeFromChild(ITextProvider* pThis, winmdroot.UI.Accessibility.IRawElementProviderSimple* childElement, winmdroot.UI.Accessibility.ITextRangeProvider** pRetVal)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.RangeFromChild(childElement, pRetVal);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves a text range enclosing a child element such as an image, hyperlink, or other embedded object.</summary>
			/// <param name="childElement">
			/// <para>Type: **[IRawElementProviderSimple](nn-uiautomationcore-irawelementprovidersimple.md)\*** The UI Automation provider of the specified child element.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-rangefromchild#parameters">Read more on docs.microsoft.com</see>.</para>
			/// </param>
			/// <returns>
			/// <para>Type: **[HRESULT](/windows/desktop/WinProg/windows-data-types)** If this method succeeds, it returns **S_OK**. Otherwise, it returns an **HRESULT** error code. > [!NOTE] > **E_INVALIDARG** is returned if *childElement* is not a descendent of an [ITextProvider](nn-uiautomationcore-itextprovider.md), or is not enclosed by a valid text range.</para>
			/// </returns>
			/// <remarks>Each element retrieved with [ITextRangeProvider::GetChildren](nf-uiautomationcore-itextrangeprovider-getchildren.md) also has a valid text range that can be retrieved through [RangeFromChild](nf-uiautomationcore-itextprovider-rangefromchild.md). This includes any elements in the UI Automation tree between the [ITextProvider](nn-uiautomationcore-itextprovider.md) and the child element.</remarks>
			public unsafe winmdroot.UI.Accessibility.ITextRangeProvider* RangeFromChild(winmdroot.UI.Accessibility.IRawElementProviderSimple* childElement)
			{
				winmdroot.UI.Accessibility.ITextRangeProvider* __retVal = default(winmdroot.UI.Accessibility.ITextRangeProvider*);
				((delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.UI.Accessibility.IRawElementProviderSimple* ,winmdroot.UI.Accessibility.ITextRangeProvider** ,winmdroot.Foundation.HRESULT>)lpVtbl[5])((ITextProvider*)Unsafe.AsPointer(ref this), childElement, &__retVal).ThrowOnFailure();
				return __retVal;
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT RangeFromPoint(ITextProvider* pThis, winmdroot.UI.Accessibility.UiaPoint point, winmdroot.UI.Accessibility.ITextRangeProvider** pRetVal)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.RangeFromPoint(point, pRetVal);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Returns the degenerate (empty) text range nearest to the specified screen coordinates.</summary>
			/// <param name="point">
			/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/uiautomationcore/ns-uiautomationcore-uiapoint">UiaPoint</a></b> The location in screen coordinates.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-rangefrompoint#parameters">Read more on docs.microsoft.com</see>.</para>
			/// </param>
			/// <returns>
			/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/WinProg/windows-data-types">HRESULT</a></b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
			/// </returns>
			/// <remarks>
			/// <para>A text range that encloses a child object is returned if the screen coordinates are within the coordinates of an image, hyperlink, or other embedded object.</para>
			/// <para>Because hidden text is not ignored by <b>ITextProvider::RangeFromPoint</b>, a degenerate range from the visible text closest to the given point is returned. The property never returns <b>NULL</b>.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-rangefrompoint#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.UI.Accessibility.ITextRangeProvider* RangeFromPoint(winmdroot.UI.Accessibility.UiaPoint point)
			{
				winmdroot.UI.Accessibility.ITextRangeProvider* __retVal = default(winmdroot.UI.Accessibility.ITextRangeProvider*);
				((delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.UI.Accessibility.UiaPoint ,winmdroot.UI.Accessibility.ITextRangeProvider** ,winmdroot.Foundation.HRESULT>)lpVtbl[6])((ITextProvider*)Unsafe.AsPointer(ref this), point, &__retVal).ThrowOnFailure();
				return __retVal;
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT get_DocumentRange(ITextProvider* pThis, winmdroot.UI.Accessibility.ITextRangeProvider** pRetVal)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					*pRetVal = __object.DocumentRange;
					return winmdroot.Foundation.HRESULT.S_OK;
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves a text range that encloses the main text of a document. (ITextProvider.get_DocumentRange)</summary>
			/// <remarks>Some auxiliary text such as headers, footnotes, or annotations may not be included.</remarks>
			internal unsafe winmdroot.UI.Accessibility.ITextRangeProvider* DocumentRange
			{
				get
				{
					winmdroot.UI.Accessibility.ITextRangeProvider* __result;
					((delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.UI.Accessibility.ITextRangeProvider** ,winmdroot.Foundation.HRESULT>)lpVtbl[7])((ITextProvider*)Unsafe.AsPointer(ref this), &__result).ThrowOnFailure();
					return __result;
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT get_SupportedTextSelection(ITextProvider* pThis, winmdroot.UI.Accessibility.SupportedTextSelection* pRetVal)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					*pRetVal = __object.SupportedTextSelection;
					return winmdroot.Foundation.HRESULT.S_OK;
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves a value that specifies the type of text selection that is supported by the control. (ITextProvider.get_SupportedTextSelection)</summary>
			/// <remarks>
			/// <para>> ### Parameters > > `pRetVal` [out] > > Type: **[SupportedTextSelection](../uiautomationcore/ne-uiautomationcore-supportedtextselection.md)\*** > > When this function returns, contains a pointer to the [SupportedTextSelection](../uiautomationcore/ne-uiautomationcore-supportedtextselection.md) object.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-get_supportedtextselection#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			internal winmdroot.UI.Accessibility.SupportedTextSelection SupportedTextSelection
			{
				get
				{
					winmdroot.UI.Accessibility.SupportedTextSelection __result;
					((delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.UI.Accessibility.SupportedTextSelection* ,winmdroot.Foundation.HRESULT>)lpVtbl[8])((ITextProvider*)Unsafe.AsPointer(ref this), &__result).ThrowOnFailure();
					return __result;
				}
			}

			internal unsafe global::Windows.Win32.Foundation.HRESULT QueryInterface<T>(out T* ppv)
where T : unmanaged

			{
				var hr = this.QueryInterface(typeof(T).GUID, out void* pv);
				if (hr.Succeeded)

				{
					ppv = (T*)pv;
				}
				else

				{
					ppv = null;
				}

				return hr;
			}

			internal struct Vtbl
			{
				internal delegate *unmanaged [Stdcall]<ITextProvider*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;

				internal delegate *unmanaged [Stdcall]<ITextProvider*,uint> AddRef_2;

				internal delegate *unmanaged [Stdcall]<ITextProvider*,uint> Release_3;

				internal delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.System.Com.SAFEARRAY** ,winmdroot.Foundation.HRESULT> GetSelection_4;

				internal delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.System.Com.SAFEARRAY** ,winmdroot.Foundation.HRESULT> GetVisibleRanges_5;

				internal delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.UI.Accessibility.IRawElementProviderSimple* ,winmdroot.UI.Accessibility.ITextRangeProvider** ,winmdroot.Foundation.HRESULT> RangeFromChild_6;

				internal delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.UI.Accessibility.UiaPoint ,winmdroot.UI.Accessibility.ITextRangeProvider** ,winmdroot.Foundation.HRESULT> RangeFromPoint_7;

				internal delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.UI.Accessibility.ITextRangeProvider** ,winmdroot.Foundation.HRESULT> get_DocumentRange_8;

				internal delegate *unmanaged [Stdcall]<ITextProvider*,winmdroot.UI.Accessibility.SupportedTextSelection* ,winmdroot.Foundation.HRESULT> get_SupportedTextSelection_9;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->GetSelection_4 = &GetSelection;
				vtable->GetVisibleRanges_5 = &GetVisibleRanges;
				vtable->RangeFromChild_6 = &RangeFromChild;
				vtable->RangeFromPoint_7 = &RangeFromPoint;
				vtable->get_DocumentRange_8 = &get_DocumentRange;
				vtable->get_SupportedTextSelection_9 = &get_SupportedTextSelection;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{3589c92c-63f3-4367-99bb-ada653b77cf2}</value>
			internal static readonly Guid IID_Guid = new Guid(0x3589C92C, 0x63F3, 0x4367, 0x99, 0xBB, 0xAD, 0xA6, 0x53, 0xB7, 0x7C, 0xF2);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0x2C,0xC9,0x89,0x35,0xF3,0x63,0x67,0x43,0x99,0xBB,0xAD,0xA6,0x53,0xB7,0x7C,0xF2					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("3589C92C-63F3-4367-99BB-ADA653B77CF2"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			[SupportedOSPlatform("windows5.1.2600")]
			internal interface Interface
			{
				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT GetSelection(winmdroot.System.Com.SAFEARRAY** pRetVal);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT GetVisibleRanges(winmdroot.System.Com.SAFEARRAY** pRetVal);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT RangeFromChild(winmdroot.UI.Accessibility.IRawElementProviderSimple* childElement, winmdroot.UI.Accessibility.ITextRangeProvider** pRetVal);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT RangeFromPoint(winmdroot.UI.Accessibility.UiaPoint point, winmdroot.UI.Accessibility.ITextRangeProvider** pRetVal);

				unsafe winmdroot.UI.Accessibility.ITextRangeProvider* DocumentRange
				{
					get;
				}

				winmdroot.UI.Accessibility.SupportedTextSelection SupportedTextSelection
				{
					get;
				}
			}
		}
	}
}