2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsClipboard_h__
|
|
|
|
#define nsClipboard_h__
|
|
|
|
|
|
|
|
#include "nsBaseClipboard.h"
|
2014-07-14 12:35:30 -07:00
|
|
|
#include "nsIObserver.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIURI.h"
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
class nsITransferable;
|
|
|
|
class nsIClipboardOwner;
|
|
|
|
class nsIWidget;
|
2012-06-05 19:08:30 -07:00
|
|
|
class nsIFile;
|
2007-03-22 10:30:00 -07:00
|
|
|
struct IDataObject;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Native Win32 Clipboard wrapper
|
|
|
|
*/
|
|
|
|
|
2013-07-18 13:31:53 -07:00
|
|
|
class nsClipboard : public nsBaseClipboard,
|
|
|
|
public nsIObserver
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
nsClipboard();
|
|
|
|
virtual ~nsClipboard();
|
|
|
|
|
2013-07-18 13:31:53 -07:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIObserver
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsIClipboard
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD HasDataMatchingFlavors(const char** aFlavorList, uint32_t aLength,
|
|
|
|
int32_t aWhichClipboard, bool *_retval);
|
2013-02-19 17:51:02 -08:00
|
|
|
NS_IMETHOD EmptyClipboard(int32_t aWhichClipboard);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Internal Native Routines
|
|
|
|
static nsresult CreateNativeDataObject(nsITransferable * aTransferable,
|
|
|
|
IDataObject ** aDataObj,
|
|
|
|
nsIURI * uri);
|
|
|
|
static nsresult SetupNativeDataObject(nsITransferable * aTransferable,
|
|
|
|
IDataObject * aDataObj);
|
|
|
|
static nsresult GetDataFromDataObject(IDataObject * aDataObject,
|
|
|
|
UINT anIndex,
|
|
|
|
nsIWidget * aWindow,
|
|
|
|
nsITransferable * aTransferable);
|
2012-08-22 08:56:38 -07:00
|
|
|
static nsresult GetNativeDataOffClipboard(nsIWidget * aWindow, UINT aIndex, UINT aFormat, void ** aData, uint32_t * aLen);
|
|
|
|
static nsresult GetNativeDataOffClipboard(IDataObject * aDataObject, UINT aIndex, UINT aFormat, const char * aMIMEImageFormat, void ** aData, uint32_t * aLen);
|
|
|
|
static nsresult GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLen);
|
2007-03-22 10:30:00 -07:00
|
|
|
static UINT GetFormat(const char* aMimeStr);
|
|
|
|
|
|
|
|
static UINT CF_HTML;
|
|
|
|
|
|
|
|
protected:
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD SetNativeClipboardData ( int32_t aWhichClipboard );
|
|
|
|
NS_IMETHOD GetNativeClipboardData ( nsITransferable * aTransferable, int32_t aWhichClipboard );
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool IsInternetShortcut ( const nsAString& inFileName ) ;
|
2012-08-22 08:56:38 -07:00
|
|
|
static bool FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ;
|
|
|
|
static bool FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ;
|
|
|
|
static bool FindUnicodeFromPlainText ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ;
|
|
|
|
static bool FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen );
|
2012-06-05 19:08:30 -07:00
|
|
|
static void ResolveShortcut ( nsIFile* inFileName, nsACString& outURL ) ;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsIWidget * mWindow;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SET_FORMATETC(fe, cf, td, asp, li, med) \
|
2010-08-12 00:34:01 -07:00
|
|
|
{\
|
|
|
|
(fe).cfFormat=cf;\
|
|
|
|
(fe).ptd=td;\
|
|
|
|
(fe).dwAspect=asp;\
|
|
|
|
(fe).lindex=li;\
|
|
|
|
(fe).tymed=med;\
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
#endif // nsClipboard_h__
|
|
|
|
|