Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <stdio.h>
31 : : #include <string.h>
32 : :
33 : : #include <sal/alloca.h>
34 : : #include <osl/thread.h>
35 : :
36 : : #include <tools/prex.h>
37 : : #include <X11/Xlocale.h>
38 : : #include <X11/Xlib.h>
39 : : #include <tools/postx.h>
40 : :
41 : : #include "unx/salunx.h"
42 : : #include "unx/XIM.h"
43 : : #include "unx/i18n_cb.hxx"
44 : : #include "unx/i18n_status.hxx"
45 : : #include "unx/i18n_ic.hxx"
46 : : #include "unx/i18n_im.hxx"
47 : : #include "salframe.hxx"
48 : :
49 : : // -------------------------------------------------------------------------
50 : : //
51 : : // i. preedit start callback
52 : : //
53 : : // -------------------------------------------------------------------------
54 : :
55 : : int
56 : 0 : PreeditStartCallback ( XIC, XPointer client_data, XPointer )
57 : : {
58 : 0 : preedit_data_t* pPreeditData = (preedit_data_t*)client_data;
59 : 0 : if ( pPreeditData->eState == ePreeditStatusActivationRequired )
60 : : {
61 : 0 : pPreeditData->eState = ePreeditStatusActive;
62 : 0 : pPreeditData->aText.nCursorPos = 0;
63 : 0 : pPreeditData->aText.nLength = 0;
64 : : }
65 : :
66 : 0 : return -1;
67 : : }
68 : :
69 : : // -------------------------------------------------------------------------
70 : : //
71 : : // ii. preedit done callback
72 : : //
73 : : // -------------------------------------------------------------------------
74 : :
75 : : void
76 : 0 : PreeditDoneCallback ( XIC, XPointer client_data, XPointer )
77 : : {
78 : 0 : preedit_data_t* pPreeditData = (preedit_data_t*)client_data;
79 : 0 : if (pPreeditData->eState == ePreeditStatusActive )
80 : : {
81 : 0 : if( pPreeditData->pFrame )
82 : 0 : pPreeditData->pFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, (void*)NULL );
83 : : }
84 : 0 : pPreeditData->eState = ePreeditStatusStartPending;
85 : 0 : }
86 : :
87 : : // -------------------------------------------------------------------------
88 : : //
89 : : // iii. preedit draw callback
90 : : //
91 : : // -------------------------------------------------------------------------
92 : :
93 : : //
94 : : // Handle deletion of text in a preedit_draw_callback
95 : : // from and howmuch are guaranteed to be nonnegative
96 : : //
97 : :
98 : : void
99 : 0 : Preedit_DeleteText(preedit_text_t *ptext, int from, int howmuch)
100 : : {
101 : : // If we've been asked to delete no text then just set
102 : : // nLength correctly and return
103 : 0 : if (ptext->nLength == 0)
104 : : {
105 : 0 : ptext->nLength = from;
106 : 0 : return;
107 : : }
108 : :
109 : 0 : int to = from + howmuch;
110 : :
111 : 0 : if (to == (int)ptext->nLength)
112 : : {
113 : : // delete from the end of the text
114 : 0 : ptext->nLength = from;
115 : : }
116 : : else
117 : 0 : if (to < (int)ptext->nLength)
118 : : {
119 : : // cut out of the middle of the text
120 : 0 : memmove( (void*)(ptext->pUnicodeBuffer + from),
121 : : (void*)(ptext->pUnicodeBuffer + to),
122 : 0 : (ptext->nLength - to) * sizeof(sal_Unicode));
123 : 0 : memmove( (void*)(ptext->pCharStyle + from),
124 : : (void*)(ptext->pCharStyle + to),
125 : 0 : (ptext->nLength - to) * sizeof(XIMFeedback));
126 : 0 : ptext->nLength -= howmuch;
127 : : }
128 : : else
129 : : {
130 : : // XXX this indicates an error, are we out of sync ?
131 : : fprintf(stderr, "Preedit_DeleteText( from=%i to=%i length=%i )\n",
132 : 0 : from, to, ptext->nLength );
133 : 0 : fprintf (stderr, "\t XXX internal error, out of sync XXX\n");
134 : :
135 : 0 : ptext->nLength = from;
136 : : }
137 : :
138 : : // NULL-terminate the string
139 : 0 : ptext->pUnicodeBuffer[ptext->nLength] = (sal_Unicode)0;
140 : : }
141 : :
142 : : // reallocate the textbuffer with sufficiently large size 2^x
143 : : // nnewlimit is presupposed to be larger than ptext->size
144 : : void
145 : 0 : enlarge_buffer ( preedit_text_t *ptext, int nnewlimit )
146 : : {
147 : 0 : size_t nnewsize = ptext->nSize;
148 : :
149 : 0 : while ( nnewsize <= (size_t)nnewlimit )
150 : 0 : nnewsize *= 2;
151 : :
152 : 0 : ptext->nSize = nnewsize;
153 : : ptext->pUnicodeBuffer = (sal_Unicode*)realloc((void*)ptext->pUnicodeBuffer,
154 : 0 : nnewsize * sizeof(sal_Unicode));
155 : : ptext->pCharStyle = (XIMFeedback*)realloc((void*)ptext->pCharStyle,
156 : 0 : nnewsize * sizeof(XIMFeedback));
157 : 0 : }
158 : :
159 : : //
160 : : // Handle insertion of text in a preedit_draw_callback
161 : : // string field of XIMText struct is guaranteed to be != NULL
162 : : //
163 : :
164 : : void
165 : 0 : Preedit_InsertText(preedit_text_t *pText, XIMText *pInsertText, int where)
166 : : {
167 : : sal_Unicode *pInsertTextString;
168 : 0 : int nInsertTextLength = 0;
169 : 0 : XIMFeedback *pInsertTextCharStyle = pInsertText->feedback;
170 : :
171 : 0 : nInsertTextLength = pInsertText->length;
172 : :
173 : : // can't handle wchar_t strings, so convert to multibyte chars first
174 : : char *pMBString;
175 : : size_t nMBLength;
176 : 0 : if (pInsertText->encoding_is_wchar)
177 : : {
178 : 0 : wchar_t *pWCString = pInsertText->string.wide_char;
179 : 0 : size_t nBytes = wcstombs ( NULL, pWCString, 1024 /* dont care */);
180 : 0 : pMBString = (char*)alloca( nBytes + 1 );
181 : 0 : nMBLength = wcstombs ( pMBString, pWCString, nBytes + 1);
182 : : }
183 : : else
184 : : {
185 : 0 : pMBString = pInsertText->string.multi_byte;
186 : 0 : nMBLength = strlen(pMBString); // xxx
187 : : }
188 : :
189 : : // convert multibyte chars to unicode
190 : 0 : rtl_TextEncoding nEncoding = osl_getThreadTextEncoding();
191 : :
192 : 0 : if (nEncoding != RTL_TEXTENCODING_UNICODE)
193 : : {
194 : : rtl_TextToUnicodeConverter aConverter =
195 : 0 : rtl_createTextToUnicodeConverter( nEncoding );
196 : : rtl_TextToUnicodeContext aContext =
197 : 0 : rtl_createTextToUnicodeContext(aConverter);
198 : :
199 : 0 : sal_Size nBufferSize = nInsertTextLength * 2;
200 : :
201 : 0 : pInsertTextString = (sal_Unicode*)alloca(nBufferSize);
202 : :
203 : : sal_uInt32 nConversionInfo;
204 : : sal_Size nConvertedChars;
205 : :
206 : : rtl_convertTextToUnicode( aConverter, aContext,
207 : : pMBString, nMBLength,
208 : : pInsertTextString, nBufferSize,
209 : : RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_IGNORE
210 : : | RTL_TEXTTOUNICODE_FLAGS_INVALID_IGNORE,
211 : 0 : &nConversionInfo, &nConvertedChars );
212 : :
213 : 0 : rtl_destroyTextToUnicodeContext(aConverter, aContext);
214 : 0 : rtl_destroyTextToUnicodeConverter(aConverter);
215 : :
216 : : }
217 : : else
218 : : {
219 : 0 : pInsertTextString = (sal_Unicode*)pMBString;
220 : : }
221 : :
222 : : // enlarge target text-buffer if necessary
223 : 0 : if (pText->nSize <= (pText->nLength + nInsertTextLength))
224 : 0 : enlarge_buffer(pText, pText->nLength + nInsertTextLength);
225 : :
226 : : // insert text: displace old mem and put new bytes in
227 : 0 : int from = where;
228 : 0 : int to = where + nInsertTextLength;
229 : 0 : int howmany = pText->nLength - where;
230 : :
231 : 0 : memmove((void*)(pText->pUnicodeBuffer + to),
232 : : (void*)(pText->pUnicodeBuffer + from),
233 : 0 : howmany * sizeof(sal_Unicode));
234 : 0 : memmove((void*)(pText->pCharStyle + to),
235 : : (void*)(pText->pCharStyle + from),
236 : 0 : howmany * sizeof(XIMFeedback));
237 : :
238 : 0 : to = from;
239 : 0 : howmany = nInsertTextLength;
240 : :
241 : 0 : memcpy((void*)(pText->pUnicodeBuffer + to), (void*)pInsertTextString,
242 : 0 : howmany * sizeof(sal_Unicode));
243 : 0 : memcpy((void*)(pText->pCharStyle + to), (void*)pInsertTextCharStyle,
244 : 0 : howmany * sizeof(XIMFeedback));
245 : :
246 : 0 : pText->nLength += howmany;
247 : :
248 : : // NULL-terminate the string
249 : 0 : pText->pUnicodeBuffer[pText->nLength] = (sal_Unicode)0;
250 : 0 : }
251 : :
252 : : //
253 : : // Handle the change of attributes in a preedit_draw_callback
254 : : //
255 : : void
256 : 0 : Preedit_UpdateAttributes ( preedit_text_t* ptext, XIMFeedback* feedback,
257 : : int from, int amount )
258 : : {
259 : 0 : if ( (from + amount) > (int)ptext->nLength )
260 : : {
261 : : // XXX this indicates an error, are we out of sync ?
262 : : fprintf (stderr, "Preedit_UpdateAttributes( %i + %i > %i )\n",
263 : 0 : from, amount, ptext->nLength );
264 : 0 : fprintf (stderr, "\t XXX internal error, out of sync XXX\n");
265 : :
266 : 0 : return;
267 : : }
268 : :
269 : 0 : memcpy ( ptext->pCharStyle + from,
270 : 0 : feedback, amount * sizeof(XIMFeedback) );
271 : : }
272 : :
273 : : // Convert the XIM feedback values into appropriate VCL
274 : : // SAL_EXTTEXTINPUT_ATTR values
275 : : // returns an allocate list of attributes, which must be freed by caller
276 : : sal_uInt16*
277 : 0 : Preedit_FeedbackToSAL ( XIMFeedback* pfeedback, int nlength, std::vector<sal_uInt16>& rSalAttr )
278 : : {
279 : : sal_uInt16 *psalattr;
280 : : sal_uInt16 nval;
281 : 0 : sal_uInt16 noldval = 0;
282 : : XIMFeedback nfeedback;
283 : :
284 : : // only work with reasonable length
285 : 0 : if (nlength > 0 && nlength > sal::static_int_cast<int>(rSalAttr.size()) )
286 : : {
287 : 0 : rSalAttr.reserve( nlength );
288 : 0 : psalattr = &rSalAttr[0];
289 : : }
290 : : else
291 : 0 : return (sal_uInt16*)NULL;
292 : :
293 : 0 : for (int npos = 0; npos < nlength; npos++)
294 : : {
295 : 0 : nval = 0;
296 : 0 : nfeedback = pfeedback[npos];
297 : :
298 : : // means to use the feedback of the previous char
299 : 0 : if (nfeedback == 0)
300 : : {
301 : 0 : nval = noldval;
302 : : }
303 : : // convert feedback to attributes
304 : : else
305 : : {
306 : 0 : if (nfeedback & XIMReverse)
307 : 0 : nval |= SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT;
308 : 0 : if (nfeedback & XIMUnderline)
309 : 0 : nval |= SAL_EXTTEXTINPUT_ATTR_UNDERLINE;
310 : 0 : if (nfeedback & XIMHighlight)
311 : 0 : nval |= SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT;
312 : 0 : if (nfeedback & XIMPrimary)
313 : 0 : nval |= SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE;
314 : 0 : if (nfeedback & XIMSecondary)
315 : 0 : nval |= SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
316 : 0 : if (nfeedback & XIMTertiary) // same as 2ery
317 : 0 : nval |= SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE;
318 : :
319 : : }
320 : : // copy in list
321 : 0 : psalattr[npos] = nval;
322 : 0 : noldval = nval;
323 : : }
324 : : // return list of sal attributes
325 : 0 : return psalattr;
326 : : }
327 : :
328 : : void
329 : 0 : PreeditDrawCallback(XIC ic, XPointer client_data,
330 : : XIMPreeditDrawCallbackStruct *call_data)
331 : : {
332 : 0 : preedit_data_t* pPreeditData = (preedit_data_t*)client_data;
333 : :
334 : : // if there's nothing to change then change nothing
335 : 0 : if ( ( (call_data->text == NULL) && (call_data->chg_length == 0) )
336 : : || pPreeditData->pFrame == NULL )
337 : 0 : return;
338 : :
339 : : // Solaris 7 deletes the preedit buffer after commit
340 : : // since the next call to preeditstart will have the same effect just skip this.
341 : : // if (pPreeditData->eState == ePreeditStatusStartPending && call_data->text == NULL)
342 : : // return;
343 : :
344 : 0 : if ( pPreeditData->eState == ePreeditStatusStartPending )
345 : 0 : pPreeditData->eState = ePreeditStatusActivationRequired;
346 : 0 : PreeditStartCallback( ic, client_data, NULL );
347 : :
348 : : // Edit the internal textbuffer as indicated by the call_data,
349 : : // chg_first and chg_length are guaranteed to be nonnegative
350 : :
351 : : // handle text deletion
352 : 0 : if (call_data->text == NULL)
353 : : {
354 : : Preedit_DeleteText(&(pPreeditData->aText),
355 : 0 : call_data->chg_first, call_data->chg_length );
356 : : }
357 : : else
358 : : {
359 : : // handle text insertion
360 : 0 : if ( (call_data->chg_length == 0)
361 : : && (call_data->text->string.wide_char != NULL))
362 : : {
363 : : Preedit_InsertText(&(pPreeditData->aText), call_data->text,
364 : 0 : call_data->chg_first);
365 : : }
366 : : else
367 : : // handle text replacement by deletion and insertion of text,
368 : : // not smart, just good enough
369 : 0 : if ( (call_data->chg_length != 0)
370 : : && (call_data->text->string.wide_char != NULL))
371 : : {
372 : : Preedit_DeleteText(&(pPreeditData->aText),
373 : 0 : call_data->chg_first, call_data->chg_length);
374 : : Preedit_InsertText(&(pPreeditData->aText), call_data->text,
375 : 0 : call_data->chg_first);
376 : : }
377 : : else
378 : : // not really a text update, only attributes are concerned
379 : 0 : if ( (call_data->chg_length != 0)
380 : : && (call_data->text->string.wide_char == NULL))
381 : : {
382 : : Preedit_UpdateAttributes(&(pPreeditData->aText),
383 : : call_data->text->feedback,
384 : 0 : call_data->chg_first, call_data->chg_length);
385 : : }
386 : : }
387 : :
388 : : //
389 : : // build the SalExtTextInputEvent and send it up
390 : : //
391 : 0 : pPreeditData->aInputEv.mnTime = 0;
392 : : pPreeditData->aInputEv.mpTextAttr = Preedit_FeedbackToSAL(
393 : 0 : pPreeditData->aText.pCharStyle, pPreeditData->aText.nLength, pPreeditData->aInputFlags);
394 : 0 : pPreeditData->aInputEv.mnCursorPos = call_data->caret;
395 : : pPreeditData->aInputEv.maText = rtl::OUString(pPreeditData->aText.pUnicodeBuffer,
396 : 0 : pPreeditData->aText.nLength);
397 : 0 : pPreeditData->aInputEv.mnCursorFlags = 0; // default: make cursor visible
398 : 0 : pPreeditData->aInputEv.mnDeltaStart = 0; // call_data->chg_first;
399 : 0 : pPreeditData->aInputEv.mbOnlyCursor = False;
400 : :
401 : 0 : if ( pPreeditData->eState == ePreeditStatusActive && pPreeditData->pFrame )
402 : 0 : pPreeditData->pFrame->CallCallback(SALEVENT_EXTTEXTINPUT, (void*)&pPreeditData->aInputEv);
403 : 0 : if (pPreeditData->aText.nLength == 0 && pPreeditData->pFrame )
404 : 0 : pPreeditData->pFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, (void*)NULL );
405 : :
406 : 0 : if (pPreeditData->aText.nLength == 0)
407 : 0 : pPreeditData->eState = ePreeditStatusStartPending;
408 : :
409 : 0 : GetPreeditSpotLocation(ic, (XPointer)pPreeditData);
410 : : }
411 : :
412 : : void
413 : 0 : GetPreeditSpotLocation(XIC ic, XPointer client_data)
414 : : {
415 : : //
416 : : // Send SalEventExtTextInputPos event to get spotlocation
417 : : //
418 : : SalExtTextInputPosEvent mPosEvent;
419 : 0 : preedit_data_t* pPreeditData = (preedit_data_t*)client_data;
420 : :
421 : 0 : if( pPreeditData->pFrame )
422 : 0 : pPreeditData->pFrame->CallCallback(SALEVENT_EXTTEXTINPUTPOS, (void*)&mPosEvent);
423 : :
424 : : XPoint point;
425 : 0 : point.x = mPosEvent.mnX + mPosEvent.mnWidth;
426 : 0 : point.y = mPosEvent.mnY + mPosEvent.mnHeight;
427 : :
428 : : XVaNestedList preedit_attr;
429 : 0 : preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &point, NULL);
430 : 0 : XSetICValues(ic, XNPreeditAttributes, preedit_attr, NULL);
431 : 0 : XFree(preedit_attr);
432 : :
433 : 0 : return;
434 : : }
435 : :
436 : : // -------------------------------------------------------------------------
437 : : //
438 : : // iv. preedit caret callback
439 : : //
440 : : // -------------------------------------------------------------------------
441 : :
442 : : #if OSL_DEBUG_LEVEL > 1
443 : : void
444 : : PreeditCaretCallback ( XIC ic, XPointer client_data,
445 : : XIMPreeditCaretCallbackStruct *call_data )
446 : : #else
447 : : void
448 : 0 : PreeditCaretCallback ( XIC, XPointer,XIMPreeditCaretCallbackStruct* )
449 : : #endif
450 : : {
451 : : #if OSL_DEBUG_LEVEL > 1
452 : : // XXX PreeditCaretCallback is pure debug code for now
453 : : const char *direction = "?";
454 : : const char *style = "?";
455 : :
456 : : switch ( call_data->style )
457 : : {
458 : : case XIMIsInvisible: style = "Invisible"; break;
459 : : case XIMIsPrimary: style = "Primary"; break;
460 : : case XIMIsSecondary: style = "Secondary"; break;
461 : : }
462 : : switch ( call_data->direction )
463 : : {
464 : : case XIMForwardChar: direction = "Forward char"; break;
465 : : case XIMBackwardChar: direction = "Backward char"; break;
466 : : case XIMForwardWord: direction = "Forward word"; break;
467 : : case XIMBackwardWord: direction = "Backward word"; break;
468 : : case XIMCaretUp: direction = "Caret up"; break;
469 : : case XIMCaretDown: direction = "Caret down"; break;
470 : : case XIMNextLine: direction = "Next line"; break;
471 : : case XIMPreviousLine: direction = "Previous line"; break;
472 : : case XIMLineStart: direction = "Line start"; break;
473 : : case XIMLineEnd: direction = "Line end"; break;
474 : : case XIMAbsolutePosition: direction = "Absolute"; break;
475 : : case XIMDontChange: direction = "Dont change"; break;
476 : : }
477 : :
478 : : fprintf (stderr, "PreeditCaretCallback( ic=%p, client=%p,\n",
479 : : ic, client_data );
480 : : fprintf (stderr, "\t position=%i, direction=\"%s\", style=\"%s\" )\n",
481 : : call_data->position, direction, style );
482 : : #endif
483 : 0 : }
484 : :
485 : : // -----------------------------------------------------------------------
486 : : //
487 : : // v. commit string callback: convert an extended text input (iiimp ... )
488 : : // into an ordinary key-event
489 : : //
490 : : // -----------------------------------------------------------------------
491 : :
492 : : Bool
493 : 0 : IsControlCode(sal_Unicode nChar)
494 : : {
495 : 0 : if ( nChar <= 0x1F /* C0 controls */ )
496 : 0 : return True;
497 : : else
498 : 0 : return False;
499 : : }
500 : :
501 : : // ----------------------------------------------------------------------------------
502 : : //
503 : : // vi. status callbacks: for now these are empty, they are just needed for turbo linux
504 : : //
505 : : // ----------------------------------------------------------------------------------
506 : :
507 : : void
508 : 0 : StatusStartCallback (XIC, XPointer, XPointer)
509 : : {
510 : 0 : return;
511 : : }
512 : :
513 : : void
514 : 0 : StatusDoneCallback (XIC, XPointer, XPointer)
515 : : {
516 : 0 : return;
517 : : }
518 : :
519 : : void
520 : 0 : StatusDrawCallback (XIC, XPointer, XIMStatusDrawCallbackStruct *call_data)
521 : : {
522 : 0 : if( call_data->type == XIMTextType )
523 : : {
524 : 0 : String aText;
525 : 0 : if( call_data->data.text )
526 : : {
527 : : // XIM with text
528 : 0 : sal_Char* pMBString = NULL;
529 : 0 : size_t nLength = 0;
530 : 0 : if( call_data->data.text->encoding_is_wchar )
531 : : {
532 : 0 : if( call_data->data.text->string.wide_char )
533 : : {
534 : 0 : wchar_t* pWString = call_data->data.text->string.wide_char;
535 : 0 : size_t nBytes = wcstombs( NULL, pWString, 1024 );
536 : 0 : pMBString = (sal_Char*)alloca( nBytes+1 );
537 : 0 : nLength = wcstombs( pMBString, pWString, nBytes+1 );
538 : : }
539 : : }
540 : : else
541 : : {
542 : 0 : if( call_data->data.text->string.multi_byte )
543 : : {
544 : 0 : pMBString = call_data->data.text->string.multi_byte;
545 : 0 : nLength = strlen( pMBString );
546 : : }
547 : : }
548 : 0 : if( nLength )
549 : 0 : aText = String( pMBString, nLength, osl_getThreadTextEncoding() );
550 : : }
551 : 0 : ::vcl::I18NStatus::get().setStatusText( aText );
552 : : }
553 : : #if OSL_DEBUG_LEVEL > 1
554 : : else
555 : : {
556 : : fprintf( stderr, "XIMStatusDataType %s not supported\n",
557 : : call_data->type == XIMBitmapType ? "XIMBitmapType" : rtl::OString::valueOf(static_cast<sal_Int32>(call_data->type)).getStr() );
558 : : }
559 : : #endif
560 : 0 : return;
561 : : }
562 : :
563 : : void
564 : 0 : SwitchIMCallback (XIC, XPointer, XPointer call_data)
565 : : {
566 : 0 : XIMSwitchIMNotifyCallbackStruct* pCallData = (XIMSwitchIMNotifyCallbackStruct*)call_data;
567 : 0 : ::vcl::I18NStatus::get().changeIM( rtl::OStringToOUString(pCallData->to->name, RTL_TEXTENCODING_UTF8) );
568 : 0 : }
569 : :
570 : : // ----------------------------------------------------------------------------------
571 : : //
572 : : // vii. destroy callbacks: internally disable all IC/IM calls
573 : : //
574 : : // ----------------------------------------------------------------------------------
575 : :
576 : : void
577 : 0 : IC_IMDestroyCallback (XIM, XPointer client_data, XPointer)
578 : : {
579 : 0 : SalI18N_InputContext *pContext = (SalI18N_InputContext*)client_data;
580 : 0 : if (pContext != NULL)
581 : 0 : pContext->HandleDestroyIM();
582 : 0 : }
583 : :
584 : : void
585 : 0 : IM_IMDestroyCallback (XIM, XPointer client_data, XPointer)
586 : : {
587 : 0 : SalI18N_InputMethod *pMethod = (SalI18N_InputMethod*)client_data;
588 : 0 : if (pMethod != NULL)
589 : 0 : pMethod->HandleDestroyIM();
590 : 0 : }
591 : :
592 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|