editor/libeditor/base/nsEditRules.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsEditRules_h__
     7 #define nsEditRules_h__
     9 #define NS_IEDITRULES_IID \
    10 { 0x3836386d, 0x806a, 0x488d, \
    11   { 0x8b, 0xab, 0xaf, 0x42, 0xbb, 0x4c, 0x90, 0x66 } }
    13 #include "nsEditor.h"
    15 class nsPlaintextEditor;
    16 class nsISelection;
    18 /***************************************************************************
    19  * base for an object to encapsulate any additional info needed to be passed
    20  * to rules system by the editor
    21  */
    22 class nsRulesInfo
    23 {
    24   public:
    26   nsRulesInfo(EditAction aAction) : action(aAction) {}
    27   virtual ~nsRulesInfo() {}
    29   EditAction action;
    30 };
    32 /***************************************************************************
    33  * Interface of editing rules.
    34  *  
    35  */
    36 class nsIEditRules : public nsISupports
    37 {
    38 public:
    39   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEDITRULES_IID)
    41 //Interfaces for addref and release and queryinterface
    42 //NOTE: Use   NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsIEditRules
    44   NS_IMETHOD Init(nsPlaintextEditor *aEditor)=0;
    45   NS_IMETHOD SetInitialValue(const nsAString& aValue) = 0;
    46   NS_IMETHOD DetachEditor()=0;
    47   NS_IMETHOD BeforeEdit(EditAction action,
    48                         nsIEditor::EDirection aDirection) = 0;
    49   NS_IMETHOD AfterEdit(EditAction action,
    50                        nsIEditor::EDirection aDirection) = 0;
    51   NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo,
    52                           bool* aCancel, bool* aHandled) = 0;
    53   NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult)=0;
    54   NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty)=0;
    55   NS_IMETHOD DocumentModified()=0;
    56 };
    58 NS_DEFINE_STATIC_IID_ACCESSOR(nsIEditRules, NS_IEDITRULES_IID)
    60 #endif //nsEditRules_h__

mercurial