summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/HTMLEditorObjectResizerUtils.h
blob: 2bebbe76ba4b1bf76938378e7020341c041ef134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */

#ifndef HTMLEditorObjectResizerUtils_h
#define HTMLEditorObjectResizerUtils_h

#include "nsIDOMEventListener.h"
#include "nsISelectionListener.h"
#include "nsISupportsImpl.h"
#include "nsIWeakReferenceUtils.h"
#include "nsLiteralString.h"

class nsIHTMLEditor;

namespace mozilla {

#define kTopLeft       NS_LITERAL_STRING("nw")
#define kTop           NS_LITERAL_STRING("n")
#define kTopRight      NS_LITERAL_STRING("ne")
#define kLeft          NS_LITERAL_STRING("w")
#define kRight         NS_LITERAL_STRING("e")
#define kBottomLeft    NS_LITERAL_STRING("sw")
#define kBottom        NS_LITERAL_STRING("s")
#define kBottomRight   NS_LITERAL_STRING("se")

/******************************************************************************
 * mozilla::ResizerSelectionListener
 ******************************************************************************/

class ResizerSelectionListener final : public nsISelectionListener
{
public:
  explicit ResizerSelectionListener(nsIHTMLEditor* aEditor);
  void Reset();

  NS_DECL_ISUPPORTS
  NS_DECL_NSISELECTIONLISTENER

protected:
  virtual ~ResizerSelectionListener() {}
  nsWeakPtr mEditor;
};

/******************************************************************************
 * mozilla::ResizerMouseMotionListener
 ******************************************************************************/

class ResizerMouseMotionListener final : public nsIDOMEventListener
{
public:
  explicit ResizerMouseMotionListener(nsIHTMLEditor* aEditor);

  NS_DECL_ISUPPORTS
  NS_DECL_NSIDOMEVENTLISTENER

protected:
  virtual ~ResizerMouseMotionListener() {}
  nsWeakPtr mEditor;
};

/******************************************************************************
 * mozilla::DocumentResizeEventListener
 ******************************************************************************/

class DocumentResizeEventListener final : public nsIDOMEventListener
{
public:
  explicit DocumentResizeEventListener(nsIHTMLEditor* aEditor);

  NS_DECL_ISUPPORTS
  NS_DECL_NSIDOMEVENTLISTENER

protected:
  virtual ~DocumentResizeEventListener() {}
  nsWeakPtr mEditor;
};

} // namespace mozilla

#endif // #ifndef HTMLEditorObjectResizerUtils_h