initial import
[vuplus_webkit] / Source / WebKit / mac / Misc / WebNSPasteboardExtras.h
1 /*
2  * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer. 
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution. 
13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14  *     its contributors may be used to endorse or promote products derived
15  *     from this software without specific prior written permission. 
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #import <Foundation/Foundation.h>
30
31 @class DOMElement;
32 @class WebArchive;
33 @class WebHTMLView;
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 extern NSString *WebURLPboardType;
40 extern NSString *WebURLNamePboardType;
41
42 @interface NSPasteboard (WebExtras)
43
44 // Returns the array of types that _web_writeURL:andTitle: handles.
45 + (NSArray *)_web_writableTypesForURL;
46
47 // Returns the array of types that _web_writeImage handles.
48 + (NSArray *)_web_writableTypesForImageIncludingArchive:(BOOL)hasArchive;
49
50 // Returns the array of drag types that _web_bestURL handles; note that the presence
51 // of one or more of these drag types on the pasteboard is not a guarantee that
52 // _web_bestURL will return a non-nil result.
53 + (NSArray *)_web_dragTypesForURL;
54
55 // Finds the best URL from the data on the pasteboard, giving priority to http and https URLs
56 - (NSURL *)_web_bestURL;
57
58 // Writes the URL to the pasteboard with the passed types.
59 - (void)_web_writeURL:(NSURL *)URL andTitle:(NSString *)title types:(NSArray *)types;
60
61 // Sets the text on the NSFindPboard. Returns the new changeCount for the NSFindPboard.
62 + (int)_web_setFindPasteboardString:(NSString *)string withOwner:(id)owner;
63
64 // Writes a file wrapper to the pasteboard as an RTFD attachment.
65 // NSRTFDPboardType must be declared on the pasteboard before calling this method.
66 - (void)_web_writeFileWrapperAsRTFDAttachment:(NSFileWrapper *)wrapper;
67
68 // Writes an image, URL and other optional types to the pasteboard.
69 - (void)_web_writeImage:(NSImage *)image 
70                 element:(DOMElement*)element
71                     URL:(NSURL *)URL 
72                   title:(NSString *)title
73                 archive:(WebArchive *)archive
74                   types:(NSArray *)types
75                  source:(WebHTMLView *)source;
76
77 - (id)_web_declareAndWriteDragImageForElement:(DOMElement *)element
78                                        URL:(NSURL *)URL 
79                                      title:(NSString *)title
80                                    archive:(WebArchive *)archive
81                                     source:(WebHTMLView *)source;
82
83 - (void)_web_writePromisedRTFDFromArchive:(WebArchive*)archive containsImage:(BOOL)containsImage;
84
85 @end
86
87 #ifdef __cplusplus
88 }
89 #endif