mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 04:27:37 +00:00
d2149ed47c
--HG-- rename : editor/composer/src/crashtests/351236-1.html => editor/composer/crashtests/351236-1.html rename : editor/composer/src/crashtests/407062-1.html => editor/composer/crashtests/407062-1.html rename : editor/composer/src/crashtests/419563-1.xhtml => editor/composer/crashtests/419563-1.xhtml rename : editor/composer/src/crashtests/428844-1-inner.xhtml => editor/composer/crashtests/428844-1-inner.xhtml rename : editor/composer/src/crashtests/428844-1.html => editor/composer/crashtests/428844-1.html rename : editor/composer/src/crashtests/461049-1.html => editor/composer/crashtests/461049-1.html rename : editor/composer/src/crashtests/crashtests.list => editor/composer/crashtests/crashtests.list rename : editor/composer/src/crashtests/removing-editable-xslt-inner.xhtml => editor/composer/crashtests/removing-editable-xslt-inner.xhtml rename : editor/composer/src/crashtests/removing-editable-xslt.html => editor/composer/crashtests/removing-editable-xslt.html rename : editor/composer/src/nsComposeTxtSrvFilter.cpp => editor/composer/nsComposeTxtSrvFilter.cpp rename : editor/composer/src/nsComposeTxtSrvFilter.h => editor/composer/nsComposeTxtSrvFilter.h rename : editor/composer/src/nsComposerCommands.cpp => editor/composer/nsComposerCommands.cpp rename : editor/composer/src/nsComposerCommands.h => editor/composer/nsComposerCommands.h rename : editor/composer/src/nsComposerCommandsUpdater.cpp => editor/composer/nsComposerCommandsUpdater.cpp rename : editor/composer/src/nsComposerCommandsUpdater.h => editor/composer/nsComposerCommandsUpdater.h rename : editor/composer/src/nsComposerController.cpp => editor/composer/nsComposerController.cpp rename : editor/composer/src/nsComposerController.h => editor/composer/nsComposerController.h rename : editor/composer/src/nsComposerDocumentCommands.cpp => editor/composer/nsComposerDocumentCommands.cpp rename : editor/composer/src/nsComposerRegistration.cpp => editor/composer/nsComposerRegistration.cpp rename : editor/composer/src/nsEditingSession.cpp => editor/composer/nsEditingSession.cpp rename : editor/composer/src/nsEditingSession.h => editor/composer/nsEditingSession.h rename : editor/composer/src/nsEditorSpellCheck.cpp => editor/composer/nsEditorSpellCheck.cpp rename : editor/composer/src/nsEditorSpellCheck.h => editor/composer/nsEditorSpellCheck.h rename : editor/composer/public/nsIEditingSession.idl => editor/composer/nsIEditingSession.idl rename : editor/composer/src/res/EditorOverride.css => editor/composer/res/EditorOverride.css rename : editor/composer/src/res/grabber.gif => editor/composer/res/grabber.gif rename : editor/composer/src/res/table-add-column-after-active.gif => editor/composer/res/table-add-column-after-active.gif rename : editor/composer/src/res/table-add-column-after-hover.gif => editor/composer/res/table-add-column-after-hover.gif rename : editor/composer/src/res/table-add-column-after.gif => editor/composer/res/table-add-column-after.gif rename : editor/composer/src/res/table-add-column-before-active.gif => editor/composer/res/table-add-column-before-active.gif rename : editor/composer/src/res/table-add-column-before-hover.gif => editor/composer/res/table-add-column-before-hover.gif rename : editor/composer/src/res/table-add-column-before.gif => editor/composer/res/table-add-column-before.gif rename : editor/composer/src/res/table-add-row-after-active.gif => editor/composer/res/table-add-row-after-active.gif rename : editor/composer/src/res/table-add-row-after-hover.gif => editor/composer/res/table-add-row-after-hover.gif rename : editor/composer/src/res/table-add-row-after.gif => editor/composer/res/table-add-row-after.gif rename : editor/composer/src/res/table-add-row-before-active.gif => editor/composer/res/table-add-row-before-active.gif rename : editor/composer/src/res/table-add-row-before-hover.gif => editor/composer/res/table-add-row-before-hover.gif rename : editor/composer/src/res/table-add-row-before.gif => editor/composer/res/table-add-row-before.gif rename : editor/composer/src/res/table-remove-column-active.gif => editor/composer/res/table-remove-column-active.gif rename : editor/composer/src/res/table-remove-column-hover.gif => editor/composer/res/table-remove-column-hover.gif rename : editor/composer/src/res/table-remove-column.gif => editor/composer/res/table-remove-column.gif rename : editor/composer/src/res/table-remove-row-active.gif => editor/composer/res/table-remove-row-active.gif rename : editor/composer/src/res/table-remove-row-hover.gif => editor/composer/res/table-remove-row-hover.gif rename : editor/composer/src/res/table-remove-row.gif => editor/composer/res/table-remove-row.gif rename : editor/composer/src/res/text_caret.png => editor/composer/res/text_caret.png rename : editor/composer/src/res/text_caret@1.5x.png => editor/composer/res/text_caret@1.5x.png rename : editor/composer/src/res/text_caret@2.25x.png => editor/composer/res/text_caret@2.25x.png rename : editor/composer/src/res/text_caret@2x.png => editor/composer/res/text_caret@2x.png rename : editor/composer/src/res/text_caret_tilt_left.png => editor/composer/res/text_caret_tilt_left.png rename : editor/composer/src/res/text_caret_tilt_left@1.5x.png => editor/composer/res/text_caret_tilt_left@1.5x.png rename : editor/composer/src/res/text_caret_tilt_left@2.25x.png => editor/composer/res/text_caret_tilt_left@2.25x.png rename : editor/composer/src/res/text_caret_tilt_left@2x.png => editor/composer/res/text_caret_tilt_left@2x.png rename : editor/composer/src/res/text_caret_tilt_right.png => editor/composer/res/text_caret_tilt_right.png rename : editor/composer/src/res/text_caret_tilt_right@1.5x.png => editor/composer/res/text_caret_tilt_right@1.5x.png rename : editor/composer/src/res/text_caret_tilt_right@2.25x.png => editor/composer/res/text_caret_tilt_right@2.25x.png rename : editor/composer/src/res/text_caret_tilt_right@2x.png => editor/composer/res/text_caret_tilt_right@2x.png rename : editor/composer/src/res/text_selection_handle.png => editor/composer/res/text_selection_handle.png rename : editor/composer/src/res/text_selection_handle@1.5.png => editor/composer/res/text_selection_handle@1.5.png rename : editor/composer/src/res/text_selection_handle@2.png => editor/composer/res/text_selection_handle@2.png
150 lines
5.0 KiB
C++
150 lines
5.0 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* 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/. */
|
|
|
|
#ifndef nsEditingSession_h__
|
|
#define nsEditingSession_h__
|
|
|
|
|
|
#ifndef nsWeakReference_h__
|
|
#include "nsWeakReference.h" // for nsSupportsWeakReference, etc
|
|
#endif
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr
|
|
#include "nsCOMPtr.h" // for nsCOMPtr
|
|
#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS
|
|
#include "nsIWeakReferenceUtils.h" // for nsWeakPtr
|
|
#include "nsWeakReference.h" // for nsSupportsWeakReference, etc
|
|
#include "nscore.h" // for nsresult
|
|
|
|
#ifndef __gen_nsIWebProgressListener_h__
|
|
#include "nsIWebProgressListener.h"
|
|
#endif
|
|
|
|
#ifndef __gen_nsIEditingSession_h__
|
|
#include "nsIEditingSession.h" // for NS_DECL_NSIEDITINGSESSION, etc
|
|
#endif
|
|
|
|
#include "nsString.h" // for nsCString
|
|
|
|
class nsIDOMWindow;
|
|
class nsISupports;
|
|
class nsITimer;
|
|
|
|
#define NS_EDITINGSESSION_CID \
|
|
{ 0xbc26ff01, 0xf2bd, 0x11d4, { 0xa7, 0x3c, 0xe5, 0xa4, 0xb5, 0xa8, 0xbd, 0xfc } }
|
|
|
|
|
|
class nsComposerCommandsUpdater;
|
|
class nsIChannel;
|
|
class nsIControllers;
|
|
class nsIDocShell;
|
|
class nsIEditor;
|
|
class nsIWebProgress;
|
|
|
|
class nsEditingSession : public nsIEditingSession,
|
|
public nsIWebProgressListener,
|
|
public nsSupportsWeakReference
|
|
{
|
|
public:
|
|
|
|
nsEditingSession();
|
|
|
|
// nsISupports
|
|
NS_DECL_ISUPPORTS
|
|
|
|
// nsIWebProgressListener
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
|
|
|
// nsIEditingSession
|
|
NS_DECL_NSIEDITINGSESSION
|
|
|
|
protected:
|
|
virtual ~nsEditingSession();
|
|
|
|
nsIDocShell * GetDocShellFromWindow(nsIDOMWindow *aWindow);
|
|
|
|
nsresult SetupEditorCommandController(const char *aControllerClassName,
|
|
nsIDOMWindow *aWindow,
|
|
nsISupports *aContext,
|
|
uint32_t *aControllerId);
|
|
|
|
nsresult SetContextOnControllerById(nsIControllers* aControllers,
|
|
nsISupports* aContext,
|
|
uint32_t aID);
|
|
|
|
nsresult PrepareForEditing(nsIDOMWindow *aWindow);
|
|
|
|
static void TimerCallback(nsITimer *aTimer, void *aClosure);
|
|
nsCOMPtr<nsITimer> mLoadBlankDocTimer;
|
|
|
|
// progress load stuff
|
|
nsresult StartDocumentLoad(nsIWebProgress *aWebProgress,
|
|
bool isToBeMadeEditable);
|
|
nsresult EndDocumentLoad(nsIWebProgress *aWebProgress,
|
|
nsIChannel* aChannel, nsresult aStatus,
|
|
bool isToBeMadeEditable);
|
|
nsresult StartPageLoad(nsIChannel *aChannel);
|
|
nsresult EndPageLoad(nsIWebProgress *aWebProgress,
|
|
nsIChannel* aChannel, nsresult aStatus);
|
|
|
|
bool IsProgressForTargetDocument(nsIWebProgress *aWebProgress);
|
|
|
|
void RemoveEditorControllers(nsIDOMWindow *aWindow);
|
|
void RemoveWebProgressListener(nsIDOMWindow *aWindow);
|
|
void RestoreAnimationMode(nsIDOMWindow *aWindow);
|
|
void RemoveListenersAndControllers(nsIDOMWindow *aWindow,
|
|
nsIEditor *aEditor);
|
|
|
|
protected:
|
|
|
|
bool mDoneSetup; // have we prepared for editing yet?
|
|
|
|
// Used to prevent double creation of editor because nsIWebProgressListener
|
|
// receives a STATE_STOP notification before the STATE_START
|
|
// for our document, so we wait for the STATE_START, then STATE_STOP
|
|
// before creating an editor
|
|
bool mCanCreateEditor;
|
|
|
|
bool mInteractive;
|
|
bool mMakeWholeDocumentEditable;
|
|
|
|
bool mDisabledJSAndPlugins;
|
|
|
|
// True if scripts were enabled before the editor turned scripts
|
|
// off, otherwise false.
|
|
bool mScriptsEnabled;
|
|
|
|
// True if plugins were enabled before the editor turned plugins
|
|
// off, otherwise false.
|
|
bool mPluginsEnabled;
|
|
|
|
bool mProgressListenerRegistered;
|
|
|
|
// The image animation mode before it was turned off.
|
|
uint16_t mImageAnimationMode;
|
|
|
|
// THE REMAINING MEMBER VARIABLES WILL BECOME A SET WHEN WE EDIT
|
|
// MORE THAN ONE EDITOR PER EDITING SESSION
|
|
nsRefPtr<nsComposerCommandsUpdater> mStateMaintainer;
|
|
|
|
// Save the editor type so we can create the editor after loading uri
|
|
nsCString mEditorType;
|
|
uint32_t mEditorFlags;
|
|
uint32_t mEditorStatus;
|
|
uint32_t mBaseCommandControllerId;
|
|
uint32_t mDocStateControllerId;
|
|
uint32_t mHTMLCommandControllerId;
|
|
|
|
// Make sure the docshell we use is safe
|
|
nsWeakPtr mDocShell;
|
|
|
|
// See if we can reuse an existing editor
|
|
nsWeakPtr mExistingEditor;
|
|
};
|
|
|
|
|
|
|
|
#endif // nsEditingSession_h__
|