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