Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
nsDataObjCollection Class Reference

#include <nsDataObjCollection.h>

Inheritance diagram for nsDataObjCollection:
Inheritance graph
[legend]
Collaboration diagram for nsDataObjCollection:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsDataObjCollection ()
 ~nsDataObjCollection ()
 STDMETHODIMP_ (ULONG) AddRef()
STDMETHODIMP QueryInterface (REFIID, void **)
 STDMETHODIMP_ (ULONG) Release()
virtual HRESULT AddSetFormat (FORMATETC &FE)
virtual HRESULT AddGetFormat (FORMATETC &FE)
virtual HRESULT GetBitmap (FORMATETC &FE, STGMEDIUM &STM)
virtual HRESULT GetDib (FORMATETC &FE, STGMEDIUM &STM)
virtual HRESULT GetMetafilePict (FORMATETC &FE, STGMEDIUM &STM)
virtual HRESULT SetBitmap (FORMATETC &FE, STGMEDIUM &STM)
virtual HRESULT SetDib (FORMATETC &FE, STGMEDIUM &STM)
virtual HRESULT SetMetafilePict (FORMATETC &FE, STGMEDIUM &STM)
void AddDataFlavor (nsString *aDataFlavor, LPFORMATETC aFE)
void SetTransferable (nsITransferable *aTransferable)
void AddDataObject (IDataObject *aDataObj)
PRInt32 GetNumDataObjects ()
IDataObject * GetDataObjectAt (PRUint32 aItem)
CLSID GetClassID () const
STDMETHODIMP GetData (LPFORMATETC pFE, LPSTGMEDIUM pSTM)
STDMETHODIMP GetDataHere (LPFORMATETC pFE, LPSTGMEDIUM pSTM)
STDMETHODIMP QueryGetData (LPFORMATETC pFE)
STDMETHODIMP GetCanonicalFormatEtc (LPFORMATETC pFE, LPFORMATETC pCanonFE)
STDMETHODIMP SetData (LPFORMATETC pFE, LPSTGMEDIUM pSTM, BOOL release)
STDMETHODIMP EnumFormatEtc (DWORD direction, LPENUMFORMATETC *ppEnum)
STDMETHODIMP DAdvise (LPFORMATETC pFE, DWORD flags, LPADVISESINK pAdvise, DWORD *pConn)
STDMETHODIMP DUnadvise (DWORD pConn)
STDMETHODIMP EnumDAdvise (LPENUMSTATDATA *ppEnum)
ULONG GetRefCount () const
virtual long QueryInterface ()=0
virtual long AddRef ()=0
virtual long Release ()=0

Static Public Member Functions

static ULONG GetCumRefCount ()

Protected Member Functions

BOOL FormatsMatch (const FORMATETC &source, const FORMATETC &target) const

Protected Attributes

nsString mStringData
ULONG m_cRef
nsVoidArraymDataFlavors
nsITransferablemTransferable
CEnumFormatEtc * m_enumFE
nsVoidArraymDataObjects

Static Protected Attributes

static ULONG g_cRef = 0

Detailed Description

Definition at line 91 of file nsDataObjCollection.h.


Constructor & Destructor Documentation

Definition at line 72 of file nsDataObjCollection.cpp.

{
       m_cRef         = 0;
  mTransferable   = nsnull;
  mDataFlavors    = new nsVoidArray();
  mDataObjects    = new nsVoidArray();

  m_enumFE = new CEnumFormatEtc(32);
  m_enumFE->AddRef();

}

Here is the call graph for this function:

Definition at line 87 of file nsDataObjCollection.cpp.

{
  NS_IF_RELEASE(mTransferable);
  PRInt32 i;
  for (i=0;i<mDataFlavors->Count();i++) {
    nsString * df = (nsString *)mDataFlavors->ElementAt(i);
    delete df;
  }
  delete mDataFlavors;
 
  for (i=0;i<mDataObjects->Count();i++) {
    IDataObject * dataObj = (IDataObject *)mDataObjects->ElementAt(i);
    NS_RELEASE(dataObj);
  }
  delete mDataObjects;

       m_cRef = 0;
  m_enumFE->Release();

}

Member Function Documentation

void nsDataObjCollection::AddDataFlavor ( nsString aDataFlavor,
LPFORMATETC  aFE 
)

Definition at line 369 of file nsDataObjCollection.cpp.

{
  // These two lists are the mapping to and from data flavors and FEs
  // Later, OLE will tell us it's needs a certain type of FORMATETC (text, unicode, etc)
  // so we will look up data flavor that corresponds to the FE
  // and then ask the transferable for that type of data
  mDataFlavors->AppendElement(new nsString(*aDataFlavor));
  m_enumFE->AddFE(aFE);

}

Here is the call graph for this function:

void nsDataObjCollection::AddDataObject ( IDataObject *  aDataObj)

Definition at line 383 of file nsDataObjCollection.cpp.

{
  NS_ADDREF(aDataObj);
  mDataObjects->AppendElement(aDataObj);

}

Here is the call graph for this function:

HRESULT nsDataObjCollection::AddGetFormat ( FORMATETC &  FE) [virtual]

Definition at line 315 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::AddGetFormat\n");
       return ResultFromScode(S_OK);
}
virtual long IUnknown::AddRef ( ) [pure virtual, inherited]

Here is the caller graph for this function:

HRESULT nsDataObjCollection::AddSetFormat ( FORMATETC &  FE) [virtual]

Definition at line 308 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::AddSetFormat\n");
       return ResultFromScode(S_OK);
}
STDMETHODIMP nsDataObjCollection::DAdvise ( LPFORMATETC  pFE,
DWORD  flags,
LPADVISESINK  pAdvise,
DWORD pConn 
)

Definition at line 269 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::DAdvise\n");
       return ResultFromScode(E_FAIL);
}
STDMETHODIMP nsDataObjCollection::DUnadvise ( DWORD  pConn)

Definition at line 278 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::DUnadvise\n");
       return ResultFromScode(E_FAIL);
}
STDMETHODIMP nsDataObjCollection::EnumDAdvise ( LPENUMSTATDATA *  ppEnum)

Definition at line 285 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::EnumDAdvise\n");
       return ResultFromScode(E_FAIL);
}
STDMETHODIMP nsDataObjCollection::EnumFormatEtc ( DWORD  direction,
LPENUMFORMATETC *  ppEnum 
)

Definition at line 240 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::EnumFormatEtc\n");

  switch (dwDir) {
    case DATADIR_GET: {
       m_enumFE->Clone(ppEnum);
    } break;
    case DATADIR_SET:
        *ppEnum=NULL;
        break;
    default:
        *ppEnum=NULL;
        break;
  } // switch

  // Since a new one has been created, 
  // we will ref count the new clone here 
  // before giving it back
  if (NULL == *ppEnum)
    return ResultFromScode(E_FAIL);
  else
    (*ppEnum)->AddRef();

  return NOERROR;

}
BOOL nsDataObjCollection::FormatsMatch ( const FORMATETC &  source,
const FORMATETC &  target 
) const [protected]

Definition at line 156 of file nsDataObjCollection.cpp.

{
       if ((source.cfFormat == target.cfFormat) &&
               (source.dwAspect  & target.dwAspect)  &&
               (source.tymed     & target.tymed))       {
              return TRUE;
       } else {
              return FALSE;
       }
}
HRESULT nsDataObjCollection::GetBitmap ( FORMATETC &  FE,
STGMEDIUM &  STM 
) [virtual]

Definition at line 322 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::GetBitmap\n");
       return ResultFromScode(E_NOTIMPL);
}
STDMETHODIMP nsDataObjCollection::GetCanonicalFormatEtc ( LPFORMATETC  pFE,
LPFORMATETC  pCanonFE 
)

Definition at line 223 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::GetCanonicalFormatEtc\n");
              return ResultFromScode(E_FAIL);
}

Definition at line 361 of file nsDataObjCollection.cpp.

Definition at line 294 of file nsDataObjCollection.cpp.

{
       return g_cRef;
}
STDMETHODIMP nsDataObjCollection::GetData ( LPFORMATETC  pFE,
LPSTGMEDIUM  pSTM 
)

Definition at line 170 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::GetData\n");
  PRNTDEBUG3("  format: %d  Text: %d\n", pFE->cfFormat, CF_TEXT);

  for (PRInt32 i=0;i<mDataObjects->Count();i++) {
    IDataObject * dataObj = (IDataObject *)mDataObjects->ElementAt(i);
    if (S_OK == dataObj->GetData(pFE, pSTM)) {
      return S_OK;
    }
  }

       return ResultFromScode(DATA_E_FORMATETC);
}
STDMETHODIMP nsDataObjCollection::GetDataHere ( LPFORMATETC  pFE,
LPSTGMEDIUM  pSTM 
)

Definition at line 187 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::GetDataHere\n");
              return ResultFromScode(E_FAIL);
}
IDataObject* nsDataObjCollection::GetDataObjectAt ( PRUint32  aItem) [inline]

Definition at line 128 of file nsDataObjCollection.h.

{ return (IDataObject *)mDataObjects->SafeElementAt(aItem); }
HRESULT nsDataObjCollection::GetDib ( FORMATETC &  FE,
STGMEDIUM &  STM 
) [virtual]

Definition at line 329 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::GetDib\n");
       return ResultFromScode(E_NOTIMPL);
}
HRESULT nsDataObjCollection::GetMetafilePict ( FORMATETC &  FE,
STGMEDIUM &  STM 
) [virtual]

Definition at line 336 of file nsDataObjCollection.cpp.

{
       return ResultFromScode(E_NOTIMPL);
}

Definition at line 127 of file nsDataObjCollection.h.

{ return mDataObjects->Count(); }

Definition at line 300 of file nsDataObjCollection.cpp.

{
       return m_cRef;
}
STDMETHODIMP nsDataObjCollection::QueryGetData ( LPFORMATETC  pFE)

Definition at line 198 of file nsDataObjCollection.cpp.

{
  UINT format = nsClipboard::GetFormat(MULTI_MIME);
  PRNTDEBUG("nsDataObjCollection::QueryGetData  ");

  PRNTDEBUG3("format: %d  Mulitple: %d\n", pFE->cfFormat, format);

  if (format == pFE->cfFormat) {
    return S_OK;
  }


  for (PRInt32 i=0;i<mDataObjects->Count();i++) {
    IDataObject * dataObj = (IDataObject *)mDataObjects->ElementAt(i);
    if (S_OK == dataObj->QueryGetData(pFE)) {
      return S_OK;
    }
  }

  PRNTDEBUG2("***** nsDataObjCollection::QueryGetData - Unknown format %d\n", pFE->cfFormat);
       return ResultFromScode(E_FAIL);
}
virtual long IUnknown::QueryInterface ( ) [pure virtual, inherited]

Here is the caller graph for this function:

STDMETHODIMP nsDataObjCollection::QueryInterface ( REFIID  riid,
void **  ppv 
)

Definition at line 112 of file nsDataObjCollection.cpp.

{
       *ppv=NULL;

       if ( (IID_IUnknown == riid) || (IID_IDataObject  == riid) ) {
              *ppv = static_cast<IDataObject*>(this); 
              AddRef();
              return NOERROR;
       }

       if ( IID_IDataObjCollection == riid ) {
              *ppv = static_cast<nsIDataObjCollection*>(this); 
              AddRef();
              return NOERROR;
       }

       return ResultFromScode(E_NOINTERFACE);
}

Here is the call graph for this function:

virtual long IUnknown::Release ( ) [pure virtual, inherited]

Here is the caller graph for this function:

HRESULT nsDataObjCollection::SetBitmap ( FORMATETC &  FE,
STGMEDIUM &  STM 
) [virtual]

Definition at line 342 of file nsDataObjCollection.cpp.

{
       return ResultFromScode(E_NOTIMPL);
}
STDMETHODIMP nsDataObjCollection::SetData ( LPFORMATETC  pFE,
LPSTGMEDIUM  pSTM,
BOOL  release 
)

Definition at line 231 of file nsDataObjCollection.cpp.

{
  PRNTDEBUG("nsDataObjCollection::SetData\n");

  return ResultFromScode(E_FAIL);
}
HRESULT nsDataObjCollection::SetDib ( FORMATETC &  FE,
STGMEDIUM &  STM 
) [virtual]

Definition at line 348 of file nsDataObjCollection.cpp.

{
       return ResultFromScode(E_FAIL);
}
HRESULT nsDataObjCollection::SetMetafilePict ( FORMATETC &  FE,
STGMEDIUM &  STM 
) [virtual]

Definition at line 354 of file nsDataObjCollection.cpp.

{
       return ResultFromScode(E_FAIL);
}

Member Data Documentation

ULONG nsDataObjCollection::g_cRef = 0 [static, protected]

Definition at line 200 of file nsDataObjCollection.h.

Definition at line 201 of file nsDataObjCollection.h.

CEnumFormatEtc* nsDataObjCollection::m_enumFE [protected]

Definition at line 208 of file nsDataObjCollection.h.

Definition at line 203 of file nsDataObjCollection.h.

Definition at line 211 of file nsDataObjCollection.h.

Definition at line 196 of file nsDataObjCollection.h.

Definition at line 205 of file nsDataObjCollection.h.


The documentation for this class was generated from the following files: