00001 00034 #ifndef LL_PREEDITOR 00035 #define LL_PREEDITOR 00036 00037 class LLPreeditor 00038 { 00039 public: 00040 00041 typedef std::vector<S32> segment_lengths_t; 00042 typedef std::vector<BOOL> standouts_t; 00043 00044 // We don't delete against LLPreeditor, but compilers complain without this... 00045 00046 virtual ~LLPreeditor() {}; 00047 00048 // Discard any preedit info. on this preeditor. 00049 00050 virtual void resetPreedit() = 0; 00051 00052 // Update the preedit feedback using specified details. 00053 // Existing preedit is discarded and replaced with the new one. (I.e., updatePreedit is not cumulative.) 00054 // All arguments are IN. 00055 // preedit_count is the number of elements in arrays preedit_list and preedit_standouts. 00056 // preedit list is an array of preedit texts (clauses.) 00057 // preedit_standouts indicates whether each preedit text should be shown as standout clause. 00058 // caret_position is the preedit-local position of text editing caret, in # of llwchar. 00059 00060 virtual void updatePreedit(const LLWString &preedit_string, 00061 const segment_lengths_t &preedit_segment_lengths, const standouts_t &preedit_standouts, S32 caret_position) = 0; 00062 00063 // Turn the specified sub-contents into an active preedit. 00064 // Both position and length are IN and count with UTF-32 (llwchar) characters. 00065 // This method primarily facilitates reconversion. 00066 00067 virtual void markAsPreedit(S32 position, S32 length) = 0; 00068 00069 // Get the position and the length of the active preedit in the contents. 00070 // Both position and length are OUT and count with UTF-32 (llwchar) characters. 00071 // When this preeditor has no active preedit, position receives 00072 // the caret position, and length receives 0. 00073 00074 virtual void getPreeditRange(S32 *position, S32 *length) const = 0; 00075 00076 // Get the position and the length of the current selection in the contents. 00077 // Both position and length are OUT and count with UTF-32 (llwchar) characters. 00078 // When this preeditor has no selection, position receives 00079 // the caret position, and length receives 0. 00080 00081 virtual void getSelectionRange(S32 *position, S32 *length) const = 0; 00082 00083 // Get the locations where the preedit and related UI elements are displayed. 00084 // Locations are relative to the app window and measured in GL coordinate space (before scaling.) 00085 // query_position is IN argument, and other three are OUT. 00086 00087 virtual BOOL getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const = 0; 00088 00089 // Get the size (height) of the current font used in this preeditor. 00090 00091 virtual S32 getPreeditFontSize() const = 0; 00092 00093 // Get the contents of this preeditor as a LLWString. If there is an active preedit, 00094 // the returned LLWString contains it. 00095 00096 virtual const LLWString & getWText() const = 0; 00097 00098 // Handle a UTF-32 char on this preeditor, i.e., add the character 00099 // to the contents. 00100 // This is a back door of the method of same name of LLWindowCallback. 00101 // called_from_parent should be set to FALSE if calling through LLPreeditor. 00102 00103 virtual BOOL handleUnicodeCharHere(llwchar uni_char) = 0; 00104 }; 00105 00106 #endif