1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/editor/libeditor/base/nsEditRules.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsEditRules_h__ 1.10 +#define nsEditRules_h__ 1.11 + 1.12 +#define NS_IEDITRULES_IID \ 1.13 +{ 0x3836386d, 0x806a, 0x488d, \ 1.14 + { 0x8b, 0xab, 0xaf, 0x42, 0xbb, 0x4c, 0x90, 0x66 } } 1.15 + 1.16 +#include "nsEditor.h" 1.17 + 1.18 +class nsPlaintextEditor; 1.19 +class nsISelection; 1.20 + 1.21 +/*************************************************************************** 1.22 + * base for an object to encapsulate any additional info needed to be passed 1.23 + * to rules system by the editor 1.24 + */ 1.25 +class nsRulesInfo 1.26 +{ 1.27 + public: 1.28 + 1.29 + nsRulesInfo(EditAction aAction) : action(aAction) {} 1.30 + virtual ~nsRulesInfo() {} 1.31 + 1.32 + EditAction action; 1.33 +}; 1.34 + 1.35 +/*************************************************************************** 1.36 + * Interface of editing rules. 1.37 + * 1.38 + */ 1.39 +class nsIEditRules : public nsISupports 1.40 +{ 1.41 +public: 1.42 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEDITRULES_IID) 1.43 + 1.44 +//Interfaces for addref and release and queryinterface 1.45 +//NOTE: Use NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsIEditRules 1.46 + 1.47 + NS_IMETHOD Init(nsPlaintextEditor *aEditor)=0; 1.48 + NS_IMETHOD SetInitialValue(const nsAString& aValue) = 0; 1.49 + NS_IMETHOD DetachEditor()=0; 1.50 + NS_IMETHOD BeforeEdit(EditAction action, 1.51 + nsIEditor::EDirection aDirection) = 0; 1.52 + NS_IMETHOD AfterEdit(EditAction action, 1.53 + nsIEditor::EDirection aDirection) = 0; 1.54 + NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo, 1.55 + bool* aCancel, bool* aHandled) = 0; 1.56 + NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult)=0; 1.57 + NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty)=0; 1.58 + NS_IMETHOD DocumentModified()=0; 1.59 +}; 1.60 + 1.61 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIEditRules, NS_IEDITRULES_IID) 1.62 + 1.63 +#endif //nsEditRules_h__ 1.64 +