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