1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is Mozilla Communicator.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corp.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #include
"nsISupports.idl"
41 #include
"nsISupportsArray.idl"
42 #include
"nsIFormatConverter.idl"
47 // these probably shouldn't live here, but in some central repository shared
49 #define kTextMime
"text/plain"
50 #define kUnicodeMime
"text/unicode"
51 #define kHTMLMime
"text/html"
52 #define kAOLMailMime
"AOLMAIL"
53 #define kPNGImageMime
"image/png"
54 #define kJPEGImageMime
"image/jpg"
55 #define kGIFImageMime
"image/gif"
56 #define kFileMime
"application/x-moz-file"
58 #define kURLMime
"text/x-moz-url" // data contains url\ntitle
59 #define kURLDataMime
"text/x-moz-url-data" // data contains url only
60 #define kURLDescriptionMime
"text/x-moz-url-desc" // data contains description
61 #define kURLPrivateMime
"text/x-moz-url-priv" // same as kURLDataMime but for private uses
62 #define kNativeImageMime
"application/x-moz-nativeimage"
63 #define kNativeHTMLMime
"application/x-moz-nativehtml"
65 // the source URL for a file promise
66 #define kFilePromiseURLMime
"application/x-moz-file-promise-url"
67 // the destination filename for a file promise
68 #define kFilePromiseDestFilename
"application/x-moz-file-promise-dest-filename"
69 // a dataless flavor used to interact with the OS during file drags
70 #define kFilePromiseMime
"application/x-moz-file-promise"
71 // a synthetic flavor, put into the transferable once we know the destination directory of a file drag
72 #define kFilePromiseDirectoryMime
"application/x-moz-file-promise-dir"
78 * nsIFlavorDataProvider allows a flavor to 'promise' data later,
79 * supplying the data lazily.
81 * To use it, call setTransferData, passing the flavor string,
82 * a nsIFlavorDataProvider QI'd to nsISupports, and a data size of 0.
84 * When someone calls getTransferData later, if the data size is
85 * stored as 0, the nsISupports will be QI'd to nsIFlavorDataProvider,
86 * and its getFlavorData called.
89 interface nsITransferable
;
91 [scriptable
, uuid(7E225E5F
-711C
-11D7
-9FAE
-000393636592)]
92 interface nsIFlavorDataProvider
: nsISupports
96 * Retrieve the data from this data provider.
98 * @param aTransferable (in parameter) the transferable we're being called for.
99 * @param aFlavor (in parameter) the flavor of data to retrieve
100 * @param aData the data. Some variant of class in nsISupportsPrimitives.idl
101 * @param aDataLen the length of the data
103 void getFlavorData
(in nsITransferable aTransferable
, in string aFlavor
, out nsISupports aData
, out unsigned long aDataLen
);
107 [scriptable
, uuid(8B5314BC
-DB01
-11d2
-96CE
-0060B0FB9956
)]
108 interface nsITransferable
: nsISupports
110 const long kFlavorHasDataProvider
= 0;
113 * Computes a list of flavors (mime types as nsISupportsCString) that the transferable
114 * can export, either through intrinsic knowledge or output data converters.
116 * @param aDataFlavorList fills list with supported flavors. This is a copy of
117 * the internal list, so it may be edited w/out affecting the transferable.
119 nsISupportsArray flavorsTransferableCanExport
( ) ;
122 * Given a flavor retrieve the data.
124 * @param aFlavor (in parameter) the flavor of data to retrieve
125 * @param aData the data. Some variant of class in nsISupportsPrimitives.idl
126 * @param aDataLen the length of the data
128 void getTransferData
( in string aFlavor
, out nsISupports aData
, out unsigned long aDataLen
) ;
131 * Returns the best flavor in the transferable, given those that have
132 * been added to it with |AddFlavor()|
134 * @param aFlavor (out parameter) the flavor of data that was retrieved
135 * @param aData the data. Some variant of class in nsISupportsPrimitives.idl
136 * @param aDataLen the length of the data
138 void getAnyTransferData
( out string aFlavor
, out nsISupports aData
, out unsigned long aDataLen
) ;
141 * Returns true if the data is large.
143 boolean isLargeDataSet
( ) ;
146 ///////////////////////////////
147 // Setter part of interface
148 ///////////////////////////////
151 * Computes a list of flavors (mime types as nsISupportsCString) that the transferable can
152 * accept into it, either through intrinsic knowledge or input data converters.
154 * @param outFlavorList fills list with supported flavors. This is a copy of
155 * the internal list, so it may be edited w/out affecting the transferable.
157 nsISupportsArray flavorsTransferableCanImport
( ) ;
160 * Sets the data in the transferable with the specified flavor. The transferable
161 * will maintain its own copy the data, so it is not necessary to do that beforehand.
163 * @param aFlavor the flavor of data that is being set
164 * @param aData the data, either some variant of class in nsISupportsPrimitives.idl,
165 * an nsIFile, or an nsIFlavorDataProvider (see above)
166 * @param aDataLen the length of the data, or 0 if passing a nsIFlavorDataProvider
168 void setTransferData
( in string aFlavor
, in nsISupports aData
, in unsigned long aDataLen
) ;
171 * Add the data flavor, indicating that this transferable
172 * can receive this type of flavor
174 * @param aDataFlavor a new data flavor to handle
176 void addDataFlavor
( in string aDataFlavor
) ;
179 * Removes the data flavor matching the given one (string compare) and the data
180 * that goes along with it.
182 * @param aDataFlavor a data flavor to remove
184 void removeDataFlavor
( in string aDataFlavor
) ;
186 attribute nsIFormatConverter converter
;