michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef nsDocShellEditorData_h__ michael@0: #define nsDocShellEditorData_h__ michael@0: michael@0: #ifndef nsCOMPtr_h___ michael@0: #include "nsCOMPtr.h" michael@0: #endif michael@0: michael@0: #include "nsIHTMLDocument.h" michael@0: michael@0: class nsIDocShell; michael@0: class nsIEditingSession; michael@0: class nsIEditor; michael@0: michael@0: class nsDocShellEditorData michael@0: { michael@0: public: michael@0: michael@0: nsDocShellEditorData(nsIDocShell* inOwningDocShell); michael@0: ~nsDocShellEditorData(); michael@0: michael@0: nsresult MakeEditable(bool inWaitForUriLoad); michael@0: bool GetEditable(); michael@0: nsresult CreateEditor(); michael@0: nsresult GetEditingSession(nsIEditingSession **outEditingSession); michael@0: nsresult GetEditor(nsIEditor **outEditor); michael@0: nsresult SetEditor(nsIEditor *inEditor); michael@0: void TearDownEditor(); michael@0: nsresult DetachFromWindow(); michael@0: nsresult ReattachToWindow(nsIDocShell *aDocShell); michael@0: bool WaitingForLoad() const { return mMakeEditable; } michael@0: michael@0: protected: michael@0: michael@0: nsresult EnsureEditingSession(); michael@0: michael@0: // The doc shell that owns us. Weak ref, since it always outlives us. michael@0: nsIDocShell* mDocShell; michael@0: michael@0: // Only present for the content root docShell. Session is owned here. michael@0: nsCOMPtr mEditingSession; michael@0: michael@0: // Indicates whether to make an editor after a url load. michael@0: bool mMakeEditable; michael@0: michael@0: // If this frame is editable, store editor here. Editor is owned here. michael@0: nsCOMPtr mEditor; michael@0: michael@0: // Denotes if the editor is detached from its window. The editor is detached michael@0: // while it's stored in the session history bfcache. michael@0: bool mIsDetached; michael@0: michael@0: // Backup for mMakeEditable while the editor is detached. michael@0: bool mDetachedMakeEditable; michael@0: michael@0: // Backup for the corresponding nsIHTMLDocument's editing state while michael@0: // the editor is detached. michael@0: nsIHTMLDocument::EditingState mDetachedEditingState; michael@0: michael@0: }; michael@0: michael@0: michael@0: #endif // nsDocShellEditorData_h__