- Call LockContainer only if it's not already locked/unlocked.
[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
33 #define NS_FAILED(res) ((res) & 0x80000000)
34 #define NS_SUCCEEDED(res) (!NS_FAILED(res))
35
36 typedef struct NSContainer NSContainer;
37 typedef struct BindStatusCallback BindStatusCallback;
38
39 typedef struct {
40     const IHTMLDocument2Vtbl              *lpHTMLDocument2Vtbl;
41     const IPersistMonikerVtbl             *lpPersistMonikerVtbl;
42     const IPersistFileVtbl                *lpPersistFileVtbl;
43     const IMonikerPropVtbl                *lpMonikerPropVtbl;
44     const IOleObjectVtbl                  *lpOleObjectVtbl;
45     const IOleDocumentVtbl                *lpOleDocumentVtbl;
46     const IOleDocumentViewVtbl            *lpOleDocumentViewVtbl;
47     const IOleInPlaceActiveObjectVtbl     *lpOleInPlaceActiveObjectVtbl;
48     const IViewObject2Vtbl                *lpViewObject2Vtbl;
49     const IOleInPlaceObjectWindowlessVtbl *lpOleInPlaceObjectWindowlessVtbl;
50     const IServiceProviderVtbl            *lpServiceProviderVtbl;
51     const IOleCommandTargetVtbl           *lpOleCommandTargetVtbl;
52     const IOleControlVtbl                 *lpOleControlVtbl;
53
54     LONG ref;
55
56     NSContainer *nscontainer;
57
58     IOleClientSite *client;
59     IDocHostUIHandler *hostui;
60     IOleInPlaceSite *ipsite;
61     IOleInPlaceFrame *frame;
62
63     HWND hwnd;
64
65     BOOL in_place_active;
66     BOOL ui_active;
67     BOOL window_active;
68     BOOL has_key_path;
69     BOOL container_locked;
70
71     BindStatusCallback *status_callback;
72 } HTMLDocument;
73
74 struct NSContainer {
75     nsIWebBrowser *webbrowser;
76     nsIWebNavigation *navigation;
77     nsIBaseWindow *window;
78     nsIWebBrowserStream *stream;
79
80     HWND hwnd;
81 };
82
83 #define HTMLDOC(x)       ((IHTMLDocument2*)               &(x)->lpHTMLDocument2Vtbl)
84 #define PERSIST(x)       ((IPersist*)                     &(x)->lpPersistFileVtbl)
85 #define PERSISTMON(x)    ((IPersistMoniker*)              &(x)->lpPersistMonikerVtbl)
86 #define PERSISTFILE(x)   ((IPersistFile*)                 &(x)->lpPersistFileVtbl)
87 #define MONPROP(x)       ((IMonikerProp*)                 &(x)->lpMonikerPropVtbl)
88 #define OLEOBJ(x)        ((IOleObject*)                   &(x)->lpOleObjectVtbl)
89 #define OLEDOC(x)        ((IOleDocument*)                 &(x)->lpOleDocumentVtbl)
90 #define DOCVIEW(x)       ((IOleDocumentView*)             &(x)->lpOleDocumentViewVtbl)
91 #define OLEWIN(x)        ((IOleWindow*)                   &(x)->lpOleInPlaceActiveObjectVtbl)
92 #define ACTOBJ(x)        ((IOleInPlaceActiveObject*)      &(x)->lpOleInPlaceActiveObjectVtbl)
93 #define VIEWOBJ(x)       ((IViewObject*)                  &(x)->lpViewObject2Vtbl)
94 #define VIEWOBJ2(x)      ((IViewObject2*)                 &(x)->lpViewObject2Vtbl)
95 #define INPLACEOBJ(x)    ((IOleInPlaceObject*)            &(x)->lpOleInPlaceObjectWindowlessVtbl)
96 #define INPLACEWIN(x)    ((IOleInPlaceObjectWindowless*)  &(x)->lpOleInPlaceObjectWindowlessVtbl)
97 #define SERVPROV(x)      ((IServiceProvider*)             &(x)->lpServiceProviderVtbl)
98 #define CMDTARGET(x)     ((IOleCommandTarget*)            &(x)->lpOleCommandTargetVtbl)
99 #define CONTROL(x)       ((IOleControl*)                  &(x)->lpOleControlVtbl)
100 #define STATUSCLB(x)     ((IBindStatusCallback*)          &(x)->lpBindStatusCallbackVtbl)
101
102 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
103
104 HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
105
106 void HTMLDocument_Persist_Init(HTMLDocument*);
107 void HTMLDocument_OleObj_Init(HTMLDocument*);
108 void HTMLDocument_View_Init(HTMLDocument*);
109 void HTMLDocument_Window_Init(HTMLDocument*);
110 void HTMLDocument_Service_Init(HTMLDocument*);
111 void HTMLDocument_NSContainer_Init(HTMLDocument*);
112
113 void HTMLDocument_NSContainer_Destroy(HTMLDocument*);
114
115 void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
116
117 HRESULT ProtocolFactory_Create(REFCLSID,REFIID,void**);
118
119 void close_gecko(void);
120
121 nsIURI *get_nsIURI(LPCWSTR);
122
123 nsACString *nsACString_Create(void);
124 void nsACString_SetData(nsACString*,const char*);
125 void nsACString_Destroy(nsACString*);
126
127 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
128 DEFINE_GUID(CLSID_JSProtocol, 0x3050F3B2, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
129 DEFINE_GUID(CLSID_MailtoProtocol, 0x3050F3DA, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
130 DEFINE_GUID(CLSID_ResProtocol, 0x3050F3BC, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
131 DEFINE_GUID(CLSID_SysimageProtocol, 0x76E67A63, 0x06E9, 0x11D2, 0xA8,0x40, 0x00,0x60,0x08,0x05,0x93,0x82);
132
133 extern LONG module_ref;
134 #define LOCK_MODULE()   InterlockedIncrement(&module_ref)
135 #define UNLOCK_MODULE() InterlockedDecrement(&module_ref)
136
137 extern HINSTANCE hInst;