зеркало из https://github.com/mozilla/gecko-dev.git
fix QI lameness and use macros.
This commit is contained in:
Родитель
d768ee5389
Коммит
019167bea9
|
@ -40,9 +40,6 @@
|
|||
// The class statics:
|
||||
GtkWidget* nsClipboard::sWidget = 0;
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsClipboard, nsBaseClipboard)
|
||||
NS_IMPL_RELEASE_INHERITED(nsClipboard, nsBaseClipboard)
|
||||
|
||||
|
||||
#if defined(DEBUG_akkana) || defined(DEBUG_mcafee) || defined(DEBUG_pavlov)
|
||||
#define DEBUG_CLIPBOARD
|
||||
|
@ -154,29 +151,6 @@ nsClipboard::~nsClipboard()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
|
||||
if (aIID.Equals(nsIClipboard::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIClipboard*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// GTK Weirdness!
|
||||
|
|
|
@ -38,9 +38,6 @@ public:
|
|||
nsClipboard();
|
||||
virtual ~nsClipboard();
|
||||
|
||||
//nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIClipboard
|
||||
NS_IMETHOD ForceDataToClipboard();
|
||||
|
||||
|
|
|
@ -28,9 +28,6 @@ static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID);
|
|||
// The class statics:
|
||||
GtkWidget* nsDragService::sWidget = 0;
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// static variables
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -55,29 +52,6 @@ nsDragService::~nsDragService()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @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(nsIDragService::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIDragService*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::StartDragSession (nsITransferable * aTransferable, PRUint32 aActionType)
|
||||
|
|
|
@ -33,10 +33,6 @@ class nsDragService : public nsBaseDragService
|
|||
public:
|
||||
nsDragService();
|
||||
virtual ~nsDragService();
|
||||
|
||||
//nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
||||
//nsIDragService
|
||||
NS_IMETHOD StartDragSession (nsITransferable * aTransferable,
|
||||
|
|
|
@ -42,11 +42,6 @@
|
|||
#include <Scrap.h>
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsClipboard, nsBaseClipboard)
|
||||
NS_IMPL_RELEASE_INHERITED(nsClipboard, nsBaseClipboard)
|
||||
//NS_IMPL_QUERY_INTERFACE1(nsClipboard, nsIClipboard)
|
||||
|
||||
|
||||
//
|
||||
// nsClipboard constructor
|
||||
//
|
||||
|
@ -62,33 +57,6 @@ nsClipboard::~nsClipboard()
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// SetNativeClipboardData
|
||||
//
|
||||
|
|
|
@ -39,9 +39,6 @@ public:
|
|||
nsClipboard();
|
||||
virtual ~nsClipboard();
|
||||
|
||||
//nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIClipboard
|
||||
//NS_IMETHOD ForceDataToClipboard();
|
||||
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
|
||||
DragSendDataUPP nsDragService::sDragSendDataUPP = NewDragSendDataProc(DragSendDataProc);
|
||||
|
||||
// we need our own stuff for MacOS because of nsIDragSessionMac.
|
||||
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
|
||||
NS_IMPL_QUERY_INTERFACE3(nsDragService, nsIDragService, nsIDragSession, nsIDragSessionMac)
|
||||
|
||||
|
||||
//
|
||||
// DragService constructor
|
||||
|
@ -57,17 +62,6 @@ nsDragService::~nsDragService()
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// AddRef
|
||||
// Release
|
||||
// QueryInterface
|
||||
//
|
||||
// handle the QI for nsIDragSessionMac and farm off anything else to the parent
|
||||
// class.
|
||||
//
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsDragService,nsBaseDragService,nsIDragSessionMac);
|
||||
|
||||
|
||||
//
|
||||
// StartDragSession
|
||||
//
|
||||
|
|
|
@ -44,9 +44,9 @@ public:
|
|||
nsDragService();
|
||||
virtual ~nsDragService();
|
||||
|
||||
//nsISupports
|
||||
//nsISupports - can't use inherited because of nsIDragSessionMac
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
||||
//nsIDragService
|
||||
NS_IMETHOD InvokeDragSession (nsISupportsArray * anArrayTransferables, nsIRegion * aRegion, PRUint32 aActionType);
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
#include "OLEIDL.H"
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDragService, nsBaseDragService)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDragService, nsBaseDragService)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// DragService constructor
|
||||
|
@ -60,40 +57,6 @@ nsDragService::~nsDragService()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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)
|
||||
*
|
||||
*/
|
||||
// clean me up! ;)
|
||||
nsresult nsDragService::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsresult rv = nsBaseDragService::QueryInterface(aIID, aInstancePtr);
|
||||
if (NS_OK == rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIDragService))) {
|
||||
*aInstancePtr = (void*) ((nsIDragService*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIDragSession))) {
|
||||
*aInstancePtr = (void*) ((nsIDragSession*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsDragService::InvokeDragSession (nsISupportsArray * anArrayTransferables, nsIRegion * aRegion, PRUint32 aActionType)
|
||||
{
|
||||
|
@ -236,6 +199,7 @@ NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBo
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
// First check to see if the mDataObject is is Collection of IDataObjects
|
||||
*_retval = PR_FALSE;
|
||||
UINT format = nsClipboard::GetFormat(MULTI_MIME);
|
||||
FORMATETC fe;
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL);
|
||||
|
@ -246,11 +210,8 @@ NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBo
|
|||
format = nsClipboard::GetFormat(aDataFlavor);
|
||||
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL | TYMED_FILE | TYMED_GDI);
|
||||
|
||||
if (S_OK == mDataObject->QueryGetData(&fe)) {
|
||||
return NS_OK;
|
||||
} else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (S_OK == mDataObject->QueryGetData(&fe))
|
||||
*_retval = PR_TRUE;;
|
||||
}
|
||||
|
||||
// Set it up for the data flavor
|
||||
|
@ -264,12 +225,11 @@ NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, PRBo
|
|||
PRUint32 cnt = dataObjCol->GetNumDataObjects();
|
||||
for (i=0;i<cnt;i++) {
|
||||
IDataObject * dataObj = dataObjCol->GetDataObjectAt(i);
|
||||
if (S_OK == dataObj->QueryGetData(&fe)) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (S_OK == dataObj->QueryGetData(&fe))
|
||||
*_retval = PR_TRUE;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
|
@ -35,10 +35,6 @@ class nsDragService : public nsBaseDragService
|
|||
public:
|
||||
nsDragService();
|
||||
virtual ~nsDragService();
|
||||
|
||||
//nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
||||
// nsIDragService
|
||||
NS_IMETHOD InvokeDragSession (nsISupportsArray * anArrayTransferables, nsIRegion * aRegion, PRUint32 aActionType);
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
NS_IMPL_ADDREF(nsBaseClipboard)
|
||||
NS_IMPL_RELEASE(nsBaseClipboard)
|
||||
NS_IMPL_QUERY_INTERFACE1(nsBaseClipboard, nsIClipboard);
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -54,30 +56,6 @@ nsBaseClipboard::~nsBaseClipboard()
|
|||
EmptyClipboard();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 nsBaseClipboard::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsresult rv = NS_NOINTERFACE;
|
||||
|
||||
if (aIID.Equals(nsCOMTypeInfo<nsIClipboard>::GetIID())) {
|
||||
*aInstancePtr = (void*) ((nsIClipboard*)this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the transferable object
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
NS_IMPL_ADDREF(nsBaseDragService)
|
||||
NS_IMPL_RELEASE(nsBaseDragService)
|
||||
NS_IMPL_QUERY_INTERFACE2(nsBaseDragService, nsIDragService, nsIDragSession)
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -56,32 +58,6 @@ nsBaseDragService::~nsBaseDragService()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 nsBaseDragService::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (NULL == aInstancePtr)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv = NS_NOINTERFACE;
|
||||
|
||||
if ( aIID.Equals(nsCOMTypeInfo<nsIDragService>::GetIID()) ) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIDragService*,this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
else if (aIID.Equals(nsCOMTypeInfo<nsIDragSession>::GetIID())) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIDragSession*,this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
NS_IMETHODIMP nsBaseDragService::SetCanDrop (PRBool aCanDrop)
|
||||
|
|
|
@ -44,8 +44,7 @@ Notes to self:
|
|||
|
||||
NS_IMPL_ADDREF(nsTransferable)
|
||||
NS_IMPL_RELEASE(nsTransferable)
|
||||
// NS_IMPL_QUERY_INTERFACE1(nsITransferable)
|
||||
NS_IMPL_QUERY_INTERFACE(nsTransferable, NS_GET_IID(nsITransferable))
|
||||
NS_IMPL_QUERY_INTERFACE1(nsTransferable, nsITransferable)
|
||||
|
||||
|
||||
// million bytes
|
||||
|
|
|
@ -50,7 +50,8 @@ static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);
|
|||
|
||||
NS_IMPL_ADDREF(nsXIFFormatConverter)
|
||||
NS_IMPL_RELEASE(nsXIFFormatConverter)
|
||||
NS_IMPL_QUERY_INTERFACE(nsXIFFormatConverter, NS_GET_IID(nsIFormatConverter))
|
||||
NS_IMPL_QUERY_INTERFACE1(nsXIFFormatConverter, nsIFormatConverter)
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
|
|
Загрузка…
Ссылка в новой задаче