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 "mshtml_private.h"
21 /**********************************************************
22 * IOleInPlaceActiveObject implementation
25 static inline HTMLDocument
*impl_from_IOleInPlaceActiveObject(IOleInPlaceActiveObject
*iface
)
27 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleInPlaceActiveObject_iface
);
30 static HRESULT WINAPI
OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject
*iface
, REFIID riid
, void **ppv
)
32 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
33 return htmldoc_query_interface(This
, riid
, ppv
);
36 static ULONG WINAPI
OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject
*iface
)
38 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
39 return htmldoc_addref(This
);
42 static ULONG WINAPI
OleInPlaceActiveObject_Release(IOleInPlaceActiveObject
*iface
)
44 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
45 return htmldoc_release(This
);
48 static HRESULT WINAPI
OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject
*iface
, HWND
*phwnd
)
50 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
52 TRACE("(%p)->(%p)\n", This
, phwnd
);
57 if(!This
->doc_obj
->in_place_active
) {
62 *phwnd
= This
->doc_obj
->hwnd
;
66 static HRESULT WINAPI
OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject
*iface
, BOOL fEnterMode
)
68 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
69 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
73 static HRESULT WINAPI
OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject
*iface
, LPMSG lpmsg
)
75 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
76 FIXME("(%p)->(%p)\n", This
, lpmsg
);
80 static HRESULT WINAPI
OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject
*iface
,
83 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
85 TRACE("(%p)->(%x)\n", This
, fActivate
);
87 if(This
->doc_obj
->hostui
)
88 IDocHostUIHandler_OnFrameWindowActivate(This
->doc_obj
->hostui
, fActivate
);
93 static HRESULT WINAPI
OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject
*iface
, BOOL fActivate
)
95 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
96 FIXME("(%p)->(%x)\n", This
, fActivate
);
100 static HRESULT WINAPI
OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject
*iface
, LPCRECT prcBorder
,
101 IOleInPlaceUIWindow
*pUIWindow
, BOOL fFrameWindow
)
103 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
104 FIXME("(%p)->(%p %p %x)\n", This
, prcBorder
, pUIWindow
, fFrameWindow
);
108 static HRESULT WINAPI
OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject
*iface
, BOOL fEnable
)
110 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
111 FIXME("(%p)->(%x)\n", This
, fEnable
);
115 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl
= {
116 OleInPlaceActiveObject_QueryInterface
,
117 OleInPlaceActiveObject_AddRef
,
118 OleInPlaceActiveObject_Release
,
119 OleInPlaceActiveObject_GetWindow
,
120 OleInPlaceActiveObject_ContextSensitiveHelp
,
121 OleInPlaceActiveObject_TranslateAccelerator
,
122 OleInPlaceActiveObject_OnFrameWindowActivate
,
123 OleInPlaceActiveObject_OnDocWindowActivate
,
124 OleInPlaceActiveObject_ResizeBorder
,
125 OleInPlaceActiveObject_EnableModeless
128 /**********************************************************
129 * IOleInPlaceObjectWindowless implementation
132 static inline HTMLDocument
*impl_from_IOleInPlaceObjectWindowless(IOleInPlaceObjectWindowless
*iface
)
134 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleInPlaceObjectWindowless_iface
);
137 static HRESULT WINAPI
OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless
*iface
,
138 REFIID riid
, void **ppv
)
140 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
141 return htmldoc_query_interface(This
, riid
, ppv
);
144 static ULONG WINAPI
OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless
*iface
)
146 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
147 return htmldoc_addref(This
);
150 static ULONG WINAPI
OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless
*iface
)
152 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
153 return htmldoc_release(This
);
156 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless
*iface
,
159 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
160 return IOleInPlaceActiveObject_GetWindow(&This
->IOleInPlaceActiveObject_iface
, phwnd
);
163 static HRESULT WINAPI
OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless
*iface
,
166 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
167 return IOleInPlaceActiveObject_ContextSensitiveHelp(&This
->IOleInPlaceActiveObject_iface
, fEnterMode
);
170 static HRESULT WINAPI
OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless
*iface
)
172 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
174 TRACE("(%p)\n", This
);
176 if(This
->doc_obj
->ui_active
)
177 IOleDocumentView_UIActivate(&This
->IOleDocumentView_iface
, FALSE
);
178 This
->doc_obj
->window_active
= FALSE
;
180 if(!This
->doc_obj
->in_place_active
)
183 if(This
->doc_obj
->frame
) {
184 IOleInPlaceFrame_Release(This
->doc_obj
->frame
);
185 This
->doc_obj
->frame
= NULL
;
188 if(This
->doc_obj
->hwnd
) {
189 ShowWindow(This
->doc_obj
->hwnd
, SW_HIDE
);
190 SetWindowPos(This
->doc_obj
->hwnd
, HWND_TOPMOST
, 0, 0, 0, 0, SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOACTIVATE
);
193 This
->doc_obj
->focus
= FALSE
;
194 notif_focus(This
->doc_obj
);
196 This
->doc_obj
->in_place_active
= FALSE
;
197 if(This
->doc_obj
->ipsite
) {
198 IOleInPlaceSiteEx
*ipsiteex
;
201 hres
= IOleInPlaceSite_QueryInterface(This
->doc_obj
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
202 if(SUCCEEDED(hres
)) {
203 IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex
, TRUE
);
204 IOleInPlaceSiteEx_Release(ipsiteex
);
206 IOleInPlaceSite_OnInPlaceDeactivate(This
->doc_obj
->ipsite
);
213 static HRESULT WINAPI
OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless
*iface
)
215 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
216 FIXME("(%p)\n", This
);
220 static HRESULT WINAPI
OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless
*iface
,
221 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
223 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
224 FIXME("(%p)->(%p %p)\n", This
, lprcPosRect
, lprcClipRect
);
228 static HRESULT WINAPI
OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless
*iface
)
230 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
231 FIXME("(%p)\n", This
);
235 static HRESULT WINAPI
OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless
*iface
,
236 UINT msg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*lpResult
)
238 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
239 FIXME("(%p)->(%u %lu %lu %p)\n", This
, msg
, wParam
, lParam
, lpResult
);
243 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless
*iface
,
244 IDropTarget
**ppDropTarget
)
246 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
247 FIXME("(%p)->(%p)\n", This
, ppDropTarget
);
251 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl
= {
252 OleInPlaceObjectWindowless_QueryInterface
,
253 OleInPlaceObjectWindowless_AddRef
,
254 OleInPlaceObjectWindowless_Release
,
255 OleInPlaceObjectWindowless_GetWindow
,
256 OleInPlaceObjectWindowless_ContextSensitiveHelp
,
257 OleInPlaceObjectWindowless_InPlaceDeactivate
,
258 OleInPlaceObjectWindowless_UIDeactivate
,
259 OleInPlaceObjectWindowless_SetObjectRects
,
260 OleInPlaceObjectWindowless_ReactivateAndUndo
,
261 OleInPlaceObjectWindowless_OnWindowMessage
,
262 OleInPlaceObjectWindowless_GetDropTarget
265 void HTMLDocument_Window_Init(HTMLDocument
*This
)
267 This
->IOleInPlaceActiveObject_iface
.lpVtbl
= &OleInPlaceActiveObjectVtbl
;
268 This
->IOleInPlaceObjectWindowless_iface
.lpVtbl
= &OleInPlaceObjectWindowlessVtbl
;