1/*
2 * Copyright (C) 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 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef ClipboardUtilitiesWin_h
27#define ClipboardUtilitiesWin_h
28
29#include "DragData.h"
30#include <windows.h>
31#include <wtf/Forward.h>
32
33namespace WebCore {
34
35class Document;
36class URL;
37
38HGLOBAL createGlobalData(const String&);
39HGLOBAL createGlobalData(const Vector<char>&);
40HGLOBAL createGlobalData(const URL& url, const String& title);
41
42FORMATETC* urlWFormat();
43FORMATETC* urlFormat();
44FORMATETC* plainTextWFormat();
45FORMATETC* plainTextFormat();
46FORMATETC* filenameWFormat();
47FORMATETC* filenameFormat();
48FORMATETC* htmlFormat();
49FORMATETC* cfHDropFormat();
50FORMATETC* smartPasteFormat();
51FORMATETC* fileDescriptorFormat();
52FORMATETC* fileContentFormatZero();
53
54void markupToCFHTML(const String& markup, const String& srcURL, Vector<char>& result);
55
56void replaceNewlinesWithWindowsStyleNewlines(String&);
57void replaceNBSPWithSpace(String&);
58
59bool containsFilenames(const IDataObject*);
60bool containsFilenames(const DragDataMap*);
61bool containsHTML(IDataObject*);
62bool containsHTML(const DragDataMap*);
63
64PassRefPtr<DocumentFragment> fragmentFromFilenames(Document*, const IDataObject*);
65PassRefPtr<DocumentFragment> fragmentFromFilenames(Document*, const DragDataMap*);
66PassRefPtr<DocumentFragment> fragmentFromHTML(Document*, IDataObject*);
67PassRefPtr<DocumentFragment> fragmentFromHTML(Document*, const DragDataMap*);
68PassRefPtr<DocumentFragment> fragmentFromCFHTML(Document*, const String& cfhtml);
69
70String getURL(IDataObject*, DragData::FilenameConversionPolicy, String* title = 0);
71String getURL(const DragDataMap*, DragData::FilenameConversionPolicy, String* title = 0);
72String getPlainText(IDataObject*);
73String getPlainText(const DragDataMap*);
74String getTextHTML(IDataObject*);
75String getTextHTML(const DragDataMap*);
76String getCFHTML(IDataObject*);
77String getCFHTML(const DragDataMap*);
78
79void getClipboardData(IDataObject*, FORMATETC* fetc, Vector<String>& dataStrings);
80void setClipboardData(IDataObject*, UINT format, const Vector<String>& dataStrings);
81void getFileDescriptorData(IDataObject*, int& size, String& pathname);
82void getFileContentData(IDataObject*, int size, void* dataBlob);
83void setFileDescriptorData(IDataObject*, int size, const String& pathname);
84void setFileContentData(IDataObject*, int size, void* dataBlob);
85
86} // namespace WebCore
87
88#endif // ClipboardUtilitiesWin_h
89