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
);
107 static HRESULT WINAPI
OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject
*iface
, BOOL fActivate
)
109 HTMLDocument
*This
= ACTOBJ_THIS(iface
);
110 FIXME("(%p)->(%x)\n", This
, fActivate
);
114 static HRESULT WINAPI
OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject
*iface
, LPCRECT prcBorder
,
115 IOleInPlaceUIWindow
*pUIWindow
, BOOL fFrameWindow
)
117 HTMLDocument
*This
= ACTOBJ_THIS(iface
);
118 FIXME("(%p)->(%p %p %x)\n", This
, prcBorder
, pUIWindow
, fFrameWindow
);
122 static HRESULT WINAPI
OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject
*iface
, BOOL fEnable
)
124 HTMLDocument
*This
= ACTOBJ_THIS(iface
);
125 FIXME("(%p)->(%x)\n", This
, fEnable
);
129 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl
= {
130 OleInPlaceActiveObject_QueryInterface
,
131 OleInPlaceActiveObject_AddRef
,
132 OleInPlaceActiveObject_Release
,
133 OleInPlaceActiveObject_GetWindow
,
134 OleInPlaceActiveObject_ContextSensitiveHelp
,
135 OleInPlaceActiveObject_TranslateAccelerator
,
136 OleInPlaceActiveObject_OnFrameWindowActivate
,
137 OleInPlaceActiveObject_OnDocWindowActivate
,
138 OleInPlaceActiveObject_ResizeBorder
,
139 OleInPlaceActiveObject_EnableModeless
144 /**********************************************************
145 * IOleInPlaceObjectWindowless implementation
148 #define OLEINPLACEWND_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceObjectWindowless, iface)
150 static HRESULT WINAPI
OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless
*iface
,
151 REFIID riid
, void **ppvObject
)
153 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
154 return IHTMLDocument2_QueryInterface(HTMLDOC(This
), riid
, ppvObject
);
157 static ULONG WINAPI
OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless
*iface
)
159 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
160 return IHTMLDocument2_AddRef(HTMLDOC(This
));
163 static ULONG WINAPI
OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless
*iface
)
165 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
166 return IHTMLDocument2_Release(HTMLDOC(This
));
169 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless
*iface
,
172 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
173 return IOleWindow_GetWindow(OLEWIN(This
), phwnd
);
176 static HRESULT WINAPI
OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless
*iface
,
179 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
180 return IOleWindow_ContextSensitiveHelp(OLEWIN(This
), fEnterMode
);
183 static HRESULT WINAPI
OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless
*iface
)
185 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
187 TRACE("(%p)\n", This
);
190 IOleDocumentView_UIActivate(DOCVIEW(This
), FALSE
);
191 This
->window_active
= FALSE
;
193 if(!This
->in_place_active
)
197 IOleInPlaceFrame_Release(This
->frame
);
200 ShowWindow(This
->hwnd
, SW_HIDE
);
201 SetWindowPos(This
->hwnd
, HWND_TOPMOST
, 0, 0, 0, 0, SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOACTIVATE
);
204 This
->in_place_active
= FALSE
;
206 IOleInPlaceSite_OnInPlaceDeactivate(This
->ipsite
);
211 static HRESULT WINAPI
OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless
*iface
)
213 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
214 FIXME("(%p)\n", This
);
218 static HRESULT WINAPI
OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless
*iface
,
219 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
221 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
222 FIXME("(%p)->(%p %p)\n", This
, lprcPosRect
, lprcClipRect
);
226 static HRESULT WINAPI
OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless
*iface
)
228 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
229 FIXME("(%p)\n", This
);
233 static HRESULT WINAPI
OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless
*iface
,
234 UINT msg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*lpResult
)
236 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
237 FIXME("(%p)->(%u %u %lu %p)\n", This
, msg
, wParam
, lParam
, lpResult
);
241 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless
*iface
,
242 IDropTarget
**ppDropTarget
)
244 HTMLDocument
*This
= OLEINPLACEWND_THIS(iface
);
245 FIXME("(%p)->(%p)\n", This
, ppDropTarget
);
249 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl
= {
250 OleInPlaceObjectWindowless_QueryInterface
,
251 OleInPlaceObjectWindowless_AddRef
,
252 OleInPlaceObjectWindowless_Release
,
253 OleInPlaceObjectWindowless_GetWindow
,
254 OleInPlaceObjectWindowless_ContextSensitiveHelp
,
255 OleInPlaceObjectWindowless_InPlaceDeactivate
,
256 OleInPlaceObjectWindowless_UIDeactivate
,
257 OleInPlaceObjectWindowless_SetObjectRects
,
258 OleInPlaceObjectWindowless_ReactivateAndUndo
,
259 OleInPlaceObjectWindowless_OnWindowMessage
,
260 OleInPlaceObjectWindowless_GetDropTarget
263 #undef INPLACEWIN_THIS
265 void HTMLDocument_ShowContextMenu(HTMLDocument
*This
, DWORD dwID
, POINT
*ppt
)
267 HMENU menu_res
, menu
;
270 hres
= IDocHostUIHandler_ShowContextMenu(This
->hostui
, dwID
, ppt
,
271 (IUnknown
*)CMDTARGET(This
), (IDispatch
*)HTMLDOC(This
));
275 menu_res
= LoadMenuW(get_shdoclc(), MAKEINTRESOURCEW(IDR_BROWSE_CONTEXT_MENU
));
276 menu
= GetSubMenu(menu_res
, dwID
);
278 TrackPopupMenu(menu
, TPM_LEFTALIGN
| TPM_RIGHTBUTTON
| TPM_RETURNCMD
,
279 ppt
->x
, ppt
->y
, 0, This
->hwnd
, NULL
);
281 DestroyMenu(menu_res
);
284 void HTMLDocument_Window_Init(HTMLDocument
*This
)
286 This
->lpOleInPlaceActiveObjectVtbl
= &OleInPlaceActiveObjectVtbl
;
287 This
->lpOleInPlaceObjectWindowlessVtbl
= &OleInPlaceObjectWindowlessVtbl
;