1 |
|
---|
2 | #ifndef __DOC_HOST_UI_HANDLER__
|
---|
3 | #define __DOC_HOST_UI_HANDLER__
|
---|
4 |
|
---|
5 | #include <windows.h>
|
---|
6 | #include <ExDisp.h>
|
---|
7 | #include <mshtml.h>
|
---|
8 | #include <mshtmhst.h>
|
---|
9 | #include <oaidl.h>
|
---|
10 |
|
---|
11 | class DocHostUiHandler : public IDocHostUIHandler
|
---|
12 | {
|
---|
13 |
|
---|
14 | IOleClientSite* ole_client_site_;
|
---|
15 | class HTMLWindow* html_window_;
|
---|
16 |
|
---|
17 | public:
|
---|
18 |
|
---|
19 | void ClientSite(IOleClientSite*);
|
---|
20 |
|
---|
21 | DocHostUiHandler(class HTMLWindow*);
|
---|
22 |
|
---|
23 | virtual
|
---|
24 | ~DocHostUiHandler()
|
---|
25 | {
|
---|
26 | }
|
---|
27 |
|
---|
28 | HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID FAR* ppvObj)
|
---|
29 | {
|
---|
30 | if (ole_client_site_)
|
---|
31 | {
|
---|
32 | return ole_client_site_->QueryInterface(riid, ppvObj);
|
---|
33 | }
|
---|
34 |
|
---|
35 | return E_NOINTERFACE;
|
---|
36 | }
|
---|
37 |
|
---|
38 | ULONG STDMETHODCALLTYPE AddRef()
|
---|
39 | {
|
---|
40 | return 1;
|
---|
41 | }
|
---|
42 |
|
---|
43 | ULONG STDMETHODCALLTYPE Release()
|
---|
44 | {
|
---|
45 | return 1;
|
---|
46 | }
|
---|
47 |
|
---|
48 | HRESULT STDMETHODCALLTYPE ShowContextMenu(
|
---|
49 | DWORD dwID,
|
---|
50 | POINT __RPC_FAR *ppt,
|
---|
51 | IUnknown __RPC_FAR *pcmdtReserved,
|
---|
52 | IDispatch __RPC_FAR *pdispReserved);
|
---|
53 |
|
---|
54 | HRESULT STDMETHODCALLTYPE ShowUI(
|
---|
55 | DWORD dwID,
|
---|
56 | IOleInPlaceActiveObject __RPC_FAR *pActiveObject,
|
---|
57 | IOleCommandTarget __RPC_FAR *pCommandTarget,
|
---|
58 | IOleInPlaceFrame __RPC_FAR *pFrame,
|
---|
59 | IOleInPlaceUIWindow __RPC_FAR *pDoc)
|
---|
60 | {
|
---|
61 | return S_OK ;
|
---|
62 | }
|
---|
63 |
|
---|
64 | HRESULT STDMETHODCALLTYPE GetHostInfo(DOCHOSTUIINFO __RPC_FAR *pInfo);
|
---|
65 |
|
---|
66 | HRESULT STDMETHODCALLTYPE HideUI()
|
---|
67 | {
|
---|
68 | return S_OK;
|
---|
69 | }
|
---|
70 |
|
---|
71 | HRESULT STDMETHODCALLTYPE UpdateUI()
|
---|
72 | {
|
---|
73 | // We update our UI in our window message loop so we don't do anything here.
|
---|
74 | return S_OK;
|
---|
75 | }
|
---|
76 |
|
---|
77 | HRESULT STDMETHODCALLTYPE EnableModeless(BOOL fEnable)
|
---|
78 | {
|
---|
79 | return S_OK;
|
---|
80 | }
|
---|
81 |
|
---|
82 | HRESULT STDMETHODCALLTYPE OnDocWindowActivate(BOOL fActivate)
|
---|
83 | {
|
---|
84 | return S_OK;
|
---|
85 | }
|
---|
86 |
|
---|
87 | HRESULT STDMETHODCALLTYPE OnFrameWindowActivate(BOOL fActivate)
|
---|
88 | {
|
---|
89 | return S_OK;
|
---|
90 | }
|
---|
91 |
|
---|
92 | HRESULT STDMETHODCALLTYPE ResizeBorder(LPCRECT prcBorder, IOleInPlaceUIWindow __RPC_FAR *pUIWindow, BOOL fRameWindow)
|
---|
93 | {
|
---|
94 | return S_OK;
|
---|
95 | }
|
---|
96 |
|
---|
97 | HRESULT STDMETHODCALLTYPE TranslateAccelerator(LPMSG lpMsg, const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID);
|
---|
98 |
|
---|
99 | HRESULT STDMETHODCALLTYPE GetOptionKeyPath(LPOLESTR __RPC_FAR *pchKey, DWORD dw);
|
---|
100 |
|
---|
101 | HRESULT STDMETHODCALLTYPE GetDropTarget(IDropTarget __RPC_FAR *pDropTarget, IDropTarget __RPC_FAR *__RPC_FAR *ppDropTarget)
|
---|
102 | {
|
---|
103 | /*
|
---|
104 | Return our IDropTarget object associated with this IDocHostUIHandler object. I don't
|
---|
105 | know why we don't do this via QueryInterface(), but we don't.
|
---|
106 |
|
---|
107 | NOTE: If we want/need an IDropTarget interface, then we would have had to setup our own
|
---|
108 | IDropTarget functions, IDropTarget VTable, and create an IDropTarget object. We'd want to put
|
---|
109 | a pointer to the IDropTarget object in our own custom IDocHostUIHandlerEx object (like how
|
---|
110 | we may add an HWND field for the use of ShowContextMenu). So when we created our
|
---|
111 | IDocHostUIHandlerEx object, maybe we'd add a 'idrop' field to the end of it, and
|
---|
112 | store a pointer to our IDropTarget object there. Then we could return this pointer as so:
|
---|
113 |
|
---|
114 | *pDropTarget = ((IDocHostUIHandlerEx FAR *)This)->idrop;
|
---|
115 | return S_OK;
|
---|
116 |
|
---|
117 | But for our purposes, we don't need an IDropTarget object, so we'll tell whomever is calling
|
---|
118 | us that we don't have one. */
|
---|
119 | return S_FALSE;
|
---|
120 | }
|
---|
121 |
|
---|
122 | HRESULT STDMETHODCALLTYPE GetExternal(IDispatch __RPC_FAR *__RPC_FAR *ppDispatch);
|
---|
123 |
|
---|
124 | HRESULT STDMETHODCALLTYPE TranslateUrl(DWORD dwTranslate, OLECHAR __RPC_FAR *pchURLIn, OLECHAR __RPC_FAR *__RPC_FAR *ppchURLOut);
|
---|
125 |
|
---|
126 | HRESULT STDMETHODCALLTYPE FilterDataObject(IDataObject __RPC_FAR *pDO, IDataObject __RPC_FAR *__RPC_FAR *ppDORet)
|
---|
127 | {
|
---|
128 | /*
|
---|
129 | Return our IDataObject object associated with this IDocHostUIHandler object. I don't
|
---|
130 | know why we don't do this via QueryInterface(), but we don't.
|
---|
131 |
|
---|
132 | NOTE: If we want/need an IDataObject interface, then we would have had to setup our own
|
---|
133 | IDataObject functions, IDataObject VTable, and create an IDataObject object. We'd want to put
|
---|
134 | a pointer to the IDataObject object in our custom _IDocHostUIHandlerEx object (like how
|
---|
135 | we may add an HWND field for the use of ShowContextMenu). So when we defined our
|
---|
136 | _IDocHostUIHandlerEx object, maybe we'd add a 'idata' field to the end of it, and
|
---|
137 | store a pointer to our IDataObject object there. Then we could return this pointer as so:
|
---|
138 |
|
---|
139 | *ppDORet = ((_IDocHostUIHandlerEx FAR *)This)->idata;
|
---|
140 | return S_OK;
|
---|
141 |
|
---|
142 | But for our purposes, we don't need an IDataObject object, so we'll tell whomever is calling
|
---|
143 | us that we don't have one. Note: We must set ppDORet to 0 if we don't return our own
|
---|
144 | IDataObject object. */
|
---|
145 | *ppDORet = 0;
|
---|
146 | return S_FALSE;
|
---|
147 | }
|
---|
148 | };
|
---|
149 |
|
---|
150 | #endif
|
---|