HRESULT CCompartmentMonitor::Uninitialize(void) { HRESULT hr = S_OK; if(m_pCompartment) { ITfSource *pSource; hr = m_pCompartment->QueryInterface(IID_ITfSource, (void **)&pSource); if(SUCCEEDED(hr)) { hr = pSource->UnadviseSink(m_dwCookie); pSource->Release(); } m_pCompartment->Release(); m_pCompartment = NULL; } m_guidCompartment = GUID_NULL; return hr; }
HRESULT CTextEditSink::_Unadvise() { HRESULT hr; ITfSource *source = NULL; hr = E_FAIL; if (_pic == NULL) goto Exit; if (FAILED(_pic->QueryInterface(IID_ITfSource, (void **)&source))) goto Exit; if (FAILED(source->UnadviseSink(_dwEditCookie))) goto Exit; hr = S_OK; Exit: if (source) source->Release(); if (_pic) { _pic->Release(); _pic = NULL; } return hr; }
BOOL CSampleIME::_InitTextEditSink(_In_ ITfDocumentMgr *pDocMgr) { ITfSource* pSource = nullptr; BOOL ret = TRUE; // clear out any previous sink first if (_textEditSinkCookie != TF_INVALID_COOKIE) { if (SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource))) { pSource->UnadviseSink(_textEditSinkCookie); pSource->Release(); } _pTextEditSinkContext->Release(); _pTextEditSinkContext = nullptr; _textEditSinkCookie = TF_INVALID_COOKIE; } if (pDocMgr == nullptr) { return TRUE; // caller just wanted to clear the previous sink } if (FAILED(pDocMgr->GetTop(&_pTextEditSinkContext))) { return FALSE; } if (_pTextEditSinkContext == nullptr) { return TRUE; // empty document, no sink possible } ret = FALSE; if (SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource))) { if (SUCCEEDED(pSource->AdviseSink(IID_ITfTextEditSink, (ITfTextEditSink *)this, &_textEditSinkCookie))) { ret = TRUE; } else { _textEditSinkCookie = TF_INVALID_COOKIE; } pSource->Release(); } if (ret == FALSE) { _pTextEditSinkContext->Release(); _pTextEditSinkContext = nullptr; } return ret; }
void CExtentMonitorTextService::_UninitThreadFocusSink() { ITfSource *pSource; if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK) { pSource->UnadviseSink(_dwThreadFocusCookie); pSource->Release(); } }
BOOL CTextService::_InitTextEditSink(ITfDocumentMgr *pDocumentMgr) { BOOL fRet = FALSE; if(_pTextEditSinkContext != nullptr && _dwTextEditSinkCookie != TF_INVALID_COOKIE) { ITfSource *pSource = nullptr; if(SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) { pSource->UnadviseSink(_dwTextEditSinkCookie); SafeRelease(&pSource); } SafeRelease(&_pTextEditSinkContext); _dwTextEditSinkCookie = TF_INVALID_COOKIE; } if(pDocumentMgr == nullptr) { return TRUE; } if(FAILED(pDocumentMgr->GetTop(&_pTextEditSinkContext))) { return FALSE; } if(_pTextEditSinkContext == nullptr) { return TRUE; } { ITfSource *pSource = nullptr; if(SUCCEEDED(_pTextEditSinkContext->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) { if(SUCCEEDED(pSource->AdviseSink(IID_IUNK_ARGS((ITfTextEditSink *)this), &_dwTextEditSinkCookie))) { fRet = TRUE; } else { _dwTextEditSinkCookie = TF_INVALID_COOKIE; } SafeRelease(&pSource); } } if(fRet == FALSE) { SafeRelease(&_pTextEditSinkContext); } return fRet; }
BOOL CTextService::_InitTextEditSink(ITfDocumentMgr *pDocMgr) { ITfSource *pSource; BOOL fRet; // clear out any previous sink first if (_dwTextEditSinkCookie != TF_INVALID_COOKIE) { if (_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK) { pSource->UnadviseSink(_dwTextEditSinkCookie); pSource->Release(); } _pTextEditSinkContext->Release(); _pTextEditSinkContext = NULL; _dwTextEditSinkCookie = TF_INVALID_COOKIE; } if (pDocMgr == NULL) return TRUE; // caller just wanted to clear the previous sink // setup a new sink advised to the topmost context of the document if (pDocMgr->GetTop(&_pTextEditSinkContext) != S_OK) return FALSE; if (_pTextEditSinkContext == NULL) return TRUE; // empty document, no sink possible fRet = FALSE; if (_pTextEditSinkContext->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK) { if (pSource->AdviseSink(IID_ITfTextEditSink, (ITfTextEditSink *)this, &_dwTextEditSinkCookie) == S_OK) { fRet = TRUE; } else { _dwTextEditSinkCookie = TF_INVALID_COOKIE; } pSource->Release(); } if (fRet == FALSE) { _pTextEditSinkContext->Release(); _pTextEditSinkContext = NULL; } return fRet; }
void WeaselTSF::_UninitThreadMgrEventSink() { ITfSource *pSource; if (_dwThreadMgrEventSinkCookie == TF_INVALID_COOKIE) return; if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_ITfSource, (void **) &pSource))) { pSource->UnadviseSink(_dwThreadMgrEventSinkCookie); pSource->Release(); } _dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE; }
void UnadviseSink(IUnknown *pSourceIn, DWORD *pdwCookie) { ITfSource *pSource; if (*pdwCookie == TF_INVALID_COOKIE) return; // never Advised if (pSourceIn->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK) { pSource->UnadviseSink(*pdwCookie); pSource->Release(); } *pdwCookie = TF_INVALID_COOKIE; }
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; }
void CTextService::_UninitThreadMgrEventSink() { HRESULT hr; if(_dwThreadMgrEventSinkCookie != TF_INVALID_COOKIE) { ITfSource *pSource = nullptr; if(SUCCEEDED(_pThreadMgr->QueryInterface(IID_PPV_ARGS(&pSource))) && (pSource != nullptr)) { hr = pSource->UnadviseSink(_dwThreadMgrEventSinkCookie); SafeRelease(&pSource); } _dwThreadMgrEventSinkCookie = TF_INVALID_COOKIE; } }
HRESULT CCandidateList::_UnadviseTextLayoutSink() { HRESULT hr = E_FAIL; if(_pContextDocument != NULL) { ITfSource *pSource; if(_pContextDocument->QueryInterface(IID_PPV_ARGS(&pSource)) == S_OK) { hr = pSource->UnadviseSink(_dwCookieTextLayoutSink); SafeRelease(&pSource); } } return hr; }
HRESULT CCandidateList::_UnadviseContextKeyEventSink() { HRESULT hr = E_FAIL; ITfSource *pSource; if(_pContextCandidateWindow != NULL) { if(_pContextCandidateWindow->QueryInterface(IID_PPV_ARGS(&pSource)) == S_OK) { hr = pSource->UnadviseSink(_dwCookieContextKeyEventSink); SafeRelease(&pSource); } } return hr; }
HRESULT CInputModeWindow::_UnadviseTextLayoutSink() { HRESULT hr = E_FAIL; if(_pContext != nullptr) { ITfSource *pSource; if(_pContext->QueryInterface(IID_PPV_ARGS(&pSource)) == S_OK) { hr = pSource->UnadviseSink(_dwCookieTextLayoutSink); SafeRelease(&pSource); } } return hr; }
void CSampleIME::_UninitThreadMgrEventSink() { ITfSource* pSource = nullptr; if (_threadMgrEventSinkCookie == TF_INVALID_COOKIE) { return; } if (SUCCEEDED(_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource))) { pSource->UnadviseSink(_threadMgrEventSinkCookie); pSource->Release(); } _threadMgrEventSinkCookie = TF_INVALID_COOKIE; }
void COVTSF::_UninitActiveLanguageProfileNotifySink() { ITfSource* pSource = nullptr; if (_activeLanguageProfileNotifySinkCookie == TF_INVALID_COOKIE) { return; // never Advised } if (_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource) == S_OK) { pSource->UnadviseSink(_activeLanguageProfileNotifySinkCookie); pSource->Release(); } _activeLanguageProfileNotifySinkCookie = TF_INVALID_COOKIE; }
void CIME::_UninitThreadFocusSink() { ITfSource* pSource = nullptr; if (FAILED(_pThreadMgr->QueryInterface(IID_ITfSource, (void **)&pSource))) { return; } if (FAILED(pSource->UnadviseSink(_dwThreadFocusSinkCookie))) { pSource->Release(); return; } pSource->Release(); }
HRESULT CCompartmentEventSink::_Unadvise() { HRESULT hr = S_OK; ITfSource* pSource = nullptr; hr = _pCompartment->QueryInterface(IID_ITfSource, (void **)&pSource); if (SUCCEEDED(hr)) { hr = pSource->UnadviseSink(_dwCookie); pSource->Release(); } _pCompartment->Release(); _pCompartment = nullptr; _dwCookie = 0; return hr; }
HRESULT touchmind::control::DWriteEditControlTextEditSink::Unadvise( ITfContext *pTfContext ) { HRESULT hr = E_FAIL; if (pTfContext == nullptr) { return hr; } ITfSource *source = nullptr; hr = pTfContext->QueryInterface(IID_ITfSource, (void **)&source); if (FAILED(hr)) { LOG(SEVERITY_LEVEL_ERROR) << L"QueryInterface failed"; } if (SUCCEEDED(hr)) { hr = source->UnadviseSink(m_editCookie); if (FAILED(hr)) { LOG(SEVERITY_LEVEL_ERROR) << L"UnadviseSink failed"; } } SafeRelease(&source); return hr; }
HRESULT CCandidateList::_UnadviseTextLayoutSink() { HRESULT hr; ITfSource *pSource = NULL; hr = E_FAIL; if (_pContextDocument == NULL) goto Exit; if (FAILED(_pContextDocument->QueryInterface(IID_ITfSource, (void **)&pSource))) goto Exit; if (FAILED(pSource->UnadviseSink(_dwCookieTextLayoutSink))) goto Exit; hr = S_OK; Exit: if (pSource != NULL) pSource->Release(); return hr; }