4 * Implementation of OLE IPicture and related interfaces
6 * Copyright 2000 Huw D M Davies for CodeWeavers.
7 * Copyright 2001 Marcus Meissner
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * Support PICTYPE_BITMAP and PICTYPE_ICON, altough only bitmaps very well..
26 * Lots of methods are just stubs.
29 * NOTES (or things that msdn doesn't tell you)
31 * The width and height properties are returned in HIMETRIC units (0.01mm)
32 * IPicture::Render also uses these to select a region of the src picture.
33 * A bitmap's size is converted into these units by using the screen resolution
34 * thus an 8x8 bitmap on a 96dpi screen has a size of 212x212 (8/96 * 2540).
47 /* Must be before wine includes, the header has things conflicting with
54 #define NONAMELESSUNION
55 #define NONAMELESSSTRUCT
65 #include "wine/debug.h"
67 #include "wine/wingdi16.h"
68 #include "cursoricon.h"
71 /* This is a hack, so jpeglib.h does not redefine INT32 and the like*/
73 #define UINT8 JPEG_UINT8
74 #define UINT16 JPEG_UINT16
82 WINE_DEFAULT_DEBUG_CHANNEL(ole
);
84 /*************************************************************************
85 * Declaration of implementation class
88 typedef struct OLEPictureImpl
{
91 * IPicture handles IUnknown
94 ICOM_VTABLE(IPicture
) *lpvtbl1
;
95 ICOM_VTABLE(IDispatch
) *lpvtbl2
;
96 ICOM_VTABLE(IPersistStream
) *lpvtbl3
;
97 ICOM_VTABLE(IConnectionPointContainer
) *lpvtbl4
;
99 /* Object referenece count */
102 /* We own the object and must destroy it ourselves */
105 /* Picture description */
108 /* These are the pixel size of a bitmap */
112 /* And these are the size of the picture converted into HIMETRIC units */
113 OLE_XSIZE_HIMETRIC himetricWidth
;
114 OLE_YSIZE_HIMETRIC himetricHeight
;
116 IConnectionPoint
*pCP
;
127 * Macros to retrieve pointer to IUnknown (IPicture) from the other VTables.
129 #define ICOM_THIS_From_IDispatch(impl, name) \
130 impl *This = (impl*)(((char*)name)-sizeof(void*));
131 #define ICOM_THIS_From_IPersistStream(impl, name) \
132 impl *This = (impl*)(((char*)name)-2*sizeof(void*));
133 #define ICOM_THIS_From_IConnectionPointContainer(impl, name) \
134 impl *This = (impl*)(((char*)name)-3*sizeof(void*));
137 * Predeclare VTables. They get initialized at the end.
139 static ICOM_VTABLE(IPicture
) OLEPictureImpl_VTable
;
140 static ICOM_VTABLE(IDispatch
) OLEPictureImpl_IDispatch_VTable
;
141 static ICOM_VTABLE(IPersistStream
) OLEPictureImpl_IPersistStream_VTable
;
142 static ICOM_VTABLE(IConnectionPointContainer
) OLEPictureImpl_IConnectionPointContainer_VTable
;
144 /***********************************************************************
145 * Implementation of the OLEPictureImpl class.
148 static void OLEPictureImpl_SetBitmap(OLEPictureImpl
*This
) {
152 TRACE("bitmap handle %p\n", This
->desc
.u
.bmp
.hbitmap
);
153 if(GetObjectA(This
->desc
.u
.bmp
.hbitmap
, sizeof(bm
), &bm
) != sizeof(bm
)) {
154 ERR("GetObject fails\n");
157 This
->origWidth
= bm
.bmWidth
;
158 This
->origHeight
= bm
.bmHeight
;
159 /* The width and height are stored in HIMETRIC units (0.01 mm),
160 so we take our pixel width divide by pixels per inch and
161 multiply by 25.4 * 100 */
162 /* Should we use GetBitmapDimension if available? */
163 hdcRef
= CreateCompatibleDC(0);
164 This
->himetricWidth
=(bm
.bmWidth
*2540)/GetDeviceCaps(hdcRef
, LOGPIXELSX
);
165 This
->himetricHeight
=(bm
.bmHeight
*2540)/GetDeviceCaps(hdcRef
, LOGPIXELSY
);
169 /************************************************************************
170 * OLEPictureImpl_Construct
172 * This method will construct a new instance of the OLEPictureImpl
175 * The caller of this method must release the object when it's
178 static OLEPictureImpl
* OLEPictureImpl_Construct(LPPICTDESC pictDesc
, BOOL fOwn
)
180 OLEPictureImpl
* newObject
= 0;
183 TRACE("(%p) type = %d\n", pictDesc
, pictDesc
->picType
);
186 * Allocate space for the object.
188 newObject
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(OLEPictureImpl
));
194 * Initialize the virtual function table.
196 newObject
->lpvtbl1
= &OLEPictureImpl_VTable
;
197 newObject
->lpvtbl2
= &OLEPictureImpl_IDispatch_VTable
;
198 newObject
->lpvtbl3
= &OLEPictureImpl_IPersistStream_VTable
;
199 newObject
->lpvtbl4
= &OLEPictureImpl_IConnectionPointContainer_VTable
;
201 CreateConnectionPoint((IUnknown
*)newObject
,&IID_IPropertyNotifySink
,&newObject
->pCP
);
204 * Start with one reference count. The caller of this function
205 * must release the interface pointer when it is done.
208 newObject
->hDCCur
= 0;
210 newObject
->fOwn
= fOwn
;
212 /* dunno about original value */
213 newObject
->keepOrigFormat
= TRUE
;
216 if(pictDesc
->cbSizeofstruct
!= sizeof(PICTDESC
)) {
217 FIXME("struct size = %d\n", pictDesc
->cbSizeofstruct
);
219 memcpy(&newObject
->desc
, pictDesc
, sizeof(PICTDESC
));
222 switch(pictDesc
->picType
) {
224 OLEPictureImpl_SetBitmap(newObject
);
227 case PICTYPE_METAFILE
:
228 TRACE("metafile handle %p\n", pictDesc
->u
.wmf
.hmeta
);
229 newObject
->himetricWidth
= pictDesc
->u
.wmf
.xExt
;
230 newObject
->himetricHeight
= pictDesc
->u
.wmf
.yExt
;
234 /* not sure what to do here */
235 newObject
->himetricWidth
= newObject
->himetricHeight
= 0;
239 case PICTYPE_ENHMETAFILE
:
241 FIXME("Unsupported type %d\n", pictDesc
->picType
);
242 newObject
->himetricWidth
= newObject
->himetricHeight
= 0;
246 newObject
->desc
.picType
= PICTYPE_UNINITIALIZED
;
249 TRACE("returning %p\n", newObject
);
253 /************************************************************************
254 * OLEPictureImpl_Destroy
256 * This method is called by the Release method when the reference
257 * count goes down to 0. It will free all resources used by
259 static void OLEPictureImpl_Destroy(OLEPictureImpl
* Obj
)
261 TRACE("(%p)\n", Obj
);
263 if(Obj
->fOwn
) { /* We need to destroy the picture */
264 switch(Obj
->desc
.picType
) {
266 DeleteObject(Obj
->desc
.u
.bmp
.hbitmap
);
268 case PICTYPE_METAFILE
:
269 DeleteMetaFile(Obj
->desc
.u
.wmf
.hmeta
);
272 DestroyIcon(Obj
->desc
.u
.icon
.hicon
);
274 case PICTYPE_ENHMETAFILE
:
275 DeleteEnhMetaFile(Obj
->desc
.u
.emf
.hemf
);
278 FIXME("Unsupported type %d - unable to delete\n", Obj
->desc
.picType
);
282 if (Obj
->data
) HeapFree(GetProcessHeap(), 0, Obj
->data
);
283 HeapFree(GetProcessHeap(), 0, Obj
);
286 static ULONG WINAPI
OLEPictureImpl_AddRef(IPicture
* iface
);
288 /************************************************************************
289 * OLEPictureImpl_QueryInterface (IUnknown)
291 * See Windows documentation for more details on IUnknown methods.
293 static HRESULT WINAPI
OLEPictureImpl_QueryInterface(
298 ICOM_THIS(OLEPictureImpl
, iface
);
299 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), ppvObject
);
302 * Perform a sanity check on the parameters.
304 if ( (This
==0) || (ppvObject
==0) )
308 * Initialize the return parameter.
313 * Compare the riid with the interface IDs implemented by this object.
315 if (memcmp(&IID_IUnknown
, riid
, sizeof(IID_IUnknown
)) == 0)
317 *ppvObject
= (IPicture
*)This
;
319 else if (memcmp(&IID_IPicture
, riid
, sizeof(IID_IPicture
)) == 0)
321 *ppvObject
= (IPicture
*)This
;
323 else if (memcmp(&IID_IDispatch
, riid
, sizeof(IID_IDispatch
)) == 0)
325 *ppvObject
= (IDispatch
*)&(This
->lpvtbl2
);
327 else if (memcmp(&IID_IPictureDisp
, riid
, sizeof(IID_IPictureDisp
)) == 0)
329 *ppvObject
= (IDispatch
*)&(This
->lpvtbl2
);
331 else if (memcmp(&IID_IPersistStream
, riid
, sizeof(IID_IPersistStream
)) == 0)
333 *ppvObject
= (IPersistStream
*)&(This
->lpvtbl3
);
335 else if (memcmp(&IID_IConnectionPointContainer
, riid
, sizeof(IID_IConnectionPointContainer
)) == 0)
337 *ppvObject
= (IConnectionPointContainer
*)&(This
->lpvtbl4
);
340 * Check that we obtained an interface.
344 FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid
));
345 return E_NOINTERFACE
;
349 * Query Interface always increases the reference count by one when it is
352 OLEPictureImpl_AddRef((IPicture
*)This
);
356 /***********************************************************************
357 * OLEPicture_SendNotify (internal)
359 * Sends notification messages of changed properties to any interested
362 static void OLEPicture_SendNotify(OLEPictureImpl
* this, DISPID dispID
)
364 IEnumConnections
*pEnum
;
367 if (IConnectionPoint_EnumConnections(this->pCP
, &pEnum
))
369 while(IEnumConnections_Next(pEnum
, 1, &CD
, NULL
) == S_OK
) {
370 IPropertyNotifySink
*sink
;
372 IUnknown_QueryInterface(CD
.pUnk
, &IID_IPropertyNotifySink
, (LPVOID
)&sink
);
373 IPropertyNotifySink_OnChanged(sink
, dispID
);
374 IPropertyNotifySink_Release(sink
);
375 IUnknown_Release(CD
.pUnk
);
377 IEnumConnections_Release(pEnum
);
381 /************************************************************************
382 * OLEPictureImpl_AddRef (IUnknown)
384 * See Windows documentation for more details on IUnknown methods.
386 static ULONG WINAPI
OLEPictureImpl_AddRef(
389 ICOM_THIS(OLEPictureImpl
, iface
);
390 TRACE("(%p)->(ref=%ld)\n", This
, This
->ref
);
396 /************************************************************************
397 * OLEPictureImpl_Release (IUnknown)
399 * See Windows documentation for more details on IUnknown methods.
401 static ULONG WINAPI
OLEPictureImpl_Release(
404 ICOM_THIS(OLEPictureImpl
, iface
);
405 TRACE("(%p)->(ref=%ld)\n", This
, This
->ref
);
408 * Decrease the reference count on this object.
413 * If the reference count goes down to 0, perform suicide.
417 OLEPictureImpl_Destroy(This
);
426 /************************************************************************
427 * OLEPictureImpl_get_Handle
429 static HRESULT WINAPI
OLEPictureImpl_get_Handle(IPicture
*iface
,
432 ICOM_THIS(OLEPictureImpl
, iface
);
433 TRACE("(%p)->(%p)\n", This
, phandle
);
434 switch(This
->desc
.picType
) {
436 *phandle
= (OLE_HANDLE
)This
->desc
.u
.bmp
.hbitmap
;
438 case PICTYPE_METAFILE
:
439 *phandle
= (OLE_HANDLE
)This
->desc
.u
.wmf
.hmeta
;
442 *phandle
= (OLE_HANDLE
)This
->desc
.u
.icon
.hicon
;
444 case PICTYPE_ENHMETAFILE
:
445 *phandle
= (OLE_HANDLE
)This
->desc
.u
.emf
.hemf
;
448 FIXME("Unimplemented type %d\n", This
->desc
.picType
);
451 TRACE("returning handle %08x\n", *phandle
);
455 /************************************************************************
456 * OLEPictureImpl_get_hPal
458 static HRESULT WINAPI
OLEPictureImpl_get_hPal(IPicture
*iface
,
461 ICOM_THIS(OLEPictureImpl
, iface
);
462 FIXME("(%p)->(%p): stub\n", This
, phandle
);
466 /************************************************************************
467 * OLEPictureImpl_get_Type
469 static HRESULT WINAPI
OLEPictureImpl_get_Type(IPicture
*iface
,
472 ICOM_THIS(OLEPictureImpl
, iface
);
473 TRACE("(%p)->(%p): type is %d\n", This
, ptype
, This
->desc
.picType
);
474 *ptype
= This
->desc
.picType
;
478 /************************************************************************
479 * OLEPictureImpl_get_Width
481 static HRESULT WINAPI
OLEPictureImpl_get_Width(IPicture
*iface
,
482 OLE_XSIZE_HIMETRIC
*pwidth
)
484 ICOM_THIS(OLEPictureImpl
, iface
);
485 TRACE("(%p)->(%p): width is %ld\n", This
, pwidth
, This
->himetricWidth
);
486 *pwidth
= This
->himetricWidth
;
490 /************************************************************************
491 * OLEPictureImpl_get_Height
493 static HRESULT WINAPI
OLEPictureImpl_get_Height(IPicture
*iface
,
494 OLE_YSIZE_HIMETRIC
*pheight
)
496 ICOM_THIS(OLEPictureImpl
, iface
);
497 TRACE("(%p)->(%p): height is %ld\n", This
, pheight
, This
->himetricHeight
);
498 *pheight
= This
->himetricHeight
;
502 /************************************************************************
503 * OLEPictureImpl_Render
505 static HRESULT WINAPI
OLEPictureImpl_Render(IPicture
*iface
, HDC hdc
,
506 long x
, long y
, long cx
, long cy
,
507 OLE_XPOS_HIMETRIC xSrc
,
508 OLE_YPOS_HIMETRIC ySrc
,
509 OLE_XSIZE_HIMETRIC cxSrc
,
510 OLE_YSIZE_HIMETRIC cySrc
,
513 ICOM_THIS(OLEPictureImpl
, iface
);
514 TRACE("(%p)->(%p, (%ld,%ld), (%ld,%ld) <- (%ld,%ld), (%ld,%ld), %p)\n",
515 This
, hdc
, x
, y
, cx
, cy
, xSrc
, ySrc
, cxSrc
, cySrc
, prcWBounds
);
517 TRACE("prcWBounds (%ld,%ld) - (%ld,%ld)\n", prcWBounds
->left
, prcWBounds
->top
,
518 prcWBounds
->right
, prcWBounds
->bottom
);
521 * While the documentation suggests this to be here (or after rendering?)
522 * it does cause an endless recursion in my sample app. -MM 20010804
523 OLEPicture_SendNotify(This,DISPID_PICT_RENDER);
526 switch(This
->desc
.picType
) {
532 /* Set a mapping mode that maps bitmap pixels into HIMETRIC units.
533 NB y-axis gets flipped */
535 hdcBmp
= CreateCompatibleDC(0);
536 SetMapMode(hdcBmp
, MM_ANISOTROPIC
);
537 SetWindowOrgEx(hdcBmp
, 0, 0, NULL
);
538 SetWindowExtEx(hdcBmp
, This
->himetricWidth
, This
->himetricHeight
, NULL
);
539 SetViewportOrgEx(hdcBmp
, 0, This
->origHeight
, NULL
);
540 SetViewportExtEx(hdcBmp
, This
->origWidth
, -This
->origHeight
, NULL
);
542 hbmpOld
= SelectObject(hdcBmp
, This
->desc
.u
.bmp
.hbitmap
);
544 StretchBlt(hdc
, x
, y
, cx
, cy
, hdcBmp
, xSrc
, ySrc
, cxSrc
, cySrc
, SRCCOPY
);
546 SelectObject(hdcBmp
, hbmpOld
);
551 FIXME("Not quite correct implementation of rendering icons...\n");
552 DrawIcon(hdc
,x
,y
,This
->desc
.u
.icon
.hicon
);
555 case PICTYPE_METAFILE
:
556 case PICTYPE_ENHMETAFILE
:
558 FIXME("type %d not implemented\n", This
->desc
.picType
);
564 /************************************************************************
565 * OLEPictureImpl_set_hPal
567 static HRESULT WINAPI
OLEPictureImpl_set_hPal(IPicture
*iface
,
570 ICOM_THIS(OLEPictureImpl
, iface
);
571 FIXME("(%p)->(%08x): stub\n", This
, hpal
);
572 OLEPicture_SendNotify(This
,DISPID_PICT_HPAL
);
576 /************************************************************************
577 * OLEPictureImpl_get_CurDC
579 static HRESULT WINAPI
OLEPictureImpl_get_CurDC(IPicture
*iface
,
582 ICOM_THIS(OLEPictureImpl
, iface
);
583 TRACE("(%p), returning %p\n", This
, This
->hDCCur
);
584 if (phdc
) *phdc
= This
->hDCCur
;
588 /************************************************************************
589 * OLEPictureImpl_SelectPicture
591 static HRESULT WINAPI
OLEPictureImpl_SelectPicture(IPicture
*iface
,
594 OLE_HANDLE
*phbmpOut
)
596 ICOM_THIS(OLEPictureImpl
, iface
);
597 TRACE("(%p)->(%p, %p, %p)\n", This
, hdcIn
, phdcOut
, phbmpOut
);
598 if (This
->desc
.picType
== PICTYPE_BITMAP
) {
599 SelectObject(hdcIn
,This
->desc
.u
.bmp
.hbitmap
);
602 *phdcOut
= This
->hDCCur
;
603 This
->hDCCur
= hdcIn
;
605 *phbmpOut
= (OLE_HANDLE
)This
->desc
.u
.bmp
.hbitmap
;
608 FIXME("Don't know how to select picture type %d\n",This
->desc
.picType
);
613 /************************************************************************
614 * OLEPictureImpl_get_KeepOriginalFormat
616 static HRESULT WINAPI
OLEPictureImpl_get_KeepOriginalFormat(IPicture
*iface
,
619 ICOM_THIS(OLEPictureImpl
, iface
);
620 TRACE("(%p)->(%p)\n", This
, pfKeep
);
623 *pfKeep
= This
->keepOrigFormat
;
627 /************************************************************************
628 * OLEPictureImpl_put_KeepOriginalFormat
630 static HRESULT WINAPI
OLEPictureImpl_put_KeepOriginalFormat(IPicture
*iface
,
633 ICOM_THIS(OLEPictureImpl
, iface
);
634 TRACE("(%p)->(%d)\n", This
, keep
);
635 This
->keepOrigFormat
= keep
;
636 /* FIXME: what DISPID notification here? */
640 /************************************************************************
641 * OLEPictureImpl_PictureChanged
643 static HRESULT WINAPI
OLEPictureImpl_PictureChanged(IPicture
*iface
)
645 ICOM_THIS(OLEPictureImpl
, iface
);
646 TRACE("(%p)->()\n", This
);
647 OLEPicture_SendNotify(This
,DISPID_PICT_HANDLE
);
651 /************************************************************************
652 * OLEPictureImpl_SaveAsFile
654 static HRESULT WINAPI
OLEPictureImpl_SaveAsFile(IPicture
*iface
,
659 ICOM_THIS(OLEPictureImpl
, iface
);
660 FIXME("(%p)->(%p, %d, %p), hacked stub.\n", This
, pstream
, SaveMemCopy
, pcbSize
);
661 return IStream_Write(pstream
,This
->data
,This
->datalen
,(ULONG
*)pcbSize
);
664 /************************************************************************
665 * OLEPictureImpl_get_Attributes
667 static HRESULT WINAPI
OLEPictureImpl_get_Attributes(IPicture
*iface
,
670 ICOM_THIS(OLEPictureImpl
, iface
);
671 TRACE("(%p)->(%p).\n", This
, pdwAttr
);
673 switch (This
->desc
.picType
) {
674 case PICTYPE_BITMAP
: break; /* not 'truely' scalable, see MSDN. */
675 case PICTYPE_ICON
: *pdwAttr
= PICTURE_TRANSPARENT
;break;
676 case PICTYPE_METAFILE
: *pdwAttr
= PICTURE_TRANSPARENT
|PICTURE_SCALABLE
;break;
677 default:FIXME("Unknown pictype %d\n",This
->desc
.picType
);break;
683 /************************************************************************
684 * IConnectionPointContainer
687 static HRESULT WINAPI
OLEPictureImpl_IConnectionPointContainer_QueryInterface(
688 IConnectionPointContainer
* iface
,
692 ICOM_THIS_From_IConnectionPointContainer(IPicture
,iface
);
694 return IPicture_QueryInterface(This
,riid
,ppvoid
);
697 static ULONG WINAPI
OLEPictureImpl_IConnectionPointContainer_AddRef(
698 IConnectionPointContainer
* iface
)
700 ICOM_THIS_From_IConnectionPointContainer(IPicture
, iface
);
702 return IPicture_AddRef(This
);
705 static ULONG WINAPI
OLEPictureImpl_IConnectionPointContainer_Release(
706 IConnectionPointContainer
* iface
)
708 ICOM_THIS_From_IConnectionPointContainer(IPicture
, iface
);
710 return IPicture_Release(This
);
713 static HRESULT WINAPI
OLEPictureImpl_EnumConnectionPoints(
714 IConnectionPointContainer
* iface
,
715 IEnumConnectionPoints
** ppEnum
717 ICOM_THIS_From_IConnectionPointContainer(IPicture
, iface
);
719 FIXME("(%p,%p), stub!\n",This
,ppEnum
);
723 static HRESULT WINAPI
OLEPictureImpl_FindConnectionPoint(
724 IConnectionPointContainer
* iface
,
726 IConnectionPoint
**ppCP
728 ICOM_THIS_From_IConnectionPointContainer(OLEPictureImpl
, iface
);
729 TRACE("(%p,%s,%p)\n",This
,debugstr_guid(riid
),ppCP
);
733 if (IsEqualGUID(riid
,&IID_IPropertyNotifySink
))
734 return IConnectionPoint_QueryInterface(This
->pCP
,&IID_IConnectionPoint
,(LPVOID
)ppCP
);
735 FIXME("tried to find connection point on %s?\n",debugstr_guid(riid
));
738 /************************************************************************
741 /************************************************************************
742 * OLEPictureImpl_IPersistStream_QueryInterface (IUnknown)
744 * See Windows documentation for more details on IUnknown methods.
746 static HRESULT WINAPI
OLEPictureImpl_IPersistStream_QueryInterface(
747 IPersistStream
* iface
,
751 ICOM_THIS_From_IPersistStream(IPicture
, iface
);
753 return IPicture_QueryInterface(This
, riid
, ppvoid
);
756 /************************************************************************
757 * OLEPictureImpl_IPersistStream_AddRef (IUnknown)
759 * See Windows documentation for more details on IUnknown methods.
761 static ULONG WINAPI
OLEPictureImpl_IPersistStream_AddRef(
762 IPersistStream
* iface
)
764 ICOM_THIS_From_IPersistStream(IPicture
, iface
);
766 return IPicture_AddRef(This
);
769 /************************************************************************
770 * OLEPictureImpl_IPersistStream_Release (IUnknown)
772 * See Windows documentation for more details on IUnknown methods.
774 static ULONG WINAPI
OLEPictureImpl_IPersistStream_Release(
775 IPersistStream
* iface
)
777 ICOM_THIS_From_IPersistStream(IPicture
, iface
);
779 return IPicture_Release(This
);
782 /************************************************************************
783 * OLEPictureImpl_IPersistStream_GetClassID
785 static HRESULT WINAPI
OLEPictureImpl_GetClassID(
786 IPersistStream
* iface
,CLSID
* pClassID
)
788 ICOM_THIS_From_IPersistStream(IPicture
, iface
);
789 FIXME("(%p),stub!\n",This
);
793 /************************************************************************
794 * OLEPictureImpl_IPersistStream_IsDirty
796 static HRESULT WINAPI
OLEPictureImpl_IsDirty(
797 IPersistStream
* iface
)
799 ICOM_THIS_From_IPersistStream(IPicture
, iface
);
800 FIXME("(%p),stub!\n",This
);
805 /* for the jpeg decompressor source manager. */
806 static void _jpeg_init_source(j_decompress_ptr cinfo
) { }
808 static boolean
_jpeg_fill_input_buffer(j_decompress_ptr cinfo
) {
809 ERR("(), should not get here.\n");
813 static void _jpeg_skip_input_data(j_decompress_ptr cinfo
,long num_bytes
) {
814 TRACE("Skipping %ld bytes...\n", num_bytes
);
815 cinfo
->src
->next_input_byte
+= num_bytes
;
816 cinfo
->src
->bytes_in_buffer
-= num_bytes
;
819 static boolean
_jpeg_resync_to_restart(j_decompress_ptr cinfo
, int desired
) {
820 ERR("(desired=%d), should not get here.\n",desired
);
823 static void _jpeg_term_source(j_decompress_ptr cinfo
) { }
824 #endif /* HAVE_LIBJPEG */
833 static int _gif_inputfunc(GifFileType
*gif
, GifByteType
*data
, int len
) {
834 struct gifdata
*gd
= (struct gifdata
*)gif
->UserData
;
836 if (len
+gd
->curoff
> gd
->len
) {
837 FIXME("Trying to read %d bytes, but only %d available.\n",len
, gd
->len
-gd
->curoff
);
838 len
= gd
->len
- gd
->curoff
;
840 memcpy(data
, gd
->data
+gd
->curoff
, len
);
846 /************************************************************************
847 * OLEPictureImpl_IPersistStream_Load (IUnknown)
849 * Loads the binary data from the IStream. Starts at current position.
850 * There appears to be an 2 DWORD header:
854 * Currently implemented: BITMAP, ICON, JPEG.
856 static HRESULT WINAPI
OLEPictureImpl_Load(IPersistStream
* iface
,IStream
*pStm
) {
863 ICOM_THIS_From_IPersistStream(OLEPictureImpl
, iface
);
865 TRACE("(%p,%p)\n",This
,pStm
);
867 /* Sometimes we have a header, sometimes we don't. Apply some guesses to find
870 hr
=IStream_Stat(pStm
,&statstg
,STATFLAG_NONAME
);
872 FIXME("Stat failed with hres %lx\n",hr
);
873 hr
=IStream_Read(pStm
,header
,8,&xread
);
874 if (hr
|| xread
!=8) {
875 FIXME("Failure while reading picture header (hr is %lx, nread is %ld).\n",hr
,xread
);
878 if (header
[1] > statstg
.cbSize
.QuadPart
|| (header
[1]==0)) {/* Incorrect header, assume none. */
880 xbuf
= This
->data
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,statstg
.cbSize
.QuadPart
);
881 memcpy(xbuf
,&header
,8);
882 This
->datalen
= statstg
.cbSize
.QuadPart
;
883 while (xread
< This
->datalen
) {
885 hr
= IStream_Read(pStm
,xbuf
+xread
,This
->datalen
-xread
,&nread
);
890 if (xread
!= This
->datalen
)
891 FIXME("Could only read %ld of %d bytes in no-header case?\n",xread
,This
->datalen
);
894 xbuf
= This
->data
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,header
[1]);
895 This
->datalen
= header
[1];
896 while (xread
< header
[1]) {
898 hr
= IStream_Read(pStm
,xbuf
+xread
,header
[1]-xread
,&nread
);
903 if (xread
!= header
[1])
904 FIXME("Could only read %ld of %ld bytes?\n",xread
,header
[1]);
906 magic
= xbuf
[0] + (xbuf
[1]<<8);
908 case 0x4947: { /* GIF */
923 gif
= DGifOpen((void*)&gd
, _gif_inputfunc
);
924 ret
= DGifSlurp(gif
);
925 if (ret
== GIF_ERROR
) {
926 FIXME("Failed reading GIF using libgif.\n");
929 TRACE("screen height %d, width %d\n", gif
->SWidth
, gif
->SHeight
);
930 TRACE("color res %d, backgcolor %d\n", gif
->SColorResolution
, gif
->SBackGroundColor
);
931 TRACE("imgcnt %d\n", gif
->ImageCount
);
932 if (gif
->ImageCount
<1) {
933 FIXME("GIF stream does not have images inside?\n");
936 TRACE("curimage: %d x %d, on %dx%d, interlace %d\n",
937 gif
->Image
.Width
, gif
->Image
.Height
,
938 gif
->Image
.Left
, gif
->Image
.Top
,
942 bmi
= HeapAlloc(GetProcessHeap(),0,sizeof(BITMAPINFOHEADER
)+(1<<gif
->SColorResolution
)*sizeof(RGBQUAD
));
943 bytes
= HeapAlloc(GetProcessHeap(),0,gif
->SWidth
*gif
->SHeight
);
944 si
= gif
->SavedImages
+0;
945 gid
= &(si
->ImageDesc
);
947 if (!cm
) cm
= gif
->SColorMap
;
948 for (i
=0;i
<(1<<gif
->SColorResolution
);i
++) {
949 bmi
->bmiColors
[i
].rgbRed
= cm
->Colors
[i
].Red
;
950 bmi
->bmiColors
[i
].rgbGreen
= cm
->Colors
[i
].Green
;
951 bmi
->bmiColors
[i
].rgbBlue
= cm
->Colors
[i
].Blue
;
953 /* Map to in picture coordinates */
954 for (i
=0;i
<gid
->Height
;i
++)
955 for (j
=0;j
<gid
->Width
;j
++)
956 bytes
[(gid
->Top
+i
)*gif
->SWidth
+gid
->Left
+j
]=si
->RasterBits
[i
*gid
->Width
+j
];
957 bmi
->bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
958 bmi
->bmiHeader
.biWidth
= gif
->SWidth
;
959 bmi
->bmiHeader
.biHeight
= gif
->SHeight
;
960 bmi
->bmiHeader
.biPlanes
= 1;
961 bmi
->bmiHeader
.biBitCount
= 8;
962 bmi
->bmiHeader
.biCompression
= BI_RGB
;
963 bmi
->bmiHeader
.biSizeImage
= gif
->SWidth
*gif
->SHeight
;
964 bmi
->bmiHeader
.biXPelsPerMeter
= 0;
965 bmi
->bmiHeader
.biYPelsPerMeter
= 0;
966 bmi
->bmiHeader
.biClrUsed
= 1 << gif
->SColorResolution
;
967 bmi
->bmiHeader
.biClrImportant
= 0;
970 This
->desc
.u
.bmp
.hbitmap
=CreateDIBitmap(
979 This
->desc
.picType
= PICTYPE_BITMAP
;
980 OLEPictureImpl_SetBitmap(This
);
982 HeapFree(GetProcessHeap(),0,bytes
);
985 FIXME("Trying to load GIF, but no support for libgif/libungif compiled in.\n");
990 case 0xd8ff: { /* JPEG */
992 struct jpeg_decompress_struct jd
;
993 struct jpeg_error_mgr jerr
;
996 JSAMPROW samprow
,oldsamprow
;
997 BITMAPINFOHEADER bmi
;
1000 struct jpeg_source_mgr xjsm
;
1004 /* This is basically so we can use in-memory data for jpeg decompression.
1005 * We need to have all the functions.
1007 xjsm
.next_input_byte
= xbuf
;
1008 xjsm
.bytes_in_buffer
= xread
;
1009 xjsm
.init_source
= _jpeg_init_source
;
1010 xjsm
.fill_input_buffer
= _jpeg_fill_input_buffer
;
1011 xjsm
.skip_input_data
= _jpeg_skip_input_data
;
1012 xjsm
.resync_to_restart
= _jpeg_resync_to_restart
;
1013 xjsm
.term_source
= _jpeg_term_source
;
1015 jd
.err
= jpeg_std_error(&jerr
);
1016 jpeg_create_decompress(&jd
);
1018 ret
=jpeg_read_header(&jd
,TRUE
);
1019 jd
.out_color_space
= JCS_RGB
;
1020 jpeg_start_decompress(&jd
);
1021 if (ret
!= JPEG_HEADER_OK
) {
1022 ERR("Jpeg image in stream has bad format, read header returned %d.\n",ret
);
1023 HeapFree(GetProcessHeap(),0,xbuf
);
1027 bits
= HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,
1028 (jd
.output_height
+1) * ((jd
.output_width
*jd
.output_components
+ 3) & ~3) );
1029 samprow
=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY
,jd
.output_width
*jd
.output_components
);
1032 oldsamprow
= samprow
;
1033 while ( jd
.output_scanline
<jd
.output_height
) {
1034 x
= jpeg_read_scanlines(&jd
,&samprow
,1);
1036 FIXME("failed to read current scanline?\n");
1039 /* We have to convert from RGB to BGR, see MSDN/ BITMAPINFOHEADER */
1040 for(i
=0;i
<jd
.output_width
;i
++,samprow
+=jd
.output_components
) {
1041 *(bits
++) = *(samprow
+2);
1042 *(bits
++) = *(samprow
+1);
1043 *(bits
++) = *(samprow
);
1045 bits
= (LPBYTE
)(((UINT_PTR
)bits
+ 3) & ~3);
1046 samprow
= oldsamprow
;
1050 bmi
.biSize
= sizeof(bmi
);
1051 bmi
.biWidth
= jd
.output_width
;
1052 bmi
.biHeight
= -jd
.output_height
;
1054 bmi
.biBitCount
= jd
.output_components
<<3;
1055 bmi
.biCompression
= BI_RGB
;
1056 bmi
.biSizeImage
= jd
.output_height
*jd
.output_width
*jd
.output_components
;
1057 bmi
.biXPelsPerMeter
= 0;
1058 bmi
.biYPelsPerMeter
= 0;
1060 bmi
.biClrImportant
= 0;
1062 HeapFree(GetProcessHeap(),0,samprow
);
1063 jpeg_finish_decompress(&jd
);
1064 jpeg_destroy_decompress(&jd
);
1066 This
->desc
.u
.bmp
.hbitmap
=CreateDIBitmap(
1075 This
->desc
.picType
= PICTYPE_BITMAP
;
1076 OLEPictureImpl_SetBitmap(This
);
1078 HeapFree(GetProcessHeap(),0,bits
);
1080 ERR("Trying to load JPEG picture, but JPEG supported not compiled in.\n");
1085 case 0x4d42: { /* Bitmap */
1086 BITMAPFILEHEADER
*bfh
= (BITMAPFILEHEADER
*)xbuf
;
1087 BITMAPINFO
*bi
= (BITMAPINFO
*)(bfh
+1);
1090 /* Does not matter whether this is a coreheader or not, we only use
1091 * components which are in both
1094 This
->desc
.u
.bmp
.hbitmap
= CreateDIBitmap(
1098 xbuf
+bfh
->bfOffBits
,
1100 (bi
->bmiHeader
.biBitCount
<=8)?DIB_PAL_COLORS
:DIB_RGB_COLORS
1103 This
->desc
.picType
= PICTYPE_BITMAP
;
1104 OLEPictureImpl_SetBitmap(This
);
1108 case 0x0000: { /* ICON , first word is dwReserved */
1110 CURSORICONFILEDIR
*cifd
= (CURSORICONFILEDIR
*)xbuf
;
1114 FIXME("icon.idReserved=%d\n",cifd->idReserved);
1115 FIXME("icon.idType=%d\n",cifd->idType);
1116 FIXME("icon.idCount=%d\n",cifd->idCount);
1118 for (i=0;i<cifd->idCount;i++) {
1119 FIXME("[%d] width %d\n",i,cifd->idEntries[i].bWidth);
1120 FIXME("[%d] height %d\n",i,cifd->idEntries[i].bHeight);
1121 FIXME("[%d] bColorCount %d\n",i,cifd->idEntries[i].bColorCount);
1122 FIXME("[%d] bReserved %d\n",i,cifd->idEntries[i].bReserved);
1123 FIXME("[%d] xHotspot %d\n",i,cifd->idEntries[i].xHotspot);
1124 FIXME("[%d] yHotspot %d\n",i,cifd->idEntries[i].yHotspot);
1125 FIXME("[%d] dwDIBSize %d\n",i,cifd->idEntries[i].dwDIBSize);
1126 FIXME("[%d] dwDIBOffset %d\n",i,cifd->idEntries[i].dwDIBOffset);
1130 /* If we have more than one icon, try to find the best.
1131 * this currently means '32 pixel wide'.
1133 if (cifd
->idCount
!=1) {
1134 for (i
=0;i
<cifd
->idCount
;i
++) {
1135 if (cifd
->idEntries
[i
].bWidth
== 32)
1138 if (i
==cifd
->idCount
) i
=0;
1141 hicon
= CreateIconFromResourceEx(
1142 xbuf
+cifd
->idEntries
[i
].dwDIBOffset
,
1143 cifd
->idEntries
[i
].dwDIBSize
,
1146 cifd
->idEntries
[i
].bWidth
,
1147 cifd
->idEntries
[i
].bHeight
,
1151 FIXME("CreateIcon failed.\n");
1154 This
->desc
.picType
= PICTYPE_ICON
;
1155 This
->desc
.u
.icon
.hicon
= hicon
;
1156 This
->himetricWidth
= cifd
->idEntries
[i
].bWidth
;
1157 This
->himetricHeight
= cifd
->idEntries
[i
].bHeight
;
1165 FIXME("Unknown magic %04x, %ld read bytes:\n",magic
,xread
);
1167 for (i
=0;i
<xread
+8;i
++) {
1168 if (i
<8) MESSAGE("%02x ",((unsigned char*)&header
)[i
]);
1169 else MESSAGE("%02x ",xbuf
[i
-8]);
1170 if (i
% 10 == 9) MESSAGE("\n");
1177 /* FIXME: this notify is not really documented */
1179 OLEPicture_SendNotify(This
,DISPID_PICT_TYPE
);
1183 static HRESULT WINAPI
OLEPictureImpl_Save(
1184 IPersistStream
* iface
,IStream
*pStm
,BOOL fClearDirty
)
1186 ICOM_THIS_From_IPersistStream(IPicture
, iface
);
1187 FIXME("(%p,%p,%d),stub!\n",This
,pStm
,fClearDirty
);
1191 static HRESULT WINAPI
OLEPictureImpl_GetSizeMax(
1192 IPersistStream
* iface
,ULARGE_INTEGER
*pcbSize
)
1194 ICOM_THIS_From_IPersistStream(IPicture
, iface
);
1195 FIXME("(%p,%p),stub!\n",This
,pcbSize
);
1199 /************************************************************************
1202 /************************************************************************
1203 * OLEPictureImpl_IDispatch_QueryInterface (IUnknown)
1205 * See Windows documentation for more details on IUnknown methods.
1207 static HRESULT WINAPI
OLEPictureImpl_IDispatch_QueryInterface(
1212 ICOM_THIS_From_IDispatch(IPicture
, iface
);
1214 return IPicture_QueryInterface(This
, riid
, ppvoid
);
1217 /************************************************************************
1218 * OLEPictureImpl_IDispatch_AddRef (IUnknown)
1220 * See Windows documentation for more details on IUnknown methods.
1222 static ULONG WINAPI
OLEPictureImpl_IDispatch_AddRef(
1225 ICOM_THIS_From_IDispatch(IPicture
, iface
);
1227 return IPicture_AddRef(This
);
1230 /************************************************************************
1231 * OLEPictureImpl_IDispatch_Release (IUnknown)
1233 * See Windows documentation for more details on IUnknown methods.
1235 static ULONG WINAPI
OLEPictureImpl_IDispatch_Release(
1238 ICOM_THIS_From_IDispatch(IPicture
, iface
);
1240 return IPicture_Release(This
);
1243 /************************************************************************
1244 * OLEPictureImpl_GetTypeInfoCount (IDispatch)
1246 * See Windows documentation for more details on IDispatch methods.
1248 static HRESULT WINAPI
OLEPictureImpl_GetTypeInfoCount(
1250 unsigned int* pctinfo
)
1257 /************************************************************************
1258 * OLEPictureImpl_GetTypeInfo (IDispatch)
1260 * See Windows documentation for more details on IDispatch methods.
1262 static HRESULT WINAPI
OLEPictureImpl_GetTypeInfo(
1266 ITypeInfo
** ppTInfo
)
1273 /************************************************************************
1274 * OLEPictureImpl_GetIDsOfNames (IDispatch)
1276 * See Windows documentation for more details on IDispatch methods.
1278 static HRESULT WINAPI
OLEPictureImpl_GetIDsOfNames(
1281 LPOLESTR
* rgszNames
,
1291 /************************************************************************
1292 * OLEPictureImpl_Invoke (IDispatch)
1294 * See Windows documentation for more details on IDispatch methods.
1296 static HRESULT WINAPI
OLEPictureImpl_Invoke(
1298 DISPID dispIdMember
,
1302 DISPPARAMS
* pDispParams
,
1303 VARIANT
* pVarResult
,
1304 EXCEPINFO
* pExepInfo
,
1307 FIXME("(dispid: %ld):Stub\n",dispIdMember
);
1309 VariantInit(pVarResult
);
1310 V_VT(pVarResult
) = VT_BOOL
;
1311 V_UNION(pVarResult
,boolVal
) = FALSE
;
1316 static ICOM_VTABLE(IPicture
) OLEPictureImpl_VTable
=
1318 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1319 OLEPictureImpl_QueryInterface
,
1320 OLEPictureImpl_AddRef
,
1321 OLEPictureImpl_Release
,
1322 OLEPictureImpl_get_Handle
,
1323 OLEPictureImpl_get_hPal
,
1324 OLEPictureImpl_get_Type
,
1325 OLEPictureImpl_get_Width
,
1326 OLEPictureImpl_get_Height
,
1327 OLEPictureImpl_Render
,
1328 OLEPictureImpl_set_hPal
,
1329 OLEPictureImpl_get_CurDC
,
1330 OLEPictureImpl_SelectPicture
,
1331 OLEPictureImpl_get_KeepOriginalFormat
,
1332 OLEPictureImpl_put_KeepOriginalFormat
,
1333 OLEPictureImpl_PictureChanged
,
1334 OLEPictureImpl_SaveAsFile
,
1335 OLEPictureImpl_get_Attributes
1338 static ICOM_VTABLE(IDispatch
) OLEPictureImpl_IDispatch_VTable
=
1340 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1341 OLEPictureImpl_IDispatch_QueryInterface
,
1342 OLEPictureImpl_IDispatch_AddRef
,
1343 OLEPictureImpl_IDispatch_Release
,
1344 OLEPictureImpl_GetTypeInfoCount
,
1345 OLEPictureImpl_GetTypeInfo
,
1346 OLEPictureImpl_GetIDsOfNames
,
1347 OLEPictureImpl_Invoke
1350 static ICOM_VTABLE(IPersistStream
) OLEPictureImpl_IPersistStream_VTable
=
1352 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1353 OLEPictureImpl_IPersistStream_QueryInterface
,
1354 OLEPictureImpl_IPersistStream_AddRef
,
1355 OLEPictureImpl_IPersistStream_Release
,
1356 OLEPictureImpl_GetClassID
,
1357 OLEPictureImpl_IsDirty
,
1358 OLEPictureImpl_Load
,
1359 OLEPictureImpl_Save
,
1360 OLEPictureImpl_GetSizeMax
1363 static ICOM_VTABLE(IConnectionPointContainer
) OLEPictureImpl_IConnectionPointContainer_VTable
=
1365 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1366 OLEPictureImpl_IConnectionPointContainer_QueryInterface
,
1367 OLEPictureImpl_IConnectionPointContainer_AddRef
,
1368 OLEPictureImpl_IConnectionPointContainer_Release
,
1369 OLEPictureImpl_EnumConnectionPoints
,
1370 OLEPictureImpl_FindConnectionPoint
1373 /***********************************************************************
1374 * OleCreatePictureIndirect (OLEAUT32.419)
1376 HRESULT WINAPI
OleCreatePictureIndirect(LPPICTDESC lpPictDesc
, REFIID riid
,
1377 BOOL fOwn
, LPVOID
*ppvObj
)
1379 OLEPictureImpl
* newPict
= NULL
;
1382 TRACE("(%p,%p,%d,%p)\n", lpPictDesc
, riid
, fOwn
, ppvObj
);
1393 * Try to construct a new instance of the class.
1395 newPict
= OLEPictureImpl_Construct(lpPictDesc
, fOwn
);
1397 if (newPict
== NULL
)
1398 return E_OUTOFMEMORY
;
1401 * Make sure it supports the interface required by the caller.
1403 hr
= IPicture_QueryInterface((IPicture
*)newPict
, riid
, ppvObj
);
1406 * Release the reference obtained in the constructor. If
1407 * the QueryInterface was unsuccessful, it will free the class.
1409 IPicture_Release((IPicture
*)newPict
);
1415 /***********************************************************************
1416 * OleLoadPicture (OLEAUT32.418)
1418 HRESULT WINAPI
OleLoadPicture( LPSTREAM lpstream
, LONG lSize
, BOOL fRunmode
,
1419 REFIID riid
, LPVOID
*ppvObj
)
1425 TRACE("(%p,%ld,%d,%s,%p), partially implemented.\n",
1426 lpstream
, lSize
, fRunmode
, debugstr_guid(riid
), ppvObj
);
1428 hr
= OleCreatePictureIndirect(NULL
,riid
,!fRunmode
,(LPVOID
*)&newpic
);
1431 hr
= IPicture_QueryInterface(newpic
,&IID_IPersistStream
, (LPVOID
*)&ps
);
1433 FIXME("Could not get IPersistStream iface from Ole Picture?\n");
1434 IPicture_Release(newpic
);
1438 IPersistStream_Load(ps
,lpstream
);
1439 IPersistStream_Release(ps
);
1440 hr
= IPicture_QueryInterface(newpic
,riid
,ppvObj
);
1442 FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid
));
1443 IPicture_Release(newpic
);
1447 /***********************************************************************
1448 * OleLoadPictureEx (OLEAUT32.401)
1450 HRESULT WINAPI
OleLoadPictureEx( LPSTREAM lpstream
, LONG lSize
, BOOL fRunmode
,
1451 REFIID riid
, DWORD xsiz
, DWORD ysiz
, DWORD flags
, LPVOID
*ppvObj
)
1457 FIXME("(%p,%ld,%d,%s,x=%ld,y=%ld,f=%lx,%p), partially implemented.\n",
1458 lpstream
, lSize
, fRunmode
, debugstr_guid(riid
), xsiz
, ysiz
, flags
, ppvObj
);
1460 hr
= OleCreatePictureIndirect(NULL
,riid
,!fRunmode
,(LPVOID
*)&newpic
);
1463 hr
= IPicture_QueryInterface(newpic
,&IID_IPersistStream
, (LPVOID
*)&ps
);
1465 FIXME("Could not get IPersistStream iface from Ole Picture?\n");
1466 IPicture_Release(newpic
);
1470 IPersistStream_Load(ps
,lpstream
);
1471 IPersistStream_Release(ps
);
1472 hr
= IPicture_QueryInterface(newpic
,riid
,ppvObj
);
1474 FIXME("Failed to get interface %s from IPicture.\n",debugstr_guid(riid
));
1475 IPicture_Release(newpic
);
1479 /*******************************************************************************
1480 * StdPic ClassFactory
1484 /* IUnknown fields */
1485 ICOM_VFIELD(IClassFactory
);
1487 } IClassFactoryImpl
;
1489 static HRESULT WINAPI
1490 SPCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
1491 ICOM_THIS(IClassFactoryImpl
,iface
);
1493 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
1494 return E_NOINTERFACE
;
1498 SPCF_AddRef(LPCLASSFACTORY iface
) {
1499 ICOM_THIS(IClassFactoryImpl
,iface
);
1500 return ++(This
->ref
);
1503 static ULONG WINAPI
SPCF_Release(LPCLASSFACTORY iface
) {
1504 ICOM_THIS(IClassFactoryImpl
,iface
);
1505 /* static class, won't be freed */
1506 return --(This
->ref
);
1509 static HRESULT WINAPI
SPCF_CreateInstance(
1510 LPCLASSFACTORY iface
,LPUNKNOWN pOuter
,REFIID riid
,LPVOID
*ppobj
1514 FIXME("(%p,%p,%s,%p), creating stdpic with PICTYPE_NONE.\n",iface
,pOuter
,debugstr_guid(riid
),ppobj
);
1515 pd
.cbSizeofstruct
= sizeof(pd
);
1516 pd
.picType
= PICTYPE_NONE
;
1517 return OleCreatePictureIndirect(&pd
,riid
,TRUE
,ppobj
);
1521 static HRESULT WINAPI
SPCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
1522 ICOM_THIS(IClassFactoryImpl
,iface
);
1523 FIXME("(%p)->(%d),stub!\n",This
,dolock
);
1527 static ICOM_VTABLE(IClassFactory
) SPCF_Vtbl
= {
1528 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
1529 SPCF_QueryInterface
,
1532 SPCF_CreateInstance
,
1535 static IClassFactoryImpl STDPIC_CF
= {&SPCF_Vtbl
, 1 };
1537 void _get_STDPIC_CF(LPVOID
*ppv
) { *ppv
= (LPVOID
)&STDPIC_CF
; }