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
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 /**********************************************************
39 * IOleInPlaceActiveObject implementation
42 static inline HTMLDocument *impl_from_IOleInPlaceActiveObject(IOleInPlaceActiveObject *iface)
44 return CONTAINING_RECORD(iface, HTMLDocument, IOleInPlaceActiveObject_iface);
47 static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppv)
49 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
50 return htmldoc_query_interface(This, riid, ppv);
53 static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
55 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
56 return htmldoc_addref(This);
59 static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
61 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
62 return htmldoc_release(This);
65 static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
67 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
69 TRACE("(%p)->(%p)\n", This, phwnd);
74 if(!This->doc_obj->in_place_active) {
79 *phwnd = This->doc_obj->hwnd;
83 static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
85 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
86 FIXME("(%p)->(%x)\n", This, fEnterMode);
90 static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
92 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
93 FIXME("(%p)->(%p)\n", This, lpmsg);
97 static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface,
100 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
102 TRACE("(%p)->(%x)\n", This, fActivate);
104 if(This->doc_obj->hostui)
105 IDocHostUIHandler_OnFrameWindowActivate(This->doc_obj->hostui, fActivate);
110 static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
112 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
113 FIXME("(%p)->(%x)\n", This, fActivate);
117 static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
118 IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
120 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
121 FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
125 static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
127 HTMLDocument *This = impl_from_IOleInPlaceActiveObject(iface);
128 FIXME("(%p)->(%x)\n", This, fEnable);
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 /**********************************************************
146 * IOleInPlaceObjectWindowless implementation
149 static inline HTMLDocument *impl_from_IOleInPlaceObjectWindowless(IOleInPlaceObjectWindowless *iface)
151 return CONTAINING_RECORD(iface, HTMLDocument, IOleInPlaceObjectWindowless_iface);
154 static HRESULT WINAPI OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless *iface,
155 REFIID riid, void **ppv)
157 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
158 return htmldoc_query_interface(This, riid, ppv);
161 static ULONG WINAPI OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless *iface)
163 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
164 return htmldoc_addref(This);
167 static ULONG WINAPI OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless *iface)
169 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
170 return htmldoc_release(This);
173 static HRESULT WINAPI OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless *iface,
176 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
177 return IOleWindow_GetWindow(&This->IOleInPlaceActiveObject_iface, phwnd);
180 static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface,
183 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
184 return IOleWindow_ContextSensitiveHelp(&This->IOleInPlaceActiveObject_iface, fEnterMode);
187 static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface)
189 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
191 TRACE("(%p)\n", This);
193 if(This->doc_obj->ui_active)
194 IOleDocumentView_UIActivate(&This->IOleDocumentView_iface, FALSE);
195 This->doc_obj->window_active = FALSE;
197 if(!This->doc_obj->in_place_active)
200 if(This->doc_obj->frame)
201 IOleInPlaceFrame_Release(This->doc_obj->frame);
203 if(This->doc_obj->hwnd) {
204 ShowWindow(This->doc_obj->hwnd, SW_HIDE);
205 SetWindowPos(This->doc_obj->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
208 This->doc_obj->focus = FALSE;
209 notif_focus(This->doc_obj);
211 This->doc_obj->in_place_active = FALSE;
212 if(This->doc_obj->ipsite) {
213 IOleInPlaceSiteEx *ipsiteex;
216 hres = IOleInPlaceSite_QueryInterface(This->doc_obj->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
217 if(SUCCEEDED(hres)) {
218 IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex, TRUE);
219 IOleInPlaceSiteEx_Release(ipsiteex);
221 IOleInPlaceSite_OnInPlaceDeactivate(This->doc_obj->ipsite);
228 static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless *iface)
230 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
231 FIXME("(%p)\n", This);
235 static HRESULT WINAPI OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless *iface,
236 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
238 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
239 FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
243 static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface)
245 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
246 FIXME("(%p)\n", This);
250 static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless *iface,
251 UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult)
253 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
254 FIXME("(%p)->(%u %lu %lu %p)\n", This, msg, wParam, lParam, lpResult);
258 static HRESULT WINAPI OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless *iface,
259 IDropTarget **ppDropTarget)
261 HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface);
262 FIXME("(%p)->(%p)\n", This, ppDropTarget);
266 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
267 OleInPlaceObjectWindowless_QueryInterface,
268 OleInPlaceObjectWindowless_AddRef,
269 OleInPlaceObjectWindowless_Release,
270 OleInPlaceObjectWindowless_GetWindow,
271 OleInPlaceObjectWindowless_ContextSensitiveHelp,
272 OleInPlaceObjectWindowless_InPlaceDeactivate,
273 OleInPlaceObjectWindowless_UIDeactivate,
274 OleInPlaceObjectWindowless_SetObjectRects,
275 OleInPlaceObjectWindowless_ReactivateAndUndo,
276 OleInPlaceObjectWindowless_OnWindowMessage,
277 OleInPlaceObjectWindowless_GetDropTarget
280 void HTMLDocument_Window_Init(HTMLDocument *This)
282 This->IOleInPlaceActiveObject_iface.lpVtbl = &OleInPlaceActiveObjectVtbl;
283 This->IOleInPlaceObjectWindowless_iface.lpVtbl = &OleInPlaceObjectWindowlessVtbl;