~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/widget/public/nsITransferable.idl

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 
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/
 
7
 * 
 
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.
 
12
 * 
 
13
 * The Original Code is Mozilla Communicator.
 
14
 * 
 
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.
 
18
 * 
 
19
 * Contributor(s): 
 
20
 *   Mike Pinkerton
 
21
 */
 
22
 
 
23
#include "nsISupports.idl"
 
24
#include "nsISupportsArray.idl"
 
25
#include "nsIFormatConverter.idl"
 
26
 
 
27
 
 
28
%{ C++
 
29
 
 
30
// these probably shouldn't live here, but in some central repository shared
 
31
// by the entire app.
 
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"
 
40
 
 
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"
 
46
 
 
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"
 
53
 
 
54
%}
 
55
 
 
56
 
 
57
/**
 
58
  * nsIFlavorDataProvider allows a flavor to 'promise' data later,
 
59
  * supplying the data lazily.
 
60
  * 
 
61
  * To use it, call setTransferData, passing the flavor string,
 
62
  * a nsIFlavorDataProvider QI'd to nsISupports, and a data size of 0.
 
63
  *
 
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.
 
67
  *
 
68
  */
 
69
interface nsITransferable;
 
70
 
 
71
[scriptable, uuid(7E225E5F-711C-11D7-9FAE-000393636592)]
 
72
interface nsIFlavorDataProvider : nsISupports
 
73
{
 
74
 
 
75
  /**
 
76
    * Retrieve the data from this data provider.
 
77
    *
 
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
 
82
    */
 
83
  void getFlavorData(in nsITransferable aTransferable, in string aFlavor, out nsISupports aData, out unsigned long aDataLen);
 
84
};
 
85
 
 
86
 
 
87
[scriptable, uuid(8B5314BC-DB01-11d2-96CE-0060B0FB9956)]
 
88
interface nsITransferable : nsISupports
 
89
{
 
90
  const long kFlavorHasDataProvider = 0;
 
91
  
 
92
  /**
 
93
    * Computes a list of flavors (mime types as nsISupportsCString) that the transferable 
 
94
    * can export, either through intrinsic knowledge or output data converters.
 
95
    *
 
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.
 
98
    */
 
99
  nsISupportsArray flavorsTransferableCanExport ( ) ;
 
100
 
 
101
  /**
 
102
    * Given a flavor retrieve the data. 
 
103
    *
 
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
 
107
    */
 
108
  void getTransferData ( in string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
 
109
 
 
110
  /**
 
111
    * Returns the best flavor in the transferable, given those that have
 
112
    * been added to it with |AddFlavor()|
 
113
    *
 
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
 
117
    */
 
118
  void getAnyTransferData ( out string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
 
119
 
 
120
  /**
 
121
    * Returns true if the data is large.
 
122
    */
 
123
  boolean isLargeDataSet ( ) ;
 
124
  
 
125
 
 
126
    ///////////////////////////////
 
127
    // Setter part of interface 
 
128
    ///////////////////////////////
 
129
 
 
130
  /**
 
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.
 
133
    *
 
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.
 
136
    */
 
137
  nsISupportsArray flavorsTransferableCanImport ( ) ;
 
138
 
 
139
  /**
 
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.
 
142
    *
 
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
 
147
    */
 
148
  void setTransferData ( in string aFlavor, in nsISupports aData, in unsigned long aDataLen ) ;
 
149
 
 
150
  /**
 
151
    * Add the data flavor, indicating that this transferable 
 
152
    * can receive this type of flavor
 
153
    *
 
154
    * @param  aDataFlavor a new data flavor to handle
 
155
    */
 
156
  void addDataFlavor ( in string aDataFlavor ) ;
 
157
 
 
158
  /**
 
159
    * Removes the data flavor matching the given one (string compare) and the data
 
160
    * that goes along with it.
 
161
    *
 
162
    * @param  aDataFlavor a data flavor to remove
 
163
    */
 
164
  void removeDataFlavor ( in string aDataFlavor ) ;
 
165
 
 
166
  attribute nsIFormatConverter converter;
 
167
 
 
168
};
 
169