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 #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
);
71 if(!This
->in_place_active
) {
80 static HRESULT WINAPI
OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject
*iface
, BOOL fEnterMode
)
82 HTMLDocument
*This
= ACTOBJ_THIS(iface
);
83 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
87 static HRESULT WINAPI
OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject
*iface
, LPMSG lpmsg
)
89 HTMLDocument
*This
= ACTOBJ_THIS(iface
);
90 FIXME("(%p)->(%p)\n", This
, lpmsg
);
94 static HRESULT WINAPI
OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject
*iface
,
97 HTMLDocument
*This
= ACTOBJ_THIS(iface
);
99 TRACE("(%p)->(%x)\n", This
, fActivate
);
102 IDocHostUIHandler_OnFrameWindowActivate(This
->hostui
, fActivate
);
104 if(fActivate
&& This
->nscontainer
)
105 nsIWebBrowserFocus_Activate(This
->nscontainer
->focus
);
110 static HRESULT WINAPI
OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject
*iface
, BOOL fActivate
)
112 HTMLDocument
*This
= ACTOBJ_THIS(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
= ACTOBJ_THIS(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
= ACTOBJ_THIS(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
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
,
175 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
176 return IOleWindow_GetWindow(OLEWIN(This
), phwnd
);
179 static HRESULT WINAPI
OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless
*iface
,
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
);
193 IOleDocumentView_UIActivate(DOCVIEW(This
), FALSE
);
194 This
->window_active
= FALSE
;
196 if(!This
->in_place_active
)
200 IOleInPlaceFrame_Release(This
->frame
);
203 ShowWindow(This
->hwnd
, SW_HIDE
);
204 SetWindowPos(This
->hwnd
, HWND_TOPMOST
, 0, 0, 0, 0, SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOACTIVATE
);
210 This
->in_place_active
= FALSE
;
212 IOleInPlaceSiteEx
*ipsiteex
;
215 hres
= IOleInPlaceSite_QueryInterface(This
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
216 if(SUCCEEDED(hres
)) {
217 IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex
, TRUE
);
218 IOleInPlaceSiteEx_Release(ipsiteex
);
220 IOleInPlaceSite_OnInPlaceDeactivate(This
->ipsite
);
227 static HRESULT WINAPI
OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless
*iface
)
229 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
230 FIXME("(%p)\n", This
);
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
);
242 static HRESULT WINAPI
OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless
*iface
)
244 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
245 FIXME("(%p)\n", This
);
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
);
257 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless
*iface
,
258 IDropTarget
**ppDropTarget
)
260 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
261 FIXME("(%p)->(%p)\n", This
, ppDropTarget
);
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
;