source: trunk/src/oleaut32/iPicture.cpp@ 1730

Last change on this file since 1730 was 1729, checked in by davidr, 26 years ago

Added beginnings of IPicture interface for VB6 support.

File size: 25.3 KB
Line 
1/* $Id: iPicture.cpp,v 1.1 1999-11-14 01:26:35 davidr Exp $ */
2/*
3 * OLE Picture functions
4 *
5 * Defines the OLE "Picture" object
6 * This object has the following ingoing interfaces:
7 * IUnknown
8 * IPicture - Picture manipulation
9 * IDispatch - for Automation
10 * IPictureDisp - for Automation
11 * IPersistStream - Persist to stream
12 *
13 * 12/11/99 - New Code
14 *
15 * Copyright 1999 David J. Raison
16 *
17 * Project Odin Software License can be found in LICENSE.TXT
18 *
19 */
20
21#include "oleaut32.h"
22#include "ipicture.h"
23
24typedef struct IPictureImpl {
25
26 // IUnknown, IPictureImpl
27 ICOM_VTABLE(IPicture) * lpvtbl1;
28
29 // IDispatch, IPictureImplDisp
30 ICOM_VTABLE(IDispatch) * lpvtbl2;
31
32 // IPersistStream
33 ICOM_VTABLE(IPersistStream) * lpvtbl3;
34
35 ULONG ref; // Reference counter...
36
37// PICTDESC description;
38
39 short sType;
40 HANDLE hPicture;
41 HANDLE hPal;
42 BOOL fKeepOriginalFormat;
43 BOOL fOwn;
44 HDC hdc;
45 DWORD lAttrib;
46
47} IPictureImpl;
48
49// Access macros
50#define _ICOM_THIS(class, name) class* This = (class*)name;
51#define _ICOM_THIS_From_IDispatch(class, name) class * This = (class*)(((char*)name)-sizeof(void*));
52#define _ICOM_THIS_From_IPersistStream(class, name) class * This = (class*)(((char*)name)-2*sizeof(void*));
53
54// ======================================================================
55// Prototypes.
56// ======================================================================
57
58// ----------------------------------------------------------------------
59// IPictureImpl
60// ----------------------------------------------------------------------
61static IPictureImpl * IPictureImpl_Constructor(LPPICTDESC description, BOOL fOwn);
62static void IPictureImpl_Destructor(IPictureImpl * obj);
63
64static ULONG WIN32API IPictureImpl_AddRef(LPPICTURE iface);
65static HRESULT WIN32API IPictureImpl_QueryInterface(LPPICTURE iface,
66 REFIID refiid, LPVOID * obj);
67static ULONG WIN32API IPictureImpl_AddRef(LPPICTURE iface);
68static ULONG WIN32API IPictureImpl_Release(LPPICTURE iface);
69static HRESULT WIN32API IPictureImpl_get_Handle(LPPICTURE iface,
70 OLE_HANDLE * pHandle);
71static HRESULT WIN32API IPictureImpl_get_hPal(LPPICTURE iface,
72 OLE_HANDLE * phPal);
73static HRESULT WIN32API IPictureImpl_get_Type(LPPICTURE iface,
74 SHORT * pType);
75static HRESULT WIN32API IPictureImpl_get_Width(LPPICTURE iface,
76 OLE_XSIZE_HIMETRIC * pWidth);
77static HRESULT WIN32API IPictureImpl_get_Height(LPPICTURE iface,
78 OLE_YSIZE_HIMETRIC * pHeight);
79static HRESULT WIN32API IPictureImpl_Render(LPPICTURE iface,
80 HDC hdc, LONG x, LONG y, LONG cx, LONG cy,
81 OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
82 OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc,
83 LPCRECT pRcWBounds);
84static HRESULT WIN32API IPictureImpl_set_hPal(LPPICTURE iface,
85 OLE_HANDLE hPal);
86static HRESULT WIN32API IPictureImpl_get_CurDC(LPPICTURE iface,
87 HDC * phDC);
88static HRESULT WIN32API IPictureImpl_SelectPicture(LPPICTURE iface,
89 HDC hDCIn, HDC * phDCOut, OLE_HANDLE * phBmpOut);
90static HRESULT WIN32API IPictureImpl_get_KeepOriginalFormat(LPPICTURE iface,
91 BOOL * pKeep);
92static HRESULT WIN32API IPictureImpl_put_KeepOriginalFormat(LPPICTURE iface,
93 BOOL Keep);
94static HRESULT WIN32API IPictureImpl_PictureChanged(LPPICTURE iface);
95static HRESULT WIN32API IPictureImpl_SaveAsFile(LPPICTURE iface,
96 LPSTREAM pStream, BOOL fSaveMemCopy, LONG * pCbSize);
97static HRESULT WIN32API IPictureImpl_get_Attributes(LPPICTURE iface,
98 DWORD * pDwAttr);
99
100// ----------------------------------------------------------------------
101// IDispatch
102// ----------------------------------------------------------------------
103static HRESULT WINAPI IPictureImpl_IDispatch_QueryInterface(LPDISPATCH iface,
104 REFIID riid, LPVOID * obj);
105static ULONG WINAPI IPictureImpl_IDispatch_AddRef(LPDISPATCH iface);
106static ULONG WINAPI IPictureImpl_IDispatch_Release(LPDISPATCH iface);
107static HRESULT WINAPI IPictureImpl_IDispatch_GetTypeInfoCount(LPDISPATCH iface,
108 unsigned int* pctinfo);
109static HRESULT WINAPI IPictureImpl_IDispatch_GetTypeInfo(LPDISPATCH iface,
110 UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo);
111static HRESULT WINAPI IPictureImpl_IDispatch_GetIDsOfNames(LPDISPATCH iface,
112 REFIID riid, LPOLESTR* rgszNames, UINT cNames,
113 LCID lcid, DISPID* rgDispId);
114static HRESULT WINAPI IPictureImpl_IDispatch_Invoke(LPDISPATCH iface,
115 DISPID dispIdMember, REFIID riid,
116 LCID lcid, WORD wFlags,
117 DISPPARAMS* pDispParams, VARIANT* pVarResult,
118 EXCEPINFO* pExepInfo, UINT* puArgErr);
119
120// ----------------------------------------------------------------------
121// IPersistStream
122// ----------------------------------------------------------------------
123static HRESULT WINAPI IPictureImpl_IPersistStream_QueryInterface(LPPERSISTSTREAM iface,
124 REFIID riid, LPVOID * obj);
125static ULONG WINAPI IPictureImpl_IPersistStream_AddRef(LPPERSISTSTREAM iface);
126static ULONG WINAPI IPictureImpl_IPersistStream_Release(LPPERSISTSTREAM iface);
127static HRESULT WINAPI IPictureImpl_IPersistStream_GetClassID(LPPERSISTSTREAM iface,
128 CLSID * pClassID);
129static HRESULT WINAPI IPictureImpl_IPersistStream_IsDirty(LPPERSISTSTREAM iface);
130static HRESULT WINAPI IPictureImpl_IPersistStream_Load(LPPERSISTSTREAM iface,
131 LPSTREAM pLoadStream);
132static HRESULT WINAPI IPictureImpl_IPersistStream_Save(LPPERSISTSTREAM iface,
133 LPSTREAM pOutStream, BOOL fClearDirty);
134static HRESULT WINAPI IPictureImpl_IPersistStream_GetSizeMax(LPPERSISTSTREAM iface,
135 ULARGE_INTEGER * pcbSize);
136
137// ======================================================================
138// Local Data
139// ======================================================================
140static ICOM_VTABLE(IPicture) IPictureImpl_VTable =
141{
142 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
143 IPictureImpl_QueryInterface,
144 IPictureImpl_AddRef,
145 IPictureImpl_Release,
146 IPictureImpl_get_Handle,
147 IPictureImpl_get_hPal,
148 IPictureImpl_get_Type,
149 IPictureImpl_get_Width,
150 IPictureImpl_get_Height,
151 IPictureImpl_Render,
152 IPictureImpl_set_hPal,
153 IPictureImpl_get_CurDC,
154 IPictureImpl_SelectPicture,
155 IPictureImpl_get_KeepOriginalFormat,
156 IPictureImpl_put_KeepOriginalFormat,
157 IPictureImpl_PictureChanged,
158 IPictureImpl_SaveAsFile,
159 IPictureImpl_get_Attributes
160};
161
162static ICOM_VTABLE(IDispatch) IPictureImpl_IDispatch_VTable =
163{
164 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
165 IPictureImpl_IDispatch_QueryInterface,
166 IPictureImpl_IDispatch_AddRef,
167 IPictureImpl_IDispatch_Release,
168 IPictureImpl_IDispatch_GetTypeInfoCount,
169 IPictureImpl_IDispatch_GetTypeInfo,
170 IPictureImpl_IDispatch_GetIDsOfNames,
171 IPictureImpl_IDispatch_Invoke
172};
173
174static ICOM_VTABLE(IPersistStream) IPictureImpl_IPersistStream_VTable =
175{
176 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
177 IPictureImpl_IPersistStream_QueryInterface,
178 IPictureImpl_IPersistStream_AddRef,
179 IPictureImpl_IPersistStream_Release,
180 IPictureImpl_IPersistStream_GetClassID,
181 IPictureImpl_IPersistStream_IsDirty,
182 IPictureImpl_IPersistStream_Load,
183 IPictureImpl_IPersistStream_Save,
184 IPictureImpl_IPersistStream_GetSizeMax
185};
186
187// ======================================================================
188// Local Methods
189// ======================================================================
190
191// ----------------------------------------------------------------------
192// IPictureImpl_QueryInterface
193// ----------------------------------------------------------------------
194static IPictureImpl * IPictureImpl_Constructor(LPPICTDESC description, BOOL fOwn)
195{
196 IPictureImpl * newObject;
197
198 // Allocate a new object on the heap...
199 if ((newObject = (IPictureImpl *)HeapAlloc(GetProcessHeap(), 0, sizeof(IPictureImpl))) == 0)
200 return 0;
201
202 dprintf(("OLEAUT32: IPictureImpl(%p)->Contructor()\n", newObject));
203
204 // Initialise the vft's
205 newObject->lpvtbl1 = &IPictureImpl_VTable;
206 newObject->lpvtbl2 = &IPictureImpl_IDispatch_VTable;
207 newObject->lpvtbl3 = &IPictureImpl_IPersistStream_VTable;
208
209 // Initial reference count of 1...
210 newObject->ref = 1;
211 newObject->fOwn = fOwn;
212
213 // If a description is not passed then leave the picture uninitialised...
214 if (description == 0)
215 newObject->sType = PICTYPE_NONE;
216 else
217 {
218 // Validate size...
219 if (description->cbSizeofstruct < sizeof(PICTDESC))
220 {
221 dprintf(("OLEAUT32: IPictureImpl(%p)->Constructor - Invalid cbSizeofstruct!", newObject));
222 return 0;
223 }
224 switch(description->picType)
225 {
226 case PICTYPE_BITMAP:
227 dprintf(("OLEAUT32: IPictureImpl(%p)->Constructor - Creating bitmap", newObject));
228
229 newObject->sType = PICTYPE_BITMAP;
230
231 // Allocate picture from bitmap...
232
233// newObject->description.u.bmp.hbitmap = description->u.bmp.hbitmap;
234// newObject->description.u.bmp.hpal = description->u.bmp.hpal;
235
236 break;
237
238 case PICTYPE_METAFILE:
239 dprintf(("OLEAUT32: IPictureImpl(%p)->Constructor - Creating metafile", newObject));
240
241 newObject->sType = PICTYPE_METAFILE;
242
243// newObject->description.u.wmf.hmeta = description->u.wmf.hmeta;
244// newObject->description.u.wmf.xExt = description->u.wmf.xExt;
245// newObject->description.u.wmf.yExt = description->u.wmf.yExt;
246 break;
247
248 case PICTYPE_ICON:
249 dprintf(("OLEAUT32: IPictureImpl(%p)->Constructor - Creating icon", newObject));
250
251 newObject->sType = PICTYPE_ICON;
252
253// newObject->description.u.icon.hicon = description->u.icon.hicon;
254 break;
255
256 case PICTYPE_ENHMETAFILE:
257 dprintf(("OLEAUT32: IPictureImpl(%p)->Constructor - Creating enh metafile", newObject));
258 newObject->sType = PICTYPE_ENHMETAFILE;
259
260// newObject->description.u.emf.hemf = description->u.emf.hemf;
261 break;
262
263 default:
264 // assume uninitialised...
265 dprintf(("OLEAUT32: IPictureImpl(%p)->Constructor - Creating uninitialised", newObject));
266 newObject->sType = PICTYPE_NONE;
267 break;
268 }
269 }
270
271 return newObject;
272}
273
274// ----------------------------------------------------------------------
275// IPictureImpl_QueryInterface
276// ----------------------------------------------------------------------
277static void IPictureImpl_Destructor(IPictureImpl * obj)
278{
279 dprintf(("OLEAUT32: IPictureImpl(%p)->Destructor()\n", obj));
280
281 HeapFree(GetProcessHeap(), 0, obj);
282}
283
284// ----------------------------------------------------------------------
285// IPictureImpl_QueryInterface
286// ----------------------------------------------------------------------
287static HRESULT WIN32API IPictureImpl_QueryInterface(LPPICTURE iface, REFIID refiid, LPVOID *obj)
288{
289 _ICOM_THIS(IPictureImpl, iface);
290
291 dprintf(("OLEAUT32: IPictureImpl(%p)->QueryInterface()", This));
292
293 // Sanity check...
294 if ((This == 0) || (obj == 0))
295 return E_INVALIDARG;
296
297 // Initialise return jic...
298 *obj = 0;
299
300 // Go find the correct interface...
301 if (IsEqualIID(&IID_IUnknown, refiid))
302 *obj = &(This->lpvtbl1);
303 else if (IsEqualIID(&IID_IPicture, refiid))
304 *obj = &(This->lpvtbl1);
305 else if (IsEqualIID(&IID_IDispatch, refiid))
306 *obj = &(This->lpvtbl2);
307 else if (IsEqualIID(&IID_IPictureDisp, refiid))
308 *obj = &(This->lpvtbl2);
309 else if (IsEqualIID(&IID_IPersistStream, refiid))
310 *obj = &(This->lpvtbl3);
311 else
312 return OLE_E_ENUM_NOMORE;
313
314 // Query Interface always increases the reference count by one...
315 IPictureImpl_AddRef((LPPICTURE)This);
316
317 return S_OK;
318}
319
320// ----------------------------------------------------------------------
321// IPictureImpl_AddRef
322// ----------------------------------------------------------------------
323static ULONG WIN32API IPictureImpl_AddRef(LPPICTURE iface)
324{
325 _ICOM_THIS(IPictureImpl, iface);
326
327 dprintf(("OLEAUT32: IPictureImpl(%p)->AddRef()", This));
328
329 return ++(This->ref);
330}
331
332// ----------------------------------------------------------------------
333// IPictureImpl_Release
334// ----------------------------------------------------------------------
335static ULONG WIN32API IPictureImpl_Release(LPPICTURE iface)
336{
337 _ICOM_THIS(IPictureImpl, iface);
338
339 dprintf(("OLEAUT32: IPictureImpl(%p)->Release()\n", This));
340
341 if (--(This->ref) == 0)
342 {
343 IPictureImpl_Destructor(This);
344 return 0;
345 }
346 return This->ref;
347}
348
349// ----------------------------------------------------------------------
350// IPictureImpl_get_Handle
351// ----------------------------------------------------------------------
352static HRESULT WIN32API IPictureImpl_get_Handle(LPPICTURE iface,
353 OLE_HANDLE * pHandle)
354{
355 _ICOM_THIS(IPictureImpl, iface);
356
357 dprintf(("OLEAUT32: IPictureImpl(%p)->get_Handle()", This));
358
359 // Sanity check...
360 if (pHandle == 0)
361 return E_POINTER;
362
363 // Return the handle...
364 *pHandle = This->hPicture;
365
366 return S_OK;
367}
368
369// ----------------------------------------------------------------------
370// IPictureImpl_get_hPal
371// ----------------------------------------------------------------------
372static HRESULT WIN32API IPictureImpl_get_hPal(LPPICTURE iface,
373 OLE_HANDLE * phPal)
374{
375 _ICOM_THIS(IPictureImpl, iface);
376
377 dprintf(("OLEAUT32: IPictureImpl(%p)->get_hPal()", This));
378
379 // Sanity check...
380 if (phPal == 0)
381 return E_POINTER;
382
383 // Return the handle...
384 *phPal = This->hPal;
385
386 return S_OK;
387}
388
389// ----------------------------------------------------------------------
390// IPictureImpl_get_Type
391// ----------------------------------------------------------------------
392static HRESULT WIN32API IPictureImpl_get_Type(LPPICTURE iface,
393 SHORT * pType)
394{
395 _ICOM_THIS(IPictureImpl, iface);
396
397 dprintf(("OLEAUT32: IPictureImpl(%p)->get_Type()", This));
398
399 // Sanity check...
400 if (pType == 0)
401 return E_POINTER;
402
403 // Return the type...
404 if (This->sType == PICTYPE_NONE)
405 *pType = PICTYPE_UNINITIALIZED;
406 else
407 *pType = This->sType;
408
409 return S_OK;
410}
411
412// ----------------------------------------------------------------------
413//
414// ----------------------------------------------------------------------
415static HRESULT WIN32API IPictureImpl_get_Width(LPPICTURE iface,
416 OLE_XSIZE_HIMETRIC * pWidth)
417{
418 _ICOM_THIS(IPictureImpl, iface);
419
420 dprintf(("OLEAUT32: IPictureImpl(%p)->get_Width()", This));
421
422 return E_NOTIMPL;
423}
424
425// ----------------------------------------------------------------------
426//
427// ----------------------------------------------------------------------
428static HRESULT WIN32API IPictureImpl_get_Height(LPPICTURE iface,
429 OLE_YSIZE_HIMETRIC * pHeight)
430{
431 _ICOM_THIS(IPictureImpl, iface);
432
433 dprintf(("OLEAUT32: IPictureImpl(%p)->get_Height()", This));
434
435 return E_NOTIMPL;
436}
437
438// ----------------------------------------------------------------------
439//
440// ----------------------------------------------------------------------
441static HRESULT WIN32API IPictureImpl_Render(LPPICTURE iface,
442 HDC hdc, LONG x, LONG y, LONG cx, LONG cy,
443 OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
444 OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc,
445 LPCRECT pRcWBounds)
446{
447 _ICOM_THIS(IPictureImpl, iface);
448
449 dprintf(("OLEAUT32: IPictureImpl(%p)->Render()", This));
450
451 return E_NOTIMPL;
452}
453
454// ----------------------------------------------------------------------
455//
456// ----------------------------------------------------------------------
457static HRESULT WIN32API IPictureImpl_set_hPal(LPPICTURE iface,
458 OLE_HANDLE hPal)
459{
460 _ICOM_THIS(IPictureImpl, iface);
461
462 dprintf(("OLEAUT32: IPictureImpl(%p)->set_hPal()", This));
463
464 return E_NOTIMPL;
465}
466
467// ----------------------------------------------------------------------
468//
469// ----------------------------------------------------------------------
470static HRESULT WIN32API IPictureImpl_get_CurDC(LPPICTURE iface,
471 HDC * phDC)
472{
473 _ICOM_THIS(IPictureImpl, iface);
474
475 dprintf(("OLEAUT32: IPictureImpl(%p)->get_CurDC()", This));
476
477 return E_NOTIMPL;
478}
479
480// ----------------------------------------------------------------------
481//
482// ----------------------------------------------------------------------
483static HRESULT WIN32API IPictureImpl_SelectPicture(LPPICTURE iface,
484 HDC hDCIn, HDC * phDCOut, OLE_HANDLE * phBmpOut)
485{
486 _ICOM_THIS(IPictureImpl, iface);
487
488 dprintf(("OLEAUT32: IPictureImpl(%p)->SelectPicture()", This));
489
490 return E_NOTIMPL;
491}
492
493// ----------------------------------------------------------------------
494//
495// ----------------------------------------------------------------------
496static HRESULT WIN32API IPictureImpl_get_KeepOriginalFormat(LPPICTURE iface,
497 BOOL * pKeep)
498{
499 _ICOM_THIS(IPictureImpl, iface);
500
501 dprintf(("OLEAUT32: IPictureImpl(%p)->get_KeepOriginalFormat()", This));
502
503 // Sanity check...
504 if (pKeep == 0)
505 return E_POINTER;
506
507 // Return the current setting...
508 *pKeep = This->fKeepOriginalFormat;
509
510 return S_OK;
511}
512
513// ----------------------------------------------------------------------
514//
515// ----------------------------------------------------------------------
516static HRESULT WIN32API IPictureImpl_put_KeepOriginalFormat(LPPICTURE iface,
517 BOOL Keep)
518{
519 _ICOM_THIS(IPictureImpl, iface);
520
521 dprintf(("OLEAUT32: IPictureImpl(%p)->put_KeepOriginalFormat()", This));
522
523 // Save it...
524 This->fKeepOriginalFormat = Keep;
525
526 return S_OK;
527}
528
529// ----------------------------------------------------------------------
530//
531// ----------------------------------------------------------------------
532static HRESULT WIN32API IPictureImpl_PictureChanged(LPPICTURE iface)
533{
534 _ICOM_THIS(IPictureImpl, iface);
535
536 dprintf(("OLEAUT32: IPictureImpl(%p)->PictureChanged()", This));
537
538 return S_OK;
539}
540
541// ----------------------------------------------------------------------
542//
543// ----------------------------------------------------------------------
544static HRESULT WIN32API IPictureImpl_SaveAsFile(LPPICTURE iface,
545 LPSTREAM pStream, BOOL fSaveMemCopy, LONG * pCbSize)
546{
547 _ICOM_THIS(IPictureImpl, iface);
548
549 dprintf(("OLEAUT32: IPictureImpl(%p)->SaveAsFile()", This));
550
551 return E_NOTIMPL;
552}
553
554// ----------------------------------------------------------------------
555//
556// ----------------------------------------------------------------------
557static HRESULT WIN32API IPictureImpl_get_Attributes(LPPICTURE iface,
558 DWORD * pDwAttr)
559{
560 _ICOM_THIS(IPictureImpl, iface);
561
562 dprintf(("OLEAUT32: IPictureImpl(%p)->get_Attributes()", This));
563
564 return E_NOTIMPL;
565}
566
567
568// ----------------------------------------------------------------------
569//
570// ----------------------------------------------------------------------
571static HRESULT WINAPI IPictureImpl_IDispatch_QueryInterface(LPDISPATCH iface,
572 REFIID riid, LPVOID * obj)
573{
574 _ICOM_THIS_From_IDispatch(IPicture, iface);
575
576 return IPictureImpl_QueryInterface(This, riid, obj);
577}
578
579// ----------------------------------------------------------------------
580//
581// ----------------------------------------------------------------------
582static ULONG WINAPI IPictureImpl_IDispatch_AddRef(LPDISPATCH iface)
583{
584 _ICOM_THIS_From_IDispatch(IPicture, iface);
585
586 return IPictureImpl_AddRef(This);
587}
588
589// ----------------------------------------------------------------------
590//
591// ----------------------------------------------------------------------
592static ULONG WINAPI IPictureImpl_IDispatch_Release(LPDISPATCH iface)
593{
594 _ICOM_THIS_From_IDispatch(IPicture, iface);
595
596 return IPictureImpl_Release(This);
597}
598
599// ----------------------------------------------------------------------
600//
601// ----------------------------------------------------------------------
602static HRESULT WINAPI IPictureImpl_IDispatch_GetTypeInfoCount(LPDISPATCH iface,
603 unsigned int* pctinfo)
604{
605 dprintf(("Stub"));
606 return E_NOTIMPL;
607}
608
609// ----------------------------------------------------------------------
610//
611// ----------------------------------------------------------------------
612static HRESULT WINAPI IPictureImpl_IDispatch_GetTypeInfo(LPDISPATCH iface,
613 UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo)
614{
615 dprintf(("Stub"));
616 return E_NOTIMPL;
617}
618
619// ----------------------------------------------------------------------
620//
621// ----------------------------------------------------------------------
622static HRESULT WINAPI IPictureImpl_IDispatch_GetIDsOfNames(LPDISPATCH iface,
623 REFIID riid, LPOLESTR* rgszNames, UINT cNames,
624 LCID lcid, DISPID* rgDispId)
625{
626 dprintf(("Stub"));
627 return E_NOTIMPL;
628}
629
630// ----------------------------------------------------------------------
631//
632// ----------------------------------------------------------------------
633static HRESULT WINAPI IPictureImpl_IDispatch_Invoke(LPDISPATCH iface,
634 DISPID dispIdMember, REFIID riid,
635 LCID lcid, WORD wFlags,
636 DISPPARAMS* pDispParams, VARIANT* pVarResult,
637 EXCEPINFO* pExepInfo, UINT* puArgErr)
638{
639 dprintf(("Stub"));
640 return E_NOTIMPL;
641}
642
643// ----------------------------------------------------------------------
644//
645// ----------------------------------------------------------------------
646static HRESULT WINAPI IPictureImpl_IPersistStream_QueryInterface(LPPERSISTSTREAM iface,
647 REFIID riid, LPVOID * obj)
648{
649 _ICOM_THIS_From_IPersistStream(IPicture, iface);
650
651 return IPictureImpl_QueryInterface(This, riid, obj);
652}
653
654// ----------------------------------------------------------------------
655//
656// ----------------------------------------------------------------------
657static ULONG WINAPI IPictureImpl_IPersistStream_AddRef(LPPERSISTSTREAM iface)
658{
659 _ICOM_THIS_From_IPersistStream(IPicture, iface);
660
661 return IPictureImpl_AddRef(This);
662}
663
664// ----------------------------------------------------------------------
665//
666// ----------------------------------------------------------------------
667static ULONG WINAPI IPictureImpl_IPersistStream_Release(LPPERSISTSTREAM iface)
668{
669 _ICOM_THIS_From_IPersistStream(IPicture, iface);
670
671 return IPictureImpl_Release(This);
672}
673
674// ----------------------------------------------------------------------
675//
676// ----------------------------------------------------------------------
677static HRESULT WINAPI IPictureImpl_IPersistStream_GetClassID(LPPERSISTSTREAM iface,
678 CLSID * pClassID)
679{
680 dprintf(("Stub"));
681 return E_NOTIMPL;
682}
683
684// ----------------------------------------------------------------------
685//
686// ----------------------------------------------------------------------
687static HRESULT WINAPI IPictureImpl_IPersistStream_IsDirty(LPPERSISTSTREAM iface)
688{
689 dprintf(("Stub"));
690 return E_NOTIMPL;
691}
692
693// ----------------------------------------------------------------------
694//
695// ----------------------------------------------------------------------
696static HRESULT WINAPI IPictureImpl_IPersistStream_Load(LPPERSISTSTREAM iface,
697 LPSTREAM pLoadStream)
698{
699 dprintf(("Stub"));
700 return E_NOTIMPL;
701}
702
703// ----------------------------------------------------------------------
704//
705// ----------------------------------------------------------------------
706static HRESULT WINAPI IPictureImpl_IPersistStream_Save(LPPERSISTSTREAM iface,
707 LPSTREAM pOutStream, BOOL fClearDirty)
708{
709 dprintf(("Stub"));
710 return E_NOTIMPL;
711}
712
713// ----------------------------------------------------------------------
714//
715// ----------------------------------------------------------------------
716static HRESULT WINAPI IPictureImpl_IPersistStream_GetSizeMax(LPPERSISTSTREAM iface,
717 ULARGE_INTEGER * pcbSize)
718{
719 dprintf(("Stub"));
720 return E_NOTIMPL;
721}
722
723
724// ======================================================================
725// Public API's
726// ======================================================================
727
728// ----------------------------------------------------------------------
729// OleLoadPicture
730// ----------------------------------------------------------------------
731HRESULT WIN32API OleLoadPicture(LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
732 REFIID riid, LPVOID * lplpvObj)
733{
734 dprintf(("OLEAUT32: OleLoadPicture - stub"));
735 return S_OK;
736}
737
738// ----------------------------------------------------------------------
739// OleCreatePictureIndirect
740// ----------------------------------------------------------------------
741HRESULT WIN32API OleCreatePictureIndirect(LPPICTDESC lpPictDesc, REFIID riid,
742 BOOL fOwn, LPVOID * lplpvObj)
743{
744 IPictureImpl * newPicture;
745 HRESULT hr;
746
747 dprintf(("OLEAUT32: OleCreatePictureIndirect"));
748
749 // Validate input pointer...
750 if (lplpvObj == 0)
751 return E_POINTER;
752
753 *lplpvObj = 0;
754
755 // Create new picture object...
756 newPicture = IPictureImpl_Constructor(lpPictDesc, fOwn);
757
758 if (newPicture == 0)
759 return E_OUTOFMEMORY;
760
761 // Grab and return the requested interface...
762 hr = IPictureImpl_QueryInterface((LPPICTURE)newPicture, riid, lplpvObj);
763
764 // We should now have two references :-)
765 // One from the constructor & one from QueryInterface
766 // Release one...
767 IPictureImpl_Release((LPPICTURE)newPicture);
768
769 return hr;
770}
771
772// ----------------------------------------------------------------------
773// OleLoadPictureFile
774// ----------------------------------------------------------------------
775HRESULT WIN32API OleLoadPictureFile(VARIANT varFileName, LPDISPATCH* lplpdispPicture)
776{
777 dprintf(("OLEAUT32: OleLoadPictureFile - stub"));
778 return S_OK;
779}
780
781// ----------------------------------------------------------------------
782// OleSavePictureFile
783// ----------------------------------------------------------------------
784HRESULT WIN32API OleSavePictureFile(LPDISPATCH lpdispPicture,
785 BSTR bstrFileName)
786{
787 dprintf(("OLEAUT32: OleSavePictureFile - stub"));
788 return S_OK;
789}
790
791// ----------------------------------------------------------------------
792// OleLoadPicturePath
793// ----------------------------------------------------------------------
794HRESULT WIN32API OleLoadPicturePath
795 (LPOLESTR szURLorPath,
796 LPUNKNOWN punkCaller,
797 DWORD dwReserved,
798 OLE_COLOR clrReserved,
799 REFIID riid,
800 LPVOID * ppvRet )
801{
802 dprintf(("OLEAUT32: OleLoadPicturePath - stub"));
803 return S_OK;
804}
805
806
Note: See TracBrowser for help on using the repository browser.