Leaked source code of windows server 2003
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//
// tmgrsink.cpp
//
// ITfThreadMgrEventSink implementation.
//
#include "globals.h"
#include "case.h"
#include "snoop.h"
//+---------------------------------------------------------------------------
//
// OnInitDocumentMgr
//
// Sink called by the framework just before the first context is pushed onto
// a document.
//----------------------------------------------------------------------------
STDAPI CCaseTextService::OnInitDocumentMgr(ITfDocumentMgr *pDocMgr) { return S_OK; }
//+---------------------------------------------------------------------------
//
// OnUninitDocumentMgr
//
// Sink called by the framework just after the last context is popped off a
// document.
//----------------------------------------------------------------------------
STDAPI CCaseTextService::OnUninitDocumentMgr(ITfDocumentMgr *pDocMgr) { return S_OK; }
//+---------------------------------------------------------------------------
//
// OnSetFocus
//
// Sink called by the framework when focus changes from one document to
// another. Either document may be NULL, meaning previously there was no
// focus document, or now no document holds the input focus.
//----------------------------------------------------------------------------
STDAPI CCaseTextService::OnSetFocus(ITfDocumentMgr *pDocMgrFocus, ITfDocumentMgr *pDocMgrPrevFocus) { // track text changes on the focus doc
// we are guarenteed a final OnSetFocus(NULL, ..) which we use for cleanup
_InitTextEditSink(pDocMgrFocus);
// let's update the snoop window with text from the new focus context
_pSnoopWnd->_UpdateText(NULL); return S_OK; }
//+---------------------------------------------------------------------------
//
// OnPushContext
//
// Sink called by the framework when a context is pushed.
//----------------------------------------------------------------------------
STDAPI CCaseTextService::OnPushContext(ITfContext *pContext) { return S_OK; }
//+---------------------------------------------------------------------------
//
// OnPopContext
//
// Sink called by the framework when a context is popped.
//----------------------------------------------------------------------------
STDAPI CCaseTextService::OnPopContext(ITfContext *pContext) { return S_OK; }
//+---------------------------------------------------------------------------
//
// _InitThreadMgrSink
//
// Advise our sink.
//----------------------------------------------------------------------------
BOOL CCaseTextService::_InitThreadMgrSink() { ITfSource *pSource; BOOL fRet;
if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) != S_OK) return FALSE;
fRet = FALSE;
if (pSource->AdviseSink(IID_ITfThreadMgrEventSink, (ITfThreadMgrEventSink *)this, &_dwThreadMgrEventSinkCookie) != S_OK) { // make sure we don't try to Unadvise _dwThreadMgrEventSinkCookie later
_dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE; goto Exit; }
fRet = TRUE;
Exit: pSource->Release(); return fRet; }
//+---------------------------------------------------------------------------
//
// _UninitThreadMgrSink
//
// Unadvise our sink.
//----------------------------------------------------------------------------
void CCaseTextService::_UninitThreadMgrSink() { ITfSource *pSource;
if (_dwThreadMgrEventSinkCookie == TF_INVALID_COOKIE) return; // never Advised
if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK) { pSource->UnadviseSink(_dwThreadMgrEventSinkCookie); pSource->Release(); }
_dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE; }
|