Added default MSHTML context menu.
[wine] / dlls / mshtml / mshtml_private.h
1 /*
2  * Copyright 2005 Jacek Caban
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "docobj.h"
20 #include "mshtml.h"
21 #include "mshtmhst.h"
22
23 #ifdef INIT_GUID
24 #include "initguid.h"
25 #endif
26
27 #include "nsiface.h"
28
29 #define NS_OK                     ((nsresult)0x00000000L)
30 #define NS_NOINTERFACE            ((nsresult)0x80004002L)
31 #define NS_ERROR_NOT_IMPLEMENTED  ((nsresult)0x80004001L)
32 #define NS_ERROR_INVALID_ARG      ((nsresult)0x80070057L) 
33
34 #define NS_FAILED(res) ((res) & 0x80000000)
35 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
36
37 #define NSAPI WINAPI
38
39 typedef struct NSContainer NSContainer;
40 typedef struct BindStatusCallback BindStatusCallback;
41
42 typedef struct {
43     const IHTMLDocument2Vtbl              *lpHTMLDocument2Vtbl;
44     const IPersistMonikerVtbl             *lpPersistMonikerVtbl;
45     const IPersistFileVtbl                *lpPersistFileVtbl;
46     const IMonikerPropVtbl                *lpMonikerPropVtbl;
47     const IOleObjectVtbl                  *lpOleObjectVtbl;
48     const IOleDocumentVtbl                *lpOleDocumentVtbl;
49     const IOleDocumentViewVtbl            *lpOleDocumentViewVtbl;
50     const IOleInPlaceActiveObjectVtbl     *lpOleInPlaceActiveObjectVtbl;
51     const IViewObject2Vtbl                *lpViewObject2Vtbl;
52     const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
53     const IServiceProviderVtbl            *lpServiceProviderVtbl;
54     const IOleCommandTargetVtbl           *lpOleCommandTargetVtbl;
55     const IOleControlVtbl                 *lpOleControlVtbl;
56
57     LONG ref;
58
59     NSContainer *nscontainer;
60
61     IOleClientSite *client;
62     IDocHostUIHandler *hostui;
63     IOleInPlaceSite *ipsite;
64     IOleInPlaceFrame *frame;
65
66     HWND hwnd;
67
68     BOOL in_place_active;
69     BOOL ui_active;
70     BOOL window_active;
71     BOOL has_key_path;
72     BOOL container_locked;
73
74     BindStatusCallback *status_callback;
75 } HTMLDocument;
76
77 struct NSContainer {
78     const nsIWebBrowserChromeVtbl     *lpWebBrowserChromeVtbl;
79     const nsIContextMenuListenerVtbl  *lpContextMenuListenerVtbl;
80
81     nsIWebBrowser *webbrowser;
82     nsIWebNavigation *navigation;
83     nsIBaseWindow *window;
84     nsIWebBrowserStream *stream;
85
86     HTMLDocument *doc;
87
88     HWND hwnd;
89 };
90
91 #define HTMLDOC(x)       ((IHTMLDocument2*)               &(x)->lpHTMLDocument2Vtbl)
92 #define PERSIST(x)       ((IPersist*)                     &(x)->lpPersistFileVtbl)
93 #define PERSISTMON(x)    ((IPersistMoniker*)              &(x)->lpPersistMonikerVtbl)
94 #define PERSISTFILE(x)   ((IPersistFile*)                 &(x)->lpPersistFileVtbl)
95 #define MONPROP(x)       ((IMonikerProp*)                 &(x)->lpMonikerPropVtbl)
96 #define OLEOBJ(x)        ((IOleObject*)                   &(x)->lpOleObjectVtbl)
97 #define OLEDOC(x)        ((IOleDocument*)                 &(x)->lpOleDocumentVtbl)
98 #define DOCVIEW(x)       ((IOleDocumentView*)             &(x)->lpOleDocumentViewVtbl)
99 #define OLEWIN(x)        ((IOleWindow*)                   &(x)->lpOleInPlaceActiveObjectVtbl)
100 #define ACTOBJ(x)        ((IOleInPlaceActiveObject*)      &(x)->lpOleInPlaceActiveObjectVtbl)
101 #define VIEWOBJ(x)       ((IViewObject*)                  &(x)->lpViewObject2Vtbl)
102 #define VIEWOBJ2(x)      ((IViewObject2*)                 &(x)->lpViewObject2Vtbl)
103 #define INPLACEOBJ(x)    ((IOleInPlaceObject*)            &(x)->lpOleInPlaceObjectWindowlessVtbl)
104 #define INPLACEWIN(x)    ((IOleInPlaceObjectWindowless*)  &(x)->lpOleInPlaceObjectWindowlessVtbl)
105 #define SERVPROV(x)      ((IServiceProvider*)             &(x)->lpServiceProviderVtbl)
106 #define CMDTARGET(x)     ((IOleCommandTarget*)            &(x)->lpOleCommandTargetVtbl)
107 #define CONTROL(x)       ((IOleControl*)                  &(x)->lpOleControlVtbl)
108 #define STATUSCLB(x)     ((IBindStatusCallback*)          &(x)->lpBindStatusCallbackVtbl)
109
110 #define NSWBCHROME(x)    ((nsIWebBrowserChrome*)          &(x)->lpWebBrowserChromeVtbl)
111 #define NSCML(x)         ((nsIContextMenuListener*)       &(x)->lpContextMenuListenerVtbl)
112
113 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
114
115 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
116
117 void HTMLDocument_Persist_Init(HTMLDocument*);
118 void HTMLDocument_OleObj_Init(HTMLDocument*);
119 void HTMLDocument_View_Init(HTMLDocument*);
120 void HTMLDocument_Window_Init(HTMLDocument*);
121 void HTMLDocument_Service_Init(HTMLDocument*);
122 void HTMLDocument_NSContainer_Init(HTMLDocument*);
123
124 void HTMLDocument_NSContainer_Destroy(HTMLDocument*);
125
126 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
127 void HTMLDocument_ShowContextMenu(HTMLDocument*,DWORD,POINT*);
128
129 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
130
131 void close_gecko(void);
132
133 nsIURI *get_nsIURI(LPCWSTR);
134
135 nsACString *nsACString_Create(void);
136 void nsACString_SetData(nsACString*,const char*);
137 void nsACString_Destroy(nsACString*);
138
139 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
140 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
141 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
142 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
143 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
144
145 extern LONG module_ref;
146 #define LOCK_MODULE()   InterlockedIncrement(&module_ref)
147 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
148
149 extern HINSTANCE hInst;