| 1 | /* $Id: iPicture.cpp,v 1.2 1999-11-14 21:05:08 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 "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 ULONG WIN32API IPictureImpl_AddRef(LPPICTURE iface);
|
|---|
| 37 | static HRESULT WIN32API IPictureImpl_QueryInterface(LPPICTURE iface,
|
|---|
| 38 | REFIID refiid, LPVOID * obj);
|
|---|
| 39 | static ULONG WIN32API IPictureImpl_AddRef(LPPICTURE iface);
|
|---|
| 40 | static ULONG WIN32API IPictureImpl_Release(LPPICTURE iface);
|
|---|
| 41 | static HRESULT WIN32API IPictureImpl_get_Handle(LPPICTURE iface,
|
|---|
| 42 | OLE_HANDLE * pHandle);
|
|---|
| 43 | static HRESULT WIN32API IPictureImpl_get_hPal(LPPICTURE iface,
|
|---|
| 44 | OLE_HANDLE * phPal);
|
|---|
| 45 | static HRESULT WIN32API IPictureImpl_get_Type(LPPICTURE iface,
|
|---|
| 46 | SHORT * pType);
|
|---|
| 47 | static HRESULT WIN32API IPictureImpl_get_Width(LPPICTURE iface,
|
|---|
| 48 | OLE_XSIZE_HIMETRIC * pWidth);
|
|---|
| 49 | static HRESULT WIN32API IPictureImpl_get_Height(LPPICTURE iface,
|
|---|
| 50 | OLE_YSIZE_HIMETRIC * pHeight);
|
|---|
| 51 | static HRESULT WIN32API IPictureImpl_Render(LPPICTURE iface,
|
|---|
| 52 | HDC hdc, LONG x, LONG y, LONG cx, LONG cy,
|
|---|
| 53 | OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
|
|---|
| 54 | OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc,
|
|---|
| 55 | LPCRECT pRcWBounds);
|
|---|
| 56 | static HRESULT WIN32API IPictureImpl_set_hPal(LPPICTURE iface,
|
|---|
| 57 | OLE_HANDLE hPal);
|
|---|
| 58 | static HRESULT WIN32API IPictureImpl_get_CurDC(LPPICTURE iface,
|
|---|
| 59 | HDC * phDC);
|
|---|
| 60 | static HRESULT WIN32API IPictureImpl_SelectPicture(LPPICTURE iface,
|
|---|
| 61 | HDC hDCIn, HDC * phDCOut, OLE_HANDLE * phBmpOut);
|
|---|
| 62 | static HRESULT WIN32API IPictureImpl_get_KeepOriginalFormat(LPPICTURE iface,
|
|---|
| 63 | BOOL * pKeep);
|
|---|
| 64 | static HRESULT WIN32API IPictureImpl_put_KeepOriginalFormat(LPPICTURE iface,
|
|---|
| 65 | BOOL Keep);
|
|---|
| 66 | static HRESULT WIN32API IPictureImpl_PictureChanged(LPPICTURE iface);
|
|---|
| 67 | static HRESULT WIN32API IPictureImpl_SaveAsFile(LPPICTURE iface,
|
|---|
| 68 | LPSTREAM pStream, BOOL fSaveMemCopy, LONG * pCbSize);
|
|---|
| 69 | static HRESULT WIN32API IPictureImpl_get_Attributes(LPPICTURE iface,
|
|---|
| 70 | DWORD * pDwAttr);
|
|---|
| 71 |
|
|---|
| 72 | // ----------------------------------------------------------------------
|
|---|
| 73 | // IDispatch
|
|---|
| 74 | // ----------------------------------------------------------------------
|
|---|
| 75 | static HRESULT WINAPI IPictureImpl_IDispatch_QueryInterface(LPDISPATCH iface,
|
|---|
| 76 | REFIID riid, LPVOID * obj);
|
|---|
| 77 | static ULONG WINAPI IPictureImpl_IDispatch_AddRef(LPDISPATCH iface);
|
|---|
| 78 | static ULONG WINAPI IPictureImpl_IDispatch_Release(LPDISPATCH iface);
|
|---|
| 79 | static HRESULT WINAPI IPictureImpl_IDispatch_GetTypeInfoCount(LPDISPATCH iface,
|
|---|
| 80 | unsigned int* pctinfo);
|
|---|
| 81 | static HRESULT WINAPI IPictureImpl_IDispatch_GetTypeInfo(LPDISPATCH iface,
|
|---|
| 82 | UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo);
|
|---|
| 83 | static HRESULT WINAPI IPictureImpl_IDispatch_GetIDsOfNames(LPDISPATCH iface,
|
|---|
| 84 | REFIID riid, LPOLESTR* rgszNames, UINT cNames,
|
|---|
| 85 | LCID lcid, DISPID* rgDispId);
|
|---|
| 86 | static HRESULT WINAPI IPictureImpl_IDispatch_Invoke(LPDISPATCH iface,
|
|---|
| 87 | DISPID dispIdMember, REFIID riid,
|
|---|
| 88 | LCID lcid, WORD wFlags,
|
|---|
| 89 | DISPPARAMS* pDispParams, VARIANT* pVarResult,
|
|---|
| 90 | EXCEPINFO* pExepInfo, UINT* puArgErr);
|
|---|
| 91 |
|
|---|
| 92 | // ----------------------------------------------------------------------
|
|---|
| 93 | // IPersistStream
|
|---|
| 94 | // ----------------------------------------------------------------------
|
|---|
| 95 | static HRESULT WINAPI IPictureImpl_IPersistStream_QueryInterface(LPPERSISTSTREAM iface,
|
|---|
| 96 | REFIID riid, LPVOID * obj);
|
|---|
| 97 | static ULONG WINAPI IPictureImpl_IPersistStream_AddRef(LPPERSISTSTREAM iface);
|
|---|
| 98 | static ULONG WINAPI IPictureImpl_IPersistStream_Release(LPPERSISTSTREAM iface);
|
|---|
| 99 | static HRESULT WINAPI IPictureImpl_IPersistStream_GetClassID(LPPERSISTSTREAM iface,
|
|---|
| 100 | CLSID * pClassID);
|
|---|
| 101 | static HRESULT WINAPI IPictureImpl_IPersistStream_IsDirty(LPPERSISTSTREAM iface);
|
|---|
| 102 | static HRESULT WINAPI IPictureImpl_IPersistStream_Load(LPPERSISTSTREAM iface,
|
|---|
| 103 | LPSTREAM pLoadStream);
|
|---|
| 104 | static HRESULT WINAPI IPictureImpl_IPersistStream_Save(LPPERSISTSTREAM iface,
|
|---|
| 105 | LPSTREAM pOutStream, BOOL fClearDirty);
|
|---|
| 106 | static HRESULT WINAPI IPictureImpl_IPersistStream_GetSizeMax(LPPERSISTSTREAM iface,
|
|---|
| 107 | ULARGE_INTEGER * pcbSize);
|
|---|
| 108 |
|
|---|
| 109 | // ======================================================================
|
|---|
| 110 | // Local Data
|
|---|
| 111 | // ======================================================================
|
|---|
| 112 | static ICOM_VTABLE(IPicture) IPictureImpl_VTable =
|
|---|
| 113 | {
|
|---|
| 114 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|---|
| 115 | IPictureImpl_QueryInterface,
|
|---|
| 116 | IPictureImpl_AddRef,
|
|---|
| 117 | IPictureImpl_Release,
|
|---|
| 118 | IPictureImpl_get_Handle,
|
|---|
| 119 | IPictureImpl_get_hPal,
|
|---|
| 120 | IPictureImpl_get_Type,
|
|---|
| 121 | IPictureImpl_get_Width,
|
|---|
| 122 | IPictureImpl_get_Height,
|
|---|
| 123 | IPictureImpl_Render,
|
|---|
| 124 | IPictureImpl_set_hPal,
|
|---|
| 125 | IPictureImpl_get_CurDC,
|
|---|
| 126 | IPictureImpl_SelectPicture,
|
|---|
| 127 | IPictureImpl_get_KeepOriginalFormat,
|
|---|
| 128 | IPictureImpl_put_KeepOriginalFormat,
|
|---|
| 129 | IPictureImpl_PictureChanged,
|
|---|
| 130 | IPictureImpl_SaveAsFile,
|
|---|
| 131 | IPictureImpl_get_Attributes
|
|---|
| 132 | };
|
|---|
| 133 |
|
|---|
| 134 | static ICOM_VTABLE(IDispatch) IPictureImpl_IDispatch_VTable =
|
|---|
| 135 | {
|
|---|
| 136 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|---|
| 137 | IPictureImpl_IDispatch_QueryInterface,
|
|---|
| 138 | IPictureImpl_IDispatch_AddRef,
|
|---|
| 139 | IPictureImpl_IDispatch_Release,
|
|---|
| 140 | IPictureImpl_IDispatch_GetTypeInfoCount,
|
|---|
| 141 | IPictureImpl_IDispatch_GetTypeInfo,
|
|---|
| 142 | IPictureImpl_IDispatch_GetIDsOfNames,
|
|---|
| 143 | IPictureImpl_IDispatch_Invoke
|
|---|
| 144 | };
|
|---|
| 145 |
|
|---|
| 146 | static ICOM_VTABLE(IPersistStream) IPictureImpl_IPersistStream_VTable =
|
|---|
| 147 | {
|
|---|
| 148 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|---|
| 149 | IPictureImpl_IPersistStream_QueryInterface,
|
|---|
| 150 | IPictureImpl_IPersistStream_AddRef,
|
|---|
| 151 | IPictureImpl_IPersistStream_Release,
|
|---|
| 152 | IPictureImpl_IPersistStream_GetClassID,
|
|---|
| 153 | IPictureImpl_IPersistStream_IsDirty,
|
|---|
| 154 | IPictureImpl_IPersistStream_Load,
|
|---|
| 155 | IPictureImpl_IPersistStream_Save,
|
|---|
| 156 | IPictureImpl_IPersistStream_GetSizeMax
|
|---|
| 157 | };
|
|---|
| 158 |
|
|---|
| 159 | // ======================================================================
|
|---|
| 160 | // Local Methods
|
|---|
| 161 | // ======================================================================
|
|---|
| 162 |
|
|---|
| 163 | // ----------------------------------------------------------------------
|
|---|
| 164 | // Uninitialised Picture
|
|---|
| 165 | // ----------------------------------------------------------------------
|
|---|
| 166 | HRESULT IPictureNone::get_Handle(OLE_HANDLE * pHandle)
|
|---|
| 167 | {
|
|---|
| 168 | *pHandle = 0;
|
|---|
| 169 | return E_FAIL;
|
|---|
| 170 | }
|
|---|
| 171 |
|
|---|
| 172 | HRESULT IPictureNone::get_hPal(OLE_HANDLE * phPal)
|
|---|
| 173 | {
|
|---|
| 174 | *phPal = 0;
|
|---|
| 175 | return E_FAIL;
|
|---|
| 176 | }
|
|---|
| 177 |
|
|---|
| 178 | HRESULT IPictureNone::get_Type(SHORT * pType)
|
|---|
| 179 | {
|
|---|
| 180 | *pType = PICTYPE_UNINITIALIZED;
|
|---|
| 181 | return S_OK;
|
|---|
| 182 | }
|
|---|
| 183 |
|
|---|
| 184 | HRESULT IPictureNone::get_Width(OLE_XSIZE_HIMETRIC * pWidth)
|
|---|
| 185 | {
|
|---|
| 186 | *pWidth = 0;
|
|---|
| 187 | return E_FAIL;
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 | HRESULT IPictureNone::get_Height(OLE_YSIZE_HIMETRIC * pHeight)
|
|---|
| 191 | {
|
|---|
| 192 | *pHeight = 0;
|
|---|
| 193 | return E_FAIL;
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | HRESULT IPictureNone::Render(HDC hdc, LONG x, LONG y, LONG cx, LONG cy,
|
|---|
| 197 | OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
|
|---|
| 198 | OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc,
|
|---|
| 199 | LPCRECT pRcWBounds)
|
|---|
| 200 | {
|
|---|
| 201 | return E_FAIL;
|
|---|
| 202 | }
|
|---|
| 203 |
|
|---|
| 204 | HRESULT IPictureNone::set_hPal(OLE_HANDLE hPal)
|
|---|
| 205 | {
|
|---|
| 206 | return E_FAIL;
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | HRESULT IPictureNone::SaveAsFile(LPSTREAM pStream, BOOL fSaveMemCopy, LONG * pCbSize)
|
|---|
| 210 | {
|
|---|
| 211 | return E_FAIL;
|
|---|
| 212 | }
|
|---|
| 213 |
|
|---|
| 214 | HRESULT IPictureNone::get_Attributes(DWORD * pDwAttr)
|
|---|
| 215 | {
|
|---|
| 216 | *pDwAttr = 0;
|
|---|
| 217 | return S_OK;
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|
| 220 | IPictureBmp::IPictureBmp(IPictureImpl * a_pPicture, HBITMAP hbitmap, HPALETTE hpal)
|
|---|
| 221 | : IPictureStrat(a_pPicture)
|
|---|
| 222 | {
|
|---|
| 223 | pPicture->u.bmp.hbitmap = hbitmap;
|
|---|
| 224 | pPicture->u.bmp.hpal = hpal;
|
|---|
| 225 | }
|
|---|
| 226 |
|
|---|
| 227 | // ----------------------------------------------------------------------
|
|---|
| 228 | // Icon Picture
|
|---|
| 229 | // ----------------------------------------------------------------------
|
|---|
| 230 | IPictureBmp::~IPictureBmp()
|
|---|
| 231 | {
|
|---|
| 232 | if (pPicture->fOwn)
|
|---|
| 233 | {
|
|---|
| 234 | // Free bitmap...
|
|---|
| 235 | DeleteObject(pPicture->u.bmp.hbitmap);
|
|---|
| 236 | DeleteObject(pPicture->u.bmp.hpal);
|
|---|
| 237 | }
|
|---|
| 238 | }
|
|---|
| 239 |
|
|---|
| 240 | HRESULT IPictureBmp::get_Handle(OLE_HANDLE * pHandle)
|
|---|
| 241 | {
|
|---|
| 242 | *pHandle = pPicture->u.bmp.hbitmap;
|
|---|
| 243 | return S_OK;
|
|---|
| 244 | }
|
|---|
| 245 |
|
|---|
| 246 | HRESULT IPictureBmp::get_hPal(OLE_HANDLE * phPal)
|
|---|
| 247 | {
|
|---|
| 248 | *phPal = pPicture->u.bmp.hpal;
|
|---|
| 249 | return S_OK;
|
|---|
| 250 | }
|
|---|
| 251 |
|
|---|
| 252 | HRESULT IPictureBmp::get_Type(SHORT * pType)
|
|---|
| 253 | {
|
|---|
| 254 | *pType = PICTYPE_BITMAP;
|
|---|
| 255 | return S_OK;
|
|---|
| 256 | }
|
|---|
| 257 |
|
|---|
| 258 | HRESULT IPictureBmp::get_Width(OLE_XSIZE_HIMETRIC * pWidth)
|
|---|
| 259 | {
|
|---|
| 260 | SIZE size;
|
|---|
| 261 |
|
|---|
| 262 | if (GetBitmapDimensionEx( pPicture->u.bmp.hbitmap, &size) == 0)
|
|---|
| 263 | {
|
|---|
| 264 | *pWidth = 0;
|
|---|
| 265 | return E_FAIL;
|
|---|
| 266 | }
|
|---|
| 267 |
|
|---|
| 268 | *pWidth = size.cx;
|
|---|
| 269 |
|
|---|
| 270 | return S_OK;
|
|---|
| 271 | }
|
|---|
| 272 |
|
|---|
| 273 | HRESULT IPictureBmp::get_Height(OLE_YSIZE_HIMETRIC * pHeight)
|
|---|
| 274 | {
|
|---|
| 275 | SIZE size;
|
|---|
| 276 |
|
|---|
| 277 | if (GetBitmapDimensionEx( pPicture->u.bmp.hbitmap, &size) == 0)
|
|---|
| 278 | {
|
|---|
| 279 | *pHeight = 0;
|
|---|
| 280 | return E_FAIL;
|
|---|
| 281 | }
|
|---|
| 282 |
|
|---|
| 283 | *pHeight = size.cy;
|
|---|
| 284 |
|
|---|
| 285 | return S_OK;
|
|---|
| 286 | }
|
|---|
| 287 |
|
|---|
| 288 | HRESULT IPictureBmp::Render(HDC hdc, LONG x, LONG y, LONG cx, LONG cy,
|
|---|
| 289 | OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
|
|---|
| 290 | OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc,
|
|---|
| 291 | LPCRECT pRcWBounds)
|
|---|
| 292 | {
|
|---|
| 293 | return E_FAIL;
|
|---|
| 294 | }
|
|---|
| 295 |
|
|---|
| 296 | HRESULT IPictureBmp::set_hPal(OLE_HANDLE hPal)
|
|---|
| 297 | {
|
|---|
| 298 | pPicture->u.bmp.hpal = hPal;
|
|---|
| 299 | return S_OK;
|
|---|
| 300 | }
|
|---|
| 301 |
|
|---|
| 302 | HRESULT IPictureBmp::SaveAsFile(LPSTREAM pStream, BOOL fSaveMemCopy, LONG * pCbSize)
|
|---|
| 303 | {
|
|---|
| 304 | return E_FAIL;
|
|---|
| 305 | }
|
|---|
| 306 |
|
|---|
| 307 | HRESULT IPictureBmp::get_Attributes(DWORD * pDwAttr)
|
|---|
| 308 | {
|
|---|
| 309 | // Although bitmaps may be scaled, it is really stretching.
|
|---|
| 310 | *pDwAttr = 0;
|
|---|
| 311 | return S_OK;
|
|---|
| 312 | }
|
|---|
| 313 |
|
|---|
| 314 | // ----------------------------------------------------------------------
|
|---|
| 315 | // Metafile Picture
|
|---|
| 316 | // ----------------------------------------------------------------------
|
|---|
| 317 | IPictureIcon::IPictureIcon(IPictureImpl * a_pPicture, HICON hicon)
|
|---|
| 318 | : IPictureStrat(a_pPicture)
|
|---|
| 319 | {
|
|---|
| 320 | pPicture->u.icon.hicon = hicon;
|
|---|
| 321 | }
|
|---|
| 322 |
|
|---|
| 323 | IPictureIcon::~IPictureIcon()
|
|---|
| 324 | {
|
|---|
| 325 | if (pPicture->fOwn)
|
|---|
| 326 | {
|
|---|
| 327 | // Free icon...
|
|---|
| 328 | DestroyIcon(pPicture->u.icon.hicon);
|
|---|
| 329 | }
|
|---|
| 330 | }
|
|---|
| 331 |
|
|---|
| 332 | HRESULT IPictureIcon::get_Handle(OLE_HANDLE * pHandle)
|
|---|
| 333 | {
|
|---|
| 334 | *pHandle = pPicture->u.icon.hicon;
|
|---|
| 335 | return S_OK;
|
|---|
| 336 | }
|
|---|
| 337 |
|
|---|
| 338 | HRESULT IPictureIcon::get_hPal(OLE_HANDLE * phPal)
|
|---|
| 339 | {
|
|---|
| 340 | *phPal = 0;
|
|---|
| 341 | return S_OK;
|
|---|
| 342 | }
|
|---|
| 343 |
|
|---|
| 344 | HRESULT IPictureIcon::get_Type(SHORT * pType)
|
|---|
| 345 | {
|
|---|
| 346 | *pType = PICTYPE_ICON;
|
|---|
| 347 | return S_OK;
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 | HRESULT IPictureIcon::get_Width(OLE_XSIZE_HIMETRIC * pWidth)
|
|---|
| 351 | {
|
|---|
| 352 | // FIXME - Read from system constants...
|
|---|
| 353 | *pWidth = 32;
|
|---|
| 354 |
|
|---|
| 355 | return S_OK;
|
|---|
| 356 | }
|
|---|
| 357 |
|
|---|
| 358 | HRESULT IPictureIcon::get_Height(OLE_YSIZE_HIMETRIC * pHeight)
|
|---|
| 359 | {
|
|---|
| 360 | // FIXME - Read from system constants...
|
|---|
| 361 | *pHeight = 32;
|
|---|
| 362 |
|
|---|
| 363 | return S_OK;
|
|---|
| 364 | }
|
|---|
| 365 |
|
|---|
| 366 | HRESULT IPictureIcon::Render(HDC hdc, LONG x, LONG y, LONG cx, LONG cy,
|
|---|
| 367 | OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
|
|---|
| 368 | OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc,
|
|---|
| 369 | LPCRECT pRcWBounds)
|
|---|
| 370 | {
|
|---|
| 371 | return E_FAIL;
|
|---|
| 372 | }
|
|---|
| 373 |
|
|---|
| 374 | HRESULT IPictureIcon::set_hPal(OLE_HANDLE hPal)
|
|---|
| 375 | {
|
|---|
| 376 | return E_FAIL;
|
|---|
| 377 | }
|
|---|
| 378 |
|
|---|
| 379 | HRESULT IPictureIcon::SaveAsFile(LPSTREAM pStream, BOOL fSaveMemCopy, LONG * pCbSize)
|
|---|
| 380 | {
|
|---|
| 381 | return E_FAIL;
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|
| 384 | HRESULT IPictureIcon::get_Attributes(DWORD * pDwAttr)
|
|---|
| 385 | {
|
|---|
| 386 | *pDwAttr = PICTURE_TRANSPARENT;
|
|---|
| 387 | return S_OK;
|
|---|
| 388 | }
|
|---|
| 389 |
|
|---|
| 390 | // ----------------------------------------------------------------------
|
|---|
| 391 | // Enhanced Metafile Picture
|
|---|
| 392 | // ----------------------------------------------------------------------
|
|---|
| 393 |
|
|---|
| 394 | IPictureMeta::IPictureMeta(IPictureImpl * a_pPicture, HMETAFILE hmeta, int xExt, int yExt)
|
|---|
| 395 | : IPictureStrat(a_pPicture)
|
|---|
| 396 | {
|
|---|
| 397 | pPicture->u.wmf.hmeta = hmeta;
|
|---|
| 398 | pPicture->u.wmf.xExt = xExt;
|
|---|
| 399 | pPicture->u.wmf.yExt = yExt;
|
|---|
| 400 | }
|
|---|
| 401 |
|
|---|
| 402 | IPictureMeta::~IPictureMeta()
|
|---|
| 403 | {
|
|---|
| 404 | if (pPicture->fOwn)
|
|---|
| 405 | {
|
|---|
| 406 | // Free metafile...
|
|---|
| 407 | DeleteMetaFile(pPicture->u.wmf.hmeta);
|
|---|
| 408 | }
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 | HRESULT IPictureMeta::get_Handle(OLE_HANDLE * pHandle)
|
|---|
| 412 | {
|
|---|
| 413 | *pHandle = pPicture->u.wmf.hmeta;
|
|---|
| 414 | return S_OK;
|
|---|
| 415 | }
|
|---|
| 416 |
|
|---|
| 417 | HRESULT IPictureMeta::get_hPal(OLE_HANDLE * phPal)
|
|---|
| 418 | {
|
|---|
| 419 | *phPal = 0;
|
|---|
| 420 | return E_FAIL;
|
|---|
| 421 | }
|
|---|
| 422 |
|
|---|
| 423 | HRESULT IPictureMeta::get_Type(SHORT * pType)
|
|---|
| 424 | {
|
|---|
| 425 | *pType = PICTYPE_METAFILE;
|
|---|
| 426 | return S_OK;
|
|---|
| 427 | }
|
|---|
| 428 |
|
|---|
| 429 | HRESULT IPictureMeta::get_Width(OLE_XSIZE_HIMETRIC * pWidth)
|
|---|
| 430 | {
|
|---|
| 431 | *pWidth = pPicture->u.wmf.xExt;
|
|---|
| 432 | return S_OK;
|
|---|
| 433 | }
|
|---|
| 434 |
|
|---|
| 435 | HRESULT IPictureMeta::get_Height(OLE_YSIZE_HIMETRIC * pHeight)
|
|---|
| 436 | {
|
|---|
| 437 | *pHeight = pPicture->u.wmf.yExt;
|
|---|
| 438 | return S_OK;
|
|---|
| 439 | }
|
|---|
| 440 |
|
|---|
| 441 | HRESULT IPictureMeta::Render(HDC hdc, LONG x, LONG y, LONG cx, LONG cy,
|
|---|
| 442 | OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
|
|---|
| 443 | OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc,
|
|---|
| 444 | LPCRECT pRcWBounds)
|
|---|
| 445 | {
|
|---|
| 446 | return E_FAIL;
|
|---|
| 447 | }
|
|---|
| 448 |
|
|---|
| 449 | HRESULT IPictureMeta::set_hPal(OLE_HANDLE hPal)
|
|---|
| 450 | {
|
|---|
| 451 | return E_FAIL;
|
|---|
| 452 | }
|
|---|
| 453 |
|
|---|
| 454 | HRESULT IPictureMeta::SaveAsFile(LPSTREAM pStream, BOOL fSaveMemCopy, LONG * pCbSize)
|
|---|
| 455 | {
|
|---|
| 456 | return E_FAIL;
|
|---|
| 457 | }
|
|---|
| 458 |
|
|---|
| 459 | HRESULT IPictureMeta::get_Attributes(DWORD * pDwAttr)
|
|---|
| 460 | {
|
|---|
| 461 | *pDwAttr = PICTURE_SCALEABLE | PICTURE_TRANSPARENT;
|
|---|
| 462 | return S_OK;
|
|---|
| 463 | }
|
|---|
| 464 |
|
|---|
| 465 | // ----------------------------------------------------------------------
|
|---|
| 466 | // IPictureImpl_QueryInterface
|
|---|
| 467 | // ----------------------------------------------------------------------
|
|---|
| 468 | static IPictureImpl * IPictureImpl_Constructor(LPPICTDESC description, BOOL fOwn)
|
|---|
| 469 | {
|
|---|
| 470 | IPictureImpl * newObject;
|
|---|
| 471 |
|
|---|
| 472 | // Allocate a new object on the heap...
|
|---|
| 473 | if ((newObject = (IPictureImpl *)HeapAlloc(GetProcessHeap(), 0, sizeof(IPictureImpl))) == 0)
|
|---|
| 474 | return 0;
|
|---|
| 475 |
|
|---|
| 476 | dprintf(("OLEAUT32: IPictureImpl(%p)->Contructor(fOwn = %d)\n", newObject, fOwn));
|
|---|
| 477 |
|
|---|
| 478 | // Initialise the vft's
|
|---|
| 479 | newObject->lpvtbl1 = &IPictureImpl_VTable;
|
|---|
| 480 | newObject->lpvtbl2 = &IPictureImpl_IDispatch_VTable;
|
|---|
| 481 | newObject->lpvtbl3 = &IPictureImpl_IPersistStream_VTable;
|
|---|
| 482 |
|
|---|
| 483 | // Initial reference count of 1...
|
|---|
| 484 | newObject->ref = 1;
|
|---|
| 485 | newObject->fOwn = fOwn;
|
|---|
| 486 |
|
|---|
| 487 | // If a description is not passed then leave the picture uninitialised...
|
|---|
| 488 | if (description == 0)
|
|---|
| 489 | newObject->pStrat = new IPictureNone(newObject);
|
|---|
| 490 | else
|
|---|
| 491 | {
|
|---|
| 492 | // Validate size...
|
|---|
| 493 | if (description->cbSizeofstruct < sizeof(PICTDESC))
|
|---|
| 494 | {
|
|---|
| 495 | dprintf(("OLEAUT32: IPictureImpl(%p)->Constructor - Invalid cbSizeofstruct!", newObject));
|
|---|
| 496 | return 0;
|
|---|
| 497 | }
|
|---|
| 498 | switch(description->picType)
|
|---|
| 499 | {
|
|---|
| 500 | case PICTYPE_BITMAP:
|
|---|
| 501 | newObject->pStrat = new IPictureBmp(
|
|---|
| 502 | newObject,
|
|---|
| 503 | description->u.bmp.hbitmap,
|
|---|
| 504 | description->u.bmp.hpal);
|
|---|
| 505 | break;
|
|---|
| 506 |
|
|---|
| 507 | case PICTYPE_METAFILE:
|
|---|
| 508 | newObject->pStrat = new IPictureMeta(newObject,
|
|---|
| 509 | description->u.wmf.hmeta,
|
|---|
| 510 | description->u.wmf.xExt,
|
|---|
| 511 | description->u.wmf.yExt);
|
|---|
| 512 | break;
|
|---|
| 513 |
|
|---|
| 514 | case PICTYPE_ICON:
|
|---|
| 515 | newObject->pStrat = new IPictureIcon(newObject,
|
|---|
| 516 | description->u.icon.hicon);
|
|---|
| 517 | break;
|
|---|
| 518 |
|
|---|
| 519 | case PICTYPE_ENHMETAFILE:
|
|---|
| 520 | newObject->pStrat = new IPictureIcon(newObject,
|
|---|
| 521 | description->u.emf.hemf);
|
|---|
| 522 | break;
|
|---|
| 523 |
|
|---|
| 524 | default:
|
|---|
| 525 | // assume uninitialised...
|
|---|
| 526 | newObject->pStrat = new IPictureNone(newObject);
|
|---|
| 527 | break;
|
|---|
| 528 | }
|
|---|
| 529 | }
|
|---|
| 530 |
|
|---|
| 531 | return newObject;
|
|---|
| 532 | }
|
|---|
| 533 |
|
|---|
| 534 | // ----------------------------------------------------------------------
|
|---|
| 535 | // IPictureImpl_QueryInterface
|
|---|
| 536 | // ----------------------------------------------------------------------
|
|---|
| 537 | static void IPictureImpl_Destructor(IPictureImpl * obj)
|
|---|
| 538 | {
|
|---|
| 539 | dprintf(("OLEAUT32: IPictureImpl(%p)->Destructor()\n", obj));
|
|---|
| 540 |
|
|---|
| 541 | delete obj->pStrat;
|
|---|
| 542 |
|
|---|
| 543 | HeapFree(GetProcessHeap(), 0, obj);
|
|---|
| 544 | }
|
|---|
| 545 |
|
|---|
| 546 | // ----------------------------------------------------------------------
|
|---|
| 547 | // IPictureImpl_QueryInterface
|
|---|
| 548 | // ----------------------------------------------------------------------
|
|---|
| 549 | static HRESULT WIN32API IPictureImpl_QueryInterface(LPPICTURE iface, REFIID refiid, LPVOID *obj)
|
|---|
| 550 | {
|
|---|
| 551 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 552 |
|
|---|
| 553 | dprintf(("OLEAUT32: IPictureImpl(%p)->QueryInterface()", This));
|
|---|
| 554 |
|
|---|
| 555 | // Sanity check...
|
|---|
| 556 | if ((This == 0) || (obj == 0))
|
|---|
| 557 | return E_INVALIDARG;
|
|---|
| 558 |
|
|---|
| 559 | // Initialise return jic...
|
|---|
| 560 | *obj = 0;
|
|---|
| 561 |
|
|---|
| 562 | // Go find the correct interface...
|
|---|
| 563 | if (IsEqualIID(&IID_IUnknown, refiid))
|
|---|
| 564 | *obj = &(This->lpvtbl1);
|
|---|
| 565 | else if (IsEqualIID(&IID_IPicture, refiid))
|
|---|
| 566 | *obj = &(This->lpvtbl1);
|
|---|
| 567 | else if (IsEqualIID(&IID_IDispatch, refiid))
|
|---|
| 568 | *obj = &(This->lpvtbl2);
|
|---|
| 569 | else if (IsEqualIID(&IID_IPictureDisp, refiid))
|
|---|
| 570 | *obj = &(This->lpvtbl2);
|
|---|
| 571 | else if (IsEqualIID(&IID_IPersistStream, refiid))
|
|---|
| 572 | *obj = &(This->lpvtbl3);
|
|---|
| 573 | else
|
|---|
| 574 | return OLE_E_ENUM_NOMORE;
|
|---|
| 575 |
|
|---|
| 576 | // Query Interface always increases the reference count by one...
|
|---|
| 577 | IPictureImpl_AddRef((LPPICTURE)This);
|
|---|
| 578 |
|
|---|
| 579 | return S_OK;
|
|---|
| 580 | }
|
|---|
| 581 |
|
|---|
| 582 | // ----------------------------------------------------------------------
|
|---|
| 583 | // IPictureImpl_AddRef
|
|---|
| 584 | // ----------------------------------------------------------------------
|
|---|
| 585 | static ULONG WIN32API IPictureImpl_AddRef(LPPICTURE iface)
|
|---|
| 586 | {
|
|---|
| 587 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 588 |
|
|---|
| 589 | dprintf(("OLEAUT32: IPictureImpl(%p)->AddRef()", This));
|
|---|
| 590 |
|
|---|
| 591 | return ++(This->ref);
|
|---|
| 592 | }
|
|---|
| 593 |
|
|---|
| 594 | // ----------------------------------------------------------------------
|
|---|
| 595 | // IPictureImpl_Release
|
|---|
| 596 | // ----------------------------------------------------------------------
|
|---|
| 597 | static ULONG WIN32API IPictureImpl_Release(LPPICTURE iface)
|
|---|
| 598 | {
|
|---|
| 599 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 600 |
|
|---|
| 601 | dprintf(("OLEAUT32: IPictureImpl(%p)->Release()\n", This));
|
|---|
| 602 |
|
|---|
| 603 | if (--(This->ref) == 0)
|
|---|
| 604 | {
|
|---|
| 605 | IPictureImpl_Destructor(This);
|
|---|
| 606 | return 0;
|
|---|
| 607 | }
|
|---|
| 608 | return This->ref;
|
|---|
| 609 | }
|
|---|
| 610 |
|
|---|
| 611 | // ----------------------------------------------------------------------
|
|---|
| 612 | // IPictureImpl_get_Handle
|
|---|
| 613 | // ----------------------------------------------------------------------
|
|---|
| 614 | static HRESULT WIN32API IPictureImpl_get_Handle(LPPICTURE iface,
|
|---|
| 615 | OLE_HANDLE * pHandle)
|
|---|
| 616 | {
|
|---|
| 617 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 618 |
|
|---|
| 619 | dprintf(("OLEAUT32: IPictureImpl(%p)->get_Handle()", This));
|
|---|
| 620 |
|
|---|
| 621 | // Sanity check...
|
|---|
| 622 | if (pHandle == 0)
|
|---|
| 623 | return E_POINTER;
|
|---|
| 624 |
|
|---|
| 625 | // Return the handle...
|
|---|
| 626 | return This->pStrat->get_Handle(pHandle);
|
|---|
| 627 | }
|
|---|
| 628 |
|
|---|
| 629 | // ----------------------------------------------------------------------
|
|---|
| 630 | // IPictureImpl_get_hPal
|
|---|
| 631 | // ----------------------------------------------------------------------
|
|---|
| 632 | static HRESULT WIN32API IPictureImpl_get_hPal(LPPICTURE iface,
|
|---|
| 633 | OLE_HANDLE * phPal)
|
|---|
| 634 | {
|
|---|
| 635 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 636 |
|
|---|
| 637 | dprintf(("OLEAUT32: IPictureImpl(%p)->get_hPal()", This));
|
|---|
| 638 |
|
|---|
| 639 | // Sanity check...
|
|---|
| 640 | if (phPal == 0)
|
|---|
| 641 | return E_POINTER;
|
|---|
| 642 |
|
|---|
| 643 | // Return the handle...
|
|---|
| 644 | return This->pStrat->get_hPal(phPal);
|
|---|
| 645 | }
|
|---|
| 646 |
|
|---|
| 647 | // ----------------------------------------------------------------------
|
|---|
| 648 | // IPictureImpl_get_Type
|
|---|
| 649 | // ----------------------------------------------------------------------
|
|---|
| 650 | static HRESULT WIN32API IPictureImpl_get_Type(LPPICTURE iface,
|
|---|
| 651 | SHORT * pType)
|
|---|
| 652 | {
|
|---|
| 653 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 654 |
|
|---|
| 655 | dprintf(("OLEAUT32: IPictureImpl(%p)->get_Type()", This));
|
|---|
| 656 |
|
|---|
| 657 | // Sanity check...
|
|---|
| 658 | if (pType == 0)
|
|---|
| 659 | return E_POINTER;
|
|---|
| 660 |
|
|---|
| 661 | // Return the type...
|
|---|
| 662 | return This->pStrat->get_Type(pType);
|
|---|
| 663 | }
|
|---|
| 664 |
|
|---|
| 665 | // ----------------------------------------------------------------------
|
|---|
| 666 | // IPictureImpl_get_Width
|
|---|
| 667 | // ----------------------------------------------------------------------
|
|---|
| 668 | static HRESULT WIN32API IPictureImpl_get_Width(LPPICTURE iface,
|
|---|
| 669 | OLE_XSIZE_HIMETRIC * pWidth)
|
|---|
| 670 | {
|
|---|
| 671 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 672 |
|
|---|
| 673 | dprintf(("OLEAUT32: IPictureImpl(%p)->get_Width()", This));
|
|---|
| 674 |
|
|---|
| 675 | // Sanity check...
|
|---|
| 676 | if (pWidth == 0)
|
|---|
| 677 | return E_POINTER;
|
|---|
| 678 |
|
|---|
| 679 | // Return the width...
|
|---|
| 680 | return This->pStrat->get_Width(pWidth);
|
|---|
| 681 | }
|
|---|
| 682 |
|
|---|
| 683 | // ----------------------------------------------------------------------
|
|---|
| 684 | // IPictureImpl_get_Height
|
|---|
| 685 | // ----------------------------------------------------------------------
|
|---|
| 686 | static HRESULT WIN32API IPictureImpl_get_Height(LPPICTURE iface,
|
|---|
| 687 | OLE_YSIZE_HIMETRIC * pHeight)
|
|---|
| 688 | {
|
|---|
| 689 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 690 |
|
|---|
| 691 | dprintf(("OLEAUT32: IPictureImpl(%p)->get_Height()", This));
|
|---|
| 692 |
|
|---|
| 693 | // Sanity check...
|
|---|
| 694 | if (pHeight == 0)
|
|---|
| 695 | return E_POINTER;
|
|---|
| 696 |
|
|---|
| 697 | // Return the height...
|
|---|
| 698 | return This->pStrat->get_Height(pHeight);
|
|---|
| 699 | }
|
|---|
| 700 |
|
|---|
| 701 | // ----------------------------------------------------------------------
|
|---|
| 702 | // IPictureImpl_Render
|
|---|
| 703 | // ----------------------------------------------------------------------
|
|---|
| 704 | static HRESULT WIN32API IPictureImpl_Render(LPPICTURE iface,
|
|---|
| 705 | HDC hdc, LONG x, LONG y, LONG cx, LONG cy,
|
|---|
| 706 | OLE_XPOS_HIMETRIC xSrc, OLE_YPOS_HIMETRIC ySrc,
|
|---|
| 707 | OLE_XSIZE_HIMETRIC cxSrc, OLE_YSIZE_HIMETRIC cySrc,
|
|---|
| 708 | LPCRECT pRcWBounds)
|
|---|
| 709 | {
|
|---|
| 710 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 711 |
|
|---|
| 712 | dprintf(("OLEAUT32: IPictureImpl(%p)->Render()", This));
|
|---|
| 713 |
|
|---|
| 714 | // Delegate...
|
|---|
| 715 | return This->pStrat->Render(hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, pRcWBounds);
|
|---|
| 716 | }
|
|---|
| 717 |
|
|---|
| 718 | // ----------------------------------------------------------------------
|
|---|
| 719 | // IPictureImpl_set_hPal
|
|---|
| 720 | // ----------------------------------------------------------------------
|
|---|
| 721 | static HRESULT WIN32API IPictureImpl_set_hPal(LPPICTURE iface,
|
|---|
| 722 | OLE_HANDLE hPal)
|
|---|
| 723 | {
|
|---|
| 724 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 725 |
|
|---|
| 726 | dprintf(("OLEAUT32: IPictureImpl(%p)->set_hPal()", This));
|
|---|
| 727 |
|
|---|
| 728 | //Delegate...
|
|---|
| 729 | return This->pStrat->set_hPal(hPal);
|
|---|
| 730 | }
|
|---|
| 731 |
|
|---|
| 732 | // ----------------------------------------------------------------------
|
|---|
| 733 | // IPictureImpl_get_CurDC
|
|---|
| 734 | // ----------------------------------------------------------------------
|
|---|
| 735 | static HRESULT WIN32API IPictureImpl_get_CurDC(LPPICTURE iface,
|
|---|
| 736 | HDC * phDC)
|
|---|
| 737 | {
|
|---|
| 738 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 739 |
|
|---|
| 740 | dprintf(("OLEAUT32: IPictureImpl(%p)->get_CurDC()", This));
|
|---|
| 741 |
|
|---|
| 742 | // Sanity check
|
|---|
| 743 | if (phDC == 0)
|
|---|
| 744 | return E_POINTER;
|
|---|
| 745 |
|
|---|
| 746 | // Return current hDC
|
|---|
| 747 | *phDC = This->hCurDC;
|
|---|
| 748 |
|
|---|
| 749 | return S_OK;
|
|---|
| 750 | }
|
|---|
| 751 |
|
|---|
| 752 | // ----------------------------------------------------------------------
|
|---|
| 753 | // IPictureImpl_SelectPicture
|
|---|
| 754 | // ----------------------------------------------------------------------
|
|---|
| 755 | static HRESULT WIN32API IPictureImpl_SelectPicture(LPPICTURE iface,
|
|---|
| 756 | HDC hDCIn, HDC * phDCOut, OLE_HANDLE * phBmpOut)
|
|---|
| 757 | {
|
|---|
| 758 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 759 |
|
|---|
| 760 | dprintf(("OLEAUT32: IPictureImpl(%p)->SelectPicture() - Stub", This));
|
|---|
| 761 |
|
|---|
| 762 | return E_NOTIMPL;
|
|---|
| 763 | }
|
|---|
| 764 |
|
|---|
| 765 | // ----------------------------------------------------------------------
|
|---|
| 766 | // IPictureImpl_get_KeepOriginalFormat
|
|---|
| 767 | // ----------------------------------------------------------------------
|
|---|
| 768 | static HRESULT WIN32API IPictureImpl_get_KeepOriginalFormat(LPPICTURE iface,
|
|---|
| 769 | BOOL * pKeep)
|
|---|
| 770 | {
|
|---|
| 771 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 772 |
|
|---|
| 773 | dprintf(("OLEAUT32: IPictureImpl(%p)->get_KeepOriginalFormat()", This));
|
|---|
| 774 |
|
|---|
| 775 | // Sanity check...
|
|---|
| 776 | if (pKeep == 0)
|
|---|
| 777 | return E_POINTER;
|
|---|
| 778 |
|
|---|
| 779 | // Return the current setting...
|
|---|
| 780 | *pKeep = This->fKeepOriginalFormat;
|
|---|
| 781 |
|
|---|
| 782 | return S_OK;
|
|---|
| 783 | }
|
|---|
| 784 |
|
|---|
| 785 | // ----------------------------------------------------------------------
|
|---|
| 786 | // IPictureImpl_put_KeepOriginalFormat
|
|---|
| 787 | // ----------------------------------------------------------------------
|
|---|
| 788 | static HRESULT WIN32API IPictureImpl_put_KeepOriginalFormat(LPPICTURE iface,
|
|---|
| 789 | BOOL Keep)
|
|---|
| 790 | {
|
|---|
| 791 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 792 |
|
|---|
| 793 | dprintf(("OLEAUT32: IPictureImpl(%p)->put_KeepOriginalFormat()", This));
|
|---|
| 794 |
|
|---|
| 795 | // Save it...
|
|---|
| 796 | This->fKeepOriginalFormat = Keep;
|
|---|
| 797 |
|
|---|
| 798 | return S_OK;
|
|---|
| 799 | }
|
|---|
| 800 |
|
|---|
| 801 | // ----------------------------------------------------------------------
|
|---|
| 802 | // IPictureImpl_PictureChanged
|
|---|
| 803 | // ----------------------------------------------------------------------
|
|---|
| 804 | static HRESULT WIN32API IPictureImpl_PictureChanged(LPPICTURE iface)
|
|---|
| 805 | {
|
|---|
| 806 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 807 |
|
|---|
| 808 | dprintf(("OLEAUT32: IPictureImpl(%p)->PictureChanged()", This));
|
|---|
| 809 |
|
|---|
| 810 | return S_OK;
|
|---|
| 811 | }
|
|---|
| 812 |
|
|---|
| 813 | // ----------------------------------------------------------------------
|
|---|
| 814 | // IPictureImpl_SaveAsFile
|
|---|
| 815 | // ----------------------------------------------------------------------
|
|---|
| 816 | static HRESULT WIN32API IPictureImpl_SaveAsFile(LPPICTURE iface,
|
|---|
| 817 | LPSTREAM pStream, BOOL fSaveMemCopy, LONG * pCbSize)
|
|---|
| 818 | {
|
|---|
| 819 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 820 |
|
|---|
| 821 | dprintf(("OLEAUT32: IPictureImpl(%p)->SaveAsFile()", This));
|
|---|
| 822 |
|
|---|
| 823 | //Delegate...
|
|---|
| 824 | return This->pStrat->SaveAsFile(pStream, fSaveMemCopy, pCbSize);
|
|---|
| 825 | }
|
|---|
| 826 |
|
|---|
| 827 | // ----------------------------------------------------------------------
|
|---|
| 828 | // IPictureImpl_get_Attributes
|
|---|
| 829 | // ----------------------------------------------------------------------
|
|---|
| 830 | static HRESULT WIN32API IPictureImpl_get_Attributes(LPPICTURE iface,
|
|---|
| 831 | DWORD * pDwAttr)
|
|---|
| 832 | {
|
|---|
| 833 | _ICOM_THIS(IPictureImpl, iface);
|
|---|
| 834 |
|
|---|
| 835 | dprintf(("OLEAUT32: IPictureImpl(%p)->get_Attributes()", This));
|
|---|
| 836 |
|
|---|
| 837 | // Sanity check
|
|---|
| 838 | if (pDwAttr == 0)
|
|---|
| 839 | return E_POINTER;
|
|---|
| 840 |
|
|---|
| 841 | //Delegate...
|
|---|
| 842 | return This->pStrat->get_Attributes(pDwAttr);
|
|---|
| 843 | }
|
|---|
| 844 |
|
|---|
| 845 |
|
|---|
| 846 | // ----------------------------------------------------------------------
|
|---|
| 847 | // IPictureImpl_IDispatch_QueryInterface
|
|---|
| 848 | // ----------------------------------------------------------------------
|
|---|
| 849 | static HRESULT WINAPI IPictureImpl_IDispatch_QueryInterface(LPDISPATCH iface,
|
|---|
| 850 | REFIID riid, LPVOID * obj)
|
|---|
| 851 | {
|
|---|
| 852 | _ICOM_THIS_From_IDispatch(IPicture, iface);
|
|---|
| 853 |
|
|---|
| 854 | return IPictureImpl_QueryInterface(This, riid, obj);
|
|---|
| 855 | }
|
|---|
| 856 |
|
|---|
| 857 | // ----------------------------------------------------------------------
|
|---|
| 858 | // IPictureImpl_IDispatch_AddRef
|
|---|
| 859 | // ----------------------------------------------------------------------
|
|---|
| 860 | static ULONG WINAPI IPictureImpl_IDispatch_AddRef(LPDISPATCH iface)
|
|---|
| 861 | {
|
|---|
| 862 | _ICOM_THIS_From_IDispatch(IPicture, iface);
|
|---|
| 863 |
|
|---|
| 864 | return IPictureImpl_AddRef(This);
|
|---|
| 865 | }
|
|---|
| 866 |
|
|---|
| 867 | // ----------------------------------------------------------------------
|
|---|
| 868 | // IPictureImpl_IDispatch_Release
|
|---|
| 869 | // ----------------------------------------------------------------------
|
|---|
| 870 | static ULONG WINAPI IPictureImpl_IDispatch_Release(LPDISPATCH iface)
|
|---|
| 871 | {
|
|---|
| 872 | _ICOM_THIS_From_IDispatch(IPicture, iface);
|
|---|
| 873 |
|
|---|
| 874 | return IPictureImpl_Release(This);
|
|---|
| 875 | }
|
|---|
| 876 |
|
|---|
| 877 | // ----------------------------------------------------------------------
|
|---|
| 878 | //
|
|---|
| 879 | // ----------------------------------------------------------------------
|
|---|
| 880 | static HRESULT WINAPI IPictureImpl_IDispatch_GetTypeInfoCount(LPDISPATCH iface,
|
|---|
| 881 | unsigned int* pctinfo)
|
|---|
| 882 | {
|
|---|
| 883 | dprintf(("Stub"));
|
|---|
| 884 | return E_NOTIMPL;
|
|---|
| 885 | }
|
|---|
| 886 |
|
|---|
| 887 | // ----------------------------------------------------------------------
|
|---|
| 888 | //
|
|---|
| 889 | // ----------------------------------------------------------------------
|
|---|
| 890 | static HRESULT WINAPI IPictureImpl_IDispatch_GetTypeInfo(LPDISPATCH iface,
|
|---|
| 891 | UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo)
|
|---|
| 892 | {
|
|---|
| 893 | dprintf(("Stub"));
|
|---|
| 894 | return E_NOTIMPL;
|
|---|
| 895 | }
|
|---|
| 896 |
|
|---|
| 897 | // ----------------------------------------------------------------------
|
|---|
| 898 | //
|
|---|
| 899 | // ----------------------------------------------------------------------
|
|---|
| 900 | static HRESULT WINAPI IPictureImpl_IDispatch_GetIDsOfNames(LPDISPATCH iface,
|
|---|
| 901 | REFIID riid, LPOLESTR* rgszNames, UINT cNames,
|
|---|
| 902 | LCID lcid, DISPID* rgDispId)
|
|---|
| 903 | {
|
|---|
| 904 | dprintf(("Stub"));
|
|---|
| 905 | return E_NOTIMPL;
|
|---|
| 906 | }
|
|---|
| 907 |
|
|---|
| 908 | // ----------------------------------------------------------------------
|
|---|
| 909 | //
|
|---|
| 910 | // ----------------------------------------------------------------------
|
|---|
| 911 | static HRESULT WINAPI IPictureImpl_IDispatch_Invoke(LPDISPATCH iface,
|
|---|
| 912 | DISPID dispIdMember, REFIID riid,
|
|---|
| 913 | LCID lcid, WORD wFlags,
|
|---|
| 914 | DISPPARAMS* pDispParams, VARIANT* pVarResult,
|
|---|
| 915 | EXCEPINFO* pExepInfo, UINT* puArgErr)
|
|---|
| 916 | {
|
|---|
| 917 | dprintf(("Stub"));
|
|---|
| 918 | return E_NOTIMPL;
|
|---|
| 919 | }
|
|---|
| 920 |
|
|---|
| 921 | // ----------------------------------------------------------------------
|
|---|
| 922 | //
|
|---|
| 923 | // ----------------------------------------------------------------------
|
|---|
| 924 | static HRESULT WINAPI IPictureImpl_IPersistStream_QueryInterface(LPPERSISTSTREAM iface,
|
|---|
| 925 | REFIID riid, LPVOID * obj)
|
|---|
| 926 | {
|
|---|
| 927 | _ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 928 |
|
|---|
| 929 | return IPictureImpl_QueryInterface(This, riid, obj);
|
|---|
| 930 | }
|
|---|
| 931 |
|
|---|
| 932 | // ----------------------------------------------------------------------
|
|---|
| 933 | //
|
|---|
| 934 | // ----------------------------------------------------------------------
|
|---|
| 935 | static ULONG WINAPI IPictureImpl_IPersistStream_AddRef(LPPERSISTSTREAM iface)
|
|---|
| 936 | {
|
|---|
| 937 | _ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 938 |
|
|---|
| 939 | return IPictureImpl_AddRef(This);
|
|---|
| 940 | }
|
|---|
| 941 |
|
|---|
| 942 | // ----------------------------------------------------------------------
|
|---|
| 943 | //
|
|---|
| 944 | // ----------------------------------------------------------------------
|
|---|
| 945 | static ULONG WINAPI IPictureImpl_IPersistStream_Release(LPPERSISTSTREAM iface)
|
|---|
| 946 | {
|
|---|
| 947 | _ICOM_THIS_From_IPersistStream(IPicture, iface);
|
|---|
| 948 |
|
|---|
| 949 | return IPictureImpl_Release(This);
|
|---|
| 950 | }
|
|---|
| 951 |
|
|---|
| 952 | // ----------------------------------------------------------------------
|
|---|
| 953 | //
|
|---|
| 954 | // ----------------------------------------------------------------------
|
|---|
| 955 | static HRESULT WINAPI IPictureImpl_IPersistStream_GetClassID(LPPERSISTSTREAM iface,
|
|---|
| 956 | CLSID * pClassID)
|
|---|
| 957 | {
|
|---|
| 958 | dprintf(("Stub"));
|
|---|
| 959 | return E_NOTIMPL;
|
|---|
| 960 | }
|
|---|
| 961 |
|
|---|
| 962 | // ----------------------------------------------------------------------
|
|---|
| 963 | //
|
|---|
| 964 | // ----------------------------------------------------------------------
|
|---|
| 965 | static HRESULT WINAPI IPictureImpl_IPersistStream_IsDirty(LPPERSISTSTREAM iface)
|
|---|
| 966 | {
|
|---|
| 967 | dprintf(("Stub"));
|
|---|
| 968 | return E_NOTIMPL;
|
|---|
| 969 | }
|
|---|
| 970 |
|
|---|
| 971 | // ----------------------------------------------------------------------
|
|---|
| 972 | //
|
|---|
| 973 | // ----------------------------------------------------------------------
|
|---|
| 974 | static HRESULT WINAPI IPictureImpl_IPersistStream_Load(LPPERSISTSTREAM iface,
|
|---|
| 975 | LPSTREAM pLoadStream)
|
|---|
| 976 | {
|
|---|
| 977 | dprintf(("Stub"));
|
|---|
| 978 | return E_NOTIMPL;
|
|---|
| 979 | }
|
|---|
| 980 |
|
|---|
| 981 | // ----------------------------------------------------------------------
|
|---|
| 982 | //
|
|---|
| 983 | // ----------------------------------------------------------------------
|
|---|
| 984 | static HRESULT WINAPI IPictureImpl_IPersistStream_Save(LPPERSISTSTREAM iface,
|
|---|
| 985 | LPSTREAM pOutStream, BOOL fClearDirty)
|
|---|
| 986 | {
|
|---|
| 987 | dprintf(("Stub"));
|
|---|
| 988 | return E_NOTIMPL;
|
|---|
| 989 | }
|
|---|
| 990 |
|
|---|
| 991 | // ----------------------------------------------------------------------
|
|---|
| 992 | //
|
|---|
| 993 | // ----------------------------------------------------------------------
|
|---|
| 994 | static HRESULT WINAPI IPictureImpl_IPersistStream_GetSizeMax(LPPERSISTSTREAM iface,
|
|---|
| 995 | ULARGE_INTEGER * pcbSize)
|
|---|
| 996 | {
|
|---|
| 997 | dprintf(("Stub"));
|
|---|
| 998 | return E_NOTIMPL;
|
|---|
| 999 | }
|
|---|
| 1000 |
|
|---|
| 1001 |
|
|---|
| 1002 | // ======================================================================
|
|---|
| 1003 | // Public API's
|
|---|
| 1004 | // ======================================================================
|
|---|
| 1005 |
|
|---|
| 1006 | // ----------------------------------------------------------------------
|
|---|
| 1007 | // OleLoadPicture
|
|---|
| 1008 | // ----------------------------------------------------------------------
|
|---|
| 1009 | HRESULT WIN32API OleLoadPicture(LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
|---|
| 1010 | REFIID riid, LPVOID * lplpvObj)
|
|---|
| 1011 | {
|
|---|
| 1012 | dprintf(("OLEAUT32: OleLoadPicture - stub"));
|
|---|
| 1013 | return S_OK;
|
|---|
| 1014 | }
|
|---|
| 1015 |
|
|---|
| 1016 | // ----------------------------------------------------------------------
|
|---|
| 1017 | // OleCreatePictureIndirect
|
|---|
| 1018 | // ----------------------------------------------------------------------
|
|---|
| 1019 | HRESULT WIN32API OleCreatePictureIndirect(LPPICTDESC lpPictDesc, REFIID riid,
|
|---|
| 1020 | BOOL fOwn, LPVOID * lplpvObj)
|
|---|
| 1021 | {
|
|---|
| 1022 | IPictureImpl * newPicture;
|
|---|
| 1023 | HRESULT hr;
|
|---|
| 1024 |
|
|---|
| 1025 | dprintf(("OLEAUT32: OleCreatePictureIndirect"));
|
|---|
| 1026 |
|
|---|
| 1027 | // Validate input pointer...
|
|---|
| 1028 | if (lplpvObj == 0)
|
|---|
| 1029 | return E_POINTER;
|
|---|
| 1030 |
|
|---|
| 1031 | *lplpvObj = 0;
|
|---|
| 1032 |
|
|---|
| 1033 | // Create new picture object...
|
|---|
| 1034 | newPicture = IPictureImpl_Constructor(lpPictDesc, fOwn);
|
|---|
| 1035 |
|
|---|
| 1036 | if (newPicture == 0)
|
|---|
| 1037 | return E_OUTOFMEMORY;
|
|---|
| 1038 |
|
|---|
| 1039 | // Grab and return the requested interface...
|
|---|
| 1040 | hr = IPictureImpl_QueryInterface((LPPICTURE)newPicture, riid, lplpvObj);
|
|---|
| 1041 |
|
|---|
| 1042 | // We should now have two references :-)
|
|---|
| 1043 | // One from the constructor & one from QueryInterface
|
|---|
| 1044 | // Release one...
|
|---|
| 1045 | IPictureImpl_Release((LPPICTURE)newPicture);
|
|---|
| 1046 |
|
|---|
| 1047 | return hr;
|
|---|
| 1048 | }
|
|---|
| 1049 |
|
|---|
| 1050 | // ----------------------------------------------------------------------
|
|---|
| 1051 | // OleLoadPictureFile
|
|---|
| 1052 | // ----------------------------------------------------------------------
|
|---|
| 1053 | HRESULT WIN32API OleLoadPictureFile(VARIANT varFileName, LPDISPATCH* lplpdispPicture)
|
|---|
| 1054 | {
|
|---|
| 1055 | dprintf(("OLEAUT32: OleLoadPictureFile - stub"));
|
|---|
| 1056 | return S_OK;
|
|---|
| 1057 | }
|
|---|
| 1058 |
|
|---|
| 1059 | // ----------------------------------------------------------------------
|
|---|
| 1060 | // OleSavePictureFile
|
|---|
| 1061 | // ----------------------------------------------------------------------
|
|---|
| 1062 | HRESULT WIN32API OleSavePictureFile(LPDISPATCH lpdispPicture,
|
|---|
| 1063 | BSTR bstrFileName)
|
|---|
| 1064 | {
|
|---|
| 1065 | dprintf(("OLEAUT32: OleSavePictureFile - stub"));
|
|---|
| 1066 | return S_OK;
|
|---|
| 1067 | }
|
|---|
| 1068 |
|
|---|
| 1069 | // ----------------------------------------------------------------------
|
|---|
| 1070 | // OleLoadPicturePath
|
|---|
| 1071 | // ----------------------------------------------------------------------
|
|---|
| 1072 | HRESULT WIN32API OleLoadPicturePath
|
|---|
| 1073 | (LPOLESTR szURLorPath,
|
|---|
| 1074 | LPUNKNOWN punkCaller,
|
|---|
| 1075 | DWORD dwReserved,
|
|---|
| 1076 | OLE_COLOR clrReserved,
|
|---|
| 1077 | REFIID riid,
|
|---|
| 1078 | LPVOID * ppvRet )
|
|---|
| 1079 | {
|
|---|
| 1080 | dprintf(("OLEAUT32: OleLoadPicturePath - stub"));
|
|---|
| 1081 | return S_OK;
|
|---|
| 1082 | }
|
|---|
| 1083 |
|
|---|
| 1084 |
|
|---|