From 850d21470f74e2ac34d64c4adfa777a4de75921b Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Mon, 5 Apr 1999 21:45:17 +0000 Subject: [PATCH] Removed. It is now in xpwidgets git-svn-id: svn://10.0.0.236/trunk@26332 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/windows/nsDataFlavor.cpp | 125 --------- mozilla/widget/src/windows/nsDataFlavor.h | 66 ----- mozilla/widget/src/windows/nsTransferable.cpp | 241 ------------------ mozilla/widget/src/windows/nsTransferable.h | 67 ----- 4 files changed, 499 deletions(-) delete mode 100644 mozilla/widget/src/windows/nsDataFlavor.cpp delete mode 100644 mozilla/widget/src/windows/nsDataFlavor.h delete mode 100644 mozilla/widget/src/windows/nsTransferable.cpp delete mode 100644 mozilla/widget/src/windows/nsTransferable.h diff --git a/mozilla/widget/src/windows/nsDataFlavor.cpp b/mozilla/widget/src/windows/nsDataFlavor.cpp deleted file mode 100644 index ea28915e96e..00000000000 --- a/mozilla/widget/src/windows/nsDataFlavor.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- 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 - -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; -} - diff --git a/mozilla/widget/src/windows/nsDataFlavor.h b/mozilla/widget/src/windows/nsDataFlavor.h deleted file mode 100644 index 7e54bf353d3..00000000000 --- a/mozilla/widget/src/windows/nsDataFlavor.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- 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 -#include "OLEIDL.H" -//#include - -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__ diff --git a/mozilla/widget/src/windows/nsTransferable.cpp b/mozilla/widget/src/windows/nsTransferable.cpp deleted file mode 100644 index 272c8d480fd..00000000000 --- a/mozilla/widget/src/windows/nsTransferable.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* -*- 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;iCount();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; - } else if (mimeInQuestion.Equals(kHTMLMime)) { - - } - - return NS_OK; -} - -/** - * - * - */ -NS_IMETHODIMP nsTransferable::SetTransferData(nsIDataFlavor * aDataFlavor, void * aData, PRUint32 aDataLen) -{ - if (aData == nsnull) { - return NS_OK; - } - - 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; -} - -/** - * - * - */ -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); - - return rv; -} - -/** - * - * - */ -NS_IMETHODIMP nsTransferable::IsLargeDataSet() -{ - if (mStrCache) { - return (mStrCache->Length() > 1024?NS_OK:NS_ERROR_FAILURE); - } - - return NS_ERROR_FAILURE; -} - diff --git a/mozilla/widget/src/windows/nsTransferable.h b/mozilla/widget/src/windows/nsTransferable.h deleted file mode 100644 index b4ea8051511..00000000000 --- a/mozilla/widget/src/windows/nsTransferable.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- 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; - -/** - * 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 IsLargeDataSet(); - - // Used for native implementation - nsDataObj * GetDataObj() { return mDataObj; } - -protected: - - nsISupportsArray * mDFList; - nsDataObj * mDataObj; - - nsString * mStrCache; - void * mDataPtr; -}; - -#endif // nsTransferable_h__