editor/composer/public/nsIEditingSession.idl

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:e47192f508fe
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "nsISupports.idl"
7 #include "domstubs.idl"
8
9 interface nsIEditor;
10
11 [scriptable, uuid(24f3f4da-18a4-448d-876d-7360fefac029)]
12
13 interface nsIEditingSession : nsISupports
14 {
15 /**
16 * Error codes when we fail to create an editor
17 * is placed in attribute editorStatus
18 */
19 const long eEditorOK = 0;
20 const long eEditorCreationInProgress = 1;
21 const long eEditorErrorCantEditMimeType = 2;
22 const long eEditorErrorFileNotFound = 3;
23 const long eEditorErrorCantEditFramesets = 8;
24 const long eEditorErrorUnknown = 9;
25
26 /**
27 * Status after editor creation and document loading
28 * Value is one of the above error codes
29 */
30 readonly attribute unsigned long editorStatus;
31
32 /**
33 * Make this window editable
34 * @param aWindow nsIDOMWindow, the window the embedder needs to make editable
35 * @param aEditorType string, "html" "htmlsimple" "text" "textsimple"
36 * @param aMakeWholeDocumentEditable if PR_TRUE make the whole document in
37 * aWindow editable, otherwise it's the
38 * embedder who should make the document
39 * (or part of it) editable.
40 * @param aInteractive if PR_FALSE turn off scripting and plugins
41 */
42 void makeWindowEditable(in nsIDOMWindow window, in string aEditorType,
43 in boolean doAfterUriLoad,
44 in boolean aMakeWholeDocumentEditable,
45 in boolean aInteractive);
46
47 /**
48 * Test whether a specific window has had its editable flag set; it may have an editor
49 * now, or will get one after the uri load.
50 *
51 * Use this, passing the content root window, to test if we've set up editing
52 * for this content.
53 */
54 boolean windowIsEditable(in nsIDOMWindow window);
55
56 /**
57 * Get the editor for this window. May return null
58 */
59 nsIEditor getEditorForWindow(in nsIDOMWindow window);
60
61 /**
62 * Setup editor and related support objects
63 */
64 void setupEditorOnWindow(in nsIDOMWindow window);
65
66 /**
67 * Destroy editor and related support objects
68 */
69 void tearDownEditorOnWindow(in nsIDOMWindow window);
70
71 void setEditorOnControllers(in nsIDOMWindow aWindow,
72 in nsIEditor aEditor);
73
74 /**
75 * Disable scripts and plugins in aWindow.
76 */
77 void disableJSAndPlugins(in nsIDOMWindow aWindow);
78
79 /**
80 * Restore JS and plugins (enable/disable them) according to the state they
81 * were before the last call to disableJSAndPlugins.
82 */
83 void restoreJSAndPlugins(in nsIDOMWindow aWindow);
84
85 /**
86 * Removes all the editor's controllers/listeners etc and makes the window
87 * uneditable.
88 */
89 void detachFromWindow(in nsIDOMWindow aWindow);
90
91 /**
92 * Undos detachFromWindow(), reattaches this editing session/editor
93 * to the window.
94 */
95 void reattachToWindow(in nsIDOMWindow aWindow);
96
97 /**
98 * Whether this session has disabled JS and plugins.
99 */
100 readonly attribute boolean jsAndPluginsDisabled;
101 };
102

mercurial