Ignore:
Timestamp:
Sep 5, 2001, 3:19:02 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ole32/clipboard.c

    r5602 r6648  
     1/* $Id: clipboard.c,v 1.2 2001-09-05 13:17:07 bird Exp $ */
    12/*
    23 *  OLE 2 clipboard support
     
    8182
    8283  /*
    83    * The hidden OLE clipboard window. This window is used as the bridge between the 
     84   * The hidden OLE clipboard window. This window is used as the bridge between the
    8485   * the OLE and windows clipboard API. (Windows creates one such window per process)
    8586   */
     
    114115*   DO NOT add any members before the VTables declaration!
    115116*/
    116 typedef struct 
     117typedef struct
    117118{
    118119  /* IEnumFORMATETC VTable */
    119120  ICOM_VFIELD(IEnumFORMATETC);
    120  
     121
    121122  /* IEnumFORMATETC fields */
    122123  UINT                         posFmt;    /* current enumerator position */
     
    133134   */
    134135  IUnknown*                    pUnkDataObj;
    135  
     136
    136137} IEnumFORMATETCImpl;
    137138
     
    172173            REFIID           riid,
    173174            void**           ppvObject);
    174 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 
     175static ULONG WINAPI OLEClipbrd_IDataObject_AddRef(
    175176            IDataObject*     iface);
    176 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 
     177static ULONG WINAPI OLEClipbrd_IDataObject_Release(
    177178            IDataObject*     iface);
    178179static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
    179             IDataObject*     iface,
    180             LPFORMATETC      pformatetcIn,
    181             STGMEDIUM*       pmedium);
     180        IDataObject*     iface,
     181        LPFORMATETC      pformatetcIn,
     182        STGMEDIUM*       pmedium);
    182183static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere(
    183             IDataObject*     iface,
    184             LPFORMATETC      pformatetc,
    185             STGMEDIUM*       pmedium);
     184        IDataObject*     iface,
     185        LPFORMATETC      pformatetc,
     186        STGMEDIUM*       pmedium);
    186187static HRESULT WINAPI OLEClipbrd_IDataObject_QueryGetData(
    187             IDataObject*     iface,
    188             LPFORMATETC      pformatetc);
     188        IDataObject*     iface,
     189        LPFORMATETC      pformatetc);
    189190static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc(
    190             IDataObject*     iface,
    191             LPFORMATETC      pformatectIn,
    192             LPFORMATETC      pformatetcOut);
     191        IDataObject*     iface,
     192        LPFORMATETC      pformatectIn,
     193        LPFORMATETC      pformatetcOut);
    193194static HRESULT WINAPI OLEClipbrd_IDataObject_SetData(
    194             IDataObject*     iface,
    195             LPFORMATETC      pformatetc,
    196             STGMEDIUM*       pmedium,
    197             BOOL             fRelease);
     195        IDataObject*     iface,
     196        LPFORMATETC      pformatetc,
     197        STGMEDIUM*       pmedium,
     198        BOOL             fRelease);
    198199static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc(
    199             IDataObject*     iface,       
    200             DWORD            dwDirection,
    201             IEnumFORMATETC** ppenumFormatEtc);
     200        IDataObject*     iface,
     201        DWORD            dwDirection,
     202        IEnumFORMATETC** ppenumFormatEtc);
    202203static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise(
    203             IDataObject*     iface,
    204             FORMATETC*       pformatetc,
    205             DWORD            advf,
    206             IAdviseSink*     pAdvSink,
    207             DWORD*           pdwConnection);
     204        IDataObject*     iface,
     205        FORMATETC*       pformatetc,
     206        DWORD            advf,
     207        IAdviseSink*     pAdvSink,
     208        DWORD*           pdwConnection);
    208209static HRESULT WINAPI OLEClipbrd_IDataObject_DUnadvise(
    209             IDataObject*     iface,
    210             DWORD            dwConnection);
     210        IDataObject*     iface,
     211        DWORD            dwConnection);
    211212static HRESULT WINAPI OLEClipbrd_IDataObject_EnumDAdvise(
    212             IDataObject*     iface,
    213             IEnumSTATDATA**  ppenumAdvise);
     213        IDataObject*     iface,
     214        IEnumSTATDATA**  ppenumAdvise);
    214215
    215216/*
     
    265266
    266267/*
    267  * Name of our registered OLE clipboard window class 
     268 * Name of our registered OLE clipboard window class
    268269 */
    269270CHAR OLEClipbrd_WNDCLASS[] = "CLIPBRDWNDCLASS";
     
    279280
    280281/*---------------------------------------------------------------------*
    281  *           Win32 OLE clipboard API 
     282 *           Win32 OLE clipboard API
    282283 *---------------------------------------------------------------------*/
    283284
     
    290291 *
    291292 *    S_OK                  IDataObject pointer placed on the clipboard
    292  *    CLIPBRD_E_CANT_OPEN   OpenClipboard failed 
    293  *    CLIPBRD_E_CANT_EMPTY  EmptyClipboard failed 
     293 *    CLIPBRD_E_CANT_OPEN   OpenClipboard failed
     294 *    CLIPBRD_E_CANT_EMPTY  EmptyClipboard failed
    294295 *    CLIPBRD_E_CANT_CLOSE  CloseClipboard failed
    295296 *    CLIPBRD_E_CANT_SET    SetClipboard failed
     
    306307  OLEClipbrd **ppDataObject;
    307308*/
    308  
     309
    309310  TRACE("(%p)\n", pDataObj);
    310  
     311
    311312  /*
    312313   * Make sure we have a clipboard object
     
    331332  /*
    332333   * Empty the current clipboard and make our window the clipboard owner
    333    * NOTE: This will trigger a WM_DESTROYCLIPBOARD message 
     334   * NOTE: This will trigger a WM_DESTROYCLIPBOARD message
    334335   */
    335336  if ( !EmptyClipboard() )
     
    356357
    357358  /*
    358    * Enumerate all HGLOBAL formats supported by the source and make 
     359   * Enumerate all HGLOBAL formats supported by the source and make
    359360   * those formats available using delayed rendering using SetClipboardData.
    360    * Only global memory based data items may be made available to non-OLE 
    361    * applications via the standard Windows clipboard API. Data based on other 
     361   * Only global memory based data items may be made available to non-OLE
     362   * applications via the standard Windows clipboard API. Data based on other
    362363   * mediums(non TYMED_HGLOBAL) can only be accessed via the Ole Clipboard API.
    363364   *
     
    373374      HANDLE_ERROR( hr );
    374375    }
    375      
     376
    376377    while ( S_OK == IEnumFORMATETC_Next(penumFormatetc, 1, &rgelt, NULL) )
    377378    {
     
    382383              GetClipboardFormatNameA(rgelt.cfFormat, szFmtName, sizeof(szFmtName)-1)
    383384                ? szFmtName : "");
    384  
     385
    385386        SetClipboardData( rgelt.cfFormat, (HANDLE)NULL);
    386387      }
     
    391392  /*
    392393   * Windows additionally creates a new "DataObject" clipboard format
    393    * and stores in on the clipboard. We could possibly store a pointer 
     394   * and stores in on the clipboard. We could possibly store a pointer
    394395   * to our internal IDataObject interface on the clipboard. I'm not
    395396   * sure what the use of this is though.
     
    402403   if (hDataObject==0)
    403404     HANDLE_ERROR( E_OUTOFMEMORY );
    404    
     405
    405406   ppDataObject = (OLEClipbrd**)GlobalLock(hDataObject);
    406407   *ppDataObject = theOleClipboard;
     
    410411     HANDLE_ERROR( CLIPBRD_E_CANT_SET );
    411412*/
    412  
     413
    413414  hr = S_OK;
    414415
     
    439440/***********************************************************************
    440441 * OleGetClipboard [OLE32.105]
    441  * Returns a pointer to our internal IDataObject which represents the conceptual 
    442  * state of the Windows clipboard. If the current clipboard already contains 
     442 * Returns a pointer to our internal IDataObject which represents the conceptual
     443 * state of the Windows clipboard. If the current clipboard already contains
    443444 * an IDataObject, our internal IDataObject will delegate to this object.
    444445 */
     
    447448  HRESULT hr = S_OK;
    448449  TRACE("()\n");
    449    
     450
    450451  /*
    451452   * Make sure we have a clipboard object
     
    488489  BOOL bClipboardOpen = FALSE;
    489490  IDataObject* pIDataObjectSrc = NULL;
    490  
     491
    491492  TRACE("()\n");
    492493
     
    508509  pIDataObjectSrc = theOleClipboard->pIDataObjectSrc;
    509510  IDataObject_AddRef(pIDataObjectSrc);
    510  
     511
    511512  /*
    512513   * Open the Windows clipboard
     
    548549    }
    549550  }
    550  
     551
    551552  IEnumFORMATETC_Release(penumFormatetc);
    552  
     553
    553554  /*
    554555   * Release the source data object we are holding on to
     
    571572 *           OleIsCurrentClipboard [OLE32.110]
    572573 */
    573 HRESULT WINAPI OleIsCurrentClipboard (  IDataObject *pDataObject) 
     574HRESULT WINAPI OleIsCurrentClipboard (  IDataObject *pDataObject)
    574575{
    575576  TRACE("()\n");
     
    587588
    588589/*---------------------------------------------------------------------*
    589  *           Internal implementation methods for the OLE clipboard 
     590 *           Internal implementation methods for the OLE clipboard
    590591 *---------------------------------------------------------------------*/
    591592
    592593/***********************************************************************
    593594 * OLEClipbrd_Initialize()
    594  * Initializes the OLE clipboard. 
     595 * Initializes the OLE clipboard.
    595596 */
    596597void OLEClipbrd_Initialize()
    597598{
    598599  /*
    599    * Create the clipboard if necessary 
     600   * Create the clipboard if necessary
    600601   */
    601602  if ( !theOleClipboard )
     
    609610/***********************************************************************
    610611 * OLEClipbrd_UnInitialize()
    611  * Un-Initializes the OLE clipboard 
     612 * Un-Initializes the OLE clipboard
    612613 */
    613614void OLEClipbrd_UnInitialize()
     
    636637  OLEClipbrd* newObject = NULL;
    637638  HGLOBAL hNewObject = 0;
    638  
     639
    639640  /*
    640641   * Allocate space for the object. We use GlobalAlloc since we need
     
    650651   */
    651652  newObject = GlobalLock(hNewObject);
    652  
     653
    653654  /*
    654655   * Initialize the virtual function table.
     
    657658
    658659  /*
    659    * Start with one reference count. The caller of this function 
     660   * Start with one reference count. The caller of this function
    660661   * must release the interface pointer when it is done.
    661662   */
     
    663664
    664665  newObject->hSelf = hNewObject;
    665  
     666
    666667  /*
    667668   * The Ole clipboard is a singleton - save the global handle and pointer
     
    676677{
    677678  TRACE("()\n");
    678    
     679
    679680  if ( !ptrToDestroy )
    680681    return;
    681682
    682683  /*
    683    * Destroy the Ole clipboard window 
     684   * Destroy the Ole clipboard window
    684685   */
    685686  if ( ptrToDestroy->hWndClipboard )
     
    703704/***********************************************************************
    704705 * OLEClipbrd_CreateWindow()
    705  * Create the clipboard window 
     706 * Create the clipboard window
    706707 */
    707708static HWND OLEClipbrd_CreateWindow()
     
    710711  WNDCLASSEXA wcex;
    711712
    712   /* 
    713    * Register the clipboard window class if necessary 
     713  /*
     714   * Register the clipboard window class if necessary
    714715   */
    715716    ZeroMemory( &wcex, sizeof(WNDCLASSEXA));
     
    727728
    728729  /*
    729    * Create a hidden window to receive OLE clipboard messages 
     730   * Create a hidden window to receive OLE clipboard messages
    730731   */
    731732
     
    737738 */
    738739
    739   hwnd = CreateWindowA(OLEClipbrd_WNDCLASS, 
    740                                     "ClipboardWindow",
    741                                     WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED,
    742                                     CW_USEDEFAULT, CW_USEDEFAULT,
    743                                     CW_USEDEFAULT, CW_USEDEFAULT,
    744                                     0,
    745                                     0,
    746                                     0,
    747                                     0 /*(LPVOID)&clipboardInfo */);
     740  hwnd = CreateWindowA(OLEClipbrd_WNDCLASS,
     741                    "ClipboardWindow",
     742                    WS_POPUP | WS_CLIPSIBLINGS | WS_OVERLAPPED,
     743                    CW_USEDEFAULT, CW_USEDEFAULT,
     744                    CW_USEDEFAULT, CW_USEDEFAULT,
     745                    0,
     746                    0,
     747                    0,
     748                    0 /*(LPVOID)&clipboardInfo */);
    748749
    749750  return hwnd;
     
    756757static void OLEClipbrd_DestroyWindow(HWND hwnd)
    757758{
    758   /* 
    759    * Destroy clipboard window and unregister its WNDCLASS 
     759  /*
     760   * Destroy clipboard window and unregister its WNDCLASS
    760761   */
    761762  DestroyWindow(hwnd);
     
    765766/***********************************************************************
    766767 * OLEClipbrd_WndProc(HWND, unsigned, WORD, LONG)
    767  * Processes messages sent to the OLE clipboard window. 
    768  * Note that we will intercept messages in our WndProc only when data 
    769  * has been placed in the clipboard via OleSetClipboard(). 
     768 * Processes messages sent to the OLE clipboard window.
     769 * Note that we will intercept messages in our WndProc only when data
     770 * has been placed in the clipboard via OleSetClipboard().
    770771 * i.e. Only when OLE owns the windows clipboard.
    771772 */
     
    773774  (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    774775{
    775   switch (message) 
     776  switch (message)
    776777  {
    777778    /*
    778      * WM_RENDERFORMAT 
     779     * WM_RENDERFORMAT
    779780     * We receive this message to allow us to handle delayed rendering of
    780      * a specific clipboard format when an application requests data in 
     781     * a specific clipboard format when an application requests data in
    781782     * that format by calling GetClipboardData.
    782      * (Recall that in OleSetClipboard, we used SetClipboardData to 
     783     * (Recall that in OleSetClipboard, we used SetClipboardData to
    783784     * make all HGLOBAL formats supported by the source IDataObject
    784785     * available using delayed rendering)
    785      * On receiving this mesage we must actually render the data in the 
    786      * specified format and place it on the clipboard by calling the 
    787      * SetClipboardData function. 
     786     * On receiving this mesage we must actually render the data in the
     787     * specified format and place it on the clipboard by calling the
     788     * SetClipboardData function.
    788789     */
    789790    case WM_RENDERFORMAT:
    790791    {
    791792      FORMATETC rgelt;
    792        
     793
    793794      ZeroMemory( &rgelt, sizeof(FORMATETC));
    794795
     
    802803
    803804      TRACE("(): WM_RENDERFORMAT(cfFormat=%d)\n", rgelt.cfFormat);
    804      
     805
    805806      /*
    806807       * Render the clipboard data.
     
    826827      IEnumFORMATETC* penumFormatetc = NULL;
    827828      FORMATETC rgelt;
    828      
     829
    829830      TRACE("(): WM_RENDERALLFORMATS\n");
    830      
     831
    831832      /*
    832833       * Render all HGLOBAL formats supported by the source into
     
    845846        {
    846847          /*
    847            * Render the clipboard data. 
     848           * Render the clipboard data.
    848849           */
    849850          if ( FAILED(OLEClipbrd_RenderFormat( (IDataObject*)&(theOleClipboard->lpvtbl1), &rgelt )) )
    850851            continue;
    851        
     852
    852853          TRACE("(): WM_RENDERALLFORMATS(cfFormat=%d)\n", rgelt.cfFormat);
    853854        }
    854855      }
    855      
     856
    856857      IEnumFORMATETC_Release(penumFormatetc);
    857858
     
    992993
    993994        HeapFree(GetProcessHeap(), 0, mfBits);
    994  
     995
    995996        GlobalUnlock(std2.u.hMetaFilePict);
    996997
     
    10201021   *  Put a copy of the rendered data back on the clipboard
    10211022   */
    1022  
     1023
    10231024  if ( !(hDup = OLEClipbrd_GlobalDupMem(hStorage)) )
    10241025    HANDLE_ERROR( E_OUTOFMEMORY );
    1025        
     1026
    10261027  if ( !SetClipboardData( pFormatetc->cfFormat, hDup ) )
    10271028  {
     
    10311032
    10321033CLEANUP:
    1033  
     1034
    10341035  ReleaseStgMedium(&std);
    1035  
     1036
    10361037  return hr;
    10371038}
     
    10471048    PVOID pGlobalSrc, pGlobalDest;
    10481049    DWORD cBytes;
    1049    
     1050
    10501051    if ( !hGlobalSrc )
    10511052      return 0;
     
    10541055    if ( 0 == cBytes )
    10551056      return 0;
    1056        
     1057
    10571058    hGlobalDest = GlobalAlloc( GMEM_DDESHARE|GMEM_MOVEABLE,
    10581059                               cBytes );
    10591060    if ( !hGlobalDest )
    10601061      return 0;
    1061    
     1062
    10621063    pGlobalSrc = GlobalLock(hGlobalSrc);
    10631064    pGlobalDest = GlobalLock(hGlobalDest);
     
    10661067
    10671068    memcpy(pGlobalDest, pGlobalSrc, cBytes);
    1068        
     1069
    10691070    GlobalUnlock(hGlobalSrc);
    10701071    GlobalUnlock(hGlobalDest);
     
    10751076
    10761077/*---------------------------------------------------------------------*
    1077  *  Implementation of the internal IDataObject interface exposed by 
     1078 *  Implementation of the internal IDataObject interface exposed by
    10781079 *  the OLE clipboard.
    10791080 *---------------------------------------------------------------------*/
     
    10901091            void**           ppvObject)
    10911092{
    1092   /* 
    1093    * Declare "This" pointer 
     1093  /*
     1094   * Declare "This" pointer
    10941095   */
    10951096  ICOM_THIS(OLEClipbrd, iface);
    10961097  TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvObject);
    1097  
     1098
    10981099  /*
    10991100   * Perform a sanity check on the parameters.
     
    11011102  if ( (This==0) || (ppvObject==0) )
    11021103    return E_INVALIDARG;
    1103  
     1104
    11041105  /*
    11051106   * Initialize the return parameter.
     
    11101111   * Compare the riid with the interface IDs implemented by this object.
    11111112   */
    1112   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     1113  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    11131114  {
    11141115    *ppvObject = iface;
    11151116  }
    1116   else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0) 
     1117  else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0)
    11171118  {
    11181119    *ppvObject = (IDataObject*)&(This->lpvtbl1);
     
    11231124    return E_NOINTERFACE;
    11241125  }
    1125  
     1126
    11261127  /*
    11271128   * Query Interface always increases the reference count by one when it is
    1128    * successful. 
     1129   * successful.
    11291130   */
    11301131  IUnknown_AddRef((IUnknown*)*ppvObject);
     
    11381139 * See Windows documentation for more details on IUnknown methods.
    11391140 */
    1140 static ULONG WINAPI OLEClipbrd_IDataObject_AddRef( 
     1141static ULONG WINAPI OLEClipbrd_IDataObject_AddRef(
    11411142            IDataObject*     iface)
    11421143{
    1143   /* 
    1144    * Declare "This" pointer 
     1144  /*
     1145   * Declare "This" pointer
    11451146   */
    11461147  ICOM_THIS(OLEClipbrd, iface);
    11471148
    11481149  TRACE("(%p)->(count=%lu)\n",This, This->ref);
    1149  
     1150
    11501151  This->ref++;
    11511152
     
    11581159 * See Windows documentation for more details on IUnknown methods.
    11591160 */
    1160 static ULONG WINAPI OLEClipbrd_IDataObject_Release( 
     1161static ULONG WINAPI OLEClipbrd_IDataObject_Release(
    11611162            IDataObject*     iface)
    11621163{
    1163   /* 
    1164    * Declare "This" pointer 
     1164  /*
     1165   * Declare "This" pointer
    11651166   */
    11661167  ICOM_THIS(OLEClipbrd, iface);
    11671168
    11681169  TRACE("(%p)->(count=%lu)\n",This, This->ref);
    1169  
     1170
    11701171  /*
    11711172   * Decrease the reference count on this object.
     
    11801181    OLEClipbrd_Destroy(This);
    11811182  }
    1182  
     1183
    11831184  return This->ref;
    11841185}
    11851186
    1186  
     1187
    11871188/************************************************************************
    11881189 * OLEClipbrd_IDataObject_GetData (IDataObject)
    11891190 *
    1190  * The OLE Clipboard's implementation of this method delegates to 
     1191 * The OLE Clipboard's implementation of this method delegates to
    11911192 * a data source if there is one or wraps around the windows clipboard
    11921193 *
     
    11941195 */
    11951196static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
    1196             IDataObject*     iface,
    1197             LPFORMATETC      pformatetcIn,
    1198             STGMEDIUM*       pmedium)
     1197        IDataObject*     iface,
     1198        LPFORMATETC      pformatetcIn,
     1199        STGMEDIUM*       pmedium)
    11991200{
    12001201  HANDLE      hData = 0;
     
    12031204
    12041205  /*
    1205    * Declare "This" pointer 
     1206   * Declare "This" pointer
    12061207   */
    12071208  ICOM_THIS(OLEClipbrd, iface);
    1208  
     1209
    12091210  TRACE("(%p,%p,%p)\n", iface, pformatetcIn, pmedium);
    12101211
     
    12321233*/
    12331234
    1234   /* 
     1235  /*
    12351236   * Otherwise, get the data from the windows clipboard using GetClipboardData
    12361237   */
     
    12401241  hData = GetClipboardData(pformatetcIn->cfFormat);
    12411242
    1242   /* 
     1243  /*
    12431244   * Return the clipboard data in the storage medium structure
    12441245   */
     
    12461247  pmedium->u.hGlobal = (HGLOBAL)hData;
    12471248  pmedium->pUnkForRelease = NULL;
    1248  
     1249
    12491250  hr = S_OK;
    1250  
     1251
    12511252CLEANUP:
    12521253  /*
     
    12621263
    12631264static HRESULT WINAPI OLEClipbrd_IDataObject_GetDataHere(
    1264             IDataObject*     iface,
    1265             LPFORMATETC      pformatetc,
    1266             STGMEDIUM*       pmedium)
     1265        IDataObject*     iface,
     1266        LPFORMATETC      pformatetc,
     1267        STGMEDIUM*       pmedium)
    12671268{
    12681269  FIXME(": Stub\n");
     
    12731274 * OLEClipbrd_IDataObject_QueryGetData (IDataObject)
    12741275 *
    1275  * The OLE Clipboard's implementation of this method delegates to 
     1276 * The OLE Clipboard's implementation of this method delegates to
    12761277 * a data source if there is one or wraps around the windows clipboard
    12771278 * function IsClipboardFormatAvailable() otherwise.
     
    12801281 */
    12811282static HRESULT WINAPI OLEClipbrd_IDataObject_QueryGetData(
    1282             IDataObject*     iface,
    1283             LPFORMATETC      pformatetc)
    1284 {
    1285   /* 
    1286    * Declare "This" pointer 
     1283        IDataObject*     iface,
     1284        LPFORMATETC      pformatetc)
     1285{
     1286  /*
     1287   * Declare "This" pointer
    12871288   */
    12881289  ICOM_THIS(OLEClipbrd, iface);
     
    13141315  if ( pformatetc->tymed != TYMED_HGLOBAL )
    13151316    return DV_E_TYMED;
    1316          
     1317
    13171318  /*
    13181319   * Delegate to the Windows clipboard function IsClipboardFormatAvailable
     
    13271328 */
    13281329static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc(
    1329             IDataObject*     iface,
    1330             LPFORMATETC      pformatectIn,
    1331             LPFORMATETC      pformatetcOut)
     1330        IDataObject*     iface,
     1331        LPFORMATETC      pformatectIn,
     1332        LPFORMATETC      pformatetcOut)
    13321333{
    13331334  TRACE("(%p, %p, %p)\n", iface, pformatectIn, pformatetcOut);
     
    13431344 * OLEClipbrd_IDataObject_SetData (IDataObject)
    13441345 *
    1345  * The OLE Clipboard's does not implement this method 
     1346 * The OLE Clipboard's does not implement this method
    13461347 *
    13471348 * See Windows documentation for more details on IDataObject methods.
    13481349 */
    13491350static HRESULT WINAPI OLEClipbrd_IDataObject_SetData(
    1350             IDataObject*     iface,
    1351             LPFORMATETC      pformatetc,
    1352             STGMEDIUM*       pmedium,
    1353             BOOL             fRelease)
     1351        IDataObject*     iface,
     1352        LPFORMATETC      pformatetc,
     1353        STGMEDIUM*       pmedium,
     1354        BOOL             fRelease)
    13541355{
    13551356  TRACE("\n");
     
    13631364 */
    13641365static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc(
    1365             IDataObject*     iface,
    1366             DWORD            dwDirection,
    1367             IEnumFORMATETC** ppenumFormatEtc)
     1366        IDataObject*     iface,
     1367        DWORD            dwDirection,
     1368        IEnumFORMATETC** ppenumFormatEtc)
    13681369{
    13691370  HRESULT hr = S_OK;
     
    13721373  UINT format;
    13731374  BOOL bClipboardOpen;
    1374  
    1375   /* 
    1376    * Declare "This" pointer 
     1375
     1376  /*
     1377   * Declare "This" pointer
    13771378   */
    13781379  ICOM_THIS(OLEClipbrd, iface);
     
    14271428      HANDLE_ERROR( E_FAIL );
    14281429    }
    1429    
     1430
    14301431    /* Init the FORMATETC struct */
    14311432    afmt[i].cfFormat = format;
     
    14461447  if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenumFormatEtc)))
    14471448    HANDLE_ERROR( hr );
    1448      
     1449
    14491450  hr = S_OK;
    1450  
     1451
    14511452CLEANUP:
    14521453  /*
     
    14551456  if (afmt)
    14561457    HeapFree(GetProcessHeap(), 0, afmt);
    1457  
     1458
    14581459  /*
    14591460   * Close Windows clipboard
     
    14681469 * OLEClipbrd_IDataObject_DAdvise (IDataObject)
    14691470 *
    1470  * The OLE Clipboard's does not implement this method 
     1471 * The OLE Clipboard's does not implement this method
    14711472 *
    14721473 * See Windows documentation for more details on IDataObject methods.
    14731474 */
    14741475static HRESULT WINAPI OLEClipbrd_IDataObject_DAdvise(
    1475             IDataObject*     iface,
    1476             FORMATETC*       pformatetc,
    1477             DWORD            advf,
    1478             IAdviseSink*     pAdvSink,
    1479             DWORD*           pdwConnection)
     1476        IDataObject*     iface,
     1477        FORMATETC*       pformatetc,
     1478        DWORD            advf,
     1479        IAdviseSink*     pAdvSink,
     1480        DWORD*           pdwConnection)
    14801481{
    14811482  TRACE("\n");
     
    14861487 * OLEClipbrd_IDataObject_DUnadvise (IDataObject)
    14871488 *
    1488  * The OLE Clipboard's does not implement this method 
     1489 * The OLE Clipboard's does not implement this method
    14891490 *
    14901491 * See Windows documentation for more details on IDataObject methods.
    14911492 */
    14921493static HRESULT WINAPI OLEClipbrd_IDataObject_DUnadvise(
    1493             IDataObject*     iface,
    1494             DWORD            dwConnection)
     1494        IDataObject*     iface,
     1495        DWORD            dwConnection)
    14951496{
    14961497  TRACE("\n");
     
    15061507 */
    15071508static HRESULT WINAPI OLEClipbrd_IDataObject_EnumDAdvise(
    1508             IDataObject*     iface,
    1509             IEnumSTATDATA**  ppenumAdvise)
     1509        IDataObject*     iface,
     1510        IEnumSTATDATA**  ppenumAdvise)
    15101511{
    15111512  TRACE("\n");
     
    15331534  DWORD size=cfmt * sizeof(FORMATETC);
    15341535  LPMALLOC pIMalloc;
    1535  
     1536
    15361537  ef = (IEnumFORMATETCImpl*)HeapAlloc(GetProcessHeap(),
    15371538                                      HEAP_ZERO_MEMORY,
     
    15391540  if (!ef)
    15401541    return NULL;
    1541  
     1542
    15421543  ef->ref = 0;
    15431544  ICOM_VTBL(ef) = &efvt;
    15441545  ef->pUnkDataObj = pUnkDataObj;
    1545  
     1546
    15461547  ef->posFmt = 0;
    15471548  ef->countFmt = cfmt;
     
    15501551  ef->pFmt = (LPFORMATETC)IMalloc_Alloc(pIMalloc, size);
    15511552  IMalloc_Release(pIMalloc);
    1552  
     1553
    15531554  if (ef->pFmt)
    15541555    memcpy(ef->pFmt, afmt, size);
    1555  
     1556
    15561557  TRACE("(%p)->()\n",ef);
    15571558  return (LPENUMFORMATETC)ef;
     
    15751576   * we only need to support the IUnknown and IEnumFORMATETC interfaces
    15761577   */
    1577  
     1578
    15781579  *ppvObj = NULL;
    1579  
     1580
    15801581  if(IsEqualIID(riid, &IID_IUnknown))
    15811582  {
     
    15851586  {
    15861587    *ppvObj = (IDataObject*)This;
    1587   }   
    1588  
     1588  }
     1589
    15891590  if(*ppvObj)
    15901591  {
     
    15931594    return S_OK;
    15941595  }
    1595  
     1596
    15961597  TRACE("-- Interface: E_NOINTERFACE\n");
    15971598  return E_NOINTERFACE;
     
    16141615  if (This->pUnkDataObj)
    16151616    IUnknown_AddRef(This->pUnkDataObj);
    1616  
     1617
    16171618  return ++(This->ref);
    16181619}
     
    16321633  if (This->pUnkDataObj)
    16331634    IUnknown_Release(This->pUnkDataObj);  /* Release parent data object */
    1634  
    1635   if (!--(This->ref)) 
     1635
     1636  if (!--(This->ref))
    16361637  {
    16371638    TRACE("() - destroying IEnumFORMATETC(%p)\n",This);
     
    16411642      IMalloc_Release(pIMalloc);
    16421643    }
    1643      
     1644
    16441645    HeapFree(GetProcessHeap(),0,This);
    16451646    return 0;
     
    16601661  UINT cfetch;
    16611662  HRESULT hres = S_FALSE;
    1662  
     1663
    16631664  TRACE("(%p)->(pos=%u)\n", This, This->posFmt);
    1664  
     1665
    16651666  if (This->posFmt < This->countFmt)
    16661667  {
     
    16711672      hres = S_OK;
    16721673    }
    1673    
     1674
    16741675    memcpy(rgelt, &This->pFmt[This->posFmt], cfetch * sizeof(FORMATETC));
    16751676    This->posFmt += cfetch;
     
    16791680    cfetch = 0;
    16801681  }
    1681  
     1682
    16821683  if (pceltFethed)
    16831684  {
    16841685    *pceltFethed = cfetch;
    16851686  }
    1686  
     1687
    16871688  return hres;
    16881689}
     
    16971698  ICOM_THIS(IEnumFORMATETCImpl,iface);
    16981699  TRACE("(%p)->(num=%lu)\n", This, celt);
    1699  
     1700
    17001701  This->posFmt += celt;
    17011702  if (This->posFmt > This->countFmt)
     
    17161717  ICOM_THIS(IEnumFORMATETCImpl,iface);
    17171718  TRACE("(%p)->()\n", This);
    1718  
     1719
    17191720  This->posFmt = 0;
    17201721  return S_OK;
     
    17311732  ICOM_THIS(IEnumFORMATETCImpl,iface);
    17321733  HRESULT hr = S_OK;
    1733  
     1734
    17341735  TRACE("(%p)->(ppenum=%p)\n", This, ppenum);
    17351736
     
    17431744  if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenum)))
    17441745    return ( hr );
    1745  
     1746
    17461747  return (*ppenum) ? S_OK : E_OUTOFMEMORY;
    17471748}
Note: See TracChangeset for help on using the changeset viewer.