TSF Application interfaces

The first stop on the TSF tour is the application interfaces.  These are implemented by applications or text controls.

An application (or text control) must implement ITextStoreACP to be considered ‘TSF-aware'.  It may choose to implement any of the other interfaces described in the table below.  I also describe how TSF obtains an instance of each interface.

Interface

Optional?

How Obtained?

ITextStoreACP

No

Passed to ITfDocumentMgr::CreateContext

ITfInputScope

Yes

Returned from ITextStoreACP::RequestSupportedAttrs with GUID_PROP_INPUTSCOPE.

ITfInputScope2

Yes

QI from ITfInputScope

ITfPersistentPropertyLoaderACP

Yes

Passed to ITextStoreACPServices::Unserialize

ITfMouseTrackerACP

Yes

QI from ITextStoreACP

ITfContextOwnerCompositionSink

Yes

Passed to ITfDocumentMgr::CreateContext

ITfUIElementSink

Yes

Passed to ITfSource::AdviseSink (see below)

Note: I put ITfUIElementSink here because text services never implement this interface, even though it's an event sink (described in a future post).   Full-screen applications (or games) would implement this interface if they wish to control the UI drawn by text services.  (See the discussion of UILess mode in MSDN.)

Interface

When to implement

ITextStoreACP

Always implement this. 

ITfInputScope

Consider implementing this.  It's not hard, and some text services use it to improve recognition (e.g., Windows Speech Recognition knows about the URL input scope, and has special code for that).

ITfInputScope2

Implement this if you implemented ITfInputScope, and you need the extra functionality (string enumeration).

ITfPersistentPropertyLoaderACP

Implement this if you support asynchronous property loading.  If you don't know what that means, you don't need to implement this.

ITfMouseTrackerACP

Implement this to help handwriting recognition (I believe that you must implement this to get gestures).

ITfContextOwnerCompositionSink

Implement this if you need control over compositions.

ITfUIElementSink

Only implement this if your application takes over the screen, and you still want IMEs to work inside your application.  It's a fair amount of work to implement this.