1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/interfaces/base/nsICompositionStringSynthesizer.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,53 @@ 1.4 +/* -*- Mode: IDL; 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 +#include "nsISupports.idl" 1.10 + 1.11 +/** 1.12 + * Stores composition clauses information and caret information for synthesizing 1.13 + * composition string. 1.14 + */ 1.15 + 1.16 +[scriptable, uuid(9a7d7851-8c0a-4061-9edc-60d6693f86c9)] 1.17 +interface nsICompositionStringSynthesizer : nsISupports 1.18 +{ 1.19 + /** 1.20 + * Set composition string or committed string. 1.21 + */ 1.22 + void setString(in AString aString); 1.23 + 1.24 + // NOTE: These values must be same to NS_TEXTRANGE_* in TextEvents.h 1.25 + const unsigned long ATTR_RAWINPUT = 0x02; 1.26 + const unsigned long ATTR_SELECTEDRAWTEXT = 0x03; 1.27 + const unsigned long ATTR_CONVERTEDTEXT = 0x04; 1.28 + const unsigned long ATTR_SELECTEDCONVERTEDTEXT = 0x05; 1.29 + 1.30 + /** 1.31 + * Append a clause. 1.32 + * 1.33 + * TODO: Should be able to specify custom clause style. 1.34 + */ 1.35 + void appendClause(in unsigned long aLength, 1.36 + in unsigned long aAttribute); 1.37 + 1.38 + /** 1.39 + * Set caret information. 1.40 + */ 1.41 + void setCaret(in unsigned long aOffset, 1.42 + in unsigned long aLength); 1.43 + 1.44 + /** 1.45 + * Synthesize composition string with given information by dispatching 1.46 + * a proper event. 1.47 + * 1.48 + * If clauses have never been set, this dispatches a commit event. 1.49 + * If clauses are not filled all over the composition string, this throw an 1.50 + * error. 1.51 + * 1.52 + * After dispatching event, this clears all the information about the 1.53 + * composition string. So, you can reuse this instance. 1.54 + */ 1.55 + bool dispatchEvent(); 1.56 +};