Ignore:
Timestamp:
Sep 17, 2000, 12:31:07 PM (25 years ago)
Author:
davidr
Message:

Updates from wine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ole32/datacache.cpp

    r3167 r4274  
    1 /* $Id: datacache.cpp,v 1.2 2000-03-19 15:33:05 davidr Exp $ */
     1/* $Id: datacache.cpp,v 1.3 2000-09-17 10:31:02 davidr Exp $ */
    22/*
    33 *  OLE 2 Data cache
     
    6464  DWORD unknown6;
    6565  DWORD unknown7;
    66   DWORD objectExtentX;
    67   DWORD objectExtentY;
    68   DWORD unknown8;
     66  DWORD dwObjectExtentX;
     67  DWORD dwObjectExtentY;
     68  DWORD dwSize;
    6969} PresentationDataHeader;
    7070
     
    10061006}
    10071007
     1008/************************************************************************
     1009 * DataCache_GetData
     1010 *
     1011 * Get Data from a source dataobject using format pformatetcIn->cfFormat
     1012 * See Windows documentation for more details on GetData.
     1013 * TODO: Currently only CF_METAFILEPICT is implemented
     1014 */
    10081015static HRESULT WINAPI DataCache_GetData(
    10091016            IDataObject*     iface,
     
    10111018            STGMEDIUM*       pmedium)
    10121019{
    1013   FIXME("stub\n");
     1020  HRESULT hr = 0;
     1021  HRESULT hrRet = E_UNEXPECTED;
     1022  IPersistStorage *pPersistStorage = 0;
     1023  IStorage *pStorage = 0;
     1024  IStream *pStream = 0;
     1025  OLECHAR name[]={ 2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};
     1026  HGLOBAL hGlobalMF = 0;
     1027  void *mfBits = 0;
     1028  PresentationDataHeader pdh;
     1029  METAFILEPICT *mfPict;
     1030  HMETAFILE hMetaFile = 0;
     1031
     1032  if (pformatetcIn->cfFormat == CF_METAFILEPICT)
     1033  {
     1034    /* Get the Persist Storage */
     1035
     1036    hr = IDataObject_QueryInterface(iface, &IID_IPersistStorage, (void**)&pPersistStorage);
     1037
     1038    if (hr != S_OK)
     1039      goto cleanup;
     1040
     1041    /* Create a doc file to copy the doc to a storage */
     1042
     1043    hr = StgCreateDocfile(NULL, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &pStorage);
     1044
     1045    if (hr != S_OK)
     1046      goto cleanup;
     1047
     1048    /* Save it to storage */
     1049
     1050    hr = OleSave(pPersistStorage, pStorage, FALSE);
     1051
     1052    if (hr != S_OK)
     1053      goto cleanup;
     1054
     1055    /* Open the Presentation data srteam */
     1056
     1057    hr = IStorage_OpenStream(pStorage, name, 0, STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &pStream);
     1058
     1059    if (hr != S_OK)
     1060      goto cleanup;
     1061
     1062    /* Read the presentation header */
     1063
     1064    hr = IStream_Read(pStream, &pdh, sizeof(PresentationDataHeader), NULL);
     1065
     1066    if (hr != S_OK)
     1067      goto cleanup;
     1068
     1069    mfBits = HeapAlloc(GetProcessHeap(), 0, pdh.dwSize);
     1070
     1071    /* Read the Metafile bits */
     1072
     1073    hr = IStream_Read(pStream, mfBits, pdh.dwSize, NULL);
     1074
     1075    if (hr != S_OK)
     1076      goto cleanup;
     1077
     1078    /* Create the metafile and place it in the STGMEDIUM structure */
     1079
     1080    hMetaFile = SetMetaFileBitsEx(pdh.dwSize, (BYTE *)mfBits);
     1081
     1082    hGlobalMF = GlobalAlloc(GMEM_SHARE|GMEM_MOVEABLE, sizeof(METAFILEPICT));
     1083    mfPict = (METAFILEPICT *)GlobalLock(hGlobalMF);
     1084    mfPict->hMF = hMetaFile;
     1085
     1086    GlobalUnlock(hGlobalMF);
     1087
     1088    pmedium->u.hGlobal = hGlobalMF;
     1089    pmedium->tymed = TYMED_MFPICT;
     1090    hrRet = S_OK;
     1091
     1092cleanup:
     1093
     1094    if (mfBits)
     1095      HeapFree(GetProcessHeap(), 0, mfBits);
     1096
     1097    if (pStream)
     1098      IStream_Release(pStream);
     1099
     1100    if (pStorage)
     1101      IStorage_Release(pStorage);
     1102
     1103    if (pPersistStorage)
     1104      IPersistStorage_Release(pPersistStorage);
     1105
     1106    return hrRet;
     1107  }
     1108
     1109  /* TODO: Other formats are not implemented */
     1110
    10141111  return E_NOTIMPL;
    10151112}
     
    14851582
    14861583    SetWindowExtEx(hdcDraw,
    1487                    presData.objectExtentX,
    1488                    presData.objectExtentY,
     1584                   presData.dwObjectExtentX,
     1585                   presData.dwObjectExtentY,
    14891586                   &oldWindowExt);
    14901587
     
    17051802  if (SUCCEEDED(hres))
    17061803  {
    1707     lpsizel->cx = presData.objectExtentX;
    1708     lpsizel->cy = presData.objectExtentY;
     1804    lpsizel->cx = presData.dwObjectExtentX;
     1805    lpsizel->cy = presData.dwObjectExtentY;
    17091806  }
    17101807
Note: See TracChangeset for help on using the changeset viewer.