1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/html/document/src/nsIHTMLDocument.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,126 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsIHTMLDocument_h 1.10 +#define nsIHTMLDocument_h 1.11 + 1.12 +#include "nsISupports.h" 1.13 +#include "nsCompatibility.h" 1.14 + 1.15 +class nsIDOMHTMLFormElement; 1.16 +class nsIContent; 1.17 +class nsIScriptElement; 1.18 +class nsIEditor; 1.19 +class nsContentList; 1.20 +class nsWrapperCache; 1.21 + 1.22 +#define NS_IHTMLDOCUMENT_IID \ 1.23 +{ 0xcf814492, 0x303c, 0x4718, \ 1.24 + { 0x9a, 0x3e, 0x39, 0xbc, 0xd5, 0x2c, 0x10, 0xdb } } 1.25 + 1.26 +/** 1.27 + * HTML document extensions to nsIDocument. 1.28 + */ 1.29 +class nsIHTMLDocument : public nsISupports 1.30 +{ 1.31 +public: 1.32 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTMLDOCUMENT_IID) 1.33 + 1.34 + /** 1.35 + * Set compatibility mode for this document 1.36 + */ 1.37 + virtual void SetCompatibilityMode(nsCompatibility aMode) = 0; 1.38 + 1.39 + /** 1.40 + * Called when form->BindToTree() is called so that document knows 1.41 + * immediately when a form is added 1.42 + */ 1.43 + virtual void AddedForm() = 0; 1.44 + /** 1.45 + * Called when form->SetDocument() is called so that document knows 1.46 + * immediately when a form is removed 1.47 + */ 1.48 + virtual void RemovedForm() = 0; 1.49 + /** 1.50 + * Called to get a better count of forms than document.forms can provide 1.51 + * without calling FlushPendingNotifications (bug 138892). 1.52 + */ 1.53 + // XXXbz is this still needed now that we can flush just content, 1.54 + // not the rest? 1.55 + virtual int32_t GetNumFormsSynchronous() = 0; 1.56 + 1.57 + virtual bool IsWriting() = 0; 1.58 + 1.59 + /** 1.60 + * Get the list of form elements in the document. 1.61 + */ 1.62 + virtual nsContentList* GetForms() = 0; 1.63 + 1.64 + /** 1.65 + * Get the list of form controls in the document (all elements in 1.66 + * the document that are of type nsIContent::eHTML_FORM_CONTROL). 1.67 + */ 1.68 + virtual nsContentList* GetFormControls() = 0; 1.69 + 1.70 + /** 1.71 + * Should be called when an element's editable changes as a result of 1.72 + * changing its contentEditable attribute/property. 1.73 + * 1.74 + * @param aElement the element for which the contentEditable 1.75 + * attribute/property was changed 1.76 + * @param aChange +1 if the contentEditable attribute/property was changed to 1.77 + * true, -1 if it was changed to false 1.78 + */ 1.79 + virtual nsresult ChangeContentEditableCount(nsIContent *aElement, 1.80 + int32_t aChange) = 0; 1.81 + 1.82 + enum EditingState { 1.83 + eTearingDown = -2, 1.84 + eSettingUp = -1, 1.85 + eOff = 0, 1.86 + eDesignMode, 1.87 + eContentEditable 1.88 + }; 1.89 + 1.90 + /** 1.91 + * Returns whether the document is editable. 1.92 + */ 1.93 + bool IsEditingOn() 1.94 + { 1.95 + return GetEditingState() == eDesignMode || 1.96 + GetEditingState() == eContentEditable; 1.97 + } 1.98 + 1.99 + /** 1.100 + * Returns the editing state of the document (not editable, contentEditable or 1.101 + * designMode). 1.102 + */ 1.103 + virtual EditingState GetEditingState() = 0; 1.104 + 1.105 + /** 1.106 + * Set the editing state of the document. Don't use this if you want 1.107 + * to enable/disable editing, call EditingStateChanged() or 1.108 + * SetDesignMode(). 1.109 + */ 1.110 + virtual nsresult SetEditingState(EditingState aState) = 0; 1.111 + 1.112 + /** 1.113 + * Disables getting and setting cookies 1.114 + */ 1.115 + virtual void DisableCookieAccess() = 0; 1.116 + 1.117 + /** 1.118 + * Called when this nsIHTMLDocument's editor is destroyed. 1.119 + */ 1.120 + virtual void TearingDownEditor(nsIEditor *aEditor) = 0; 1.121 + 1.122 + virtual void SetIsXHTML(bool aXHTML) = 0; 1.123 + 1.124 + virtual void SetDocWriteDisabled(bool aDisabled) = 0; 1.125 +}; 1.126 + 1.127 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLDocument, NS_IHTMLDOCUMENT_IID) 1.128 + 1.129 +#endif /* nsIHTMLDocument_h */