Correct size check.
[wine/dcerpc.git] / dlls / mshtml / olewnd.c
blob5a400028f4634f5dbab3b9c85b4c0ca6700f0312
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 /**********************************************************
38 * IOleInPlaceActiveObject implementation
41 #define ACTOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceActiveObject, iface)
43 static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppvObject)
45 HTMLDocument *This = ACTOBJ_THIS(iface);
46 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
49 static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
51 HTMLDocument *This = ACTOBJ_THIS(iface);
52 return IHTMLDocument2_AddRef(HTMLDOC(This));
55 static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
57 HTMLDocument *This = ACTOBJ_THIS(iface);
58 return IHTMLDocument2_Release(HTMLDOC(This));
61 static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
63 HTMLDocument *This = ACTOBJ_THIS(iface);
65 TRACE("(%p)->(%p)\n", This, phwnd);
67 if(!phwnd)
68 return E_INVALIDARG;
70 if(!This->in_place_active) {
71 *phwnd = NULL;
72 return E_FAIL;
75 *phwnd = This->hwnd;
76 return S_OK;
79 static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
81 HTMLDocument *This = ACTOBJ_THIS(iface);
82 FIXME("(%p)->(%x)\n", This, fEnterMode);
83 return E_NOTIMPL;
86 static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
88 HTMLDocument *This = ACTOBJ_THIS(iface);
89 FIXME("(%p)->(%p)\n", This, lpmsg);
90 return E_NOTIMPL;
93 static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
95 HTMLDocument *This = ACTOBJ_THIS(iface);
96 FIXME("(%p)->(%x)\n", This, fActivate);
97 return E_NOTIMPL;
100 static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
102 HTMLDocument *This = ACTOBJ_THIS(iface);
103 FIXME("(%p)->(%x)\n", This, fActivate);
104 return E_NOTIMPL;
107 static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
108 IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
110 HTMLDocument *This = ACTOBJ_THIS(iface);
111 FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
112 return E_NOTIMPL;
115 static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
117 HTMLDocument *This = ACTOBJ_THIS(iface);
118 FIXME("(%p)->(%x)\n", This, fEnable);
119 return E_NOTIMPL;
122 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
123 OleInPlaceActiveObject_QueryInterface,
124 OleInPlaceActiveObject_AddRef,
125 OleInPlaceActiveObject_Release,
126 OleInPlaceActiveObject_GetWindow,
127 OleInPlaceActiveObject_ContextSensitiveHelp,
128 OleInPlaceActiveObject_TranslateAccelerator,
129 OleInPlaceActiveObject_OnFrameWindowActivate,
130 OleInPlaceActiveObject_OnDocWindowActivate,
131 OleInPlaceActiveObject_ResizeBorder,
132 OleInPlaceActiveObject_EnableModeless
135 #undef ACTOBJ_THIS
137 /**********************************************************
138 * IOleInPlaceObjectWindowless implementation
141 #define OLEINPLACEWND_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceObjectWindowless, iface)
143 static HRESULT WINAPI OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless *iface,
144 REFIID riid, void **ppvObject)
146 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
147 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
150 static ULONG WINAPI OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless *iface)
152 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
153 return IHTMLDocument2_AddRef(HTMLDOC(This));
156 static ULONG WINAPI OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless *iface)
158 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
159 return IHTMLDocument2_Release(HTMLDOC(This));
162 static HRESULT WINAPI OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless *iface,
163 HWND *phwnd)
165 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
166 return IOleWindow_GetWindow(OLEWIN(This), phwnd);
169 static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface,
170 BOOL fEnterMode)
172 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
173 return IOleWindow_ContextSensitiveHelp(OLEWIN(This), fEnterMode);
176 static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface)
178 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
180 TRACE("(%p)\n", This);
182 if(!This->in_place_active)
183 return S_OK;
185 if(This->frame)
186 IOleInPlaceFrame_Release(This->frame);
188 if(This->hwnd) {
189 ShowWindow(This->hwnd, SW_HIDE);
190 SetWindowPos(This->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
193 This->in_place_active = FALSE;
194 if(This->ipsite)
195 IOleInPlaceSite_OnInPlaceDeactivate(This->ipsite);
197 return S_OK;
200 static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless *iface)
202 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
203 FIXME("(%p)\n", This);
204 return E_NOTIMPL;
207 static HRESULT WINAPI OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless *iface,
208 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
210 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
211 FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
212 return E_NOTIMPL;
215 static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface)
217 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
218 FIXME("(%p)\n", This);
219 return E_NOTIMPL;
222 static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless *iface,
223 UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult)
225 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
226 FIXME("(%p)->(%u %u %lu %p)\n", This, msg, wParam, lParam, lpResult);
227 return E_NOTIMPL;
230 static HRESULT WINAPI OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless *iface,
231 IDropTarget **ppDropTarget)
233 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
234 FIXME("(%p)->(%p)\n", This, ppDropTarget);
235 return E_NOTIMPL;
238 static IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
239 OleInPlaceObjectWindowless_QueryInterface,
240 OleInPlaceObjectWindowless_AddRef,
241 OleInPlaceObjectWindowless_Release,
242 OleInPlaceObjectWindowless_GetWindow,
243 OleInPlaceObjectWindowless_ContextSensitiveHelp,
244 OleInPlaceObjectWindowless_InPlaceDeactivate,
245 OleInPlaceObjectWindowless_UIDeactivate,
246 OleInPlaceObjectWindowless_SetObjectRects,
247 OleInPlaceObjectWindowless_ReactivateAndUndo,
248 OleInPlaceObjectWindowless_OnWindowMessage,
249 OleInPlaceObjectWindowless_GetDropTarget
252 #undef INPLACEWIN_THIS
254 void HTMLDocument_Window_Init(HTMLDocument *This)
256 This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
257 This->lpOleInPlaceObjectWindowlessVtbl = &OleInPlaceObjectWindowlessVtbl;