summaryrefslogtreecommitdiff
path: root/plugins/IEView/src/IEView.h
blob: 1d26ac38c40f6f044fcb017ccf4c93998fa38c38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
/*

IEView Plugin for Miranda IM
Copyright (C) 2005-2010  Piotr Piastucki

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
class IEView;

#ifndef IEVIEW_INCLUDED
#define IEVIEW_INCLUDED

#include "ieview_common.h"
#include "HTMLBuilder.h"
//#include "SmileyWindow.h"

static const CLSID CLSID_MozillaBrowser=
{ 0x1339B54C, 0x3453, 0x11D2,
	{ 0x93, 0xB9, 0x00, 0x00,
	  0x00, 0x00, 0x00, 0x00 } };

#ifndef DISPID_AMBIENT_DLCONTROL
#define DISPID_AMBIENT_DLCONTROL                (-5512)
#endif

#ifndef __IDocHostUIHandler_INTERFACE_DEFINED__
#define __IDocHostUIHandler_INTERFACE_DEFINED__

typedef struct _DOCHOSTUIINFO
	{
	ULONG cbSize;
	DWORD dwFlags;
	DWORD dwDoubleClick;
	OLECHAR *pchHostCss;
	OLECHAR *pchHostNS;
	} DOCHOSTUIINFO;

const IID IID_IDocHostUIHandler ={0xbd3f23c0,0xd43e,0x11CF,{0x89, 0x3b, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x1a}};

	MIDL_INTERFACE("bd3f23c0-d43e-11cf-893b-00aa00bdce1a")
	IDocHostUIHandler : public IUnknown
	{
	public:
	virtual HRESULT STDMETHODCALLTYPE ShowContextMenu( 
		/* [in] */ DWORD dwID,
		/* [in] */ POINT *ppt,
		/* [in] */ IUnknown *pcmdtReserved,
		/* [in] */ IDispatch *pdispReserved) = 0;

	virtual HRESULT STDMETHODCALLTYPE GetHostInfo( 
		/* [out][in] */ DOCHOSTUIINFO *pInfo) = 0;

	virtual HRESULT STDMETHODCALLTYPE ShowUI( 
		/* [in] */ DWORD dwID,
		/* [in] */ IOleInPlaceActiveObject *pActiveObject,
		/* [in] */ IOleCommandTarget *pCommandTarget,
		/* [in] */ IOleInPlaceFrame *pFrame,
		/* [in] */ IOleInPlaceUIWindow *pDoc) = 0;

	virtual HRESULT STDMETHODCALLTYPE HideUI( void) = 0;

	virtual HRESULT STDMETHODCALLTYPE UpdateUI( void) = 0;

	virtual HRESULT STDMETHODCALLTYPE EnableModeless( 
		/* [in] */ BOOL fEnable) = 0;

	virtual HRESULT STDMETHODCALLTYPE OnDocWindowActivate( 
		/* [in] */ BOOL fActivate) = 0;

	virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivate( 
		/* [in] */ BOOL fActivate) = 0;

	virtual HRESULT STDMETHODCALLTYPE ResizeBorder( 
		/* [in] */ LPCRECT prcBorder,
		/* [in] */ IOleInPlaceUIWindow *pUIWindow,
		/* [in] */ BOOL fRameWindow) = 0;

	virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator( 
		/* [in] */ LPMSG lpMsg,
		/* [in] */ const GUID *pguidCmdGroup,
		/* [in] */ DWORD nCmdID) = 0;

	virtual HRESULT STDMETHODCALLTYPE GetOptionKeyPath( 
		/* [annotation][out] */ 
		LPOLESTR *pchKey,
		/* [in] */ DWORD dw) = 0;

	virtual HRESULT STDMETHODCALLTYPE GetDropTarget( 
		/* [in] */ IDropTarget *pDropTarget,
		/* [out] */ IDropTarget **ppDropTarget) = 0;

	virtual HRESULT STDMETHODCALLTYPE GetExternal( 
		/* [out] */ IDispatch **ppDispatch) = 0;

	virtual HRESULT STDMETHODCALLTYPE TranslateUrl( 
		/* [in] */ DWORD dwTranslate,
		/* [annotation][in] */ 
		OLECHAR *pchURLIn,
		/* [annotation][out] */ 
		OLECHAR **ppchURLOut) = 0;

	virtual HRESULT STDMETHODCALLTYPE FilterDataObject( 
		/* [in] */ IDataObject *pDO,
		/* [out] */ IDataObject **ppDORet) = 0;

	};

typedef enum tagDOCHOSTUIFLAG
	{	DOCHOSTUIFLAG_DIALOG	= 0x1,
	DOCHOSTUIFLAG_DISABLE_HELP_MENU	= 0x2,
	DOCHOSTUIFLAG_NO3DBORDER	= 0x4,
	DOCHOSTUIFLAG_SCROLL_NO	= 0x8,
	DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE	= 0x10,
	DOCHOSTUIFLAG_OPENNEWWIN	= 0x20,
	DOCHOSTUIFLAG_DISABLE_OFFSCREEN	= 0x40,
	DOCHOSTUIFLAG_FLAT_SCROLLBAR	= 0x80,
	DOCHOSTUIFLAG_DIV_BLOCKDEFAULT	= 0x100,
	DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY	= 0x200,
	DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY	= 0x400,
	DOCHOSTUIFLAG_CODEPAGELINKEDFONTS	= 0x800,
	DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8	= 0x1000,
	DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8	= 0x2000,
	DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE	= 0x4000,
	DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION	= 0x10000,
	DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION	= 0x20000,
	DOCHOSTUIFLAG_THEME	= 0x40000,
	DOCHOSTUIFLAG_NOTHEME	= 0x80000,
	DOCHOSTUIFLAG_NOPICS	= 0x100000,
	DOCHOSTUIFLAG_NO3DOUTERBORDER	= 0x200000,
	DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP	= 0x400000,
	DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK	= 0x800000,
	DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL	= 0x1000000,
	DOCHOSTUIFLAG_HOST_NAVIGATES	= 0x2000000,
	DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION	= 0x4000000,
	DOCHOSTUIFLAG_USE_WINDOWLESS_SELECTCONTROL	= 0x8000000,
	DOCHOSTUIFLAG_USE_WINDOWED_SELECTCONTROL	= 0x10000000,
	DOCHOSTUIFLAG_ENABLE_ACTIVEX_INACTIVATE_MODE	= 0x20000000,
	DOCHOSTUIFLAG_DPI_AWARE	= 0x40000000
	} DOCHOSTUIFLAG;

#endif 	/* __IDocHostUIHandler_INTERFACE_DEFINED__ */

#ifndef __IHTMLAnchorElement_INTERFACE_DEFINED__
#define __IHTMLAnchorElement_INTERFACE_DEFINED__

/* interface IHTMLAnchorElement */
/* [object][uuid][dual][oleautomation] */ 


EXTERN_C const IID IID_IHTMLAnchorElement;

	MIDL_INTERFACE("3050f1da-98b5-11cf-bb82-00aa00bdce0b")
	IHTMLAnchorElement : public IDispatch
	{
	public:
		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_href( 
			/* [in] */  BSTR v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_href( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_target( 
			/* [in] */  BSTR v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_target( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_rel( 
			/* [in] */  BSTR v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_rel( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_rev( 
			/* [in] */  BSTR v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_rev( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_urn( 
			/* [in] */  BSTR v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_urn( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_Methods( 
			/* [in] */  BSTR v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_Methods( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_name( 
			/* [in] */  BSTR v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_name( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_host( 
			/* [in] */  BSTR v) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_host( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_hostname( 
			/* [in] */  BSTR v) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hostname( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_pathname( 
			/* [in] */  BSTR v) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_pathname( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_port( 
			/* [in] */  BSTR v) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_port( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_protocol( 
			/* [in] */  BSTR v) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_protocol( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_search( 
			/* [in] */  BSTR v) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_search( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_hash( 
			/* [in] */  BSTR v) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_hash( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onblur( 
			/* [in] */ VARIANT v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onblur( 
			/* [out][retval] */  VARIANT *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_onfocus( 
			/* [in] */ VARIANT v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_onfocus( 
			/* [out][retval] */  VARIANT *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_accessKey( 
			/* [in] */  BSTR v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_accessKey( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_protocolLong( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_mimeType( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nameProp( 
			/* [out][retval] */  BSTR *p) = 0;

		virtual /* [bindable][displaybind][id][propput] */ HRESULT STDMETHODCALLTYPE put_tabIndex( 
			/* [in] */ short v) = 0;

		virtual /* [bindable][displaybind][id][propget] */ HRESULT STDMETHODCALLTYPE get_tabIndex( 
			/* [out][retval] */  short *p) = 0;

		virtual /* [id] */ HRESULT STDMETHODCALLTYPE focus( void) = 0;

		virtual /* [id] */ HRESULT STDMETHODCALLTYPE blur( void) = 0;

	};

#endif 	/* __IHTMLAnchorElement_INTERFACE_DEFINED__ */

#ifndef __IInternetSecurityManager_INTERFACE_DEFINED__
#define __IInternetSecurityManager_INTERFACE_DEFINED__

	typedef enum tagURLZONE {
		URLZONE_INVALID = -1,
		URLZONE_PREDEFINED_MIN = 0,
		URLZONE_LOCAL_MACHINE = 0,
		URLZONE_INTRANET,
		URLZONE_TRUSTED,
		URLZONE_INTERNET,
		URLZONE_UNTRUSTED,
		URLZONE_PREDEFINED_MAX = 999,
		URLZONE_USER_MIN = 1000,
		URLZONE_USER_MAX = 10000
	} URLZONE;

	#define URLACTION_ACTIVEX_MIN                                  0x00001200
	#define URLACTION_ACTIVEX_MAX                                  0x000013ff
	#define URLACTION_SCRIPT_MIN                                   0x00001400
	#define URLACTION_SCRIPT_MAX                                   0x000015ff
	#define URLACTION_HTML_MIN                                     0x00001600
	#define URLACTION_HTML_JAVA_RUN                                0x00001605 // derive from Java custom policy
	#define URLACTION_HTML_MAX                                     0x000017ff
	#define URLACTION_JAVA_MIN                                     0x00001C00
	#define URLACTION_JAVA_MAX                                     0x00001Cff

	#define INET_E_USE_DEFAULT_PROTOCOLHANDLER 0x800C0011L
	#define INET_E_USE_DEFAULT_SETTING         0x800C0012L
	#define INET_E_DEFAULT_ACTION              INET_E_USE_DEFAULT_PROTOCOLHANDLER
	#define INET_E_QUERYOPTION_UNKNOWN         0x800C0013L
	#define INET_E_REDIRECTING                 0x800C0014L

	// Permissions
	#define URLPOLICY_ALLOW                0x00
	#define URLPOLICY_QUERY                0x01
	#define URLPOLICY_DISALLOW             0x03

	static const CLSID IID_IInternetSecurityManager=
	{ 0x79eac9ee, 0xbaf9, 0x11ce,
	{ 0x8c, 0x82, 0x00, 0xaa, 0x00, 0x4b, 0xa9, 0x0b } };

	#define SID_SInternetSecurityManager         IID_IInternetSecurityManager

#ifdef __cplusplus
extern "C" {
#endif
#define INTERFACE IInternetSecurityMgrSite
DECLARE_INTERFACE_(IInternetSecurityMgrSite,IUnknown)
{
	STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
	STDMETHOD_(ULONG,AddRef)(THIS) PURE;
	STDMETHOD_(ULONG,Release)(THIS) PURE;
	STDMETHOD(GetWindow)(THIS_ HWND*) PURE;
	STDMETHOD(EnableModeless)(THIS_ BOOL) PURE;
};
#undef INTERFACE

#define INTERFACE IInternetSecurityManager
DECLARE_INTERFACE_(IInternetSecurityManager,IUnknown)
{
	STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
	STDMETHOD_(ULONG,AddRef)(THIS) PURE;
	STDMETHOD_(ULONG,Release)(THIS) PURE;

	STDMETHOD(SetSecuritySite)(THIS_ IInternetSecurityMgrSite*) PURE;
	STDMETHOD(GetSecuritySite)(THIS_ IInternetSecurityMgrSite**) PURE;
	STDMETHOD(MapUrlToZone)(THIS_ LPCWSTR,DWORD*,DWORD) PURE;
	STDMETHOD(GetSecurityId)(THIS_ LPCWSTR,BYTE*,DWORD*,DWORD_PTR) PURE;
	STDMETHOD(ProcessUrlAction)(THIS_ LPCWSTR,DWORD,BYTE*,DWORD,BYTE*,DWORD,DWORD,DWORD) PURE;
	STDMETHOD(QueryCustomPolicy)(THIS_ LPCWSTR,REFGUID,BYTE**,DWORD*,BYTE*,DWORD,DWORD) PURE;
	STDMETHOD(SetZoneMapping)(THIS_ DWORD,LPCWSTR,DWORD) PURE;
	STDMETHOD(GetZoneMappings)(THIS_ DWORD,IEnumString**,DWORD) PURE;
};
#undef INTERFACE


#ifdef __cplusplus
}
#endif

#endif

class IEViewSink:public  DWebBrowserEvents2 {
private:
	int		m_cRef;
	IEView *ieWindow;
public:
	IEViewSink(IEView *);
	virtual ~IEViewSink();
	// IDispatch
	STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv);
	STDMETHODIMP_(ULONG) AddRef(void);
	STDMETHODIMP_(ULONG) Release(void);

	STDMETHOD(GetTypeInfoCount)(UINT*);
	STDMETHOD(GetTypeInfo)(UINT, LCID, LPTYPEINFO*);
	STDMETHOD(GetIDsOfNames)(REFIID,LPOLESTR*,UINT,LCID,DISPID*);
	STDMETHOD(Invoke)(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
	// DWebBrowserEvents2
	STDMETHODIMP_(void)StatusTextChange(BSTR);
	STDMETHODIMP_(void)ProgressChange(long, long);
	STDMETHODIMP_(void)CommandStateChange(long, VARIANT_BOOL);
	STDMETHODIMP_(void)DownloadBegin();
	STDMETHODIMP_(void)DownloadComplete();
	STDMETHODIMP_(void)TitleChange(BSTR Text);
	STDMETHODIMP_(void)PropertyChange(BSTR Text);
	STDMETHODIMP_(void)BeforeNavigate2(IDispatch*,VARIANT*,VARIANT*,VARIANT*,VARIANT*,VARIANT*,VARIANT_BOOL*);
	STDMETHODIMP_(void)NewWindow2(IDispatch**, VARIANT_BOOL*);
	STDMETHODIMP_(void)NavigateComplete(IDispatch*, VARIANT*);
	STDMETHODIMP_(void)DocumentComplete(IDispatch*, VARIANT*);
	STDMETHODIMP_(void)OnQuit();
	STDMETHODIMP_(void)OnVisible(VARIANT_BOOL);
	STDMETHODIMP_(void)OnToolBar(VARIANT_BOOL);
	STDMETHODIMP_(void)OnMenuBar(VARIANT_BOOL);
	STDMETHODIMP_(void)OnStatusBar(VARIANT_BOOL);
	STDMETHODIMP_(void)OnFullScreen(VARIANT_BOOL);
	STDMETHODIMP_(void)OnTheaterMode(VARIANT_BOOL);
	STDMETHODIMP_(void)WindowSetResizable(VARIANT_BOOL);
	STDMETHODIMP_(void)WindowSetLeft(long);
	STDMETHODIMP_(void)WindowSetTop(long);
	STDMETHODIMP_(void)WindowSetWidth(long);
	STDMETHODIMP_(void)WindowSetHeight(long);
	STDMETHODIMP_(void)WindowClosing(VARIANT_BOOL, VARIANT_BOOL*);
	STDMETHODIMP_(void)ClientToHostWindow(long*,long*);
	STDMETHODIMP_(void)SetSecureLockIcon(long);
	STDMETHODIMP_(void)FileDownload(VARIANT_BOOL*);
};

class IEView:public IDispatch, public IOleClientSite, public IOleInPlaceSite, public IDocHostUIHandler, public IInternetSecurityManager, public IServiceProvider {
private:
	static IEView *list;
	static CRITICAL_SECTION mutex;
	static bool isInited;
	HWND parent;
	HWND hwnd;
	IEView *prev, *next;
	int m_cRef;
	RECT rcClient;
	BOOL m_bInPlaceActive;
	DWORD m_dwCookie;
	IConnectionPoint *m_pConnectionPoint;
	IEViewSink *sink;
	IWebBrowser2 *pWebBrowser;
	HTMLBuilder *builder;

	WNDPROC mainWndProc, docWndProc, serverWndProc;
	bool getFocus;
	bool clearRequired;
	BSTR selectedText;
	bool isContactSet;
	MCONTACT hContact;

	// IUnknown
	STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv);
	STDMETHODIMP_(ULONG) AddRef(void);
	STDMETHODIMP_(ULONG) Release(void);

	// IDispatch
	STDMETHOD(GetTypeInfoCount)(UINT*);
	STDMETHOD(GetTypeInfo)(UINT, LCID, LPTYPEINFO*);
	STDMETHOD(GetIDsOfNames)(REFIID,LPOLESTR*,UINT,LCID,DISPID*);
	STDMETHOD(Invoke)(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
	// IOleWindow
	STDMETHOD(GetWindow)(HWND *phwnd);
	STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode);
	// IOleInPlace
	STDMETHOD(CanInPlaceActivate)(void);
	STDMETHOD(OnInPlaceActivate)(void);
	STDMETHOD(OnUIActivate)(void);
	STDMETHOD(GetWindowContext)(IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc,
								LPRECT lprcPosRect, LPRECT lprcClipRect,
							   LPOLEINPLACEFRAMEINFO lpFrameInfo);
	STDMETHOD(Scroll)(SIZE scrollExtant);

	STDMETHOD(OnUIDeactivate)(BOOL fUndoable);
	STDMETHOD(OnInPlaceDeactivate)( void);
	STDMETHOD(DiscardUndoState)( void);
	STDMETHOD(DeactivateAndUndo)( void);
	STDMETHOD(OnPosRectChange)(LPCRECT lprcPosRect);
	// IOleClientSite
	STDMETHOD(SaveObject)(void);
	STDMETHOD(GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk);
	STDMETHOD(GetContainer)(IOleContainer **ppContainer);
	STDMETHOD(ShowObject)(void);
	STDMETHOD(OnShowWindow)(BOOL fShow);
	STDMETHOD(RequestNewObjectLayout)(void);

	// IDocHostUIHandler
	STDMETHOD(ShowContextMenu)(DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved);
	STDMETHOD(GetHostInfo)(DOCHOSTUIINFO *pInfo);
	STDMETHOD(ShowUI)(DWORD dwID, IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
					IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc);
	STDMETHOD(HideUI)(void);
	STDMETHOD(UpdateUI)(void);
	STDMETHOD(EnableModeless)(BOOL fEnable);
	STDMETHOD(OnDocWindowActivate)(BOOL fEnable);
	STDMETHOD(OnFrameWindowActivate)(BOOL fEnable);
	STDMETHOD(ResizeBorder)(LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow);
	STDMETHOD(TranslateAccelerator)(LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID);
	STDMETHOD(GetOptionKeyPath)(LPOLESTR *pchKey, DWORD dw);
	STDMETHOD(GetDropTarget)(IDropTarget *pDropTarget, IDropTarget **ppDropTarget);
	STDMETHOD(GetExternal)(IDispatch **ppDispatch);
	STDMETHOD(TranslateUrl)(DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut);
	STDMETHOD(FilterDataObject)(IDataObject *pDO, IDataObject **ppDORet);
	// IServiceProvider
	STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void** ppvObject);
	// IInternetSecurityManager
	STDMETHOD(SetSecuritySite)(IInternetSecurityMgrSite *pSite);
	STDMETHOD(GetSecuritySite)(IInternetSecurityMgrSite **ppSite);
	STDMETHOD(MapUrlToZone)(LPCWSTR pwszUrl, DWORD *pdwZone, DWORD dwFlags);
	STDMETHOD(GetSecurityId)(LPCWSTR pwszUrl, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved);
	STDMETHOD(ProcessUrlAction)(LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved);
	STDMETHOD(QueryCustomPolicy)(LPCWSTR pwszUrl, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved);
	STDMETHOD(SetZoneMapping)(DWORD dwZone, LPCWSTR lpszPattern, DWORD dwFlags);
	STDMETHOD(GetZoneMappings)(DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags);

	IHTMLDocument2 *getDocument();
	BSTR			getHrefFromAnchor(IHTMLElement *element);
	BSTR			getSelection();
	void			setBorder();
protected:
	void			navigate(const char *);
	void			navigate(const wchar_t *);
public:
	IEView(HWND parent, HTMLBuilder* builder, int x, int y, int cx, int cy);
//	IEView::IEView(HWND parent, SmileyWindow* smileyWindow, int x, int y, int cx, int cy);
	virtual ~IEView();

	void			waitWhileBusy();
	HWND			getHWND();
	void 			translateAccelerator(UINT uMsg, WPARAM wParam, LPARAM lParam);
	bool			mouseClick(POINT pt);
	bool			mouseActivate();
	bool			setFocus(HWND prevFocus);
	void			setWindowPos(int x, int y, int cx, int cy);
	HTMLBuilder*    getBuilder();

	void			write(const wchar_t *text);
	void			write(const char *text);
	void			writef(const char *fmt, ...);
	void			documentClose();
	void			rebuildLog();
	void			scrollToBottom();
	void			scrollToBottomSoft();
	void			scrollToTop();

	void            setMainWndProc(WNDPROC);
	WNDPROC         getMainWndProc();
	void            setDocWndProc(WNDPROC);
	WNDPROC         getDocWndProc();
	void            setServerWndProc(WNDPROC);
	WNDPROC         getServerWndProc();

	void            appendEventOld(IEVIEWEVENT * event);
	void            appendEvent(IEVIEWEVENT * event);
	void            clear(IEVIEWEVENT * event);
	void*           getSelection(IEVIEWEVENT * event);
	void            navigate(IEVIEWNAVIGATE * nav);
	void            saveDocument();

	void			setContact(MCONTACT hContact);

	static IEView*	get(HWND);
	static void		init();
	static void		release();
	static void		setOptions();

};
#endif