michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsClipboard_h__ michael@0: #define nsClipboard_h__ michael@0: michael@0: #include "nsBaseClipboard.h" michael@0: #include "nsIURI.h" michael@0: #include michael@0: michael@0: class nsITransferable; michael@0: class nsIClipboardOwner; michael@0: class nsIWidget; michael@0: class nsIFile; michael@0: struct IDataObject; michael@0: michael@0: /** michael@0: * Native Win32 Clipboard wrapper michael@0: */ michael@0: michael@0: class nsClipboard : public nsBaseClipboard, michael@0: public nsIObserver michael@0: { michael@0: michael@0: public: michael@0: nsClipboard(); michael@0: virtual ~nsClipboard(); michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: // nsIObserver michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: // nsIClipboard michael@0: NS_IMETHOD HasDataMatchingFlavors(const char** aFlavorList, uint32_t aLength, michael@0: int32_t aWhichClipboard, bool *_retval); michael@0: NS_IMETHOD EmptyClipboard(int32_t aWhichClipboard); michael@0: michael@0: // Internal Native Routines michael@0: static nsresult CreateNativeDataObject(nsITransferable * aTransferable, michael@0: IDataObject ** aDataObj, michael@0: nsIURI * uri); michael@0: static nsresult SetupNativeDataObject(nsITransferable * aTransferable, michael@0: IDataObject * aDataObj); michael@0: static nsresult GetDataFromDataObject(IDataObject * aDataObject, michael@0: UINT anIndex, michael@0: nsIWidget * aWindow, michael@0: nsITransferable * aTransferable); michael@0: static nsresult GetNativeDataOffClipboard(nsIWidget * aWindow, UINT aIndex, UINT aFormat, void ** aData, uint32_t * aLen); michael@0: static nsresult GetNativeDataOffClipboard(IDataObject * aDataObject, UINT aIndex, UINT aFormat, const char * aMIMEImageFormat, void ** aData, uint32_t * aLen); michael@0: static nsresult GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLen); michael@0: static UINT GetFormat(const char* aMimeStr); michael@0: michael@0: static UINT CF_HTML; michael@0: michael@0: protected: michael@0: NS_IMETHOD SetNativeClipboardData ( int32_t aWhichClipboard ); michael@0: NS_IMETHOD GetNativeClipboardData ( nsITransferable * aTransferable, int32_t aWhichClipboard ); michael@0: michael@0: static bool IsInternetShortcut ( const nsAString& inFileName ) ; michael@0: static bool FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ; michael@0: static bool FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ; michael@0: static bool FindUnicodeFromPlainText ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ; michael@0: static bool FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ); michael@0: static void ResolveShortcut ( nsIFile* inFileName, nsACString& outURL ) ; michael@0: michael@0: nsIWidget * mWindow; michael@0: michael@0: }; michael@0: michael@0: #define SET_FORMATETC(fe, cf, td, asp, li, med) \ michael@0: {\ michael@0: (fe).cfFormat=cf;\ michael@0: (fe).ptd=td;\ michael@0: (fe).dwAspect=asp;\ michael@0: (fe).lindex=li;\ michael@0: (fe).tymed=med;\ michael@0: } michael@0: michael@0: michael@0: #endif // nsClipboard_h__ michael@0: