|
1 /* -*- Mode: IDL; 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/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 /** |
|
9 * Stores composition clauses information and caret information for synthesizing |
|
10 * composition string. |
|
11 */ |
|
12 |
|
13 [scriptable, uuid(9a7d7851-8c0a-4061-9edc-60d6693f86c9)] |
|
14 interface nsICompositionStringSynthesizer : nsISupports |
|
15 { |
|
16 /** |
|
17 * Set composition string or committed string. |
|
18 */ |
|
19 void setString(in AString aString); |
|
20 |
|
21 // NOTE: These values must be same to NS_TEXTRANGE_* in TextEvents.h |
|
22 const unsigned long ATTR_RAWINPUT = 0x02; |
|
23 const unsigned long ATTR_SELECTEDRAWTEXT = 0x03; |
|
24 const unsigned long ATTR_CONVERTEDTEXT = 0x04; |
|
25 const unsigned long ATTR_SELECTEDCONVERTEDTEXT = 0x05; |
|
26 |
|
27 /** |
|
28 * Append a clause. |
|
29 * |
|
30 * TODO: Should be able to specify custom clause style. |
|
31 */ |
|
32 void appendClause(in unsigned long aLength, |
|
33 in unsigned long aAttribute); |
|
34 |
|
35 /** |
|
36 * Set caret information. |
|
37 */ |
|
38 void setCaret(in unsigned long aOffset, |
|
39 in unsigned long aLength); |
|
40 |
|
41 /** |
|
42 * Synthesize composition string with given information by dispatching |
|
43 * a proper event. |
|
44 * |
|
45 * If clauses have never been set, this dispatches a commit event. |
|
46 * If clauses are not filled all over the composition string, this throw an |
|
47 * error. |
|
48 * |
|
49 * After dispatching event, this clears all the information about the |
|
50 * composition string. So, you can reuse this instance. |
|
51 */ |
|
52 bool dispatchEvent(); |
|
53 }; |