using System; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Text; using Vanara.InteropServices; using TS_ATTRID = System.Guid; using TsViewCookie = System.UInt32; namespace Vanara.PInvoke { public static partial class MSCTF { /// Application does not support the data type contained in the IDataObject object to be inserted using ITextStoreACP::InsertEmbedded. public static readonly HRESULT TS_E_FORMAT = unchecked((int)0x8004020a); /// Parameter is not within the bounding box of any character. public static readonly HRESULT TS_E_INVALIDPOINT = unchecked((int)0x80040207); /// Range specified extends outside the document. public static readonly HRESULT TS_E_INVALIDPOS = unchecked((int)0x80040200); /// Object does not support the requested interface. public static readonly HRESULT TS_E_NOINTERFACE = unchecked((int)0x80040204); /// Application has not calculated a text layout. public static readonly HRESULT TS_E_NOLAYOUT = unchecked((int)0x80040206); /// Application does not have a read-only lock or read/write lock for the document. public static readonly HRESULT TS_E_NOLOCK = unchecked((int)0x80040201); /// Embedded content offset is not positioned before a TF_CHAR_EMBEDDED character. public static readonly HRESULT TS_E_NOOBJECT = unchecked((int)0x80040202); /// Document has no selection. public static readonly HRESULT TS_E_NOSELECTION = unchecked((int)0x80040205); /// Content cannot be returned to match the service GUID. public static readonly HRESULT TS_E_NOSERVICE = unchecked((int)0x80040203); /// Document is read-only. Cannot modify content. public static readonly HRESULT TS_E_READONLY = unchecked((int)0x80040209); /// Document cannot be locked synchronously. public static readonly HRESULT TS_E_SYNCHRONOUS = unchecked(0x00040300); /// Document successfully received an asynchronous lock. public static readonly HRESULT TS_S_ASYNC = 0x1; /// /// Specifies the character position to return based upon the screen coordinates of the point relative to a character bounding box. /// By default, the character position returned is the character bounding box containing the screen coordinates of the point. If the /// point is outside a character bounding box, the method returns NULL or TF_E_INVALIDPOINT. Other bit flags for this /// parameter are as follows. /// [PInvokeData("textstor.h")] [Flags] public enum GXFPF : uint { /// /// If the screen coordinates of the point are contained in a character bounding box, the character position returned is the /// bounding edge closest to the screen coordinates of the point. /// GXFPF_ROUND_NEAREST = 0x1, /// /// If the screen coordinates of the point are not contained in a character bounding box, the closest character position is returned. /// GXFPF_NEAREST = 0x2, } /// The following flags specify the events that call the AdviseSink methods. // https://docs.microsoft.com/en-us/windows/win32/tsf/ts-as--constants [PInvokeData("textstor.h")] [Flags] public enum TS_AS : uint { /// Text is changed in the document. TS_AS_TEXT_CHANGE = 0x01, /// Text is selected in the document. TS_AS_SEL_CHANGE = 0x02, /// The layout of the document is changed. TS_AS_LAYOUT_CHANGE = 0x04, /// The attributes of the document is changed. TS_AS_ATTR_CHANGE = 0x08, /// The status of the document is changed. TS_AS_STATUS_CHANGE = 0x10, /// One of the previous four events occurred in the document. TS_AS_ALL_SINKS = (TS_AS_TEXT_CHANGE | TS_AS_SEL_CHANGE | TS_AS_LAYOUT_CHANGE | TS_AS_ATTR_CHANGE | TS_AS_STATUS_CHANGE), } /// /// The TS_ATTR_* constants are used to obtain and change the values of document attributes. These constants form possible values of /// bitfield flags in ITextStoreACP and ITextStoreAnchor methods. /// [PInvokeData("textstor.h")] [Flags] public enum TS_ATTR_FIND : uint { /// /// Search backward from the start character or anchor position for the position where a transition occurs in a document /// attribute value. The default is search forward. /// TS_ATTR_FIND_BACKWARDS = (0x1), /// /// Return the number of characters between the start character or anchor position (acpStart in /// ITextStoreACP::FindNextAttrTransition or paStart in ITextStoreAnchor::FindNextAttrTransition ) and the position at which an /// attribute transition occurs. /// TS_ATTR_FIND_WANT_OFFSET = (0x2), /// /// Used by ITextStoreAnchor::FindNextAttrTransition to position the input anchor at the next attribute transition, if one is /// found. Otherwise the input anchor is not modified. /// TS_ATTR_FIND_UPDATESTART = (0x4), /// Load supported document attribute values into the TS_ATTRVAL structure. TS_ATTR_FIND_WANT_VALUE = (0x8), /// /// Used by ITextStoreACP::RequestAttrsTransitioningAtPosition and ITextStoreAnchor::RequestAttrsTransitioningAtPosition to /// obtain the document attribute values that end at the specified character or anchor position. /// TS_ATTR_FIND_WANT_END = (0x10), /// Reserved. TS_ATTR_FIND_HIDDEN = (0x20), } /// The TS_CH_* constants are used internally by TSF to indicate that text deletions have occurred. [PInvokeData("textstor.h")] [Flags] public enum TS_CH : uint { /// Text preceding the character position has been deleted. TS_CH_PRECEDING_DEL = 1, /// Text following the character position has been deleted. TS_CH_FOLLOWING_DEL = 2, } /// Bit fields that specify how the method deals with hidden text. [PInvokeData("textstor.h")] [Flags] public enum TS_GEA { /// Hidden text is skipped over. TS_GEA_NONE = 0x0, /// An embedded object can be located within hidden text. TS_GEA_HIDDEN = 0x1 } /// [PInvokeData("textstor.h")] [Flags] public enum TS_GTA { /// The ts gta hidden TS_GTA_HIDDEN = 0x1 } /// /// /// The TS_IAS_* constants are used as bitfield flags to control insertion of text or embedded objects at a selection or insertion point. /// /// // https://docs.microsoft.com/en-us/windows/win32/tsf/ts-ias--constants [PInvokeData("textstor.h")] [Flags] public enum TS_IAS : uint { /// Text is inserted and the range pointer is set to NULL upon exit. Cannot be combined with the TS_IAS_QUERYONLY flag. TS_IAS_NOQUERY = 0x1, /// /// Do not perform the insertion. Caller only requires the range pointer to be set. Cannot be combined with the TS_IAS_NOQUERY flag. /// TS_IAS_QUERYONLY = 0x2, } /// The TS_IE_* constants describe how to insert text that can contain embedded objects used by text services. /// These constants are used in the dwFlags parameter of ITextStoreACP::InsertEmbedded and ITextStoreAnchor::InsertEmbedded. // https://docs.microsoft.com/en-us/windows/win32/tsf/ts-ie--constants [PInvokeData("textstor.h", MSDNShortId = "NN:textstor.ITextStoreACP")] public enum TS_IE : uint { /// /// The text is a transform (correction) of existing content, and any special text markup information (metadata) is retained, /// such as .wav file data or a language identifier. /// TS_IE_CORRECTION = 0x1, /// Not used. [Obsolete("Not used.")] TS_IE_COMPOSITION = 0x2, } /// Specifies the type of lock requested. [PInvokeData("textstor.h")] [Flags] public enum TS_LF : uint { /// The document has a synchronous-lock if this flag is combined with other flags. TS_LF_SYNC = 0x1, /// The document has a read-only lock and cannot be modified. TS_LF_READ = 0x2, /// The document has a read/write lock and can be modified. TS_LF_READWRITE = 0x6, } /// /// A set of flags that can be changed by an app at run time. For example, an app can enable a check box for the user to reset the /// status of documentation. This member can contain zero, or one or more of the following values. /// [PInvokeData("textstor.h")] [Flags] public enum TS_SD : uint { /// The document is read-only. TS_SD_READONLY = 0x001, /// The document is loading. TS_SD_LOADING = 0x002, /// Reserved TS_SD_RESERVED = 0x004, /// /// Starting with Windows 8.1: The document supports autocorrection provided by the touch keyboard. This support can change /// during the lifetime of the control. /// TS_SD_TKBAUTOCORRECTENABLE = 0x008, // document owner sets this flag in order to receive auto-correction from the Windows touch keyboard /// /// Starting with Windows 8.1: The document supports text suggestions provided by the touch keyboard. This support can change /// during the lifetime of the control. /// TS_SD_TKBPREDICTIONENABLE = 0x010, // document owner sets this flag in order to receive prediction from the Windows touch keyboard /// /// Starting with Windows 8.1: The text control owning the document sets this flag to indicate its support of Input Method /// Editor (IME) UI integration. When specified, the IME should attempt to align the candidate window below the text box instead /// of floating near the cursor. /// TS_SD_UIINTEGRATIONENABLE = 0x020, // indicates that text control supports IME UI integration /// used by UWP text controls to disable default automatic SIP invocation TS_SD_INPUTPANEMANUALDISPLAYENABLE = 0x040, // /// used by UWP text controls to enable embedded handwriting TS_SD_EMBEDDEDHANDWRITINGVIEW_ENABLED = 0x080, // /// used by UWP text controls to show/hide embedded handwriting view TS_SD_EMBEDDEDHANDWRITINGVIEW_VISIBLE = 0x100, // } /// /// The TS_Shift_* constants are used by the IAnchor interface for manipulation of hidden text and character counting. /// // https://docs.microsoft.com/en-us/windows/win32/tsf/ts-shift--constants [PInvokeData("textstor.h")] [Flags] public enum TS_SHIFT : uint { /// /// Specifies that the anchor will be shifted to the next region boundary, including the boundary of a hidden text region. If /// not set, the anchor will be shifted past any adjacent hidden text until a region of visible text is found. /// TS_SHIFT_COUNT_HIDDEN = 0x1, /// Not used. [Obsolete("Not used.")] TS_SHIFT_HALT_HIDDEN = 0x2, /// Not used. TS_SHIFT_HALT_VISIBLE = 0x4, /// The anchor is not shifted. TS_SHIFT_COUNT_ONLY = 0x8, } /// /// A set of flags that cannot be changed at run time. This member can contain zero, or one or more of the following values. /// [PInvokeData("textstor.h")] [Flags] public enum TS_SS : uint { /// The document supports multiple selections. TS_SS_DISJOINTSEL = 0x001, /// The document can contain multiple regions. TS_SS_REGIONS = 0x002, /// The document is expected to have a short usage cycle. TS_SS_TRANSITORY = 0x004, /// if set, the document will never contain hidden text (for perf) TS_SS_NOHIDDENTEXT = 0x008, /// Starting with Windows 8: The document supports autocorrection provided by the touch keyboard. TS_SS_TKBAUTOCORRECTENABLE = 0x010, // document owner sets this flag in order to receive auto-correction from the Windows touch keyboard /// Starting with Windows 8: The document supports text suggestions provided by the touch keyboard. TS_SS_TKBPREDICTIONENABLE = 0x020, // document owner sets this flag in order to receive prediction from the Windows touch keyboard /// document is provided on behalf of a UWP control TS_SS_UWPCONTROL = 0x040, // } /// ITextStoreACP::SetText, ITextStoreAnchor::SetText, or ITextStoreACPSink::OnTextChange parameters. [PInvokeData("textstor.h")] [Flags] public enum TS_ST : uint { /// None. TS_ST_NONE = 0x0, /// /// The text is a transform (correction) of existing content, and any special text markup information (metadata) is retained, /// such as .wav file data or a language identifier. The client defines the type of markup information to be retained. /// TS_ST_CORRECTION = 0x1, } /// ITextStoreAnchorSink::OnTextChange paramneter. [PInvokeData("textstor.h")] [Flags] public enum TS_TC : uint { /// None. TS_TC_NONE = 0x0, /// /// If dwFlags parameter of ITextStoreAnchorSink::OnTextChange is set to this value, the text is a transform (correction) of /// existing content, and any special text markup information (metadata) is retained, such as .wav file data or a language identifier. /// TS_TC_CORRECTION = 0x1, } /// Elements of the TsActiveSelEnd enumeration specify which end of a text store selection is active. /// /// /// The active end of a selection is the end likely to respond to user actions. For example, in many applications, holding down the /// SHIFT key while using the arrow keys will change the selection. The end of the selection that moves is the active end of the selection. /// /// This enumeration is used in the TS_SELECTIONSTYLE structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ne-textstor-tsactiveselend [PInvokeData("textstor.h", MSDNShortId = "NE:textstor.__MIDL___MIDL_itf_textstor_0000_0000_0001")] [Guid("05FCF85B-5E9C-4C3E-AB71-29471D4F38E7")] public enum TsActiveSelEnd : uint { /// The selection has no active end. This is typical for all selections other than the default selection. TS_AE_NONE, /// The active end of the selection is at the start of the range of text. TS_AE_START, /// The active end of the selection is at the end of the range of text. TS_AE_END, } /// Elements of the TsGravity enumeration specify the gravity type associated with an IAnchor object. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ne-textstor-tsgravity [PInvokeData("textstor.h", MSDNShortId = "NE:textstor.__MIDL_IAnchor_0001")] [Guid("DAA8601E-7695-426F-9BB7-498A6AA64B68")] public enum TsGravity : uint { /// The anchor has backward gravity. For more information about anchor gravity, see Ranges. TS_GR_BACKWARD, /// The anchor has forward gravity. For more information about anchor gravity, see Ranges. TS_GR_FORWARD, } /// /// Elements of the TsLayoutCode enumeration are used to specify the type of layout change in an /// ITextStoreACPSink::OnLayoutChange or ITextStoreAnchorSink::OnLayoutChange notification. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ne-textstor-tslayoutcode [PInvokeData("textstor.h", MSDNShortId = "NE:textstor.__MIDL___MIDL_itf_textstor_0000_0000_0002")] [Guid("7899D7C4-5F07-493C-A89A-FAC8E777F476")] public enum TsLayoutCode : uint { /// The view has just been created. TS_LC_CREATE, /// The view layout has changed. TS_LC_CHANGE, /// The view is about to be destroyed. TS_LC_DESTROY, } /// /// Elements of the TsRunType enumeration specify if a text run is visible, hidden, or is a private data type embedded in the /// text run. /// /// /// /// A text run is a collection of consecutive characters that is visible, hidden, or contains embedded data. For example, the text, /// Hello World in HTML might be <b>Hello </b><i>World</i>. This text would be defined using the TsRunType /// as in the following. /// /// /// /// Text Run /// Value /// /// /// <b> /// TS_RT_HIDDEN /// /// /// Hello<space> /// TS_RT_PLAIN /// /// /// </b> /// TS_RT_HIDDEN /// /// /// <i> /// TS_RT_HIDDEN /// /// /// World /// TS_RT_PLAIN /// /// /// </i> /// TS_RT_HIDDEN /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ne-textstor-tsruntype [PInvokeData("textstor.h", MSDNShortId = "NE:textstor.__MIDL___MIDL_itf_textstor_0000_0000_0003")] [Guid("033B0DF0-F193-4170-B47B-141AFC247878")] public enum TsRunType : uint { /// The text run is visible. TS_RT_PLAIN, /// The text run is hidden. TS_RT_HIDDEN, /// The text run is a private data type embedded in the text run. TS_RT_OPAQUE, } /// Elements of the TsShiftDir enumeration specify which direction an anchor is moved. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ne-textstor-tsshiftdir [PInvokeData("textstor.h", MSDNShortId = "NE:textstor.__MIDL_IAnchor_0002")] [Guid("898E19DF-4FB4-4AF3-8DAF-9B3C1145C79D")] public enum TsShiftDir : uint { /// Specifies that the anchor will be moved to the region immediately preceding a range of text. TS_SD_BACKWARD, /// Specifies that the anchor will be moved to the region immediately following a range of text. TS_SD_FORWARD, } /// /// /// The IAnchor interface is implemented by the TSF manager. Clients of Microsoft Active Accessibility use IAnchor /// anchor objects to delimit a range of text within a text stream. /// /// The interface ID is IID_IAnchor. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nn-textstor-ianchor [PInvokeData("textstor.h", MSDNShortId = "NN:textstor.IAnchor")] [ComImport, Guid("0FEB7E34-5A60-4356-8EF7-ABDEC2FF7CF8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface IAnchor { /// Sets the gravity of the anchor. /// /// Contains a value from the TsGravity enumeration that specifies a new forward or backward gravity for the anchor. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-setgravity HRESULT SetGravity( TsGravity // gravity ); void SetGravity([In] TsGravity gravity); /// The IAnchor::GetGravity method retrieves the gravity of the anchor in an IAnchor object. /// Pointer that receives a TsGravity value that specifies the anchor gravity. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-getgravity HRESULT GetGravity( TsGravity // *pgravity ); TsGravity GetGravity(); /// /// The IAnchor::IsEqual method evaluates two anchors within a text stream and returns a Boolean value that specifies the /// equality or inequality of the anchor positions. /// /// /// Specifies an anchor to compare to the primary anchor. Used to determine the equality of the two anchor positions. /// /// /// A Boolean value that specifies whether the two anchors are positioned at the same location. If set to TRUE, the two /// anchors occupy the same location. If set to FALSE, the two anchors do not occupy the same location. /// /// /// /// Anchors are always positioned between characters or regions. When two anchors are between the same characters, being at the /// same offset within the text stream, and within the same region, IAnchor::IsEqual returns TRUE. Otherwise it /// returns FALSE. /// /// /// IAnchor::Compare incorporates the same functionality as IAnchor::IsEqual. However, because IAnchor::IsEqual is /// more specific, it can have a more efficient implementation on the server. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-isequal HRESULT IsEqual( IAnchor *paWith, // BOOL *pfEqual ); [return: MarshalAs(UnmanagedType.Bool)] bool IsEqual([In] IAnchor paWith); /// The IAnchor::Compare method compares the relative position of two anchors within a text stream. /// /// An anchor object to compare to the primary anchor. Used to determine the relative position of the two anchors. /// /// /// Result of the comparison of the positions of the two anchors. /// /// /// Value /// Meaning /// /// /// -1 /// The primary anchor is positioned earlier in the text stream than paWith. /// /// /// 0 /// The primary anchor is positioned at the same location as paWith. /// /// /// +1 /// The primary anchor is positioned later in the text stream than paWith. /// /// /// /// /// The value 0 is returned for *plResult only when the two anchors are in a single region. Anchor positions include the spaces /// between regions. If you only need to determine if the two anchors are positioned at the same location, IAnchor::IsEqual is /// more efficient. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-compare HRESULT Compare( IAnchor *paWith, // LONG *plResult ); int Compare([In] IAnchor paWith); /// The IAnchor::Shift method shifts the anchor forward or backward within a text stream. /// /// Bit fields that are used to avoid anchor positioning. /// /// /// Value /// Meaning /// /// /// TS_SHIFT_COUNT_ONLY /// /// The anchor is not shifted. If the flag is not set (dwFlags = 0), the anchor will be shifted as specified by the other /// parameter settings. /// /// /// /// /// The number of characters to move the anchor within the text stream. /// /// The actual number of characters moved within the text stream. The method will set pcch to zero if it fails. /// /// Reference to an anchor that blocks the shift. Set to NULL to avoid blocking the shift. /// /// /// cchReq and pcch parameters can be negative, meaning a shift backward in the text stream, or positive, meaning a shift /// forward. The actual number of characters shifted can be less than cchReq if the beginning or end of the document is /// encountered, a region boundary is encountered, or if paHaltAnchor receives an anchor that blocks the shift. /// /// /// If paHaltAnchor receives an anchor that blocks the shift, the application will truncate the shift at the position occupied /// by paHaltAnchor. If paHaltAnchor is not within the span of text covered by the shift, it has no relevance to the shift and /// is ignored. /// /// /// For example, if the anchor referenced by paHaltAnchor lies 8 characters ahead of the anchor in the stream, and a client /// calls Shift (0, 10, pcch, paHaltAnchor), then on exit the anchor will have moved only 8 characters. If the anchor /// referenced by paHaltAnchor is equal to the current anchor to be moved, then Shift will return successfully without /// moving the anchor at all. In this case pcch will be 0. /// /// /// The anchor shift is always blocked by region boundaries, as if the beginning or end of the document were encountered. This /// will be indicated on exit by the actual shift pcch being smaller in absolute value than the requested shift cchReq. In this /// case, clients can use IAnchor::ShiftRegion to shift the anchor into an adjacent region. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-shift HRESULT Shift( DWORD dwFlags, LONG // cchReq, LONG *pcch, IAnchor *paHaltAnchor ); void Shift([In] uint dwFlags, [In] int cchReq, out int pcch, [In] IAnchor paHaltAnchor); /// The IAnchor::ShiftTo method shifts the current anchor to the same position as another anchor. /// Anchor occupying a position that the current anchor will be moved to. /// Implementing this method is usually more efficient than an equivalent IAnchor::Shift operation. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-shiftto HRESULT ShiftTo( IAnchor *paSite ); void ShiftTo([In] IAnchor paSite); /// Shifts the anchor into an adjacent region in the text stream. /// /// /// Bitfields that are used to control anchor repositioning around hidden text, or to avoid actual repositioning of the anchor. /// /// /// /// Value /// Meaning /// /// /// TS_SHIFT_COUNT_HIDDEN /// /// Specifies that the anchor will be shifted to the next region boundary, including the boundary of a hidden text region. If /// not set, the anchor will be shifted past any adjacent hidden text until a region of visible text is found. /// /// /// /// TS_SHIFT_COUNT_ONLY /// The anchor is not shifted. /// /// /// /// /// Contains one of the TsShiftDir values that specifies which adjacent region the anchor is moved to. /// /// /// Value /// Meaning /// /// /// TS_SD_BACKWARD /// Specifies that the anchor will be moved to the region immediately preceding a range of text. /// /// /// TS_SD_FORWARD /// Specifies that the anchor will be moved to the region immediately following a range of text. /// /// /// /// /// Boolean value that specifies whether a shift of the anchor occurred. /// /// /// Value /// Meaning /// /// /// TRUE /// The shift failed, and the anchor was not repositioned. /// /// /// FALSE /// The shift succeeded. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-shiftregion HRESULT ShiftRegion( DWORD // dwFlags, TsShiftDir dir, BOOL *pfNoRegion ); [return: MarshalAs(UnmanagedType.Bool)] bool ShiftRegion([In] uint dwFlags, [In] TsShiftDir dir); /// This method has not been implemented. /// Not used. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-setchangehistorymask HRESULT // SetChangeHistoryMask( DWORD dwMask ); void SetChangeHistoryMask([In, Optional] uint dwMask); /// /// The IAnchor::GetChangeHistory method gets the history of deletions that have occurred immediately preceding or /// following the anchor. /// /// /// /// Bit field flags that specify that deletions have occurred immediately preceding or following the anchor. One or both of the /// following values can be set. /// /// /// /// Value /// Meaning /// /// /// TS_CH_PRECEDING_DEL /// Text preceding the anchor has been deleted. /// /// /// TS_CH_FOLLOWING_DEL /// Text following the anchor has been deleted. /// /// /// /// /// The pdwHistory change flags must be set when deletions adjacent to the anchor have occurred. /// The change flags remain set until they are cleared with a call to IAnchor::ClearChangeHistory. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-getchangehistory HRESULT GetChangeHistory( // DWORD *pdwHistory ); TS_CH GetChangeHistory(); /// The IAnchor::ClearChangeHistory method clears the anchor change history flags. /// /// Applications should clear the anchor change history flags after receiving this call. The change history flags were set by IAnchor::GetChangeHistory. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-clearchangehistory HRESULT ClearChangeHistory(); void ClearChangeHistory(); /// /// The IAnchor::Clone method produces a new anchor object positioned at the same location, and with the same gravity, as /// the current anchor. /// /// A new anchor object, identical to the current anchor. /// The change history and change history masks are both cleared in the cloned anchor. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-ianchor-clone HRESULT Clone( IAnchor **ppaClone ); IAnchor Clone(); } /// /// /// The ITextStoreACP interface is implemented by the application and is used by the TSF manager to manipulate text streams /// or text stores in TSF. An application can obtain an instance of this interface with a call to the ITfDocumentMgr::CreateContext /// method. The interface ID is IID_ITextStoreACP. /// /// /// This interface exposes text stores through an application character position (ACP) format. Applications that use an anchor-based /// format should use ITextStoreAnchor. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nn-textstor-itextstoreacp [PInvokeData("textstor.h", MSDNShortId = "NN:textstor.ITextStoreACP")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("28888FE3-C2A0-483A-A3EA-8CB1CE51FF3D")] public interface ITextStoreACP { /// /// The ITextStoreACP::AdviseSink method installs a new advise sink from the ITextStoreACPSink interface or modifies an /// existing advise sink. The sink interface is specified by the punk parameter. /// /// Specifies the sink interface. /// Pointer to the sink interface. Cannot be NULL. /// /// Specifies the events that notify the advise sink. For more information about possible parameter values, see TS_AS_* Constants. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// CONNECT_E_ADVISELIMIT /// A sink interface pointer could not be obtained. /// /// /// E_INVALIDARG /// The specified sink interface is unsupported. /// /// /// E_UNEXPECTED /// The specified sink object could not be obtained. /// /// /// /// /// /// Subsequent calls with the same interface, represented by the punk parameter, are handled as requests to update the dwMask /// parameter. Servers should not call the AddRef method on the sink in response to such a request. /// /// /// Servers only maintain a single connection point. Attempts to advise a second sink object fail until the original sink object /// is removed. Applications should use the ITextStoreACP::UnadviseSink method to unregister the sink object when notifications /// are not required. /// /// Use this method to get the ITextStoreACPServices interface. /// Examples /// CMyTextEditor ITextStoreACP /// /// STDMETHODIMP CMyTextEditor::AdviseSink(REFIID riid, IUnknown *punk, DWORD dwMask) { HRESULT hr; IUnknown *punkID; typedef struct { IUnknown *punkID; ITextStoreACPSink *pTextStoreACPSink; DWORD dwMask; }ADVISE_SINK, *PADVISE_SINK; // Determine if the sink interface exists. // Get the pointer to the IUnknown interface and check if the IUnknown // pointer is the same as a pointer to an existing sink. // If the sink exists, update the existing sink with the // dwMask parameters passed to this method. hr = QueryInterface(IID_IUnknown, (LPVOID*)&punkID); if(FAILED(hr)) { hr = E_INVALIDARG; } if(punkID == m_AdviseSink.punkID) { m_AdviseSink.dwMask = dwMask; hr = S_OK; } // If the sink does not exist, do the following: // 1. Install a new sink. // 2. Keep the pointer to the IUnknown interface to uniquely // identify this advise sink. // 3. Set the dwMask parameter of this new sink to the dwMask // parameters passed to this method. // 4. Increment the reference count. // 5. Release the IUnknown pointer, since this pointer is no // longer required. if(IsEqualIID(riid, IID_ITextStoreACPSink)) { punk->QueryInterface(IID_ITextStoreACPSink, (LPVOID*)&m_AdviseSink.pTextStoreACPSink); m_AdviseSink.punkID = punkID; m_AdviseSink.dwMask = dwMask; punkID->AddRef(); punkID->Release(); hr = S_OK; } return hr; } /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-advisesink HRESULT AdviseSink( REFIID // riid, IUnknown *punk, DWORD dwMask ); [PreserveSig] HRESULT AdviseSink(in Guid riid, [In, MarshalAs(UnmanagedType.IUnknown)] object punk, [In] TS_AS dwMask); /// /// The ITextStoreACP::UnadviseSink method is called by an application to indicate that it no longer requires /// notifications from the TSF manager. The TSF manager will release the sink interface and stop notifications. /// /// Pointer to a sink object. Cannot be NULL. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// CONNECT_E_NOCONNECTION /// There is no active sink object. /// /// /// /// /// /// Every call to the ITextStoreAnchor::AdviseSink method, which registers a new sink object, should be matched by a call to /// this method. Calls to the ITextStoreAnchor::AdviseSink method that only update the dwMask parameter of a sink which /// was previously registered, do not require a call to the ITextStoreAnchor::UnadviseSink method. /// /// /// For example, to register a sink object, an application calls the ITextStoreAnchor::AdviseSink method the first time. /// After registering the sink object, the application can call the ITextStoreAnchor::AdviseSink method again with the /// same sink object to change the dwMask parameter. To unregister the sink object, an application calls the /// ITextStoreAnchor::UnadviseSink method. /// /// /// The punk parameter must have the same COM identity as the pointer originally passed in the /// ITextStoreAnchor::AdviseSink method. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-unadvisesink HRESULT UnadviseSink( // IUnknown *punk ); [PreserveSig] HRESULT UnadviseSink([In, MarshalAs(UnmanagedType.IUnknown)] object punk); /// /// The ITextStoreACP::RequestLock method is called by the TSF manager to provide a document lock in order to modify the /// document. This method calls the ITextStoreACPSink::OnLockGranted method to create the document lock. /// /// /// Specifies the type of lock requested. /// /// /// Value /// Meaning /// /// /// TS_LF_READ /// The document has a read-only lock and cannot be modified. /// /// /// TS_LF_READWRITE /// The document has a read/write lock and can be modified. /// /// /// TS_LF_SYNC /// The document has a synchronous-lock if this flag is combined with other flags. /// /// /// /// /// /// If the lock request is synchronous, receives an HRESULT value from the ITextStoreAnchorSink::OnLockGranted method that /// specifies the result of the lock request. /// /// /// If the lock request is asynchronous and the result is TS_S_ASYNC, the document receives an asynchronous lock. If the lock /// request is asynchronous and the result is TS_E_SYNCHRONOUS, the document cannot be locked synchronously. /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// /// /// /// This method uses the ITextStoreACPSink::OnLockGranted method to lock the document. Applications must never modify the /// document or send change notifications using the ITextStoreACPSink::OnTextChange method from within the /// ITextStoreACP::RequestLock method. If the application has pending changes to report, the application can only respond /// to the asynchronous lock request. /// /// /// Applications should not attempt to queue multiple ITextStoreACP::RequestLock method calls, because the application /// requires only a single callback. If the caller makes several read requests and one or more write requests, however, the /// callback should be for write access. /// /// /// Successful requests for synchronous locks supersede requests for asynchronous locks. Unsuccessful requests for synchronous /// locks do not supersede requests for asynchronous locks. The implementation must still serve the outstanding asynchronous /// request, if one exists. /// /// /// If the lock is granted before the ITextStoreACP::RequestLock method returns, the phrSession parameter will receive /// the HRESULT returned by the ITextStoreACPSink::OnLockGranted method. If the call is successful, but the lock will be /// granted later, the phrSession parameter receives the TS_S_ASYNC flag. The phrSession parameter should be ignored if /// ITextStoreACP::RequestLock returns anything other than S_OK. /// /// /// A caller should never call this method reentrantly, except in the case that the caller holds a read-only lock. In this case /// the method can be called reentrantly to ask for an asynchronous write lock. The write lock will be granted later, after the /// read-only lock ends. /// /// For more information about document locks, see Document Locks. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-requestlock HRESULT RequestLock( DWORD // dwLockFlags, HRESULT *phrSession ); [PreserveSig] HRESULT RequestLock([In] TS_LF dwLockFlags, out HRESULT phrSession); /// /// The ITextStoreACP::GetStatus method obtains the document status. The document status is returned through the /// TS_STATUS structure. /// /// Receives the TS_STATUS structure that contains the document status. Cannot be NULL. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The pointer to the TS_STATUS parameter is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-getstatus HRESULT GetStatus( TS_STATUS // *pdcs ); [PreserveSig] HRESULT GetStatus(out TS_STATUS pdcs); /// /// The ITextStoreACP::QueryInsert method determines whether the specified start and end character positions are valid. /// Use this method to adjust an edit to a document before executing the edit. The method must not return values outside the /// range of the document. /// /// Starting application character position for inserted text. /// /// Ending application character position for the inserted text. This value is equal to acpTextStart if the text is inserted at /// a point instead of replacing selected text. /// /// Length of replacement text. /// /// Returns the new starting application character position of the inserted text. If this parameter is NULL, then text /// cannot be inserted at the specified position. This value cannot be outside the document range. /// /// /// Returns the new ending application character position of the inserted text. If this parameter is NULL, then /// pacpResultStart is set to NULL and text cannot be inserted at the specified position. This value cannot be outside /// the document range. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_INVALIDARG /// The acpTestStart or acpTestEnd parameters are invalid. /// /// /// /// /// The values of pacpResultStart and pacpResultEnd depend upon how the application inserts text into the document. If /// pacpResultStart and pacpResultEnd are the same as acpTextStart, the cursor is at the beginning of the inserted text after /// insertion. If pacpResultStart and pacpResultEnd are the same as acpTextEnd, the cursor is at the end of the inserted text /// after insertion. If the difference between pacpResultStart and pacpResultEnd is equal to the length of the inserted text, /// the inserted text is highlighted after insertion. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-queryinsert HRESULT QueryInsert( LONG // acpTestStart, LONG acpTestEnd, ULONG cch, LONG *pacpResultStart, LONG *pacpResultEnd ); [PreserveSig] HRESULT QueryInsert([In] int acpTestStart, [In] int acpTestEnd, [In] uint cch, out int pacpResultStart, out int pacpResultEnd); /// /// The ITextStoreACP::GetSelection method returns the character position of a text selection in a document. This method /// supports multiple text selections. The caller must have a read-only lock on the document before calling this method. /// /// /// Specifies the text selections that start the process. If the TF_DEFAULT_SELECTION constant is specified for this parameter, /// the input selection starts the process. /// /// Specifies the maximum number of selections to return. /// /// Receives the style, start, and end character positions of the selected text. These values are put into the TS_SELECTION_ACP structure. /// /// Receives the number of pSelection structures returned. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock on the document. /// /// /// TS_E_NOSELECTION /// The document has no selection. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-getselection HRESULT GetSelection( // ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched ); [PreserveSig] HRESULT GetSelection([In] uint ulIndex, [In] uint ulCount, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_SELECTION_ACP[] pSelection, [NullAllowed] out uint pcFetched); /// /// The ITextStoreACP::SetSelection method selects text within the document. The application must have a read/write lock /// on the document before calling this method. /// /// Specifies the number of text selections in pSelection. /// /// Specifies the style, start, and end character positions of the text selected through the TS_SELECTION_ACP structure. /// /// When the start and end character positions are equal, the method places a caret at that character position. There can be /// only one caret at a time in the document. /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// TF_E_INVALIDPOS /// The character positions specified are beyond the text in the document. /// /// /// TF_E_NOLOCK /// The caller does not have a read/write lock. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-setselection HRESULT SetSelection( // ULONG ulCount, const TS_SELECTION_ACP *pSelection ); [PreserveSig] HRESULT SetSelection([In] uint ulCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] TS_SELECTION_ACP[] pSelection); /// /// The ITextStoreACP::GetText method returns information about text at a specified character position. This method /// returns the visible and hidden text and indicates if embedded data is attached to the text. /// /// Specifies the starting character position. /// /// Specifies the ending character position. If this parameter is 1, then return all text in the text store. /// /// /// Specifies the buffer to receive the plain text data. If this parameter is NULL, then the cchPlainReq parameter must /// be 0. /// /// Specifies the number of plain text characters passed to the method. /// /// Receives the number of characters copied into the plain text buffer. This parameter cannot be NULL. Use a parameter /// if values are not required. /// /// Receives an array of TS_RUNINFO structures. May be NULL only if cRunInfoReq = 0. /// Specifies the size, in characters, of the text run buffer. /// /// Receives the number of TS_RUNINFO structures written to the text run buffer. This parameter cannot be NULL. /// /// Receives the character position of the next unread character. Cannot be NULL. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TF_E_INVALIDPOS /// The acpStart or acpEnd parameters are outside of the document text. /// /// /// TF_E_NOLOCK /// The caller does not have a read-only lock on the document. /// /// /// /// /// /// Callers that use this method must have a read-only lock on the document by calling the ITextStoreACP::RequestLock /// method. Without a read-only lock, the method fails and returns TF_E_NOLOCK. /// /// /// Applications can also truncate the method return values for internal reasons. Callers should carefully examine the return /// characters and text run counts to get the required return values. If the return values are incomplete, repeatedly call the /// method until the return values are complete. /// /// /// The caller can request plain text only by setting the cRunInfoReq parameter to 0 and the prgRunInfo parameter to /// NULL. The caller can request only text run data by setting the cchPlainReq parameter to 0 and the pchPlain parameter /// to NULL. However, the caller must still supply valid non- null values for pcchPlainRet, even if this parameter /// is not used. /// /// /// If acpEnd is -1, then it should be handled as if set at the end of the stream. Otherwise, it will be greater than or equal /// to zero. /// /// /// On exit, pacpNext should be set to the character position of the next character in the stream not referenced by the return /// values. A caller would use this to quickly scan text with multiple ITextStoreACP::GetText calls. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-gettext HRESULT GetText( LONG acpStart, // LONG acpEnd, WCHAR *pchPlain, ULONG cchPlainReq, ULONG *pcchPlainRet, TS_RUNINFO *prgRunInfo, ULONG cRunInfoReq, ULONG // *pcRunInfoRet, LONG *pacpNext ); [PreserveSig] HRESULT GetText([In] int acpStart, [In] int acpEnd, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pchPlain, [In] uint cchPlainReq, out uint pcchPlainRet, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 7)] TS_RUNINFO[] prgRunInfo, [In] uint cRunInfoReq, out uint pcRunInfoRet, out int pacpNext); /// The ITextStoreACP::SetText method sets the text selection to the supplied character positions. /// /// If set to the value of TS_ST_CORRECTION, the text is a transform (correction) of existing content, and any special text /// markup information (metadata) is retained, such as .wav file data or a language identifier. The client defines the type of /// markup information to be retained. /// /// Specifies the starting character position of the text to replace. /// /// Specifies the ending character position of the text to replace. This parameter is ignored if the value is 1. /// /// /// Specifies the pointer to the replacement text. The text string does not have to be NULL terminated, because the text /// character count is specified in the cch parameter. /// /// Specifies the number of characters in the replacement text. /// /// Pointer to a TS_TEXTCHANGE structure with the following data. /// /// /// Value /// Meaning /// /// /// acpStart /// The starting application character position before the text is inserted into the document. /// /// /// acpOldEnd /// /// The ending position before the text is inserted into the document. This value is the same as acpStart for an insertion /// point. If this value is different from acpStart, then text was selected prior to the text insertion. /// /// /// /// acpNewEnd /// The ending position after the text insertion occurred. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_INVALIDPOS /// The acpStart or acpEnd parameter is outside of the document text. /// /// /// TS_E_NOLOCK /// The caller does not have a read/write lock. /// /// /// TS_E_READONLY /// The document is read-only. Content cannot be modified. /// /// /// TS_E_REGION /// An attempt was made to modify text across a region boundary. /// /// /// /// /// /// Applications should start a composition by first using ITextStoreACP::InsertTextAtSelection. ITextStoreACP::SetText /// should be used only within an existing composition. If there is no active composition at the time SetText is called, /// the TSF manager creates a composition that lasts just long enough to wrap the call to SetText. /// /// The acpStart and acpEnd character positions cannot be outside the document range. /// Applications should not call the ITextStoreACPSink::OnTextChange method in response to this method. /// /// This method should call the ITextStoreACP::SetSelection method to select the text to be changed. After successfully /// executing the ITextStoreACP::SetSelection method, this method then calls the /// ITextStoreACP::InsertTextAtSelection method to perform the actual text change. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-settext HRESULT SetText( DWORD dwFlags, // LONG acpStart, LONG acpEnd, const WCHAR *pchText, ULONG cch, TS_TEXTCHANGE *pChange ); [PreserveSig] HRESULT SetText([In] TS_ST dwFlags, [In] int acpStart, [In] int acpEnd, [In, MarshalAs(UnmanagedType.LPWStr)] string pchText, [In] uint cch, out TS_TEXTCHANGE pChange); /// /// The ITextStoreACP::GetFormattedText method returns formatted text data about a specified text string. The caller must /// have a read/write lock on the document before calling this method. /// /// Specifies the starting character position of the text to get in the document. /// /// Specifies the ending character position of the text to get in the document. This parameter is ignored if the value is 1. /// /// Receives the pointer to the IDataObject object that contains the formatted text. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_NOLOCK /// The caller does not have a read/write lock on the document. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-getformattedtext HRESULT // GetFormattedText( LONG acpStart, LONG acpEnd, IDataObject **ppDataObject ); [PreserveSig] HRESULT GetFormattedText([In] int acpStart, [In] int acpEnd, [Out, MarshalAs(UnmanagedType.Interface)] out IDataObject ppDataObject); /// Gets an embedded document. /// Contains the character position, within the document, from where the object is obtained. /// /// Contains a GUID value that defines the requested format of the obtained object. This can be one of the following values. /// /// /// Value /// Meaning /// /// /// GUID_TS_SERVICE_DATAOBJECT /// The object should be obtained as an IDataObject object. /// /// /// GUID_TS_SERVICE_ACCESSIBLE /// The object should be obtained as an Accessible object. /// /// /// GUID_TS_SERVICE_ACTIVEX /// The object should be obtained as an ActiveX object. /// /// /// /// Specifies the interface type requested. /// Pointer to an IUnknown pointer that receives the requested interface. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_NOTIMPL /// The application does not support embedded objects. /// /// /// TF_E_INVALIDPOS /// acpPos is not within the document. /// /// /// TS_E_NOINTERFACE /// The requested interface type is unsupported. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock. /// /// /// TS_E_NOOBJECT /// There is no embedded object at acpPos. /// /// /// TS_E_NOSERVICE /// The service type specified in rguidService is unsupported. /// /// /// /// /// The caller must use QueryInterface to probe for appropriate interfaces. Prospective interfaces include those /// associated with embedded documents or controls such as IOleObject , IDataObject , IViewObject , /// IPersistStorage , IOleCache , or IDispatch . /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-getembedded HRESULT GetEmbedded( LONG // acpPos, REFGUID rguidService, REFIID riid, IUnknown **ppunk ); [PreserveSig] HRESULT GetEmbedded([In] int acpPos, in Guid rguidService, in Guid riid, [Out, MarshalAs(UnmanagedType.IUnknown)] out object ppunk); /// Gets a value indicating whether the specified object can be inserted into the document. /// Pointer to the object type. Can be NULL. /// /// Pointer to the FORMATETC structure that contains format data of the object. This parameter cannot be NULL if the /// pguidService parameter is NULL. /// /// /// Receives TRUE if the object type can be inserted into the document or FALSE if the object type cannot be /// inserted into the document. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The pFormatEtc parameter is NULL. /// /// /// /// The clipboard formats supported by the document are dependent on the application. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-queryinsertembedded HRESULT // QueryInsertEmbedded( const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable ); [PreserveSig] HRESULT QueryInsertEmbedded([In, Optional] GuidPtr pguidService, [In, Optional] IntPtr pFormatEtc, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfInsertable); /// Inserts an embedded object at the specified character. /// Must be TS_IE_CORRECTION. /// Contains the starting character position where the object is inserted. /// Contains the ending character position where the object is inserted. /// Pointer to an IDataObject interface that contains data about the object inserted. /// Pointer to a TS_TEXTCHANGE structure that receives data about the modified text. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_NOTIMPL /// The application does not support embedded objects. /// /// /// TS_E_FORMAT /// The application does not support the data type contained in pDataObject. /// /// /// TS_E_INVALIDPOS /// acpStart and/or acpEnd are not within the document. /// /// /// TS_E_NOLOCK /// The caller does not have a read/write lock. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-insertembedded HRESULT InsertEmbedded( // DWORD dwFlags, LONG acpStart, LONG acpEnd, IDataObject *pDataObject, TS_TEXTCHANGE *pChange ); [PreserveSig] HRESULT InsertEmbedded([In] TS_IE dwFlags, [In] int acpStart, [In] int acpEnd, [In] IDataObject pDataObject, out TS_TEXTCHANGE pChange); /// /// The ITextStoreACP::InsertTextAtSelection method inserts text at the insertion point or selection. A caller must have /// a read/write lock on the document before inserting text. /// /// /// /// Specifies whether the pacpStart and pacpEnd parameters and the TS_TEXTCHANGE structure contain the results of the text insertion. /// /// The TF_IAS_NOQUERY and TF_IAS_QUERYONLY flags cannot be combined. /// /// /// Value /// Meaning /// /// /// 0 /// /// Text insertion will occur, and the pacpStart and pacpEnd parameters will contain the results of the text insertion. The /// TS_TEXTCHANGE structure must be filled with this flag. /// /// /// /// TF_IAS_NOQUERY /// /// Text is inserted, the values of the pacpStart and pacpEnd parameters can be NULL, and the TS_TEXTCHANGE structure must be /// filled. Use this flag to view the results of the text insertion. /// /// /// /// TF_IAS_QUERYONLY /// /// Text is not inserted, and the values for the pacpStart and pacpEnd parameters contain the results of the text insertion. The /// values of these parameters depend on how the application implements text insertion into a document. For more information, /// see the Remarks section. Use this flag to view the results of the text insertion without actually inserting the text. It is /// not required that you fill the TS_TEXTCHANGE structure if you use this flag. /// /// /// /// /// Pointer to the string to insert in the document. The string can be NULL terminated. /// Specifies the text length. /// Pointer to the starting application character position where the text insertion occurs. /// /// Pointer to the ending application character position where the text insertion occurs. This parameter value is the same as /// the value of the pacpStart parameter for an insertion point. /// /// /// Pointer to a TS_TEXTCHANGE structure with the following members. /// /// /// Value /// Meaning /// /// /// acpStart /// The starting application character position before the text is inserted into the document. /// /// /// acpOldEnd /// /// The ending application character position before the text is inserted into the document. This value is the same as acpStart /// for an insertion point. If this value is different from acpStart, then text was selected prior to the text insertion. /// /// /// /// acpNewEnd /// The end position after the text insertion occurred. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_NOLOCK /// The caller does not have a lock on the document. /// /// /// E_INVALIDARG /// The pchText parameter is invalid. /// /// /// /// /// /// The values of the pacpStart and the pacpEnd parameters depend upon how the client application inserts text into a document. /// For example, if the application sets the cursor at the start of the inserted text after text insertion, then the value for /// the pacpStart and pacpEnd parameters is the same as the acpStart member of the TS_TEXTCHANGE structure. /// /// Applications should not call the ITextStoreACPSink::OnTextChange method in response to this method. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-inserttextatselection HRESULT // InsertTextAtSelection( DWORD dwFlags, const WCHAR *pchText, ULONG cch, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange ); [PreserveSig] HRESULT InsertTextAtSelection([In] TS_IAS dwFlags, [In, MarshalAs(UnmanagedType.LPWStr)] string pchText, [In] uint cch, out int pacpStart, out int pacpEnd, out TS_TEXTCHANGE pChange); /// /// The ITextStoreACP::InsertEmbeddedAtSelection method inserts an IDataObject object at the insertion point or /// selection. The client that calls this method must have a read/write lock before inserting an IDataObject object into /// the document. /// /// /// /// Specifies whether the pacpStart and pacpEnd parameters and the TS_TEXTCHANGE structure will contain the results of the /// object insertion. /// /// The TF_IAS_NOQUERY and TF_IAS_QUERYONLY flags cannot be combined. /// /// /// Value /// Meaning /// /// /// 0 /// /// Text insertion will occur, and the pacpStart and pacpEnd parameters will contain the results of the text insertion. The /// TS_TEXTCHANGE structure must be filled with this flag. /// /// /// /// TF_IAS_NOQUERY /// /// Text is inserted, the values of the pacpStart and pacpEnd parameters can be NULL, and the TS_TEXTCHANGE structure must be /// filled. Use this flag if the results of the text insertion are not required. /// /// /// /// TF_IAS_QUERYONLY /// /// Text is not inserted, and the values for the pacpStart and pacpEnd parameter contain the results of the text insertion. The /// values of these parameters depend on how the application implements text insertion into a document. For more information, /// see the Remarks section. Use this flag to view the results of the text insertion without actually inserting the text, for /// example, to predict the results of collapsing or otherwise adjusting a selection. It is not required that you fill the /// TS_TEXTCHANGE structure with this flag. /// /// /// /// /// Pointer to the IDataObject object to be inserted. /// Pointer to the starting application character position where the object insertion will occur. /// /// Pointer to the ending application character position where the object insertion will occur. This parameter value will be the /// same as the value of the pacpStart parameter for an insertion point. /// /// /// Pointer to a TS_TEXTCHANGE structure with the following members. /// /// /// Value /// Meaning /// /// /// acpStart /// The starting application character position before the object is inserted into the document. /// /// /// acpOldEnd /// /// The ending application character position before the object is inserted into the document. This value is the same as /// acpStart for an insertion point. If this value is different from acpStart, then text was selected prior to the object insertion. /// /// /// /// acpNewEnd /// The ending application character position after the object insertion took place. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The pchText parameter is invalid. /// /// /// TS_E_NOLOCK /// The caller does not have a lock on the document. /// /// /// /// /// The values of the pacpStart and pacpEnd parameters depend upon how the client application inserts an object into a document. /// For example, if the application sets the cursor at the start of the object after object insertion, then the value of the /// pacpStart and pacpEnd parameters is the same as the acpStart member of the TS_TEXTCHANGE structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-insertembeddedatselection HRESULT // InsertEmbeddedAtSelection( DWORD dwFlags, IDataObject *pDataObject, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange ); [PreserveSig] HRESULT InsertEmbeddedAtSelection([In] TS_IAS dwFlags, [In] IDataObject pDataObject, out int pacpStart, out int pacpEnd, out TS_TEXTCHANGE pChange); /// Get the attributes that are supported in the document. /// /// Specifies whether a subsequent call to the ITextStoreAnchor::RetrieveRequestedAttrs method will contain the supported /// attributes. If the TS_ATTR_FIND_WANT_VALUE flag is specified, the default attribute values will be those in the TS_ATTRVAL /// structure after the subsequent call to ITextStoreAnchor::RetrieveRequestedAttrs. If any other flag is specified for /// this parameter, the method only verifies that the attribute is supported and that the varValue member of the /// TS_ATTRVAL structure is set to VT_EMPTY. /// /// Specifies the number of supported attributes to obtain. /// /// Pointer to the TS_ATTRID data type that specifies the attribute to verify. The method returns only the attributes specified /// by TS_ATTRID, even though other attributes can be supported. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_OUTOFMEMORY /// The method was unable to allocate sufficient memory to complete the operation. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-requestsupportedattrs HRESULT // RequestSupportedAttrs( DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs ); [PreserveSig] HRESULT RequestSupportedAttrs([In] TS_ATTR_FIND dwFlags, [In] uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs); /// Gets text attributes at the specified character position. /// Specifies the application character position in the document. /// Specifies the number of attributes to obtain. /// Pointer to the TS_ATTRID data type that specifies the attribute to verify. /// Must be zero. /// This method has no return values. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-requestattrsatposition HRESULT // RequestAttrsAtPosition( LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags ); [PreserveSig] HRESULT RequestAttrsAtPosition([In] int acpPos, [In] uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs, TS_ATTR_FIND dwFlags = 0); /// Gets text attributes transitioning at the specified character position. /// Specifies the application character position in the document. /// Specifies the number of attributes to obtain. /// Pointer to the TS_ATTRID data type that specifies the attribute to verify. /// /// /// Specifies attributes for the call to the ITextStoreACP::RetrieveRequestedAttrs method. If this parameter is not set, the /// method returns the attributes that start at the specified position. Other possible values for this parameter are the following. /// /// /// /// Value /// Meaning /// /// /// TS_ATTR_FIND_WANT_END /// Obtains the attributes that end at the specified application character position. /// /// /// TS_ATTR_FIND_WANT_VALUE /// /// Obtains the value of the attribute in addition to the attribute. The attribute value is put into the varValue member of the /// TS_ATTRVAL structure during the ITextStoreACP::RetrieveRequestedAttrs method call. /// /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// In the sentence, "This is italic text.", the italic attribute starts before the word italic and ends after the word text. /// /// /// If the flag TS_ATTR_FIND_WANT_END is set in dwFlags, the method would return the italic attribute for the text "italic /// <anchor>normal", because there is an end transition at the anchor location. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-requestattrstransitioningatposition // HRESULT RequestAttrsTransitioningAtPosition( LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags ); [PreserveSig] HRESULT RequestAttrsTransitioningAtPosition([In] int acpPos, [In] uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs, [In] TS_ATTR_FIND dwFlags); /// /// The ITextStoreACP::FindNextAttrTransition method determines the character position where a transition occurs in an /// attribute value. The specified attribute to check is application-dependent. /// /// Specifies the character position to start the search for an attribute transition. /// Specifies the character position to end the search for an attribute transition. /// Specifies the number of attributes to check. /// Pointer to the TS_ATTRID data type that specifies the attribute to check. /// /// Specifies the direction to search for an attribute transition. By default, the method searches forward. /// /// /// Value /// Meaning /// /// /// TS_ATTR_FIND_BACKWARDS /// The method searches backward. /// /// /// TS_ATTR_FIND_WANT_OFFSET /// The plFoundOffset parameter receives the character offset of the attribute transition from acpStart. /// /// /// /// Receives the next character position to check for an attribute transition. /// /// Receives a Boolean value of TRUE if an attribute transition was found, otherwise FALSE is returned. /// /// /// Receives the character position of the attribute transition (not ACP positions). If TS_ATTR_FIND_WANT_OFFSET flag is set in /// dwFlags, receives the character offset of the attribute transition from acpStart. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_INVALIDPOS /// The character positions specified are beyond the text in the document. /// /// /// /// /// Note If an application does not implement ITextStoreACP::FindNextAttrTransition, /// ITfReadOnlyProperty::EnumRanges fails with E_FAIL. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-findnextattrtransition HRESULT // FindNextAttrTransition( LONG acpStart, LONG acpHalt, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags, LONG // *pacpNext, BOOL *pfFound, LONG *plFoundOffset ); [PreserveSig] HRESULT FindNextAttrTransition([In] int acpStart, [In] int acpHalt, [In] uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs, [In] TS_ATTR_FIND dwFlags, out int pacpNext, [MarshalAs(UnmanagedType.Bool)] out bool pfFound, out int plFoundOffset); /// Gets the attributes returned by a call to an attribute request method. /// Specifies the number of supported attributes to obtain. /// /// Pointer to the TS_ATTRVAL structure that receives the supported attributes. The members of this structure depend upon the /// dwFlags parameter of the calling method. /// /// Receives the number of supported attributes. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-retrieverequestedattrs HRESULT // RetrieveRequestedAttrs( ULONG ulCount, TS_ATTRVAL *paAttrVals, ULONG *pcFetched ); [PreserveSig] HRESULT RetrieveRequestedAttrs([In] uint ulCount, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] TS_ATTRVAL[] paAttrVals, [NullAllowed] out uint pcFetched); /// The ITextStoreACP::GetEndACP method returns the number of characters in a document. /// Receives the character position of the last character in the document plus one. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_NOTIMPL /// /// The application has not implemented this method. This is usually an indication that calculating the end position requires /// excessive resources. If the end position is necessary, you can use ITextStoreACP::GetText to calculate it, though this can /// also be a memory-intensive operation, paging in arbitrarily large amounts of memory from disk. /// /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-getendacp HRESULT GetEndACP( LONG *pacp ); [PreserveSig] HRESULT GetEndACP(out int pacp); /// /// The ITextStoreACP::GetActiveView method returns a TsViewCookie data type that specifies the current active view. /// /// Receives the TsViewCookie data type that specifies the current active view. /// This method has no return values. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-getactiveview HRESULT GetActiveView( // TsViewCookie *pvcView ); [PreserveSig] HRESULT GetActiveView(out TsViewCookie pvcView); /// /// The ITextStoreACP::GetACPFromPoint method converts a point in screen coordinates to an application character position. /// /// Specifies the context view. /// Pointer to the POINT structure with the screen coordinates of the point. /// /// /// Specifies the character position to return based upon the screen coordinates of the point relative to a character bounding /// box. By default, the character position returned is the character bounding box containing the screen coordinates of the /// point. If the point is outside a character bounding box, the method returns NULL or TF_E_INVALIDPOINT. Other bit /// flags for this parameter are as follows. /// /// The bit flags can be combined. /// /// /// Value /// Meaning /// /// /// GXFPF_ROUND_NEAREST /// /// If the screen coordinates of the point are contained in a character bounding box, the character position returned is the /// bounding edge closest to the screen coordinates of the point. /// /// /// /// GXFPF_NEAREST /// /// If the screen coordinates of the point are not contained in a character bounding box, the closest character position is returned. /// /// /// /// /// Receives the character position that corresponds to the screen coordinates of the point. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_INVALIDPOINT /// The ptScreen parameter is not within the bounding box of any character. /// /// /// TS_E_NOLAYOUT /// The application has not calculated a text layout. /// /// /// /// /// /// The point 1 screen coordinates cause the pacp parameter to be 0 by default or if the dwFlags parameter is set to /// GXFPF_NEAREST because the point 1 screen coordinates are inside the character bounding box of character position 0. If the /// dwFlags parameter is set to GXFPF_ROUND_NEAREST for point 1, the pacp parameter is 1 because the point 1 screen coordinates /// are closest to range position 1. Range position 1 is the starting range position of character position 1. /// /// /// For the point 2 screen coordinates, the method returns TF_E_INVALIDPOINT by default or if the dwFlags parameter is /// set to GXFPF_NEAREST because the point 2 screen coordinates are outside a character bounding box. If the dwFlags /// parameter is set to GXFPF_ROUND_NEAREST, then the point 2 screen coordinates causes the pacp parameter to be 1, /// because the closest character position to the point 2 screen coordinates is character position 1. /// /// Point 1 /// /// /// Default-- pacp = 0 --The screen coordinates point is inside the character bounding box of Character Position 0. /// /// /// /// GXFPF_ROUND_NEAREST -- pacp = 1 --The screen coordinates of the point is closest to Range Position 1 which is the /// starting range position of Character Position 1. /// /// /// /// /// GXFPF_NEAREST -- pacp = 0 --The default behavior occurs because the point is within the character bounding box of /// Character Position 0. /// /// /// /// Point 2 /// /// /// Default-- hr = TF_E_INVALIDPOINT --The screen coordinates of the point is outside a character bounding box. /// /// /// /// GXPF_ROUND_NEAREST-- hr = TF_E_INVALIDPOINT --The default behavior occurs because the screen coordinates of the point are /// outside a character bounding box. /// /// /// /// /// GXPF_NEAREST-- pacp = 1 --The closest character position to the screen coordinates of the point is Character Position 1. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-getacpfrompoint HRESULT // GetACPFromPoint( TsViewCookie vcView, const POINT *ptScreen, DWORD dwFlags, LONG *pacp ); [PreserveSig] HRESULT GetACPFromPoint([In] TsViewCookie vcView, in POINT ptScreen, [In] GXFPF dwFlags, out int pacp); /// /// The ITextStoreACP::GetTextExt method returns the bounding box, in screen coordinates, of the text at a specified /// character position. The caller must have a read-only lock on the document before calling this method. /// /// Specifies the context view. /// Specifies the starting character position of the text to get in the document. /// Specifies the ending character position of the text to get in the document. /// Receives the bounding box in screen coordinates of the text at the specified character positions. /// /// Receives a Boolean value that specifies if the text in the bounding box has been clipped. If this parameter is TRUE, /// the bounding box contains clipped text and does not include the entire requested text range. The bounding box is clipped /// because the requested range is not visible. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_INVALIDARG /// The specified start and end character positions are equal. /// /// /// TS_E_INVALIDPOS /// The range specified by the acpStart and acpEnd parameters extends past the beginning or end of the document. /// /// /// TS_E_NOLAYOUT /// The application has not calculated a text layout. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock on the document. /// /// /// /// /// If the document window is minimized, or if the specified text is not currently visible, the method returns S_OK with the prc /// parameter set to {0,0,0,0}. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-gettextext HRESULT GetTextExt( // TsViewCookie vcView, LONG acpStart, LONG acpEnd, RECT *prc, BOOL *pfClipped ); [PreserveSig] HRESULT GetTextExt([In] TsViewCookie vcView, [In] int acpStart, [In] int acpEnd, out RECT prc, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfClipped); /// /// The ITextStoreACP::GetScreenExt method returns the bounding box screen coordinates of the display surface where the /// text stream is rendered. /// /// Specifies the context view. /// Receives the bounding box screen coordinates of the display surface of the document. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The specified vcView parameter is invalid. /// /// /// /// /// If the text is not currently displayed, for example, if the document window is minimized, the prc parameter is set to { 0, /// 0, 0, 0 }. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-getscreenext HRESULT GetScreenExt( // TsViewCookie vcView, RECT *prc ); [PreserveSig] HRESULT GetScreenExt([In] TsViewCookie vcView, out RECT prc); /// The ITextStoreACP::GetWnd method returns the handle to a window that corresponds to the current document. /// Specifies the TsViewCookie data type that corresponds to the current document. /// /// Receives a pointer to the handle of the window that corresponds to the current document. This parameter can be NULL /// if the document does not have the corresponding handle to the window. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The TsViewCookie data type is invalid. /// /// /// /// /// A document cannot have a corresponding window handle if the document is in memory but not displayed on the screen, or if the /// document is a windowless control and the control does not recognize the window handle of the owner of the windowless /// controls. Callers cannot assume that the phwnd parameter will receive a non- NULL value even if the method is /// successful. Callers can also receive a NULL value for the phwnd parameter. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp-getwnd HRESULT GetWnd( TsViewCookie // vcView, HWND *phwnd ); [PreserveSig] HRESULT GetWnd([In] TsViewCookie vcView, out HWND phwnd); } /// /// /// The ITextStoreACP2 interface is implemented by the application and is used by the TSF manager to manipulate text streams /// or text stores in TSF. An application can obtain an instance of this interface with a call to the CreateContext method. The /// interface ID is IID_ITextStoreACP2. /// /// /// This interface exposes text stores through an application character position (ACP) format. Applications that use an anchor-based /// format should use ITextStoreAnchor. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nn-textstor-itextstoreacp2 [PInvokeData("textstor.h", MSDNShortId = "NN:textstor.ITextStoreACP2")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("f86ad89f-5fe4-4b8d-bb9f-ef3797a84f1f")] public interface ITextStoreACP2 { /// /// Installs a new advise sink from the ITextStoreACPSink interface or modifies an existing advise sink. The sink interface is /// specified by the punk parameter. /// /// Specifies the sink interface. /// Pointer to the sink interface. Cannot be NULL. /// /// Specifies the events that notify the advise sink. For more information about possible parameter values, see TS_AS_* Constants. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// CONNECT_E_ADVISELIMIT /// A sink interface pointer could not be obtained. /// /// /// E_INVALIDARG /// The specified sink interface is unsupported. /// /// /// E_UNEXPECTED /// The specified sink object could not be obtained. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-advisesink HRESULT AdviseSink( REFIID // riid, IUnknown *punk, DWORD dwMask ); [PreserveSig] HRESULT AdviseSink(in Guid riid, [In, MarshalAs(UnmanagedType.IUnknown)] object punk, [In] TS_AS dwMask); /// /// Called by an application to indicate that it no longer requires notifications from the TSF manager. The TSF manager will /// release the sink interface and stop notifications. /// /// Pointer to a sink object. Cannot be NULL. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// CONNECT_E_NOCONNECTION /// There is no active sink object. /// /// /// /// /// /// Every call to the AdviseSink method, which registers a new sink object, should be matched by a call to this method. Calls to /// the AdviseSink method that only update the dwMask parameter of a sink which was previously registered, do not require /// a call to the UnadviseSink method. /// /// /// For example, to register a sink object, an application calls the AdviseSink method the first time. After registering the /// sink object, the application can call the AdviseSink method again with the same sink object to change the dwMask /// parameter. To unregister the sink object, an application calls the UnadviseSink method. /// /// The punk parameter must have the same COM identity as the pointer originally passed in the AdviseSink method. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-unadvisesink HRESULT UnadviseSink( // IUnknown *punk ); [PreserveSig] HRESULT UnadviseSink([In, MarshalAs(UnmanagedType.IUnknown)] object punk); /// /// Called by the TSF manager to provide a document lock in order to modify the document. This method calls the OnLockGranted /// method to create the document lock. /// /// /// Specifies the type of lock requested. /// /// /// Value /// Meaning /// /// /// TS_LF_READ /// The document has a read-only lock and cannot be modified. /// /// /// TS_LF_READWRITE /// The document has a read/write lock and can be modified. /// /// /// TS_LF_SYNC /// The document has a synchronous-lock if this flag is combined with other flags. /// /// /// /// /// /// If the lock request is synchronous, receives an HRESULT value from the OnLockGranted method that specifies the result of the /// lock request. /// /// /// If the lock request is asynchronous and the result is TS_S_ASYNC, the document receives an asynchronous lock. If the lock /// request is asynchronous and the result is TS_E_SYNCHRONOUS, the document can't be locked synchronously. /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// /// /// /// This method uses the OnLockGranted method to lock the document. Applications must never modify the document or send change /// notifications using the OnTextChange method from within the RequestLock method. If the application has pending /// changes to report, the application can only respond to the asynchronous lock request. /// /// /// Applications should not attempt to queue multiple RequestLock method calls, because the application requires only a /// single callback. If the caller makes several read requests and one or more write requests, however, the callback should be /// for write access. /// /// /// Successful requests for synchronous locks supersede requests for asynchronous locks. Unsuccessful requests for synchronous /// locks do not supersede requests for asynchronous locks. The implementation must still serve the outstanding asynchronous /// request, if one exists. /// /// /// If the lock is granted before the RequestLock method returns, the phrSession parameter will receive the HRESULT /// returned by the OnLockGranted method. If the call is successful, but the lock will be granted later, the phrSession /// parameter receives the TS_S_ASYNC flag. The phrSession parameter should be ignored if RequestLock returns anything /// other than S_OK. /// /// /// A caller should never call this method reentrantly, except in the case that the caller holds a read-only lock. In this case /// the method can be called reentrantly to ask for an asynchronous write lock. The write lock will be granted later, after the /// read-only lock ends. /// /// For more information about document locks, see Document Locks. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-requestlock HRESULT RequestLock( DWORD // dwLockFlags, HRESULT *phrSession ); [PreserveSig] HRESULT RequestLock([In] TS_LF dwLockFlags, out HRESULT phrSession); /// Gets the document status. The document status is returned through the TS_STATUS structure. /// Receives the TS_STATUS structure that contains the document status. Cannot be NULL. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The pointer to the TS_STATUS parameter is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-getstatus HRESULT GetStatus( TS_STATUS // *pdcs ); [PreserveSig] HRESULT GetStatus(out TS_STATUS pdcs); /// /// Determines whether the specified start and end character positions are valid. Use this method to adjust an edit to a /// document before executing the edit. The method must not return values outside the range of the document. /// /// Starting application character position for inserted text. /// /// Ending application character position for the inserted text. This value is equal to acpTextStart if the text is inserted at /// a point instead of replacing selected text. /// /// Length of replacement text. /// /// Returns the new starting application character position of the inserted text. If this parameter is NULL, then text /// cannot be inserted at the specified position. This value cannot be outside the document range. /// /// /// Returns the new ending application character position of the inserted text. If this parameter is NULL, then /// pacpResultStart is set to NULL and text cannot be inserted at the specified position. This value cannot be outside /// the document range. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_INVALIDARG /// The acpTestStart or acpTestEnd parameters are invalid. /// /// /// /// /// The values of pacpResultStart and pacpResultEnd depend upon how the application inserts text into the document. If /// pacpResultStart and pacpResultEnd are the same as acpTextStart, the cursor is at the beginning of the inserted text after /// insertion. If pacpResultStart and pacpResultEnd are the same as acpTextEnd, the cursor is at the end of the inserted text /// after insertion. If the difference between pacpResultStart and pacpResultEnd is equal to the length of the inserted text, /// the inserted text is highlighted after insertion. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-queryinsert HRESULT QueryInsert( LONG // acpTestStart, LONG acpTestEnd, ULONG cch, LONG *pacpResultStart, LONG *pacpResultEnd ); [PreserveSig] HRESULT QueryInsert([In] int acpTestStart, [In] int acpTestEnd, [In] uint cch, out int pacpResultStart, out int pacpResultEnd); /// /// Gets the character position of a text selection in a document. This method supports multiple text selections. The caller /// must have a read-only lock on the document before calling this method. /// /// /// Specifies the text selections that start the process. If the TF_DEFAULT_SELECTION constant is specified for this parameter, /// the input selection starts the process. /// /// Specifies the maximum number of selections to return. /// /// Receives the style, start, and end character positions of the selected text. These values are put into the TS_SELECTION_ACP structure. /// /// Receives the number of pSelection structures returned. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock on the document. /// /// /// TS_E_NOSELECTION /// The document has no selection. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-getselection HRESULT GetSelection( // ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched ); [PreserveSig] HRESULT GetSelection([In] uint ulIndex, [In] uint ulCount, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_SELECTION_ACP[] pSelection, [NullAllowed] out uint pcFetched); /// /// Selects text within the document. The application must have a read/write lock on the document before calling this method. /// /// Specifies the number of text selections in pSelection. /// /// Specifies the style, start, and end character positions of the text selected through the TS_SELECTION_ACP structure. /// /// When the start and end character positions are equal, the method places a caret at that character position. There can be /// only one caret at a time in the document. /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// TF_E_INVALIDPOS /// The character positions specified are beyond the text in the document. /// /// /// TF_E_NOLOCK /// The caller does not have a read/write lock. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-setselection HRESULT SetSelection( // ULONG ulCount, const TS_SELECTION_ACP *pSelection ); [PreserveSig] HRESULT SetSelection([In] uint ulCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] TS_SELECTION_ACP[] pSelection); /// /// Gets info about text at a specified character position. This method returns the visible and hidden text and indicates if /// embedded data is attached to the text. /// /// Specifies the starting character position. /// /// Specifies the ending character position. If this parameter is 1, then return all text in the text store. /// /// /// Specifies the buffer to receive the plain text data. If this parameter is NULL, then the cchPlainReq parameter must /// be 0. /// /// Specifies the number of plain text characters passed to the method. /// /// Receives the number of characters copied into the plain text buffer. This parameter cannot be NULL. Use a parameter /// if values are not required. /// /// Receives an array of TS_RUNINFO structures. May be NULL only if cRunInfoReq = 0. /// Specifies the size, in characters, of the text run buffer. /// /// Receives the number of TS_RUNINFO structures written to the text run buffer. This parameter cannot be NULL. /// /// Receives the character position of the next unread character. Cannot be NULL. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TF_E_INVALIDPOS /// The acpStart or acpEnd parameters are outside of the document text. /// /// /// TF_E_NOLOCK /// The caller does not have a read-only lock on the document. /// /// /// /// /// /// Callers that use this method must have a read-only lock on the document by calling the RequestLock method. Without a /// read-only lock, the method fails and returns TF_E_NOLOCK. /// /// /// Applications can also truncate the method return values for internal reasons. Callers should carefully examine the return /// characters and text run counts to get the required return values. If the return values are incomplete, repeatedly call the /// method until the return values are complete. /// /// /// The caller can request plain text only by setting the cRunInfoReq parameter to 0 and the prgRunInfo parameter to /// NULL. The caller can request only text run data by setting the cchPlainReq parameter to 0 and the pchPlain parameter /// to NULL. However, the caller must still supply valid non- null values for pcchPlainRet, even if this parameter /// is not used. /// /// /// If acpEnd is -1, then it should be handled as if set at the end of the stream. Otherwise, it will be greater than or equal /// to zero. /// /// /// On exit, pacpNext should be set to the character position of the next character in the stream not referenced by the return /// values. A caller would use this to quickly scan text with multiple GetText calls. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-gettext HRESULT GetText( LONG // acpStart, LONG acpEnd, WCHAR *pchPlain, ULONG cchPlainReq, ULONG *pcchPlainRet, TS_RUNINFO *prgRunInfo, ULONG cRunInfoReq, // ULONG *pcRunInfoRet, LONG *pacpNext ); [PreserveSig] HRESULT GetText([In] int acpStart, [In] int acpEnd, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pchPlain, [In] uint cchPlainReq, out uint pcchPlainRet, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 7)] TS_RUNINFO[] prgRunInfo, [In] uint cRunInfoReq, out uint pcRunInfoRet, out int pacpNext); /// Sets the text selection to the supplied character positions. /// /// If set to the value of TS_ST_CORRECTION, the text is a transform (correction) of existing content, and any special /// text markup information (metadata) is retained, such as .wav file data or a language identifier. The client defines the type /// of markup information to be retained. /// /// Specifies the starting character position of the text to replace. /// /// Specifies the ending character position of the text to replace. This parameter is ignored if the value is 1. /// /// /// Specifies the pointer to the replacement text. The text string does not have to be NULL terminated, because the text /// character count is specified in the cch parameter. /// /// Specifies the number of characters in the replacement text. /// /// Pointer to a TS_TEXTCHANGE structure with the following data. /// /// /// Value /// Meaning /// /// /// acpStart /// The starting application character position before the text is inserted into the document. /// /// /// acpOldEnd /// /// The ending position before the text is inserted into the document. This value is the same as acpStart for an insertion /// point. If this value is different from acpStart, then text was selected prior to the text insertion. /// /// /// /// acpNewEnd /// The ending position after the text insertion occurred. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_INVALIDPOS /// The acpStart or acpEnd parameter is outside of the document text. /// /// /// TS_E_NOLOCK /// The caller does not have a read/write lock. /// /// /// TS_E_READONLY /// The document is read-only. Content cannot be modified. /// /// /// TS_E_REGION /// An attempt was made to modify text across a region boundary. /// /// /// /// /// /// Applications should start a composition by first using InsertTextAtSelection. SetText should be used only within an /// existing composition. If there is no active composition at the time SetText is called, the TSF manager creates a /// composition that lasts just long enough to wrap the call to SetText. /// /// The acpStart and acpEnd character positions cannot be outside the document range. /// Applications should not call the OnTextChange method in response to this method. /// /// This method should call the SetSelection method to select the text to be changed. After successfully executing the /// SetSelection method, this method then calls the InsertTextAtSelection method to perform the actual text change. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-settext HRESULT SetText( DWORD // dwFlags, LONG acpStart, LONG acpEnd, const WCHAR *pchText, ULONG cch, TS_TEXTCHANGE *pChange ); [PreserveSig] HRESULT SetText([In] TS_ST dwFlags, [In] int acpStart, [In] int acpEnd, [In, MarshalAs(UnmanagedType.LPWStr)] string pchText, [In] uint cch, out TS_TEXTCHANGE pChange); /// /// Gets formatted text data about a specified text string. The caller must have a read/write lock on the document before /// calling this method. /// /// Specifies the starting character position of the text to get in the document. /// /// Specifies the ending character position of the text to get in the document. This parameter is ignored if the value is 1. /// /// Receives the pointer to the IDataObject object that contains the formatted text. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_NOLOCK /// The caller does not have a read/write lock on the document. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-getformattedtext HRESULT // GetFormattedText( LONG acpStart, LONG acpEnd, IDataObject **ppDataObject ); [PreserveSig] HRESULT GetFormattedText([In] int acpStart, [In] int acpEnd, [Out, MarshalAs(UnmanagedType.Interface)] out IDataObject ppDataObject); /// Gets an embedded document. /// Contains the character position, within the document, from where the object is obtained. /// /// Contains a GUID value that defines the requested format of the obtained object. This can be one of the following values. /// /// /// Value /// Meaning /// /// /// GUID_TS_SERVICE_DATAOBJECT /// The object should be obtained as an IDataObject object. /// /// /// GUID_TS_SERVICE_ACCESSIBLE /// The object should be obtained as an Accessible object. /// /// /// GUID_TS_SERVICE_ACTIVEX /// The object should be obtained as an ActiveX object. /// /// /// /// Specifies the interface type requested. /// Pointer to an IUnknown pointer that receives the requested interface. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_NOTIMPL /// The application does not support embedded objects. /// /// /// TF_E_INVALIDPOS /// acpPos is not within the document. /// /// /// TS_E_NOINTERFACE /// The requested interface type is unsupported. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock. /// /// /// TS_E_NOOBJECT /// There is no embedded object at acpPos. /// /// /// TS_E_NOSERVICE /// The service type specified in rguidService is unsupported. /// /// /// /// /// Use QueryInterface to probe for appropriate interfaces. Prospective interfaces include those associated with embedded /// documents or controls such as IOleObject , IDataObject , IViewObject , IPersistStorage , /// IOleCache , or IDispatch . /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-getembedded HRESULT GetEmbedded( LONG // acpPos, REFGUID rguidService, REFIID riid, IUnknown **ppunk ); [PreserveSig] HRESULT GetEmbedded([In] int acpPos, in Guid rguidService, in Guid riid, [Out, MarshalAs(UnmanagedType.IUnknown)] out object ppunk); /// Gets a value indicating whether the specified object can be inserted into the document. /// Pointer to the object type. Can be NULL. /// /// Pointer to the FORMATETC structure that contains format data of the object. This parameter cannot be NULL if the /// pguidService parameter is NULL. /// /// /// Receives TRUE if the object type can be inserted into the document or FALSE if the object type can't be /// inserted into the document. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The pFormatEtc parameter is NULL. /// /// /// /// The clipboard formats supported by the document are dependent on the application. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-queryinsertembedded HRESULT // QueryInsertEmbedded( const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable ); [PreserveSig] HRESULT QueryInsertEmbedded([In, Optional] GuidPtr pguidService, [In, Optional] IntPtr pFormatEtc, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfInsertable); /// Inserts an embedded object at the specified character. /// Must be TS_IE_CORRECTION. /// Contains the starting character position where the object is inserted. /// Contains the ending character position where the object is inserted. /// Pointer to an IDataObject interface that contains data about the object inserted. /// Pointer to a TS_TEXTCHANGE structure that receives data about the modified text. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_NOTIMPL /// The application does not support embedded objects. /// /// /// TS_E_FORMAT /// The application does not support the data type contained in pDataObject. /// /// /// TS_E_INVALIDPOS /// acpStart and/or acpEnd are not within the document. /// /// /// TS_E_NOLOCK /// The caller does not have a read/write lock. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-insertembedded HRESULT InsertEmbedded( // DWORD dwFlags, LONG acpStart, LONG acpEnd, IDataObject *pDataObject, TS_TEXTCHANGE *pChange ); [PreserveSig] HRESULT InsertEmbedded([In] TS_IE dwFlags, [In] int acpStart, [In] int acpEnd, [In] IDataObject pDataObject, out TS_TEXTCHANGE pChange); /// /// Inserts text at the insertion point or selection. A caller must have a read/write lock on the document before inserting text. /// /// /// /// /// /// /// /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// /// /// The values of the pacpStart and the pacpEnd parameters depend upon how the client application inserts text into a document. /// For example, if the application sets the cursor at the start of the inserted text after text insertion, then the value for /// the pacpStart and pacpEnd parameters is the same as the acpStart member of the TS_TEXTCHANGE structure. /// /// Applications should not call the OnTextChange method in response to this method. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-inserttextatselection HRESULT // InsertTextAtSelection( DWORD dwFlags, const WCHAR *pchText, ULONG cch, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange ); [PreserveSig] HRESULT InsertTextAtSelection([In] TF_IAS dwFlags, [In, MarshalAs(UnmanagedType.LPWStr)] string pchText, [In] uint cch, out int pacpStart, out int pacpEnd, out TS_TEXTCHANGE pChange); /// /// Inserts an IDataObject at the insertion point or selection. The client that calls this method must have a read/write lock /// before inserting an IDataObject object into the document. /// /// /// /// Specifies whether the pacpStart and pacpEnd parameters and the TS_TEXTCHANGE structure will contain the results of the /// object insertion. /// /// The TF_IAS_NOQUERY and TF_IAS_QUERYONLY flags cannot be combined. /// /// /// Value /// Meaning /// /// /// 0 /// /// Text insertion will occur, and the pacpStart and pacpEnd parameters will contain the results of the text insertion. The /// TS_TEXTCHANGE structure must be filled with this flag. /// /// /// /// TF_IAS_NOQUERY /// /// Text is inserted, the values of the pacpStart and pacpEnd parameters can be NULL, and the TS_TEXTCHANGE structure must be /// filled. Use this flag if the results of the text insertion are not required. /// /// /// /// TF_IAS_QUERYONLY /// /// Text is not inserted, and the values for the pacpStart and pacpEnd parameter contain the results of the text insertion. The /// values of these parameters depend on how the application implements text insertion into a document. For more information, /// see the Remarks section. Use this flag to view the results of the text insertion without actually inserting the text, for /// example, to predict the results of collapsing or otherwise adjusting a selection. It is not required that you fill the /// TS_TEXTCHANGE structure with this flag. /// /// /// /// /// Pointer to the IDataObject object to be inserted. /// Pointer to the starting application character position where the object insertion will occur. /// /// Pointer to the ending application character position where the object insertion will occur. This parameter value will be the /// same as the value of the pacpStart parameter for an insertion point. /// /// /// Pointer to a TS_TEXTCHANGE structure with the following members. /// /// /// Value /// Meaning /// /// /// acpStart /// The starting application character position before the object is inserted into the document. /// /// /// acpOldEnd /// /// The ending application character position before the object is inserted into the document. This value is the same as /// acpStart for an insertion point. If this value is different from acpStart, then text was selected prior to the object insertion. /// /// /// /// acpNewEnd /// The ending application character position after the object insertion took place. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The pchText parameter is invalid. /// /// /// TS_E_NOLOCK /// The caller does not have a lock on the document. /// /// /// /// /// The values of the pacpStart and pacpEnd parameters depend upon how the client application inserts an object into a document. /// For example, if the application sets the cursor at the start of the object after object insertion, then the value of the /// pacpStart and pacpEnd parameters is the same as the acpStart member of the TS_TEXTCHANGE structure. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-insertembeddedatselection HRESULT // InsertEmbeddedAtSelection( DWORD dwFlags, IDataObject *pDataObject, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange ); [PreserveSig] HRESULT InsertEmbeddedAtSelection([In] TF_IAS dwFlags, [In] IDataObject pDataObject, out int pacpStart, out int pacpEnd, out TS_TEXTCHANGE pChange); /// Get the attributes that are supported in the document. /// /// Specifies whether a subsequent call to the RetrieveRequestedAttrs method will contain the supported attributes. If the /// TS_ATTR_FIND_WANT_VALUE flag is specified, the default attribute values will be those in the TS_ATTRVAL structure /// after the subsequent call to RetrieveRequestedAttrs. If any other flag is specified for this parameter, the method /// only verifies that the attribute is supported and that the varValue member of the TS_ATTRVAL structure is set /// to VT_EMPTY. /// /// Specifies the number of supported attributes to obtain. /// /// Pointer to the TS_ATTRID data type that specifies the attribute to verify. The method returns only the attributes specified /// by TS_ATTRID, even though other attributes can be supported. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_OUTOFMEMORY /// The method was unable to allocate sufficient memory to complete the operation. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-requestsupportedattrs HRESULT // RequestSupportedAttrs( DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs ); [PreserveSig] HRESULT RequestSupportedAttrs([In] TS_ATTR_FIND dwFlags, [In] uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs); /// Gets text attributes at the specified character position. /// Specifies the application character position in the document. /// Specifies the number of attributes to obtain. /// Pointer to the TS_ATTRID data type that specifies the attribute to verify. /// /// /// Specifies attributes for the call to the RetrieveRequestedAttrs method. If this parameter is not set, the method returns the /// attributes that start at the specified position. Other possible values for this parameter are the following. /// /// /// /// Value /// Meaning /// /// /// TS_ATTR_FIND_WANT_END /// Obtains the attributes that end at the specified application character position. /// /// /// TS_ATTR_FIND_WANT_VALUE /// /// Obtains the value of the attribute in addition to the attribute. The attribute value is put into the varValue member of the /// TS_ATTRVAL structure during the RetrieveRequestedAttrs method call. /// /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// In the sentence, "This is italic text.", the italic attribute starts before the word italic and ends after the word text. /// /// /// If the flag TS_ATTR_FIND_WANT_END is set in dwFlags, the method would return the italic attribute for the text /// "italic <anchor>normal", because there is an end transition at the anchor location. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-requestattrsatposition HRESULT // RequestAttrsAtPosition( LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags ); [PreserveSig] HRESULT RequestAttrsAtPosition([In] int acpPos, [In] uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs, uint dwFlags = 0); /// Gets text attributes transitioning at the specified character position. /// Specifies the application character position in the document. /// Specifies the number of attributes to obtain. /// Pointer to the TS_ATTRID data type that specifies the attribute to verify. /// /// /// Specifies attributes for the call to the RetrieveRequestedAttrs method. If this parameter is not set, the method returns the /// attributes that start at the specified position. Other possible values for this parameter are the following. /// /// /// /// Value /// Meaning /// /// /// TS_ATTR_FIND_WANT_END /// Obtains the attributes that end at the specified application character position. /// /// /// TS_ATTR_FIND_WANT_VALUE /// /// Obtains the value of the attribute in addition to the attribute. The attribute value is put into the varValue member of the /// TS_ATTRVAL structure during the RetrieveRequestedAttrs method call. /// /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// In the sentence, "This is italic text.", the italic attribute starts before the word italic and ends after the word text. /// /// /// If the flag TS_ATTR_FIND_WANT_END is set in dwFlags, the method would return the italic attribute for the text "italic /// <anchor>normal", because there is an end transition at the anchor location. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-requestattrstransitioningatposition // HRESULT RequestAttrsTransitioningAtPosition( LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags ); [PreserveSig] HRESULT RequestAttrsTransitioningAtPosition([In] int acpPos, [In] uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs, [In] TS_ATTR_FIND dwFlags); /// /// Determines the character position where a transition occurs in an attribute value. The specified attribute to check is application-dependent. /// /// Specifies the character position to start the search for an attribute transition. /// Specifies the character position to end the search for an attribute transition. /// Specifies the number of attributes to check. /// Pointer to the TS_ATTRID data type that specifies the attribute to check. /// /// Specifies the direction to search for an attribute transition. By default, the method searches forward. /// /// /// Value /// Meaning /// /// /// TS_ATTR_FIND_BACKWARDS /// The method searches backward. /// /// /// TS_ATTR_FIND_WANT_OFFSET /// The plFoundOffset parameter receives the character offset of the attribute transition from acpStart. /// /// /// /// Receives the next character position to check for an attribute transition. /// /// Receives a Boolean value of TRUE if an attribute transition was found, otherwise FALSE is returned. /// /// /// Receives the character position of the attribute transition (not ACP positions). If TS_ATTR_FIND_WANT_OFFSET flag is set in /// dwFlags, receives the character offset of the attribute transition from acpStart. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_INVALIDPOS /// The character positions specified are beyond the text in the document. /// /// /// /// /// Note If an application does not implement FindNextAttrTransition, ITfReadOnlyProperty::EnumRanges fails with E_FAIL. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-findnextattrtransition HRESULT // FindNextAttrTransition( LONG acpStart, LONG acpHalt, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags, LONG // *pacpNext, BOOL *pfFound, LONG *plFoundOffset ); [PreserveSig] HRESULT FindNextAttrTransition([In] int acpStart, [In] int acpHalt, [In] uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs, [In] TS_ATTR_FIND dwFlags, out int pacpNext, [MarshalAs(UnmanagedType.Bool)] out bool pfFound, out int plFoundOffset); /// Gets the attributes returned by a call to an attribute request method. /// Specifies the number of supported attributes to obtain. /// /// Pointer to the TS_ATTRVAL structure that receives the supported attributes. The members of this structure depend upon the /// dwFlags parameter of the calling method. /// /// Receives the number of supported attributes. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-retrieverequestedattrs HRESULT // RetrieveRequestedAttrs( ULONG ulCount, TS_ATTRVAL *paAttrVals, ULONG *pcFetched ); [PreserveSig] HRESULT RetrieveRequestedAttrs([In] uint ulCount, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] TS_ATTRVAL[] paAttrVals, [NullAllowed] out uint pcFetched); /// Gets the number of characters in a document. /// Receives the character position of the last character in the document plus one. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_NOTIMPL /// /// The application has not implemented this method. This is usually an indication that calculating the end position requires /// excessive resources. If the end position is necessary, you can use GetText to calculate it, though this can also be a /// memory-intensive operation, paging in arbitrarily large amounts of memory from disk. /// /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-getendacp HRESULT GetEndACP( LONG // *pacp ); [PreserveSig] HRESULT GetEndACP(out int pacp); /// Gets a TsViewCookie that represents the current active view. /// Receives the TsViewCookie data type that specifies the current active view. /// This method has no return values. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-getactiveview HRESULT GetActiveView( // TsViewCookie *pvcView ); [PreserveSig] HRESULT GetActiveView(out TsViewCookie pvcView); /// Converts a point in screen coordinates to an application character position. /// Specifies the context view. /// Pointer to the POINT structure with the screen coordinates of the point. /// /// /// Specifies the character position to return based upon the screen coordinates of the point relative to a character bounding /// box. By default, the character position returned is the character bounding box containing the screen coordinates of the /// point. If the point is outside a character bounding box, the method returns NULL or TF_E_INVALIDPOINT. Other bit /// flags for this parameter are as follows. /// /// The bit flags can be combined. /// /// /// Value /// Meaning /// /// /// GXFPF_ROUND_NEAREST /// /// If the screen coordinates of the point are contained in a character bounding box, the character position returned is the /// bounding edge closest to the screen coordinates of the point. /// /// /// /// GXFPF_NEAREST /// /// If the screen coordinates of the point are not contained in a character bounding box, the closest character position is returned. /// /// /// /// /// Receives the character position that corresponds to the screen coordinates of the point. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_INVALIDPOINT /// The ptScreen parameter is not within the bounding box of any character. /// /// /// TS_E_NOLAYOUT /// The application has not calculated a text layout. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-getacpfrompoint HRESULT // GetACPFromPoint( TsViewCookie vcView, const POINT *ptScreen, DWORD dwFlags, LONG *pacp ); [PreserveSig] HRESULT GetACPFromPoint([In] TsViewCookie vcView, in POINT ptScreen, [In] GXFPF dwFlags, out int pacp); /// /// Gets the bounding box, in screen coordinates, of the text at a specified character position. The caller must have a /// read-only lock on the document before calling this method. /// /// Specifies the context view. /// Specifies the starting character position of the text to get in the document. /// Specifies the ending character position of the text to get in the document. /// Receives the bounding box in screen coordinates of the text at the specified character positions. /// /// Receives a Boolean value that specifies if the text in the bounding box has been clipped. If this parameter is TRUE, /// the bounding box contains clipped text and does not include the entire requested text range. The bounding box is clipped /// because the requested range is not visible. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_INVALIDARG /// The specified start and end character positions are equal. /// /// /// TS_E_INVALIDPOS /// The range specified by the acpStart and acpEnd parameters extends past the beginning or end of the document. /// /// /// TS_E_NOLAYOUT /// The application has not calculated a text layout. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock on the document. /// /// /// /// /// If the document window is minimized, or if the specified text is not currently visible, the method returns S_OK with /// the prc parameter set to {0,0,0,0}. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-gettextext HRESULT GetTextExt( // TsViewCookie vcView, LONG acpStart, LONG acpEnd, RECT *prc, BOOL *pfClipped ); [PreserveSig] HRESULT GetTextExt([In] TsViewCookie vcView, [In] int acpStart, [In] int acpEnd, out RECT prc, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfClipped); /// Gets the bounding box screen coordinates of the display surface where the text stream is rendered. /// Specifies the context view. /// Receives the bounding box screen coordinates of the display surface of the document. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The specified vcView parameter is invalid. /// /// /// /// /// If the text is not currently displayed, for example, if the document window is minimized, the prc parameter is set to { 0, /// 0, 0, 0 }. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacp2-getscreenext HRESULT GetScreenExt( // TsViewCookie vcView, RECT *prc ); [PreserveSig] HRESULT GetScreenExt([In] TsViewCookie vcView, out RECT prc); } /// /// The ITextStoreACPSink interface is implemented by the TSF manager and is used by an ACP-based application to notify the /// manager when certain events occur. The manager installs this advise sink by calling ITextStoreACP::AdviseSink. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nn-textstor-itextstoreacpsink [PInvokeData("textstor.h", MSDNShortId = "NN:textstor.ITextStoreACPSink")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("22D44C94-A419-4542-A272-AE26093ECECF")] public interface ITextStoreACPSink { /// Called when the text of a document changes. /// /// /// Contains a set of flags that specify additional information about the text change. This can be one or more of the following values. /// /// /// /// Value /// Meaning /// /// /// 0 /// The text has changed. /// /// /// TS_ST_CORRECTION /// /// The text is a transform (correction) of existing content, and any special text markup information (metadata) is retained, /// such as .wav file data or a language identifier. This flag is used for applications that need to preserve data associated /// with the original text. /// /// /// /// /// Pointer to a TS_TEXTCHANGE structure that contains text change data. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// pChange is invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// TS_E_NOLOCK /// /// The TSF manager holds a lock on the document. This typically indicates that the method was called from within another /// ITextStoreACP method, such as ITextStoreACP::SetText. /// /// /// /// /// /// /// ITextStoreACPSink::OnTextChange is never called when the text is modified by one of the ITextStoreACP /// interface methods, such as ITextStoreACP::SetText or ITextStoreACP::InsertTextAtSelection. /// /// When calling this method, the application must be able to grant a document lock. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-ontextchange HRESULT OnTextChange( // DWORD dwFlags, const TS_TEXTCHANGE *pChange ); [PreserveSig] HRESULT OnTextChange([In] TS_ST dwFlags, in TS_TEXTCHANGE pChange); /// Called when the selection within the document changes. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_NOLOCK /// The manager holds a lock on the document. /// /// /// /// /// /// ITextStoreACPSink::OnSelectionChange is never called when the selection is modified by one of the ITextStoreACP /// interface methods, such as ITextStoreACP::SetSelection or ITextStoreACP::InsertTextAtSelection. /// /// When calling this method, the application must be able to grant a document lock. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onselectionchange HRESULT OnSelectionChange(); [PreserveSig] HRESULT OnSelectionChange(); /// Called when the layout (on-screen representation) of the document changes. /// Contains a TsLayoutCode value that defines the type of change. /// Contains an application-defined cookie that identifies the document. For more information, see ITextStoreACP::GetActiveView. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// A layout change can be in response to a change to the text, font size, window movement, window resizing, or other change /// that affects the displayed text. /// /// /// If a call to ITextStoreACP::GetTextExt or ITextStoreACP::GetACPFromPoint returns TS_E_NOLAYOUT because the application has /// not calculated the layout, the application must call ITextStoreACPSink::OnLayoutChange when the layout is available. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onlayoutchange HRESULT // OnLayoutChange( TsLayoutCode lcode, TsViewCookie vcView ); [PreserveSig] HRESULT OnLayoutChange([In] TsLayoutCode lcode, [In] TsViewCookie vcView); /// Called when the status of the document changes. /// /// Contains a value that specifies the new status. For more information about possible values, see the dwDynamicFlags /// member of the TS_STATUS structure. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onstatuschange HRESULT // OnStatusChange( DWORD dwFlags ); [PreserveSig] HRESULT OnStatusChange(TS_SD dwFlags); /// Called when the value of one or more text attribute changes. /// Specifies the starting point of the attribute change. /// Specifies the ending point of the attribute change. /// Specifies the number of attributes in the paAttrs array. /// Pointer to an array of TS_ATTRID values that identify the attributes changed. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onattrschange HRESULT // OnAttrsChange( LONG acpStart, LONG acpEnd, ULONG cAttrs, const TS_ATTRID *paAttrs ); [PreserveSig] HRESULT OnAttrsChange(int acpStart, int acpEnd, uint cAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] TS_ATTRID[] paAttrs); /// Called to grant a document lock. /// /// /// Contains a set of flags that identify the type of lock requested and other lock request data. This can be one of the /// following values. /// /// /// /// Value /// Meaning /// /// /// TS_LF_READ /// The lock is read-only. /// /// /// TS_LF_READWRITE /// The lock is read/write. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// dwLockFlags is invalid. /// /// /// E_UNEXPECTED /// The wrong type of lock was granted. /// /// /// /// /// /// A document lock is requested by calling ITextStoreACP::RequestLock . The application grants the lock request by /// calling ITextStoreACPSink::OnLockGranted with the requested lock type. The lock is only valid during the /// OnLockGranted call. When OnLockGranted returns, the document is considered unlocked. /// /// The lock type, specified in dwLockFlags, must match the requested lock type in the corresponding call to ITextStoreACP::RequestLock. /// /// If a synchronous lock request is made from within ITextStoreACP::RequestLock, then the caller must also provide the /// return value from ITextStoreACP::RequestLock. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onlockgranted HRESULT // OnLockGranted( DWORD dwLockFlags ); [PreserveSig] HRESULT OnLockGranted(TS_LF dwLockFlags); /// Called when an edit transaction is started. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// This method causes the ITfEditTransactionSink::OnStartEditTransaction method to be called on all installed edit transaction sinks. /// /// /// An edit transaction is a group of text changes that should be processed at one time. Calling this method allows a text /// service to queue the upcoming changes until ITextStoreACPSink::OnEndEditTransaction is called. When /// ITextStoreACPSink::OnEndEditTransaction is called, the text service will process all queued changes. Use of edit /// transactions is optional. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onstartedittransaction HRESULT OnStartEditTransaction(); [PreserveSig] HRESULT OnStartEditTransaction(); /// Called when an edit transaction is terminated. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// This method causes the ITfEditTransactionSink::OnEndEditTransaction method to be called on all installed edit transaction sinks. /// /// /// An edit transaction is a group of text changes that should be processed at one time. Calling /// ITextStoreACPSink::OnStartEditTransaction allows a text service to queue the upcoming changes until /// ITextStoreACPSink::OnEndEditTransaction is called. When ITextStoreACPSink::OnEndEditTransaction is called, the /// text service will process all of the queued changes. Use of edit transactions is optional. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onendedittransaction HRESULT OnEndEditTransaction(); [PreserveSig] HRESULT OnEndEditTransaction(); } /// Undocumented. [PInvokeData("textstor.h")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("2bdf9464-41e2-43e3-950c-a6865ba25cd4")] public interface ITextStoreACPSinkEx : ITextStoreACPSink { /// Called when the text of a document changes. /// /// /// Contains a set of flags that specify additional information about the text change. This can be one or more of the following values. /// /// /// /// Value /// Meaning /// /// /// 0 /// The text has changed. /// /// /// TS_ST_CORRECTION /// /// The text is a transform (correction) of existing content, and any special text markup information (metadata) is retained, /// such as .wav file data or a language identifier. This flag is used for applications that need to preserve data associated /// with the original text. /// /// /// /// /// Pointer to a TS_TEXTCHANGE structure that contains text change data. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// pChange is invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// TS_E_NOLOCK /// /// The TSF manager holds a lock on the document. This typically indicates that the method was called from within another /// ITextStoreACP method, such as ITextStoreACP::SetText. /// /// /// /// /// /// /// ITextStoreACPSink::OnTextChange is never called when the text is modified by one of the ITextStoreACP /// interface methods, such as ITextStoreACP::SetText or ITextStoreACP::InsertTextAtSelection. /// /// When calling this method, the application must be able to grant a document lock. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-ontextchange HRESULT OnTextChange( // DWORD dwFlags, const TS_TEXTCHANGE *pChange ); [PreserveSig] new HRESULT OnTextChange([In] TS_ST dwFlags, in TS_TEXTCHANGE pChange); /// Called when the selection within the document changes. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_NOLOCK /// The manager holds a lock on the document. /// /// /// /// /// /// ITextStoreACPSink::OnSelectionChange is never called when the selection is modified by one of the ITextStoreACP /// interface methods, such as ITextStoreACP::SetSelection or ITextStoreACP::InsertTextAtSelection. /// /// When calling this method, the application must be able to grant a document lock. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onselectionchange HRESULT OnSelectionChange(); [PreserveSig] new HRESULT OnSelectionChange(); /// Called when the layout (on-screen representation) of the document changes. /// Contains a TsLayoutCode value that defines the type of change. /// Contains an application-defined cookie that identifies the document. For more information, see ITextStoreACP::GetActiveView. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// A layout change can be in response to a change to the text, font size, window movement, window resizing, or other change /// that affects the displayed text. /// /// /// If a call to ITextStoreACP::GetTextExt or ITextStoreACP::GetACPFromPoint returns TS_E_NOLAYOUT because the application has /// not calculated the layout, the application must call ITextStoreACPSink::OnLayoutChange when the layout is available. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onlayoutchange HRESULT // OnLayoutChange( TsLayoutCode lcode, TsViewCookie vcView ); [PreserveSig] new HRESULT OnLayoutChange([In] TsLayoutCode lcode, [In] TsViewCookie vcView); /// Called when the status of the document changes. /// /// Contains a value that specifies the new status. For more information about possible values, see the dwDynamicFlags /// member of the TS_STATUS structure. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onstatuschange HRESULT // OnStatusChange( DWORD dwFlags ); [PreserveSig] new HRESULT OnStatusChange(TS_SD dwFlags); /// Called when the value of one or more text attribute changes. /// Specifies the starting point of the attribute change. /// Specifies the ending point of the attribute change. /// Specifies the number of attributes in the paAttrs array. /// Pointer to an array of TS_ATTRID values that identify the attributes changed. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onattrschange HRESULT // OnAttrsChange( LONG acpStart, LONG acpEnd, ULONG cAttrs, const TS_ATTRID *paAttrs ); [PreserveSig] new HRESULT OnAttrsChange(int acpStart, int acpEnd, uint cAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] TS_ATTRID[] paAttrs); /// Called to grant a document lock. /// /// /// Contains a set of flags that identify the type of lock requested and other lock request data. This can be one of the /// following values. /// /// /// /// Value /// Meaning /// /// /// TS_LF_READ /// The lock is read-only. /// /// /// TS_LF_READWRITE /// The lock is read/write. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// dwLockFlags is invalid. /// /// /// E_UNEXPECTED /// The wrong type of lock was granted. /// /// /// /// /// /// A document lock is requested by calling ITextStoreACP::RequestLock . The application grants the lock request by /// calling ITextStoreACPSink::OnLockGranted with the requested lock type. The lock is only valid during the /// OnLockGranted call. When OnLockGranted returns, the document is considered unlocked. /// /// The lock type, specified in dwLockFlags, must match the requested lock type in the corresponding call to ITextStoreACP::RequestLock. /// /// If a synchronous lock request is made from within ITextStoreACP::RequestLock, then the caller must also provide the /// return value from ITextStoreACP::RequestLock. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onlockgranted HRESULT // OnLockGranted( DWORD dwLockFlags ); [PreserveSig] new HRESULT OnLockGranted(TS_LF dwLockFlags); /// Called when an edit transaction is started. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// This method causes the ITfEditTransactionSink::OnStartEditTransaction method to be called on all installed edit transaction sinks. /// /// /// An edit transaction is a group of text changes that should be processed at one time. Calling this method allows a text /// service to queue the upcoming changes until ITextStoreACPSink::OnEndEditTransaction is called. When /// ITextStoreACPSink::OnEndEditTransaction is called, the text service will process all queued changes. Use of edit /// transactions is optional. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onstartedittransaction HRESULT OnStartEditTransaction(); [PreserveSig] new HRESULT OnStartEditTransaction(); /// Called when an edit transaction is terminated. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// This method causes the ITfEditTransactionSink::OnEndEditTransaction method to be called on all installed edit transaction sinks. /// /// /// An edit transaction is a group of text changes that should be processed at one time. Calling /// ITextStoreACPSink::OnStartEditTransaction allows a text service to queue the upcoming changes until /// ITextStoreACPSink::OnEndEditTransaction is called. When ITextStoreACPSink::OnEndEditTransaction is called, the /// text service will process all of the queued changes. Use of edit transactions is optional. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreacpsink-onendedittransaction HRESULT OnEndEditTransaction(); [PreserveSig] new HRESULT OnEndEditTransaction(); /// Called when disconnect. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// [PreserveSig] HRESULT OnDisconnect(); } /// /// /// The ITextStoreAnchor interface is implemented by a Microsoft Active Accessibility client and is used by the TSF manager to /// manipulate text streams. Ranges of text within a stream are delimited by anchor objects. these anchor objects are exposed and /// manipulated by the IAnchor interface. /// /// An application can obtain an instance of this interface with Microsoft Active Accessibility. The interface ID is IID_ITextStoreAnchor. /// To use the application character position (ACP) model for text manipulation, use ITextStoreACP instead. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nn-textstor-itextstoreanchor [PInvokeData("textstor.h", MSDNShortId = "NN:textstor.ITextStoreAnchor")] [ComImport, Guid("9B2077B0-5F18-4DEC-BEE9-3CC722F5DFE0"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ITextStoreAnchor { /// /// The ITextStoreAnchor::AdviseSink method installs a new advise sink from the ITextStoreAnchorSink interface or /// modifies an existing advise sink. /// /// Specifies the sink interface. The only supported value is IID_ITextStoreAnchorSink. /// Pointer to the sink interface to advise. Cannot be NULL. /// /// Specifies the events that notify the advise sink. For more information about possible parameter values, see TS_AS_* Constants. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The specified sink interface riid could not be obtained. /// /// /// E_INVALIDARG /// The specified sink interface is unsupported. /// /// /// E_UNEXPECTED /// The specified sink object could not be obtained. /// /// /// /// /// /// Subsequent calls with the same interface, represented by the punk parameter, are handled as requests to update the dwMask /// parameter. Servers should not call the AddRef method on the sink in response to such a request. /// /// /// Servers only maintain a single connection point. Attempts to advise a second sink object fail until the original sink object /// is removed. Applications should use the ITextStoreAnchor::UnadviseSink method to unregister the sink object when /// notifications are not required. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-advisesink HRESULT AdviseSink( // REFIID riid, IUnknown *punk, DWORD dwMask ); [PreserveSig] HRESULT AdviseSink(in Guid riid, [In, MarshalAs(UnmanagedType.IUnknown)] object punk, [In] TS_AS dwMask); /// Called by an application to indicate that it no longer requires notifications from the TSF manager. /// Pointer to a sink object. Cannot be NULL. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// CONNECT_E_NOCONNECTION /// There is no active sink object. /// /// /// /// /// /// Every call to the ITextStoreAnchor::AdviseSink method, which registers a new sink object, should be matched by a call to /// this method. If AdviseSink has only updated the dwMask parameter of a sink which was previously registered, a call to /// UnadviseSink is not required. /// /// /// For example, to register a sink object, an application calls the AdviseSink method the first time. The application /// can then call the AdviseSink method again with the same sink object to change the dwMask parameter. To unregister the /// sink object, an application calls the UnadviseSink method. /// /// The punk parameter must have the same COM identity as the pointer originally passed in the AdviseSink method. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-unadvisesink HRESULT UnadviseSink( // IUnknown *punk ); [PreserveSig] HRESULT UnadviseSink([In, MarshalAs(UnmanagedType.IUnknown)] object punk); /// Used by the TSF manager to provide a document lock in order to modify the text stream. /// /// Specifies the type of lock requested. /// /// /// Value /// Meaning /// /// /// TS_LF_READ /// The document has a read-only lock and cannot be modified. /// /// /// TS_LF_READWRITE /// The document has a read/write lock and can be modified. /// /// /// TS_LF_SYNC /// The document has a synchronous-lock if this flag is combined with other flags. /// /// /// /// /// /// If the lock request is synchronous, receives an HRESULT value from the ITextStoreAnchorSink::OnLockGranted method that /// specifies the result of the lock request. /// /// /// If the lock request is asynchronous and the result is TS_S_ASYNC, the document receives an asynchronous lock. If the lock /// request is asynchronous and the result is TS_E_SYNCHRONOUS, the document cannot be locked synchronously. /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// /// /// /// This method uses the ITextStoreAnchorSink::OnLockGranted method to lock the document. Applications must never modify /// the document or send change notifications using the ITextStoreAnchorSink::OnTextChange method from within the /// ITextStoreAnchor::RequestLock method. If the application has pending changes to report, the application can only /// respond to the asynchronous lock request. /// /// /// Applications should not attempt to queue multiple ITextStoreAnchor::RequestLock method calls, because the application /// requires only a single callback. If the caller makes several read requests and one or more write requests, however, the /// callback should be for write access. /// /// /// Successful requests for synchronous locks supersede requests for asynchronous locks. Unsuccessful requests for synchronous /// locks do not supersede requests for asynchronous locks. The implementation must still serve the outstanding asynchronous /// request, if one exists. /// /// /// If the lock is granted before the ITextStoreAnchor::RequestLock method returns, the phrSession parameter will receive /// the HRESULT returned by the ITextStoreAnchorSink::OnLockGranted method. If the call is successful, but the lock will /// be granted later, the phrSession parameter receives the TS_S_ASYNC flag. The phrSession parameter should be ignored if /// ITextStoreAnchor::RequestLock returns anything other than S_OK. /// /// /// A caller should never call this method reentrantly, except in the case that the caller holds a read-only lock. In this case /// the method can be called reentrantly to ask for an asynchronous write lock. The write lock will be granted later, after the /// read-only lock ends. /// /// For more information about document locks, see Document Locks. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-requestlock HRESULT RequestLock( // DWORD dwLockFlags, HRESULT *phrSession ); [PreserveSig] HRESULT RequestLock([In] TS_LF dwLockFlags, out HRESULT phrSession); /// /// The ITextStoreAnchor::GetStatus method obtains the document status. The document status is returned through the /// TS_STATUS structure. /// /// Receives the TS_STATUS structure that contains the document status. Cannot be NULL. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The pointer to the TS_STATUS parameter is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getstatus HRESULT GetStatus( // TS_STATUS *pdcs ); [PreserveSig] HRESULT GetStatus(out TS_STATUS pdcs); /// /// The ITextStoreAnchor::QueryInsert method determines whether the specified start and end anchors are valid. Use this /// method to adjust an edit to a document before you execute the edit. The method must not return values outside the range of /// the document. /// /// Receives a pointer to a start anchor for the inserted text. /// /// Receives a pointer to an end anchor for the inserted text. This is the same as paTestStart if the text is inserted at a /// point instead of replacing selected text. /// /// Length of replacement text. /// /// Pointer to the new anchor object at the starting location for the inserted text. If the value of this parameter is /// NULL, then text cannot be inserted at the specified position. This anchor cannot be outside the document. /// /// /// Pointer to the new anchor object at the ending location for the inserted text. If the value of this parameter is /// NULL, then text cannot be inserted at the specified position. This anchor cannot be outside the document. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_INVALIDARG /// The paTestStart or paTestEnd parameters are invalid. /// /// /// E_OUTOFMEMORY /// The attempt to instantiate the ppaResultStart and/or ppaResultEnd anchors failed. /// /// /// /// /// The values of ppaResultStart and ppaResultEnd depend upon how the application inserts text into the document. If /// ppaResultStart and ppaResultEnd are the same as paTestStart, the cursor is at the beginning of the inserted text after /// insertion. If ppaResultStart and ppaResultEnd are the same as paTextEnd, the cursor is at the end of the inserted text after insertion. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-queryinsert HRESULT QueryInsert( // IAnchor *paTestStart, IAnchor *paTestEnd, ULONG cch, IAnchor **ppaResultStart, IAnchor **ppaResultEnd ); [PreserveSig] HRESULT QueryInsert([In] IAnchor paTestStart, [In] IAnchor paTestEnd, uint cch, out IAnchor ppaResultStart, out IAnchor ppaResultEnd); /// /// The ITextStoreAnchor::GetSelection method returns the offset of a text selection in a text stream. This method /// supports multiple text selections. The caller must have a read-only lock on the document before calling this method. /// /// /// Specifies the text selections that start the process. If the TF_DEFAULT_SELECTION constant is specified for this parameter, /// the input selection starts the process, and only a single selection (the one appropriate for input operations) will be returned. /// /// Specifies the maximum number of selections to return. /// /// Receives the style, start, and end character positions of the selected text. These values are put into the /// TS_SELECTION_ANCHOR structure. /// /// Receives the number of pSelection structures returned. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method was unable to load the start or end anchor into the TS_SELECTION_ANCHOR structure. /// /// /// E_OUTOFMEMORY /// The method was unable to allocate memory for the selection. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock on the document. /// /// /// TS_E_NOSELECTION /// The document has no selection. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getselection HRESULT GetSelection( // ULONG ulIndex, ULONG ulCount, TS_SELECTION_ANCHOR *pSelection, ULONG *pcFetched ); [PreserveSig] HRESULT GetSelection(uint ulIndex, uint ulCount, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_SELECTION_ANCHOR[] pSelection, [NullAllowed] out uint pcFetched); /// Selects text within the document. /// Specifies the number of text selections in pSelection. /// /// /// Specifies the style, start, and end character positions of the text selected through the TS_SELECTION_ANCHOR structure. The /// start anchor member paStart of the structure must never follow the end anchor member paEnd, although they /// might be at the same location. /// /// /// When paStart = paEnd, the method places a caret at the anchor location. There can be only one caret at a time /// in the text stream. /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_OUTOFMEMORY /// The method was unable to allocate sufficient memory to complete the operation. /// /// /// TF_E_INVALIDPOS /// The anchor locations specified are beyond the text in the document. /// /// /// TF_E_NOLOCK /// The caller does not have a read/write lock. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-setselection HRESULT SetSelection( // ULONG ulCount, const TS_SELECTION_ANCHOR *pSelection ); [PreserveSig] HRESULT SetSelection(uint ulCount, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] TS_SELECTION_ANCHOR[] pSelection); /// /// The ITextStoreAnchor::GetText method returns information about text at a specified anchor position. This method /// returns the visible and hidden text and indicates if embedded data is attached to the text. /// /// Not used; should be zero. /// Specifies the starting anchor position. /// /// Specifies the ending anchor position. If NULL, it is treated as if it were an anchor positioned at the very end of /// the text stream. /// /// Specifies the buffer to receive the text. May be NULL only when cchReq = 0. /// Specifies the pchText buffer size in characters. /// Receives the number of characters copied into the pchText buffer. /// If TRUE, paStart will be repositioned just past the last character copied to pchText. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method completed successfully. /// /// /// E_FAIL /// The method was unable to obtain a valid interface pointer to paStart and/or paEnd. /// /// /// TF_E_INVALIDPOS /// The paStart or paEnd anchors are outside of the document text. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock on the document. /// /// /// /// /// /// Callers that use this method must have a read-only lock on the document by calling the ITextStoreAnchor::RequestLock method. /// Without a read-only lock, the method fails and returns TF_E_NOLOCK. /// /// Applications can truncate the method return values for internal reasons. /// To quickly scan text with multiple GetText calls, a caller would use fUpdateAnchor = TRUE. /// /// The actual number of characters copied could be less than cchReq if the number of characters between paStart and paEnd is /// less than cchReq. /// /// The behavior of GetText is not affected by any region boundaries covered by the returned text. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-gettext HRESULT GetText( DWORD // dwFlags, IAnchor *paStart, IAnchor *paEnd, WCHAR *pchText, ULONG cchReq, ULONG *pcch, BOOL fUpdateAnchor ); [PreserveSig] HRESULT GetText(uint dwFlags, [In] IAnchor paStart, [In] IAnchor paEnd, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pchText, uint cchReq, out uint pcch, [In, MarshalAs(UnmanagedType.Bool)] bool fUpdateAnchor); /// The ITextStoreAnchor::SetText method sets the text selection between two supplied anchor locations. /// /// If set to the value of TS_ST_CORRECTION, the text is a transform (correction) of existing content, and any special text /// markup information (metadata) is retained, such as .wav file data or a language identifier. The client defines the type of /// markup information to be retained. /// /// Pointer to the anchor at the start of the range of text to replace. /// /// Pointer to the anchor at the end of the range of text to replace. Must always follow or be at the same position as paStart. /// /// /// Pointer to the replacement text. The text string does not have to be NULL terminated, because the text character /// count is specified in the cch parameter. /// /// Specifies the number of characters in the replacement text. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method could not instantiate one of the anchors paStart or paEnd. /// /// /// TS_E_INVALIDPOS /// The location of paStart or paEnd is outside of the document text. /// /// /// TS_E_NOLOCK /// The caller does not have a read/write lock. /// /// /// TS_E_READONLY /// The document is read-only. Content cannot be modified. /// /// /// TS_E_REGION /// An attempt was made to modify text across a region boundary. /// /// /// /// /// /// Applications should start a composition by first using ITextStoreAnchor::InsertTextAtSelection. /// ITextStoreAnchor::SetText should be used only within an existing composition. If there is no active composition at /// the time SetText is called, the TSF manager creates a composition that lasts just long enough to wrap the call to SetText. /// /// /// Callers must hold a write lock obtained through ITextStoreAnchor::RequestLock. Otherwise, ITextStoreAnchor::SetText /// will fail with TS_E_NOLOCK. /// /// If paStart is at the same location as paEnd, then the operation is an insertion, and no existing text will be removed. /// TS_CHAR_EMBEDDED cannot be passed into this method. For embedded objects, use ITextStoreAnchor::InsertEmbedded instead. /// /// This method will fail if the range of text replaced covers any region boundary. Instead, callers should make multiple calls /// to the method, one for each region. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-settext HRESULT SetText( DWORD // dwFlags, IAnchor *paStart, IAnchor *paEnd, const WCHAR *pchText, ULONG cch ); [PreserveSig] HRESULT SetText([In] TS_ST dwFlags, [In] IAnchor paStart, [In] IAnchor paEnd, [In, MarshalAs(UnmanagedType.LPWStr)] string pchText, uint cch); /// The ITextStoreAnchor::GetFormattedText method returns formatted text information from a text stream. /// Anchor position at which to start retrieval of formatted text. /// Anchor position at which to end retrieval of formatted text. /// Pointer to the IDataObject object that contains the formatted text. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method was unable to obtain a valid interface pointer to the start and/or end anchors. /// /// /// E_NOTIMPL /// An application can return this value if the method is not implemented. /// /// /// TS_E_NOLOCK /// The caller does not have a read/write lock on the document. /// /// /// /// /// Text, embedded objects, and any formatting are wrapped into a single IDataObject object. In this way private /// appliation-specific formatting associated with text can be preserved by a client. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getformattedtext HRESULT // GetFormattedText( IAnchor *paStart, IAnchor *paEnd, IDataObject **ppDataObject ); [PreserveSig] HRESULT GetFormattedText([In] IAnchor paStart, [In] IAnchor paEnd, out IDataObject ppDataObject); /// The ITextStoreAnchor::GetEmbedded method obtains an embedded object from a text stream. /// /// Bit fields that specify how the method deals with hidden text. If set to TS_GEA_HIDDEN, an embedded object can be located /// within hidden text. Otherwise hidden text is skipped over. /// /// /// Pointer to an anchor positioned immediately in front of the embedded object, as denoted by a TS_CHAR_EMBEDDED character. /// /// /// Contains a GUID value that defines the requested format of the obtained object. This can be one of the following values. /// /// /// Value /// Meaning /// /// /// GUID_TS_SERVICE_DATAOBJECT /// The object should be obtained as an IDataObject data object. /// /// /// GUID_TS_SERVICE_ACCESSIBLE /// The object should be obtained as an Accessible object. /// /// /// GUID_TS_SERVICE_ACTIVEX /// The object should be obtained as an ActiveX object. /// /// /// /// Specifies the interface type requested. /// Pointer to an IUnknown pointer that receives the requested interface. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method failed to obtain the requested object. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// E_NOTIMPL /// The implementing application does not expose embedded objects in its text stream. /// /// /// TF_E_INVALIDPOS /// The requested paPos anchor is not within the document. /// /// /// TS_E_NOINTERFACE /// The requested interface type is unsupported. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock. /// /// /// TS_E_NOOBJECT /// There is no paPos anchor immediately in front of a TS_CHAR_EMBEDDED character. /// /// /// TS_E_NOSERVICE /// The service type specified in rguidService is unsupported. /// /// /// /// /// The caller must use QueryInterface to probe for appropriate interfaces. Prospective interfaces include those /// associated with embedded documents or controls such as IOleObject, IDataObject, IViewObject, /// IPersistStorage, IOleCache, or IDispatch. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getembedded HRESULT GetEmbedded( // DWORD dwFlags, IAnchor *paPos, REFGUID rguidService, REFIID riid, IUnknown **ppunk ); [PreserveSig] HRESULT GetEmbedded(TS_GEA dwFlags, [In] IAnchor paPos, in Guid rguidService, in Guid riid, [MarshalAs(UnmanagedType.IUnknown)] out object ppunk); /// Inserts an IDataObject data object into a text stream. /// Must be TS_IE_CORRECTION. /// Pointer to the anchor at the start of the object to be inserted. /// Pointer to the anchor at the end of the object to be inserted. /// Pointer to an IDataObject data object. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method was unable to obtain a valid interface pointer to the start and/or end anchors. /// /// /// E_INVALIDARG /// One or more input parameters are invalid. /// /// /// E_NOTIMPL /// The application does not support embedded objects. /// /// /// TS_E_FORMAT /// The application does not support the data type contained in pDataObject. /// /// /// TS_E_INVALIDPOS /// paStart and/or paEnd are not within the document. /// /// /// TS_E_NOLOCK /// The caller does not have a read/write lock. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-insertembedded HRESULT // InsertEmbedded( DWORD dwFlags, IAnchor *paStart, IAnchor *paEnd, IDataObject *pDataObject ); [PreserveSig] HRESULT InsertEmbedded([In] TS_IE dwFlags, [In] IAnchor paStart, [In] IAnchor paEnd, [In] IDataObject pDataObject); /// Obtains the supported attributes of a text stream. /// /// Specifies whether a subsequent call to the ITextStoreAnchor::RetrieveRequestedAttrs method will contain the supported /// attributes. If the TS_ATTR_FIND_WANT_VALUE flag is specified, the default attribute values will be those in the TS_ATTRVAL /// structure after the subsequent call to ITextStoreAnchor::RetrieveRequestedAttrs. If any other flag is specified for /// this parameter, the method only verifies that the attribute is supported and that the varValue member of the /// TS_ATTRVAL structure is set to VT_EMPTY. /// /// Specifies the number of supported attributes to obtain. /// /// Pointer to the TS_ATTRID data type that specifies the attribute to verify. The method returns only the attributes specified /// by TS_ATTRID, even though other attributes might be supported. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// An unspecified error occurred. /// /// /// E_OUTOFMEMORY /// The method was unable to allocate sufficient memory to complete the operation. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-requestsupportedattrs HRESULT // RequestSupportedAttrs( DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs ); [PreserveSig] HRESULT RequestSupportedAttrs(TS_ATTR_FIND dwFlags, uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs); /// Obtains a list of attributes that begin or end at the specified anchor location. /// Pointer to the anchor. /// Specifies the number of attributes to obtain. /// Pointer to the TS_ATTRID data type that specifies the attribute to verify. /// Must be zero. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The paPos anchor is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-requestattrsatposition HRESULT // RequestAttrsAtPosition( IAnchor *paPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags ); [PreserveSig] HRESULT RequestAttrsAtPosition([In] IAnchor paPos, uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs, uint dwFlags = 0); /// Obtains a list of attributes that begin or end at the specified anchor location. /// Pointer to the anchor. /// Specifies the number of attributes to obtain. /// Pointer to the TS_ATTRID data type that specifies the attribute to verify. /// /// /// Specifies attributes for the call to the ITextStoreAnchor::RetrieveRequestedAttrs method. If this parameter is not set, the /// method returns the attributes that start at the specified anchor location. Other possible values for this parameter are the following. /// /// /// /// Value /// Meaning /// /// /// TS_ATTR_FIND_WANT_END /// Obtains the attributes that end at the specified anchor location. /// /// /// TS_ATTR_FIND_WANT_VALUE /// /// Obtains the value of the attribute in addition to the attribute. The attribute value is put into the varValue member of the /// TS_ATTRVAL structure during the ITextStoreAnchor::RetrieveRequestedAttrs method call. /// /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// paPos is invalid. /// /// /// /// /// /// In the sentence, "This is italic text.", the italic attribute starts before the word italic and ends after the word text. /// /// /// If the flag TS_ATTR_FIND_WANT_END is set in dwFlags, the method would return the italic attribute for the text "italic /// <anchor>normal", because there is an end transition at the anchor location. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-requestattrstransitioningatposition // HRESULT RequestAttrsTransitioningAtPosition( IAnchor *paPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD // dwFlags ); [PreserveSig] HRESULT RequestAttrsTransitioningAtPosition([In] IAnchor paPos, uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs, [In] TS_ATTR_FIND dwFlags); /// /// The ITextStoreAnchor::FindNextAttrTransition method finds the location in the text stream where a transition occurs /// in an attribute value. The specified attribute to check is application-dependent. /// /// Pointer to the anchor position at the start of a range to search for an attribute transition. /// Pointer to the anchor position at the end of a range to search for an attribute transition. /// Specifies the number of attributes to check. /// /// Pointer to the TS_ATTRID data type that specifies the attribute to check. Pre-defined attributes are given in tsattrs.h. /// /// /// Specifies the direction to search for an attribute transition. By default, the method searches forward. /// /// /// Value /// Meaning /// /// /// TS_ATTR_FIND_BACKWARDS /// The method searches backward in the text stream. /// /// /// TS_ATTR_FIND_UPDATESTART /// /// The method positions the input anchor paStart at the next attribute transition, if one is found. Otherwise the input anchor /// is not modified. /// /// /// /// TS_ATTR_FIND_WANT_OFFSET /// The plFoundOffset parameter receives the character offset of the attribute transition from paStart. /// /// /// /// /// Receives a Boolean value of TRUE if an attribute transition was found, otherwise FALSE is returned. /// /// Receives the character offset of the attribute transition from the start anchor paStart. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// paStart and/or paHalt are invalid. /// /// /// TS_E_INVALIDPOS /// The character positions specified are beyond the text in the document. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-findnextattrtransition HRESULT // FindNextAttrTransition( IAnchor *paStart, IAnchor *paHalt, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags, // BOOL *pfFound, LONG *plFoundOffset ); [PreserveSig] HRESULT FindNextAttrTransition([In] IAnchor paStart, [In] IAnchor paHalt, uint cFilterAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] TS_ATTRID[] paFilterAttrs, TS_ATTR_FIND dwFlags, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfFound, out int plFoundOffset); /// /// Returns the attributes obtained by the RequestAttrsAtPosition, RequestAttrsTransitioningAtPosition, or RequestSupportedAttrs methods. /// /// Specifies the number of supported attributes to obtain. /// /// Pointer to the TS_ATTRVAL structure that receives the supported attributes. The members of this structure depend upon the /// dwFlags parameter of the calling method. /// /// Receives the number of supported attributes. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-retrieverequestedattrs HRESULT // RetrieveRequestedAttrs( ULONG ulCount, TS_ATTRVAL *paAttrVals, ULONG *pcFetched ); [PreserveSig] HRESULT RetrieveRequestedAttrs(uint ulCount, [Out] TS_ATTRVAL[] paAttrVals, [NullAllowed] out uint pcFetched); /// The ITextStoreAnchor::GetStart method returns an anchor positioned at the start of the text stream. /// Pointer to an anchor object located at the start of the text stream. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// ppaStart is invalid. /// /// /// E_OUTOFMEMORY /// The attempt to instantiate an anchor at the start of the text stream failed. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getstart HRESULT GetStart( IAnchor // **ppaStart ); [PreserveSig] HRESULT GetStart(out IAnchor ppaStart); /// The ITextStoreAnchor::GetEnd method returns an anchor positioned at the end of the text stream. /// Pointer to an anchor object located at the very end of the text stream. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// ppaEnd is invalid. /// /// /// E_NOTIMPL /// /// The application has not implemented this method. This is usually an indication that calculating the end position requires /// excessive resources. If the end position is necessary, you can use ITextStoreAnchor::GetText to calculate it, though this /// might also be a memory-intensive operation, paging in arbitrarily large amounts of memory from disk. /// /// /// /// E_OUTOFMEMORY /// The attempt to instantiate an anchor at the end of the document failed. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getend HRESULT GetEnd( IAnchor // **ppaEnd ); [PreserveSig] HRESULT GetEnd(out IAnchor ppaEnd); /// /// The ITextStoreAnchor::GetActiveView method returns a TsViewCookie data type that specifies the current active view. /// TSF supports only a single active view, so a given text store should always return the same TsViewCookie data type. /// /// Receives the TsViewCookie data type that specifies the current active view. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// pvcView is invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getactiveview HRESULT GetActiveView( // TsViewCookie *pvcView ); [PreserveSig] HRESULT GetActiveView(out TsViewCookie pvcView); /// /// The ITextStoreAnchor::GetAnchorFromPoint method converts a point in screen coordinates to an anchor positioned at a /// corresponding location. /// /// Specifies the context view. /// Pointer to the POINT structure with the screen coordinates of the point. /// /// /// Specifies the anchor position to return based upon the screen coordinates of the point relative to a character bounding box. /// By default, the anchor position returned is the character bounding box containing the screen coordinates of the point. If /// the point is outside a character bounding box, the method returns NULL or TF_E_INVALIDPOINT. Other bit flags for this /// parameter are as follows. /// /// The bit flags can be combined. /// /// /// Value /// Meaning /// /// /// GXFPF_ROUND_NEAREST /// /// If the screen coordinates of the point are contained in a character bounding box, an anchor is returned at the bounding edge /// closest to the screen coordinates of the point. /// /// /// /// GXFPF_NEAREST /// /// If the screen coordinates of the point are not contained in a character bounding box, an anchor at the closest character /// position is returned. /// /// /// /// /// Pointer to an anchor object at a location corresponding to the screen coordinates ptScreen. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method failed. /// /// /// E_INVALIDARG /// One or more input parameters is invalid. /// /// /// E_OUTOFMEMORY /// The attempt to instantiate an anchor at the specified location failed. /// /// /// TS_E_INVALIDPOINT /// The ptScreen parameter is not within the bounding box of any character. /// /// /// TS_E_NOLAYOUT /// The application has not calculated a text layout yet. /// /// /// /// /// /// The point 1 screen coordinates cause the offset (character position) of anchor ppaSite to be 0 by default or if the dwFlags /// parameter is set to GXFPF_NEAREST because the point 1 screen coordinates are inside the character bounding box of character /// position 0. If the dwFlags parameter is set to GXFPF_ROUND_NEAREST for point 1, the anchor offset is 1 because the point 1 /// screen coordinates are closest to range position 1. Range position 1 is the starting range position of character position 1. /// /// /// For the point 2 screen coordinates, the method returns TF_E_INVALIDPOINT by default or if the dwFlags parameter is /// set to GXFPF_NEAREST because the point 2 screen coordinates are outside a character bounding box. If the dwFlags /// parameter is set to GXFPF_ROUND_NEAREST, then the point 2 screen coordinates causes the anchor offset to be 1, /// because the closest character position to the point 2 screen coordinates is character position 1. /// /// Point 1 /// /// /// /// Default-- anchor offset = 0 --The screen coordinates point is inside the character bounding box of Character Position 0. /// /// /// /// /// GXFPF_ROUND_NEAREST -- anchor offset = 1 --The screen coordinates of the point is closest to Range Position 1 which /// is the starting range position of Character Position 1. /// /// /// /// /// GXFPF_NEAREST -- anchor offset = 0 --The default behavior occurs because the point is within the character bounding /// box of Character Position 0. /// /// /// /// Point 2 /// /// /// Default-- hr = TF_E_INVALIDPOINT --The screen coordinates of the point are outside a character bounding box. /// /// /// /// GXPF_ROUND_NEAREST-- hr = TF_E_INVALIDPOINT --The default behavior occurs because the screen coordinates of the point is /// outside a character bounding box. /// /// /// /// /// GXPF_NEAREST-- anchor offset = 1 --The closest character position to the screen coordinates of the point is Character /// Position 1. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getanchorfrompoint HRESULT // GetAnchorFromPoint( TsViewCookie vcView, const POINT *ptScreen, DWORD dwFlags, IAnchor **ppaSite ); [PreserveSig] HRESULT GetAnchorFromPoint([In] TsViewCookie vcView, in POINT ptScreen, GXFPF dwFlags, out IAnchor ppaSite); /// /// The ITextStoreAnchor::GetTextExt method returns the bounding box, in screen coordinates, of a range of text. The /// caller must have a read-only lock on the document before calling this method. /// /// Specifies the context view. /// Specifies the anchor positioned at the start of the range. /// Specifies the anchor positioned at the end of the range. /// Receives the bounding box of the text range in screen coordinates. /// /// Receives a Boolean value that specifies if the text in the bounding box has been clipped. If TRUE, the bounding box /// contains clipped text and does not include the entire requested text range. The bounding box is clipped because the /// requested range is not visible. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method was unable to obtain a valid interface pointer to the start and/or end anchors. /// /// /// TS_E_INVALIDARG /// One or more of the input parameters is invalid. /// /// /// TS_E_INVALIDPOS /// The range specified by the paStart and paEnd parameters extends past the beginning or end of the document. /// /// /// TS_E_NOLAYOUT /// The application has not calculated a text layout. Any further calls will not succeed until the application calls ITextStoreAnchorSink::OnLayoutChange. /// /// /// TS_E_NOLOCK /// The caller does not have a read-only lock on the document. /// /// /// /// /// If the document window is minimized, or if the specified text is not currently visible, the method returns S_OK with the prc /// parameter set to {0,0,0,0}. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-gettextext HRESULT GetTextExt( // TsViewCookie vcView, IAnchor *paStart, IAnchor *paEnd, RECT *prc, BOOL *pfClipped ); [PreserveSig] HRESULT GetTextExt([In] TsViewCookie vcView, [In] IAnchor paStart, [In] IAnchor paEnd, out RECT prc, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfClipped); /// /// The ITextStoreAnchor::GetScreenExt method returns the bounding box screen coordinates of the display surface where /// the text stream is rendered. /// /// Specifies the context view. /// Receives the bounding box screen coordinates of the display surface of the document. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The specified vcView parameter is invalid. /// /// /// /// /// If the text is not currently displayed, for example, if the document window is minimized, the prc parameter is set to { 0, /// 0, 0, 0 }. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getscreenext HRESULT GetScreenExt( // TsViewCookie vcView, RECT *prc ); [PreserveSig] HRESULT GetScreenExt([In] TsViewCookie vcView, out RECT prc); /// /// The ITextStoreAnchor::GetWnd method returns the handle to a window that corresponds to the current text stream. /// /// Specifies the TsViewCookie data type that corresponds to the current document. /// /// Receives a pointer to the handle of the window that corresponds to the current document. This parameter can be NULL /// if the document does not have the corresponding handle to the window. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The TsViewCookie data type is invalid. /// /// /// /// /// A document might not have a corresponding window handle if the document is in memory but not displayed on the screen, or if /// the document is a windowless control and the control does not recognize the window handle of the owner of the windowless /// controls. Callers cannot assume that the phwnd parameter will receive a non- NULL value even if the method is /// successful. Callers can also receive a NULL value for the phwnd parameter. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-getwnd HRESULT GetWnd( TsViewCookie // vcView, HWND *phwnd ); [PreserveSig] HRESULT GetWnd([In] TsViewCookie vcView, out HWND phwnd); /// /// Determines whether the document can accept an embedded object through the InsertEmbedded or InsertEmbeddedAtSelection methods. /// /// Pointer to the object type. If NULL, pFormatEtc should be used. /// /// Pointer to the FORMATETC structure that contains format data of the object. This parameter cannot be NULL if the /// pguidService parameter is NULL. /// /// /// Receives TRUE if the object type can be inserted into the document or FALSE if the object type cannot be /// inserted into the document. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// The pFormatEtc parameter is NULL. /// /// /// /// The clipboard formats supported by the document are dependent on the application. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-queryinsertembedded HRESULT // QueryInsertEmbedded( const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable ); [PreserveSig] HRESULT QueryInsertEmbedded([In, Optional] GuidPtr pguidService, [In, Optional] IntPtr pFormatEtc, [Out, MarshalAs(UnmanagedType.Bool)] out bool pfInsertable); /// Inserts text at the insertion point or selection. /// /// Specifies whether the paStart and paEnd parameters will contain the results of the text insertion. /// The TF_IAS_NOQUERY and TF_IAS_QUERYONLY flags cannot be combined. /// /// /// Value /// Meaning /// /// /// TF_IAS_NOQUERY /// /// Text is inserted, and the values of the ppaStart and ppaEnd parameters can be NULL. Use this flag if the results of the text /// insertion are not required. /// /// /// /// TF_IAS_QUERYONLY /// /// Text is not inserted, and the ppaStart and ppaEnd anchors contain the results of the text insertion. The values of these /// parameters depend on how the application implements text insertion into a document. Use this flag to view the results of the /// text insertion without actually inserting the text. Zero-length text can be inserted. /// /// /// /// /// Pointer to the string to insert in the document. The string can be NULL terminated. /// Specifies the text length. /// Pointer to the anchor object at the start of the text insertion. /// /// Pointer to the anchor object at the end of the text insertion. For an insertion point, this parameter value will be the same /// as the value of the ppaStart parameter. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method could not instantiate one of the anchors paStart or paEnd. /// /// /// E_INVALIDARG /// The pchText parameter is invalid. /// /// /// TS_E_NOLOCK /// The caller does not have a lock on the document. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-inserttextatselection HRESULT // InsertTextAtSelection( DWORD dwFlags, const WCHAR *pchText, ULONG cch, IAnchor **ppaStart, IAnchor **ppaEnd ); [PreserveSig] HRESULT InsertTextAtSelection([In] TF_IAS dwFlags, [In, MarshalAs(UnmanagedType.LPWStr)] string pchText, uint cch, out IAnchor ppaStart, out IAnchor ppaEnd); /// /// The ITextStoreAnchor::InsertEmbeddedAtSelection method inserts an IDataObject object at the insertion point or /// selection. The client that calls this method must have a read/write lock before inserting an IDataObject into the /// text stream. /// /// /// Specifies whether the paStart and paEnd parameters will contain the results of the object insertion. /// The TF_IAS_NOQUERY and TF_IAS_QUERYONLY flags cannot be combined. /// /// /// Value /// Meaning /// /// /// TF_IAS_NOQUERY /// /// Text is inserted, and the values of the ppaStart and ppaEnd parameters can be NULL. Use this flag if the results of the text /// insertion are not required. /// /// /// /// TF_IAS_QUERYONLY /// /// Text is not inserted, and the ppaStart and ppaEnd anchors contain the results of the text insertion. The values of these /// parameters depend on how the application implements text insertion into a document. Use this flag to view the results of the /// text insertion without actually inserting the text, for example, to predict the results of collapsing or otherwise adjusting /// a selection. /// /// /// /// /// Pointer to the IDataObject object to be inserted. /// Pointer to the anchor object at the start of the object insertion. /// /// Pointer to the anchor object at the end of the object insertion. For an insertion point, this parameter value will be the /// same as the value of the ppaStart parameter. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method could not instantiate one of the anchors paStart or paEnd. /// /// /// E_INVALIDARG /// The pchText parameter is invalid. /// /// /// E_OUTOFMEMORY /// The method could not instantiate one of the anchors paStart or paEnd. /// /// /// TS_E_NOLOCK /// The caller does not have a lock on the document. /// /// /// /// /// Clients must use this method to insert an object into a text stream, since a TS_CHAR_EMBEDDED constant cannot be passed into ITextStoreAnchor::SetText. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchor-insertembeddedatselection HRESULT // InsertEmbeddedAtSelection( DWORD dwFlags, IDataObject *pDataObject, IAnchor **ppaStart, IAnchor **ppaEnd ); [PreserveSig] HRESULT InsertEmbeddedAtSelection([In] TF_IAS dwFlags, [In] IDataObject pDataObject, out IAnchor ppaStart, out IAnchor ppaEnd); } /// Undocumented. [PInvokeData("textstor.h")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("A2DE3BC1-3D8E-11d3-81A9-F753FBE61A00")] public interface ITextStoreAnchorEx { /// Scrolls to rect. /// The p start. /// The p end. /// The rc. /// The dw position. /// [PreserveSig] HRESULT ScrollToRect([In] IAnchor pStart, [In] IAnchor pEnd, in RECT rc, uint dwPosition); } /// /// /// The ITextStoreAnchorSink interface is implemented by the TSF manager and is used by an anchor-based application to notify /// the manager when certain events occur. The manager installs this advise sink by calling ITextStoreAnchor::AdviseSink. /// /// The interface ID is IID_ITextStoreAnchorSink. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nn-textstor-itextstoreanchorsink [PInvokeData("textstor.h", MSDNShortId = "NN:textstor.ITextStoreAnchorSink")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("AA80E905-2021-11D2-93E0-0060B067B86E")] public interface ITextStoreAnchorSink { /// Called when text in the text stream changes. /// /// /// Contains a set of flags that specify additional information about the text change. This can be one or more of the following values. /// /// /// /// Value /// Meaning /// /// /// 0 /// The text has changed. /// /// /// TS_TC_CORRECTION /// /// The text is a transform (correction) of existing content, and any special text markup information (metadata) is retained, /// such as .wav file data or a language identifier. This flag is used for applications that need to preserve data associated /// with the original text. /// /// /// /// /// Pointer to an anchor located at the start of the changed text. /// Pointer to an anchor located at the end of the changed text. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method was unable to create cloned anchors to contain the change. /// /// /// E_INVALIDARG /// paStart or paEnd is invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// TS_E_NOLOCK /// /// The TSF manager holds a lock on the document. This typically indicates that the method was called from within another /// ITextStoreAnchor method, such as ITextStoreAnchor::SetText. /// /// /// /// /// /// /// This method is called only when the application modifies its own text, not when a client modifies text with one of the /// ITextStoreAnchor methods, such as ITextStoreAnchor::SetText or ITextStoreAnchor::InsertTextAtSelection. /// /// When calling this method, the application must be able to grant a document lock. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-ontextchange HRESULT // OnTextChange( DWORD dwFlags, IAnchor *paStart, IAnchor *paEnd ); [PreserveSig] HRESULT OnTextChange([In] TS_TC dwFlags, [In] IAnchor paStart, [In] IAnchor paEnd); /// /// The ITextStoreAnchorSink::OnSelectionChange method is called when the selection within the text stream changes. This /// method should be called whenever the return value of a potential call to ITextStoreAnchor::GetSelection has changed. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_NOLOCK /// The manager holds a lock on the document. /// /// /// /// /// /// This method only needs to be called when the application modifies the selection itself, not when a client modifies the /// selection with ITextStoreAnchor::SetSelection, ITextStoreAnchor::InsertTextAtSelection, or other ITextStoreAnchor methods. /// /// When calling this method, the application must be able to grant a document lock. /// /// Applications should expect reentrant client calls to ITextStoreAnchor::RequestLock from within this method. An application /// can grant the lock request synchronously, or, because several changes have been cached, it can grant the lock asynchronously. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onselectionchange HRESULT OnSelectionChange(); [PreserveSig] HRESULT OnSelectionChange(); /// /// The ITextStoreAnchorSink::OnLayoutChange method is called when the layout (on-screen representation) of the document changes. /// /// Contains a TsLayoutCode value that defines the type of change. /// Contains an application-defined cookie that identifies the document. For more information, see ITextStoreAnchor::GetActiveView. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// A layout change can be in response to a change to the text, font size, window movement, window resizing, or other change /// that affects the displayed text. /// /// /// If a call to ITextStoreAnchor::GetTextExt or ITextStoreAnchor::GetAnchorFromPoint returns TS_E_NOLAYOUT because the /// application has not calculated the layout, the application must call ITextStoreAnchorSink::OnLayoutChange when the /// layout is available. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onlayoutchange HRESULT // OnLayoutChange( TsLayoutCode lcode, TsViewCookie vcView ); [PreserveSig] HRESULT OnLayoutChange([In] TsLayoutCode lcode, [In] TsViewCookie vcView); /// Called when the text stream status changes. /// /// Contains a value that specifies the new status. For more information about possible values, see the dwDynamicFlags /// member of the TS_STATUS structure. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// Applications should call this method whenever ITextStoreAnchor::GetStatus returns a new value for any of the /// dwDynamicFlags member of TS_STATUS . /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onstatuschange HRESULT // OnStatusChange( DWORD dwFlags ); [PreserveSig] HRESULT OnStatusChange(TS_SD dwFlags); /// /// The ITextStoreAnchorSink::OnAttrsChange method is called when the value of one or more text attributes changes. /// /// Pointer to the start anchor of the range of text that has the attribute change. /// Pointer to the end anchor of the range of text that has the attribute change. /// Specifies the number of attributes in the paAttrs array. /// Pointer to an array of TS_ATTRID values that identify the attributes changed. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onattrschange HRESULT // OnAttrsChange( IAnchor *paStart, IAnchor *paEnd, ULONG cAttrs, const TS_ATTRID *paAttrs ); [PreserveSig] HRESULT OnAttrsChange([In] IAnchor paStart, [In] IAnchor paEnd, uint cAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] TS_ATTRID[] paAttrs); /// Called to grant a document lock. /// /// /// Contains a set of flags that identify the type of lock requested and other lock request data. This can be one of the /// following values. /// /// /// /// Value /// Meaning /// /// /// TS_LF_READ /// The lock is read-only. /// /// /// TS_LF_READWRITE /// The lock is read/write. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// dwLockFlags is invalid. /// /// /// E_UNEXPECTED /// The wrong type of lock was granted. /// /// /// /// /// /// A document lock is requested by calling ITextStoreAnchor::RequestLock. The application grants the lock request by calling /// ITextStoreAnchorSink::OnLockGranted with the requested lock type. The lock is only valid during the /// OnLockGranted call. When OnLockGranted returns, the document is considered unlocked. /// /// The lock type, specified in dwLockFlags, must match the requested lock type in the corresponding call to ITextStoreAnchor::RequestLock. /// Calls to ITextStoreAnchor::RequestLock from within OnLockGranted will return an error value. /// Applications must not call any of the ITextStoreAnchorSink methods from within the context of OnLockGranted. /// /// If a synchronous lock request is made from within ITextStoreAnchor::RequestLock, then the caller must also provide /// the return value from ITextStoreAnchor::RequestLock. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onlockgranted HRESULT // OnLockGranted( DWORD dwLockFlags ); [PreserveSig] HRESULT OnLockGranted(TS_LF dwLockFlags); /// Called when an edit transaction is started. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// This method will be called on all installed edit transaction sinks. /// /// An edit transaction is a group of text changes that should be processed at one time. Calling this method allows a text /// service to queue the upcoming changes until ITextStoreAnchorSink::OnEndEditTransaction is called. When /// ITextStoreAnchorSink::OnEndEditTransaction is called, the text service will process all queued changes. /// /// Use of edit transactions is optional. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onstartedittransaction HRESULT OnStartEditTransaction(); [PreserveSig] HRESULT OnStartEditTransaction(); /// Called when an edit transaction is terminated. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_UNEXPECTED /// The reference count of the edit transaction is incorrect. /// /// /// /// /// /// This method causes the ITfEditTransactionSink::OnEndEditTransaction method to be called on all installed edit transaction sinks. /// /// /// An edit transaction is a group of text changes that should be processed at one time. Calling /// ITextStoreAnchorSink::OnStartEditTransaction allows a text service to queue the upcoming changes until /// ITextStoreAnchorSink::OnEndEditTransaction is called. When ITextStoreAnchorSink::OnEndEditTransaction is /// called, the text service will process all of the queued changes. /// /// Use of edit transactions is optional. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onendedittransaction HRESULT OnEndEditTransaction(); [PreserveSig] HRESULT OnEndEditTransaction(); } /// /// /// The ITextStoreAnchorSink interface is implemented by the TSF manager and is used by an anchor-based application to notify /// the manager when certain events occur. The manager installs this advise sink by calling ITextStoreAnchor::AdviseSink. /// /// The interface ID is IID_ITextStoreAnchorSink. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nn-textstor-itextstoreanchorsink [PInvokeData("textstor.h", MSDNShortId = "NN:textstor.ITextStoreAnchorSink")] [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("25642426-028d-4474-977b-111bb114fe3e")] public interface ITextStoreAnchorSinkEx : ITextStoreAnchorSink { /// Called when text in the text stream changes. /// /// /// Contains a set of flags that specify additional information about the text change. This can be one or more of the following values. /// /// /// /// Value /// Meaning /// /// /// 0 /// The text has changed. /// /// /// TS_TC_CORRECTION /// /// The text is a transform (correction) of existing content, and any special text markup information (metadata) is retained, /// such as .wav file data or a language identifier. This flag is used for applications that need to preserve data associated /// with the original text. /// /// /// /// /// Pointer to an anchor located at the start of the changed text. /// Pointer to an anchor located at the end of the changed text. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_FAIL /// The method was unable to create cloned anchors to contain the change. /// /// /// E_INVALIDARG /// paStart or paEnd is invalid. /// /// /// E_OUTOFMEMORY /// A memory allocation failure occurred. /// /// /// TS_E_NOLOCK /// /// The TSF manager holds a lock on the document. This typically indicates that the method was called from within another /// ITextStoreAnchor method, such as ITextStoreAnchor::SetText. /// /// /// /// /// /// /// This method is called only when the application modifies its own text, not when a client modifies text with one of the /// ITextStoreAnchor methods, such as ITextStoreAnchor::SetText or ITextStoreAnchor::InsertTextAtSelection. /// /// When calling this method, the application must be able to grant a document lock. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-ontextchange HRESULT // OnTextChange( DWORD dwFlags, IAnchor *paStart, IAnchor *paEnd ); [PreserveSig] new HRESULT OnTextChange([In] TS_TC dwFlags, [In] IAnchor paStart, [In] IAnchor paEnd); /// /// The ITextStoreAnchorSink::OnSelectionChange method is called when the selection within the text stream changes. This /// method should be called whenever the return value of a potential call to ITextStoreAnchor::GetSelection has changed. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// TS_E_NOLOCK /// The manager holds a lock on the document. /// /// /// /// /// /// This method only needs to be called when the application modifies the selection itself, not when a client modifies the /// selection with ITextStoreAnchor::SetSelection, ITextStoreAnchor::InsertTextAtSelection, or other ITextStoreAnchor methods. /// /// When calling this method, the application must be able to grant a document lock. /// /// Applications should expect reentrant client calls to ITextStoreAnchor::RequestLock from within this method. An application /// can grant the lock request synchronously, or, because several changes have been cached, it can grant the lock asynchronously. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onselectionchange HRESULT OnSelectionChange(); [PreserveSig] new HRESULT OnSelectionChange(); /// /// The ITextStoreAnchorSink::OnLayoutChange method is called when the layout (on-screen representation) of the document changes. /// /// Contains a TsLayoutCode value that defines the type of change. /// Contains an application-defined cookie that identifies the document. For more information, see ITextStoreAnchor::GetActiveView. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// /// A layout change can be in response to a change to the text, font size, window movement, window resizing, or other change /// that affects the displayed text. /// /// /// If a call to ITextStoreAnchor::GetTextExt or ITextStoreAnchor::GetAnchorFromPoint returns TS_E_NOLAYOUT because the /// application has not calculated the layout, the application must call ITextStoreAnchorSink::OnLayoutChange when the /// layout is available. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onlayoutchange HRESULT // OnLayoutChange( TsLayoutCode lcode, TsViewCookie vcView ); [PreserveSig] new HRESULT OnLayoutChange([In] TsLayoutCode lcode, [In] TsViewCookie vcView); /// Called when the text stream status changes. /// /// Contains a value that specifies the new status. For more information about possible values, see the dwDynamicFlags /// member of the TS_STATUS structure. /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// Applications should call this method whenever ITextStoreAnchor::GetStatus returns a new value for any of the /// dwDynamicFlags member of TS_STATUS . /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onstatuschange HRESULT // OnStatusChange( DWORD dwFlags ); [PreserveSig] new HRESULT OnStatusChange(TS_SD dwFlags); /// /// The ITextStoreAnchorSink::OnAttrsChange method is called when the value of one or more text attributes changes. /// /// Pointer to the start anchor of the range of text that has the attribute change. /// Pointer to the end anchor of the range of text that has the attribute change. /// Specifies the number of attributes in the paAttrs array. /// Pointer to an array of TS_ATTRID values that identify the attributes changed. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// One or more parameters are invalid. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onattrschange HRESULT // OnAttrsChange( IAnchor *paStart, IAnchor *paEnd, ULONG cAttrs, const TS_ATTRID *paAttrs ); [PreserveSig] new HRESULT OnAttrsChange([In] IAnchor paStart, [In] IAnchor paEnd, uint cAttrs, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] TS_ATTRID[] paAttrs); /// Called to grant a document lock. /// /// /// Contains a set of flags that identify the type of lock requested and other lock request data. This can be one of the /// following values. /// /// /// /// Value /// Meaning /// /// /// TS_LF_READ /// The lock is read-only. /// /// /// TS_LF_READWRITE /// The lock is read/write. /// /// /// /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_INVALIDARG /// dwLockFlags is invalid. /// /// /// E_UNEXPECTED /// The wrong type of lock was granted. /// /// /// /// /// /// A document lock is requested by calling ITextStoreAnchor::RequestLock. The application grants the lock request by calling /// ITextStoreAnchorSink::OnLockGranted with the requested lock type. The lock is only valid during the /// OnLockGranted call. When OnLockGranted returns, the document is considered unlocked. /// /// The lock type, specified in dwLockFlags, must match the requested lock type in the corresponding call to ITextStoreAnchor::RequestLock. /// Calls to ITextStoreAnchor::RequestLock from within OnLockGranted will return an error value. /// Applications must not call any of the ITextStoreAnchorSink methods from within the context of OnLockGranted. /// /// If a synchronous lock request is made from within ITextStoreAnchor::RequestLock, then the caller must also provide /// the return value from ITextStoreAnchor::RequestLock. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onlockgranted HRESULT // OnLockGranted( DWORD dwLockFlags ); [PreserveSig] new HRESULT OnLockGranted(TS_LF dwLockFlags); /// Called when an edit transaction is started. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// /// /// This method will be called on all installed edit transaction sinks. /// /// An edit transaction is a group of text changes that should be processed at one time. Calling this method allows a text /// service to queue the upcoming changes until ITextStoreAnchorSink::OnEndEditTransaction is called. When /// ITextStoreAnchorSink::OnEndEditTransaction is called, the text service will process all queued changes. /// /// Use of edit transactions is optional. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onstartedittransaction HRESULT OnStartEditTransaction(); [PreserveSig] new HRESULT OnStartEditTransaction(); /// Called when an edit transaction is terminated. /// /// This method can return one of these values. /// /// /// Value /// Description /// /// /// S_OK /// The method was successful. /// /// /// E_UNEXPECTED /// The reference count of the edit transaction is incorrect. /// /// /// /// /// /// This method causes the ITfEditTransactionSink::OnEndEditTransaction method to be called on all installed edit transaction sinks. /// /// /// An edit transaction is a group of text changes that should be processed at one time. Calling /// ITextStoreAnchorSink::OnStartEditTransaction allows a text service to queue the upcoming changes until /// ITextStoreAnchorSink::OnEndEditTransaction is called. When ITextStoreAnchorSink::OnEndEditTransaction is /// called, the text service will process all of the queued changes. /// /// Use of edit transactions is optional. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/nf-textstor-itextstoreanchorsink-onendedittransaction HRESULT OnEndEditTransaction(); [PreserveSig] new HRESULT OnEndEditTransaction(); /// Called when disconnected. /// [PreserveSig] HRESULT OnDisconnect(); } /// The TS_ATTRVAL structure contains document attribute values. /// /// An application uses attributes to expose its data to TSF, whereas text services use properties to expose their data to TSF. /// TS_ATTRVAL is used in ITextStoreACP and ITextStoreAnchor methods. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ns-textstor-ts_attrval typedef struct TS_ATTRVAL { TS_ATTRID idAttr; // DWORD dwOverlapId; VARIANT varValue; } TS_ATTRVAL; [PInvokeData("textstor.h", MSDNShortId = "NS:textstor.TS_ATTRVAL")] [StructLayout(LayoutKind.Sequential, Pack = 8), Guid("2CC2B33F-1174-4507-B8D9-5BC0EB37C197")] public struct TS_ATTRVAL { /// GUID for the attribute type. public TS_ATTRID idAttr; /// /// A unique identifier of this attribute when overlapped with other attributes. This is a feature in Microsoft Active /// Accessibility. In TSF, this parameter value is zero (0). Any nonzero value is ignored. /// public uint dwOverlapId; /// Value of the attribute. [MarshalAs(UnmanagedType.Struct)] public object varValue; } /// The TS_RUNINFO structure specifies the properties of text run data. /// /// /// A text run is a collection of consecutive visible, hidden, or embedded characters. For example, the text, Hello World in HTML /// might be <b>Hello </b><i>World</i>. This text is represented in the TS_RUNINFO structure as follows. /// /// /// /// Text Run /// uCount /// TsRunType /// /// /// <b> /// 3 /// TS_RT_HIDDEN /// /// /// Hello<space> /// 5 /// TS_RT_PLAIN /// /// /// </b><i> /// 7 /// TS_RT_HIDDEN /// /// /// World /// 5 /// TS_RT_PLAIN /// /// /// </i> /// 4 /// TS_RT_HIDDEN /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ns-textstor-ts_runinfo typedef struct TS_RUNINFO { ULONG uCount; // TsRunType type; } TS_RUNINFO; [PInvokeData("textstor.h", MSDNShortId = "NS:textstor.TS_RUNINFO")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("A6231949-37C5-4B74-A24E-2A26C327201D")] public struct TS_RUNINFO { /// Specifies the number of characters in the text run. public uint uCount; /// /// Specifies the text run type. If this parameter is TS_RT_PLAIN, the text run is visible. If this parameter is TS_RT_HIDDEN, /// the text run is hidden. If this parameter is TS_RT_OPAQUE, the text run is a private data type embedded in the text by /// application or text service that implements the ITextStore interface. /// public TsRunType type; } /// The TS_SELECTION_ACP structure contains ACP-based text selection data. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ns-textstor-ts_selection_acp typedef struct TS_SELECTION_ACP { LONG // acpStart; LONG acpEnd; TS_SELECTIONSTYLE style; } TS_SELECTION_ACP; [PInvokeData("textstor.h", MSDNShortId = "NS:textstor.TS_SELECTION_ACP")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("C4B9C33B-8A0D-4426-BEBE-D444A4701FE9")] public struct TS_SELECTION_ACP { /// Contains the start position of the selection. public int acpStart; /// Contains the end position of the selection. public int acpEnd; /// A TS_SELECTIONSTYLE structure that contains additional selection data. public TS_SELECTIONSTYLE style; } /// The TS_SELECTION_ANCHOR structure contains anchor-based text selection data. // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ns-textstor-ts_selection_anchor typedef struct TS_SELECTION_ANCHOR { // IAnchor *paStart; IAnchor *paEnd; TS_SELECTIONSTYLE style; } TS_SELECTION_ANCHOR; [PInvokeData("textstor.h", MSDNShortId = "NS:textstor.TS_SELECTION_ANCHOR")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("B03413D2-0723-4C4E-9E08-2E9C1FF3772B")] public struct TS_SELECTION_ANCHOR { /// Contains the start anchor of the selection. public IAnchor paStart; /// Contains the end anchor of the selection. public IAnchor paEnd; /// A TS_SELECTIONSTYLE structure that contains additional selection data. public TS_SELECTIONSTYLE style; } /// The TS_SELECTIONSTYLE structure represents the style of a selection. /// /// An interim character selection is the length of one character and is visually represented as a solid rectangle that is usually /// flashing. This is a standard UI element of Korean and some Chinese character compositions. fInterimChar is an indication /// that a specific character is being composed. fInterimChar can only be nonzero for a single selection. In this case, there /// will be no caret because the highlight takes its place. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ns-textstor-ts_selectionstyle typedef struct TS_SELECTIONSTYLE { // TsActiveSelEnd ase; BOOL fInterimChar; } TS_SELECTIONSTYLE; [PInvokeData("textstor.h", MSDNShortId = "NS:textstor.TS_SELECTIONSTYLE")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("7ECC3FFA-8F73-4D91-98ED-76F8AC5B1600")] public struct TS_SELECTIONSTYLE { /// Specifies the active end of the selection. For more information, see TsActiveSelEnd. public TsActiveSelEnd ase; /// /// Indicates if the selection is an interim character. If this value is nonzero, then the seleciton is an interim character and /// ase will be TS_AE_NONE. If this value is zero, the selection is not an interim character. /// [MarshalAs(UnmanagedType.Bool)] public bool fInterimChar; } /// The TS_STATUS structure contains document status data. /// /// The TF_STATUS structure contains document status data. /// TF_STATUS is an alias for TS_STATUS. /// /// dwDynamicFlags contains a set of flags that can be changed by an app at run time. For example, an app can enable a check /// box for the user to reset the status of documentation. This member can contain zero, or one or more of the following values. /// /// /// /// Value /// Meaning /// /// /// TF_SD_LOADING /// The document is loading. /// /// /// TF_SD_READONLY /// The document is read-only. /// /// /// TS_SD_UIINTEGRATIONENABLE /// /// Starting with Windows 8.1: The text control owning the document sets this flag to indicate its support of Input Method Editor /// (IME) UI integration. When specified, the IME should attempt to align the candidate window below the text box instead of /// floating near the cursor. /// /// /// /// TF_SD_TKBAUTOCORRECTENABLE /// /// Starting with Windows 8.1: The document supports autocorrection provided by the touch keyboard. This support can change during /// the lifetime of the control. /// /// /// /// TF_SD_TKBPREDICTIONENABLE /// /// Starting with Windows 8.1: The document supports text suggestions provided by the touch keyboard. This support can change during /// the lifetime of the control. /// /// /// /// /// dwStaticFlags contains a set of flags that cannot be changed at run time. This member can contain zero, or one or more of /// the following values. /// /// /// /// Value /// Meaning /// /// /// TF_SS_DISJOINTSEL /// The document supports multiple selections. /// /// /// TF_SS_REGIONS /// The document can contain multiple regions. /// /// /// TF_SS_TRANSITORY /// The document is expected to have a short usage cycle. /// /// /// TF_SS_TKBAUTOCORRECTENABLE /// Starting with Windows 8: The document supports autocorrection provided by the touch keyboard. /// /// /// TF_SS_TKBPREDICTIONENABLE /// Starting with Windows 8: The document supports text suggestions provided by the touch keyboard. /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ns-textstor-ts_status typedef struct TS_STATUS { DWORD // dwDynamicFlags; DWORD dwStaticFlags; } TS_STATUS; [PInvokeData("textstor.h", MSDNShortId = "NS:textstor.TS_STATUS")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("FEC4F516-C503-45B1-A5FD-7A3D8AB07049")] public struct TS_STATUS { /// /// /// Contains a set of flags that can be changed by an app at run time. For example, an app can enable a check box for the user /// to reset the document status. This member can contain zero, or one or more of the following values. /// /// public TS_SD dwDynamicFlags; /// /// /// Contains a set of flags that cannot be changed at run time. This member can contain zero, or one or more of the following values. /// /// public TS_SS dwStaticFlags; } /// The TS_TEXTCHANGE structure contains text change data. /// /// The possible text changes include insert, delete, and replace. For example, if you replace the first "t" of "text" with "T", /// acpStart =0, acpOldEnd =1, and acpNewEnd =1. If you delete the last "t", acpStart =3, /// acpOldEnd =4, and acpNewEnd =3. If an "a" is inserted between "e" and "x", acpStart =2, acpOldEnd /// =2, and acpNewEnd =3. /// // https://docs.microsoft.com/en-us/windows/win32/api/textstor/ns-textstor-ts_textchange typedef struct TS_TEXTCHANGE { LONG // acpStart; LONG acpOldEnd; LONG acpNewEnd; } TS_TEXTCHANGE; [PInvokeData("textstor.h", MSDNShortId = "NS:textstor.TS_TEXTCHANGE")] [StructLayout(LayoutKind.Sequential, Pack = 4), Guid("F3181BD6-BCF0-41D3-A81C-474B17EC38FB")] public struct TS_TEXTCHANGE { /// Contains the starting character position of the change. public int acpStart; /// Contains the ending character position before the text is changed. public int acpOldEnd; /// Contains the ending character position after the text is changed. public int acpNewEnd; } /// /// The following values identify attributes obtained with the ITfContext::GetAppProperty method. The data format and contents of /// each property type are included. /// [PInvokeData("tsattrs.h")] public static class TSATTRID { /// Not used. public static readonly Guid TSATTRID_App = new(0xa80f77df, 0x4237, 0x40e5, 0x84, 0x9c, 0xb5, 0xfa, 0x51, 0xc1, 0x3a, 0xc7); /// Contains a nonzero value if the text contains a spelling error or zero otherwise. public static readonly Guid TSATTRID_App_IncorrectGrammar = new(0xbd54e398, 0xad03, 0x4b74, 0xb6, 0xb3, 0x5e, 0xdb, 0x19, 0x99, 0x63, 0x88); /// Contains a nonzero value if the text contains a grammar error or zero otherwise. public static readonly Guid TSATTRID_App_IncorrectSpelling = new(0xf42de43c, 0xef12, 0x430d, 0x94, 0x4c, 0x9a, 0x08, 0x97, 0x0a, 0x25, 0xd2); /// Not used. public static readonly Guid TSATTRID_Font = new(0x573ea825, 0x749b, 0x4f8a, 0x9c, 0xfd, 0x21, 0xc3, 0x60, 0x5c, 0xa8, 0x28); /// Contains the face name of the text font. public static readonly Guid TSATTRID_Font_FaceName = new(0xb536aeb6, 0x053b, 0x4eb8, 0xb6, 0x5a, 0x50, 0xda, 0x1e, 0x81, 0xe7, 0x2e); /// Contains the point size of the text font. public static readonly Guid TSATTRID_Font_SizePts = new(0xc8493302, 0xa5e9, 0x456d, 0xaf, 0x04, 0x80, 0x05, 0xe4, 0x13, 0x0f, 0x03); /// Not used. public static readonly Guid TSATTRID_Font_Style = new(0x68b2a77f, 0x6b0e, 0x4f28, 0x81, 0x77, 0x57, 0x1c, 0x2f, 0x3a, 0x42, 0xb1); /// Not used. public static readonly Guid TSATTRID_Font_Style_Animation = new(0xdcf73d22, 0xe029, 0x47b7, 0xbb, 0x36, 0xf2, 0x63, 0xa3, 0xd0, 0x04, 0xcc); /// Contains a nonzero value if the text has the specified animation or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Animation_BlinkingBackground = new(0x86e5b104, 0x0104, 0x4b10, 0xb5, 0x85, 0x00, 0xf2, 0x52, 0x75, 0x22, 0xb5); /// Contains a nonzero value if the text has the specified animation or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Animation_LasVegasLights = new(0xf40423d5, 0xf87, 0x4f8f, 0xba, 0xda, 0xe6, 0xd6, 0xc, 0x25, 0xe1, 0x52); /// Contains a nonzero value if the text has the specified animation or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Animation_MarchingBlackAnts = new(0x7644e067, 0xf186, 0x4902, 0xbf, 0xc6, 0xec, 0x81, 0x5a, 0xa2, 0x0e, 0x9d); /// Contains a nonzero value if the text has the specified animation or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Animation_MarchingRedAnts = new(0x78368dad, 0x50fb, 0x4c6f, 0x84, 0x0b, 0xd4, 0x86, 0xbb, 0x6c, 0xf7, 0x81); /// Contains a nonzero value if the text has the specified animation or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Animation_Shimmer = new(0x2ce31b58, 0x5293, 0x4c36, 0x88, 0x09, 0xbf, 0x8b, 0xb5, 0x1a, 0x27, 0xb3); /// Contains a nonzero value if the text has the specified animation or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Animation_SparkleText = new(0x533aad20, 0x962c, 0x4e9f, 0x8c, 0x09, 0xb4, 0x2e, 0xa4, 0x74, 0x97, 0x11); /// Contains a nonzero value if the text has the specified animation or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Animation_WipeDown = new(0x5872e874, 0x367b, 0x4803, 0xb1, 0x60, 0xc9, 0x0f, 0xf6, 0x25, 0x69, 0xd0); /// Contains a nonzero value if the text has the specified animation or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Animation_WipeRight = new(0xb855cbe3, 0x3d2c, 0x4600, 0xb1, 0xe9, 0xe1, 0xc9, 0xce, 0x02, 0xf8, 0x42); /// Contains the RGB value of the text background. Contains 0xFF000000 if the text color is automatic. public static readonly Guid TSATTRID_Font_Style_BackgroundColor = new(0xb50eaa4e, 0x3091, 0x4468, 0x81, 0xdb, 0xd7, 0x9e, 0xa1, 0x90, 0xc7, 0xc7); /// Contains a nonzero value if the text is blinking or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Blink = new(0xbfb2c036, 0x7acf, 0x4532, 0xb7, 0x20, 0xb4, 0x16, 0xdd, 0x77, 0x65, 0xa8); /// Contains a nonzero value if the text is bold or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Bold = new(0x48813a43, 0x8a20, 0x4940, 0x8e, 0x58, 0x97, 0x82, 0x3f, 0x7b, 0x26, 0x8a); /// Contains a nonzero value if the text is capitalized or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Capitalize = new(0x7d85a3ba, 0xb4fd, 0x43b3, 0xbe, 0xfc, 0x6b, 0x98, 0x5c, 0x84, 0x31, 0x41); /// Contains the RGB value of the text color. Contains 0xFF000000 if the text color is automatic. public static readonly Guid TSATTRID_Font_Style_Color = new(0x857a7a37, 0xb8af, 0x4e9a, 0x81, 0xb4, 0xac, 0xf7, 0x00, 0xc8, 0x41, 0x1b); /// Contains a nonzero value if the text is embossed or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Emboss = new(0xbd8ed742, 0x349e, 0x4e37, 0x82, 0xfb, 0x43, 0x79, 0x79, 0xcb, 0x53, 0xa7); /// Contains a nonzero value if the text is engraved or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Engrave = new(0x9c3371de, 0x8332, 0x4897, 0xbe, 0x5d, 0x89, 0x23, 0x32, 0x23, 0x17, 0x9a); /// Contains the font height. For more information, see the lfHeight member of the LOGFONT structure. public static readonly Guid TSATTRID_Font_Style_Height = new(0x7e937477, 0x12e6, 0x458b, 0x92, 0x6a, 0x1f, 0xa4, 0x4e, 0xe8, 0xf3, 0x91); /// Contains a nonzero value if the text is hidden or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Hidden = new(0xb1e28770, 0x881c, 0x475f, 0x86, 0x3f, 0x88, 0x7a, 0x64, 0x7b, 0x10, 0x90); /// Contains a nonzero value if the text is italic or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Italic = new(0x8740682a, 0xa765, 0x48e1, 0xac, 0xfc, 0xd2, 0x22, 0x22, 0xb2, 0xf8, 0x10); /// Contains the minimum kerning size. For more information, see ITextFont::GetKerning. public static readonly Guid TSATTRID_Font_Style_Kerning = new(0xcc26e1b4, 0x2f9a, 0x47c8, 0x8b, 0xff, 0xbf, 0x1e, 0xb7, 0xcc, 0xe0, 0xdd); /// Contains a nonzero value if the text is lowercase or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Lowercase = new(0x76d8ccb5, 0xca7b, 0x4498, 0x8e, 0xe9, 0xd5, 0xc4, 0xf6, 0xf7, 0x4c, 0x60); /// Contains a nonzero value if the text is outlined or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Outlined = new(0x10e6db31, 0xdb0d, 0x4ac6, 0xa7, 0xf5, 0x9c, 0x9c, 0xff, 0x6f, 0x2a, 0xb4); /// Contains a nonzero value if the text is overlined or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Overline = new(0xe3989f4a, 0x992b, 0x4301, 0x8c, 0xe1, 0xa5, 0xb7, 0xc6, 0xd1, 0xf3, 0xc8); /// Contains a nonzero value if the text is double overlined or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Overline_Double = new(0xdc46063a, 0xe115, 0x46e3, 0xbc, 0xd8, 0xca, 0x67, 0x72, 0xaa, 0x95, 0xb4); /// Contains a nonzero value if the text is single overlined or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Overline_Single = new(0x8440d94c, 0x51ce, 0x47b2, 0x8d, 0x4c, 0x15, 0x75, 0x1e, 0x5f, 0x72, 0x1b); /// Contains the font position. public static readonly Guid TSATTRID_Font_Style_Position = new(0x15cd26ab, 0xf2fb, 0x4062, 0xb5, 0xa6, 0x9a, 0x49, 0xe1, 0xa5, 0xcc, 0x0b); /// Contains a nonzero value if the text is protected or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Protected = new(0x1c557cb2, 0x14cf, 0x4554, 0xa5, 0x74, 0xec, 0xb2, 0xf7, 0xe7, 0xef, 0xd4); /// Contains a nonzero value if the text is shadowed or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Shadow = new(0x5f686d2f, 0xc6cd, 0x4c56, 0x8a, 0x1a, 0x99, 0x4a, 0x4b, 0x97, 0x66, 0xbe); /// Contains a nonzero value if the text is lowercase or zero otherwise. public static readonly Guid TSATTRID_Font_Style_SmallCaps = new(0xfacb6bc6, 0x9100, 0x4cc6, 0xb9, 0x69, 0x11, 0xee, 0xa4, 0x5a, 0x86, 0xb4); /// Contains the font spacing. public static readonly Guid TSATTRID_Font_Style_Spacing = new(0x98c1200d, 0x8f06, 0x409a, 0x8e, 0x49, 0x6a, 0x55, 0x4b, 0xf7, 0xc1, 0x53); /// Not used. public static readonly Guid TSATTRID_Font_Style_Strikethrough = new(0x0c562193, 0x2d08, 0x4668, 0x96, 0x01, 0xce, 0xd4, 0x13, 0x09, 0xd7, 0xaf); /// Contains a nonzero value if the text is double strikethrough or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Strikethrough_Double = new(0x62489b31, 0xa3e7, 0x4f94, 0xac, 0x43, 0xeb, 0xaf, 0x8f, 0xcc, 0x7a, 0x9f); /// Contains a nonzero value if the text is single strikethrough or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Strikethrough_Single = new(0x75d736b6, 0x3c8f, 0x4b97, 0xab, 0x78, 0x18, 0x77, 0xcb, 0x99, 0x0d, 0x31); /// Contains a nonzero value if the text is subscript or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Subscript = new(0x5774fb84, 0x389b, 0x43bc, 0xa7, 0x4b, 0x15, 0x68, 0x34, 0x7c, 0xf0, 0xf4); /// Contains a nonzero value if the text is superscript or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Superscript = new(0x2ea4993c, 0x563c, 0x49aa, 0x93, 0x72, 0x0b, 0xef, 0x09, 0xa9, 0x25, 0x5b); /// Contains a nonzero value if the text is underlined or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Underline = new(0xc3c9c9f3, 0x7902, 0x444b, 0x9a, 0x7b, 0x48, 0xe7, 0x0f, 0x4b, 0x50, 0xf7); /// Contains a nonzero value if the text is double underlined or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Underline_Double = new(0x74d24aa6, 0x1db3, 0x4c69, 0xa1, 0x76, 0x31, 0x12, 0x0e, 0x75, 0x86, 0xd5); /// Contains a nonzero value if the text is single underlined or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Underline_Single = new(0x1b6720e5, 0x0f73, 0x4951, 0xa6, 0xb3, 0x6f, 0x19, 0xe4, 0x3c, 0x94, 0x61); /// Contains a nonzero value if the text is uppercase or zero otherwise. public static readonly Guid TSATTRID_Font_Style_Uppercase = new(0x33a300e8, 0xe340, 0x4937, 0xb6, 0x97, 0x8f, 0x23, 0x40, 0x45, 0xcd, 0x9a); /// /// Contains the font weight. For more information about possible values, see the lfWeight member of the LOGFONT structure. /// public static readonly Guid TSATTRID_Font_Style_Weight = new(0x12f3189c, 0x8bb0, 0x461b, 0xb1, 0xfa, 0xea, 0xf9, 0x07, 0x04, 0x7f, 0xe0); /// Not used. public static readonly Guid TSATTRID_List = new(0x436d673b, 0x26f1, 0x4aee, 0x9e, 0x65, 0x8f, 0x83, 0xa4, 0xed, 0x48, 0x84); /// Contains the index level of the list. 1 is the outermost level, 2 is the next level, and so on. public static readonly Guid TSATTRID_List_LevelIndel = new(0x7f7cc899, 0x311f, 0x487b, 0xad, 0x5d, 0xe2, 0xa4, 0x59, 0xe1, 0x2d, 0x42); /// Not used. public static readonly Guid TSATTRID_List_Type = new(0xae3e665e, 0x4bce, 0x49e3, 0xa0, 0xfe, 0x2d, 0xb4, 0x7d, 0x3a, 0x17, 0xae); /// Contains a nonzero value if the list is an arabic numeral list or zero otherwise. public static readonly Guid TSATTRID_List_Type_Arabic = new(0x1338c5d6, 0x98a3, 0x4fa3, 0x9b, 0xd1, 0x7a, 0x60, 0xee, 0xf8, 0xe9, 0xe0); /// Contains a nonzero value if the list is a bulleted list or zero otherwise. public static readonly Guid TSATTRID_List_Type_Bullet = new(0xbccd77c5, 0x4c4d, 0x4ce2, 0xb1, 0x02, 0x55, 0x9f, 0x3b, 0x2b, 0xfc, 0xea); /// Contains a nonzero value if the list is a lowercase lettered list or zero otherwise. public static readonly Guid TSATTRID_List_Type_LowerLetter = new(0x96372285, 0xf3cf, 0x491e, 0xa9, 0x25, 0x38, 0x32, 0x34, 0x7f, 0xd2, 0x37); /// Contains a nonzero value if the list is a lowercase roman numeral list or zero otherwise. public static readonly Guid TSATTRID_List_Type_LowerRoman = new(0x90466262, 0x3980, 0x4b8e, 0x93, 0x68, 0x91, 0x8b, 0xd1, 0x21, 0x8a, 0x41); /// Contains a nonzero value if the list is an upper-case lettered list or zero otherwise. public static readonly Guid TSATTRID_List_Type_UpperLetter = new(0x7987b7cd, 0xce52, 0x428b, 0x9b, 0x95, 0xa3, 0x57, 0xf6, 0xf1, 0x0c, 0x45); /// Contains a nonzero value if the list is an uppercase roman numeral list or zero otherwise. public static readonly Guid TSATTRID_List_Type_UpperRoman = new(0x0f6ab552, 0x4a80, 0x467f, 0xb2, 0xf1, 0x12, 0x7e, 0x2a, 0xa3, 0xba, 0x9e); /// Not used. public static readonly Guid TSATTRID_OTHERS = new(0xb3c32af9, 0x57d0, 0x46a9, 0xbc, 0xa8, 0xda, 0xc2, 0x38, 0xa1, 0x30, 0x57); /// Not used. public static readonly Guid TSATTRID_Text = new(0x7edb8e68, 0x81f9, 0x449d, 0xa1, 0x5a, 0x87, 0xa8, 0x38, 0x8f, 0xaa, 0xc0); /// Not used. public static readonly Guid TSATTRID_Text_Alignment = new(0x139941e6, 0x1767, 0x456d, 0x93, 0x8e, 0x35, 0xba, 0x56, 0x8b, 0x5c, 0xd4); /// Contains a nonzero value if the text is centered or zero otherwise. public static readonly Guid TSATTRID_Text_Alignment_Center = new(0xa4a95c16, 0x53bf, 0x4d55, 0x8b, 0x87, 0x4b, 0xdd, 0x8d, 0x42, 0x75, 0xfc); /// Contains a nonzero value if the text is justified or zero otherwise. public static readonly Guid TSATTRID_Text_Alignment_Justify = new(0xed350740, 0xa0f7, 0x42d3, 0x8e, 0xa8, 0xf8, 0x1b, 0x64, 0x88, 0xfa, 0xf0); /// Contains a nonzero value if the text is left aligned or zero otherwise. public static readonly Guid TSATTRID_Text_Alignment_Left = new(0x16ae95d3, 0x6361, 0x43a2, 0x84, 0x95, 0xd0, 0x0f, 0x39, 0x7f, 0x16, 0x93); /// Contains a nonzero value if the text is right aligned or zero otherwise. public static readonly Guid TSATTRID_Text_Alignment_Right = new(0xb36f0f98, 0x1b9e, 0x4360, 0x86, 0x16, 0x03, 0xfb, 0x08, 0xa7, 0x84, 0x56); /// Contains a nonzero value if the text is an embedded object or zero otherwise. public static readonly Guid TSATTRID_Text_EmbeddedObject = new(0x7edb8e68, 0x81f9, 0x449d, 0xa1, 0x5a, 0x87, 0xa8, 0x38, 0x8f, 0xaa, 0xc0); /// Contains a nonzero value if the text is hyphenated or zero otherwise. public static readonly Guid TSATTRID_Text_Hyphenation = new(0xdadf4525, 0x618e, 0x49eb, 0xb1, 0xa8, 0x3b, 0x68, 0xbd, 0x76, 0x48, 0xe3); /// Contains the LANGID language identifier of the text. public static readonly Guid TSATTRID_Text_Language = new(0xd8c04ef1, 0x5753, 0x4c25, 0x88, 0x87, 0x85, 0x44, 0x3f, 0xe5, 0xf8, 0x19); /// /// Contains a pointer to a link object. The caller must use the QueryInterface method to obtain the desired interface, such as IUniformResourceLocator. /// public static readonly Guid TSATTRID_Text_Link = new(0x47cd9051, 0x3722, 0x4cd8, 0xb7, 0xc8, 0x4e, 0x17, 0xca, 0x17, 0x59, 0xf5); /// Specifies the angle, in tenths of degrees, between text base line and the x-axis of the device. public static readonly Guid TSATTRID_Text_Orientation = new(0x6bab707f, 0x8785, 0x4c39, 0x8b, 0x52, 0x96, 0xf8, 0x78, 0x30, 0x3f, 0xfb); /// Not used. public static readonly Guid TSATTRID_Text_Para = new(0x5edc5822, 0x99dc, 0x4dd6, 0xae, 0xc3, 0xb6, 0x2b, 0xaa, 0x5b, 0x2e, 0x7c); /// Contains the number of points that the first line of a paragraph is indented. public static readonly Guid TSATTRID_Text_Para_FirstLineIndent = new(0x07c97a13, 0x7472, 0x4dd8, 0x90, 0xa9, 0x91, 0xe3, 0xd7, 0xe4, 0xf2, 0x9c); /// Contains the number of points that the paragraph is indented from the left. public static readonly Guid TSATTRID_Text_Para_LeftIndent = new(0xfb2848e9, 0x7471, 0x41c9, 0xb6, 0xb3, 0x8a, 0x14, 0x50, 0xe0, 0x18, 0x97); /// Not used. public static readonly Guid TSATTRID_Text_Para_LineSpacing = new(0x699b380d, 0x7f8c, 0x46d6, 0xa7, 0x3b, 0xdf, 0xe3, 0xd1, 0x53, 0x8d, 0xf3); /// Contains the minimum number of lines for the line spacing of the paragraph. public static readonly Guid TSATTRID_Text_Para_LineSpacing_AtLeast = new(0xadfedf31, 0x2d44, 0x4434, 0xa5, 0xff, 0x7f, 0x4c, 0x49, 0x90, 0xa9, 0x05); /// Contains a nonzero value if the paragraph is double spaced or zero otherwise. public static readonly Guid TSATTRID_Text_Para_LineSpacing_Double = new(0x82fb1805, 0xa6c4, 0x4231, 0xac, 0x12, 0x62, 0x60, 0xaf, 0x2a, 0xba, 0x28); /// Contains the exact number of lines for the line spacing of the paragraph. public static readonly Guid TSATTRID_Text_Para_LineSpacing_Exactly = new(0x3d45ad40, 0x23de, 0x48d7, 0xa6, 0xb3, 0x76, 0x54, 0x20, 0xc6, 0x20, 0xcc); /// Contains the number of lines for the multiple line spacing of the paragraph. public static readonly Guid TSATTRID_Text_Para_LineSpacing_Multiple = new(0x910f1e3c, 0xd6d0, 0x4f65, 0x8a, 0x3c, 0x42, 0xb4, 0xb3, 0x18, 0x68, 0xc5); /// Contains a nonzero value if the paragraph is one and one half line spaced or zero otherwise. public static readonly Guid TSATTRID_Text_Para_LineSpacing_OnePtFive = new(0x0428a021, 0x0397, 0x4b57, 0x9a, 0x17, 0x07, 0x95, 0x99, 0x4c, 0xd3, 0xc5); /// Contains a nonzero value if the paragraph is single spaced or zero otherwise. public static readonly Guid TSATTRID_Text_Para_LineSpacing_Single = new(0xed350740, 0xa0f7, 0x42d3, 0x8e, 0xa8, 0xf8, 0x1b, 0x64, 0x88, 0xfa, 0xf0); /// Contains the number of points that the paragraph is indented from the right. public static readonly Guid TSATTRID_Text_Para_RightIndent = new(0x2c7f26f9, 0xa5e2, 0x48da, 0xb9, 0x8a, 0x52, 0x0c, 0xb1, 0x65, 0x13, 0xbf); /// Contains the number of points of spacing after the paragraph. public static readonly Guid TSATTRID_Text_Para_SpaceAfter = new(0x7b0a3f55, 0x22dc, 0x425f, 0xa4, 0x11, 0x93, 0xda, 0x1d, 0x8f, 0x9b, 0xaa); /// Contains the number of points of spacing before the paragraph. public static readonly Guid TSATTRID_Text_Para_SpaceBefore = new(0x8df98589, 0x194a, 0x4601, 0xb2, 0x51, 0x98, 0x65, 0xa3, 0xe9, 0x06, 0xdd); /// Contains zero if the text is read-only or nonzero otherwise. public static readonly Guid TSATTRID_Text_ReadOnly = new(0x85836617, 0xde32, 0x4afd, 0xa5, 0x0f, 0xa2, 0xdb, 0x11, 0x0e, 0x6e, 0x4d); /// Contains zero if the text is right-to-left reading or nonzero otherwise. public static readonly Guid TSATTRID_Text_RightToLeft = new(0xca666e71, 0x1b08, 0x453d, 0xbf, 0xdd, 0x28, 0xe0, 0x8c, 0x8a, 0xaf, 0x7a); /// /// Specifies if the text is vertical or horizontal. Contains zero if the text is horizontal or nonzero if the text is vertical. /// public static readonly Guid TSATTRID_Text_VerticalWriting = new(0x6bba8195, 0x046f, 0x4ea9, 0xb3, 0x11, 0x97, 0xfd, 0x66, 0xc4, 0x27, 0x4b); } } }