1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsControllerCommandTable_h_
8 #define nsControllerCommandTable_h_
10 #include "nsIControllerCommandTable.h"
11 #include "nsWeakReference.h"
12 #include "nsInterfaceHashtable.h"
14 class nsIControllerCommand
;
16 class nsControllerCommandTable final
: public nsIControllerCommandTable
,
17 public nsSupportsWeakReference
{
19 nsControllerCommandTable();
22 NS_DECL_NSICONTROLLERCOMMANDTABLE
24 static already_AddRefed
<nsControllerCommandTable
> CreateEditorCommandTable();
25 static already_AddRefed
<nsControllerCommandTable
> CreateEditingCommandTable();
26 static already_AddRefed
<nsControllerCommandTable
>
27 CreateHTMLEditorCommandTable();
28 static already_AddRefed
<nsControllerCommandTable
>
29 CreateHTMLEditorDocStateCommandTable();
30 static already_AddRefed
<nsControllerCommandTable
> CreateWindowCommandTable();
33 virtual ~nsControllerCommandTable();
35 // Hash table of nsIControllerCommands, keyed by command name.
36 nsInterfaceHashtable
<nsCStringHashKey
, nsIControllerCommand
> mCommandsTable
;
42 nsControllerCommandTable
*
43 nsIControllerCommandTable::AsControllerCommandTable() {
44 return static_cast<nsControllerCommandTable
*>(this);
47 const nsControllerCommandTable
*
48 nsIControllerCommandTable::AsControllerCommandTable() const {
49 return static_cast<const nsControllerCommandTable
*>(this);
52 #endif // nsControllerCommandTable_h_