source: trunk/src/oleaut32/olepicture.c@ 5280

Last change on this file since 5280 was 4837, checked in by sandervl, 25 years ago

merged with Wine 12-22-2000

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