LCOV - code coverage report
Current view: directory - editor/libeditor/base - nsEditorCommands.h (source / functions) Found Hit Coverage
Test: app.info Lines: 16 0 0.0 %
Date: 2012-06-02 Functions: 47 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla Communicator client code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : #ifndef nsIEditorCommand_h_
      39                 : #define nsIEditorCommand_h_
      40                 : 
      41                 : #include "nsCOMPtr.h"
      42                 : #include "nsIControllerCommand.h"
      43                 : #include "nsIAtom.h"
      44                 : 
      45                 : // This is a virtual base class for commands registered with the editor controller.
      46                 : // Note that such commands can be shared by more than on editor instance, so
      47                 : // MUST be stateless. Any state must be stored via the refCon (an nsIEditor).
      48                 : class nsBaseEditorCommand : public nsIControllerCommand
      49                 : {
      50                 : public:
      51                 : 
      52                 :               nsBaseEditorCommand();
      53               0 :   virtual     ~nsBaseEditorCommand() {}
      54                 :     
      55                 :   NS_DECL_ISUPPORTS
      56                 :     
      57                 :   NS_IMETHOD  IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) = 0;
      58                 :   NS_IMETHOD  DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) = 0;
      59                 :   
      60                 : };
      61                 : 
      62                 : 
      63                 : #define NS_DECL_EDITOR_COMMAND(_cmd)                    \
      64                 : class _cmd : public nsBaseEditorCommand                 \
      65                 : {                                                       \
      66                 : public:                                                 \
      67                 :   NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval); \
      68                 :   NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon); \
      69                 :   NS_IMETHOD DoCommandParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon); \
      70                 :   NS_IMETHOD GetCommandStateParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon); \
      71                 : };
      72                 : 
      73                 : 
      74                 : 
      75                 : // basic editor commands
      76               0 : NS_DECL_EDITOR_COMMAND(nsUndoCommand)
      77               0 : NS_DECL_EDITOR_COMMAND(nsRedoCommand)
      78               0 : NS_DECL_EDITOR_COMMAND(nsClearUndoCommand)
      79                 : 
      80               0 : NS_DECL_EDITOR_COMMAND(nsCutCommand)
      81               0 : NS_DECL_EDITOR_COMMAND(nsCutOrDeleteCommand)
      82               0 : NS_DECL_EDITOR_COMMAND(nsCopyCommand)
      83               0 : NS_DECL_EDITOR_COMMAND(nsCopyOrDeleteCommand)
      84               0 : NS_DECL_EDITOR_COMMAND(nsPasteCommand)
      85               0 : NS_DECL_EDITOR_COMMAND(nsPasteTransferableCommand)
      86               0 : NS_DECL_EDITOR_COMMAND(nsSwitchTextDirectionCommand)
      87               0 : NS_DECL_EDITOR_COMMAND(nsDeleteCommand)
      88               0 : NS_DECL_EDITOR_COMMAND(nsSelectAllCommand)
      89                 : 
      90               0 : NS_DECL_EDITOR_COMMAND(nsSelectionMoveCommands)
      91                 : 
      92                 : // Insert content commands
      93               0 : NS_DECL_EDITOR_COMMAND(nsInsertPlaintextCommand)
      94               0 : NS_DECL_EDITOR_COMMAND(nsPasteQuotationCommand)
      95                 : 
      96                 : 
      97                 : #if 0
      98                 : // template for new command
      99                 : NS_IMETHODIMP
     100                 : nsFooCommand::IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval)
     101                 : {
     102                 :   return NS_ERROR_NOT_IMPLEMENTED;
     103                 : }
     104                 : 
     105                 : 
     106                 : NS_IMETHODIMP
     107                 : nsFooCommand::DoCommand(const char *aCommandName, const nsAString & aCommandParams, nsISupports *aCommandRefCon)
     108                 : {
     109                 :   return NS_ERROR_NOT_IMPLEMENTED;
     110                 : }
     111                 : 
     112                 : 
     113                 : #endif
     114                 : 
     115                 : #endif // nsIEditorCommand_h_

Generated by: LCOV version 1.7