78 lines
2.2 KiB
C++
78 lines
2.2 KiB
C++
//////////////////////////////////////////////////////////////////////
|
|
//
|
|
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
|
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
// TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
|
// PARTICULAR PURPOSE.
|
|
//
|
|
// Copyright (C) 2003 Microsoft Corporation. All rights reserved.
|
|
//
|
|
// TextService.h
|
|
//
|
|
// CTextService declaration.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef TEXTSERVICE_H
|
|
#define TEXTSERVICE_H
|
|
|
|
class CTextService : public ITfTextInputProcessor,
|
|
public ITfThreadMgrEventSink,
|
|
public ITfTextEditSink
|
|
{
|
|
public:
|
|
CTextService();
|
|
~CTextService();
|
|
|
|
// IUnknown
|
|
STDMETHODIMP QueryInterface(REFIID riid, void **ppvObj);
|
|
STDMETHODIMP_(ULONG) AddRef(void);
|
|
STDMETHODIMP_(ULONG) Release(void);
|
|
|
|
// ITfTextInputProcessor
|
|
STDMETHODIMP Activate(ITfThreadMgr *pThreadMgr, TfClientId tfClientId);
|
|
STDMETHODIMP Deactivate();
|
|
|
|
// ITfThreadMgrEventSink
|
|
STDMETHODIMP OnInitDocumentMgr(ITfDocumentMgr *pDocMgr);
|
|
STDMETHODIMP OnUninitDocumentMgr(ITfDocumentMgr *pDocMgr);
|
|
STDMETHODIMP OnSetFocus(ITfDocumentMgr *pDocMgrFocus, ITfDocumentMgr *pDocMgrPrevFocus);
|
|
STDMETHODIMP OnPushContext(ITfContext *pContext);
|
|
STDMETHODIMP OnPopContext(ITfContext *pContext);
|
|
|
|
// ITfTextEditSink
|
|
STDMETHODIMP OnEndEdit(ITfContext *pContext, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord);
|
|
|
|
// CClassFactory factory callback
|
|
static HRESULT CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObj);
|
|
|
|
ITfThreadMgr *_GetThreadMgr() { return _pThreadMgr; }
|
|
|
|
private:
|
|
// initialize and uninitialize ThreadMgrEventSink.
|
|
BOOL _InitThreadMgrEventSink();
|
|
void _UninitThreadMgrEventSink();
|
|
|
|
// initialize TextEditSink.
|
|
BOOL _InitTextEditSink(ITfDocumentMgr *pDocMgr);
|
|
|
|
//
|
|
// state
|
|
//
|
|
ITfThreadMgr *_pThreadMgr;
|
|
|
|
// The cookie of ThreadMgrEventSink
|
|
DWORD _dwThreadMgrEventSinkCookie;
|
|
|
|
//
|
|
// private variables for TextEditSink
|
|
//
|
|
ITfContext *_pTextEditSinkContext;
|
|
DWORD _dwTextEditSinkCookie;
|
|
|
|
LONG _cRef; // COM ref count
|
|
};
|
|
|
|
|
|
#endif // TEXTSERVICE_H
|