editor/composer/src/nsComposerCommandsUpdater.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7
michael@0 8
michael@0 9
michael@0 10 #ifndef nsComposerCommandsUpdater_h__
michael@0 11 #define nsComposerCommandsUpdater_h__
michael@0 12
michael@0 13 #include "nsCOMPtr.h" // for already_AddRefed, nsCOMPtr
michael@0 14 #include "nsIDocumentStateListener.h"
michael@0 15 #include "nsISelectionListener.h"
michael@0 16 #include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS
michael@0 17 #include "nsITimer.h" // for NS_DECL_NSITIMERCALLBACK, etc
michael@0 18 #include "nsITransactionListener.h" // for nsITransactionListener
michael@0 19 #include "nsIWeakReferenceUtils.h" // for nsWeakPtr
michael@0 20 #include "nscore.h" // for NS_IMETHOD, nsresult, etc
michael@0 21
michael@0 22 class nsIDOMWindow;
michael@0 23 class nsITransaction;
michael@0 24 class nsITransactionManager;
michael@0 25 class nsPICommandUpdater;
michael@0 26
michael@0 27 class nsComposerCommandsUpdater : public nsISelectionListener,
michael@0 28 public nsIDocumentStateListener,
michael@0 29 public nsITransactionListener,
michael@0 30 public nsITimerCallback
michael@0 31 {
michael@0 32 public:
michael@0 33
michael@0 34 nsComposerCommandsUpdater();
michael@0 35 virtual ~nsComposerCommandsUpdater();
michael@0 36
michael@0 37 // nsISupports
michael@0 38 NS_DECL_ISUPPORTS
michael@0 39
michael@0 40 // nsISelectionListener
michael@0 41 NS_DECL_NSISELECTIONLISTENER
michael@0 42
michael@0 43 // nsIDocumentStateListener
michael@0 44 NS_DECL_NSIDOCUMENTSTATELISTENER
michael@0 45
michael@0 46 // nsITimerCallback interfaces
michael@0 47 NS_DECL_NSITIMERCALLBACK
michael@0 48
michael@0 49 /** nsITransactionListener interfaces
michael@0 50 */
michael@0 51 NS_IMETHOD WillDo(nsITransactionManager *aManager, nsITransaction *aTransaction, bool *aInterrupt);
michael@0 52 NS_IMETHOD DidDo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aDoResult);
michael@0 53 NS_IMETHOD WillUndo(nsITransactionManager *aManager, nsITransaction *aTransaction, bool *aInterrupt);
michael@0 54 NS_IMETHOD DidUndo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aUndoResult);
michael@0 55 NS_IMETHOD WillRedo(nsITransactionManager *aManager, nsITransaction *aTransaction, bool *aInterrupt);
michael@0 56 NS_IMETHOD DidRedo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aRedoResult);
michael@0 57 NS_IMETHOD WillBeginBatch(nsITransactionManager *aManager, bool *aInterrupt);
michael@0 58 NS_IMETHOD DidBeginBatch(nsITransactionManager *aManager, nsresult aResult);
michael@0 59 NS_IMETHOD WillEndBatch(nsITransactionManager *aManager, bool *aInterrupt);
michael@0 60 NS_IMETHOD DidEndBatch(nsITransactionManager *aManager, nsresult aResult);
michael@0 61 NS_IMETHOD WillMerge(nsITransactionManager *aManager, nsITransaction *aTopTransaction,
michael@0 62 nsITransaction *aTransactionToMerge, bool *aInterrupt);
michael@0 63 NS_IMETHOD DidMerge(nsITransactionManager *aManager, nsITransaction *aTopTransaction,
michael@0 64 nsITransaction *aTransactionToMerge,
michael@0 65 bool aDidMerge, nsresult aMergeResult);
michael@0 66
michael@0 67
michael@0 68 nsresult Init(nsIDOMWindow* aDOMWindow);
michael@0 69
michael@0 70 protected:
michael@0 71
michael@0 72 enum {
michael@0 73 eStateUninitialized = -1,
michael@0 74 eStateOff = false,
michael@0 75 eStateOn = true
michael@0 76 };
michael@0 77
michael@0 78 bool SelectionIsCollapsed();
michael@0 79 nsresult UpdateDirtyState(bool aNowDirty);
michael@0 80 nsresult UpdateOneCommand(const char* aCommand);
michael@0 81 nsresult UpdateCommandGroup(const nsAString& aCommandGroup);
michael@0 82
michael@0 83 already_AddRefed<nsPICommandUpdater> GetCommandUpdater();
michael@0 84
michael@0 85 nsresult PrimeUpdateTimer();
michael@0 86 void TimerCallback();
michael@0 87 nsCOMPtr<nsITimer> mUpdateTimer;
michael@0 88
michael@0 89 nsWeakPtr mDOMWindow;
michael@0 90 nsWeakPtr mDocShell;
michael@0 91 int8_t mDirtyState;
michael@0 92 int8_t mSelectionCollapsed;
michael@0 93 bool mFirstDoOfFirstUndo;
michael@0 94
michael@0 95
michael@0 96 };
michael@0 97
michael@0 98 extern "C" nsresult NS_NewComposerCommandsUpdater(nsISelectionListener** aInstancePtrResult);
michael@0 99
michael@0 100
michael@0 101 #endif // nsComposerCommandsUpdater_h__

mercurial