ReactOS 0.4.15-dev-8222-g9164419
CTextEventSink Class Reference

#include <sinks.h>

Inheritance diagram for CTextEventSink:
Collaboration diagram for CTextEventSink:

Public Member Functions

 CTextEventSink (FN_ENDEDIT fnEndEdit, LPVOID pCallbackPV)
 @implemented
 
virtual ~CTextEventSink ()
 @implemented
 
HRESULT _Advise (IUnknown *pUnknown, UINT uFlags)
 @implemented
 
HRESULT _Unadvise ()
 @implemented
 
STDMETHODIMP QueryInterface (REFIID riid, LPVOID *ppvObj) override
 @implemented
 
 STDMETHODIMP_ (ULONG) AddRef() override
 
 STDMETHODIMP_ (ULONG) Release() override
 
STDMETHODIMP OnEndEdit (ITfContext *pic, TfEditCookie ecReadOnly, ITfEditRecord *pEditRecord) override
 @implemented
 
STDMETHODIMP OnLayoutChange (ITfContext *pContext, TfLayoutCode lcode, ITfContextView *pContextView) override
 @implemented
 
HRESULT OnEndEdit ([in] ITfContext *pic, [in] TfEditCookie ecReadOnly, [in] ITfEditRecord *pEditRecord)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Protected Attributes

LONG m_cRefs
 
IUnknownm_pUnknown
 
DWORD m_dwEditSinkCookie
 
DWORD m_dwLayoutSinkCookie
 
union {
   UINT   m_uFlags
 
   FN_LAYOUTCHANGE   m_fnLayoutChange
 
}; 
 
FN_ENDEDIT m_fnEndEdit
 
LPVOID m_pCallbackPV
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Private Types inherited from ITfTextLayoutSink
enum  TfLayoutCode { TF_LC_CREATE = 0 , TF_LC_CHANGE = 1 , TF_LC_DESTROY = 2 }
 
- Private Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
HRESULT OnLayoutChange ([in] ITfContext *pic, [in] TfLayoutCode lcode, [in] ITfContextView *pView)
 
- Private Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Detailed Description

Definition at line 48 of file sinks.h.

Constructor & Destructor Documentation

◆ CTextEventSink()

CTextEventSink::CTextEventSink ( FN_ENDEDIT  fnEndEdit,
LPVOID  pCallbackPV 
)

@implemented

Definition at line 133 of file sinks.cpp.

134{
135 m_cRefs = 1;
140 m_fnEndEdit = fnEndEdit;
141 m_pCallbackPV = pCallbackPV;
142}
IUnknown * m_pUnknown
Definition: sinks.h:52
DWORD m_dwLayoutSinkCookie
Definition: sinks.h:54
LONG m_cRefs
Definition: sinks.h:51
DWORD m_dwEditSinkCookie
Definition: sinks.h:53
FN_LAYOUTCHANGE m_fnLayoutChange
Definition: sinks.h:58
LPVOID m_pCallbackPV
Definition: sinks.h:61
FN_ENDEDIT m_fnEndEdit
Definition: sinks.h:60
#define NULL
Definition: types.h:112
#define DWORD
Definition: nt_native.h:44

◆ ~CTextEventSink()

CTextEventSink::~CTextEventSink ( )
virtual

@implemented

Definition at line 145 of file sinks.cpp.

146{
147}

Member Function Documentation

◆ _Advise()

HRESULT CTextEventSink::_Advise ( IUnknown pUnknown,
UINT  uFlags 
)

@implemented

Definition at line 215 of file sinks.cpp.

216{
219
220 ITfSource *pSource = NULL;
221 HRESULT hr = pUnknown->QueryInterface(IID_ITfSource, (void**)&pSource);
222 if (SUCCEEDED(hr))
223 {
224 ITfTextEditSink *pSink = static_cast<ITfTextEditSink*>(this);
225 if (uFlags & 1)
226 hr = pSource->AdviseSink(IID_ITfTextEditSink, pSink, &m_dwEditSinkCookie);
227 if (SUCCEEDED(hr) && (uFlags & 2))
228 hr = pSource->AdviseSink(IID_ITfTextLayoutSink, pSink, &m_dwLayoutSinkCookie);
229
230 if (SUCCEEDED(hr))
231 {
233 pUnknown->AddRef();
234 }
235 else
236 {
237 pSource->UnadviseSink(m_dwEditSinkCookie);
238 }
239 }
240
241 if (pSource)
242 pSource->Release();
243
244 return hr;
245}
UINT m_uFlags
Definition: sinks.h:57
UINT uFlags
Definition: api.c:59
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
ULONG AddRef()
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
nsrefcnt Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
HRESULT hr
Definition: shlfolder.c:183

◆ _Unadvise()

HRESULT CTextEventSink::_Unadvise ( )

@implemented

Definition at line 248 of file sinks.cpp.

249{
250 if (!m_pUnknown)
251 return E_FAIL;
252
253 ITfSource *pSource = NULL;
254 HRESULT hr = m_pUnknown->QueryInterface(IID_ITfSource, (void**)&pSource);
255 if (SUCCEEDED(hr))
256 {
257 if (m_uFlags & 1)
258 hr = pSource->UnadviseSink(m_dwEditSinkCookie);
259 if (m_uFlags & 2)
260 hr = pSource->UnadviseSink(m_dwLayoutSinkCookie);
261
262 pSource->Release();
263 }
264
267
268 return E_NOTIMPL;
269}
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
ULONG Release()

Referenced by CicInputContext::DestroyInputContext().

◆ OnEndEdit()

STDMETHODIMP CTextEventSink::OnEndEdit ( ITfContext pic,
TfEditCookie  ecReadOnly,
ITfEditRecord pEditRecord 
)
override

@implemented

Implements ITfTextEditSink.

Definition at line 186 of file sinks.cpp.

190{
191 TEXT_EVENT_SINK_END_EDIT Data = { ecReadOnly, pEditRecord, pic };
192 return m_fnEndEdit(1, m_pCallbackPV, (LPVOID)&Data);
193}

◆ OnLayoutChange()

STDMETHODIMP CTextEventSink::OnLayoutChange ( ITfContext pContext,
TfLayoutCode  lcode,
ITfContextView pContextView 
)
override

@implemented

Implements ITfTextLayoutSink.

Definition at line 196 of file sinks.cpp.

200{
201 switch (lcode)
202 {
203 case TF_LC_CREATE:
204 return m_fnLayoutChange(3, m_fnEndEdit, pContextView);
205 case TF_LC_CHANGE:
206 return m_fnLayoutChange(2, m_fnEndEdit, pContextView);
207 case TF_LC_DESTROY:
208 return m_fnLayoutChange(4, m_fnEndEdit, pContextView);
209 default:
210 return E_INVALIDARG;
211 }
212}
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ QueryInterface()

STDMETHODIMP CTextEventSink::QueryInterface ( REFIID  riid,
LPVOID ppvObj 
)
override

@implemented

Definition at line 150 of file sinks.cpp.

151{
152 static const QITAB c_tab[] =
153 {
156 { NULL }
157 };
158 return ::QISearch(this, c_tab, riid, ppvObj);
159}
REFIID riid
Definition: atlbase.h:39
#define QITABENT(Cthis, Ifoo)
Definition: shlwapi.h:2094

◆ STDMETHODIMP_() [1/2]

CTextEventSink::STDMETHODIMP_ ( ULONG  )
override

◆ STDMETHODIMP_() [2/2]

CTextEventSink::STDMETHODIMP_ ( ULONG  )
override

Member Data Documentation

◆ 

union { ... } CTextEventSink::@294

◆ m_cRefs

LONG CTextEventSink::m_cRefs
protected

Definition at line 51 of file sinks.h.

Referenced by CTextEventSink().

◆ m_dwEditSinkCookie

DWORD CTextEventSink::m_dwEditSinkCookie
protected

Definition at line 53 of file sinks.h.

Referenced by _Advise(), _Unadvise(), and CTextEventSink().

◆ m_dwLayoutSinkCookie

DWORD CTextEventSink::m_dwLayoutSinkCookie
protected

Definition at line 54 of file sinks.h.

Referenced by _Advise(), _Unadvise(), and CTextEventSink().

◆ m_fnEndEdit

FN_ENDEDIT CTextEventSink::m_fnEndEdit
protected

Definition at line 60 of file sinks.h.

Referenced by CTextEventSink(), OnEndEdit(), and OnLayoutChange().

◆ m_fnLayoutChange

FN_LAYOUTCHANGE CTextEventSink::m_fnLayoutChange

Definition at line 58 of file sinks.h.

Referenced by CTextEventSink(), and OnLayoutChange().

◆ m_pCallbackPV

LPVOID CTextEventSink::m_pCallbackPV
protected

Definition at line 61 of file sinks.h.

Referenced by CTextEventSink(), and OnEndEdit().

◆ m_pUnknown

IUnknown* CTextEventSink::m_pUnknown
protected

Definition at line 52 of file sinks.h.

Referenced by _Advise(), _Unadvise(), and CTextEventSink().

◆ m_uFlags

UINT CTextEventSink::m_uFlags

Definition at line 57 of file sinks.h.

Referenced by _Advise(), and _Unadvise().


The documentation for this class was generated from the following files: