2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2002-02-17 19:28:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef nsContentAreaDragDrop_h__
|
|
|
|
#define nsContentAreaDragDrop_h__
|
|
|
|
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2008-10-17 20:04:55 +00:00
|
|
|
#include "nsIDOMEventListener.h"
|
2003-04-18 20:20:04 +00:00
|
|
|
#include "nsITransferable.h"
|
2002-02-17 19:28:13 +00:00
|
|
|
|
2016-01-30 17:05:36 +00:00
|
|
|
class nsPIDOMWindowOuter;
|
2002-02-17 19:28:13 +00:00
|
|
|
class nsISelection;
|
|
|
|
class nsITransferable;
|
2002-04-23 14:24:48 +00:00
|
|
|
class nsIContent;
|
2005-02-18 19:18:20 +00:00
|
|
|
class nsIFile;
|
2013-08-12 14:45:33 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class DataTransfer;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2002-02-17 19:28:13 +00:00
|
|
|
|
|
|
|
//
|
2010-04-18 18:27:18 +00:00
|
|
|
// class nsContentAreaDragDrop, used to generate the dragdata
|
2002-02-17 19:28:13 +00:00
|
|
|
//
|
2010-04-18 18:27:18 +00:00
|
|
|
class nsContentAreaDragDrop
|
2002-02-17 19:28:13 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2008-08-27 12:07:27 +00:00
|
|
|
/**
|
|
|
|
* Determine what data in the content area, if any, is being dragged.
|
|
|
|
*
|
|
|
|
* aWindow - the window containing the target node
|
|
|
|
* aTarget - the mousedown event target that started the drag
|
|
|
|
* aSelectionTargetNode - the node where the drag event should be fired
|
|
|
|
* aIsAltKeyPressed - true if the Alt key is pressed. In some cases, this
|
|
|
|
* will prevent the drag from occuring. For example,
|
|
|
|
* holding down Alt over a link should select the text,
|
|
|
|
* not drag the link.
|
|
|
|
* aDataTransfer - the dataTransfer for the drag event.
|
|
|
|
* aCanDrag - [out] set to true if the drag may proceed, false to stop the
|
|
|
|
* drag entirely
|
2012-02-17 14:16:59 +00:00
|
|
|
* aSelection - [out] set to the selection being dragged, or null if no
|
|
|
|
* selection is being dragged.
|
2008-08-27 12:07:27 +00:00
|
|
|
* aDragNode - [out] the link, image or area being dragged, or null if the
|
2010-05-13 12:19:50 +00:00
|
|
|
* drag occurred on another element.
|
2008-08-27 12:07:27 +00:00
|
|
|
*/
|
2016-01-30 17:05:36 +00:00
|
|
|
static nsresult GetDragData(nsPIDOMWindowOuter* aWindow,
|
2008-08-27 12:07:27 +00:00
|
|
|
nsIContent* aTarget,
|
|
|
|
nsIContent* aSelectionTargetNode,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aIsAltKeyPressed,
|
2013-08-12 14:45:33 +00:00
|
|
|
mozilla::dom::DataTransfer* aDataTransfer,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool* aCanDrag,
|
2012-02-17 14:16:59 +00:00
|
|
|
nsISelection** aSelection,
|
2008-08-27 12:07:27 +00:00
|
|
|
nsIContent** aDragNode);
|
2005-03-17 18:00:33 +00:00
|
|
|
};
|
2002-02-17 19:28:13 +00:00
|
|
|
|
2008-08-27 12:07:27 +00:00
|
|
|
// this is used to save images to disk lazily when the image data is asked for
|
|
|
|
// during the drop instead of when it is added to the drag data transfer. This
|
|
|
|
// ensures that the image data is only created when an image drop is allowed.
|
|
|
|
class nsContentAreaDragDropDataProvider : public nsIFlavorDataProvider
|
|
|
|
{
|
2014-06-25 02:09:15 +00:00
|
|
|
virtual ~nsContentAreaDragDropDataProvider() {}
|
|
|
|
|
2008-08-27 12:07:27 +00:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIFLAVORDATAPROVIDER
|
|
|
|
|
|
|
|
nsresult SaveURIToFile(nsAString& inSourceURIString,
|
2012-10-04 19:07:51 +00:00
|
|
|
nsIFile* inDestFile, bool isPrivate);
|
2008-08-27 12:07:27 +00:00
|
|
|
};
|
2002-02-17 19:28:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* nsContentAreaDragDrop_h__ */
|
|
|
|
|