1*c2c66affSColin Finck /*
2*c2c66affSColin Finck * Copyright 2005 Jacek Caban
3*c2c66affSColin Finck *
4*c2c66affSColin Finck * This library is free software; you can redistribute it and/or
5*c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
6*c2c66affSColin Finck * License as published by the Free Software Foundation; either
7*c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
8*c2c66affSColin Finck *
9*c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
10*c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12*c2c66affSColin Finck * Lesser General Public License for more details.
13*c2c66affSColin Finck *
14*c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
15*c2c66affSColin Finck * License along with this library; if not, write to the Free Software
16*c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17*c2c66affSColin Finck */
18*c2c66affSColin Finck
19*c2c66affSColin Finck #include "mshtml_private.h"
20*c2c66affSColin Finck
21*c2c66affSColin Finck #define DOCHOST_DOCCANNAVIGATE 0
22*c2c66affSColin Finck
23*c2c66affSColin Finck typedef struct {
24*c2c66affSColin Finck IEnumUnknown IEnumUnknown_iface;
25*c2c66affSColin Finck LONG ref;
26*c2c66affSColin Finck } EnumUnknown;
27*c2c66affSColin Finck
impl_from_IEnumUnknown(IEnumUnknown * iface)28*c2c66affSColin Finck static inline EnumUnknown *impl_from_IEnumUnknown(IEnumUnknown *iface)
29*c2c66affSColin Finck {
30*c2c66affSColin Finck return CONTAINING_RECORD(iface, EnumUnknown, IEnumUnknown_iface);
31*c2c66affSColin Finck }
32*c2c66affSColin Finck
EnumUnknown_QueryInterface(IEnumUnknown * iface,REFIID riid,void ** ppv)33*c2c66affSColin Finck static HRESULT WINAPI EnumUnknown_QueryInterface(IEnumUnknown *iface, REFIID riid, void **ppv)
34*c2c66affSColin Finck {
35*c2c66affSColin Finck EnumUnknown *This = impl_from_IEnumUnknown(iface);
36*c2c66affSColin Finck
37*c2c66affSColin Finck if(IsEqualGUID(&IID_IUnknown, riid)) {
38*c2c66affSColin Finck TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
39*c2c66affSColin Finck *ppv = &This->IEnumUnknown_iface;
40*c2c66affSColin Finck }else if(IsEqualGUID(&IID_IEnumUnknown, riid)) {
41*c2c66affSColin Finck TRACE("(%p)->(IID_IEnumUnknown %p)\n", This, ppv);
42*c2c66affSColin Finck *ppv = &This->IEnumUnknown_iface;
43*c2c66affSColin Finck }else {
44*c2c66affSColin Finck WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
45*c2c66affSColin Finck *ppv = NULL;
46*c2c66affSColin Finck return E_NOINTERFACE;
47*c2c66affSColin Finck }
48*c2c66affSColin Finck
49*c2c66affSColin Finck IUnknown_AddRef((IUnknown*)*ppv);
50*c2c66affSColin Finck return S_OK;
51*c2c66affSColin Finck }
52*c2c66affSColin Finck
EnumUnknown_AddRef(IEnumUnknown * iface)53*c2c66affSColin Finck static ULONG WINAPI EnumUnknown_AddRef(IEnumUnknown *iface)
54*c2c66affSColin Finck {
55*c2c66affSColin Finck EnumUnknown *This = impl_from_IEnumUnknown(iface);
56*c2c66affSColin Finck LONG ref = InterlockedIncrement(&This->ref);
57*c2c66affSColin Finck
58*c2c66affSColin Finck TRACE("(%p) ref=%d\n", This, ref);
59*c2c66affSColin Finck
60*c2c66affSColin Finck return ref;
61*c2c66affSColin Finck }
62*c2c66affSColin Finck
EnumUnknown_Release(IEnumUnknown * iface)63*c2c66affSColin Finck static ULONG WINAPI EnumUnknown_Release(IEnumUnknown *iface)
64*c2c66affSColin Finck {
65*c2c66affSColin Finck EnumUnknown *This = impl_from_IEnumUnknown(iface);
66*c2c66affSColin Finck LONG ref = InterlockedDecrement(&This->ref);
67*c2c66affSColin Finck
68*c2c66affSColin Finck TRACE("(%p) ref=%d\n", This, ref);
69*c2c66affSColin Finck
70*c2c66affSColin Finck if(!ref)
71*c2c66affSColin Finck heap_free(This);
72*c2c66affSColin Finck
73*c2c66affSColin Finck return ref;
74*c2c66affSColin Finck }
75*c2c66affSColin Finck
EnumUnknown_Next(IEnumUnknown * iface,ULONG celt,IUnknown ** rgelt,ULONG * pceltFetched)76*c2c66affSColin Finck static HRESULT WINAPI EnumUnknown_Next(IEnumUnknown *iface, ULONG celt, IUnknown **rgelt, ULONG *pceltFetched)
77*c2c66affSColin Finck {
78*c2c66affSColin Finck EnumUnknown *This = impl_from_IEnumUnknown(iface);
79*c2c66affSColin Finck
80*c2c66affSColin Finck TRACE("(%p)->(%u %p %p)\n", This, celt, rgelt, pceltFetched);
81*c2c66affSColin Finck
82*c2c66affSColin Finck /* FIXME: It's not clear if we should ever return something here */
83*c2c66affSColin Finck if(pceltFetched)
84*c2c66affSColin Finck *pceltFetched = 0;
85*c2c66affSColin Finck return S_FALSE;
86*c2c66affSColin Finck }
87*c2c66affSColin Finck
EnumUnknown_Skip(IEnumUnknown * iface,ULONG celt)88*c2c66affSColin Finck static HRESULT WINAPI EnumUnknown_Skip(IEnumUnknown *iface, ULONG celt)
89*c2c66affSColin Finck {
90*c2c66affSColin Finck EnumUnknown *This = impl_from_IEnumUnknown(iface);
91*c2c66affSColin Finck FIXME("(%p)->(%u)\n", This, celt);
92*c2c66affSColin Finck return E_NOTIMPL;
93*c2c66affSColin Finck }
94*c2c66affSColin Finck
EnumUnknown_Reset(IEnumUnknown * iface)95*c2c66affSColin Finck static HRESULT WINAPI EnumUnknown_Reset(IEnumUnknown *iface)
96*c2c66affSColin Finck {
97*c2c66affSColin Finck EnumUnknown *This = impl_from_IEnumUnknown(iface);
98*c2c66affSColin Finck FIXME("(%p)\n", This);
99*c2c66affSColin Finck return E_NOTIMPL;
100*c2c66affSColin Finck }
101*c2c66affSColin Finck
EnumUnknown_Clone(IEnumUnknown * iface,IEnumUnknown ** ppenum)102*c2c66affSColin Finck static HRESULT WINAPI EnumUnknown_Clone(IEnumUnknown *iface, IEnumUnknown **ppenum)
103*c2c66affSColin Finck {
104*c2c66affSColin Finck EnumUnknown *This = impl_from_IEnumUnknown(iface);
105*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, ppenum);
106*c2c66affSColin Finck return E_NOTIMPL;
107*c2c66affSColin Finck }
108*c2c66affSColin Finck
109*c2c66affSColin Finck static const IEnumUnknownVtbl EnumUnknownVtbl = {
110*c2c66affSColin Finck EnumUnknown_QueryInterface,
111*c2c66affSColin Finck EnumUnknown_AddRef,
112*c2c66affSColin Finck EnumUnknown_Release,
113*c2c66affSColin Finck EnumUnknown_Next,
114*c2c66affSColin Finck EnumUnknown_Skip,
115*c2c66affSColin Finck EnumUnknown_Reset,
116*c2c66affSColin Finck EnumUnknown_Clone
117*c2c66affSColin Finck };
118*c2c66affSColin Finck
119*c2c66affSColin Finck /**********************************************************
120*c2c66affSColin Finck * IOleObject implementation
121*c2c66affSColin Finck */
122*c2c66affSColin Finck
impl_from_IOleObject(IOleObject * iface)123*c2c66affSColin Finck static inline HTMLDocument *impl_from_IOleObject(IOleObject *iface)
124*c2c66affSColin Finck {
125*c2c66affSColin Finck return CONTAINING_RECORD(iface, HTMLDocument, IOleObject_iface);
126*c2c66affSColin Finck }
127*c2c66affSColin Finck
OleObject_QueryInterface(IOleObject * iface,REFIID riid,void ** ppv)128*c2c66affSColin Finck static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
129*c2c66affSColin Finck {
130*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
131*c2c66affSColin Finck return htmldoc_query_interface(This, riid, ppv);
132*c2c66affSColin Finck }
133*c2c66affSColin Finck
OleObject_AddRef(IOleObject * iface)134*c2c66affSColin Finck static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
135*c2c66affSColin Finck {
136*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
137*c2c66affSColin Finck return htmldoc_addref(This);
138*c2c66affSColin Finck }
139*c2c66affSColin Finck
OleObject_Release(IOleObject * iface)140*c2c66affSColin Finck static ULONG WINAPI OleObject_Release(IOleObject *iface)
141*c2c66affSColin Finck {
142*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
143*c2c66affSColin Finck return htmldoc_release(This);
144*c2c66affSColin Finck }
145*c2c66affSColin Finck
update_hostinfo(HTMLDocumentObj * This,DOCHOSTUIINFO * hostinfo)146*c2c66affSColin Finck static void update_hostinfo(HTMLDocumentObj *This, DOCHOSTUIINFO *hostinfo)
147*c2c66affSColin Finck {
148*c2c66affSColin Finck nsIScrollable *scrollable;
149*c2c66affSColin Finck nsresult nsres;
150*c2c66affSColin Finck
151*c2c66affSColin Finck if(!This->nscontainer)
152*c2c66affSColin Finck return;
153*c2c66affSColin Finck
154*c2c66affSColin Finck nsres = nsIWebBrowser_QueryInterface(This->nscontainer->webbrowser, &IID_nsIScrollable, (void**)&scrollable);
155*c2c66affSColin Finck if(NS_SUCCEEDED(nsres)) {
156*c2c66affSColin Finck nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_Y,
157*c2c66affSColin Finck (hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO) ? Scrollbar_Never : Scrollbar_Always);
158*c2c66affSColin Finck if(NS_FAILED(nsres))
159*c2c66affSColin Finck ERR("Could not set default Y scrollbar prefs: %08x\n", nsres);
160*c2c66affSColin Finck
161*c2c66affSColin Finck nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_X,
162*c2c66affSColin Finck hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO ? Scrollbar_Never : Scrollbar_Auto);
163*c2c66affSColin Finck if(NS_FAILED(nsres))
164*c2c66affSColin Finck ERR("Could not set default X scrollbar prefs: %08x\n", nsres);
165*c2c66affSColin Finck
166*c2c66affSColin Finck nsIScrollable_Release(scrollable);
167*c2c66affSColin Finck }else {
168*c2c66affSColin Finck ERR("Could not get nsIScrollable: %08x\n", nsres);
169*c2c66affSColin Finck }
170*c2c66affSColin Finck }
171*c2c66affSColin Finck
172*c2c66affSColin Finck /* Calls undocumented 84 cmd of CGID_ShellDocView */
call_docview_84(HTMLDocumentObj * doc)173*c2c66affSColin Finck void call_docview_84(HTMLDocumentObj *doc)
174*c2c66affSColin Finck {
175*c2c66affSColin Finck IOleCommandTarget *olecmd;
176*c2c66affSColin Finck VARIANT var;
177*c2c66affSColin Finck HRESULT hres;
178*c2c66affSColin Finck
179*c2c66affSColin Finck if(!doc->client)
180*c2c66affSColin Finck return;
181*c2c66affSColin Finck
182*c2c66affSColin Finck hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
183*c2c66affSColin Finck if(FAILED(hres))
184*c2c66affSColin Finck return;
185*c2c66affSColin Finck
186*c2c66affSColin Finck VariantInit(&var);
187*c2c66affSColin Finck hres = IOleCommandTarget_Exec(olecmd, &CGID_ShellDocView, 84, 0, NULL, &var);
188*c2c66affSColin Finck IOleCommandTarget_Release(olecmd);
189*c2c66affSColin Finck if(SUCCEEDED(hres) && V_VT(&var) != VT_NULL)
190*c2c66affSColin Finck FIXME("handle result\n");
191*c2c66affSColin Finck }
192*c2c66affSColin Finck
set_document_navigation(HTMLDocumentObj * doc,BOOL doc_can_navigate)193*c2c66affSColin Finck void set_document_navigation(HTMLDocumentObj *doc, BOOL doc_can_navigate)
194*c2c66affSColin Finck {
195*c2c66affSColin Finck VARIANT var;
196*c2c66affSColin Finck
197*c2c66affSColin Finck if(!doc->client_cmdtrg)
198*c2c66affSColin Finck return;
199*c2c66affSColin Finck
200*c2c66affSColin Finck if(doc_can_navigate) {
201*c2c66affSColin Finck V_VT(&var) = VT_UNKNOWN;
202*c2c66affSColin Finck V_UNKNOWN(&var) = (IUnknown*)&doc->basedoc.window->base.IHTMLWindow2_iface;
203*c2c66affSColin Finck }
204*c2c66affSColin Finck
205*c2c66affSColin Finck IOleCommandTarget_Exec(doc->client_cmdtrg, &CGID_DocHostCmdPriv, DOCHOST_DOCCANNAVIGATE, 0,
206*c2c66affSColin Finck doc_can_navigate ? &var : NULL, NULL);
207*c2c66affSColin Finck }
208*c2c66affSColin Finck
load_settings(HTMLDocumentObj * doc)209*c2c66affSColin Finck static void load_settings(HTMLDocumentObj *doc)
210*c2c66affSColin Finck {
211*c2c66affSColin Finck HKEY settings_key;
212*c2c66affSColin Finck DWORD val, size;
213*c2c66affSColin Finck LONG res;
214*c2c66affSColin Finck
215*c2c66affSColin Finck static const WCHAR ie_keyW[] = {
216*c2c66affSColin Finck 'S','O','F','T','W','A','R','E','\\',
217*c2c66affSColin Finck 'M','i','c','r','o','s','o','f','t','\\',
218*c2c66affSColin Finck 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0};
219*c2c66affSColin Finck static const WCHAR zoomW[] = {'Z','o','o','m',0};
220*c2c66affSColin Finck static const WCHAR zoom_factorW[] = {'Z','o','o','m','F','a','c','t','o','r',0};
221*c2c66affSColin Finck
222*c2c66affSColin Finck res = RegOpenKeyW(HKEY_CURRENT_USER, ie_keyW, &settings_key);
223*c2c66affSColin Finck if(res != ERROR_SUCCESS)
224*c2c66affSColin Finck return;
225*c2c66affSColin Finck
226*c2c66affSColin Finck size = sizeof(val);
227*c2c66affSColin Finck res = RegGetValueW(settings_key, zoomW, zoom_factorW, RRF_RT_REG_DWORD, NULL, &val, &size);
228*c2c66affSColin Finck RegCloseKey(settings_key);
229*c2c66affSColin Finck if(res == ERROR_SUCCESS)
230*c2c66affSColin Finck set_viewer_zoom(doc->nscontainer, (float)val/100000);
231*c2c66affSColin Finck }
232*c2c66affSColin Finck
OleObject_SetClientSite(IOleObject * iface,IOleClientSite * pClientSite)233*c2c66affSColin Finck static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
234*c2c66affSColin Finck {
235*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
236*c2c66affSColin Finck IOleCommandTarget *cmdtrg = NULL;
237*c2c66affSColin Finck IOleWindow *ole_window;
238*c2c66affSColin Finck IBrowserService *browser_service;
239*c2c66affSColin Finck BOOL hostui_setup;
240*c2c66affSColin Finck VARIANT silent;
241*c2c66affSColin Finck HWND hwnd;
242*c2c66affSColin Finck HRESULT hres;
243*c2c66affSColin Finck
244*c2c66affSColin Finck TRACE("(%p)->(%p)\n", This, pClientSite);
245*c2c66affSColin Finck
246*c2c66affSColin Finck if(pClientSite == This->doc_obj->client)
247*c2c66affSColin Finck return S_OK;
248*c2c66affSColin Finck
249*c2c66affSColin Finck if(This->doc_obj->client) {
250*c2c66affSColin Finck IOleClientSite_Release(This->doc_obj->client);
251*c2c66affSColin Finck This->doc_obj->client = NULL;
252*c2c66affSColin Finck This->doc_obj->usermode = UNKNOWN_USERMODE;
253*c2c66affSColin Finck }
254*c2c66affSColin Finck
255*c2c66affSColin Finck if(This->doc_obj->client_cmdtrg) {
256*c2c66affSColin Finck IOleCommandTarget_Release(This->doc_obj->client_cmdtrg);
257*c2c66affSColin Finck This->doc_obj->client_cmdtrg = NULL;
258*c2c66affSColin Finck }
259*c2c66affSColin Finck
260*c2c66affSColin Finck if(This->doc_obj->hostui && !This->doc_obj->custom_hostui) {
261*c2c66affSColin Finck IDocHostUIHandler_Release(This->doc_obj->hostui);
262*c2c66affSColin Finck This->doc_obj->hostui = NULL;
263*c2c66affSColin Finck }
264*c2c66affSColin Finck
265*c2c66affSColin Finck if(This->doc_obj->doc_object_service) {
266*c2c66affSColin Finck IDocObjectService_Release(This->doc_obj->doc_object_service);
267*c2c66affSColin Finck This->doc_obj->doc_object_service = NULL;
268*c2c66affSColin Finck }
269*c2c66affSColin Finck
270*c2c66affSColin Finck if(This->doc_obj->webbrowser) {
271*c2c66affSColin Finck IUnknown_Release(This->doc_obj->webbrowser);
272*c2c66affSColin Finck This->doc_obj->webbrowser = NULL;
273*c2c66affSColin Finck }
274*c2c66affSColin Finck
275*c2c66affSColin Finck if(This->doc_obj->browser_service) {
276*c2c66affSColin Finck IUnknown_Release(This->doc_obj->browser_service);
277*c2c66affSColin Finck This->doc_obj->browser_service = NULL;
278*c2c66affSColin Finck }
279*c2c66affSColin Finck
280*c2c66affSColin Finck if(This->doc_obj->travel_log) {
281*c2c66affSColin Finck ITravelLog_Release(This->doc_obj->travel_log);
282*c2c66affSColin Finck This->doc_obj->travel_log = NULL;
283*c2c66affSColin Finck }
284*c2c66affSColin Finck
285*c2c66affSColin Finck memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO));
286*c2c66affSColin Finck
287*c2c66affSColin Finck if(!pClientSite)
288*c2c66affSColin Finck return S_OK;
289*c2c66affSColin Finck
290*c2c66affSColin Finck IOleClientSite_AddRef(pClientSite);
291*c2c66affSColin Finck This->doc_obj->client = pClientSite;
292*c2c66affSColin Finck
293*c2c66affSColin Finck hostui_setup = This->doc_obj->hostui_setup;
294*c2c66affSColin Finck
295*c2c66affSColin Finck if(!This->doc_obj->hostui) {
296*c2c66affSColin Finck IDocHostUIHandler *uihandler;
297*c2c66affSColin Finck
298*c2c66affSColin Finck This->doc_obj->custom_hostui = FALSE;
299*c2c66affSColin Finck
300*c2c66affSColin Finck hres = IOleClientSite_QueryInterface(pClientSite, &IID_IDocHostUIHandler, (void**)&uihandler);
301*c2c66affSColin Finck if(SUCCEEDED(hres))
302*c2c66affSColin Finck This->doc_obj->hostui = uihandler;
303*c2c66affSColin Finck }
304*c2c66affSColin Finck
305*c2c66affSColin Finck if(This->doc_obj->hostui) {
306*c2c66affSColin Finck DOCHOSTUIINFO hostinfo;
307*c2c66affSColin Finck LPOLESTR key_path = NULL, override_key_path = NULL;
308*c2c66affSColin Finck IDocHostUIHandler2 *uihandler2;
309*c2c66affSColin Finck
310*c2c66affSColin Finck memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
311*c2c66affSColin Finck hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
312*c2c66affSColin Finck hres = IDocHostUIHandler_GetHostInfo(This->doc_obj->hostui, &hostinfo);
313*c2c66affSColin Finck if(SUCCEEDED(hres)) {
314*c2c66affSColin Finck TRACE("hostinfo = {%u %08x %08x %s %s}\n",
315*c2c66affSColin Finck hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
316*c2c66affSColin Finck debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
317*c2c66affSColin Finck update_hostinfo(This->doc_obj, &hostinfo);
318*c2c66affSColin Finck This->doc_obj->hostinfo = hostinfo;
319*c2c66affSColin Finck }
320*c2c66affSColin Finck
321*c2c66affSColin Finck if(!hostui_setup) {
322*c2c66affSColin Finck hres = IDocHostUIHandler_GetOptionKeyPath(This->doc_obj->hostui, &key_path, 0);
323*c2c66affSColin Finck if(hres == S_OK && key_path) {
324*c2c66affSColin Finck if(key_path[0]) {
325*c2c66affSColin Finck /* FIXME: use key_path */
326*c2c66affSColin Finck FIXME("key_path = %s\n", debugstr_w(key_path));
327*c2c66affSColin Finck }
328*c2c66affSColin Finck CoTaskMemFree(key_path);
329*c2c66affSColin Finck }
330*c2c66affSColin Finck
331*c2c66affSColin Finck hres = IDocHostUIHandler_QueryInterface(This->doc_obj->hostui, &IID_IDocHostUIHandler2,
332*c2c66affSColin Finck (void**)&uihandler2);
333*c2c66affSColin Finck if(SUCCEEDED(hres)) {
334*c2c66affSColin Finck hres = IDocHostUIHandler2_GetOverrideKeyPath(uihandler2, &override_key_path, 0);
335*c2c66affSColin Finck if(hres == S_OK && override_key_path) {
336*c2c66affSColin Finck if(override_key_path[0]) {
337*c2c66affSColin Finck /*FIXME: use override_key_path */
338*c2c66affSColin Finck FIXME("override_key_path = %s\n", debugstr_w(override_key_path));
339*c2c66affSColin Finck }
340*c2c66affSColin Finck CoTaskMemFree(override_key_path);
341*c2c66affSColin Finck }
342*c2c66affSColin Finck IDocHostUIHandler2_Release(uihandler2);
343*c2c66affSColin Finck }
344*c2c66affSColin Finck
345*c2c66affSColin Finck This->doc_obj->hostui_setup = TRUE;
346*c2c66affSColin Finck }
347*c2c66affSColin Finck }
348*c2c66affSColin Finck
349*c2c66affSColin Finck load_settings(This->doc_obj);
350*c2c66affSColin Finck
351*c2c66affSColin Finck /* Native calls here GetWindow. What is it for?
352*c2c66affSColin Finck * We don't have anything to do with it here (yet). */
353*c2c66affSColin Finck hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleWindow, (void**)&ole_window);
354*c2c66affSColin Finck if(SUCCEEDED(hres)) {
355*c2c66affSColin Finck IOleWindow_GetWindow(ole_window, &hwnd);
356*c2c66affSColin Finck IOleWindow_Release(ole_window);
357*c2c66affSColin Finck }
358*c2c66affSColin Finck
359*c2c66affSColin Finck hres = do_query_service((IUnknown*)pClientSite, &IID_IShellBrowser,
360*c2c66affSColin Finck &IID_IBrowserService, (void**)&browser_service);
361*c2c66affSColin Finck if(SUCCEEDED(hres)) {
362*c2c66affSColin Finck ITravelLog *travel_log;
363*c2c66affSColin Finck
364*c2c66affSColin Finck This->doc_obj->browser_service = (IUnknown*)browser_service;
365*c2c66affSColin Finck
366*c2c66affSColin Finck hres = IBrowserService_GetTravelLog(browser_service, &travel_log);
367*c2c66affSColin Finck if(SUCCEEDED(hres))
368*c2c66affSColin Finck This->doc_obj->travel_log = travel_log;
369*c2c66affSColin Finck }else {
370*c2c66affSColin Finck browser_service = NULL;
371*c2c66affSColin Finck }
372*c2c66affSColin Finck
373*c2c66affSColin Finck hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleCommandTarget, (void**)&cmdtrg);
374*c2c66affSColin Finck if(SUCCEEDED(hres)) {
375*c2c66affSColin Finck VARIANT var;
376*c2c66affSColin Finck OLECMD cmd = {OLECMDID_SETPROGRESSTEXT, 0};
377*c2c66affSColin Finck
378*c2c66affSColin Finck This->doc_obj->client_cmdtrg = cmdtrg;
379*c2c66affSColin Finck
380*c2c66affSColin Finck if(!hostui_setup) {
381*c2c66affSColin Finck IDocObjectService *doc_object_service;
382*c2c66affSColin Finck IWebBrowser2 *wb;
383*c2c66affSColin Finck
384*c2c66affSColin Finck set_document_navigation(This->doc_obj, TRUE);
385*c2c66affSColin Finck
386*c2c66affSColin Finck if(browser_service) {
387*c2c66affSColin Finck hres = IBrowserService_QueryInterface(browser_service,
388*c2c66affSColin Finck &IID_IDocObjectService, (void**)&doc_object_service);
389*c2c66affSColin Finck if(SUCCEEDED(hres)) {
390*c2c66affSColin Finck This->doc_obj->doc_object_service = doc_object_service;
391*c2c66affSColin Finck
392*c2c66affSColin Finck /*
393*c2c66affSColin Finck * Some embedding routines, esp. in regards to use of IDocObjectService, differ if
394*c2c66affSColin Finck * embedder supports IWebBrowserApp.
395*c2c66affSColin Finck */
396*c2c66affSColin Finck hres = do_query_service((IUnknown*)pClientSite, &IID_IWebBrowserApp, &IID_IWebBrowser2, (void**)&wb);
397*c2c66affSColin Finck if(SUCCEEDED(hres))
398*c2c66affSColin Finck This->doc_obj->webbrowser = (IUnknown*)wb;
399*c2c66affSColin Finck }
400*c2c66affSColin Finck }
401*c2c66affSColin Finck }
402*c2c66affSColin Finck
403*c2c66affSColin Finck call_docview_84(This->doc_obj);
404*c2c66affSColin Finck
405*c2c66affSColin Finck IOleCommandTarget_QueryStatus(cmdtrg, NULL, 1, &cmd, NULL);
406*c2c66affSColin Finck
407*c2c66affSColin Finck V_VT(&var) = VT_I4;
408*c2c66affSColin Finck V_I4(&var) = 0;
409*c2c66affSColin Finck IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX,
410*c2c66affSColin Finck OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
411*c2c66affSColin Finck IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS,
412*c2c66affSColin Finck OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
413*c2c66affSColin Finck }
414*c2c66affSColin Finck
415*c2c66affSColin Finck if(This->doc_obj->usermode == UNKNOWN_USERMODE)
416*c2c66affSColin Finck IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface, DISPID_AMBIENT_USERMODE);
417*c2c66affSColin Finck
418*c2c66affSColin Finck IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface,
419*c2c66affSColin Finck DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
420*c2c66affSColin Finck
421*c2c66affSColin Finck hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
422*c2c66affSColin Finck if(SUCCEEDED(hres)) {
423*c2c66affSColin Finck if(V_VT(&silent) != VT_BOOL)
424*c2c66affSColin Finck WARN("silent = %s\n", debugstr_variant(&silent));
425*c2c66affSColin Finck else if(V_BOOL(&silent))
426*c2c66affSColin Finck FIXME("silent == true\n");
427*c2c66affSColin Finck }
428*c2c66affSColin Finck
429*c2c66affSColin Finck IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface, DISPID_AMBIENT_USERAGENT);
430*c2c66affSColin Finck IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface, DISPID_AMBIENT_PALETTE);
431*c2c66affSColin Finck
432*c2c66affSColin Finck return S_OK;
433*c2c66affSColin Finck }
434*c2c66affSColin Finck
OleObject_GetClientSite(IOleObject * iface,IOleClientSite ** ppClientSite)435*c2c66affSColin Finck static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite)
436*c2c66affSColin Finck {
437*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
438*c2c66affSColin Finck
439*c2c66affSColin Finck TRACE("(%p)->(%p)\n", This, ppClientSite);
440*c2c66affSColin Finck
441*c2c66affSColin Finck if(!ppClientSite)
442*c2c66affSColin Finck return E_INVALIDARG;
443*c2c66affSColin Finck
444*c2c66affSColin Finck if(This->doc_obj->client)
445*c2c66affSColin Finck IOleClientSite_AddRef(This->doc_obj->client);
446*c2c66affSColin Finck *ppClientSite = This->doc_obj->client;
447*c2c66affSColin Finck
448*c2c66affSColin Finck return S_OK;
449*c2c66affSColin Finck }
450*c2c66affSColin Finck
OleObject_SetHostNames(IOleObject * iface,LPCOLESTR szContainerApp,LPCOLESTR szContainerObj)451*c2c66affSColin Finck static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
452*c2c66affSColin Finck {
453*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
454*c2c66affSColin Finck FIXME("(%p)->(%s %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
455*c2c66affSColin Finck return E_NOTIMPL;
456*c2c66affSColin Finck }
457*c2c66affSColin Finck
OleObject_Close(IOleObject * iface,DWORD dwSaveOption)458*c2c66affSColin Finck static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
459*c2c66affSColin Finck {
460*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
461*c2c66affSColin Finck
462*c2c66affSColin Finck TRACE("(%p)->(%08x)\n", This, dwSaveOption);
463*c2c66affSColin Finck
464*c2c66affSColin Finck if(dwSaveOption == OLECLOSE_PROMPTSAVE)
465*c2c66affSColin Finck FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
466*c2c66affSColin Finck
467*c2c66affSColin Finck if(This->doc_obj->in_place_active)
468*c2c66affSColin Finck IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->IOleInPlaceObjectWindowless_iface);
469*c2c66affSColin Finck
470*c2c66affSColin Finck HTMLDocument_LockContainer(This->doc_obj, FALSE);
471*c2c66affSColin Finck
472*c2c66affSColin Finck if(This->advise_holder)
473*c2c66affSColin Finck IOleAdviseHolder_SendOnClose(This->advise_holder);
474*c2c66affSColin Finck
475*c2c66affSColin Finck return S_OK;
476*c2c66affSColin Finck }
477*c2c66affSColin Finck
OleObject_SetMoniker(IOleObject * iface,DWORD dwWhichMoniker,IMoniker * pmk)478*c2c66affSColin Finck static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
479*c2c66affSColin Finck {
480*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
481*c2c66affSColin Finck FIXME("(%p %d %p)->()\n", This, dwWhichMoniker, pmk);
482*c2c66affSColin Finck return E_NOTIMPL;
483*c2c66affSColin Finck }
484*c2c66affSColin Finck
OleObject_GetMoniker(IOleObject * iface,DWORD dwAssign,DWORD dwWhichMoniker,IMoniker ** ppmk)485*c2c66affSColin Finck static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
486*c2c66affSColin Finck {
487*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
488*c2c66affSColin Finck FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
489*c2c66affSColin Finck return E_NOTIMPL;
490*c2c66affSColin Finck }
491*c2c66affSColin Finck
OleObject_InitFromData(IOleObject * iface,IDataObject * pDataObject,BOOL fCreation,DWORD dwReserved)492*c2c66affSColin Finck static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *pDataObject, BOOL fCreation,
493*c2c66affSColin Finck DWORD dwReserved)
494*c2c66affSColin Finck {
495*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
496*c2c66affSColin Finck FIXME("(%p)->(%p %x %d)\n", This, pDataObject, fCreation, dwReserved);
497*c2c66affSColin Finck return E_NOTIMPL;
498*c2c66affSColin Finck }
499*c2c66affSColin Finck
OleObject_GetClipboardData(IOleObject * iface,DWORD dwReserved,IDataObject ** ppDataObject)500*c2c66affSColin Finck static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
501*c2c66affSColin Finck {
502*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
503*c2c66affSColin Finck FIXME("(%p)->(%d %p)\n", This, dwReserved, ppDataObject);
504*c2c66affSColin Finck return E_NOTIMPL;
505*c2c66affSColin Finck }
506*c2c66affSColin Finck
OleObject_DoVerb(IOleObject * iface,LONG iVerb,LPMSG lpmsg,IOleClientSite * pActiveSite,LONG lindex,HWND hwndParent,LPCRECT lprcPosRect)507*c2c66affSColin Finck static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
508*c2c66affSColin Finck LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
509*c2c66affSColin Finck {
510*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
511*c2c66affSColin Finck IOleDocumentSite *pDocSite;
512*c2c66affSColin Finck HRESULT hres;
513*c2c66affSColin Finck
514*c2c66affSColin Finck TRACE("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
515*c2c66affSColin Finck
516*c2c66affSColin Finck if(iVerb != OLEIVERB_SHOW && iVerb != OLEIVERB_UIACTIVATE && iVerb != OLEIVERB_INPLACEACTIVATE) {
517*c2c66affSColin Finck FIXME("iVerb = %d not supported\n", iVerb);
518*c2c66affSColin Finck return E_NOTIMPL;
519*c2c66affSColin Finck }
520*c2c66affSColin Finck
521*c2c66affSColin Finck if(!pActiveSite)
522*c2c66affSColin Finck pActiveSite = This->doc_obj->client;
523*c2c66affSColin Finck
524*c2c66affSColin Finck hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleDocumentSite, (void**)&pDocSite);
525*c2c66affSColin Finck if(SUCCEEDED(hres)) {
526*c2c66affSColin Finck HTMLDocument_LockContainer(This->doc_obj, TRUE);
527*c2c66affSColin Finck
528*c2c66affSColin Finck /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
529*c2c66affSColin Finck hres = IOleDocumentSite_ActivateMe(pDocSite, &This->IOleDocumentView_iface);
530*c2c66affSColin Finck IOleDocumentSite_Release(pDocSite);
531*c2c66affSColin Finck }else {
532*c2c66affSColin Finck hres = IOleDocumentView_UIActivate(&This->IOleDocumentView_iface, TRUE);
533*c2c66affSColin Finck if(SUCCEEDED(hres)) {
534*c2c66affSColin Finck if(lprcPosRect) {
535*c2c66affSColin Finck RECT rect; /* We need to pass rect as not const pointer */
536*c2c66affSColin Finck rect = *lprcPosRect;
537*c2c66affSColin Finck IOleDocumentView_SetRect(&This->IOleDocumentView_iface, &rect);
538*c2c66affSColin Finck }
539*c2c66affSColin Finck IOleDocumentView_Show(&This->IOleDocumentView_iface, TRUE);
540*c2c66affSColin Finck }
541*c2c66affSColin Finck }
542*c2c66affSColin Finck
543*c2c66affSColin Finck return hres;
544*c2c66affSColin Finck }
545*c2c66affSColin Finck
OleObject_EnumVerbs(IOleObject * iface,IEnumOLEVERB ** ppEnumOleVerb)546*c2c66affSColin Finck static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
547*c2c66affSColin Finck {
548*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
549*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, ppEnumOleVerb);
550*c2c66affSColin Finck return E_NOTIMPL;
551*c2c66affSColin Finck }
552*c2c66affSColin Finck
OleObject_Update(IOleObject * iface)553*c2c66affSColin Finck static HRESULT WINAPI OleObject_Update(IOleObject *iface)
554*c2c66affSColin Finck {
555*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
556*c2c66affSColin Finck FIXME("(%p)\n", This);
557*c2c66affSColin Finck return E_NOTIMPL;
558*c2c66affSColin Finck }
559*c2c66affSColin Finck
OleObject_IsUpToDate(IOleObject * iface)560*c2c66affSColin Finck static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
561*c2c66affSColin Finck {
562*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
563*c2c66affSColin Finck FIXME("(%p)\n", This);
564*c2c66affSColin Finck return E_NOTIMPL;
565*c2c66affSColin Finck }
566*c2c66affSColin Finck
OleObject_GetUserClassID(IOleObject * iface,CLSID * pClsid)567*c2c66affSColin Finck static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid)
568*c2c66affSColin Finck {
569*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
570*c2c66affSColin Finck
571*c2c66affSColin Finck TRACE("(%p)->(%p)\n", This, pClsid);
572*c2c66affSColin Finck
573*c2c66affSColin Finck if(!pClsid)
574*c2c66affSColin Finck return E_INVALIDARG;
575*c2c66affSColin Finck
576*c2c66affSColin Finck *pClsid = CLSID_HTMLDocument;
577*c2c66affSColin Finck return S_OK;
578*c2c66affSColin Finck }
579*c2c66affSColin Finck
OleObject_GetUserType(IOleObject * iface,DWORD dwFormOfType,LPOLESTR * pszUserType)580*c2c66affSColin Finck static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
581*c2c66affSColin Finck {
582*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
583*c2c66affSColin Finck FIXME("(%p)->(%d %p)\n", This, dwFormOfType, pszUserType);
584*c2c66affSColin Finck return E_NOTIMPL;
585*c2c66affSColin Finck }
586*c2c66affSColin Finck
OleObject_SetExtent(IOleObject * iface,DWORD dwDrawAspect,SIZEL * psizel)587*c2c66affSColin Finck static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
588*c2c66affSColin Finck {
589*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
590*c2c66affSColin Finck FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
591*c2c66affSColin Finck return E_NOTIMPL;
592*c2c66affSColin Finck }
593*c2c66affSColin Finck
OleObject_GetExtent(IOleObject * iface,DWORD dwDrawAspect,SIZEL * psizel)594*c2c66affSColin Finck static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
595*c2c66affSColin Finck {
596*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
597*c2c66affSColin Finck FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
598*c2c66affSColin Finck return E_NOTIMPL;
599*c2c66affSColin Finck }
600*c2c66affSColin Finck
OleObject_Advise(IOleObject * iface,IAdviseSink * pAdvSink,DWORD * pdwConnection)601*c2c66affSColin Finck static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
602*c2c66affSColin Finck {
603*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
604*c2c66affSColin Finck TRACE("(%p)->(%p %p)\n", This, pAdvSink, pdwConnection);
605*c2c66affSColin Finck
606*c2c66affSColin Finck if(!pdwConnection)
607*c2c66affSColin Finck return E_INVALIDARG;
608*c2c66affSColin Finck
609*c2c66affSColin Finck if(!pAdvSink) {
610*c2c66affSColin Finck *pdwConnection = 0;
611*c2c66affSColin Finck return E_INVALIDARG;
612*c2c66affSColin Finck }
613*c2c66affSColin Finck
614*c2c66affSColin Finck if(!This->advise_holder) {
615*c2c66affSColin Finck CreateOleAdviseHolder(&This->advise_holder);
616*c2c66affSColin Finck if(!This->advise_holder)
617*c2c66affSColin Finck return E_OUTOFMEMORY;
618*c2c66affSColin Finck }
619*c2c66affSColin Finck
620*c2c66affSColin Finck return IOleAdviseHolder_Advise(This->advise_holder, pAdvSink, pdwConnection);
621*c2c66affSColin Finck }
622*c2c66affSColin Finck
OleObject_Unadvise(IOleObject * iface,DWORD dwConnection)623*c2c66affSColin Finck static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
624*c2c66affSColin Finck {
625*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
626*c2c66affSColin Finck TRACE("(%p)->(%d)\n", This, dwConnection);
627*c2c66affSColin Finck
628*c2c66affSColin Finck if(!This->advise_holder)
629*c2c66affSColin Finck return OLE_E_NOCONNECTION;
630*c2c66affSColin Finck
631*c2c66affSColin Finck return IOleAdviseHolder_Unadvise(This->advise_holder, dwConnection);
632*c2c66affSColin Finck }
633*c2c66affSColin Finck
OleObject_EnumAdvise(IOleObject * iface,IEnumSTATDATA ** ppenumAdvise)634*c2c66affSColin Finck static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
635*c2c66affSColin Finck {
636*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
637*c2c66affSColin Finck
638*c2c66affSColin Finck if(!This->advise_holder) {
639*c2c66affSColin Finck *ppenumAdvise = NULL;
640*c2c66affSColin Finck return S_OK;
641*c2c66affSColin Finck }
642*c2c66affSColin Finck
643*c2c66affSColin Finck return IOleAdviseHolder_EnumAdvise(This->advise_holder, ppenumAdvise);
644*c2c66affSColin Finck }
645*c2c66affSColin Finck
OleObject_GetMiscStatus(IOleObject * iface,DWORD dwAspect,DWORD * pdwStatus)646*c2c66affSColin Finck static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
647*c2c66affSColin Finck {
648*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
649*c2c66affSColin Finck FIXME("(%p)->(%d %p)\n", This, dwAspect, pdwStatus);
650*c2c66affSColin Finck return E_NOTIMPL;
651*c2c66affSColin Finck }
652*c2c66affSColin Finck
OleObject_SetColorScheme(IOleObject * iface,LOGPALETTE * pLogpal)653*c2c66affSColin Finck static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *pLogpal)
654*c2c66affSColin Finck {
655*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleObject(iface);
656*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, pLogpal);
657*c2c66affSColin Finck return E_NOTIMPL;
658*c2c66affSColin Finck }
659*c2c66affSColin Finck
660*c2c66affSColin Finck static const IOleObjectVtbl OleObjectVtbl = {
661*c2c66affSColin Finck OleObject_QueryInterface,
662*c2c66affSColin Finck OleObject_AddRef,
663*c2c66affSColin Finck OleObject_Release,
664*c2c66affSColin Finck OleObject_SetClientSite,
665*c2c66affSColin Finck OleObject_GetClientSite,
666*c2c66affSColin Finck OleObject_SetHostNames,
667*c2c66affSColin Finck OleObject_Close,
668*c2c66affSColin Finck OleObject_SetMoniker,
669*c2c66affSColin Finck OleObject_GetMoniker,
670*c2c66affSColin Finck OleObject_InitFromData,
671*c2c66affSColin Finck OleObject_GetClipboardData,
672*c2c66affSColin Finck OleObject_DoVerb,
673*c2c66affSColin Finck OleObject_EnumVerbs,
674*c2c66affSColin Finck OleObject_Update,
675*c2c66affSColin Finck OleObject_IsUpToDate,
676*c2c66affSColin Finck OleObject_GetUserClassID,
677*c2c66affSColin Finck OleObject_GetUserType,
678*c2c66affSColin Finck OleObject_SetExtent,
679*c2c66affSColin Finck OleObject_GetExtent,
680*c2c66affSColin Finck OleObject_Advise,
681*c2c66affSColin Finck OleObject_Unadvise,
682*c2c66affSColin Finck OleObject_EnumAdvise,
683*c2c66affSColin Finck OleObject_GetMiscStatus,
684*c2c66affSColin Finck OleObject_SetColorScheme
685*c2c66affSColin Finck };
686*c2c66affSColin Finck
687*c2c66affSColin Finck /**********************************************************
688*c2c66affSColin Finck * IOleDocument implementation
689*c2c66affSColin Finck */
690*c2c66affSColin Finck
impl_from_IOleDocument(IOleDocument * iface)691*c2c66affSColin Finck static inline HTMLDocument *impl_from_IOleDocument(IOleDocument *iface)
692*c2c66affSColin Finck {
693*c2c66affSColin Finck return CONTAINING_RECORD(iface, HTMLDocument, IOleDocument_iface);
694*c2c66affSColin Finck }
695*c2c66affSColin Finck
OleDocument_QueryInterface(IOleDocument * iface,REFIID riid,void ** ppv)696*c2c66affSColin Finck static HRESULT WINAPI OleDocument_QueryInterface(IOleDocument *iface, REFIID riid, void **ppv)
697*c2c66affSColin Finck {
698*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleDocument(iface);
699*c2c66affSColin Finck return htmldoc_query_interface(This, riid, ppv);
700*c2c66affSColin Finck }
701*c2c66affSColin Finck
OleDocument_AddRef(IOleDocument * iface)702*c2c66affSColin Finck static ULONG WINAPI OleDocument_AddRef(IOleDocument *iface)
703*c2c66affSColin Finck {
704*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleDocument(iface);
705*c2c66affSColin Finck return htmldoc_addref(This);
706*c2c66affSColin Finck }
707*c2c66affSColin Finck
OleDocument_Release(IOleDocument * iface)708*c2c66affSColin Finck static ULONG WINAPI OleDocument_Release(IOleDocument *iface)
709*c2c66affSColin Finck {
710*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleDocument(iface);
711*c2c66affSColin Finck return htmldoc_release(This);
712*c2c66affSColin Finck }
713*c2c66affSColin Finck
OleDocument_CreateView(IOleDocument * iface,IOleInPlaceSite * pIPSite,IStream * pstm,DWORD dwReserved,IOleDocumentView ** ppView)714*c2c66affSColin Finck static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSite *pIPSite, IStream *pstm,
715*c2c66affSColin Finck DWORD dwReserved, IOleDocumentView **ppView)
716*c2c66affSColin Finck {
717*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleDocument(iface);
718*c2c66affSColin Finck HRESULT hres;
719*c2c66affSColin Finck
720*c2c66affSColin Finck TRACE("(%p)->(%p %p %d %p)\n", This, pIPSite, pstm, dwReserved, ppView);
721*c2c66affSColin Finck
722*c2c66affSColin Finck if(!ppView)
723*c2c66affSColin Finck return E_INVALIDARG;
724*c2c66affSColin Finck
725*c2c66affSColin Finck /* FIXME:
726*c2c66affSColin Finck * Windows implementation creates new IOleDocumentView when function is called for the
727*c2c66affSColin Finck * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
728*c2c66affSColin Finck * if the application uses returned interfaces, passed to ActivateMe or returned by
729*c2c66affSColin Finck * QueryInterface, so there is no reason to create new interface. This needs more testing.
730*c2c66affSColin Finck */
731*c2c66affSColin Finck
732*c2c66affSColin Finck if(pIPSite) {
733*c2c66affSColin Finck hres = IOleDocumentView_SetInPlaceSite(&This->IOleDocumentView_iface, pIPSite);
734*c2c66affSColin Finck if(FAILED(hres))
735*c2c66affSColin Finck return hres;
736*c2c66affSColin Finck }
737*c2c66affSColin Finck
738*c2c66affSColin Finck if(pstm)
739*c2c66affSColin Finck FIXME("pstm is not supported\n");
740*c2c66affSColin Finck
741*c2c66affSColin Finck IOleDocumentView_AddRef(&This->IOleDocumentView_iface);
742*c2c66affSColin Finck *ppView = &This->IOleDocumentView_iface;
743*c2c66affSColin Finck return S_OK;
744*c2c66affSColin Finck }
745*c2c66affSColin Finck
OleDocument_GetDocMiscStatus(IOleDocument * iface,DWORD * pdwStatus)746*c2c66affSColin Finck static HRESULT WINAPI OleDocument_GetDocMiscStatus(IOleDocument *iface, DWORD *pdwStatus)
747*c2c66affSColin Finck {
748*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleDocument(iface);
749*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, pdwStatus);
750*c2c66affSColin Finck return E_NOTIMPL;
751*c2c66affSColin Finck }
752*c2c66affSColin Finck
OleDocument_EnumViews(IOleDocument * iface,IEnumOleDocumentViews ** ppEnum,IOleDocumentView ** ppView)753*c2c66affSColin Finck static HRESULT WINAPI OleDocument_EnumViews(IOleDocument *iface, IEnumOleDocumentViews **ppEnum,
754*c2c66affSColin Finck IOleDocumentView **ppView)
755*c2c66affSColin Finck {
756*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleDocument(iface);
757*c2c66affSColin Finck FIXME("(%p)->(%p %p)\n", This, ppEnum, ppView);
758*c2c66affSColin Finck return E_NOTIMPL;
759*c2c66affSColin Finck }
760*c2c66affSColin Finck
761*c2c66affSColin Finck static const IOleDocumentVtbl OleDocumentVtbl = {
762*c2c66affSColin Finck OleDocument_QueryInterface,
763*c2c66affSColin Finck OleDocument_AddRef,
764*c2c66affSColin Finck OleDocument_Release,
765*c2c66affSColin Finck OleDocument_CreateView,
766*c2c66affSColin Finck OleDocument_GetDocMiscStatus,
767*c2c66affSColin Finck OleDocument_EnumViews
768*c2c66affSColin Finck };
769*c2c66affSColin Finck
770*c2c66affSColin Finck /**********************************************************
771*c2c66affSColin Finck * IOleControl implementation
772*c2c66affSColin Finck */
773*c2c66affSColin Finck
impl_from_IOleControl(IOleControl * iface)774*c2c66affSColin Finck static inline HTMLDocument *impl_from_IOleControl(IOleControl *iface)
775*c2c66affSColin Finck {
776*c2c66affSColin Finck return CONTAINING_RECORD(iface, HTMLDocument, IOleControl_iface);
777*c2c66affSColin Finck }
778*c2c66affSColin Finck
OleControl_QueryInterface(IOleControl * iface,REFIID riid,void ** ppv)779*c2c66affSColin Finck static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **ppv)
780*c2c66affSColin Finck {
781*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleControl(iface);
782*c2c66affSColin Finck return htmldoc_query_interface(This, riid, ppv);
783*c2c66affSColin Finck }
784*c2c66affSColin Finck
OleControl_AddRef(IOleControl * iface)785*c2c66affSColin Finck static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
786*c2c66affSColin Finck {
787*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleControl(iface);
788*c2c66affSColin Finck return htmldoc_addref(This);
789*c2c66affSColin Finck }
790*c2c66affSColin Finck
OleControl_Release(IOleControl * iface)791*c2c66affSColin Finck static ULONG WINAPI OleControl_Release(IOleControl *iface)
792*c2c66affSColin Finck {
793*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleControl(iface);
794*c2c66affSColin Finck return htmldoc_release(This);
795*c2c66affSColin Finck }
796*c2c66affSColin Finck
OleControl_GetControlInfo(IOleControl * iface,CONTROLINFO * pCI)797*c2c66affSColin Finck static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, CONTROLINFO *pCI)
798*c2c66affSColin Finck {
799*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleControl(iface);
800*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, pCI);
801*c2c66affSColin Finck return E_NOTIMPL;
802*c2c66affSColin Finck }
803*c2c66affSColin Finck
OleControl_OnMnemonic(IOleControl * iface,MSG * pMsg)804*c2c66affSColin Finck static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, MSG *pMsg)
805*c2c66affSColin Finck {
806*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleControl(iface);
807*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, pMsg);
808*c2c66affSColin Finck return E_NOTIMPL;
809*c2c66affSColin Finck }
810*c2c66affSColin Finck
get_client_disp_property(IOleClientSite * client,DISPID dispid,VARIANT * res)811*c2c66affSColin Finck HRESULT get_client_disp_property(IOleClientSite *client, DISPID dispid, VARIANT *res)
812*c2c66affSColin Finck {
813*c2c66affSColin Finck IDispatch *disp = NULL;
814*c2c66affSColin Finck DISPPARAMS dispparams = {NULL, 0};
815*c2c66affSColin Finck UINT err;
816*c2c66affSColin Finck HRESULT hres;
817*c2c66affSColin Finck
818*c2c66affSColin Finck hres = IOleClientSite_QueryInterface(client, &IID_IDispatch, (void**)&disp);
819*c2c66affSColin Finck if(FAILED(hres)) {
820*c2c66affSColin Finck TRACE("Could not get IDispatch\n");
821*c2c66affSColin Finck return hres;
822*c2c66affSColin Finck }
823*c2c66affSColin Finck
824*c2c66affSColin Finck VariantInit(res);
825*c2c66affSColin Finck
826*c2c66affSColin Finck hres = IDispatch_Invoke(disp, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
827*c2c66affSColin Finck DISPATCH_PROPERTYGET, &dispparams, res, NULL, &err);
828*c2c66affSColin Finck
829*c2c66affSColin Finck IDispatch_Release(disp);
830*c2c66affSColin Finck
831*c2c66affSColin Finck return hres;
832*c2c66affSColin Finck }
833*c2c66affSColin Finck
on_change_dlcontrol(HTMLDocument * This)834*c2c66affSColin Finck static HRESULT on_change_dlcontrol(HTMLDocument *This)
835*c2c66affSColin Finck {
836*c2c66affSColin Finck VARIANT res;
837*c2c66affSColin Finck HRESULT hres;
838*c2c66affSColin Finck
839*c2c66affSColin Finck hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_DLCONTROL, &res);
840*c2c66affSColin Finck if(SUCCEEDED(hres))
841*c2c66affSColin Finck FIXME("unsupported dlcontrol %08x\n", V_I4(&res));
842*c2c66affSColin Finck
843*c2c66affSColin Finck return S_OK;
844*c2c66affSColin Finck }
845*c2c66affSColin Finck
OleControl_OnAmbientPropertyChange(IOleControl * iface,DISPID dispID)846*c2c66affSColin Finck static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
847*c2c66affSColin Finck {
848*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleControl(iface);
849*c2c66affSColin Finck IOleClientSite *client;
850*c2c66affSColin Finck VARIANT res;
851*c2c66affSColin Finck HRESULT hres;
852*c2c66affSColin Finck
853*c2c66affSColin Finck client = This->doc_obj->client;
854*c2c66affSColin Finck if(!client) {
855*c2c66affSColin Finck TRACE("client = NULL\n");
856*c2c66affSColin Finck return S_OK;
857*c2c66affSColin Finck }
858*c2c66affSColin Finck
859*c2c66affSColin Finck switch(dispID) {
860*c2c66affSColin Finck case DISPID_AMBIENT_USERMODE:
861*c2c66affSColin Finck TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This);
862*c2c66affSColin Finck hres = get_client_disp_property(client, DISPID_AMBIENT_USERMODE, &res);
863*c2c66affSColin Finck if(FAILED(hres))
864*c2c66affSColin Finck return S_OK;
865*c2c66affSColin Finck
866*c2c66affSColin Finck if(V_VT(&res) == VT_BOOL) {
867*c2c66affSColin Finck if(V_BOOL(&res)) {
868*c2c66affSColin Finck This->doc_obj->usermode = BROWSEMODE;
869*c2c66affSColin Finck }else {
870*c2c66affSColin Finck FIXME("edit mode is not supported\n");
871*c2c66affSColin Finck This->doc_obj->usermode = EDITMODE;
872*c2c66affSColin Finck }
873*c2c66affSColin Finck }else {
874*c2c66affSColin Finck FIXME("usermode=%s\n", debugstr_variant(&res));
875*c2c66affSColin Finck }
876*c2c66affSColin Finck return S_OK;
877*c2c66affSColin Finck case DISPID_AMBIENT_DLCONTROL:
878*c2c66affSColin Finck TRACE("(%p)->(DISPID_AMBIENT_DLCONTROL)\n", This);
879*c2c66affSColin Finck return on_change_dlcontrol(This);
880*c2c66affSColin Finck case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
881*c2c66affSColin Finck TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This);
882*c2c66affSColin Finck on_change_dlcontrol(This);
883*c2c66affSColin Finck hres = get_client_disp_property(client, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &res);
884*c2c66affSColin Finck if(FAILED(hres))
885*c2c66affSColin Finck return S_OK;
886*c2c66affSColin Finck
887*c2c66affSColin Finck if(V_VT(&res) == VT_BOOL) {
888*c2c66affSColin Finck if(V_BOOL(&res)) {
889*c2c66affSColin Finck FIXME("offline connection is not supported\n");
890*c2c66affSColin Finck hres = E_FAIL;
891*c2c66affSColin Finck }
892*c2c66affSColin Finck }else {
893*c2c66affSColin Finck FIXME("offlineconnected=%s\n", debugstr_variant(&res));
894*c2c66affSColin Finck }
895*c2c66affSColin Finck return S_OK;
896*c2c66affSColin Finck case DISPID_AMBIENT_SILENT:
897*c2c66affSColin Finck TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This);
898*c2c66affSColin Finck on_change_dlcontrol(This);
899*c2c66affSColin Finck hres = get_client_disp_property(client, DISPID_AMBIENT_SILENT, &res);
900*c2c66affSColin Finck if(FAILED(hres))
901*c2c66affSColin Finck return S_OK;
902*c2c66affSColin Finck
903*c2c66affSColin Finck if(V_VT(&res) == VT_BOOL) {
904*c2c66affSColin Finck if(V_BOOL(&res)) {
905*c2c66affSColin Finck FIXME("silent mode is not supported\n");
906*c2c66affSColin Finck hres = E_FAIL;
907*c2c66affSColin Finck }
908*c2c66affSColin Finck }else {
909*c2c66affSColin Finck FIXME("silent=%s\n", debugstr_variant(&res));
910*c2c66affSColin Finck }
911*c2c66affSColin Finck return S_OK;
912*c2c66affSColin Finck case DISPID_AMBIENT_USERAGENT:
913*c2c66affSColin Finck TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This);
914*c2c66affSColin Finck hres = get_client_disp_property(client, DISPID_AMBIENT_USERAGENT, &res);
915*c2c66affSColin Finck if(FAILED(hres))
916*c2c66affSColin Finck return S_OK;
917*c2c66affSColin Finck
918*c2c66affSColin Finck FIXME("not supported AMBIENT_USERAGENT\n");
919*c2c66affSColin Finck hres = E_FAIL;
920*c2c66affSColin Finck return S_OK;
921*c2c66affSColin Finck case DISPID_AMBIENT_PALETTE:
922*c2c66affSColin Finck TRACE("(%p)->(DISPID_AMBIENT_PALETTE)\n", This);
923*c2c66affSColin Finck hres = get_client_disp_property(client, DISPID_AMBIENT_PALETTE, &res);
924*c2c66affSColin Finck if(FAILED(hres))
925*c2c66affSColin Finck return S_OK;
926*c2c66affSColin Finck
927*c2c66affSColin Finck FIXME("not supported AMBIENT_PALETTE\n");
928*c2c66affSColin Finck hres = E_FAIL;
929*c2c66affSColin Finck return S_OK;
930*c2c66affSColin Finck }
931*c2c66affSColin Finck
932*c2c66affSColin Finck FIXME("(%p) unsupported dispID=%d\n", This, dispID);
933*c2c66affSColin Finck return E_FAIL;
934*c2c66affSColin Finck }
935*c2c66affSColin Finck
OleControl_FreezeEvents(IOleControl * iface,BOOL bFreeze)936*c2c66affSColin Finck static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
937*c2c66affSColin Finck {
938*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleControl(iface);
939*c2c66affSColin Finck FIXME("(%p)->(%x)\n", This, bFreeze);
940*c2c66affSColin Finck return E_NOTIMPL;
941*c2c66affSColin Finck }
942*c2c66affSColin Finck
943*c2c66affSColin Finck static const IOleControlVtbl OleControlVtbl = {
944*c2c66affSColin Finck OleControl_QueryInterface,
945*c2c66affSColin Finck OleControl_AddRef,
946*c2c66affSColin Finck OleControl_Release,
947*c2c66affSColin Finck OleControl_GetControlInfo,
948*c2c66affSColin Finck OleControl_OnMnemonic,
949*c2c66affSColin Finck OleControl_OnAmbientPropertyChange,
950*c2c66affSColin Finck OleControl_FreezeEvents
951*c2c66affSColin Finck };
952*c2c66affSColin Finck
953*c2c66affSColin Finck /**********************************************************
954*c2c66affSColin Finck * IObjectWithSite implementation
955*c2c66affSColin Finck */
956*c2c66affSColin Finck
impl_from_IObjectWithSite(IObjectWithSite * iface)957*c2c66affSColin Finck static inline HTMLDocument *impl_from_IObjectWithSite(IObjectWithSite *iface)
958*c2c66affSColin Finck {
959*c2c66affSColin Finck return CONTAINING_RECORD(iface, HTMLDocument, IObjectWithSite_iface);
960*c2c66affSColin Finck }
961*c2c66affSColin Finck
ObjectWithSite_QueryInterface(IObjectWithSite * iface,REFIID riid,void ** ppv)962*c2c66affSColin Finck static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppv)
963*c2c66affSColin Finck {
964*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectWithSite(iface);
965*c2c66affSColin Finck return htmldoc_query_interface(This, riid, ppv);
966*c2c66affSColin Finck }
967*c2c66affSColin Finck
ObjectWithSite_AddRef(IObjectWithSite * iface)968*c2c66affSColin Finck static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
969*c2c66affSColin Finck {
970*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectWithSite(iface);
971*c2c66affSColin Finck return htmldoc_addref(This);
972*c2c66affSColin Finck }
973*c2c66affSColin Finck
ObjectWithSite_Release(IObjectWithSite * iface)974*c2c66affSColin Finck static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
975*c2c66affSColin Finck {
976*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectWithSite(iface);
977*c2c66affSColin Finck return htmldoc_release(This);
978*c2c66affSColin Finck }
979*c2c66affSColin Finck
ObjectWithSite_SetSite(IObjectWithSite * iface,IUnknown * pUnkSite)980*c2c66affSColin Finck static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *pUnkSite)
981*c2c66affSColin Finck {
982*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectWithSite(iface);
983*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, pUnkSite);
984*c2c66affSColin Finck return E_NOTIMPL;
985*c2c66affSColin Finck }
986*c2c66affSColin Finck
ObjectWithSite_GetSite(IObjectWithSite * iface,REFIID riid,PVOID * ppvSite)987*c2c66affSColin Finck static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite* iface, REFIID riid, PVOID *ppvSite)
988*c2c66affSColin Finck {
989*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectWithSite(iface);
990*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, ppvSite);
991*c2c66affSColin Finck return E_NOTIMPL;
992*c2c66affSColin Finck }
993*c2c66affSColin Finck
994*c2c66affSColin Finck static const IObjectWithSiteVtbl ObjectWithSiteVtbl = {
995*c2c66affSColin Finck ObjectWithSite_QueryInterface,
996*c2c66affSColin Finck ObjectWithSite_AddRef,
997*c2c66affSColin Finck ObjectWithSite_Release,
998*c2c66affSColin Finck ObjectWithSite_SetSite,
999*c2c66affSColin Finck ObjectWithSite_GetSite
1000*c2c66affSColin Finck };
1001*c2c66affSColin Finck
1002*c2c66affSColin Finck /**********************************************************
1003*c2c66affSColin Finck * IOleContainer implementation
1004*c2c66affSColin Finck */
1005*c2c66affSColin Finck
impl_from_IOleContainer(IOleContainer * iface)1006*c2c66affSColin Finck static inline HTMLDocument *impl_from_IOleContainer(IOleContainer *iface)
1007*c2c66affSColin Finck {
1008*c2c66affSColin Finck return CONTAINING_RECORD(iface, HTMLDocument, IOleContainer_iface);
1009*c2c66affSColin Finck }
1010*c2c66affSColin Finck
OleContainer_QueryInterface(IOleContainer * iface,REFIID riid,void ** ppv)1011*c2c66affSColin Finck static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
1012*c2c66affSColin Finck {
1013*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleContainer(iface);
1014*c2c66affSColin Finck return htmldoc_query_interface(This, riid, ppv);
1015*c2c66affSColin Finck }
1016*c2c66affSColin Finck
OleContainer_AddRef(IOleContainer * iface)1017*c2c66affSColin Finck static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
1018*c2c66affSColin Finck {
1019*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleContainer(iface);
1020*c2c66affSColin Finck return htmldoc_addref(This);
1021*c2c66affSColin Finck }
1022*c2c66affSColin Finck
OleContainer_Release(IOleContainer * iface)1023*c2c66affSColin Finck static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
1024*c2c66affSColin Finck {
1025*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleContainer(iface);
1026*c2c66affSColin Finck return htmldoc_release(This);
1027*c2c66affSColin Finck }
1028*c2c66affSColin Finck
OleContainer_ParseDisplayName(IOleContainer * iface,IBindCtx * pbc,LPOLESTR pszDisplayName,ULONG * pchEaten,IMoniker ** ppmkOut)1029*c2c66affSColin Finck static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc, LPOLESTR pszDisplayName,
1030*c2c66affSColin Finck ULONG *pchEaten, IMoniker **ppmkOut)
1031*c2c66affSColin Finck {
1032*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleContainer(iface);
1033*c2c66affSColin Finck FIXME("(%p)->(%p %s %p %p)\n", This, pbc, debugstr_w(pszDisplayName), pchEaten, ppmkOut);
1034*c2c66affSColin Finck return E_NOTIMPL;
1035*c2c66affSColin Finck }
1036*c2c66affSColin Finck
OleContainer_EnumObjects(IOleContainer * iface,DWORD grfFlags,IEnumUnknown ** ppenum)1037*c2c66affSColin Finck static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags, IEnumUnknown **ppenum)
1038*c2c66affSColin Finck {
1039*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleContainer(iface);
1040*c2c66affSColin Finck EnumUnknown *ret;
1041*c2c66affSColin Finck
1042*c2c66affSColin Finck TRACE("(%p)->(%x %p)\n", This, grfFlags, ppenum);
1043*c2c66affSColin Finck
1044*c2c66affSColin Finck ret = heap_alloc(sizeof(*ret));
1045*c2c66affSColin Finck if(!ret)
1046*c2c66affSColin Finck return E_OUTOFMEMORY;
1047*c2c66affSColin Finck
1048*c2c66affSColin Finck ret->IEnumUnknown_iface.lpVtbl = &EnumUnknownVtbl;
1049*c2c66affSColin Finck ret->ref = 1;
1050*c2c66affSColin Finck
1051*c2c66affSColin Finck *ppenum = &ret->IEnumUnknown_iface;
1052*c2c66affSColin Finck return S_OK;
1053*c2c66affSColin Finck }
1054*c2c66affSColin Finck
OleContainer_LockContainer(IOleContainer * iface,BOOL fLock)1055*c2c66affSColin Finck static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
1056*c2c66affSColin Finck {
1057*c2c66affSColin Finck HTMLDocument *This = impl_from_IOleContainer(iface);
1058*c2c66affSColin Finck FIXME("(%p)->(%x)\n", This, fLock);
1059*c2c66affSColin Finck return E_NOTIMPL;
1060*c2c66affSColin Finck }
1061*c2c66affSColin Finck
1062*c2c66affSColin Finck static const IOleContainerVtbl OleContainerVtbl = {
1063*c2c66affSColin Finck OleContainer_QueryInterface,
1064*c2c66affSColin Finck OleContainer_AddRef,
1065*c2c66affSColin Finck OleContainer_Release,
1066*c2c66affSColin Finck OleContainer_ParseDisplayName,
1067*c2c66affSColin Finck OleContainer_EnumObjects,
1068*c2c66affSColin Finck OleContainer_LockContainer
1069*c2c66affSColin Finck };
1070*c2c66affSColin Finck
impl_from_ITargetContainer(ITargetContainer * iface)1071*c2c66affSColin Finck static inline HTMLDocumentObj *impl_from_ITargetContainer(ITargetContainer *iface)
1072*c2c66affSColin Finck {
1073*c2c66affSColin Finck return CONTAINING_RECORD(iface, HTMLDocumentObj, ITargetContainer_iface);
1074*c2c66affSColin Finck }
1075*c2c66affSColin Finck
TargetContainer_QueryInterface(ITargetContainer * iface,REFIID riid,void ** ppv)1076*c2c66affSColin Finck static HRESULT WINAPI TargetContainer_QueryInterface(ITargetContainer *iface, REFIID riid, void **ppv)
1077*c2c66affSColin Finck {
1078*c2c66affSColin Finck HTMLDocumentObj *This = impl_from_ITargetContainer(iface);
1079*c2c66affSColin Finck return ICustomDoc_QueryInterface(&This->ICustomDoc_iface, riid, ppv);
1080*c2c66affSColin Finck }
1081*c2c66affSColin Finck
TargetContainer_AddRef(ITargetContainer * iface)1082*c2c66affSColin Finck static ULONG WINAPI TargetContainer_AddRef(ITargetContainer *iface)
1083*c2c66affSColin Finck {
1084*c2c66affSColin Finck HTMLDocumentObj *This = impl_from_ITargetContainer(iface);
1085*c2c66affSColin Finck return ICustomDoc_AddRef(&This->ICustomDoc_iface);
1086*c2c66affSColin Finck }
1087*c2c66affSColin Finck
TargetContainer_Release(ITargetContainer * iface)1088*c2c66affSColin Finck static ULONG WINAPI TargetContainer_Release(ITargetContainer *iface)
1089*c2c66affSColin Finck {
1090*c2c66affSColin Finck HTMLDocumentObj *This = impl_from_ITargetContainer(iface);
1091*c2c66affSColin Finck return ICustomDoc_Release(&This->ICustomDoc_iface);
1092*c2c66affSColin Finck }
1093*c2c66affSColin Finck
TargetContainer_GetFrameUrl(ITargetContainer * iface,LPWSTR * ppszFrameSrc)1094*c2c66affSColin Finck static HRESULT WINAPI TargetContainer_GetFrameUrl(ITargetContainer *iface, LPWSTR *ppszFrameSrc)
1095*c2c66affSColin Finck {
1096*c2c66affSColin Finck HTMLDocumentObj *This = impl_from_ITargetContainer(iface);
1097*c2c66affSColin Finck FIXME("(%p)->(%p)\n", This, ppszFrameSrc);
1098*c2c66affSColin Finck return E_NOTIMPL;
1099*c2c66affSColin Finck }
1100*c2c66affSColin Finck
TargetContainer_GetFramesContainer(ITargetContainer * iface,IOleContainer ** ppContainer)1101*c2c66affSColin Finck static HRESULT WINAPI TargetContainer_GetFramesContainer(ITargetContainer *iface, IOleContainer **ppContainer)
1102*c2c66affSColin Finck {
1103*c2c66affSColin Finck HTMLDocumentObj *This = impl_from_ITargetContainer(iface);
1104*c2c66affSColin Finck
1105*c2c66affSColin Finck TRACE("(%p)->(%p)\n", This, ppContainer);
1106*c2c66affSColin Finck
1107*c2c66affSColin Finck /* NOTE: we should return wrapped interface here */
1108*c2c66affSColin Finck IOleContainer_AddRef(&This->basedoc.IOleContainer_iface);
1109*c2c66affSColin Finck *ppContainer = &This->basedoc.IOleContainer_iface;
1110*c2c66affSColin Finck return S_OK;
1111*c2c66affSColin Finck }
1112*c2c66affSColin Finck
1113*c2c66affSColin Finck static const ITargetContainerVtbl TargetContainerVtbl = {
1114*c2c66affSColin Finck TargetContainer_QueryInterface,
1115*c2c66affSColin Finck TargetContainer_AddRef,
1116*c2c66affSColin Finck TargetContainer_Release,
1117*c2c66affSColin Finck TargetContainer_GetFrameUrl,
1118*c2c66affSColin Finck TargetContainer_GetFramesContainer
1119*c2c66affSColin Finck };
1120*c2c66affSColin Finck
TargetContainer_Init(HTMLDocumentObj * This)1121*c2c66affSColin Finck void TargetContainer_Init(HTMLDocumentObj *This)
1122*c2c66affSColin Finck {
1123*c2c66affSColin Finck This->ITargetContainer_iface.lpVtbl = &TargetContainerVtbl;
1124*c2c66affSColin Finck }
1125*c2c66affSColin Finck
1126*c2c66affSColin Finck /**********************************************************
1127*c2c66affSColin Finck * IObjectSafety implementation
1128*c2c66affSColin Finck */
1129*c2c66affSColin Finck
impl_from_IObjectSafety(IObjectSafety * iface)1130*c2c66affSColin Finck static inline HTMLDocument *impl_from_IObjectSafety(IObjectSafety *iface)
1131*c2c66affSColin Finck {
1132*c2c66affSColin Finck return CONTAINING_RECORD(iface, HTMLDocument, IObjectSafety_iface);
1133*c2c66affSColin Finck }
1134*c2c66affSColin Finck
ObjectSafety_QueryInterface(IObjectSafety * iface,REFIID riid,void ** ppv)1135*c2c66affSColin Finck static HRESULT WINAPI ObjectSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
1136*c2c66affSColin Finck {
1137*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectSafety(iface);
1138*c2c66affSColin Finck return htmldoc_query_interface(This, riid, ppv);
1139*c2c66affSColin Finck }
1140*c2c66affSColin Finck
ObjectSafety_AddRef(IObjectSafety * iface)1141*c2c66affSColin Finck static ULONG WINAPI ObjectSafety_AddRef(IObjectSafety *iface)
1142*c2c66affSColin Finck {
1143*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectSafety(iface);
1144*c2c66affSColin Finck return htmldoc_addref(This);
1145*c2c66affSColin Finck }
1146*c2c66affSColin Finck
ObjectSafety_Release(IObjectSafety * iface)1147*c2c66affSColin Finck static ULONG WINAPI ObjectSafety_Release(IObjectSafety *iface)
1148*c2c66affSColin Finck {
1149*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectSafety(iface);
1150*c2c66affSColin Finck return htmldoc_release(This);
1151*c2c66affSColin Finck }
1152*c2c66affSColin Finck
ObjectSafety_GetInterfaceSafetyOptions(IObjectSafety * iface,REFIID riid,DWORD * pdwSupportedOptions,DWORD * pdwEnabledOptions)1153*c2c66affSColin Finck static HRESULT WINAPI ObjectSafety_GetInterfaceSafetyOptions(IObjectSafety *iface,
1154*c2c66affSColin Finck REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
1155*c2c66affSColin Finck {
1156*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectSafety(iface);
1157*c2c66affSColin Finck FIXME("(%p)->(%s %p %p)\n", This, debugstr_guid(riid), pdwSupportedOptions, pdwEnabledOptions);
1158*c2c66affSColin Finck return E_NOTIMPL;
1159*c2c66affSColin Finck }
1160*c2c66affSColin Finck
ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety * iface,REFIID riid,DWORD dwOptionSetMask,DWORD dwEnabledOptions)1161*c2c66affSColin Finck static HRESULT WINAPI ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety *iface,
1162*c2c66affSColin Finck REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
1163*c2c66affSColin Finck {
1164*c2c66affSColin Finck HTMLDocument *This = impl_from_IObjectSafety(iface);
1165*c2c66affSColin Finck FIXME("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions);
1166*c2c66affSColin Finck
1167*c2c66affSColin Finck if(IsEqualGUID(&IID_IPersistMoniker, riid) &&
1168*c2c66affSColin Finck dwOptionSetMask==INTERFACESAFE_FOR_UNTRUSTED_DATA &&
1169*c2c66affSColin Finck dwEnabledOptions==INTERFACESAFE_FOR_UNTRUSTED_DATA)
1170*c2c66affSColin Finck return S_OK;
1171*c2c66affSColin Finck
1172*c2c66affSColin Finck return E_NOTIMPL;
1173*c2c66affSColin Finck }
1174*c2c66affSColin Finck
1175*c2c66affSColin Finck static const IObjectSafetyVtbl ObjectSafetyVtbl = {
1176*c2c66affSColin Finck ObjectSafety_QueryInterface,
1177*c2c66affSColin Finck ObjectSafety_AddRef,
1178*c2c66affSColin Finck ObjectSafety_Release,
1179*c2c66affSColin Finck ObjectSafety_GetInterfaceSafetyOptions,
1180*c2c66affSColin Finck ObjectSafety_SetInterfaceSafetyOptions
1181*c2c66affSColin Finck };
1182*c2c66affSColin Finck
HTMLDocument_LockContainer(HTMLDocumentObj * This,BOOL fLock)1183*c2c66affSColin Finck void HTMLDocument_LockContainer(HTMLDocumentObj *This, BOOL fLock)
1184*c2c66affSColin Finck {
1185*c2c66affSColin Finck IOleContainer *container;
1186*c2c66affSColin Finck HRESULT hres;
1187*c2c66affSColin Finck
1188*c2c66affSColin Finck if(!This->client || This->container_locked == fLock)
1189*c2c66affSColin Finck return;
1190*c2c66affSColin Finck
1191*c2c66affSColin Finck hres = IOleClientSite_GetContainer(This->client, &container);
1192*c2c66affSColin Finck if(SUCCEEDED(hres)) {
1193*c2c66affSColin Finck IOleContainer_LockContainer(container, fLock);
1194*c2c66affSColin Finck This->container_locked = fLock;
1195*c2c66affSColin Finck IOleContainer_Release(container);
1196*c2c66affSColin Finck }
1197*c2c66affSColin Finck }
1198*c2c66affSColin Finck
HTMLDocument_OleObj_Init(HTMLDocument * This)1199*c2c66affSColin Finck void HTMLDocument_OleObj_Init(HTMLDocument *This)
1200*c2c66affSColin Finck {
1201*c2c66affSColin Finck This->IOleObject_iface.lpVtbl = &OleObjectVtbl;
1202*c2c66affSColin Finck This->IOleDocument_iface.lpVtbl = &OleDocumentVtbl;
1203*c2c66affSColin Finck This->IOleControl_iface.lpVtbl = &OleControlVtbl;
1204*c2c66affSColin Finck This->IObjectWithSite_iface.lpVtbl = &ObjectWithSiteVtbl;
1205*c2c66affSColin Finck This->IOleContainer_iface.lpVtbl = &OleContainerVtbl;
1206*c2c66affSColin Finck This->IObjectSafety_iface.lpVtbl = &ObjectSafetyVtbl;
1207*c2c66affSColin Finck }
1208