1
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3
* The contents of this file are subject to the Mozilla Public
4
* License Version 1.1 (the "License"); you may not use this file
5
* except in compliance with the License. You may obtain a copy of
6
* the License at http://www.mozilla.org/MPL/
8
* Software distributed under the License is distributed on an "AS
9
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
* implied. See the License for the specific language governing
11
* rights and limitations under the License.
13
* The Original Code is Mozilla Communicator.
15
* The Initial Developer of the Original Code is Netscape Communications
16
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
17
* Communications Corp. All Rights Reserved.
23
#include "nsISupports.idl"
24
#include "nsISupportsArray.idl"
25
#include "nsIFormatConverter.idl"
30
// these probably shouldn't live here, but in some central repository shared
32
#define kTextMime "text/plain"
33
#define kUnicodeMime "text/unicode"
34
#define kHTMLMime "text/html"
35
#define kAOLMailMime "AOLMAIL"
36
#define kPNGImageMime "image/png"
37
#define kJPEGImageMime "image/jpg"
38
#define kGIFImageMime "image/gif"
39
#define kFileMime "application/x-moz-file"
41
#define kURLMime "text/x-moz-url" // data contains url\ntitle
42
#define kURLDataMime "text/x-moz-url-data" // data contains url only
43
#define kURLDescriptionMime "text/x-moz-url-desc" // data contains description
44
#define kNativeImageMime "application/x-moz-nativeimage"
45
#define kNativeHTMLMime "application/x-moz-nativehtml"
47
// the source URL for a file promise
48
#define kFilePromiseURLMime "application/x-moz-file-promise-url"
49
// a dataless flavor used to interact with the OS during file drags
50
#define kFilePromiseMime "application/x-moz-file-promise"
51
// a synthetic flavor, put into the transferable once we know the destination directory of a file drag
52
#define kFilePromiseDirectoryMime "application/x-moz-file-promise-dir"
58
* nsIFlavorDataProvider allows a flavor to 'promise' data later,
59
* supplying the data lazily.
61
* To use it, call setTransferData, passing the flavor string,
62
* a nsIFlavorDataProvider QI'd to nsISupports, and a data size of 0.
64
* When someone calls getTransferData later, if the data size is
65
* stored as 0, the nsISupports will be QI'd to nsIFlavorDataProvider,
66
* and its getFlavorData called.
69
interface nsITransferable;
71
[scriptable, uuid(7E225E5F-711C-11D7-9FAE-000393636592)]
72
interface nsIFlavorDataProvider : nsISupports
76
* Retrieve the data from this data provider.
78
* @param aTransferable (in parameter) the transferable we're being called for.
79
* @param aFlavor (in parameter) the flavor of data to retrieve
80
* @param aData the data. Some variant of class in nsISupportsPrimitives.idl
81
* @param aDataLen the length of the data
83
void getFlavorData(in nsITransferable aTransferable, in string aFlavor, out nsISupports aData, out unsigned long aDataLen);
87
[scriptable, uuid(8B5314BC-DB01-11d2-96CE-0060B0FB9956)]
88
interface nsITransferable : nsISupports
90
const long kFlavorHasDataProvider = 0;
93
* Computes a list of flavors (mime types as nsISupportsCString) that the transferable
94
* can export, either through intrinsic knowledge or output data converters.
96
* @param aDataFlavorList fills list with supported flavors. This is a copy of
97
* the internal list, so it may be edited w/out affecting the transferable.
99
nsISupportsArray flavorsTransferableCanExport ( ) ;
102
* Given a flavor retrieve the data.
104
* @param aFlavor (in parameter) the flavor of data to retrieve
105
* @param aData the data. Some variant of class in nsISupportsPrimitives.idl
106
* @param aDataLen the length of the data
108
void getTransferData ( in string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
111
* Returns the best flavor in the transferable, given those that have
112
* been added to it with |AddFlavor()|
114
* @param aFlavor (out parameter) the flavor of data that was retrieved
115
* @param aData the data. Some variant of class in nsISupportsPrimitives.idl
116
* @param aDataLen the length of the data
118
void getAnyTransferData ( out string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
121
* Returns true if the data is large.
123
boolean isLargeDataSet ( ) ;
126
///////////////////////////////
127
// Setter part of interface
128
///////////////////////////////
131
* Computes a list of flavors (mime types as nsISupportsCString) that the transferable can
132
* accept into it, either through intrinsic knowledge or input data converters.
134
* @param outFlavorList fills list with supported flavors. This is a copy of
135
* the internal list, so it may be edited w/out affecting the transferable.
137
nsISupportsArray flavorsTransferableCanImport ( ) ;
140
* Sets the data in the transferable with the specified flavor. The transferable
141
* will maintain its own copy the data, so it is not necessary to do that beforehand.
143
* @param aFlavor the flavor of data that is being set
144
* @param aData the data, some variant of class in nsISupportsPrimitives.idl,
145
* or an nsIFlavorDataProvider (see above)
146
* @param aDataLen the length of the data, or 0 if passing a nsIFlavorDataProvider
148
void setTransferData ( in string aFlavor, in nsISupports aData, in unsigned long aDataLen ) ;
151
* Add the data flavor, indicating that this transferable
152
* can receive this type of flavor
154
* @param aDataFlavor a new data flavor to handle
156
void addDataFlavor ( in string aDataFlavor ) ;
159
* Removes the data flavor matching the given one (string compare) and the data
160
* that goes along with it.
162
* @param aDataFlavor a data flavor to remove
164
void removeDataFlavor ( in string aDataFlavor ) ;
166
attribute nsIFormatConverter converter;