зеркало из https://github.com/mozilla/pjs.git
Whitespace cleanup and sanitizing code a bit.
This commit is contained in:
Родитель
d6517ec0cb
Коммит
9d55951488
|
@ -66,10 +66,8 @@
|
|||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsDragService::nsDragService()
|
||||
: mNativeDragSrc(nsnull), mNativeDragTarget(nsnull), mDataObject(nsnull)
|
||||
{
|
||||
mNativeDragTarget = nsnull;
|
||||
mNativeDragSrc = nsnull;
|
||||
mDataObject = nsnull;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -86,10 +84,14 @@ nsDragService::~nsDragService()
|
|||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode, nsISupportsArray * anArrayTransferables, nsIScriptableRegion * aRegion, PRUint32 aActionType)
|
||||
NS_IMETHODIMP
|
||||
nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
|
||||
nsISupportsArray *anArrayTransferables,
|
||||
nsIScriptableRegion *aRegion,
|
||||
PRUint32 aActionType)
|
||||
{
|
||||
nsBaseDragService::InvokeDragSession ( aDOMNode, anArrayTransferables, aRegion, aActionType );
|
||||
|
||||
nsBaseDragService::InvokeDragSession(aDOMNode, anArrayTransferables, aRegion,
|
||||
aActionType);
|
||||
nsresult rv;
|
||||
|
||||
// Try and get source URI of the items that are being dragged
|
||||
|
@ -102,32 +104,33 @@ NS_IMETHODIMP nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode, nsISupport
|
|||
|
||||
PRUint32 numItemsToDrag = 0;
|
||||
rv = anArrayTransferables->Count(&numItemsToDrag);
|
||||
if ( !numItemsToDrag )
|
||||
if (!numItemsToDrag)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// The clipboard class contains some static utility methods
|
||||
// that we can use to create an IDataObject from the transferable
|
||||
// The clipboard class contains some static utility methods that we
|
||||
// can use to create an IDataObject from the transferable
|
||||
|
||||
// if we're dragging more than one item, we need to create a "collection" object to fake out
|
||||
// the OS. This collection contains one |IDataObject| for each transerable. If there is just
|
||||
// the one (most cases), only pass around the native |IDataObject|.
|
||||
// if we're dragging more than one item, we need to create a
|
||||
// "collection" object to fake out the OS. This collection contains
|
||||
// one |IDataObject| for each transerable. If there is just the one
|
||||
// (most cases), only pass around the native |IDataObject|.
|
||||
nsRefPtr<IDataObject> itemToDrag;
|
||||
if ( numItemsToDrag > 1 ) {
|
||||
if (numItemsToDrag > 1) {
|
||||
nsDataObjCollection * dataObjCollection = new nsDataObjCollection();
|
||||
if (!dataObjCollection)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
itemToDrag = dataObjCollection;
|
||||
for ( PRUint32 i=0; i<numItemsToDrag; ++i ) {
|
||||
for (PRUint32 i=0; i<numItemsToDrag; ++i) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
anArrayTransferables->GetElementAt(i, getter_AddRefs(supports));
|
||||
nsCOMPtr<nsITransferable> trans(do_QueryInterface(supports));
|
||||
if ( trans ) {
|
||||
if (trans) {
|
||||
nsRefPtr<IDataObject> dataObj;
|
||||
if ( NS_SUCCEEDED(nsClipboard::CreateNativeDataObject(trans, getter_AddRefs(dataObj), uri)) ) {
|
||||
dataObjCollection->AddDataObject(dataObj);
|
||||
}
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
rv = nsClipboard::CreateNativeDataObject(trans,
|
||||
getter_AddRefs(dataObj), uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
dataObjCollection->AddDataObject(dataObj);
|
||||
}
|
||||
}
|
||||
} // if dragging multiple items
|
||||
|
@ -135,25 +138,29 @@ NS_IMETHODIMP nsDragService::InvokeDragSession (nsIDOMNode *aDOMNode, nsISupport
|
|||
nsCOMPtr<nsISupports> supports;
|
||||
anArrayTransferables->GetElementAt(0, getter_AddRefs(supports));
|
||||
nsCOMPtr<nsITransferable> trans(do_QueryInterface(supports));
|
||||
if ( trans ) {
|
||||
if ( NS_FAILED(nsClipboard::CreateNativeDataObject(trans, getter_AddRefs(itemToDrag), uri)) )
|
||||
return NS_ERROR_FAILURE;
|
||||
if (trans) {
|
||||
rv = nsClipboard::CreateNativeDataObject(trans,
|
||||
getter_AddRefs(itemToDrag),
|
||||
uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
} // else dragging a single object
|
||||
|
||||
return StartInvokingDragSession ( itemToDrag, aActionType );
|
||||
|
||||
return StartInvokingDragSession(itemToDrag, aActionType);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::StartInvokingDragSession(IDataObject * aDataObj, PRUint32 aActionType)
|
||||
NS_IMETHODIMP
|
||||
nsDragService::StartInvokingDragSession(IDataObject * aDataObj,
|
||||
PRUint32 aActionType)
|
||||
{
|
||||
// To do the drag we need to create an object that
|
||||
// To do the drag we need to create an object that
|
||||
// implements the IDataObject interface (for OLE)
|
||||
NS_IF_RELEASE(mNativeDragSrc);
|
||||
mNativeDragSrc = (IDropSource *)new nsNativeDragSource();
|
||||
if ( !mNativeDragSrc )
|
||||
if (!mNativeDragSrc)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
||||
mNativeDragSrc->AddRef();
|
||||
|
||||
// Now figure out what the native drag effect should be
|
||||
|
@ -169,37 +176,53 @@ NS_IMETHODIMP nsDragService::StartInvokingDragSession(IDataObject * aDataObj, PR
|
|||
effects |= DROPEFFECT_LINK;
|
||||
}
|
||||
|
||||
mDragAction = aActionType; //XXX not sure why we bother to cache this, it can change during the drag
|
||||
// XXX not sure why we bother to cache this, it can change during
|
||||
// the drag
|
||||
mDragAction = aActionType;
|
||||
mDoingDrag = PR_TRUE;
|
||||
|
||||
// Call the native D&D method
|
||||
HRESULT res = ::DoDragDrop(aDataObj, mNativeDragSrc, effects, &dropRes);
|
||||
|
||||
// For some drag/drop interactions, IDataObject::SetData doesn't get called with
|
||||
// a CFSTR_PERFORMEDDROPEFFECT format and the intermediate file (if it was created)
|
||||
// isn't deleted. See http://bugzilla.mozilla.org/show_bug.cgi?id=203847#c4 for a
|
||||
// detailed description of the different cases. Now that we know that the drag/drop
|
||||
// operation has ended, call SetData() so that the intermediate file is deleted.
|
||||
static CLIPFORMAT PerformedDropEffect = ::RegisterClipboardFormat( CFSTR_PERFORMEDDROPEFFECT );
|
||||
FORMATETC fmte = {(CLIPFORMAT) PerformedDropEffect, NULL, DVASPECT_CONTENT, -1, TYMED_NULL};
|
||||
// For some drag/drop interactions, IDataObject::SetData doesn't get
|
||||
// called with a CFSTR_PERFORMEDDROPEFFECT format and the
|
||||
// intermediate file (if it was created) isn't deleted. See
|
||||
// http://bugzilla.mozilla.org/show_bug.cgi?id=203847#c4 for a
|
||||
// detailed description of the different cases. Now that we know
|
||||
// that the drag/drop operation has ended, call SetData() so that
|
||||
// the intermediate file is deleted.
|
||||
static CLIPFORMAT PerformedDropEffect =
|
||||
::RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT);
|
||||
|
||||
FORMATETC fmte =
|
||||
{
|
||||
(CLIPFORMAT)PerformedDropEffect,
|
||||
NULL,
|
||||
DVASPECT_CONTENT,
|
||||
-1,
|
||||
TYMED_NULL
|
||||
};
|
||||
|
||||
STGMEDIUM medium;
|
||||
medium.tymed = TYMED_NULL;
|
||||
medium.pUnkForRelease = NULL;
|
||||
aDataObj->SetData(&fmte, &medium, FALSE);
|
||||
|
||||
mDoingDrag = PR_FALSE;
|
||||
mDoingDrag = PR_FALSE;
|
||||
|
||||
return (DRAGDROP_S_DROP == res?NS_OK:NS_ERROR_FAILURE);
|
||||
return DRAGDROP_S_DROP == res ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Make Sure we have the right kind of object
|
||||
nsDataObjCollection* nsDragService::GetDataObjCollection(IDataObject* aDataObj)
|
||||
nsDataObjCollection*
|
||||
nsDragService::GetDataObjCollection(IDataObject* aDataObj)
|
||||
{
|
||||
nsDataObjCollection * dataObjCol = nsnull;
|
||||
if (aDataObj) {
|
||||
nsIDataObjCollection* dataObj;
|
||||
if (aDataObj->QueryInterface(IID_IDataObjCollection, (void**)&dataObj) == S_OK) {
|
||||
if (aDataObj->QueryInterface(IID_IDataObjCollection,
|
||||
(void**)&dataObj) == S_OK) {
|
||||
dataObjCol = NS_STATIC_CAST(nsDataObjCollection*, aDataObj);
|
||||
dataObj->Release();
|
||||
}
|
||||
|
@ -209,17 +232,17 @@ nsDataObjCollection* nsDragService::GetDataObjCollection(IDataObject* aDataObj)
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::GetNumDropItems (PRUint32 * aNumItems)
|
||||
NS_IMETHODIMP
|
||||
nsDragService::GetNumDropItems(PRUint32 * aNumItems)
|
||||
{
|
||||
if ( !mDataObject ) {
|
||||
if (!mDataObject) {
|
||||
*aNumItems = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if ( IsCollectionObject(mDataObject) ) {
|
||||
|
||||
if (IsCollectionObject(mDataObject)) {
|
||||
nsDataObjCollection * dataObjCol = GetDataObjCollection(mDataObject);
|
||||
if ( dataObjCol )
|
||||
if (dataObjCol)
|
||||
*aNumItems = dataObjCol->GetNumDataObjects();
|
||||
}
|
||||
else {
|
||||
|
@ -228,10 +251,10 @@ NS_IMETHODIMP nsDragService::GetNumDropItems (PRUint32 * aNumItems)
|
|||
// actually have > 1 drag item.
|
||||
FORMATETC fe2;
|
||||
SET_FORMATETC(fe2, CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL);
|
||||
if ( mDataObject->QueryGetData(&fe2) == S_OK ) {
|
||||
if (mDataObject->QueryGetData(&fe2) == S_OK) {
|
||||
STGMEDIUM stm;
|
||||
if ( mDataObject->GetData(&fe2, &stm) == S_OK ) {
|
||||
HDROP hdrop = (HDROP) GlobalLock(stm.hGlobal);
|
||||
if (mDataObject->GetData(&fe2, &stm) == S_OK) {
|
||||
HDROP hdrop = (HDROP)GlobalLock(stm.hGlobal);
|
||||
*aNumItems = ::DragQueryFile(hdrop, 0xFFFFFFFF, NULL, 0);
|
||||
::GlobalUnlock(stm.hGlobal);
|
||||
::ReleaseStgMedium(&stm);
|
||||
|
@ -245,48 +268,53 @@ NS_IMETHODIMP nsDragService::GetNumDropItems (PRUint32 * aNumItems)
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::GetData (nsITransferable * aTransferable, PRUint32 anItem)
|
||||
NS_IMETHODIMP
|
||||
nsDragService::GetData(nsITransferable * aTransferable, PRUint32 anItem)
|
||||
{
|
||||
// This typcially happens on a drop, the target would be asking
|
||||
// for it's transferable to be filled in
|
||||
// Use a static clipboard utility method for this
|
||||
if ( !mDataObject )
|
||||
if (!mDataObject)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult dataFound = NS_ERROR_FAILURE;
|
||||
|
||||
if ( IsCollectionObject(mDataObject) ) {
|
||||
if (IsCollectionObject(mDataObject)) {
|
||||
// multiple items, use |anItem| as an index into our collection
|
||||
nsDataObjCollection * dataObjCol = GetDataObjCollection(mDataObject);
|
||||
PRUint32 cnt = dataObjCol->GetNumDataObjects();
|
||||
PRUint32 cnt = dataObjCol->GetNumDataObjects();
|
||||
if (anItem >= 0 && anItem < cnt) {
|
||||
IDataObject * dataObj = dataObjCol->GetDataObjectAt(anItem);
|
||||
dataFound = nsClipboard::GetDataFromDataObject(dataObj, 0, nsnull, aTransferable);
|
||||
dataFound = nsClipboard::GetDataFromDataObject(dataObj, 0, nsnull,
|
||||
aTransferable);
|
||||
}
|
||||
else
|
||||
NS_WARNING ( "Index out of range!" );
|
||||
NS_WARNING("Index out of range!");
|
||||
}
|
||||
else {
|
||||
// If they are asking for item "0", we can just get it...
|
||||
if (anItem == 0)
|
||||
dataFound = nsClipboard::GetDataFromDataObject(mDataObject, anItem, nsnull, aTransferable);
|
||||
else {
|
||||
if (anItem == 0) {
|
||||
dataFound = nsClipboard::GetDataFromDataObject(mDataObject, anItem,
|
||||
nsnull, aTransferable);
|
||||
} else {
|
||||
// It better be a file drop, or else non-zero indexes are invalid!
|
||||
FORMATETC fe2;
|
||||
SET_FORMATETC(fe2, CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL);
|
||||
if ( mDataObject->QueryGetData(&fe2) == S_OK )
|
||||
dataFound = nsClipboard::GetDataFromDataObject(mDataObject, anItem, nsnull, aTransferable);
|
||||
if (mDataObject->QueryGetData(&fe2) == S_OK)
|
||||
dataFound = nsClipboard::GetDataFromDataObject(mDataObject, anItem,
|
||||
nsnull, aTransferable);
|
||||
else
|
||||
NS_WARNING ( "Reqesting non-zero index, but clipboard data is not a collection!" );
|
||||
NS_WARNING("Reqesting non-zero index, but clipboard data is not a collection!");
|
||||
}
|
||||
}
|
||||
return dataFound;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::SetIDataObject (IDataObject * aDataObj)
|
||||
NS_IMETHODIMP
|
||||
nsDragService::SetIDataObject(IDataObject * aDataObj)
|
||||
{
|
||||
// When the native drag starts the DragService gets
|
||||
// When the native drag starts the DragService gets
|
||||
// the IDataObject that is being dragged
|
||||
NS_IF_RELEASE(mDataObject);
|
||||
mDataObject = aDataObj;
|
||||
|
@ -296,29 +324,32 @@ NS_IMETHODIMP nsDragService::SetIDataObject (IDataObject * aDataObj)
|
|||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBool *_retval)
|
||||
NS_IMETHODIMP
|
||||
nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBool *_retval)
|
||||
{
|
||||
if ( !aDataFlavor || !mDataObject || !_retval )
|
||||
if (!aDataFlavor || !mDataObject || !_retval)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if ( strcmp(aDataFlavor, kTextMime) == 0 )
|
||||
NS_WARNING ( "DO NOT USE THE text/plain DATA FLAVOR ANY MORE. USE text/unicode INSTEAD" );
|
||||
if (strcmp(aDataFlavor, kTextMime) == 0)
|
||||
NS_WARNING("DO NOT USE THE text/plain DATA FLAVOR ANY MORE. USE text/unicode INSTEAD");
|
||||
#endif
|
||||
|
||||
*_retval = PR_FALSE;
|
||||
|
||||
FORMATETC fe;
|
||||
UINT format = 0;
|
||||
|
||||
if ( IsCollectionObject(mDataObject) ) {
|
||||
|
||||
if (IsCollectionObject(mDataObject)) {
|
||||
// We know we have one of our special collection objects.
|
||||
format = nsClipboard::GetFormat(aDataFlavor);
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL | TYMED_FILE | TYMED_GDI);
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1,
|
||||
TYMED_HGLOBAL | TYMED_FILE | TYMED_GDI);
|
||||
|
||||
// See if any one of the IDataObjects in the collection supports this data type
|
||||
// See if any one of the IDataObjects in the collection supports
|
||||
// this data type
|
||||
nsDataObjCollection* dataObjCol = GetDataObjCollection(mDataObject);
|
||||
if ( dataObjCol ) {
|
||||
if (dataObjCol) {
|
||||
PRUint32 cnt = dataObjCol->GetNumDataObjects();
|
||||
for (PRUint32 i=0;i<cnt;++i) {
|
||||
IDataObject * dataObj = dataObjCol->GetDataObjectAt(i);
|
||||
|
@ -328,30 +359,37 @@ NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBo
|
|||
}
|
||||
} // if special collection object
|
||||
else {
|
||||
// Ok, so we have a single object. Check to see if has the correct data type. Since
|
||||
// this can come from an outside app, we also need to see if we need to perform
|
||||
// text->unicode conversion if the client asked for unicode and it wasn't available.
|
||||
// Ok, so we have a single object. Check to see if has the correct
|
||||
// data type. Since this can come from an outside app, we also
|
||||
// need to see if we need to perform text->unicode conversion if
|
||||
// the client asked for unicode and it wasn't available.
|
||||
format = nsClipboard::GetFormat(aDataFlavor);
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL | TYMED_FILE | TYMED_GDI);
|
||||
if ( mDataObject->QueryGetData(&fe) == S_OK )
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1,
|
||||
TYMED_HGLOBAL | TYMED_FILE | TYMED_GDI);
|
||||
if (mDataObject->QueryGetData(&fe) == S_OK)
|
||||
*_retval = PR_TRUE; // found it!
|
||||
else {
|
||||
// We haven't found the exact flavor the client asked for, but maybe we can
|
||||
// still find it from something else that's on the clipboard
|
||||
if ( strcmp(aDataFlavor, kUnicodeMime) == 0 ) {
|
||||
// client asked for unicode and it wasn't present, check if we have CF_TEXT.
|
||||
// We'll handle the actual data substitution in the data object.
|
||||
// We haven't found the exact flavor the client asked for, but
|
||||
// maybe we can still find it from something else that's on the
|
||||
// clipboard
|
||||
if (strcmp(aDataFlavor, kUnicodeMime) == 0) {
|
||||
// client asked for unicode and it wasn't present, check if we
|
||||
// have CF_TEXT. We'll handle the actual data substitution in
|
||||
// the data object.
|
||||
format = nsClipboard::GetFormat(kTextMime);
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL | TYMED_FILE | TYMED_GDI);
|
||||
if ( mDataObject->QueryGetData(&fe) == S_OK )
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1,
|
||||
TYMED_HGLOBAL | TYMED_FILE | TYMED_GDI);
|
||||
if (mDataObject->QueryGetData(&fe) == S_OK)
|
||||
*_retval = PR_TRUE; // found it!
|
||||
}
|
||||
else if ( strcmp(aDataFlavor, kURLMime) == 0 ) {
|
||||
// client asked for a url and it wasn't present, but if we have a file, then
|
||||
// we have a URL to give them (the path, or the internal URL if an InternetShortcut).
|
||||
else if (strcmp(aDataFlavor, kURLMime) == 0) {
|
||||
// client asked for a url and it wasn't present, but if we
|
||||
// have a file, then we have a URL to give them (the path, or
|
||||
// the internal URL if an InternetShortcut).
|
||||
format = nsClipboard::GetFormat(kFileMime);
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL | TYMED_FILE | TYMED_GDI);
|
||||
if ( mDataObject->QueryGetData(&fe) == S_OK )
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1,
|
||||
TYMED_HGLOBAL | TYMED_FILE | TYMED_GDI);
|
||||
if (mDataObject->QueryGetData(&fe) == S_OK)
|
||||
*_retval = PR_TRUE; // found it!
|
||||
}
|
||||
} // else try again
|
||||
|
@ -364,26 +402,28 @@ NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBo
|
|||
//
|
||||
// IsCollectionObject
|
||||
//
|
||||
// Determine if this is a single |IDataObject| or one of our private collection
|
||||
// objects. We know the difference because our collection object will respond to supporting
|
||||
// the private |MULTI_MIME| format.
|
||||
// Determine if this is a single |IDataObject| or one of our private
|
||||
// collection objects. We know the difference because our collection
|
||||
// object will respond to supporting the private |MULTI_MIME| format.
|
||||
//
|
||||
PRBool
|
||||
nsDragService :: IsCollectionObject ( IDataObject* inDataObj )
|
||||
nsDragService::IsCollectionObject(IDataObject* inDataObj)
|
||||
{
|
||||
PRBool isCollection = PR_FALSE;
|
||||
|
||||
// setup the format object to ask for the MULTI_MIME format. We only need to do this once
|
||||
|
||||
// setup the format object to ask for the MULTI_MIME format. We only
|
||||
// need to do this once
|
||||
static UINT sFormat = 0;
|
||||
static FORMATETC sFE;
|
||||
if ( !sFormat ) {
|
||||
if (!sFormat) {
|
||||
sFormat = nsClipboard::GetFormat(MULTI_MIME);
|
||||
SET_FORMATETC(sFE, sFormat, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL);
|
||||
}
|
||||
|
||||
// ask the object if it supports it. If yes, we have a collection object
|
||||
if ( inDataObj->QueryGetData(&sFE) == S_OK )
|
||||
isCollection = PR_TRUE;
|
||||
|
||||
// ask the object if it supports it. If yes, we have a collection
|
||||
// object
|
||||
if (inDataObj->QueryGetData(&sFE) == S_OK)
|
||||
isCollection = PR_TRUE;
|
||||
|
||||
return isCollection;
|
||||
|
||||
|
@ -393,12 +433,12 @@ nsDragService :: IsCollectionObject ( IDataObject* inDataObj )
|
|||
//
|
||||
// EndDragSession
|
||||
//
|
||||
// Override the default to make sure that we release the data object when the drag ends. It
|
||||
// seems that OLE doesn't like to let apps quit w/out crashing when we're still holding onto
|
||||
// their data
|
||||
// Override the default to make sure that we release the data object
|
||||
// when the drag ends. It seems that OLE doesn't like to let apps quit
|
||||
// w/out crashing when we're still holding onto their data
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsDragService::EndDragSession ()
|
||||
nsDragService::EndDragSession()
|
||||
{
|
||||
nsBaseDragService::EndDragSession();
|
||||
NS_IF_RELEASE(mDataObject);
|
||||
|
|
|
@ -51,33 +51,37 @@ class nsDataObjCollection;
|
|||
|
||||
class nsDragService : public nsBaseDragService
|
||||
{
|
||||
|
||||
public:
|
||||
nsDragService();
|
||||
virtual ~nsDragService();
|
||||
|
||||
// nsIDragService
|
||||
NS_IMETHOD InvokeDragSession (nsIDOMNode *aDOMNode, nsISupportsArray * anArrayTransferables, nsIScriptableRegion * aRegion, PRUint32 aActionType);
|
||||
NS_IMETHOD InvokeDragSession(nsIDOMNode *aDOMNode,
|
||||
nsISupportsArray *anArrayTransferables,
|
||||
nsIScriptableRegion *aRegion,
|
||||
PRUint32 aActionType);
|
||||
|
||||
// nsIDragSession
|
||||
NS_IMETHOD GetData (nsITransferable * aTransferable, PRUint32 anItem);
|
||||
NS_IMETHOD GetNumDropItems (PRUint32 * aNumItems);
|
||||
NS_IMETHOD GetData(nsITransferable * aTransferable, PRUint32 anItem);
|
||||
NS_IMETHOD GetNumDropItems(PRUint32 * aNumItems);
|
||||
NS_IMETHOD IsDataFlavorSupported(const char *aDataFlavor, PRBool *_retval);
|
||||
NS_IMETHOD EndDragSession ( ) ;
|
||||
NS_IMETHOD EndDragSession();
|
||||
|
||||
// native impl.
|
||||
NS_IMETHOD SetIDataObject (IDataObject * aDataObj);
|
||||
NS_IMETHOD StartInvokingDragSession(IDataObject * aDataObj, PRUint32 aActionType);
|
||||
NS_IMETHOD SetIDataObject(IDataObject * aDataObj);
|
||||
NS_IMETHOD StartInvokingDragSession(IDataObject * aDataObj,
|
||||
PRUint32 aActionType);
|
||||
|
||||
protected:
|
||||
nsDataObjCollection* GetDataObjCollection(IDataObject* aDataObj);
|
||||
nsDataObjCollection* GetDataObjCollection(IDataObject * aDataObj);
|
||||
|
||||
// determine if we have a single data object or one of our private collections
|
||||
PRBool IsCollectionObject ( IDataObject* inDataObj ) ;
|
||||
// determine if we have a single data object or one of our private
|
||||
// collections
|
||||
PRBool IsCollectionObject(IDataObject* inDataObj);
|
||||
|
||||
IDropSource * mNativeDragSrc;
|
||||
IDropSource * mNativeDragSrc;
|
||||
nsNativeDragTarget * mNativeDragTarget;
|
||||
IDataObject * mDataObject;
|
||||
IDataObject * mDataObject;
|
||||
};
|
||||
|
||||
#endif // nsDragService_h__
|
||||
|
|
Загрузка…
Ссылка в новой задаче