annotate EXCLUDE/GLTSF/include/TSF.hpp @ 4739:f51a9f01b508

Starting to implement ITextStoreACP. It's very incomplete and will probably change quite a bit but it's a start. ITextStoreACP is the minimum interface to be considered TSF-aware.
author dewyatt
date Mon, 21 Jun 2010 17:16:37 -0400
parents 0c7c67d4e6ee
children
rev   line source
4731
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
1 #ifndef TSF_HPP
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
2 #define TSF_HPP
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
3
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
4 #include <msctf.h>
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
5 #include <atlbase.h>
4731
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
6
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
7 class TSF
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
8 {
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
9 public:
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
10 static void Initialize();
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
11 static void Finalize();
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
12
4731
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
13 private:
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
14 class TSF_Text_Store : public ITextStoreACP, public ITfContextOwnerCompositionSink
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
15 {
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
16 public:
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
17 //IUnknown
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
18 STDMETHODIMP QueryInterface(REFIID riid, void **ppvObject);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
19 STDMETHODIMP_(ULONG) AddRef();
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
20 STDMETHODIMP_(ULONG) Release();
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
21
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
22 //ITextStoreACP
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
23 STDMETHODIMP AdviseSink(REFIID riid, IUnknown *punk, DWORD dwMask);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
24 STDMETHODIMP UnadviseSink(IUnknown *punk);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
25 STDMETHODIMP RequestLock(DWORD dwLockFlags, HRESULT *phrSession);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
26 STDMETHODIMP GetStatus(TS_STATUS *pdcs);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
27 STDMETHODIMP QueryInsert(LONG acpTestStart, LONG acpTestEnd, ULONG cch, LONG *pacpResultStart, LONG *pacpResultEnd);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
28 STDMETHODIMP GetSelection(ULONG ulIndex, ULONG ulCount, TS_SELECTION_ACP *pSelection, ULONG *pcFetched);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
29 STDMETHODIMP SetSelection(ULONG ulCount, const TS_SELECTION_ACP *pSelection);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
30 STDMETHODIMP GetText(LONG acpStart, LONG acpEnd, WCHAR *pchPlain, ULONG cchPlainReq, ULONG *pcchPlainRet, TS_RUNINFO *prgRunInfo, ULONG cRunInfoReq, ULONG *pcRunInfoRet, LONG *pacpNext);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
31 STDMETHODIMP SetText(DWORD dwFlags, LONG acpStart, LONG acpEnd, const WCHAR *pchText, ULONG cch, TS_TEXTCHANGE *pChange);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
32 STDMETHODIMP GetFormattedText(LONG acpStart, LONG acpEnd, IDataObject **ppDataObject);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
33 STDMETHODIMP GetEmbedded(LONG acpPos, REFGUID rguidService, REFIID riid, IUnknown **ppunk);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
34 STDMETHODIMP QueryInsertEmbedded(const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
35 STDMETHODIMP InsertEmbedded(DWORD dwFlags, LONG acpStart, LONG acpEnd, IDataObject *pDataObject, TS_TEXTCHANGE *pChange);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
36 STDMETHODIMP InsertTextAtSelection(DWORD dwFlags, const WCHAR *pchText, ULONG cch, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
37 STDMETHODIMP InsertEmbeddedAtSelection(DWORD dwFlags, IDataObject *pDataObject, LONG *pacpStart, LONG *pacpEnd, TS_TEXTCHANGE *pChange);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
38 STDMETHODIMP RequestSupportedAttrs(DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
39 STDMETHODIMP RequestAttrsAtPosition(LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
40 STDMETHODIMP RequestAttrsTransitioningAtPosition(LONG acpPos, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
41 STDMETHODIMP FindNextAttrTransition(LONG acpStart, LONG acpHalt, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs, DWORD dwFlags, LONG *pacpNext, BOOL *pfFound, LONG *plFoundOffset);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
42 STDMETHODIMP RetrieveRequestedAttrs(ULONG ulCount, TS_ATTRVAL *paAttrVals, ULONG *pcFetched);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
43 STDMETHODIMP GetEndACP(LONG *pacp);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
44 STDMETHODIMP GetActiveView(TsViewCookie *pvcView);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
45 STDMETHODIMP GetACPFromPoint(TsViewCookie vcView, const POINT *ptScreen, DWORD dwFlags, LONG *pacp);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
46 STDMETHODIMP GetTextExt(TsViewCookie vcView, LONG acpStart, LONG acpEnd, RECT *prc, BOOL *pfClipped);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
47 STDMETHODIMP GetScreenExt(TsViewCookie vcView, RECT *prc);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
48 STDMETHODIMP GetWnd(TsViewCookie vcView, HWND *phwnd);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
49
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
50 //ITfOwnerCompositionSink
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
51 STDMETHODIMP OnStartComposition(ITfCompositionView *pComposition, BOOL *pfOk);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
52 STDMETHODIMP OnUpdateComposition(ITfCompositionView *pComposition, ITfRange *pRangeNew);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
53 STDMETHODIMP OnEndComposition(ITfCompositionView *pComposition);
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
54
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
55 void Initialize();
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
56 void Finalize();
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
57
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
58 TSF_Text_Store();
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
59 ~TSF_Text_Store();
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
60
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
61 private:
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
62 ULONG my_Reference_Count;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
63 CComPtr<ITfDocumentMgr> my_Document_Manager;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
64 CComPtr<ITfContext> my_Context;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
65 DWORD my_Edit_Cookie;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
66 CComPtr<ITextStoreACPSink> my_Sink;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
67 DWORD my_Sink_Mask;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
68 DWORD my_Lock;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
69 DWORD my_Lock_Queued;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
70 CComPtr<ITfCompositionView> my_Composition_View;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
71 TS_SELECTION_ACP my_Composition_Selection;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
72 };
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
73
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
74 TSF();
4731
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
75
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
76 static bool COM_Initialized;
4732
e1307be6cb9e Implementing base parts of TSF
dewyatt
parents: 4731
diff changeset
77
4734
0c7c67d4e6ee Added On_Char method to Window_Listener for WM_CHAR messages.
dewyatt
parents: 4732
diff changeset
78 static CComPtr<ITfThreadMgr> Thread_Manager;
4739
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
79 static TfClientId Client_Id;
f51a9f01b508 Starting to implement ITextStoreACP.
dewyatt
parents: 4734
diff changeset
80 static TSF_Text_Store *Text_Store;
4731
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
81 };
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
82
bfc8ad7234b6 Adding some initial TSF code
dewyatt
parents:
diff changeset
83 #endif