2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
27 #include "CachedResourceHandle.h"
28 #include "ClipboardAccessPolicy.h"
29 #include "DragActions.h"
30 #include "DragImage.h"
36 // State available during IE's events for drag and drop and copy/paste
37 class Clipboard
: public RefCounted
<Clipboard
> {
39 virtual ~Clipboard() { }
41 // Is this operation a drag-drop or a copy-paste?
42 bool isForDragging() const { return m_forDragging
; }
44 String
dropEffect() const { return m_dropEffect
; }
45 void setDropEffect(const String
&);
46 String
effectAllowed() const { return m_effectAllowed
; }
47 void setEffectAllowed(const String
&);
49 virtual void clearData(const String
& type
) = 0;
50 virtual void clearAllData() = 0;
51 virtual String
getData(const String
& type
, bool& success
) const = 0;
52 virtual bool setData(const String
& type
, const String
& data
) = 0;
54 // extensions beyond IE's API
55 virtual HashSet
<String
> types() const = 0;
57 IntPoint
dragLocation() const { return m_dragLoc
; }
58 CachedImage
* dragImage() const { return m_dragImage
.get(); }
59 virtual void setDragImage(CachedImage
*, const IntPoint
&) = 0;
60 Node
* dragImageElement() { return m_dragImageElement
.get(); }
61 virtual void setDragImageElement(Node
*, const IntPoint
&) = 0;
63 virtual DragImageRef
createDragImage(IntPoint
& dragLocation
) const = 0;
64 virtual void declareAndWriteDragImage(Element
*, const KURL
&, const String
& title
, Frame
*) = 0;
65 virtual void writeURL(const KURL
&, const String
&, Frame
*) = 0;
66 virtual void writeRange(Range
*, Frame
*) = 0;
68 virtual bool hasData() = 0;
70 void setAccessPolicy(ClipboardAccessPolicy
);
72 bool sourceOperation(DragOperation
&) const;
73 bool destinationOperation(DragOperation
&) const;
74 void setSourceOperation(DragOperation
);
75 void setDestinationOperation(DragOperation
);
77 void setDragHasStarted() { m_dragStarted
= true; }
80 Clipboard(ClipboardAccessPolicy
, bool isForDragging
);
82 ClipboardAccessPolicy
policy() const { return m_policy
; }
83 bool dragStarted() const { return m_dragStarted
; }
86 ClipboardAccessPolicy m_policy
;
88 String m_effectAllowed
;
94 CachedResourceHandle
<CachedImage
> m_dragImage
;
95 RefPtr
<Node
> m_dragImageElement
;
98 } // namespace WebCore
100 #endif // Clipboard_h