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