Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 : #ifndef nsDocShellEditorData_h__
7 : #define nsDocShellEditorData_h__
8 :
9 : #ifndef nsCOMPtr_h___
10 : #include "nsCOMPtr.h"
11 : #endif
12 :
13 : #include "nsIHTMLDocument.h"
14 :
15 : class nsIDocShell;
16 : class nsIEditingSession;
17 : class nsIEditor;
18 :
19 : class nsDocShellEditorData
20 : {
21 : public:
22 : explicit nsDocShellEditorData(nsIDocShell* aOwningDocShell);
23 : ~nsDocShellEditorData();
24 :
25 : nsresult MakeEditable(bool aWaitForUriLoad);
26 : bool GetEditable();
27 : nsresult CreateEditor();
28 : nsresult GetEditingSession(nsIEditingSession** aResult);
29 : nsresult GetEditor(nsIEditor** aResult);
30 : nsresult SetEditor(nsIEditor* aEditor);
31 : void TearDownEditor();
32 : nsresult DetachFromWindow();
33 : nsresult ReattachToWindow(nsIDocShell* aDocShell);
34 0 : bool WaitingForLoad() const { return mMakeEditable; }
35 :
36 : protected:
37 : nsresult EnsureEditingSession();
38 :
39 : // The doc shell that owns us. Weak ref, since it always outlives us.
40 : nsIDocShell* mDocShell;
41 :
42 : // Only present for the content root docShell. Session is owned here.
43 : nsCOMPtr<nsIEditingSession> mEditingSession;
44 :
45 : // Indicates whether to make an editor after a url load.
46 : bool mMakeEditable;
47 :
48 : // If this frame is editable, store editor here. Editor is owned here.
49 : nsCOMPtr<nsIEditor> mEditor;
50 :
51 : // Denotes if the editor is detached from its window. The editor is detached
52 : // while it's stored in the session history bfcache.
53 : bool mIsDetached;
54 :
55 : // Backup for mMakeEditable while the editor is detached.
56 : bool mDetachedMakeEditable;
57 :
58 : // Backup for the corresponding nsIHTMLDocument's editing state while
59 : // the editor is detached.
60 : nsIHTMLDocument::EditingState mDetachedEditingState;
61 : };
62 :
63 : #endif // nsDocShellEditorData_h__
|