LCOV - app.info - editor/composer/src/nsComposerController.cpp

LCOV - code coverage report
| Current view: | directory - editor/composer/src - nsComposerController.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 56 | 0 | 0.0 %
| Date: | 2012-04-21 | Functions: | 2 | 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                 :  *   Pierre Phaneuf <pp@ludusdesign.com>
          24                 :  *   Ryan Cassin <rcassin@supernova.org>
          25                 :  *   Daniel Glazman <glazman@netscape.com>
          26                 :  *
          27                 :  * Alternatively, the contents of this file may be used under the terms of
          28                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          29                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          30                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          31                 :  * of those above. If you wish to allow use of your version of this file only
          32                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          33                 :  * use your version of this file under the terms of the MPL, indicate your
          34                 :  * decision by deleting the provisions above and replace them with the notice
          35                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          36                 :  * the provisions above, a recipient may use your version of this file under
          37                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          38                 :  *
          39                 :  * ***** END LICENSE BLOCK ***** */
          40                 :
          41                 : #include "nsIControllerCommandTable.h"
          42                 : #include "nsComposerController.h"
          43                 : #include "nsComposerCommands.h"
          44                 :
          45                 : #define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName)                    \
          46                 :   {                                                                     \
          47                 :     _cmdClass* theCmd = new _cmdClass();                                \
          48                 :     inCommandTable->RegisterCommand(_cmdName,                           \
          49                 :                        static_cast<nsIControllerCommand *>(theCmd));    \
          50                 :   }
          51                 :
          52                 : #define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName)                  \
          53                 :   {                                                                     \
          54                 :     _cmdClass* theCmd = new _cmdClass();                                \
          55                 :     inCommandTable->RegisterCommand(_cmdName,                           \
          56                 :                        static_cast<nsIControllerCommand *>(theCmd));
          57                 :
          58                 : #define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName)                   \
          59                 :     inCommandTable->RegisterCommand(_cmdName,                           \
          60                 :                         static_cast<nsIControllerCommand *>(theCmd));
          61                 :
          62                 : #define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName)                   \
          63                 :     inCommandTable->RegisterCommand(_cmdName,                           \
          64                 :                        static_cast<nsIControllerCommand *>(theCmd));    \
          65                 :   }
          66                 :
          67                 : #define NS_REGISTER_STYLE_COMMAND(_cmdClass, _cmdName, _styleTag)       \
          68                 :   {                                                                     \
          69                 :     _cmdClass* theCmd = new _cmdClass(_styleTag);                       \
          70                 :     inCommandTable->RegisterCommand(_cmdName,                           \
          71                 :                        static_cast<nsIControllerCommand *>(theCmd));    \
          72                 :   }
          73                 :
          74                 : #define NS_REGISTER_TAG_COMMAND(_cmdClass, _cmdName, _tagName)          \
          75                 :   {                                                                     \
          76                 :     _cmdClass* theCmd = new _cmdClass(_tagName);                        \
          77                 :     inCommandTable->RegisterCommand(_cmdName,                           \
          78                 :                        static_cast<nsIControllerCommand *>(theCmd));    \
          79                 :   }
          80                 :
          81                 :
          82                 : // static
          83                 : nsresult
          84               0 : nsComposerController::RegisterEditorDocStateCommands(
          85                 :                         nsIControllerCommandTable *inCommandTable)
          86                 : {
          87                 :   // observer commands for document state
          88               0 :   NS_REGISTER_FIRST_COMMAND(nsDocumentStateCommand, "obs_documentCreated")
          89               0 :   NS_REGISTER_NEXT_COMMAND(nsDocumentStateCommand, "obs_documentWillBeDestroyed")
          90               0 :   NS_REGISTER_LAST_COMMAND(nsDocumentStateCommand, "obs_documentLocationChanged")
          91                 :
          92                 :   // commands that may get or change state
          93               0 :   NS_REGISTER_FIRST_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentModified")
          94               0 :   NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentUseCSS")
          95               0 :   NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_setDocumentReadOnly")
          96               0 :   NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_insertBrOnReturn")
          97               0 :   NS_REGISTER_NEXT_COMMAND(nsSetDocumentStateCommand, "cmd_enableObjectResizing")
          98               0 :   NS_REGISTER_LAST_COMMAND(nsSetDocumentStateCommand, "cmd_enableInlineTableEditing")
          99                 :
         100               0 :   NS_REGISTER_ONE_COMMAND(nsSetDocumentOptionsCommand, "cmd_setDocumentOptions")
         101                 :
         102               0 :   return NS_OK;
         103                 : }
         104                 :
         105                 : // static
         106                 : nsresult
         107               0 : nsComposerController::RegisterHTMLEditorCommands(
         108                 :                         nsIControllerCommandTable *inCommandTable)
         109                 : {
         110                 :   // Edit menu
         111               0 :   NS_REGISTER_ONE_COMMAND(nsPasteNoFormattingCommand, "cmd_pasteNoFormatting");
         112                 :
         113                 :   // indent/outdent
         114               0 :   NS_REGISTER_ONE_COMMAND(nsIndentCommand, "cmd_indent");
         115               0 :   NS_REGISTER_ONE_COMMAND(nsOutdentCommand, "cmd_outdent");
         116                 :
         117                 :   // Styles
         118               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_bold", "b");
         119               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_italic", "i");
         120               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_underline", "u");
         121               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_tt", "tt");
         122                 :
         123               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_strikethrough", "strike");
         124               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_superscript", "sup");
         125               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_subscript", "sub");
         126               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_nobreak", "nobr");
         127                 :
         128               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_em", "em");
         129               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_strong", "strong");
         130               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_cite", "cite");
         131               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_abbr", "abbr");
         132               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_acronym", "acronym");
         133               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_code", "code");
         134               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_samp", "samp");
         135               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_var", "var");
         136               0 :   NS_REGISTER_STYLE_COMMAND(nsStyleUpdatingCommand, "cmd_removeLinks", "href");
         137                 :
         138                 :   // lists
         139               0 :   NS_REGISTER_STYLE_COMMAND(nsListCommand,     "cmd_ol", "ol");
         140               0 :   NS_REGISTER_STYLE_COMMAND(nsListCommand,     "cmd_ul", "ul");
         141               0 :   NS_REGISTER_STYLE_COMMAND(nsListItemCommand, "cmd_dt", "dt");
         142               0 :   NS_REGISTER_STYLE_COMMAND(nsListItemCommand, "cmd_dd", "dd");
         143               0 :   NS_REGISTER_ONE_COMMAND(nsRemoveListCommand, "cmd_removeList");
         144                 :
         145                 :   // format stuff
         146               0 :   NS_REGISTER_ONE_COMMAND(nsParagraphStateCommand,       "cmd_paragraphState");
         147               0 :   NS_REGISTER_ONE_COMMAND(nsFontFaceStateCommand,        "cmd_fontFace");
         148               0 :   NS_REGISTER_ONE_COMMAND(nsFontSizeStateCommand,        "cmd_fontSize");
         149               0 :   NS_REGISTER_ONE_COMMAND(nsFontColorStateCommand,       "cmd_fontColor");
         150               0 :   NS_REGISTER_ONE_COMMAND(nsBackgroundColorStateCommand, "cmd_backgroundColor");
         151               0 :   NS_REGISTER_ONE_COMMAND(nsHighlightColorStateCommand,  "cmd_highlight");
         152                 :
         153               0 :   NS_REGISTER_ONE_COMMAND(nsAlignCommand, "cmd_align");
         154               0 :   NS_REGISTER_ONE_COMMAND(nsRemoveStylesCommand, "cmd_removeStyles");
         155                 :
         156               0 :   NS_REGISTER_ONE_COMMAND(nsIncreaseFontSizeCommand, "cmd_increaseFont");
         157               0 :   NS_REGISTER_ONE_COMMAND(nsDecreaseFontSizeCommand, "cmd_decreaseFont");
         158                 :
         159                 :   // Insert content
         160               0 :   NS_REGISTER_ONE_COMMAND(nsInsertHTMLCommand, "cmd_insertHTML");
         161               0 :   NS_REGISTER_TAG_COMMAND(nsInsertTagCommand, "cmd_insertLinkNoUI", "a");
         162               0 :   NS_REGISTER_TAG_COMMAND(nsInsertTagCommand, "cmd_insertImageNoUI", "img");
         163               0 :   NS_REGISTER_TAG_COMMAND(nsInsertTagCommand, "cmd_insertHR", "hr");
         164                 :
         165               0 :   NS_REGISTER_ONE_COMMAND(nsAbsolutePositioningCommand, "cmd_absPos");
         166               0 :   NS_REGISTER_ONE_COMMAND(nsDecreaseZIndexCommand, "cmd_decreaseZIndex");
         167               0 :   NS_REGISTER_ONE_COMMAND(nsIncreaseZIndexCommand, "cmd_increaseZIndex");
         168                 :
         169               0 :   return NS_OK;
         170                 : }

Generated by: LCOV version 1.7