Backed out changeset f85447f6f56d (bug 1891145) for causing mochitest failures @...
[gecko.git] / editor / composer / nsIEditingSession.idl
blob9691092ce8ee9471801792a469ad552e279252b0
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/. */
6 #include "nsISupports.idl"
7 #include "domstubs.idl"
9 interface mozIDOMWindowProxy;
10 interface nsIEditor;
12 %{ C++
13 class mozIDOMWindowProxy;
14 namespace mozilla {
15 class HTMLEditor;
16 } // namespace mozilla
19 [scriptable, builtinclass, uuid(24f963d1-e6fc-43ea-a206-99ac5fcc5265)]
20 interface nsIEditingSession : nsISupports
22 /**
23 * Error codes when we fail to create an editor
24 * is placed in attribute editorStatus
26 const long eEditorOK = 0;
27 const long eEditorCreationInProgress = 1;
28 const long eEditorErrorCantEditMimeType = 2;
29 const long eEditorErrorFileNotFound = 3;
30 const long eEditorErrorCantEditFramesets = 8;
31 const long eEditorErrorUnknown = 9;
33 /**
34 * Status after editor creation and document loading
35 * Value is one of the above error codes
37 readonly attribute unsigned long editorStatus;
39 /**
40 * Make this window editable
41 * @param aWindow nsIDOMWindow, the window the embedder needs to make editable
42 * @param aEditorType string, "html" "htmlsimple" "text" "textsimple"
43 * @param aMakeWholeDocumentEditable if PR_TRUE make the whole document in
44 * aWindow editable, otherwise it's the
45 * embedder who should make the document
46 * (or part of it) editable.
47 * @param aInteractive if PR_FALSE turn off scripting and plugins
49 [can_run_script]
50 void makeWindowEditable(in mozIDOMWindowProxy window,
51 in string aEditorType,
52 in boolean doAfterUriLoad,
53 in boolean aMakeWholeDocumentEditable,
54 in boolean aInteractive);
56 /**
57 * Test whether a specific window has had its editable flag set; it may have an editor
58 * now, or will get one after the uri load.
60 * Use this, passing the content root window, to test if we've set up editing
61 * for this content.
63 boolean windowIsEditable(in mozIDOMWindowProxy window);
65 /**
66 * Get the editor for this window. May return null
68 nsIEditor getEditorForWindow(in mozIDOMWindowProxy window);
70 /**
71 * Destroy editor and related support objects
73 [noscript] void tearDownEditorOnWindow(in mozIDOMWindowProxy window);
75 %{C++
76 /**
77 * This method is implemented with nsIDocShell::GetHTMLEditor(). I.e.,
78 * This method doesn't depend on nsEditingSession. Therefore, even if
79 * there were some implementation of nsIEditingSession interface, this
80 * would be safe to use.
82 mozilla::HTMLEditor* GetHTMLEditorForWindow(mozIDOMWindowProxy* aWindow);