content/html/document/src/nsIHTMLDocument.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:cca1382de875
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 #ifndef nsIHTMLDocument_h
7 #define nsIHTMLDocument_h
8
9 #include "nsISupports.h"
10 #include "nsCompatibility.h"
11
12 class nsIDOMHTMLFormElement;
13 class nsIContent;
14 class nsIScriptElement;
15 class nsIEditor;
16 class nsContentList;
17 class nsWrapperCache;
18
19 #define NS_IHTMLDOCUMENT_IID \
20 { 0xcf814492, 0x303c, 0x4718, \
21 { 0x9a, 0x3e, 0x39, 0xbc, 0xd5, 0x2c, 0x10, 0xdb } }
22
23 /**
24 * HTML document extensions to nsIDocument.
25 */
26 class nsIHTMLDocument : public nsISupports
27 {
28 public:
29 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTMLDOCUMENT_IID)
30
31 /**
32 * Set compatibility mode for this document
33 */
34 virtual void SetCompatibilityMode(nsCompatibility aMode) = 0;
35
36 /**
37 * Called when form->BindToTree() is called so that document knows
38 * immediately when a form is added
39 */
40 virtual void AddedForm() = 0;
41 /**
42 * Called when form->SetDocument() is called so that document knows
43 * immediately when a form is removed
44 */
45 virtual void RemovedForm() = 0;
46 /**
47 * Called to get a better count of forms than document.forms can provide
48 * without calling FlushPendingNotifications (bug 138892).
49 */
50 // XXXbz is this still needed now that we can flush just content,
51 // not the rest?
52 virtual int32_t GetNumFormsSynchronous() = 0;
53
54 virtual bool IsWriting() = 0;
55
56 /**
57 * Get the list of form elements in the document.
58 */
59 virtual nsContentList* GetForms() = 0;
60
61 /**
62 * Get the list of form controls in the document (all elements in
63 * the document that are of type nsIContent::eHTML_FORM_CONTROL).
64 */
65 virtual nsContentList* GetFormControls() = 0;
66
67 /**
68 * Should be called when an element's editable changes as a result of
69 * changing its contentEditable attribute/property.
70 *
71 * @param aElement the element for which the contentEditable
72 * attribute/property was changed
73 * @param aChange +1 if the contentEditable attribute/property was changed to
74 * true, -1 if it was changed to false
75 */
76 virtual nsresult ChangeContentEditableCount(nsIContent *aElement,
77 int32_t aChange) = 0;
78
79 enum EditingState {
80 eTearingDown = -2,
81 eSettingUp = -1,
82 eOff = 0,
83 eDesignMode,
84 eContentEditable
85 };
86
87 /**
88 * Returns whether the document is editable.
89 */
90 bool IsEditingOn()
91 {
92 return GetEditingState() == eDesignMode ||
93 GetEditingState() == eContentEditable;
94 }
95
96 /**
97 * Returns the editing state of the document (not editable, contentEditable or
98 * designMode).
99 */
100 virtual EditingState GetEditingState() = 0;
101
102 /**
103 * Set the editing state of the document. Don't use this if you want
104 * to enable/disable editing, call EditingStateChanged() or
105 * SetDesignMode().
106 */
107 virtual nsresult SetEditingState(EditingState aState) = 0;
108
109 /**
110 * Disables getting and setting cookies
111 */
112 virtual void DisableCookieAccess() = 0;
113
114 /**
115 * Called when this nsIHTMLDocument's editor is destroyed.
116 */
117 virtual void TearingDownEditor(nsIEditor *aEditor) = 0;
118
119 virtual void SetIsXHTML(bool aXHTML) = 0;
120
121 virtual void SetDocWriteDisabled(bool aDisabled) = 0;
122 };
123
124 NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLDocument, NS_IHTMLDOCUMENT_IID)
125
126 #endif /* nsIHTMLDocument_h */

mercurial