Bug 448909 - Need more controls WHATWG Video tag (followup patch). r=mconnor
[wine-gecko.git] / editor / composer / src / nsComposerCommandsUpdater.h
bloba660e356d607c771a87a8fab1ae08a406c0b655e
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is mozilla.org code.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
24 * Simon Fraser <sfraser@netscape.com>
25 * Michael Judge <mjudge@netscape.com>
26 * Charles Manske <cmanske@netscape.com>
28 * Alternatively, the contents of this file may be used under the terms of
29 * either of the GNU General Public License Version 2 or later (the "GPL"),
30 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
40 * ***** END LICENSE BLOCK ***** */
45 #ifndef nsComposerCommandsUpdater_h__
46 #define nsComposerCommandsUpdater_h__
48 #include "nsCOMPtr.h"
49 #include "nsITimer.h"
50 #include "nsWeakPtr.h"
51 #include "nsPICommandUpdater.h"
53 #include "nsISelectionListener.h"
54 #include "nsIDocumentStateListener.h"
55 #include "nsITransactionListener.h"
57 class nsIDocShell;
58 class nsITransactionManager;
60 class nsComposerCommandsUpdater : public nsISelectionListener,
61 public nsIDocumentStateListener,
62 public nsITransactionListener,
63 public nsITimerCallback
65 public:
67 nsComposerCommandsUpdater();
68 virtual ~nsComposerCommandsUpdater();
70 // nsISupports
71 NS_DECL_ISUPPORTS
73 // nsISelectionListener
74 NS_DECL_NSISELECTIONLISTENER
76 // nsIDocumentStateListener
77 NS_DECL_NSIDOCUMENTSTATELISTENER
79 // nsITimerCallback interfaces
80 NS_DECL_NSITIMERCALLBACK
82 /** nsITransactionListener interfaces
83 */
84 NS_IMETHOD WillDo(nsITransactionManager *aManager, nsITransaction *aTransaction, PRBool *aInterrupt);
85 NS_IMETHOD DidDo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aDoResult);
86 NS_IMETHOD WillUndo(nsITransactionManager *aManager, nsITransaction *aTransaction, PRBool *aInterrupt);
87 NS_IMETHOD DidUndo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aUndoResult);
88 NS_IMETHOD WillRedo(nsITransactionManager *aManager, nsITransaction *aTransaction, PRBool *aInterrupt);
89 NS_IMETHOD DidRedo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aRedoResult);
90 NS_IMETHOD WillBeginBatch(nsITransactionManager *aManager, PRBool *aInterrupt);
91 NS_IMETHOD DidBeginBatch(nsITransactionManager *aManager, nsresult aResult);
92 NS_IMETHOD WillEndBatch(nsITransactionManager *aManager, PRBool *aInterrupt);
93 NS_IMETHOD DidEndBatch(nsITransactionManager *aManager, nsresult aResult);
94 NS_IMETHOD WillMerge(nsITransactionManager *aManager, nsITransaction *aTopTransaction,
95 nsITransaction *aTransactionToMerge, PRBool *aInterrupt);
96 NS_IMETHOD DidMerge(nsITransactionManager *aManager, nsITransaction *aTopTransaction,
97 nsITransaction *aTransactionToMerge,
98 PRBool aDidMerge, nsresult aMergeResult);
101 nsresult Init(nsIDOMWindow* aDOMWindow);
103 protected:
105 enum {
106 eStateUninitialized = -1,
107 eStateOff = PR_FALSE,
108 eStateOn = PR_TRUE
111 PRBool SelectionIsCollapsed();
112 nsresult UpdateDirtyState(PRBool aNowDirty);
113 nsresult UpdateOneCommand(const char* aCommand);
114 nsresult UpdateCommandGroup(const nsAString& aCommandGroup);
116 already_AddRefed<nsPICommandUpdater> GetCommandUpdater();
118 nsresult PrimeUpdateTimer();
119 void TimerCallback();
120 nsCOMPtr<nsITimer> mUpdateTimer;
122 nsIDOMWindow* mDOMWindow; // Weak reference
123 nsWeakPtr mDocShell;
124 PRInt8 mDirtyState;
125 PRInt8 mSelectionCollapsed;
126 PRPackedBool mFirstDoOfFirstUndo;
131 extern "C" nsresult NS_NewComposerCommandsUpdater(nsISelectionListener** aInstancePtrResult);
134 #endif // nsComposerCommandsUpdater_h__