2015-02-13 22:36:47 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
2002-01-30 07:44:14 +03:00
|
|
|
#ifndef nsDocShellEditorData_h__
|
|
|
|
#define nsDocShellEditorData_h__
|
|
|
|
|
|
|
|
#ifndef nsCOMPtr_h___
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#endif
|
|
|
|
|
2008-04-24 01:36:17 +04:00
|
|
|
#include "nsIHTMLDocument.h"
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2013-09-04 00:17:26 +04:00
|
|
|
class nsIDocShell;
|
|
|
|
class nsIEditingSession;
|
|
|
|
class nsIEditor;
|
2002-01-30 07:44:14 +03:00
|
|
|
|
|
|
|
class nsDocShellEditorData
|
|
|
|
{
|
|
|
|
public:
|
2015-02-13 22:36:37 +03:00
|
|
|
explicit nsDocShellEditorData(nsIDocShell* aOwningDocShell);
|
2008-04-24 01:36:17 +04:00
|
|
|
~nsDocShellEditorData();
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2015-02-13 22:36:37 +03:00
|
|
|
nsresult MakeEditable(bool aWaitForUriLoad);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetEditable();
|
2008-04-24 01:36:17 +04:00
|
|
|
nsresult CreateEditor();
|
2015-02-13 22:36:37 +03:00
|
|
|
nsresult GetEditingSession(nsIEditingSession** aResult);
|
|
|
|
nsresult GetEditor(nsIEditor** aResult);
|
|
|
|
nsresult SetEditor(nsIEditor* aEditor);
|
2008-04-24 01:36:17 +04:00
|
|
|
void TearDownEditor();
|
|
|
|
nsresult DetachFromWindow();
|
2015-02-13 22:36:37 +03:00
|
|
|
nsresult ReattachToWindow(nsIDocShell* aDocShell);
|
2011-09-29 10:19:26 +04:00
|
|
|
bool WaitingForLoad() const { return mMakeEditable; }
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2008-04-24 01:36:17 +04:00
|
|
|
protected:
|
|
|
|
nsresult EnsureEditingSession();
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2015-02-13 22:36:37 +03:00
|
|
|
// The doc shell that owns us. Weak ref, since it always outlives us.
|
2008-04-24 01:36:17 +04:00
|
|
|
nsIDocShell* mDocShell;
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2008-04-24 01:36:17 +04:00
|
|
|
// Only present for the content root docShell. Session is owned here.
|
|
|
|
nsCOMPtr<nsIEditingSession> mEditingSession;
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2008-04-24 01:36:17 +04:00
|
|
|
// Indicates whether to make an editor after a url load.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mMakeEditable;
|
2015-02-13 22:36:37 +03:00
|
|
|
|
2008-04-24 01:36:17 +04: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-29 10:19:26 +04:00
|
|
|
bool mIsDetached;
|
2008-04-24 01:36:17 +04:00
|
|
|
|
|
|
|
// Backup for mMakeEditable while the editor is detached.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mDetachedMakeEditable;
|
2002-01-30 07:44:14 +03:00
|
|
|
|
2008-04-24 01:36:17 +04:00
|
|
|
// Backup for the corresponding nsIHTMLDocument's editing state while
|
|
|
|
// the editor is detached.
|
|
|
|
nsIHTMLDocument::EditingState mDetachedEditingState;
|
2002-01-30 07:44:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsDocShellEditorData_h__
|