1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7#include "nsISupports.idl"
8
9/**
10 * An interface for embedding clients who wish to interact with
11 * the system-wide OS clipboard. Mozilla does not use a private
12 * clipboard, instead it places its data directly onto the system
13 * clipboard. The webshell implements this interface.
14 */
15
16[scriptable, uuid(b8100c90-73be-11d2-92a5-00105a1b0d64)]
17interface nsIClipboardCommands : nsISupports {
18
19  /**
20   * Returns whether there is a selection and it is not read-only.
21   *
22   * @return <code>true</code> if the current selection can be cut,
23   *          <code>false</code> otherwise.
24   */
25  boolean canCutSelection();
26
27  /**
28   * Returns whether there is a selection and it is copyable.
29   *
30   * @return <code>true</code> if there is a selection,
31   *          <code>false</code> otherwise.
32   */
33  boolean canCopySelection();
34
35  /**
36   * Returns whether we can copy a link location.
37   *
38   * @return <code>true</code> if a link is selected,
39   *           <code>false</code> otherwise.
40   */
41  boolean canCopyLinkLocation();
42
43  /**
44   * Returns whether we can copy an image location.
45   *
46   * @return <code>true</code> if an image is selected,
47              <code>false</code> otherwise.
48   */
49  boolean canCopyImageLocation();
50
51  /**
52   * Returns whether we can copy an image's contents.
53   *
54   * @return <code>true</code> if an image is selected,
55   *          <code>false</code> otherwise
56   */
57  boolean canCopyImageContents();
58
59  /**
60   * Returns whether the current contents of the clipboard can be
61   * pasted and if the current selection is not read-only.
62   *
63   * @return <code>true</code> there is data to paste on the clipboard
64   *          and the current selection is not read-only,
65   *          <code>false</code> otherwise
66   */
67  boolean canPaste();
68
69  /**
70   * Cut the current selection onto the clipboard.
71   */
72  void cutSelection();
73
74  /**
75   * Copy the current selection onto the clipboard.
76   */
77  void copySelection();
78
79  /**
80   * Copy the link location of the current selection (e.g.,
81   * the |href| attribute of a selected |a| tag).
82   */
83  void copyLinkLocation();
84
85  /**
86   * Copy the location of the selected image.
87   */
88  void copyImageLocation();
89
90  /**
91   * Copy the contents of the selected image.
92   */
93  void copyImageContents();
94
95  /**
96   * Paste the contents of the clipboard into the current selection.
97   */
98  void paste();
99
100  /**
101   * Select the entire contents.
102   */
103  void selectAll();
104
105  /**
106   * Clear the current selection (if any). Insertion point ends up
107   * at beginning of current selection.
108   */
109  void selectNone();
110
111};
112