1 | /*
|
---|
2 | * OLE Picture object
|
---|
3 | *
|
---|
4 | * Implementation of OLE IPicture and related interfaces
|
---|
5 | *
|
---|
6 | * Copyright 2000 Huw D M Davies for CodeWeavers.
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * BUGS
|
---|
10 | *
|
---|
11 | * Only implements PICTYPE_BITMAP.
|
---|
12 | * Most methods are just stubs.
|
---|
13 | * Doesn't even expose IPersistStream, IConnectionPointContainer.
|
---|
14 | *
|
---|
15 | *
|
---|
16 | * NOTES (or things that msdn doesn't tell you)
|
---|
17 | *
|
---|
18 | * The width and height properties are returned in HIMETRIC units (0.01mm)
|
---|
19 | * IPicture::Render also uses these to select a region of the src picture.
|
---|
20 | * A bitmap's size is converted into these units by using the screen resolution
|
---|
21 | * thus an 8x8 bitmap on a 96dpi screen has a size of 212x212 (8/96 * 2540).
|
---|
22 | *
|
---|
23 | */
|
---|
24 | #ifdef __WIN32OS2__
|
---|
25 | #define HAVE_FLOAT_H
|
---|
26 | #define WINE_LARGE_INTEGER
|
---|
27 | #include "oleaut32.h"
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #include "winerror.h"
|
---|
31 | #include "winbase.h"
|
---|
32 | #include "wingdi.h"
|
---|
33 | #include "winuser.h"
|
---|
34 | #include "ole2.h"
|
---|
35 | #include "olectl.h"
|
---|
36 | #include "wine/obj_picture.h"
|
---|
37 | #include "debugtools.h"
|
---|
38 |
|
---|
39 | #ifdef __WIN32OS2__
|
---|
40 | #undef FIXME
|
---|
41 | #undef TRACE
|
---|
42 | #ifdef DEBUG
|
---|
43 | #define TRACE WriteLog("%s", __FUNCTION__); WriteLog
|
---|
44 | #define FIXME WriteLog("FIXME %s", __FUNCTION__); WriteLog
|
---|
45 | #else
|
---|
46 | #define TRACE 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
|
---|
47 | #define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
|
---|
48 | #endif
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | DEFAULT_DEBUG_CHANNEL(ole);
|
---|
52 |
|
---|
53 | /*************************************************************************
|
---|
54 | * Declaration of implementation class
|
---|
55 | */
|
---|
56 |
|
---|
57 | typedef struct OLEPictureImpl {
|
---|
58 |
|
---|
59 | /*
|
---|
60 | * IPicture handles IUnknown
|
---|
61 | */
|
---|
62 |
|
---|
63 | ICOM_VTABLE(IPicture) *lpvtbl1;
|
---|
64 | ICOM_VTABLE(IDispatch) *lpvtbl2;
|
---|
65 | ICOM_VTABLE(IPersistStream) *lpvtbl3;
|
---|
66 |
|
---|
67 | /* Object referenece count */
|
---|
68 | DWORD ref;
|
---|
69 |
|
---|
70 | /* We own the object and must destroy it ourselves */
|
---|
71 | BOOL fOwn;
|
---|
72 |
|
---|
73 | /* Picture description */
|
---|
74 | PICTDESC desc;
|
---|
75 |
|
---|
76 | /* These are the pixel size of a bitmap */
|
---|
77 | DWORD origWidth;
|
---|
78 | DWORD origHeight;
|
---|
79 |
|
---|
80 | /* And these are the size of the picture converted into HIMETRIC units */
|
---|
81 | OLE_XSIZE_HIMETRIC himetricWidth;
|
---|
82 | OLE_YSIZE_HIMETRIC himetricHeight;
|
---|
83 |
|
---|
84 | } OLEPictureImpl;
|
---|
85 |
|
---|
86 | /*
|
---|
87 | * Macros to retrieve pointer to IUnknown (IPicture) from the other VTables.
|
---|
88 | */
|
---|
89 | #define ICOM_THIS_From_IDispatch(impl, name) \
|
---|
90 | impl *This = (impl*)(((char*)name)-sizeof(void*));
|
---|
91 |
|
---|
92 | #define ICOM_THIS_From_IPersistStream(impl, name) \
|
---|
93 | impl *This = (impl*)(((char*)name)-2*sizeof(void*));
|
---|
94 |
|
---|
95 | /*
|
---|
96 | * Predeclare VTables. They get initialized at the end.
|
---|
97 | */
|
---|
98 | static ICOM_VTABLE(IPicture) OLEPictureImpl_VTable;
|
---|
99 | static ICOM_VTABLE(IDispatch) OLEPictureImpl_IDispatch_VTable;
|
---|
100 | static ICOM_VTABLE(IPersistStream) OLEPictureImpl_IPersistStream_VTable;
|
---|
101 |
|
---|
102 | /***********************************************************************
|
---|
103 | * Implementation of the OLEPictureImpl class.
|
---|
104 | */
|
---|
105 |
|
---|
106 | /************************************************************************
|
---|
107 | * OLEPictureImpl_Construct
|
---|
108 | *
|
---|
109 | * This method will construct a new instance of the OLEPictureImpl
|
---|
110 | * class.
|
---|
111 | *
|
---|
112 | * The caller of this method must release the object when it's
|
---|
113 | * done with it.
|
---|
114 | */
|
---|
115 | static OLEPictureImpl* OLEPictureImpl_Construct(LPPICTDESC pictDesc, BOOL fOwn)
|
---|
116 | {
|
---|
117 | OLEPictureImpl* newObject = 0;
|
---|
118 | TRACE("(%p) type = %d\n", pictDesc, pictDesc->picType);
|
---|
119 |
|
---|
120 | /*
|
---|
121 | * Allocate space for the object.
|
---|
122 | */
|
---|
123 | newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(OLEPictureImpl));
|
---|
124 |
|
---|
125 | if (newObject==0)
|
---|
126 | return newObject;
|
---|
127 |
|
---|
128 | /*
|
---|
129 | * Initialize the virtual function table.
|
---|
130 | */
|
---|
131 | newObject->lpvtbl1 = &OLEPictureImpl_VTable;
|
---|
132 | newObject->lpvtbl2 = &OLEPictureImpl_IDispatch_VTable;
|
---|
133 | newObject->lpvtbl3 = &OLEPictureImpl_IPersistStream_VTable;
|
---|
134 |
|
---|
135 | /*
|
---|
136 | * Start with one reference count. The caller of this function
|
---|
137 | * must release the interface pointer when it is done.
|
---|
138 | */
|
---|
139 | newObject->ref = 1;
|
---|
140 |
|
---|
141 | newObject->fOwn = fOwn;
|
---|
142 |
|
---|
143 | if(pictDesc->cbSizeofstruct != sizeof(PICTDESC)) {
|
---|
144 | FIXME("struct size = %d\n", pictDesc->cbSizeofstruct);
|
---|
145 | }
|
---|
146 | memcpy(&newObject->desc, pictDesc, sizeof(PICTDESC));
|
---|
147 |
|
---|
148 | switch(pictDesc->picType) {
|
---|
149 | case PICTYPE_BITMAP:
|
---|
150 | {
|
---|
151 | BITMAP bm;
|
---|
152 | HDC hdcRef;
|
---|
153 |
|
---|
154 | TRACE("bitmap handle %08x\n", pictDesc->u.bmp.hbitmap);
|
---|
155 | if(GetObjectA(pictDesc->u.bmp.hbitmap, sizeof(bm), &bm) != sizeof(bm)) {
|
---|
156 | ERR("GetObject fails\n");
|
---|
157 | break;
|
---|
158 | }
|
---|
159 |
|
---|
160 | newObject->origWidth = bm.bmWidth;
|
---|
161 | newObject->origHeight = bm.bmHeight;
|
---|
162 |
|
---|
163 | /* The width and height are stored in HIMETRIC units (0.01 mm),
|
---|
164 | so we take our pixel width divide by pixels per inch and
|
---|
165 | multiply by 25.4 * 100 */
|
---|
166 |
|
---|
167 | /* Should we use GetBitmapDimension if available? */
|
---|
168 |
|
---|
169 | hdcRef = CreateCompatibleDC(0);
|
---|
170 |
|
---|
171 | newObject->himetricWidth = (bm.bmWidth * 2540) /
|
---|
172 | GetDeviceCaps(hdcRef, LOGPIXELSX);
|
---|
173 | newObject->himetricHeight = (bm.bmHeight * 2540) /
|
---|
174 | GetDeviceCaps(hdcRef, LOGPIXELSY);
|
---|
175 | DeleteDC(hdcRef);
|
---|
176 | }
|
---|
177 | break;
|
---|
178 |
|
---|
179 | case PICTYPE_METAFILE:
|
---|
180 | TRACE("metafile handle %08x\n", pictDesc->u.wmf.hmeta);
|
---|
181 | newObject->himetricWidth = pictDesc->u.wmf.xExt;
|
---|
182 | newObject->himetricHeight = pictDesc->u.wmf.yExt;
|
---|
183 | break;
|
---|
184 |
|
---|
185 | case PICTYPE_ICON:
|
---|
186 | case PICTYPE_ENHMETAFILE:
|
---|
187 | default:
|
---|
188 | FIXME("Unsupported type %d\n", pictDesc->picType);
|
---|
189 | newObject->himetricWidth = newObject->himetricHeight = 0;
|
---|
190 | break;
|
---|
191 | }
|
---|
192 |
|
---|
193 | TRACE("returning %p\n", newObject);
|
---|
194 | return newObject;
|
---|
195 | }
|
---|
196 |
|
---|
197 | /************************************************************************
|
---|
198 | * OLEPictureImpl_Destroy
|
---|
199 | *
|
---|
200 | * This method is called by the Release method when the reference
|
---|
201 | * count goes down to 0. It will free all resources used by
|
---|
202 | * this object. */
|
---|
203 | static void OLEPictureImpl_Destroy(OLEPictureImpl* Obj)
|
---|
204 | {
|
---|
205 | TRACE("(%p)\n", Obj);
|
---|
206 |
|
---|
207 | if(Obj->fOwn) { /* We need to destroy the picture */
|
---|
208 | switch(Obj->desc.picType) {
|
---|
209 | case PICTYPE_BITMAP:
|
---|
210 | DeleteObject(Obj->desc.u.bmp.hbitmap);
|
---|
211 | break;
|
---|
212 | case PICTYPE_METAFILE:
|
---|
213 | DeleteMetaFile(Obj->desc.u.wmf.hmeta);
|
---|
214 | break;
|
---|
215 | case PICTYPE_ICON:
|
---|
216 | DestroyIcon(Obj->desc.u.icon.hicon);
|
---|
217 | break;
|
---|
218 | case PICTYPE_ENHMETAFILE:
|
---|
219 | DeleteEnhMetaFile(Obj->desc.u.emf.hemf);
|
---|
220 | break;
|
---|
221 | default:
|
---|
222 | FIXME("Unsupported type %d - unable to delete\n", Obj->desc.picType);
|
---|
223 | break;
|
---|
224 | }
|
---|
225 | }
|
---|
226 | HeapFree(GetProcessHeap(), 0, Obj);
|
---|
227 | }
|
---|
228 |
|
---|
229 | static ULONG WINAPI OLEPictureImpl_AddRef(IPicture* iface);
|
---|
230 |
|
---|
231 | /************************************************************************
|
---|
232 | * OLEPictureImpl_QueryInterface (IUnknown)
|
---|
233 | *
|
---|
234 | * See Windows documentation for more details on IUnknown methods.
|
---|
235 | */
|
---|
236 | static HRESULT WINAPI OLEPictureImpl_QueryInterface(
|
---|
237 | IPicture* iface,
|
---|
238 | REFIID riid,
|
---|
239 | void** ppvObject)
|
---|
240 | {
|
---|
241 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
242 | TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject);
|
---|
243 |
|
---|
244 | /*
|
---|
245 | * Perform a sanity check on the parameters.
|
---|
246 | */
|
---|
247 | if ( (This==0) || (ppvObject==0) )
|
---|
248 | return E_INVALIDARG;
|
---|
249 |
|
---|
250 | /*
|
---|
251 | * Initialize the return parameter.
|
---|
252 | */
|
---|
253 | *ppvObject = 0;
|
---|
254 |
|
---|
255 | /*
|
---|
256 | * Compare the riid with the interface IDs implemented by this object.
|
---|
257 | */
|
---|
258 | if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
|
---|
259 | {
|
---|
260 | *ppvObject = (IPicture*)This;
|
---|
261 | }
|
---|
262 | else if (memcmp(&IID_IPicture, riid, sizeof(IID_IPicture)) == 0)
|
---|
263 | {
|
---|
264 | *ppvObject = (IPicture*)This;
|
---|
265 | }
|
---|
266 | else if (memcmp(&IID_IDispatch, riid, sizeof(IID_IDispatch)) == 0)
|
---|
267 | {
|
---|
268 | *ppvObject = (IDispatch*)&(This->lpvtbl2);
|
---|
269 | }
|
---|
270 | else if (memcmp(&IID_IPictureDisp, riid, sizeof(IID_IPictureDisp)) == 0)
|
---|
271 | {
|
---|
272 | *ppvObject = (IDispatch*)&(This->lpvtbl2);
|
---|
273 | }
|
---|
274 | /* else if (memcmp(&IID_IPersistStream, riid, sizeof(IID_IPersistStream)) == 0)
|
---|
275 | {
|
---|
276 | *ppvObject = (IPersistStream*)&(This->lpvtbl3);
|
---|
277 | }*/
|
---|
278 |
|
---|
279 | /*
|
---|
280 | * Check that we obtained an interface.
|
---|
281 | */
|
---|
282 | if ((*ppvObject)==0)
|
---|
283 | {
|
---|
284 | FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid));
|
---|
285 | return E_NOINTERFACE;
|
---|
286 | }
|
---|
287 |
|
---|
288 | /*
|
---|
289 | * Query Interface always increases the reference count by one when it is
|
---|
290 | * successful
|
---|
291 | */
|
---|
292 | OLEPictureImpl_AddRef((IPicture*)This);
|
---|
293 |
|
---|
294 | return S_OK;;
|
---|
295 | }
|
---|
296 |
|
---|
297 | /************************************************************************
|
---|
298 | * OLEPictureImpl_AddRef (IUnknown)
|
---|
299 | *
|
---|
300 | * See Windows documentation for more details on IUnknown methods.
|
---|
301 | */
|
---|
302 | static ULONG WINAPI OLEPictureImpl_AddRef(
|
---|
303 | IPicture* iface)
|
---|
304 | {
|
---|
305 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
306 | TRACE("(%p)->(ref=%ld)\n", This, This->ref);
|
---|
307 | This->ref++;
|
---|
308 |
|
---|
309 | return This->ref;
|
---|
310 | }
|
---|
311 |
|
---|
312 | /************************************************************************
|
---|
313 | * OLEPictureImpl_Release (IUnknown)
|
---|
314 | *
|
---|
315 | * See Windows documentation for more details on IUnknown methods.
|
---|
316 | */
|
---|
317 | static ULONG WINAPI OLEPictureImpl_Release(
|
---|
318 | IPicture* iface)
|
---|
319 | {
|
---|
320 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
321 | TRACE("(%p)->(ref=%ld)\n", This, This->ref);
|
---|
322 |
|
---|
323 | /*
|
---|
324 | * Decrease the reference count on this object.
|
---|
325 | */
|
---|
326 | This->ref--;
|
---|
327 |
|
---|
328 | /*
|
---|
329 | * If the reference count goes down to 0, perform suicide.
|
---|
330 | */
|
---|
331 | if (This->ref==0)
|
---|
332 | {
|
---|
333 | OLEPictureImpl_Destroy(This);
|
---|
334 |
|
---|
335 | return 0;
|
---|
336 | }
|
---|
337 |
|
---|
338 | return This->ref;
|
---|
339 | }
|
---|
340 |
|
---|
341 |
|
---|
342 | /************************************************************************
|
---|
343 | * OLEPictureImpl_get_Handle
|
---|
344 | */
|
---|
345 | static HRESULT WINAPI OLEPictureImpl_get_Handle(IPicture *iface,
|
---|
346 | OLE_HANDLE *phandle)
|
---|
347 | {
|
---|
348 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
349 | TRACE("(%p)->(%p)\n", This, phandle);
|
---|
350 | switch(This->desc.picType) {
|
---|
351 | case PICTYPE_BITMAP:
|
---|
352 | *phandle = This->desc.u.bmp.hbitmap;
|
---|
353 | break;
|
---|
354 | case PICTYPE_METAFILE:
|
---|
355 | *phandle = This->desc.u.wmf.hmeta;
|
---|
356 | break;
|
---|
357 | case PICTYPE_ICON:
|
---|
358 | *phandle = This->desc.u.icon.hicon;
|
---|
359 | break;
|
---|
360 | case PICTYPE_ENHMETAFILE:
|
---|
361 | *phandle = This->desc.u.emf.hemf;
|
---|
362 | break;
|
---|
363 | default:
|
---|
364 | FIXME("Unimplemented type %d\n", This->desc.picType);
|
---|
365 | return E_NOTIMPL;
|
---|
366 | }
|
---|
367 | TRACE("returning handle %08x\n", *phandle);
|
---|
368 | return S_OK;
|
---|
369 | }
|
---|
370 |
|
---|
371 | /************************************************************************
|
---|
372 | * OLEPictureImpl_get_hPal
|
---|
373 | */
|
---|
374 | static HRESULT WINAPI OLEPictureImpl_get_hPal(IPicture *iface,
|
---|
375 | OLE_HANDLE *phandle)
|
---|
376 | {
|
---|
377 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
378 | FIXME("(%p)->(%p): stub\n", This, phandle);
|
---|
379 | return E_NOTIMPL;
|
---|
380 | }
|
---|
381 |
|
---|
382 | /************************************************************************
|
---|
383 | * OLEPictureImpl_get_Type
|
---|
384 | */
|
---|
385 | static HRESULT WINAPI OLEPictureImpl_get_Type(IPicture *iface,
|
---|
386 | short *ptype)
|
---|
387 | {
|
---|
388 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
389 | TRACE("(%p)->(%p): type is %d\n", This, ptype, This->desc.picType);
|
---|
390 | *ptype = This->desc.picType;
|
---|
391 | return S_OK;
|
---|
392 | }
|
---|
393 |
|
---|
394 | /************************************************************************
|
---|
395 | * OLEPictureImpl_get_Width
|
---|
396 | */
|
---|
397 | static HRESULT WINAPI OLEPictureImpl_get_Width(IPicture *iface,
|
---|
398 | OLE_XSIZE_HIMETRIC *pwidth)
|
---|
399 | {
|
---|
400 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
401 | TRACE("(%p)->(%p): width is %ld\n", This, pwidth, This->himetricWidth);
|
---|
402 | *pwidth = This->himetricWidth;
|
---|
403 | return S_OK;
|
---|
404 | }
|
---|
405 |
|
---|
406 | /************************************************************************
|
---|
407 | * OLEPictureImpl_get_Height
|
---|
408 | */
|
---|
409 | static HRESULT WINAPI OLEPictureImpl_get_Height(IPicture *iface,
|
---|
410 | OLE_YSIZE_HIMETRIC *pheight)
|
---|
411 | {
|
---|
412 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
413 | TRACE("(%p)->(%p): height is %ld\n", This, pheight, This->himetricHeight);
|
---|
414 | *pheight = This->himetricHeight;
|
---|
415 | return S_OK;
|
---|
416 | }
|
---|
417 |
|
---|
418 | /************************************************************************
|
---|
419 | * OLEPictureImpl_Render
|
---|
420 | */
|
---|
421 | static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
|
---|
422 | long x, long y, long cx, long cy,
|
---|
423 | OLE_XPOS_HIMETRIC xSrc,
|
---|
424 | OLE_YPOS_HIMETRIC ySrc,
|
---|
425 | OLE_XSIZE_HIMETRIC cxSrc,
|
---|
426 | OLE_YSIZE_HIMETRIC cySrc,
|
---|
427 | LPCRECT prcWBounds)
|
---|
428 | {
|
---|
429 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
430 | TRACE("(%p)->(%08x, (%ld,%ld), (%ld,%ld) <- (%ld,%ld), (%ld,%ld), %p)\n",
|
---|
431 | This, hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, prcWBounds);
|
---|
432 | if(prcWBounds)
|
---|
433 | TRACE("prcWBounds (%d,%d) - (%d,%d)\n", prcWBounds->left, prcWBounds->top,
|
---|
434 | prcWBounds->right, prcWBounds->bottom);
|
---|
435 |
|
---|
436 | switch(This->desc.picType) {
|
---|
437 | case PICTYPE_BITMAP:
|
---|
438 | {
|
---|
439 | HBITMAP hbmpOld;
|
---|
440 | HDC hdcBmp;
|
---|
441 |
|
---|
442 | /* Set a mapping mode that maps bitmap pixels into HIMETRIC units.
|
---|
443 | NB y-axis gets flipped */
|
---|
444 |
|
---|
445 | hdcBmp = CreateCompatibleDC(0);
|
---|
446 | SetMapMode(hdcBmp, MM_ANISOTROPIC);
|
---|
447 | SetWindowOrgEx(hdcBmp, 0, 0, NULL);
|
---|
448 | SetWindowExtEx(hdcBmp, This->himetricWidth, This->himetricHeight, NULL);
|
---|
449 | SetViewportOrgEx(hdcBmp, 0, This->origHeight, NULL);
|
---|
450 | SetViewportExtEx(hdcBmp, This->origWidth, -This->origHeight, NULL);
|
---|
451 |
|
---|
452 | hbmpOld = SelectObject(hdcBmp, This->desc.u.bmp.hbitmap);
|
---|
453 |
|
---|
454 | StretchBlt(hdc, x, y, cx, cy, hdcBmp, xSrc, ySrc, cxSrc, cySrc, SRCCOPY);
|
---|
455 |
|
---|
456 | SelectObject(hdcBmp, hbmpOld);
|
---|
457 | DeleteDC(hdcBmp);
|
---|
458 | }
|
---|
459 | break;
|
---|
460 |
|
---|
461 | case PICTYPE_METAFILE:
|
---|
462 | case PICTYPE_ICON:
|
---|
463 | case PICTYPE_ENHMETAFILE:
|
---|
464 | default:
|
---|
465 | FIXME("type %d not implemented\n", This->desc.picType);
|
---|
466 | return E_NOTIMPL;
|
---|
467 | }
|
---|
468 |
|
---|
469 | return S_OK;
|
---|
470 | }
|
---|
471 |
|
---|
472 | /************************************************************************
|
---|
473 | * OLEPictureImpl_set_hPal
|
---|
474 | */
|
---|
475 | static HRESULT WINAPI OLEPictureImpl_set_hPal(IPicture *iface,
|
---|
476 | OLE_HANDLE hpal)
|
---|
477 | {
|
---|
478 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
479 | FIXME("(%p)->(%08x): stub\n", This, hpal);
|
---|
480 | return E_NOTIMPL;
|
---|
481 | }
|
---|
482 |
|
---|
483 | /************************************************************************
|
---|
484 | * OLEPictureImpl_get_CurDC
|
---|
485 | */
|
---|
486 | static HRESULT WINAPI OLEPictureImpl_get_CurDC(IPicture *iface,
|
---|
487 | HDC *phdc)
|
---|
488 | {
|
---|
489 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
490 | FIXME("(%p)->(%p): stub\n", This, phdc);
|
---|
491 | return E_NOTIMPL;
|
---|
492 | }
|
---|
493 |
|
---|
494 | /************************************************************************
|
---|
495 | * OLEPictureImpl_SelectPicture
|
---|
496 | */
|
---|
497 | static HRESULT WINAPI OLEPictureImpl_SelectPicture(IPicture *iface,
|
---|
498 | HDC hdcIn,
|
---|
499 | HDC *phdcOut,
|
---|
500 | OLE_HANDLE *phbmpOut)
|
---|
501 | {
|
---|
502 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
503 | FIXME("(%p)->(%08x, %p, %p): stub\n", This, hdcIn, phdcOut, phbmpOut);
|
---|
504 | return E_NOTIMPL;
|
---|
505 | }
|
---|
506 |
|
---|
507 | /************************************************************************
|
---|
508 | * OLEPictureImpl_get_KeepOriginalFormat
|
---|
509 | */
|
---|
510 | static HRESULT WINAPI OLEPictureImpl_get_KeepOriginalFormat(IPicture *iface,
|
---|
511 | BOOL *pfKeep)
|
---|
512 | {
|
---|
513 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
514 | FIXME("(%p)->(%p): stub\n", This, pfKeep);
|
---|
515 | return E_NOTIMPL;
|
---|
516 | }
|
---|
517 |
|
---|
518 | /************************************************************************
|
---|
519 | * OLEPictureImpl_put_KeepOriginalFormat
|
---|
520 | */
|
---|
521 | static HRESULT WINAPI OLEPictureImpl_put_KeepOriginalFormat(IPicture *iface,
|
---|
522 | BOOL keep)
|
---|
523 | {
|
---|
524 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
525 | FIXME("(%p)->(%d): stub\n", This, keep);
|
---|
526 | return E_NOTIMPL;
|
---|
527 | }
|
---|
528 |
|
---|
529 | /************************************************************************
|
---|
530 | * OLEPictureImpl_PictureChanged
|
---|
531 | */
|
---|
532 | static HRESULT WINAPI OLEPictureImpl_PictureChanged(IPicture *iface)
|
---|
533 | {
|
---|
534 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
535 | FIXME("(%p)->(): stub\n", This);
|
---|
536 | return E_NOTIMPL;
|
---|
537 | }
|
---|
538 |
|
---|
539 | /************************************************************************
|
---|
540 | * OLEPictureImpl_SaveAsFile
|
---|
541 | */
|
---|
542 | static HRESULT WINAPI OLEPictureImpl_SaveAsFile(IPicture *iface,
|
---|
543 | IStream *pstream,
|
---|
544 | BOOL SaveMemCopy,
|
---|
545 | LONG *pcbSize)
|
---|
546 | {
|
---|
547 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
548 | FIXME("(%p)->(%p, %d, %p): stub\n", This, pstream, SaveMemCopy, pcbSize);
|
---|
549 | return E_NOTIMPL;
|
---|
550 | }
|
---|
551 |
|
---|
552 | /************************************************************************
|
---|
553 | * OLEPictureImpl_get_Attributes
|
---|
554 | */
|
---|
555 | static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface,
|
---|
556 | DWORD *pdwAttr)
|
---|
557 | {
|
---|
558 | ICOM_THIS(OLEPictureImpl, iface);
|
---|
559 | FIXME("(%p)->(%p): stub\n", This, pdwAttr);
|
---|
560 | return E_NOTIMPL;
|
---|
561 | }
|
---|
562 |
|
---|
563 |
|
---|
564 |
|
---|
565 | /************************************************************************
|
---|
566 | * IDispatch
|
---|
567 | */
|
---|
568 | /************************************************************************
|
---|
569 | * OLEPictureImpl_IDispatch_QueryInterface (IUnknown)
|
---|
570 | *
|
---|
571 | * See Windows documentation for more details on IUnknown methods.
|
---|
572 | */
|
---|
573 | static HRESULT WINAPI OLEPictureImpl_IDispatch_QueryInterface(
|
---|
574 | IDispatch* iface,
|
---|
575 | REFIID riid,
|
---|
576 | VOID** ppvoid)
|
---|
577 | {
|
---|
578 | ICOM_THIS_From_IDispatch(IPicture, iface);
|
---|
579 |
|
---|
580 | return IPicture_QueryInterface(This, riid, ppvoid);
|
---|
581 | }
|
---|
582 |
|
---|
583 | /************************************************************************
|
---|
584 | * OLEPictureImpl_IDispatch_AddRef (IUnknown)
|
---|
585 | *
|
---|
586 | * See Windows documentation for more details on IUnknown methods.
|
---|
587 | */
|
---|
588 | static ULONG WINAPI OLEPictureImpl_IDispatch_AddRef(
|
---|
589 | IDispatch* iface)
|
---|
590 | {
|
---|
591 | ICOM_THIS_From_IDispatch(IPicture, iface);
|
---|
592 |
|
---|
593 | return IPicture_AddRef(This);
|
---|
594 | }
|
---|
595 |
|
---|
596 | /************************************************************************
|
---|
597 | * OLEPictureImpl_IDispatch_Release (IUnknown)
|
---|
598 | *
|
---|
599 | * See Windows documentation for more details on IUnknown methods.
|
---|
600 | */
|
---|
601 | static ULONG WINAPI OLEPictureImpl_IDispatch_Release(
|
---|
602 | IDispatch* iface)
|
---|
603 | {
|
---|
604 | ICOM_THIS_From_IDispatch(IPicture, iface);
|
---|
605 |
|
---|
606 | return IPicture_Release(This);
|
---|
607 | }
|
---|
608 |
|
---|
609 | /************************************************************************
|
---|
610 | * OLEPictureImpl_GetTypeInfoCount (IDispatch)
|
---|
611 | *
|
---|
612 | * See Windows documentation for more details on IDispatch methods.
|
---|
613 | */
|
---|
614 | static HRESULT WINAPI OLEPictureImpl_GetTypeInfoCount(
|
---|
615 | IDispatch* iface,
|
---|
616 | unsigned int* pctinfo)
|
---|
617 | {
|
---|
618 | FIXME("():Stub\n");
|
---|
619 |
|
---|
620 | return E_NOTIMPL;
|
---|
621 | }
|
---|
622 |
|
---|
623 | /************************************************************************
|
---|
624 | * OLEPictureImpl_GetTypeInfo (IDispatch)
|
---|
625 | *
|
---|
626 | * See Windows documentation for more details on IDispatch methods.
|
---|
627 | */
|
---|
628 | static HRESULT WINAPI OLEPictureImpl_GetTypeInfo(
|
---|
629 | IDispatch* iface,
|
---|
630 | UINT iTInfo,
|
---|
631 | LCID lcid,
|
---|
632 | ITypeInfo** ppTInfo)
|
---|
633 | {
|
---|
634 | FIXME("():Stub\n");
|
---|
635 |
|
---|
636 | return E_NOTIMPL;
|
---|
637 | }
|
---|
638 |
|
---|
639 | /************************************************************************
|
---|
640 | * OLEPictureImpl_GetIDsOfNames (IDispatch)
|
---|
641 | *
|
---|
642 | * See Windows documentation for more details on IDispatch methods.
|
---|
643 | */
|
---|
644 | static HRESULT WINAPI OLEPictureImpl_GetIDsOfNames(
|
---|
645 | IDispatch* iface,
|
---|
646 | REFIID riid,
|
---|
647 | LPOLESTR* rgszNames,
|
---|
648 | UINT cNames,
|
---|
649 | LCID lcid,
|
---|
650 | DISPID* rgDispId)
|
---|
651 | {
|
---|
652 | FIXME("():Stub\n");
|
---|
653 |
|
---|
654 | return E_NOTIMPL;
|
---|
655 | }
|
---|
656 |
|
---|
657 | /************************************************************************
|
---|
658 | * OLEPictureImpl_Invoke (IDispatch)
|
---|
659 | *
|
---|
660 | * See Windows documentation for more details on IDispatch methods.
|
---|
661 | */
|
---|
662 | static HRESULT WINAPI OLEPictureImpl_Invoke(
|
---|
663 | IDispatch* iface,
|
---|
664 | DISPID dispIdMember,
|
---|
665 | REFIID riid,
|
---|
666 | LCID lcid,
|
---|
667 | WORD wFlags,
|
---|
668 | DISPPARAMS* pDispParams,
|
---|
669 | VARIANT* pVarResult,
|
---|
670 | EXCEPINFO* pExepInfo,
|
---|
671 | UINT* puArgErr)
|
---|
672 | {
|
---|
673 | FIXME("():Stub\n");
|
---|
674 |
|
---|
675 | return E_NOTIMPL;
|
---|
676 | }
|
---|
677 |
|
---|
678 |
|
---|
679 | static ICOM_VTABLE(IPicture) OLEPictureImpl_VTable =
|
---|
680 | {
|
---|
681 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
---|
682 | OLEPictureImpl_QueryInterface,
|
---|
683 | OLEPictureImpl_AddRef,
|
---|
684 | OLEPictureImpl_Release,
|
---|
685 | OLEPictureImpl_get_Handle,
|
---|
686 | OLEPictureImpl_get_hPal,
|
---|
687 | OLEPictureImpl_get_Type,
|
---|
688 | OLEPictureImpl_get_Width,
|
---|
689 | OLEPictureImpl_get_Height,
|
---|
690 | OLEPictureImpl_Render,
|
---|
691 | OLEPictureImpl_set_hPal,
|
---|
692 | OLEPictureImpl_get_CurDC,
|
---|
693 | OLEPictureImpl_SelectPicture,
|
---|
694 | OLEPictureImpl_get_KeepOriginalFormat,
|
---|
695 | OLEPictureImpl_put_KeepOriginalFormat,
|
---|
696 | OLEPictureImpl_PictureChanged,
|
---|
697 | OLEPictureImpl_SaveAsFile,
|
---|
698 | OLEPictureImpl_get_Attributes
|
---|
699 | };
|
---|
700 |
|
---|
701 | static ICOM_VTABLE(IDispatch) OLEPictureImpl_IDispatch_VTable =
|
---|
702 | {
|
---|
703 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
---|
704 | OLEPictureImpl_IDispatch_QueryInterface,
|
---|
705 | OLEPictureImpl_IDispatch_AddRef,
|
---|
706 | OLEPictureImpl_IDispatch_Release,
|
---|
707 | OLEPictureImpl_GetTypeInfoCount,
|
---|
708 | OLEPictureImpl_GetTypeInfo,
|
---|
709 | OLEPictureImpl_GetIDsOfNames,
|
---|
710 | OLEPictureImpl_Invoke
|
---|
711 | };
|
---|
712 |
|
---|
713 | /***********************************************************************
|
---|
714 | * OleCreatePictureIndirect
|
---|
715 | */
|
---|
716 | HRESULT WINAPI OleCreatePictureIndirect(LPPICTDESC lpPictDesc, REFIID riid,
|
---|
717 | BOOL fOwn, LPVOID *ppvObj )
|
---|
718 | {
|
---|
719 | OLEPictureImpl* newPict = NULL;
|
---|
720 | HRESULT hr = S_OK;
|
---|
721 |
|
---|
722 | TRACE("(%p,%p,%d,%p)\n", lpPictDesc, riid, fOwn, ppvObj);
|
---|
723 |
|
---|
724 | /*
|
---|
725 | * Sanity check
|
---|
726 | */
|
---|
727 | if (ppvObj==0)
|
---|
728 | return E_POINTER;
|
---|
729 |
|
---|
730 | *ppvObj = NULL;
|
---|
731 |
|
---|
732 | /*
|
---|
733 | * Try to construct a new instance of the class.
|
---|
734 | */
|
---|
735 | newPict = OLEPictureImpl_Construct(lpPictDesc, fOwn);
|
---|
736 |
|
---|
737 | if (newPict == NULL)
|
---|
738 | return E_OUTOFMEMORY;
|
---|
739 |
|
---|
740 | /*
|
---|
741 | * Make sure it supports the interface required by the caller.
|
---|
742 | */
|
---|
743 | hr = IPicture_QueryInterface((IPicture*)newPict, riid, ppvObj);
|
---|
744 |
|
---|
745 | /*
|
---|
746 | * Release the reference obtained in the constructor. If
|
---|
747 | * the QueryInterface was unsuccessful, it will free the class.
|
---|
748 | */
|
---|
749 | IPicture_Release((IPicture*)newPict);
|
---|
750 |
|
---|
751 | return hr;
|
---|
752 | }
|
---|
753 |
|
---|
754 |
|
---|
755 |
|
---|
756 | #ifdef __WIN32OS2__
|
---|
757 |
|
---|
758 | /***********************************************************************
|
---|
759 | * OleLoadPictureEx
|
---|
760 | */
|
---|
761 | HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
---|
762 | REFIID reed, DWORD xsiz, DWORD ysiz, DWORD flags, LPVOID *ppvObj )
|
---|
763 | {
|
---|
764 | FIXME("(%p,%ld,%d,%p,%lx,%lx,%lx,%p), not implemented\n",
|
---|
765 | lpstream, lSize, fRunmode, reed, xsiz, ysiz, flags, ppvObj);
|
---|
766 | return E_NOTIMPL;
|
---|
767 | }
|
---|
768 |
|
---|
769 | /***********************************************************************
|
---|
770 | * OleLoadPicture
|
---|
771 | */
|
---|
772 | HRESULT WINAPI OleLoadPicture( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
---|
773 | REFIID reed, LPVOID *ppvObj )
|
---|
774 | {
|
---|
775 | FIXME("(%p,%ld,%d,%p,%p), not implemented\n",
|
---|
776 | lpstream, lSize, fRunmode, reed, ppvObj);
|
---|
777 | return OleLoadPictureEx(lpstream, lSize, fRunmode, reed, 0, 0, 0, ppvObj);
|
---|
778 | }
|
---|
779 |
|
---|
780 | // ----------------------------------------------------------------------
|
---|
781 | // OleLoadPictureFile
|
---|
782 | // ----------------------------------------------------------------------
|
---|
783 | HRESULT WIN32API OleLoadPictureFile(VARIANT varFileName, LPDISPATCH* lplpdispPicture)
|
---|
784 | {
|
---|
785 | dprintf(("OLEAUT32: OleLoadPictureFile - stub"));
|
---|
786 | return S_OK;
|
---|
787 | }
|
---|
788 |
|
---|
789 | // ----------------------------------------------------------------------
|
---|
790 | // OleSavePictureFile
|
---|
791 | // ----------------------------------------------------------------------
|
---|
792 | HRESULT WIN32API OleSavePictureFile(LPDISPATCH lpdispPicture,
|
---|
793 | BSTR bstrFileName)
|
---|
794 | {
|
---|
795 | dprintf(("OLEAUT32: OleSavePictureFile - stub"));
|
---|
796 | return S_OK;
|
---|
797 | }
|
---|
798 |
|
---|
799 | // ----------------------------------------------------------------------
|
---|
800 | // OleLoadPicturePath
|
---|
801 | // ----------------------------------------------------------------------
|
---|
802 | HRESULT WIN32API OleLoadPicturePath
|
---|
803 | (LPOLESTR szURLorPath,
|
---|
804 | LPUNKNOWN punkCaller,
|
---|
805 | DWORD dwReserved,
|
---|
806 | OLE_COLOR clrReserved,
|
---|
807 | REFIID riid,
|
---|
808 | LPVOID * ppvRet )
|
---|
809 | {
|
---|
810 | dprintf(("OLEAUT32: OleLoadPicturePath - stub"));
|
---|
811 | return S_OK;
|
---|
812 | }
|
---|
813 | #endif
|
---|