shdocvw.h 9.03 KB
Newer Older
1
/*
2 3
 * Header includes for shdocvw.dll
 *
4
 * Copyright 2001 John R. Sheets (for CodeWeavers)
5
 * Copyright 2005-2006 Jacek Caban for CodeWeavers
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 21
 */

22 23 24
#ifndef __WINE_SHDOCVW_H
#define __WINE_SHDOCVW_H

25 26
#define COBJMACROS

27 28 29
#include <stdarg.h>

#include "windef.h"
30
#include "winbase.h"
31
#include "wingdi.h"
32 33
#include "winuser.h"

34 35 36
#include "ole2.h"
#include "olectl.h"
#include "shlobj.h"
37
#include "exdisp.h"
38
#include "mshtmhst.h"
39
#include "hlink.h"
40
#include "htiframe.h"
41

42
#include "wine/unicode.h"
43
#include "wine/list.h"
44 45
#include "resource.h"

46

47 48
#define WM_UPDATEADDRBAR    (WM_APP+1)

49 50 51 52 53
/**********************************************************************
 * Shell Instance Objects
 */
extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid, 
    REFIID riid, LPVOID *ppvClassObj);
54 55

/**********************************************************************
56
 * WebBrowser declaration for SHDOCVW.DLL
57
 */
58 59

typedef struct ConnectionPoint ConnectionPoint;
60
typedef struct DocHost DocHost;
61

62
typedef struct {
63
    IConnectionPointContainer IConnectionPointContainer_iface;
64

65 66 67
    ConnectionPoint *wbe2;
    ConnectionPoint *wbe;
    ConnectionPoint *pns;
68 69

    IUnknown *impl;
70 71
} ConnectionPointContainer;

72
typedef struct {
73 74
    IHlinkFrame    IHlinkFrame_iface;
    ITargetFrame2  ITargetFrame2_iface;
75 76 77 78 79

    IUnknown *outer;
    DocHost *doc_host;
} HlinkFrame;

80 81 82 83 84 85 86 87
struct _task_header_t;

typedef void (*task_proc_t)(DocHost*, struct _task_header_t*);

typedef struct _task_header_t {
    task_proc_t proc;
} task_header_t;

88 89
typedef struct _IDocHostContainerVtbl
{
90 91
    ULONG (*addref)(DocHost*);
    ULONG (*release)(DocHost*);
92 93 94
    void (WINAPI* GetDocObjRect)(DocHost*,RECT*);
    HRESULT (WINAPI* SetStatusText)(DocHost*,LPCWSTR);
    void (WINAPI* SetURL)(DocHost*,LPCWSTR);
95
    HRESULT (*exec)(DocHost*,const GUID*,DWORD,DWORD,VARIANT*,VARIANT*);
96 97
} IDocHostContainerVtbl;

98
struct DocHost {
99
    IOleClientSite      IOleClientSite_iface;
100 101 102
    IOleInPlaceSite     IOleInPlaceSite_iface;
    IDocHostUIHandler2  IDocHostUIHandler2_iface;
    IOleDocumentSite    IOleDocumentSite_iface;
103
    IOleControlSite     IOleControlSite_iface;
104 105 106 107
    IOleCommandTarget   IOleCommandTarget_iface;
    IDispatch           IDispatch_iface;
    IPropertyNotifySink IPropertyNotifySink_iface;
    IServiceProvider    IServiceProvider_iface;
108

109
    /* Interfaces of InPlaceFrame object */
110
    IOleInPlaceFrame  IOleInPlaceFrame_iface;
111

112 113
    IDispatch *disp;

114 115
    IDispatch *client_disp;
    IDocHostUIHandler *hostui;
116
    IOleInPlaceFrame *frame;
117

118 119
    IUnknown *document;
    IOleDocumentView *view;
120
    IUnknown *doc_navigate;
121

122 123
    const IDocHostContainerVtbl *container_vtbl;

124 125
    HWND hwnd;
    HWND frame_hwnd;
126

127 128
    LPOLESTR url;

129 130
    VARIANT_BOOL silent;
    VARIANT_BOOL offline;
131
    VARIANT_BOOL busy;
132

133
    READYSTATE ready_state;
134
    READYSTATE doc_state;
135 136 137
    DWORD prop_notif_cookie;
    BOOL is_prop_notif;

138
    ConnectionPointContainer cps;
139
};
140

141
struct WebBrowser {
142 143 144 145
    IWebBrowser2             IWebBrowser2_iface;
    IOleObject               IOleObject_iface;
    IOleInPlaceObject        IOleInPlaceObject_iface;
    IOleControl              IOleControl_iface;
146 147 148 149 150
    IPersistStorage          IPersistStorage_iface;
    IPersistMemory           IPersistMemory_iface;
    IPersistStreamInit       IPersistStreamInit_iface;
    IProvideClassInfo2       IProvideClassInfo2_iface;
    IViewObject2             IViewObject2_iface;
151 152 153
    IOleInPlaceActiveObject  IOleInPlaceActiveObject_iface;
    IOleCommandTarget        IOleCommandTarget_iface;
    IServiceProvider         IServiceProvider_iface;
154
    IDataObject              IDataObject_iface;
155
    HlinkFrame hlink_frame;
156

157
    LONG ref;
158

159 160
    INT version;

161
    IOleClientSite *client;
162
    IOleContainer *container;
163
    IOleInPlaceSite *inplace;
164 165 166 167 168 169 170 171

    /* window context */

    HWND frame_hwnd;
    IOleInPlaceUIWindow *uiwindow;
    RECT pos_rect;
    RECT clip_rect;
    OLEINPLACEFRAMEINFO frameinfo;
172
    SIZEL extent;
173

174 175
    HWND shell_embedding_hwnd;

176
    VARIANT_BOOL register_browser;
177
    VARIANT_BOOL visible;
178
    VARIANT_BOOL menu_bar;
179
    VARIANT_BOOL address_bar;
180
    VARIANT_BOOL status_bar;
181
    VARIANT_BOOL tool_bar;
182
    VARIANT_BOOL full_screen;
183
    VARIANT_BOOL theater_mode;
184

185
    DocHost doc_host;
186
};
187

188 189 190 191 192 193 194 195
typedef struct {
    DocHost doc_host;

    LONG ref;

    InternetExplorer *ie;
} IEDocHost;

196
struct InternetExplorer {
197
    IWebBrowser2 IWebBrowser2_iface;
198
    HlinkFrame hlink_frame;
199 200 201 202

    LONG ref;

    HWND frame_hwnd;
203
    HWND status_hwnd;
204
    HMENU menu;
205
    BOOL nohome;
206

207
    struct list entry;
208
    IEDocHost *doc_host;
209
};
210

211
void WebBrowser_OleObject_Init(WebBrowser*);
212
void WebBrowser_ViewObject_Init(WebBrowser*);
213
void WebBrowser_Persist_Init(WebBrowser*);
214
void WebBrowser_ClassInfo_Init(WebBrowser*);
215

216 217
void WebBrowser_OleObject_Destroy(WebBrowser*);

218
void DocHost_Init(DocHost*,IDispatch*,const IDocHostContainerVtbl*);
219 220
void DocHost_ClientSite_Init(DocHost*);
void DocHost_Frame_Init(DocHost*);
221
void release_dochost_client(DocHost*);
222

223 224
void DocHost_Release(DocHost*);
void DocHost_ClientSite_Release(DocHost*);
225 226 227

void ConnectionPointContainer_Init(ConnectionPointContainer*,IUnknown*);
void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
228

229 230 231
void HlinkFrame_Init(HlinkFrame*,IUnknown*,DocHost*);
BOOL HlinkFrame_QI(HlinkFrame*,REFIID,void**);

232
HRESULT ShellBrowser_Create(IShellBrowser**);
233 234
HRESULT WebBrowserV1_Create(IUnknown*,REFIID,void**);
HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
235

236
void create_doc_view_hwnd(DocHost*);
237
void deactivate_document(DocHost*);
238
HRESULT dochost_object_available(DocHost*,IUnknown*);
239
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
240
HRESULT navigate_url(DocHost*,LPCWSTR,const VARIANT*,const VARIANT*,VARIANT*,VARIANT*);
241
HRESULT go_home(DocHost*);
242
void set_doc_state(DocHost*,READYSTATE);
243
HRESULT get_location_url(DocHost*,BSTR*);
244
void handle_navigation_error(DocHost*,HRESULT,BSTR,IHTMLWindow2*);
Jacek Caban's avatar
Jacek Caban committed
245

246 247 248 249
#define WM_DOCHOSTTASK (WM_USER+0x300)
void push_dochost_task(DocHost*,task_header_t*,task_proc_t,BOOL);
LRESULT  process_dochost_task(DocHost*,LPARAM);

250 251 252
HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
void InternetExplorer_WebBrowser_Init(InternetExplorer*);

253 254
void released_obj(void);

255 256
HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);

257 258
HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**);

259 260
HRESULT TaskbarList_Create(IUnknown*,REFIID,void**);

261 262 263 264
/**********************************************************************
 * Dll lifetime tracking declaration for shdocvw.dll
 */
extern LONG SHDOCVW_refCount;
265 266
static inline void SHDOCVW_LockModule(void) { InterlockedIncrement( &SHDOCVW_refCount ); }
static inline void SHDOCVW_UnlockModule(void) { InterlockedDecrement( &SHDOCVW_refCount ); }
267

268
extern HINSTANCE shdocvw_hinstance;
269 270
extern void register_iewindow_class(void);
extern void unregister_iewindow_class(void);
271
extern HRESULT update_ie_statustext(InternetExplorer*, LPCWSTR);
272

273
HRESULT register_class_object(BOOL);
274
HRESULT get_typeinfo(ITypeInfo**);
275
DWORD register_iexplore(BOOL);
276

277 278
const char *debugstr_variant(const VARIANT*);

279 280
/* memory allocation functions */

281
static inline void *heap_alloc(size_t len)
282 283 284 285
{
    return HeapAlloc(GetProcessHeap(), 0, len);
}

286 287 288 289 290
static inline void *heap_alloc_zero(size_t len)
{
    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}

291
static inline void *heap_realloc(void *mem, size_t len)
292 293 294 295
{
    return HeapReAlloc(GetProcessHeap(), 0, mem, len);
}

296
static inline BOOL heap_free(void *mem)
297 298 299 300
{
    return HeapFree(GetProcessHeap(), 0, mem);
}

301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
static inline LPWSTR heap_strdupW(LPCWSTR str)
{
    LPWSTR ret = NULL;

    if(str) {
        DWORD size;

        size = (strlenW(str)+1)*sizeof(WCHAR);
        ret = heap_alloc(size);
        memcpy(ret, str, size);
    }

    return ret;
}

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
static inline LPWSTR co_strdupW(LPCWSTR str)
{
    WCHAR *ret = CoTaskMemAlloc((strlenW(str) + 1)*sizeof(WCHAR));
    if (ret)
        lstrcpyW(ret, str);
    return ret;
}

static inline LPWSTR co_strdupAtoW(LPCSTR str)
{
    INT len;
    WCHAR *ret;
    len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
    ret = CoTaskMemAlloc(len*sizeof(WCHAR));
    if (ret)
        MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
    return ret;
}

static inline LPSTR co_strdupWtoA(LPCWSTR str)
{
    INT len;
    CHAR *ret;
    len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, 0, 0);
    ret = CoTaskMemAlloc(len);
    if (ret)
        WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
    return ret;
}

346
#endif /* __WINE_SHDOCVW_H */