2015-05-03 22:32:37 +03: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 15:12:37 +04: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 22:28:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef nsContentAreaDragDrop_h__
|
|
|
|
#define nsContentAreaDragDrop_h__
|
|
|
|
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2008-10-18 00:04:55 +04:00
|
|
|
#include "nsIDOMEventListener.h"
|
2003-04-19 00:20:04 +04:00
|
|
|
#include "nsITransferable.h"
|
2002-02-17 22:28:13 +03:00
|
|
|
|
2012-08-04 11:44:01 +04:00
|
|
|
class nsPIDOMWindow;
|
2002-02-17 22:28:13 +03:00
|
|
|
class nsISelection;
|
|
|
|
class nsITransferable;
|
2002-04-23 18:24:48 +04:00
|
|
|
class nsIContent;
|
2005-02-18 22:18:20 +03:00
|
|
|
class nsIFile;
|
2013-08-12 18:45:33 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class DataTransfer;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2002-02-17 22:28:13 +03:00
|
|
|
|
|
|
|
//
|
2010-04-18 22:27:18 +04:00
|
|
|
// class nsContentAreaDragDrop, used to generate the dragdata
|
2002-02-17 22:28:13 +03:00
|
|
|
//
|
2010-04-18 22:27:18 +04:00
|
|
|
class nsContentAreaDragDrop
|
2002-02-17 22:28:13 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2008-08-27 16:07:27 +04: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 18:16:59 +04:00
|
|
|
* aSelection - [out] set to the selection being dragged, or null if no
|
|
|
|
* selection is being dragged.
|
2008-08-27 16:07:27 +04:00
|
|
|
* aDragNode - [out] the link, image or area being dragged, or null if the
|
2010-05-13 16:19:50 +04:00
|
|
|
* drag occurred on another element.
|
2008-08-27 16:07:27 +04:00
|
|
|
*/
|
2012-08-04 11:44:01 +04:00
|
|
|
static nsresult GetDragData(nsPIDOMWindow* aWindow,
|
2008-08-27 16:07:27 +04:00
|
|
|
nsIContent* aTarget,
|
|
|
|
nsIContent* aSelectionTargetNode,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIsAltKeyPressed,
|
2013-08-12 18:45:33 +04:00
|
|
|
mozilla::dom::DataTransfer* aDataTransfer,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool* aCanDrag,
|
2012-02-17 18:16:59 +04:00
|
|
|
nsISelection** aSelection,
|
2008-08-27 16:07:27 +04:00
|
|
|
nsIContent** aDragNode);
|
2005-03-17 21:00:33 +03:00
|
|
|
};
|
2002-02-17 22:28:13 +03:00
|
|
|
|
2008-08-27 16:07:27 +04: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 06:09:15 +04:00
|
|
|
virtual ~nsContentAreaDragDropDataProvider() {}
|
|
|
|
|
2008-08-27 16:07:27 +04:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIFLAVORDATAPROVIDER
|
|
|
|
|
|
|
|
nsresult SaveURIToFile(nsAString& inSourceURIString,
|
2012-10-04 23:07:51 +04:00
|
|
|
nsIFile* inDestFile, bool isPrivate);
|
2008-08-27 16:07:27 +04:00
|
|
|
};
|
2002-02-17 22:28:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* nsContentAreaDragDrop_h__ */
|
|
|
|
|