xref: /reactos/dll/win32/ieframe/view.c (revision fc19c80d)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * Copyright 2005 Jacek Caban
3c2c66affSColin Finck  * Copyright 2010 Ilya Shpigor
4c2c66affSColin Finck  *
5c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
6c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
7c2c66affSColin Finck  * License as published by the Free Software Foundation; either
8c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
9c2c66affSColin Finck  *
10c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
11c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13c2c66affSColin Finck  * Lesser General Public License for more details.
14c2c66affSColin Finck  *
15c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
16c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
17c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18c2c66affSColin Finck  */
19c2c66affSColin Finck 
20c2c66affSColin Finck #include "ieframe.h"
21c2c66affSColin Finck 
22*fc19c80dSAmine Khaldi #include "wine/debug.h"
23*fc19c80dSAmine Khaldi 
24*fc19c80dSAmine Khaldi WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
25*fc19c80dSAmine Khaldi 
26c2c66affSColin Finck /**********************************************************************
27c2c66affSColin Finck  * Implement the IViewObject interface
28c2c66affSColin Finck  */
29c2c66affSColin Finck 
impl_from_IViewObject2(IViewObject2 * iface)30c2c66affSColin Finck static inline WebBrowser *impl_from_IViewObject2(IViewObject2 *iface)
31c2c66affSColin Finck {
32c2c66affSColin Finck     return CONTAINING_RECORD(iface, WebBrowser, IViewObject2_iface);
33c2c66affSColin Finck }
34c2c66affSColin Finck 
ViewObject_QueryInterface(IViewObject2 * iface,REFIID riid,void ** ppv)35c2c66affSColin Finck static HRESULT WINAPI ViewObject_QueryInterface(IViewObject2 *iface, REFIID riid, void **ppv)
36c2c66affSColin Finck {
37c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
38c2c66affSColin Finck     return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
39c2c66affSColin Finck }
40c2c66affSColin Finck 
ViewObject_AddRef(IViewObject2 * iface)41c2c66affSColin Finck static ULONG WINAPI ViewObject_AddRef(IViewObject2 *iface)
42c2c66affSColin Finck {
43c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
44c2c66affSColin Finck     return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
45c2c66affSColin Finck }
46c2c66affSColin Finck 
ViewObject_Release(IViewObject2 * iface)47c2c66affSColin Finck static ULONG WINAPI ViewObject_Release(IViewObject2 *iface)
48c2c66affSColin Finck {
49c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
50c2c66affSColin Finck     return IWebBrowser2_Release(&This->IWebBrowser2_iface);
51c2c66affSColin Finck }
52c2c66affSColin Finck 
ViewObject_Draw(IViewObject2 * iface,DWORD dwDrawAspect,LONG lindex,void * pvAspect,DVTARGETDEVICE * ptd,HDC hdcTargetDev,HDC hdcDraw,LPCRECTL lprcBounds,LPCRECTL lprcWBounds,BOOL (STDMETHODCALLTYPE * pfnContinue)(ULONG_PTR),ULONG_PTR dwContinue)53c2c66affSColin Finck static HRESULT WINAPI ViewObject_Draw(IViewObject2 *iface, DWORD dwDrawAspect,
54c2c66affSColin Finck         LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev,
55c2c66affSColin Finck         HDC hdcDraw, LPCRECTL lprcBounds, LPCRECTL lprcWBounds,
56c2c66affSColin Finck         BOOL (STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR),
57c2c66affSColin Finck         ULONG_PTR dwContinue)
58c2c66affSColin Finck {
59c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
60c2c66affSColin Finck     FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %08lx)\n", This, dwDrawAspect, lindex,
61c2c66affSColin Finck             pvAspect, ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue,
62c2c66affSColin Finck             dwContinue);
63*fc19c80dSAmine Khaldi     return S_OK;
64c2c66affSColin Finck }
65c2c66affSColin Finck 
ViewObject_GetColorSet(IViewObject2 * iface,DWORD dwAspect,LONG lindex,void * pvAspect,DVTARGETDEVICE * ptd,HDC hicTargetDev,LOGPALETTE ** ppColorSet)66c2c66affSColin Finck static HRESULT WINAPI ViewObject_GetColorSet(IViewObject2 *iface, DWORD dwAspect,
67c2c66affSColin Finck         LONG lindex, void *pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev,
68c2c66affSColin Finck         LOGPALETTE **ppColorSet)
69c2c66affSColin Finck {
70c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
71c2c66affSColin Finck     FIXME("(%p)->(%d %d %p %p %p %p)\n", This, dwAspect, lindex, pvAspect, ptd,
72c2c66affSColin Finck             hicTargetDev, ppColorSet);
73c2c66affSColin Finck     return E_NOTIMPL;
74c2c66affSColin Finck }
75c2c66affSColin Finck 
ViewObject_Freeze(IViewObject2 * iface,DWORD dwDrawAspect,LONG lindex,void * pvAspect,DWORD * pdwFreeze)76c2c66affSColin Finck static HRESULT WINAPI ViewObject_Freeze(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex,
77c2c66affSColin Finck                                         void *pvAspect, DWORD *pdwFreeze)
78c2c66affSColin Finck {
79c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
80c2c66affSColin Finck     FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
81c2c66affSColin Finck     return E_NOTIMPL;
82c2c66affSColin Finck }
83c2c66affSColin Finck 
ViewObject_Unfreeze(IViewObject2 * iface,DWORD dwFreeze)84c2c66affSColin Finck static HRESULT WINAPI ViewObject_Unfreeze(IViewObject2 *iface, DWORD dwFreeze)
85c2c66affSColin Finck {
86c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
87c2c66affSColin Finck     FIXME("(%p)->(%d)\n", This, dwFreeze);
88c2c66affSColin Finck     return E_NOTIMPL;
89c2c66affSColin Finck }
90c2c66affSColin Finck 
ViewObject_SetAdvise(IViewObject2 * iface,DWORD aspects,DWORD advf,IAdviseSink * pAdvSink)91c2c66affSColin Finck static HRESULT WINAPI ViewObject_SetAdvise(IViewObject2 *iface, DWORD aspects, DWORD advf,
92c2c66affSColin Finck         IAdviseSink *pAdvSink)
93c2c66affSColin Finck {
94c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
95c2c66affSColin Finck 
96c2c66affSColin Finck     TRACE("(%p)->(%d %08x %p)\n", This, aspects, advf, pAdvSink);
97c2c66affSColin Finck 
98c2c66affSColin Finck     if (aspects || advf) FIXME("aspects and/or flags not supported yet\n");
99c2c66affSColin Finck 
100c2c66affSColin Finck     This->sink_aspects = aspects;
101c2c66affSColin Finck     This->sink_flags = advf;
102c2c66affSColin Finck     if (This->sink) IAdviseSink_Release(This->sink);
103c2c66affSColin Finck     This->sink = pAdvSink;
104c2c66affSColin Finck     if (This->sink) IAdviseSink_AddRef(This->sink);
105c2c66affSColin Finck 
106c2c66affSColin Finck     return S_OK;
107c2c66affSColin Finck }
108c2c66affSColin Finck 
ViewObject_GetAdvise(IViewObject2 * iface,DWORD * pAspects,DWORD * pAdvf,IAdviseSink ** ppAdvSink)109c2c66affSColin Finck static HRESULT WINAPI ViewObject_GetAdvise(IViewObject2 *iface, DWORD *pAspects,
110c2c66affSColin Finck         DWORD *pAdvf, IAdviseSink **ppAdvSink)
111c2c66affSColin Finck {
112c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
113c2c66affSColin Finck 
114c2c66affSColin Finck     TRACE("(%p)->(%p %p %p)\n", This, pAspects, pAdvf, ppAdvSink);
115c2c66affSColin Finck 
116c2c66affSColin Finck     if (pAspects) *pAspects = This->sink_aspects;
117c2c66affSColin Finck     if (pAdvf) *pAdvf = This->sink_flags;
118c2c66affSColin Finck     if (ppAdvSink)
119c2c66affSColin Finck     {
120c2c66affSColin Finck         *ppAdvSink = This->sink;
121c2c66affSColin Finck         if (*ppAdvSink) IAdviseSink_AddRef(*ppAdvSink);
122c2c66affSColin Finck     }
123c2c66affSColin Finck 
124c2c66affSColin Finck     return S_OK;
125c2c66affSColin Finck }
126c2c66affSColin Finck 
ViewObject_GetExtent(IViewObject2 * iface,DWORD dwAspect,LONG lindex,DVTARGETDEVICE * ptd,LPSIZEL lpsizel)127c2c66affSColin Finck static HRESULT WINAPI ViewObject_GetExtent(IViewObject2 *iface, DWORD dwAspect, LONG lindex,
128c2c66affSColin Finck         DVTARGETDEVICE *ptd, LPSIZEL lpsizel)
129c2c66affSColin Finck {
130c2c66affSColin Finck     WebBrowser *This = impl_from_IViewObject2(iface);
131c2c66affSColin Finck     FIXME("(%p)->(%d %d %p %p)\n", This, dwAspect, lindex, ptd, lpsizel);
132c2c66affSColin Finck     return E_NOTIMPL;
133c2c66affSColin Finck }
134c2c66affSColin Finck 
135c2c66affSColin Finck static const IViewObject2Vtbl ViewObjectVtbl = {
136c2c66affSColin Finck     ViewObject_QueryInterface,
137c2c66affSColin Finck     ViewObject_AddRef,
138c2c66affSColin Finck     ViewObject_Release,
139c2c66affSColin Finck     ViewObject_Draw,
140c2c66affSColin Finck     ViewObject_GetColorSet,
141c2c66affSColin Finck     ViewObject_Freeze,
142c2c66affSColin Finck     ViewObject_Unfreeze,
143c2c66affSColin Finck     ViewObject_SetAdvise,
144c2c66affSColin Finck     ViewObject_GetAdvise,
145c2c66affSColin Finck     ViewObject_GetExtent
146c2c66affSColin Finck };
147c2c66affSColin Finck 
148c2c66affSColin Finck /**********************************************************************
149c2c66affSColin Finck  * Implement the IDataObject interface
150c2c66affSColin Finck  */
151c2c66affSColin Finck 
impl_from_IDataObject(IDataObject * iface)152c2c66affSColin Finck static inline WebBrowser *impl_from_IDataObject(IDataObject *iface)
153c2c66affSColin Finck {
154c2c66affSColin Finck     return CONTAINING_RECORD(iface, WebBrowser, IDataObject_iface);
155c2c66affSColin Finck }
156c2c66affSColin Finck 
DataObject_QueryInterface(LPDATAOBJECT iface,REFIID riid,LPVOID * ppvObj)157c2c66affSColin Finck static HRESULT WINAPI DataObject_QueryInterface(LPDATAOBJECT iface, REFIID riid, LPVOID * ppvObj)
158c2c66affSColin Finck {
159c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
160c2c66affSColin Finck     return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppvObj);
161c2c66affSColin Finck }
162c2c66affSColin Finck 
DataObject_AddRef(LPDATAOBJECT iface)163c2c66affSColin Finck static ULONG WINAPI DataObject_AddRef(LPDATAOBJECT iface)
164c2c66affSColin Finck {
165c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
166c2c66affSColin Finck     return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
167c2c66affSColin Finck }
168c2c66affSColin Finck 
DataObject_Release(LPDATAOBJECT iface)169c2c66affSColin Finck static ULONG WINAPI DataObject_Release(LPDATAOBJECT iface)
170c2c66affSColin Finck {
171c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
172c2c66affSColin Finck     return IWebBrowser2_Release(&This->IWebBrowser2_iface);
173c2c66affSColin Finck }
174c2c66affSColin Finck 
DataObject_GetData(LPDATAOBJECT iface,LPFORMATETC pformatetcIn,STGMEDIUM * pmedium)175c2c66affSColin Finck static HRESULT WINAPI DataObject_GetData(LPDATAOBJECT iface, LPFORMATETC pformatetcIn, STGMEDIUM *pmedium)
176c2c66affSColin Finck {
177c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
178c2c66affSColin Finck     FIXME("(%p)->()\n", This);
179c2c66affSColin Finck     return E_NOTIMPL;
180c2c66affSColin Finck }
181c2c66affSColin Finck 
DataObject_GetDataHere(LPDATAOBJECT iface,LPFORMATETC pformatetc,STGMEDIUM * pmedium)182c2c66affSColin Finck static HRESULT WINAPI DataObject_GetDataHere(LPDATAOBJECT iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium)
183c2c66affSColin Finck {
184c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
185c2c66affSColin Finck     FIXME("(%p)->()\n", This);
186c2c66affSColin Finck     return E_NOTIMPL;
187c2c66affSColin Finck }
188c2c66affSColin Finck 
DataObject_QueryGetData(LPDATAOBJECT iface,LPFORMATETC pformatetc)189c2c66affSColin Finck static HRESULT WINAPI DataObject_QueryGetData(LPDATAOBJECT iface, LPFORMATETC pformatetc)
190c2c66affSColin Finck {
191c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
192c2c66affSColin Finck     FIXME("(%p)->()\n", This);
193c2c66affSColin Finck     return E_NOTIMPL;
194c2c66affSColin Finck }
195c2c66affSColin Finck 
DataObject_GetCanonicalFormatEtc(LPDATAOBJECT iface,LPFORMATETC pformatectIn,LPFORMATETC pformatetcOut)196c2c66affSColin Finck static HRESULT WINAPI DataObject_GetCanonicalFormatEtc(LPDATAOBJECT iface, LPFORMATETC pformatectIn, LPFORMATETC pformatetcOut)
197c2c66affSColin Finck {
198c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
199c2c66affSColin Finck     FIXME("(%p)->()\n", This);
200c2c66affSColin Finck     return E_NOTIMPL;
201c2c66affSColin Finck }
202c2c66affSColin Finck 
DataObject_SetData(LPDATAOBJECT iface,LPFORMATETC pformatetc,STGMEDIUM * pmedium,BOOL fRelease)203c2c66affSColin Finck static HRESULT WINAPI DataObject_SetData(LPDATAOBJECT iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
204c2c66affSColin Finck {
205c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
206c2c66affSColin Finck     FIXME("(%p)->()\n", This);
207c2c66affSColin Finck     return E_NOTIMPL;
208c2c66affSColin Finck }
209c2c66affSColin Finck 
DataObject_EnumFormatEtc(LPDATAOBJECT iface,DWORD dwDirection,IEnumFORMATETC ** ppenumFormatEtc)210c2c66affSColin Finck static HRESULT WINAPI DataObject_EnumFormatEtc(LPDATAOBJECT iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
211c2c66affSColin Finck {
212c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
213c2c66affSColin Finck     FIXME("(%p)->()\n", This);
214c2c66affSColin Finck     return E_NOTIMPL;
215c2c66affSColin Finck }
216c2c66affSColin Finck 
DataObject_DAdvise(LPDATAOBJECT iface,FORMATETC * pformatetc,DWORD advf,IAdviseSink * pAdvSink,DWORD * pdwConnection)217c2c66affSColin Finck static HRESULT WINAPI DataObject_DAdvise(LPDATAOBJECT iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
218c2c66affSColin Finck {
219c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
220c2c66affSColin Finck     FIXME("(%p)->()\n", This);
221c2c66affSColin Finck     return E_NOTIMPL;
222c2c66affSColin Finck }
223c2c66affSColin Finck 
DataObject_DUnadvise(LPDATAOBJECT iface,DWORD dwConnection)224c2c66affSColin Finck static HRESULT WINAPI DataObject_DUnadvise(LPDATAOBJECT iface, DWORD dwConnection)
225c2c66affSColin Finck {
226c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
227c2c66affSColin Finck     FIXME("(%p)->()\n", This);
228c2c66affSColin Finck     return E_NOTIMPL;
229c2c66affSColin Finck }
230c2c66affSColin Finck 
DataObject_EnumDAdvise(LPDATAOBJECT iface,IEnumSTATDATA ** ppenumAdvise)231c2c66affSColin Finck static HRESULT WINAPI DataObject_EnumDAdvise(LPDATAOBJECT iface, IEnumSTATDATA **ppenumAdvise)
232c2c66affSColin Finck {
233c2c66affSColin Finck     WebBrowser *This = impl_from_IDataObject(iface);
234c2c66affSColin Finck     FIXME("(%p)->()\n", This);
235c2c66affSColin Finck     return E_NOTIMPL;
236c2c66affSColin Finck }
237c2c66affSColin Finck 
238c2c66affSColin Finck static const IDataObjectVtbl DataObjectVtbl = {
239c2c66affSColin Finck     DataObject_QueryInterface,
240c2c66affSColin Finck     DataObject_AddRef,
241c2c66affSColin Finck     DataObject_Release,
242c2c66affSColin Finck     DataObject_GetData,
243c2c66affSColin Finck     DataObject_GetDataHere,
244c2c66affSColin Finck     DataObject_QueryGetData,
245c2c66affSColin Finck     DataObject_GetCanonicalFormatEtc,
246c2c66affSColin Finck     DataObject_SetData,
247c2c66affSColin Finck     DataObject_EnumFormatEtc,
248c2c66affSColin Finck     DataObject_DAdvise,
249c2c66affSColin Finck     DataObject_DUnadvise,
250c2c66affSColin Finck     DataObject_EnumDAdvise
251c2c66affSColin Finck };
252c2c66affSColin Finck 
WebBrowser_ViewObject_Init(WebBrowser * This)253c2c66affSColin Finck void WebBrowser_ViewObject_Init(WebBrowser *This)
254c2c66affSColin Finck {
255c2c66affSColin Finck     This->IViewObject2_iface.lpVtbl = &ViewObjectVtbl;
256c2c66affSColin Finck     This->IDataObject_iface.lpVtbl  = &DataObjectVtbl;
257c2c66affSColin Finck }
258