This commit is contained in:
rods%netscape.com 1999-03-23 15:37:34 +00:00
Родитель 873bbc2aea
Коммит 6bd731402f
18 изменённых файлов: 2647 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,290 @@
/*
* IENUMFE.CPP
*
* Standard implementation of a FORMATETC enumerator with the
* IEnumFORMATETC interface that will generally not need
* modification.
*
* Copyright (c)1993-1994 Microsoft Corporation, All Rights Reserved
*
* Kraig Brockschmidt, Software Design Engineer
* Microsoft Systems Developer Relations
*
* Internet : kraigb@microsoft.com
* Compuserve: >INTERNET:kraigb@microsoft.com
*/
#include "ienumfe.h"
/*
* CEnumFormatEtc::CEnumFormatEtc
* CEnumFormatEtc::~CEnumFormatEtc
*
* Parameters (Constructor):
* pUnkRef LPUNKNOWN to use for reference counting.
* cFE ULONG number of FORMATETCs in pFE
* prgFE LPFORMATETC to the array to enumerate.
*/
CEnumFormatEtc::CEnumFormatEtc(LPUNKNOWN pUnkRef, ULONG cFE, LPFORMATETC prgFE)
{
UINT i;
m_cRef=0;
m_pUnkRef=pUnkRef;
m_iCur = 0;
m_cfe = cFE;
m_maxcfe = cFE;
m_prgfe=new FORMATETC[(UINT)cFE];
if (NULL!=m_prgfe) {
for (i=0; i < cFE; i++)
m_prgfe[i]=prgFE[i];
}
return;
}
/*
* CEnumFormatEtc::CEnumFormatEtc
* CEnumFormatEtc::~CEnumFormatEtc
*
* Parameters (Constructor):
* pUnkRef LPUNKNOWN to use for reference counting.
* cFE ULONG number of FORMATETCs in pFE
*/
CEnumFormatEtc::CEnumFormatEtc(LPUNKNOWN pUnkRef, ULONG cMaxFE)
{
//UINT i;
m_cRef=0;
m_pUnkRef=pUnkRef;
m_iCur = 0;
m_cfe = 0;
m_maxcfe = cMaxFE;
m_prgfe=new FORMATETC[(UINT)cMaxFE];
}
CEnumFormatEtc::~CEnumFormatEtc(void)
{
if (NULL!=m_prgfe)
delete [] m_prgfe;
}
void CEnumFormatEtc::AddFE(LPFORMATETC aFE)
{
m_prgfe[m_cfe++] = *aFE;
}
/*
* CEnumFormatEtc::QueryInterface
* CEnumFormatEtc::AddRef
* CEnumFormatEtc::Release
*
* Purpose:
* IUnknown members for CEnumFormatEtc object. For QueryInterface
* we only return out own interfaces and not those of the data
* object. However, since enumerating formats only makes sense
* when the data object is around, we insure that it stays as
* long as we stay by calling an outer IUnknown for AddRef
* and Release. But since we are not controlled by the lifetime
* of the outer object, we still keep our own reference count in
* order to free ourselves.
*/
STDMETHODIMP CEnumFormatEtc::QueryInterface(REFIID riid, LPVOID *ppv)
{
*ppv=NULL;
/*
* Enumerators are separate objects, not the data object, so
* we only need to support out IUnknown and IEnumFORMATETC
* interfaces here with no concern for aggregation.
*/
if (IsEqualIID(riid, IID_IUnknown)
|| IsEqualIID(riid, IID_IEnumFORMATETC))
*ppv=(LPVOID)this;
//AddRef any interface we'll return.
if (NULL!=*ppv)
{
((LPUNKNOWN)*ppv)->AddRef();
return NOERROR;
}
return ResultFromScode(E_NOINTERFACE);
}
STDMETHODIMP_(ULONG) CEnumFormatEtc::AddRef(void)
{
++m_cRef;
m_pUnkRef->AddRef();
return m_cRef;
}
STDMETHODIMP_(ULONG) CEnumFormatEtc::Release(void)
{
ULONG cRefT;
cRefT=--m_cRef;
m_pUnkRef->Release();
if (0L==m_cRef)
delete this;
return cRefT;
}
/*
* CEnumFormatEtc::Next
*
* Purpose:
* Returns the next element in the enumeration.
*
* Parameters:
* cFE ULONG number of FORMATETCs to return.
* pFE LPFORMATETC in which to store the returned
* structures.
* pulFE ULONG * in which to return how many we
* enumerated.
*
* Return Value:
* HRESULT NOERROR if successful, S_FALSE otherwise,
*/
STDMETHODIMP CEnumFormatEtc::Next(ULONG cFE, LPFORMATETC pFE, ULONG * pulFE)
{
ULONG cReturn=0L;
if (NULL==m_prgfe)
return ResultFromScode(S_FALSE);
if (NULL==pulFE)
{
if (1L!=cFE)
return ResultFromScode(E_POINTER);
}
else
*pulFE=0L;
if (NULL==pFE || m_iCur >= m_cfe)
return ResultFromScode(S_FALSE);
while (m_iCur < m_cfe && cFE > 0)
{
*pFE++=m_prgfe[m_iCur++];
cReturn++;
cFE--;
}
if (NULL!=pulFE)
*pulFE=cReturn;
return NOERROR;
}
/*
* CEnumFormatEtc::Skip
*
* Purpose:
* Skips the next n elements in the enumeration.
*
* Parameters:
* cSkip ULONG number of elements to skip.
*
* Return Value:
* HRESULT NOERROR if successful, S_FALSE if we could not
* skip the requested number.
*/
STDMETHODIMP CEnumFormatEtc::Skip(ULONG cSkip)
{
if (((m_iCur+cSkip) >= m_cfe) || NULL==m_prgfe)
return ResultFromScode(S_FALSE);
m_iCur+=cSkip;
return NOERROR;
}
/*
* CEnumFormatEtc::Reset
*
* Purpose:
* Resets the current element index in the enumeration to zero.
*
* Parameters:
* None
*
* Return Value:
* HRESULT NOERROR
*/
STDMETHODIMP CEnumFormatEtc::Reset(void)
{
m_iCur=0;
return NOERROR;
}
/*
* CEnumFormatEtc::Clone
*
* Purpose:
* Returns another IEnumFORMATETC with the same state as ourselves.
*
* Parameters:
* ppEnum LPENUMFORMATETC * in which to return the
* new object.
*
* Return Value:
* HRESULT NOERROR or a general error value.
*/
STDMETHODIMP CEnumFormatEtc::Clone(LPENUMFORMATETC *ppEnum)
{
LPCEnumFormatEtc pNew;
*ppEnum=NULL;
//Create the clone
pNew=new CEnumFormatEtc(m_pUnkRef, m_cfe, m_prgfe);
if (NULL==pNew)
return ResultFromScode(E_OUTOFMEMORY);
pNew->AddRef();
pNew->m_iCur=m_iCur;
*ppEnum=pNew;
return NOERROR;
}

Просмотреть файл

@ -0,0 +1,64 @@
/*
* IENUMFE.H
*
* Definitions of a template IDataObject interface implementation.
*
* Copyright (c)1993-1994 Microsoft Corporation, All Right Reserved
*
* Kraig Brockschmidt, Software Design Engineer
* Microsoft Systems Developer Relations
*
* Internet : kraigb@microsoft.com
* Compuserve: >INTERNET:kraigb@microsoft.com
*/
#ifndef _IENUMFE_H_
#define _IENUMFE_H_
#include "OLE2.h"
#include "URLMON.h"
/*
* IEnumFORMATETC object that is created from
* IDataObject::EnumFormatEtc. This object lives on its own,
* that is, QueryInterface only knows IUnknown and IEnumFormatEtc,
* nothing more. We still use an outer unknown for reference
* counting, because as long as this enumerator lives, the data
* object should live, thereby keeping the application up.
*/
class CEnumFormatEtc;
typedef class CEnumFormatEtc *LPCEnumFormatEtc;
class CEnumFormatEtc : public IEnumFORMATETC
{
private:
ULONG m_cRef; //Object reference count
LPUNKNOWN m_pUnkRef; //IUnknown for ref counting
ULONG m_iCur; //Current element
ULONG m_cfe; //Number of FORMATETCs in us
LPFORMATETC m_prgfe; //Source of FORMATETCs
ULONG m_maxcfe; // Max number of us
public:
CEnumFormatEtc(LPUNKNOWN, ULONG, LPFORMATETC);
CEnumFormatEtc(LPUNKNOWN, ULONG aMaxSize);
~CEnumFormatEtc(void);
//IUnknown members that delegate to m_pUnkOuter.
STDMETHODIMP QueryInterface(REFIID, LPVOID*);
STDMETHODIMP_(ULONG) AddRef(void);
STDMETHODIMP_(ULONG) Release(void);
//IEnumFORMATETC members
STDMETHODIMP Next(ULONG, LPFORMATETC, ULONG *);
STDMETHODIMP Skip(ULONG);
STDMETHODIMP Reset(void);
STDMETHODIMP Clone(IEnumFORMATETC **);
// Extra Methods
void AddFE(LPFORMATETC);
};
#endif //_IENUMFE_H_

Просмотреть файл

@ -0,0 +1,304 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsClipboard.h"
#include <windows.h>
#include <OLE2.h>
#include "nsDataObj.h"
#include "nsISupportsArray.h"
#include "nsIClipboardOwner.h"
#include "nsIDataFlavor.h"
#include "DDCOMM.h"
// interface definitions
static NS_DEFINE_IID(kIDataFlavorIID, NS_IDATAFLAVOR_IID);
NS_IMPL_ADDREF(nsClipboard)
NS_IMPL_RELEASE(nsClipboard)
//-------------------------------------------------------------------------
//
// nsClipboard constructor
//
//-------------------------------------------------------------------------
nsClipboard::nsClipboard()
{
NS_INIT_REFCNT();
mTransferable = nsnull;
mDataObj = nsnull;
}
//-------------------------------------------------------------------------
//
// nsClipboard destructor
//
//-------------------------------------------------------------------------
nsClipboard::~nsClipboard()
{
if (nsnull != mDataObj) {
mDataObj->Release();
}
}
/**
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsClipboard::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
nsresult rv = NS_NOINTERFACE;
static NS_DEFINE_IID(kIClipboard, NS_ICLIPBOARD_IID);
if (aIID.Equals(kIClipboard)) {
*aInstancePtr = (void*) ((nsIClipboard*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return rv;
}
/**
* Sets the transferable object
*
*/
NS_IMETHODIMP nsClipboard::SetTransferable(nsITransferable * aTransferable, nsIClipboardOwner * anOwner)
{
if (nsnull != mClipboardOwner) {
mClipboardOwner->LosingOwnership(mTransferable);
NS_RELEASE(mClipboardOwner);
}
mClipboardOwner = anOwner;
if (nsnull != anOwner) {
NS_ADDREF(mClipboardOwner);
}
if (nsnull != mTransferable) {
NS_RELEASE(mTransferable);
}
mTransferable = aTransferable;
if (nsnull == mTransferable) {
return NS_OK;
}
NS_ADDREF(mTransferable);
return NS_OK;
}
/**
*
*
*/
NS_IMETHODIMP nsClipboard::SetClipboard()
{
// make sure we have a good transferable
if (nsnull == mTransferable) {
return NS_ERROR_FAILURE;
}
// Clear the native clipboard
::OleFlushClipboard();
// Get the transferable list of data flavors
nsISupportsArray * dfList;
mTransferable->GetTransferDataFlavors(&dfList);
// Release the existing DataObject
if (mDataObj) {
mDataObj->Release();
}
// Create our native DataObject that implements
// the OLE IDataObject interface
mDataObj = new nsDataObj();
mDataObj->AddRef();
// Now give the Transferable to the DataObject
// for getting the data out of it
mDataObj->SetTransferable(mTransferable);
// Walk through flavors and register them on the native clipboard,
PRUint32 i;
for (i=0;i<dfList->Count();i++) {
nsIDataFlavor * df;
nsISupports * supports = dfList->ElementAt(i);
if (NS_OK == supports->QueryInterface(kIDataFlavorIID, (void **)&df)) {
nsString mime;
df->GetMimeType(mime);
UINT format;
if (mime.Equals(kTextMime)) {
format = CF_TEXT;
} else if (mime.Equals(kUnicodeMime)) {
format = CF_UNICODETEXT;
} else if (mime.Equals(kImageMime)) {
format = CF_BITMAP;
} else {
char * str = mime.ToNewCString();
format = ::RegisterClipboardFormat(str);
delete[] str;
}
FORMATETC fe;
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, 0, TYMED_HGLOBAL);
// Now tell the native IDataObject about both the DataFlavor and
// the native data format
mDataObj->AddDataFlavor(df, &fe);
NS_RELEASE(df);
}
NS_RELEASE(supports);
}
// cast our native DataObject to its IDataObject pointer
// and put it on the clipboard
IDataObject * ido = (IDataObject *)mDataObj;
::OleSetClipboard(ido);
return NS_OK;
}
/**
*
*
*/
static nsresult GetNativeDataOffClipboard(UINT aFormat, void ** aData, PRUint32 * aLen)
{
HGLOBAL hglb;
LPSTR lpStr;
nsresult result = NS_ERROR_FAILURE;
DWORD dataSize;
if (::OpenClipboard(NULL)) { // Just Grab TEXT for now, later we will grab HTML, XIF, etc.
hglb = ::GetClipboardData(aFormat);
if (hglb != NULL) {
lpStr = (LPSTR)::GlobalLock(hglb);
dataSize = ::GlobalSize(hglb);
*aLen = dataSize;
char * data = new char[dataSize];
char* ptr = data;
LPSTR pMem = lpStr;
PRUint32 inx;
for (inx=0; inx < dataSize; inx++) {
*ptr++ = *pMem++;
}
::GlobalUnlock(hglb);
*aData = data;
result = NS_OK;
}
::CloseClipboard();
}
return NS_OK;
}
/**
*
*
*/
NS_IMETHODIMP nsClipboard::GetClipboard()
{
// make sure we have a good transferable
if (nsnull == mTransferable) {
return NS_ERROR_FAILURE;
}
// Get the transferable list of data flavors
nsISupportsArray * dfList;
mTransferable->GetTransferDataFlavors(&dfList);
// Walk through flavors and see which flavor is on the clipboard them on the native clipboard,
PRUint32 i;
for (i=0;i<dfList->Count();i++) {
nsIDataFlavor * df;
nsISupports * supports = dfList->ElementAt(i);
if (NS_OK == supports->QueryInterface(kIDataFlavorIID, (void **)&df)) {
nsString mime;
df->GetMimeType(mime);
UINT format;
void * data;
PRUint32 dataLen;
if (mime.Equals(kTextMime)) {
format = CF_TEXT;
} else if (mime.Equals(kUnicodeMime)) {
format = CF_UNICODETEXT;
} else if (mime.Equals(kImageMime)) {
format = CF_BITMAP;
} else {
char * str = mime.ToNewCString();
format = ::RegisterClipboardFormat(str);
delete[] str;
}
if (NS_OK == GetNativeDataOffClipboard(format, &data, &dataLen)) {
mTransferable->SetTransferData(df, data, dataLen);
//NS_RELEASE(df);
//NS_RELEASE(supports);
//return NS_OK;
}
NS_RELEASE(df);
}
NS_RELEASE(supports);
}
return NS_OK;
}
/**
* This enumarates the native clipboard checking to see if the data flavor is on it
*
*/
NS_IMETHODIMP nsClipboard::IsDataFlavorSupported(nsIDataFlavor * aDataFlavor)
{
return NS_ERROR_FAILURE;
}
// make the IDataObject
/*IDataObject * dataObj = NULL;
IClassFactory * pCF = NULL;
HRESULT hr = ::CoGetClassObject(CLSID_CfDataObj, CLSCTX_INPROC_SERVER, NULL, IID_IClassFactory, (void **)&pCF);
if (REGDB_E_CLASSNOTREG == hr) {
return hr;
}
//hresult = pCF->CreateInstance(pUnkOuter, riid, ppvObj)
pCF->Release();
HRESULT ret = ::CoCreateInstance(CLSID_CfDataObj, NULL, CLSCTX_INPROC_SERVER, IID_IDataObject, (void **)&dataObj);
if (REGDB_E_CLASSNOTREG == ret) {
//return ret;
}
if (FAILED(ret)) {
//return ret;
}*/

Просмотреть файл

@ -0,0 +1,61 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsClipboard_h__
#define nsClipboard_h__
#include "nsIClipboard.h"
#include "nsITransferable.h"
class nsITransferable;
class nsDataObj;
class nsIClipboardOwner;
/**
* Native Win32 Clipboard wrapper
*/
class nsClipboard : public nsIClipboard
{
public:
nsClipboard();
virtual ~nsClipboard();
//nsISupports
NS_DECL_ISUPPORTS
// nsIClipboard
NS_IMETHOD SetTransferable(nsITransferable * aTransferable, nsIClipboardOwner * anOwner);
NS_IMETHOD GetClipboard();
NS_IMETHOD SetClipboard();
NS_IMETHOD IsDataFlavorSupported(nsIDataFlavor * aDataFlavor);
protected:
nsIClipboardOwner * mClipboardOwner;
nsITransferable * mTransferable;
nsDataObj * mDataObj;
};
#endif // nsClipboard_h__

Просмотреть файл

@ -0,0 +1,125 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsDataFlavor.h"
//#include <windows.h>
static NS_DEFINE_IID(kIDataFlavor, NS_IDATAFLAVOR_IID);
NS_IMPL_ADDREF(nsDataFlavor)
NS_IMPL_RELEASE(nsDataFlavor)
//-------------------------------------------------------------------------
//
// DataFlavor constructor
//
//-------------------------------------------------------------------------
nsDataFlavor::nsDataFlavor()
{
NS_INIT_REFCNT();
}
//-------------------------------------------------------------------------
//
// DataFlavor destructor
//
//-------------------------------------------------------------------------
nsDataFlavor::~nsDataFlavor()
{
}
/**
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsDataFlavor::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
nsresult rv = NS_NOINTERFACE;
if (aIID.Equals(kIDataFlavor)) {
*aInstancePtr = (void*) ((nsIDataFlavor*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return rv;
}
/**
*
*
*/
NS_METHOD nsDataFlavor::Init(const nsString & aMimeType, const nsString & aHumanPresentableName)
{
mMimeType = aMimeType;
mHumanPresentableName = aHumanPresentableName;
char * str = mMimeType.ToNewCString();
mNativeClipboardFormat = ::RegisterClipboardFormat(str);
delete[] str;
return NS_OK;
}
/**
*
*
*/
NS_METHOD nsDataFlavor::GetMimeType(nsString & aMimeStr)
{
aMimeStr = mMimeType;
return NS_OK;
}
/**
*
*
*/
NS_METHOD nsDataFlavor::GetHumanPresentableName(nsString & aHumanPresentableName)
{
aHumanPresentableName = mHumanPresentableName;
return NS_OK;
}
/**
*
*
*/
NS_METHOD nsDataFlavor::GetNativeData(void ** aData)
{
return NS_OK;
}
/**
*
*
*/
NS_METHOD nsDataFlavor::SetNativeData(void * aData)
{
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,66 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsDataFlavor_h__
#define nsDataFlavor_h__
#include "nsIDataFlavor.h"
#include <OLE2.h>
#include "OLEIDL.H"
//#include <windows.h>
class nsISupportsArray;
class nsIDataFlavor;
/**
* Native Win32 DataFlavor wrapper
*/
class nsDataFlavor : public nsIDataFlavor
{
public:
nsDataFlavor();
virtual ~nsDataFlavor();
//nsISupports
NS_DECL_ISUPPORTS
//nsIDataFlavor
NS_IMETHOD Init(const nsString & aMimeType, const nsString & aHumanPresentableName);
NS_IMETHOD GetMimeType(nsString & aMimeStr);
NS_IMETHOD GetHumanPresentableName(nsString & aReadableStr);
NS_IMETHOD GetNativeData(void ** aData);
NS_IMETHOD SetNativeData(void * aData);
// Native Methods
UINT GetFormat() { return mNativeClipboardFormat; }
protected:
nsString mMimeType;
nsString mHumanPresentableName;
UINT mNativeClipboardFormat;
};
#endif // nsDataFlavor_h__

Просмотреть файл

@ -0,0 +1,496 @@
/*Copyright Notice ===============================================*
This file contains proprietary information of Digital Style
Corporation. Copying or reproducing without prior written
approval is prohibited.
Copyright (c) 1995
Digital Style Corporation
16885 Via Del Campo Court #202
San Diego, CA 92127
(619)-673-5050
*Copyright Notice ===============================================*/
#include "Ddcomm.h"
//#include "DragDrop.h"
#include "nsDataObj.h"
#include "nsString.h"
#include "nsISupportsArray.h"
#include "nsIDataFlavor.h"
#include "nsITransferable.h"
#include "IENUMFE.h"
// interface definitions
static NS_DEFINE_IID(kIDataFlavorIID, NS_IDATAFLAVOR_IID);
//#include "OLEIDL.h"
#include "OLE2.h"
#include "URLMON.h"
ULONG nsDataObjClassFactory::g_cLock = 0;
ULONG nsDataObj::g_cRef = 0;
EXTERN_C GUID CDECL CLSID_nsDataObj;// =
// { 0x1bba7640, 0xdf52, 0x11cf, { 0x82, 0x7b, 0, 0xa0, 0x24, 0x3a, 0xe5, 0x05 } };
/*
* class nsDataObjClassFactory
*/
nsDataObjClassFactory::nsDataObjClassFactory()
{
m_cRef = 0L;
return;
}
nsDataObjClassFactory::~nsDataObjClassFactory()
{
return;
}
// IUnknown Interface - see iunknown.h for documentation
STDMETHODIMP nsDataObjClassFactory::QueryInterface(REFIID riid, void** ppv)
{
*ppv = NULL;
if (IID_IUnknown == riid || IID_IClassFactory == riid)
*ppv = this;
if (NULL != *ppv) {
((LPUNKNOWN)*ppv)->AddRef();
return NOERROR;
}
return ResultFromScode(E_NOINTERFACE);
}
STDMETHODIMP_(ULONG) nsDataObjClassFactory::AddRef()
{
return ++m_cRef;
}
STDMETHODIMP_(ULONG) nsDataObjClassFactory::Release()
{
if (0L != --m_cRef)
return m_cRef;
delete this;
return 0L;
}
// IClassFactory methods
STDMETHODIMP nsDataObjClassFactory::CreateInstance
(LPUNKNOWN pUnkOuter, REFIID riid, void** ppvObj)
{
nsDataObj* pObj;
HRESULT hr;
*ppvObj=NULL;
hr=ResultFromScode(E_OUTOFMEMORY);
//Verify that a controlling unknown asks for IUnknown
if (NULL != pUnkOuter && IID_IUnknown != riid)
return ResultFromScode(E_NOINTERFACE);
//Create the object.
pObj = new nsDataObj();
if (NULL == pObj)
return hr;
hr = pObj->QueryInterface(riid, ppvObj);
//Kill the object if initial creation or Init failed.
if (FAILED(hr))
delete pObj;
return hr;
}
STDMETHODIMP nsDataObjClassFactory::LockServer(BOOL fLock)
{
if (fLock) {
++g_cLock;
} else if (0 < g_cLock) {
--g_cLock;
}
return NOERROR;
}
/*
* Class nsDataObj
*/
// construction, destruction
nsDataObj::nsDataObj()
{
m_cRef = 0;
mTransferable = nsnull;
nsresult result = NS_NewISupportsArray(&mDataFlavors);
m_enumFE = new CEnumFormatEtc(this, 32);
m_enumFE->AddRef();
}
nsDataObj::~nsDataObj()
{
m_cRef = 0;
m_enumFE->Release();
}
// IUnknown interface methods - see inknown.h for documentation
STDMETHODIMP nsDataObj::QueryInterface(REFIID riid, void** ppv)
{
*ppv=NULL;
if ( (IID_IUnknown == riid) || (IID_IDataObject == riid) ) {
*ppv = this;
AddRef();
return NOERROR;
}
return ResultFromScode(E_NOINTERFACE);
}
STDMETHODIMP_(ULONG) nsDataObj::AddRef()
{
++g_cRef;
return ++m_cRef;
}
STDMETHODIMP_(ULONG) nsDataObj::Release()
{
if (0 < g_cRef)
--g_cRef;
if (0 != --m_cRef)
return m_cRef;
delete this;
return 0;
}
BOOL nsDataObj::FormatsMatch(const FORMATETC& source, const FORMATETC& target) const
{
if ((source.cfFormat == target.cfFormat) &&
(source.dwAspect & target.dwAspect) &&
(source.tymed & target.tymed)) {
return TRUE;
} else {
return FALSE;
}
}
// IDataObject methods
STDMETHODIMP nsDataObj::GetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
{
if (nsnull == mTransferable) {
return ResultFromScode(DATA_E_FORMATETC);
}
PRUint32 dfInx = 0;
ULONG count;
FORMATETC fe;
m_enumFE->Reset();
while (NOERROR == m_enumFE->Next(1, &fe, &count)) {
nsIDataFlavor * df;
nsISupports * supports = mDataFlavors->ElementAt(dfInx);
if (NS_OK == supports->QueryInterface(kIDataFlavorIID, (void **)&df)) {
if (FormatsMatch(fe, *pFE)) {
pSTM->pUnkForRelease = NULL;
CLIPFORMAT format = pFE->cfFormat;
switch(format) {
case CF_TEXT:
return GetText(df, *pFE, *pSTM);
//case CF_BITMAP:
// return GetBitmap(*pFE, *pSTM);
//case CF_DIB:
// return GetDib(*pFE, *pSTM);
//case CF_METAFILEPICT:
// return GetMetafilePict(*pFE, *pSTM);
default:
break;
} //switch
} // if
NS_RELEASE(df);
}
NS_RELEASE(supports);
dfInx++;
} // while
return ResultFromScode(DATA_E_FORMATETC);
}
STDMETHODIMP nsDataObj::GetDataHere(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
{
//if (m_dragDrop) {
// return m_dragDrop->GetDataHere(pFE, pSTM);
//} else {
return ResultFromScode(E_FAIL);
//}
}
STDMETHODIMP nsDataObj::QueryGetData(LPFORMATETC pFE)
{
//if (m_dragDrop) {
// return m_dragDrop->QueryGetData(pFE);
//} else {
return ResultFromScode(E_FAIL);
//}
}
STDMETHODIMP nsDataObj::GetCanonicalFormatEtc
(LPFORMATETC pFEIn, LPFORMATETC pFEOut)
{
//if (m_dragDrop) {
// return m_dragDrop->GetCanonicalFormatEtc(pFEIn, pFEOut);
//} else {
return ResultFromScode(E_FAIL);
//}
}
STDMETHODIMP nsDataObj::SetData(LPFORMATETC pFE, LPSTGMEDIUM pSTM, BOOL fRelease)
{
return ResultFromScode(E_FAIL);
//return m_dragDrop->SetData(pFE, pSTM, fRelease);
}
STDMETHODIMP nsDataObj::EnumFormatEtc(DWORD dwDir, LPENUMFORMATETC *ppEnum)
{
switch (dwDir) {
case DATADIR_GET: {
m_enumFE->Clone(ppEnum);
} break;
case DATADIR_SET:
*ppEnum=NULL;
break;
default:
*ppEnum=NULL;
break;
} // switch
if (NULL==*ppEnum)
return ResultFromScode(E_FAIL);
else
(*ppEnum)->AddRef();
return NOERROR;
}
STDMETHODIMP nsDataObj::DAdvise(LPFORMATETC pFE, DWORD dwFlags,
LPADVISESINK pIAdviseSink, DWORD* pdwConn)
{
return ResultFromScode(E_FAIL);
}
STDMETHODIMP nsDataObj::DUnadvise(DWORD dwConn)
{
return ResultFromScode(E_FAIL);
}
STDMETHODIMP nsDataObj::EnumDAdvise(LPENUMSTATDATA *ppEnum)
{
return ResultFromScode(E_FAIL);
}
// other methods
ULONG nsDataObj::GetCumRefCount()
{
return g_cRef;
}
ULONG nsDataObj::GetRefCount() const
{
return m_cRef;
}
// GetData and SetData helper functions
HRESULT nsDataObj::AddSetFormat(FORMATETC& aFE)
{
//m_setFormats[m_numSetFormats++] = aFE;
return ResultFromScode(S_OK);
}
HRESULT nsDataObj::AddGetFormat(FORMATETC& aFE)
{
//m_getFormats[m_numGetFormats++] = aFE;
return ResultFromScode(S_OK);
}
HRESULT nsDataObj::GetBitmap(FORMATETC&, STGMEDIUM&)
{
return ResultFromScode(E_NOTIMPL);
}
HRESULT nsDataObj::GetDib(FORMATETC&, STGMEDIUM&)
{
return ResultFromScode(E_NOTIMPL);
}
HRESULT nsDataObj::GetText(nsIDataFlavor * aDF, FORMATETC& aFE, STGMEDIUM& aSTG)
{
char * data;
PRUint32 len;
// NOTE: Transferable keeps ownership of the memory
mTransferable->GetTransferData(aDF, (void **)&data, &len);
if (0 == len) {
return ResultFromScode(E_FAIL);
}
HGLOBAL hGlobalMemory = NULL;
PSTR pGlobalMemory = NULL;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
// Copy text to Global Memory Area
hGlobalMemory = (HGLOBAL)::GlobalAlloc(GHND, (DWORD)len);
if (hGlobalMemory != NULL) {
pGlobalMemory = (PSTR)::GlobalLock(hGlobalMemory);
// need to use memcpy here
char* s = data;
PRUint32 inx;
for (inx=0; inx < len; inx++) {
*pGlobalMemory++ = *s++;
}
// Put data on Clipboard
GlobalUnlock(hGlobalMemory);
}
aSTG.hGlobal = hGlobalMemory;
return ResultFromScode(S_OK);
}
HRESULT nsDataObj::GetMetafilePict(FORMATETC&, STGMEDIUM&)
{
return ResultFromScode(E_NOTIMPL);
}
HRESULT nsDataObj::SetBitmap(FORMATETC&, STGMEDIUM&)
{
return ResultFromScode(E_NOTIMPL);
}
HRESULT nsDataObj::SetDib (FORMATETC&, STGMEDIUM&)
{
return ResultFromScode(E_FAIL);
}
HRESULT nsDataObj::SetText (FORMATETC& aFE, STGMEDIUM& aSTG)
{
if (aFE.cfFormat == CF_TEXT && aFE.tymed == TYMED_HGLOBAL) {
HGLOBAL hString = (HGLOBAL)aSTG.hGlobal;
if(hString == NULL)
return(FALSE);
// get a pointer to the actual bytes
char * pString = (char *) GlobalLock(hString);
if(!pString)
return(FALSE);
//tmpUrl = XP_STRDUP(pString);
GlobalUnlock(hString);
nsAutoString str(pString);
/* nsEventStatus status;
nsDragDropEvent event;
((nsWindow *)mWindow)->InitEvent(event, NS_DRAGDROP_EVENT);
event.mType = nsDragDropEventStatus_eDrop;
event.mIsFileURL = PR_FALSE;
event.mURL = (PRUnichar *)str.GetUnicode();
mWindow->DispatchEvent(&event, status);
*/
/*typedef struct tagKBDEV {
WORD vkCode;
WORD scanCode;
DWORD flags;
DWORD time;
DWORD dwExtraInfo;
} KBDEV, FAR *LPKBDEV, *PKBDEV;
KBDEV kbDev[1];
for (int i=0;i<strlen(pString);i++) {
kbDev.vkCode = VkKeyScan(pString[i]);
kbDev.scanCode = OemKeyScan(pString[i]);
kbDev.flags = 0;
KeyboardEventEx(&kbDev, 1, sizeof(KBDEV), KEYF_IGNORETIME);
kbDev.flags = KEYEVENTF_KEYUP;
KeyboardEventEx(&kbDev, 1, sizeof(KBDEV), KEYF_IGNORETIME);
}*/
}
return ResultFromScode(E_FAIL);
}
HRESULT nsDataObj::SetMetafilePict (FORMATETC&, STGMEDIUM&)
{
return ResultFromScode(E_FAIL);
}
CLSID nsDataObj::GetClassID() const
{
return CLSID_nsDataObj;
}
/**
* Registers a the DataFlavor/FE pair
*
*/
void nsDataObj::AddDataFlavor(nsIDataFlavor * aDataFlavor, LPFORMATETC aFE)
{
// 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(aDataFlavor);
m_enumFE->AddFE(aFE);
}
/**
* Sets the transferable object
*
*/
void nsDataObj::SetTransferable(nsITransferable * aTransferable)
{
if (nsnull != mTransferable) {
NS_RELEASE(mTransferable);
}
mTransferable = aTransferable;
if (nsnull == mTransferable) {
return;
}
NS_ADDREF(mTransferable);
return;
}

Просмотреть файл

@ -0,0 +1,180 @@
/*Copyright Notice ===============================================*
This file contains proprietary information of Digital Style
Corporation. Copying or reproducing without prior written
approval is prohibited.
Copyright (c) 1995
Digital Style Corporation
16885 Via Del Campo Court #202
San Diego, CA 92127
(619)-673-5050
*Copyright Notice ===============================================*/
#ifndef _NSDATAOBJ_H_
#define _NSDATAOBJ_H_
#include "OLEIDL.H"
#include "Ddforw.h"
#include "nsString.h"
#define MAX_FORMATS 32
class nsIDataFlavor;
class nsISupportsArray;
class CEnumFormatEtc;
class nsITransferable;
/*
* nsDataObjClassFactory - the class factory for nsDataObj objects.
*/
class nsDataObjClassFactory : public IClassFactory
{
public: // construction, destruction
nsDataObjClassFactory();
~nsDataObjClassFactory();
public: // IUnknown methods - see iunknown.h for documentation
STDMETHODIMP_(ULONG) AddRef ();
STDMETHODIMP QueryInterface(REFIID, void**);
STDMETHODIMP_(ULONG) Release ();
public: // IClassFactory methods
// Create an object of this factory with interface refIID and store
// the interface pointer in iface. pUnkOuter is not used in this
// implmentation, but in general if it were not NULL, it would reference
// the controlling IUnknown allowing iface to be used in aggregation.
// Return NOERROR if successful, E_NOINTERFACE if refIID cannot be supported.
// This factory only supports a refIID of IID_IUnknown.
STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter, REFIID refIID, void** iface);
// Increment or decrement the lock count of the server controlling this
// factory depending on whether increment is TRUE or FALSE. When the lock
// count is 0 and the reference count (cumulative total of ref counts of
// all objects created by this factory) is 0, the factory object is deleted,
// and a call to DllCanUnloadNow() will return TRUE.
STDMETHODIMP LockServer (BOOL increment);
protected:
static ULONG g_cLock; // lock server count
ULONG m_cRef; // ref count
};
/*
* This ole registered class is used to facilitate drag-drop of objects which
* can be adapted by an object derived from CfDragDrop. The CfDragDrop is
* associated with instances via SetDragDrop().
*/
class nsDataObj : public IDataObject
{
public: // construction, destruction
nsDataObj();
~nsDataObj();
public: // IUnknown methods - see iunknown.h for documentation
STDMETHODIMP_(ULONG) AddRef ();
STDMETHODIMP QueryInterface(REFIID, void**);
STDMETHODIMP_(ULONG) Release ();
public: // DataGet and DataSet helper methods
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 SetText (FORMATETC& FE, STGMEDIUM& STM);
virtual HRESULT SetMetafilePict(FORMATETC& FE, STGMEDIUM& STM);
// support for clipboard
void AddDataFlavor(nsIDataFlavor * aDataFlavor, LPFORMATETC aFE);
void SetTransferable(nsITransferable * aTransferable);
virtual HRESULT GetText(nsIDataFlavor * aDF, FORMATETC& FE, STGMEDIUM& STM);
// Return the registered OLE class ID of this object's CfDataObj.
CLSID GetClassID() const;
public: // IDataObject methods - these are general comments. see CfDragDrop
// for overriding behavior
// Store data in pSTM according to the format specified by pFE, if the
// format is supported (supported formats are specified in CfDragDrop::
// GetFormats) and return NOERROR; otherwise return DATA_E_FORMATETC. It
// is the callers responsibility to free pSTM if NOERROR is returned.
STDMETHODIMP GetData (LPFORMATETC pFE, LPSTGMEDIUM pSTM);
// Similar to GetData except that the caller allocates the structure
// referenced by pSTM.
STDMETHODIMP GetDataHere (LPFORMATETC pFE, LPSTGMEDIUM pSTM);
// Returns S_TRUE if this object supports the format specified by pSTM,
// S_FALSE otherwise.
STDMETHODIMP QueryGetData (LPFORMATETC pFE);
// Set pCanonFE to the cannonical format of pFE if one exists and return
// NOERROR, otherwise return DATA_S_SAMEFORMATETC. A cannonical format
// implies an identical rendering.
STDMETHODIMP GetCanonicalFormatEtc (LPFORMATETC pFE, LPFORMATETC pCanonFE);
// Set this objects data according to the format specified by pFE and
// the storage medium specified by pSTM and return NOERROR, if the format
// is supported. If release is TRUE this object must release the storage
// associated with pSTM.
STDMETHODIMP SetData (LPFORMATETC pFE, LPSTGMEDIUM pSTM, BOOL release);
// Set ppEnum to an IEnumFORMATETC object which will iterate all of the
// data formats that this object supports. direction is either DATADIR_GET
// or DATADIR_SET.
STDMETHODIMP EnumFormatEtc (DWORD direction, LPENUMFORMATETC* ppEnum);
// Set up an advisory connection to this object based on the format specified
// by pFE, flags, and the pAdvise. Set pConn to the established advise
// connection.
STDMETHODIMP DAdvise (LPFORMATETC pFE, DWORD flags, LPADVISESINK pAdvise,
DWORD* pConn);
// Turn off advising of a previous call to DAdvise which set pConn.
STDMETHODIMP DUnadvise (DWORD pConn);
// Set ppEnum to an IEnumSTATDATA object which will iterate over the
// existing objects which have established advisory connections to this
// object.
STDMETHODIMP EnumDAdvise (LPENUMSTATDATA *ppEnum);
public: // other methods
// Set the adapter to dragDrop
//void SetDragDrop(CfDragDrop& dragDrop);
// Return the adapter
//CfDragDrop& GetDragDrop() const;
// Return the total reference counts of all instances of this class.
static ULONG GetCumRefCount();
// Return the reference count (which helps determine if another app has
// released the interface pointer after a drop).
ULONG GetRefCount() const;
protected:
nsString mStringData;
BOOL FormatsMatch(const FORMATETC& source, const FORMATETC& target) const;
static ULONG g_cRef; // the cum reference count of all instances
ULONG m_cRef; // the reference count
//CfDragDrop* m_dragDrop; // the adapter which provides the behavior
nsISupportsArray * mDataFlavors;
CEnumFormatEtc * m_enumFE;
nsITransferable * mTransferable;
};
#endif //

Просмотреть файл

@ -0,0 +1,103 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsDragService.h"
#include "nsIDragSource.h"
#include "nsITransferable.h"
#include "nsDragSource.h"
#include "nsDataObj.h"
#include "nsTransferable.h"
#include "OLEIDL.h"
#include "OLE2.h"
static NS_DEFINE_IID(kIDragServiceIID, NS_IDRAGSERVICE_IID);
NS_IMPL_ADDREF(nsDragService)
NS_IMPL_RELEASE(nsDragService)
//-------------------------------------------------------------------------
//
// DragService constructor
//
//-------------------------------------------------------------------------
nsDragService::nsDragService()
{
NS_INIT_REFCNT();
mDragSource = nsnull;
}
//-------------------------------------------------------------------------
//
// DragService destructor
//
//-------------------------------------------------------------------------
nsDragService::~nsDragService()
{
NS_IF_RELEASE(mDragSource);
}
/**
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsDragService::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
nsresult rv = NS_NOINTERFACE;
if (aIID.Equals(kIDragServiceIID)) {
*aInstancePtr = (void*) ((nsIDragService*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return rv;
}
NS_IMETHODIMP nsDragService::StartDragSession (nsIDragSource * aDragSrc,
nsPoint * aStartLocation,
nsPoint * aImageOffset,
nsIImage * aImage,
PRBool aDoFlyback)
{
NS_IF_RELEASE(mDragSource);
mDragSource = aDragSrc;
NS_ADDREF(mDragSource);
nsITransferable * trans;
mDragSource->GetTransferable(&trans);
nsDataObj * dataObj = ((nsTransferable *)trans)->GetDataObj();
DWORD dropRes;
HRESULT res = 0;
res = ::DoDragDrop((IDataObject*)dataObj,
(IDropSource *)((nsDragSource *)mDragSource)->GetNativeDragSrc(),
DROPEFFECT_COPY | DROPEFFECT_MOVE | DROPEFFECT_SCROLL, &dropRes);
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsDragService_h__
#define nsDragService_h__
#include "nsIDragService.h"
#include "nsPoint.h"
#include "nsIImage.h"
#include <OLE2.h>
#include "OLEIDL.H"
class nsIDragSource;
class nsDataObj;
#define MAX_FORMATS 32
/**
* Native Win32 DragService wrapper
*/
class nsDragService : public nsIDragService
{
public:
nsDragService();
virtual ~nsDragService();
//nsISupports
NS_DECL_ISUPPORTS
//nsIDragService
NS_IMETHOD StartDragSession (nsIDragSource * aDragSrc,
nsPoint * aStartLocation,
nsPoint * aImageOffset,
nsIImage * aImage,
PRBool aDoFlyback);
protected:
nsIDragSource * mDragSource;
//nsDataObj * mDataObj;
};
#endif // nsDragService_h__

Просмотреть файл

@ -0,0 +1,103 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsDragSource.h"
#include "nsITransferable.h"
#include "DROPSRC.h"
static NS_DEFINE_IID(kIDragSourceIID, NS_IDRAGSOURCE_IID);
NS_IMPL_ADDREF(nsDragSource)
NS_IMPL_RELEASE(nsDragSource)
//-------------------------------------------------------------------------
//
// DragSource constructor
//
//-------------------------------------------------------------------------
nsDragSource::nsDragSource()
{
NS_INIT_REFCNT();
//mNativeDragSrc = new CfDropSource(this);
//mNativeDragSrc->AddRef();
mTransferable = nsnull;
}
//-------------------------------------------------------------------------
//
// DragSource destructor
//
//-------------------------------------------------------------------------
nsDragSource::~nsDragSource()
{
//mNativeDragSrc->Release();
}
/**
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsDragSource::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
nsresult rv = NS_NOINTERFACE;
if (aIID.Equals(kIDragSourceIID)) {
*aInstancePtr = (void*) ((nsIDragSource*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return rv;
}
NS_IMETHODIMP nsDragSource::GetTransferable(nsITransferable ** aTransferable)
{
if (nsnull != mTransferable) {
*aTransferable = mTransferable;
NS_ADDREF(mTransferable);
} else {
aTransferable = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP nsDragSource::SetTransferable(nsITransferable * aTransferable)
{
NS_IF_RELEASE(mTransferable);
mTransferable = aTransferable;
NS_ADDREF(mTransferable);
return NS_OK;
}
NS_IMETHODIMP nsDragSource:: DragStopped(nsIDraggedObject * aDraggedObj, PRInt32 anAction)
{
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsDragSource_h__
#define nsDragSource_h__
#include "nsIDragSource.h"
//#include <OLE2.h>
//#include "OLEIDL.H"
class nsITransferable;
class CfDropSource;
/**
* Native Win32 DragSource wrapper
*/
class nsDragSource : public nsIDragSource
{
public:
nsDragSource();
virtual ~nsDragSource();
//nsISupports
NS_DECL_ISUPPORTS
//nsIDragSource
NS_IMETHOD GetTransferable(nsITransferable ** aTransferable);
NS_IMETHOD SetTransferable(nsITransferable * aTransferable);
NS_IMETHOD DragStopped(nsIDraggedObject * aDraggedObj, PRInt32 anAction);
CfDropSource * GetNativeDragSrc() { return mNativeDragSrc; } // XXX this needs to be moved into impl
protected:
nsITransferable * mTransferable;
CfDropSource * mNativeDragSrc;
};
#endif // nsDragSource_h__

Просмотреть файл

@ -0,0 +1,90 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsDragTarget.h"
#include "nsIDraggedObject.h"
static NS_DEFINE_IID(kIDragTargetIID, NS_IDRAGTARGET_IID);
NS_IMPL_ADDREF(nsDragTarget)
NS_IMPL_RELEASE(nsDragTarget)
//-------------------------------------------------------------------------
//
// DragTarget constructor
//
//-------------------------------------------------------------------------
nsDragTarget::nsDragTarget()
{
NS_INIT_REFCNT();
}
//-------------------------------------------------------------------------
//
// DragTarget destructor
//
//-------------------------------------------------------------------------
nsDragTarget::~nsDragTarget()
{
}
/**
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsDragTarget::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
nsresult rv = NS_NOINTERFACE;
if (aIID.Equals(kIDragTargetIID)) {
*aInstancePtr = (void*) ((nsIDragTarget*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return rv;
}
NS_IMETHODIMP nsDragTarget::DragEnter(nsIDraggedObject * aDraggedObj, nsPoint * aLocation)
{
return NS_OK;
}
NS_IMETHODIMP nsDragTarget::DragOver(nsIDraggedObject * aDraggedObj, nsPoint * aLocation)
{
return NS_OK;
}
NS_IMETHODIMP nsDragTarget::DragExit(nsIDraggedObject * aDraggedObj, nsPoint * aLocation)
{
return NS_OK;
}
NS_IMETHODIMP nsDragTarget::DragDrop(nsIDraggedObject * aDraggedObj, PRInt32 aActions)
{
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsDragTarget_h__
#define nsDragTarget_h__
#include "nsIDragTarget.h"
#include "nsPoint.h"
#include <OLE2.h>
#include "OLEIDL.H"
class nsIDraggedObject;
/**
* Native Win32 DragTarget wrapper
*/
class nsDragTarget : public nsIDragTarget
{
public:
nsDragTarget();
virtual ~nsDragTarget();
//nsISupports
NS_DECL_ISUPPORTS
//nsIDragTarget
NS_IMETHOD DragEnter(nsIDraggedObject * aDraggedObj, nsPoint * aLocation);
NS_IMETHOD DragOver(nsIDraggedObject * aDraggedObj, nsPoint * aLocation);
NS_IMETHOD DragExit(nsIDraggedObject * aDraggedObj, nsPoint * aLocation);
NS_IMETHOD DragDrop(nsIDraggedObject * aDraggedObj, PRInt32 aActions);
protected:
};
#endif // nsDragTarget_h__

Просмотреть файл

@ -0,0 +1,96 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsDraggedObject.h"
#include "nsIDraggedObject.h"
static NS_DEFINE_IID(kIDraggedObjectIID, NS_IDRAGGEDOBJECT_IID);
NS_IMPL_ADDREF(nsDraggedObject)
NS_IMPL_RELEASE(nsDraggedObject)
//-------------------------------------------------------------------------
//
// DraggedObject constructor
//
//-------------------------------------------------------------------------
nsDraggedObject::nsDraggedObject()
{
NS_INIT_REFCNT();
}
//-------------------------------------------------------------------------
//
// DraggedObject destructor
//
//-------------------------------------------------------------------------
nsDraggedObject::~nsDraggedObject()
{
}
/**
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsDraggedObject::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
nsresult rv = NS_NOINTERFACE;
if (aIID.Equals(kIDraggedObjectIID)) {
*aInstancePtr = (void*) ((nsIDraggedObject*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return rv;
}
NS_IMETHODIMP nsDraggedObject::GetDragOffset(nscoord * aX, nscoord * aY)
{
return NS_OK;
}
NS_IMETHODIMP nsDraggedObject::GetTransferable(nsITransferable ** aTransferable)
{
return NS_OK;
}
NS_IMETHODIMP nsDraggedObject::GetSource(nsIDragSource ** aDragSrc)
{
return NS_OK;
}
NS_IMETHODIMP nsDraggedObject::GetTarget(nsIDragTarget ** aTarget)
{
return NS_OK;
}
NS_IMETHODIMP nsDraggedObject::GetTargetnFrame(nsIFrame ** aFrame)
{
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsDraggedObject_h__
#define nsDraggedObject_h__
#include "nsIDraggedObject.h"
#include "nsPoint.h"
#include <OLE2.h>
#include "OLEIDL.H"
class nsIDraggedObject;
/**
* Native Win32 DraggedObject wrapper
*/
class nsDraggedObject : public nsIDraggedObject
{
public:
nsDraggedObject();
virtual ~nsDraggedObject();
//nsISupports
NS_DECL_ISUPPORTS
//nsIDraggedObject
NS_IMETHOD GetDragOffset(nscoord * aX, nscoord * aY);
NS_IMETHOD GetTransferable(nsITransferable ** aTransferable);
NS_IMETHOD GetSource(nsIDragSource ** aDragSrc);
NS_IMETHOD GetTarget(nsIDragTarget ** aTarget);
NS_IMETHOD GetTargetnFrame(nsIFrame ** aFrame);
protected:
};
#endif // nsDraggedObject_h__

Просмотреть файл

@ -0,0 +1,360 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsTransferable.h"
#include "nsIDataFlavor.h"
#include "nsDataFlavor.h"
#include "nsWidgetsCID.h"
#include "nsISupportsArray.h"
#include "nsRepository.h"
#include "nsDataObj.h"
#include "DDCOMM.h"
static NS_DEFINE_IID(kITransferableIID, NS_ITRANSFERABLE_IID);
static NS_DEFINE_IID(kIDataFlavorIID, NS_IDATAFLAVOR_IID);
static NS_DEFINE_IID(kCDataFlavorCID, NS_DATAFLAVOR_CID);
NS_IMPL_ADDREF(nsTransferable)
NS_IMPL_RELEASE(nsTransferable)
//-------------------------------------------------------------------------
//
// Transferable constructor
//
//-------------------------------------------------------------------------
nsTransferable::nsTransferable()
{
NS_INIT_REFCNT();
mDataObj = nsnull;
mStrCache = nsnull;
mDataPtr = nsnull;
nsresult rv = NS_NewISupportsArray(&mDFList);
}
//-------------------------------------------------------------------------
//
// Transferable destructor
//
//-------------------------------------------------------------------------
nsTransferable::~nsTransferable()
{
if (mStrCache) {
delete mStrCache;
}
if (mDataPtr) {
delete mDataPtr;
}
}
/**
* @param aIID The name of the class implementing the method
* @param _classiiddef The name of the #define symbol that defines the IID
* for the class (e.g. NS_ISUPPORTS_IID)
*
*/
nsresult nsTransferable::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
nsresult rv = NS_NOINTERFACE;
if (aIID.Equals(kITransferableIID)) {
*aInstancePtr = (void*) ((nsITransferable*)this);
NS_ADDREF_THIS();
return NS_OK;
}
return rv;
}
/**
*
*
*/
NS_IMETHODIMP nsTransferable::GetTransferDataFlavors(nsISupportsArray ** aDataFlavorList)
{
*aDataFlavorList = mDFList;
NS_ADDREF(mDFList);
return NS_OK;
}
/**
*
*
*/
NS_IMETHODIMP nsTransferable::IsDataFlavorSupported(nsIDataFlavor * aDataFlavor)
{
nsAutoString mimeInQuestion;
aDataFlavor->GetMimeType(mimeInQuestion);
PRUint32 i;
for (i=0;i<mDFList->Count();i++) {
nsIDataFlavor * df;
nsISupports * supports = mDFList->ElementAt(i);
if (NS_OK == supports->QueryInterface(kIDataFlavorIID, (void **)&df)) {
nsAutoString mime;
df->GetMimeType(mime);
if (mimeInQuestion.Equals(mime)) {
return NS_OK;
}
NS_RELEASE(df);
}
NS_RELEASE(supports);
}
return NS_ERROR_FAILURE;
}
/**
*
*
*/
NS_IMETHODIMP nsTransferable::GetTransferData(nsIDataFlavor * aDataFlavor, void ** aData, PRUint32 * aDataLen)
{
if (mDataPtr) {
delete mDataPtr;
}
nsAutoString mimeInQuestion;
aDataFlavor->GetMimeType(mimeInQuestion);
if (mimeInQuestion.Equals(kTextMime)) {
char * str = mStrCache->ToNewCString();
*aDataLen = mStrCache->Length()+1;
mDataPtr = (void *)str;
*aData = mDataPtr;
//mDataPtr = (void *)new char[*aDataLen];
//memcpy(*mDataPtr, str, *aDataLen);
//delete[] str;
} else if (mimeInQuestion.Equals(kHTMLMime)) {
}
return NS_OK;
}
/**
*
*
*/
NS_IMETHODIMP nsTransferable::SetTransferData(nsIDataFlavor * aDataFlavor, void * aData, PRUint32 aDataLen)
{
nsAutoString mimeInQuestion;
aDataFlavor->GetMimeType(mimeInQuestion);
if (mimeInQuestion.Equals(kTextMime)) {
if (nsnull == mStrCache) {
mStrCache = new nsString();
}
mStrCache->SetString((char *)aData, aDataLen-1);
} else if (mimeInQuestion.Equals(kHTMLMime)) {
}
return NS_OK;
}
/**
*
*
*/
NS_IMETHODIMP nsTransferable::SetTransferString(const nsString & aStr)
{
if (!mStrCache) {
mStrCache = new nsString(aStr);
} else {
*mStrCache = aStr;
}
return NS_OK;
}
/**
*
*
*/
NS_IMETHODIMP nsTransferable::GetTransferString(nsString & aStr)
{
if (!mStrCache) {
mStrCache = new nsString();
}
aStr = *mStrCache;
return NS_OK;
}
#if 0
static void PlaceStringOnClipboard(PRUint32 aFormat, char* aData, int aLength)
{
HGLOBAL hGlobalMemory;
PSTR pGlobalMemory;
PRInt32 size = aLength + 1;
if (aLength) {
// Copy text to Global Memory Area
hGlobalMemory = (HGLOBAL)::GlobalAlloc(GHND, size);
if (hGlobalMemory != NULL) {
pGlobalMemory = (PSTR) ::GlobalLock(hGlobalMemory);
int i;
char * s = aData;
PRInt32 len = aLength;
for (i=0;i< len;i++) {
*pGlobalMemory++ = *s++;
}
// Put data on Clipboard
::GlobalUnlock(hGlobalMemory);
::SetClipboardData(aFormat, hGlobalMemory);
}
}
}
#endif
/**
*
*
*/
NS_IMETHODIMP nsTransferable::SetNativeClipboard()
{
#if 0
::OleFlushClipboard();
if (!mStrCache) {
return NS_OK;
}
char * str = mStrCache->ToNewCString();
#if 0
::OpenClipboard(NULL);
::EmptyClipboard();
PlaceStringOnClipboard(CF_TEXT, str, mStrCache->Length());
::CloseClipboard();
#else
if (mDataObj) {
mDataObj->Release();
}
// make the IDataObject
/*IDataObject * dataObj = NULL;
IClassFactory * pCF = NULL;
HRESULT hr = ::CoGetClassObject(CLSID_CfDataObj, CLSCTX_INPROC_SERVER, NULL, IID_IClassFactory, (void **)&pCF);
if (REGDB_E_CLASSNOTREG == hr) {
return hr;
}
//hresult = pCF->CreateInstance(pUnkOuter, riid, ppvObj)
pCF->Release();
HRESULT ret = ::CoCreateInstance(CLSID_CfDataObj, NULL, CLSCTX_INPROC_SERVER, IID_IDataObject, (void **)&dataObj);
if (REGDB_E_CLASSNOTREG == ret) {
//return ret;
}
if (FAILED(ret)) {
//return ret;
}*/
mDataObj = new nsDataObj();
mDataObj->AddRef();
mDataObj->SetText(*mStrCache);
PRUint32 i;
for (i=0;i<mDFList->Count();i++) {
nsIDataFlavor * df;
nsISupports * supports = mDFList->ElementAt(i);
if (NS_OK == supports->QueryInterface(kIDataFlavorIID, (void **)&df)) {
nsString mime;
df->GetMimeType(mime);
UINT format;
if (mime.Equals(kTextMime)) {
format = CF_TEXT;
} else {
char * str = mime.ToNewCString();
UINT format = ::RegisterClipboardFormat(str);
delete[] str;
}
FORMATETC fe;
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, 0, TYMED_HGLOBAL);
mDataObj->AddDataFlavor(df, &fe);
NS_RELEASE(df);
}
NS_RELEASE(supports);
}
IDataObject * ido = (IDataObject *)mDataObj;
::OleSetClipboard(ido);
#endif
delete[] str;
#endif
return NS_OK;
}
/**
*
*
*/
NS_IMETHODIMP nsTransferable::AddDataFlavor(const nsString & aMimeType, const nsString & aHumanPresentableName)
{
nsIDataFlavor * df;
nsresult rv = nsComponentManager::CreateInstance(kCDataFlavorCID, nsnull, kIDataFlavorIID, (void**) &df);
if (nsnull == df) {
return rv;
}
df->Init(aMimeType, aHumanPresentableName);
mDFList->AppendElement(df);
/*FORMATETC fe;
if (aMimeType.Equals(kTextMime)) {
SET_FORMATETC(fe, CF_TEXT, 0, DVASPECT_CONTENT, 0, TYMED_HGLOBAL);
m_getFormats[m_numGetFormats++] = fe;
SET_FORMATETC(fe, CF_TEXT, 0, DVASPECT_CONTENT, 0, TYMED_HGLOBAL);
m_setFormats[m_numSetFormats++] = fe;
} else {
nsDataFlavor * ndf = (nsDataFlavor *)df;
SET_FORMATETC(fe, ndf->GetFormat(), 0, DVASPECT_CONTENT, 0, TYMED_HGLOBAL);
m_getFormats[m_numGetFormats++] = fe;
SET_FORMATETC(fe, ndf->GetFormat(), 0, DVASPECT_CONTENT, 0, TYMED_HGLOBAL);
m_setFormats[m_numSetFormats++] = fe;
}*/
return rv;
}

Просмотреть файл

@ -0,0 +1,69 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsTransferable_h__
#define nsTransferable_h__
#include "nsITransferable.h"
class nsISupportsArray;
class nsIDataFlavor;
class nsDataObj;
#define MAX_FORMATS 32
/**
* Native Win32 Transferable wrapper
*/
class nsTransferable : public nsITransferable
{
public:
nsTransferable();
virtual ~nsTransferable();
//nsISupports
NS_DECL_ISUPPORTS
//nsITransferable
NS_IMETHOD GetTransferDataFlavors(nsISupportsArray ** aDataFlavorList);
NS_IMETHOD IsDataFlavorSupported(nsIDataFlavor * aFlavor);
NS_IMETHOD GetTransferData(nsIDataFlavor * aFlavor, void ** aData, PRUint32 * aDataLen);
NS_IMETHOD SetTransferData(nsIDataFlavor * aFlavor, void * aData, PRUint32 aDataLen);
NS_IMETHOD SetTransferString(const nsString & aStr);
NS_IMETHOD GetTransferString(nsString & aStr);
NS_IMETHOD AddDataFlavor(const nsString & aMimeType, const nsString & aHumanPresentableName);
NS_IMETHOD SetNativeClipboard();
// Used for native implementation
nsDataObj * GetDataObj() { return mDataObj; }
protected:
nsISupportsArray * mDFList;
nsDataObj * mDataObj;
nsString * mStrCache;
void * mDataPtr;
};
#endif // nsTransferable_h__