widget/windows/nsClipboard.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/widget/windows/nsClipboard.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,84 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsClipboard_h__
    1.10 +#define nsClipboard_h__
    1.11 +
    1.12 +#include "nsBaseClipboard.h"
    1.13 +#include "nsIURI.h"
    1.14 +#include <windows.h>
    1.15 +
    1.16 +class nsITransferable;
    1.17 +class nsIClipboardOwner;
    1.18 +class nsIWidget;
    1.19 +class nsIFile;
    1.20 +struct IDataObject;
    1.21 +
    1.22 +/**
    1.23 + * Native Win32 Clipboard wrapper
    1.24 + */
    1.25 +
    1.26 +class nsClipboard : public nsBaseClipboard,
    1.27 +                    public nsIObserver
    1.28 +{
    1.29 +
    1.30 +public:
    1.31 +  nsClipboard();
    1.32 +  virtual ~nsClipboard();
    1.33 +
    1.34 +  NS_DECL_ISUPPORTS_INHERITED
    1.35 +
    1.36 +  // nsIObserver
    1.37 +  NS_DECL_NSIOBSERVER
    1.38 +
    1.39 +  // nsIClipboard
    1.40 +  NS_IMETHOD HasDataMatchingFlavors(const char** aFlavorList, uint32_t aLength,
    1.41 +                                    int32_t aWhichClipboard, bool *_retval); 
    1.42 +  NS_IMETHOD EmptyClipboard(int32_t aWhichClipboard);
    1.43 +
    1.44 +  // Internal Native Routines
    1.45 +  static nsresult CreateNativeDataObject(nsITransferable * aTransferable, 
    1.46 +                                         IDataObject ** aDataObj,
    1.47 +                                         nsIURI       * uri);
    1.48 +  static nsresult SetupNativeDataObject(nsITransferable * aTransferable, 
    1.49 +                                        IDataObject * aDataObj);
    1.50 +  static nsresult GetDataFromDataObject(IDataObject     * aDataObject,
    1.51 +                                        UINT              anIndex,
    1.52 +                                        nsIWidget       * aWindow,
    1.53 +                                        nsITransferable * aTransferable);
    1.54 +  static nsresult GetNativeDataOffClipboard(nsIWidget * aWindow, UINT aIndex, UINT aFormat, void ** aData, uint32_t * aLen);
    1.55 +  static nsresult GetNativeDataOffClipboard(IDataObject * aDataObject, UINT aIndex, UINT aFormat, const char * aMIMEImageFormat, void ** aData, uint32_t * aLen);
    1.56 +  static nsresult GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLen);
    1.57 +  static UINT     GetFormat(const char* aMimeStr);
    1.58 +
    1.59 +  static UINT     CF_HTML;
    1.60 +  
    1.61 +protected:
    1.62 +  NS_IMETHOD SetNativeClipboardData ( int32_t aWhichClipboard );
    1.63 +  NS_IMETHOD GetNativeClipboardData ( nsITransferable * aTransferable, int32_t aWhichClipboard );
    1.64 +  
    1.65 +  static bool IsInternetShortcut ( const nsAString& inFileName ) ;
    1.66 +  static bool FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ;
    1.67 +  static bool FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ;
    1.68 +  static bool FindUnicodeFromPlainText ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ;
    1.69 +  static bool FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen );
    1.70 +  static void ResolveShortcut ( nsIFile* inFileName, nsACString& outURL ) ;
    1.71 +
    1.72 +  nsIWidget         * mWindow;
    1.73 +
    1.74 +};
    1.75 +
    1.76 +#define SET_FORMATETC(fe, cf, td, asp, li, med)   \
    1.77 +   {\
    1.78 +   (fe).cfFormat=cf;\
    1.79 +   (fe).ptd=td;\
    1.80 +   (fe).dwAspect=asp;\
    1.81 +   (fe).lindex=li;\
    1.82 +   (fe).tymed=med;\
    1.83 +   }
    1.84 +
    1.85 +
    1.86 +#endif // nsClipboard_h__
    1.87 +

mercurial