michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: #ifndef nsContentAreaDragDrop_h__ michael@0: #define nsContentAreaDragDrop_h__ michael@0: michael@0: michael@0: #include "nsCOMPtr.h" michael@0: michael@0: #include "nsIDOMEventListener.h" michael@0: #include "nsITransferable.h" michael@0: michael@0: class nsIDOMNode; michael@0: class nsPIDOMWindow; michael@0: class nsIDOMDragEvent; michael@0: class nsISelection; michael@0: class nsITransferable; michael@0: class nsIContent; michael@0: class nsIURI; michael@0: class nsIFile; michael@0: class nsISimpleEnumerator; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class DataTransfer; michael@0: } michael@0: } michael@0: michael@0: // michael@0: // class nsContentAreaDragDrop, used to generate the dragdata michael@0: // michael@0: class nsContentAreaDragDrop michael@0: { michael@0: public: michael@0: michael@0: /** michael@0: * Determine what data in the content area, if any, is being dragged. michael@0: * michael@0: * aWindow - the window containing the target node michael@0: * aTarget - the mousedown event target that started the drag michael@0: * aSelectionTargetNode - the node where the drag event should be fired michael@0: * aIsAltKeyPressed - true if the Alt key is pressed. In some cases, this michael@0: * will prevent the drag from occuring. For example, michael@0: * holding down Alt over a link should select the text, michael@0: * not drag the link. michael@0: * aDataTransfer - the dataTransfer for the drag event. michael@0: * aCanDrag - [out] set to true if the drag may proceed, false to stop the michael@0: * drag entirely michael@0: * aSelection - [out] set to the selection being dragged, or null if no michael@0: * selection is being dragged. michael@0: * aDragNode - [out] the link, image or area being dragged, or null if the michael@0: * drag occurred on another element. michael@0: */ michael@0: static nsresult GetDragData(nsPIDOMWindow* aWindow, michael@0: nsIContent* aTarget, michael@0: nsIContent* aSelectionTargetNode, michael@0: bool aIsAltKeyPressed, michael@0: mozilla::dom::DataTransfer* aDataTransfer, michael@0: bool* aCanDrag, michael@0: nsISelection** aSelection, michael@0: nsIContent** aDragNode); michael@0: }; michael@0: michael@0: // this is used to save images to disk lazily when the image data is asked for michael@0: // during the drop instead of when it is added to the drag data transfer. This michael@0: // ensures that the image data is only created when an image drop is allowed. michael@0: class nsContentAreaDragDropDataProvider : public nsIFlavorDataProvider michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIFLAVORDATAPROVIDER michael@0: michael@0: virtual ~nsContentAreaDragDropDataProvider() {} michael@0: michael@0: nsresult SaveURIToFile(nsAString& inSourceURIString, michael@0: nsIFile* inDestFile, bool isPrivate); michael@0: }; michael@0: michael@0: michael@0: #endif /* nsContentAreaDragDrop_h__ */ michael@0: