push b79aff4f9e064e6702329573e5ebb8548e254b61
[wine/hacks.git] / dlls / mshtml / olewnd.c
blob613f71d20174526ac1b82c8e000dcf81798033ef
1 /*
2 * Copyright 2005 Jacek Caban
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
34 #include "resource.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 /**********************************************************
39 * IOleInPlaceActiveObject implementation
42 #define ACTOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceActiveObject, iface)
44 static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppvObject)
46 HTMLDocument *This = ACTOBJ_THIS(iface);
47 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
50 static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
52 HTMLDocument *This = ACTOBJ_THIS(iface);
53 return IHTMLDocument2_AddRef(HTMLDOC(This));
56 static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
58 HTMLDocument *This = ACTOBJ_THIS(iface);
59 return IHTMLDocument2_Release(HTMLDOC(This));
62 static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
64 HTMLDocument *This = ACTOBJ_THIS(iface);
66 TRACE("(%p)->(%p)\n", This, phwnd);
68 if(!phwnd)
69 return E_INVALIDARG;
71 if(!This->in_place_active) {
72 *phwnd = NULL;
73 return E_FAIL;
76 *phwnd = This->hwnd;
77 return S_OK;
80 static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
82 HTMLDocument *This = ACTOBJ_THIS(iface);
83 FIXME("(%p)->(%x)\n", This, fEnterMode);
84 return E_NOTIMPL;
87 static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
89 HTMLDocument *This = ACTOBJ_THIS(iface);
90 FIXME("(%p)->(%p)\n", This, lpmsg);
91 return E_NOTIMPL;
94 static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface,
95 BOOL fActivate)
97 HTMLDocument *This = ACTOBJ_THIS(iface);
99 TRACE("(%p)->(%x)\n", This, fActivate);
101 if(This->hostui)
102 IDocHostUIHandler_OnFrameWindowActivate(This->hostui, fActivate);
104 if(fActivate && This->nscontainer)
105 nsIWebBrowserFocus_Activate(This->nscontainer->focus);
107 return S_OK;
110 static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
112 HTMLDocument *This = ACTOBJ_THIS(iface);
113 FIXME("(%p)->(%x)\n", This, fActivate);
114 return E_NOTIMPL;
117 static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
118 IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
120 HTMLDocument *This = ACTOBJ_THIS(iface);
121 FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
122 return E_NOTIMPL;
125 static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
127 HTMLDocument *This = ACTOBJ_THIS(iface);
128 FIXME("(%p)->(%x)\n", This, fEnable);
129 return E_NOTIMPL;
132 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
133 OleInPlaceActiveObject_QueryInterface,
134 OleInPlaceActiveObject_AddRef,
135 OleInPlaceActiveObject_Release,
136 OleInPlaceActiveObject_GetWindow,
137 OleInPlaceActiveObject_ContextSensitiveHelp,
138 OleInPlaceActiveObject_TranslateAccelerator,
139 OleInPlaceActiveObject_OnFrameWindowActivate,
140 OleInPlaceActiveObject_OnDocWindowActivate,
141 OleInPlaceActiveObject_ResizeBorder,
142 OleInPlaceActiveObject_EnableModeless
145 #undef ACTOBJ_THIS
147 /**********************************************************
148 * IOleInPlaceObjectWindowless implementation
151 #define OLEINPLACEWND_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceObjectWindowless, iface)
153 static HRESULT WINAPI OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless *iface,
154 REFIID riid, void **ppvObject)
156 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
157 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
160 static ULONG WINAPI OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless *iface)
162 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
163 return IHTMLDocument2_AddRef(HTMLDOC(This));
166 static ULONG WINAPI OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless *iface)
168 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
169 return IHTMLDocument2_Release(HTMLDOC(This));
172 static HRESULT WINAPI OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless *iface,
173 HWND *phwnd)
175 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
176 return IOleWindow_GetWindow(OLEWIN(This), phwnd);
179 static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface,
180 BOOL fEnterMode)
182 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
183 return IOleWindow_ContextSensitiveHelp(OLEWIN(This), fEnterMode);
186 static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface)
188 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
190 TRACE("(%p)\n", This);
192 if(This->ui_active)
193 IOleDocumentView_UIActivate(DOCVIEW(This), FALSE);
194 This->window_active = FALSE;
196 if(!This->in_place_active)
197 return S_OK;
199 if(This->frame)
200 IOleInPlaceFrame_Release(This->frame);
202 if(This->hwnd) {
203 ShowWindow(This->hwnd, SW_HIDE);
204 SetWindowPos(This->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
207 This->focus = FALSE;
208 notif_focus(This);
210 This->in_place_active = FALSE;
211 if(This->ipsite) {
212 IOleInPlaceSiteEx *ipsiteex;
213 HRESULT hres;
215 hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
216 if(SUCCEEDED(hres)) {
217 IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex, TRUE);
218 IOleInPlaceSiteEx_Release(ipsiteex);
219 }else {
220 IOleInPlaceSite_OnInPlaceDeactivate(This->ipsite);
224 return S_OK;
227 static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless *iface)
229 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
230 FIXME("(%p)\n", This);
231 return E_NOTIMPL;
234 static HRESULT WINAPI OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless *iface,
235 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
237 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
238 FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
239 return E_NOTIMPL;
242 static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface)
244 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
245 FIXME("(%p)\n", This);
246 return E_NOTIMPL;
249 static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless *iface,
250 UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult)
252 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
253 FIXME("(%p)->(%u %lu %lu %p)\n", This, msg, wParam, lParam, lpResult);
254 return E_NOTIMPL;
257 static HRESULT WINAPI OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless *iface,
258 IDropTarget **ppDropTarget)
260 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
261 FIXME("(%p)->(%p)\n", This, ppDropTarget);
262 return E_NOTIMPL;
265 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
266 OleInPlaceObjectWindowless_QueryInterface,
267 OleInPlaceObjectWindowless_AddRef,
268 OleInPlaceObjectWindowless_Release,
269 OleInPlaceObjectWindowless_GetWindow,
270 OleInPlaceObjectWindowless_ContextSensitiveHelp,
271 OleInPlaceObjectWindowless_InPlaceDeactivate,
272 OleInPlaceObjectWindowless_UIDeactivate,
273 OleInPlaceObjectWindowless_SetObjectRects,
274 OleInPlaceObjectWindowless_ReactivateAndUndo,
275 OleInPlaceObjectWindowless_OnWindowMessage,
276 OleInPlaceObjectWindowless_GetDropTarget
279 #undef INPLACEWIN_THIS
281 void HTMLDocument_Window_Init(HTMLDocument *This)
283 This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
284 This->lpOleInPlaceObjectWindowlessVtbl = &OleInPlaceObjectWindowlessVtbl;