1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsClipboard_h__
7 #define nsClipboard_h__
9 #include "nsBaseClipboard.h"
10 #include "nsIObserver.h"
14 class nsITransferable
;
15 class nsIClipboardOwner
;
21 * Native Win32 Clipboard wrapper
24 class nsClipboard
: public nsBaseClipboard
,
27 virtual ~nsClipboard();
32 NS_DECL_ISUPPORTS_INHERITED
38 NS_IMETHOD
HasDataMatchingFlavors(const char** aFlavorList
, uint32_t aLength
,
39 int32_t aWhichClipboard
, bool *_retval
);
40 NS_IMETHOD
EmptyClipboard(int32_t aWhichClipboard
);
42 // Internal Native Routines
43 static nsresult
CreateNativeDataObject(nsITransferable
* aTransferable
,
44 IDataObject
** aDataObj
,
46 static nsresult
SetupNativeDataObject(nsITransferable
* aTransferable
,
47 IDataObject
* aDataObj
);
48 static nsresult
GetDataFromDataObject(IDataObject
* aDataObject
,
51 nsITransferable
* aTransferable
);
52 static nsresult
GetNativeDataOffClipboard(nsIWidget
* aWindow
, UINT aIndex
, UINT aFormat
, void ** aData
, uint32_t * aLen
);
53 static nsresult
GetNativeDataOffClipboard(IDataObject
* aDataObject
, UINT aIndex
, UINT aFormat
, const char * aMIMEImageFormat
, void ** aData
, uint32_t * aLen
);
54 static nsresult
GetGlobalData(HGLOBAL aHGBL
, void ** aData
, uint32_t * aLen
);
55 static UINT
GetFormat(const char* aMimeStr
);
60 NS_IMETHOD
SetNativeClipboardData ( int32_t aWhichClipboard
);
61 NS_IMETHOD
GetNativeClipboardData ( nsITransferable
* aTransferable
, int32_t aWhichClipboard
);
63 static bool IsInternetShortcut ( const nsAString
& inFileName
) ;
64 static bool FindURLFromLocalFile ( IDataObject
* inDataObject
, UINT inIndex
, void** outData
, uint32_t* outDataLen
) ;
65 static bool FindURLFromNativeURL ( IDataObject
* inDataObject
, UINT inIndex
, void** outData
, uint32_t* outDataLen
) ;
66 static bool FindUnicodeFromPlainText ( IDataObject
* inDataObject
, UINT inIndex
, void** outData
, uint32_t* outDataLen
) ;
67 static bool FindPlatformHTML ( IDataObject
* inDataObject
, UINT inIndex
, void** outData
, uint32_t* outDataLen
);
68 static void ResolveShortcut ( nsIFile
* inFileName
, nsACString
& outURL
) ;
74 #define SET_FORMATETC(fe, cf, td, asp, li, med) \
84 #endif // nsClipboard_h__