michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsEditRules_h__ michael@0: #define nsEditRules_h__ michael@0: michael@0: #define NS_IEDITRULES_IID \ michael@0: { 0x3836386d, 0x806a, 0x488d, \ michael@0: { 0x8b, 0xab, 0xaf, 0x42, 0xbb, 0x4c, 0x90, 0x66 } } michael@0: michael@0: #include "nsEditor.h" michael@0: michael@0: class nsPlaintextEditor; michael@0: class nsISelection; michael@0: michael@0: /*************************************************************************** michael@0: * base for an object to encapsulate any additional info needed to be passed michael@0: * to rules system by the editor michael@0: */ michael@0: class nsRulesInfo michael@0: { michael@0: public: michael@0: michael@0: nsRulesInfo(EditAction aAction) : action(aAction) {} michael@0: virtual ~nsRulesInfo() {} michael@0: michael@0: EditAction action; michael@0: }; michael@0: michael@0: /*************************************************************************** michael@0: * Interface of editing rules. michael@0: * michael@0: */ michael@0: class nsIEditRules : public nsISupports michael@0: { michael@0: public: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEDITRULES_IID) michael@0: michael@0: //Interfaces for addref and release and queryinterface michael@0: //NOTE: Use NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsIEditRules michael@0: michael@0: NS_IMETHOD Init(nsPlaintextEditor *aEditor)=0; michael@0: NS_IMETHOD SetInitialValue(const nsAString& aValue) = 0; michael@0: NS_IMETHOD DetachEditor()=0; michael@0: NS_IMETHOD BeforeEdit(EditAction action, michael@0: nsIEditor::EDirection aDirection) = 0; michael@0: NS_IMETHOD AfterEdit(EditAction action, michael@0: nsIEditor::EDirection aDirection) = 0; michael@0: NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo, michael@0: bool* aCancel, bool* aHandled) = 0; michael@0: NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult)=0; michael@0: NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty)=0; michael@0: NS_IMETHOD DocumentModified()=0; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsIEditRules, NS_IEDITRULES_IID) michael@0: michael@0: #endif //nsEditRules_h__ michael@0: