Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions | Variables
clipboard.cpp File Reference
#include "mozce_internal.h"

Go to the source code of this file.

Classes

class  ClipDataObj

Functions

void oleSetup ()
MOZCE_SHUNT_API HRESULT mozce_OleSetClipboard (IDataObject *pDataObj)
MOZCE_SHUNT_API HRESULT mozce_OleGetClipboard (IDataObject **pDataObj)
MOZCE_SHUNT_API HRESULT mozce_OleFlushClipboard ()
MOZCE_SHUNT_API BOOL mozce_IsClipboardFormatAvailable (UINT format)

Variables

static IDataObject * gDataObject = NULL
static HWND gClipboardWND = NULL

Function Documentation

Definition at line 276 of file clipboard.cpp.

{
  if (gClipboardWND)
  {
    BOOL b = OpenClipboard(gClipboardWND);
    if (!b)
      return E_FAIL;
    
    IEnumFORMATETC* enumerator = NULL;
    gDataObject->EnumFormatEtc(DATADIR_GET, &enumerator);
    if (!enumerator)
      return S_OK;
    
    FORMATETC etc;
    
    while (S_OK == enumerator->Next(1, &etc, NULL))
    {
      if ( etc.cfFormat == format)
      {
        enumerator->Release();
        CloseClipboard();
        return true;
      }
    }
    enumerator->Release();
    CloseClipboard();
  }
  
  return IsClipboardFormatAvailable(format);
}

Definition at line 266 of file clipboard.cpp.

Here is the call graph for this function:

MOZCE_SHUNT_API HRESULT mozce_OleGetClipboard ( IDataObject **  pDataObj)

Definition at line 245 of file clipboard.cpp.

{
  MOZCE_PRECHECK
    oleSetup();
  
  if (pDataObj)
    *pDataObj = gDataObject;
  
  if (!*pDataObj)
  {
    *pDataObj = new ClipDataObj();
    if (!*pDataObj)
      return E_FAIL;

    gDataObject = *pDataObj;
  }
  
  (*pDataObj)->AddRef();
  return S_OK;
}

Here is the call graph for this function:

MOZCE_SHUNT_API HRESULT mozce_OleSetClipboard ( IDataObject *  pDataObj)

Definition at line 197 of file clipboard.cpp.

{
  MOZCE_PRECHECK
    
       oleSetup();
  
  if (gDataObject)
    gDataObject->Release();
  
  gDataObject = pDataObj;
  
  if (pDataObj) 
  {
    BOOL b = OpenClipboard(gClipboardWND);
    
    if (!b)
      return E_FAIL;
    
    EmptyClipboard();
    
    pDataObj->AddRef();
    
    IEnumFORMATETC* enumerator = NULL;
    pDataObj->EnumFormatEtc(DATADIR_GET, &enumerator);
    if (!enumerator)
      return S_OK;
    
    FORMATETC etc;
    
    while (S_OK == enumerator->Next(1, &etc, NULL))
    {
      if ( etc.tymed == TYMED_HGLOBAL )
      {

              STGMEDIUM medium;
              pDataObj->GetData(&etc, &medium);
        SetClipboardData( etc.cfFormat, medium.hGlobal);
      }
    }
    
    enumerator->Release();
    
    CloseClipboard();
    
  }
  return S_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 47 of file clipboard.cpp.

{
  if (gClipboardWND)
    return;
  
  WNDCLASS wndclass;
  ZeroMemory( &wndclass, sizeof(WNDCLASS));
  
  
  wndclass.style          = CS_GLOBALCLASS;
  wndclass.lpfnWndProc    = DefWindowProc;
  wndclass.lpszClassName  = L"OLE_CLIPBOARD";
  
  RegisterClass(&wndclass);
  
  gClipboardWND = CreateWindow(L"OLE_Clipboard",
                         0,
                         0,
                         CW_USEDEFAULT, CW_USEDEFAULT,
                         CW_USEDEFAULT, CW_USEDEFAULT,
                         0,
                         0,
                         0,
                         0);
}

Here is the caller graph for this function:


Variable Documentation

HWND gClipboardWND = NULL [static]

Definition at line 45 of file clipboard.cpp.

IDataObject* gDataObject = NULL [static]

Definition at line 44 of file clipboard.cpp.