Check keyboard mode before sending ise state variables
[platform/core/uifw/isf.git] / ism / src / isf_panel_agent_base.cpp
1 /** @file isf_panel_agent_base.cpp
2  *  @brief Implementation of class PanelAgentBase.
3  */
4
5 /* ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable. */
6
7 /*
8  * Smart Common Input Method
9  *
10  * Copyright (c) 2005 James Su <suzhe@tsinghua.org.cn>
11  * Copyright (c) 2012-2016 Samsung Electronics Co., Ltd.
12  *
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this program; if not, write to the
26  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
27  * Boston, MA  02111-1307  USA
28  *
29  */
30
31 #define Uses_SCIM_TRANSACTION
32 #define Uses_SCIM_TRANS_COMMANDS
33 #define Uses_SCIM_PANEL_AGENT
34 #define Uses_SCIM_HELPER
35 #define Uses_SCIM_SOCKET
36 #define Uses_SCIM_EVENT
37 #define Uses_SCIM_CONFIG
38 #define Uses_SCIM_CONFIG_MODULE
39 #define Uses_SCIM_CONFIG_PATH
40 #define Uses_SCIM_UTILITY
41
42 #include <string.h>
43 #include <sys/types.h>
44 #include <sys/times.h>
45 #include <dlog.h>
46 #include <unistd.h>
47 #include "scim_private.h"
48 #include "scim.h"
49 #include "scim_stl_map.h"
50 #include "isf_debug.h"
51
52 #ifdef LOG_TAG
53 # undef LOG_TAG
54 #endif
55 #define LOG_TAG             "ISF_PANEL_AGENT_BASE"
56
57
58 namespace scim
59 {
60
61
62 PanelAgentBase::PanelAgentBase (const String& name)
63     :m_name (name)
64 {
65     m_impl = NULL;
66 }
67
68 PanelAgentBase::~PanelAgentBase ()
69 {
70 }
71
72 bool PanelAgentBase::initialize (InfoManager* info_manager, const String& display, bool resident)
73 {
74     LOGW ("not implemented for %s", m_name.c_str ());
75     return false;
76 }
77
78 bool PanelAgentBase::valid (void) const
79 {
80     LOGW ("not implemented for %s", m_name.c_str ());
81     return false;
82 }
83
84 void PanelAgentBase::stop (void)
85 {
86     LOGW ("not implemented for %s", m_name.c_str ());
87 }
88
89
90 void PanelAgentBase::update_panel_event (int client,  uint32 context, int cmd, uint32 nType, uint32 nValue)
91 {
92     LOGW ("not implemented for %s", m_name.c_str ());
93 }
94
95 void PanelAgentBase::reset_keyboard_ise (int client, uint32 context)
96 {
97     LOGW ("not implemented for %s", m_name.c_str ());
98 }
99
100 void PanelAgentBase::update_keyboard_ise_list (int client, uint32 context)
101 {
102     LOGW ("not implemented for %s", m_name.c_str ());
103 }
104
105 void PanelAgentBase::change_factory (int client, uint32 context, const String&  uuid)
106 {
107     LOGW ("not implemented for %s", m_name.c_str ());
108 }
109
110 void PanelAgentBase::helper_candidate_show (int client, uint32 context, const String&  uuid)
111 {
112     LOGW ("not implemented for %s", m_name.c_str ());
113 }
114
115 void PanelAgentBase::helper_candidate_hide (int client, uint32 context, const String&  uuid)
116 {
117     LOGW ("not implemented for %s", m_name.c_str ());
118 }
119
120 /* if the uuid is empty, it must send to panelclient otherwise HelperAgent
121  */
122 void PanelAgentBase::candidate_more_window_show (int client, uint32 context)
123 {
124     LOGW ("not implemented for %s", m_name.c_str ());
125 }
126 /* if the uuid is empty, it must send to panelclient otherwise HelperAgent
127  */
128 void PanelAgentBase::candidate_more_window_hide (int client, uint32 context)
129 {
130     LOGW ("not implemented for %s", m_name.c_str ());
131 }
132
133 void PanelAgentBase::update_helper_lookup_table (int client, uint32 context, const String&  uuid, const LookupTable& table)
134 {
135     LOGW ("not implemented for %s", m_name.c_str ());
136 }
137
138 //select_aux
139 //helper_select_aux
140 //SCIM_TRANS_CMD_SELECT_AUX
141 //this function called by two places, will send message to help(with uuid) or app
142 void PanelAgentBase::select_aux (int client, uint32 context, uint32 item)
143 {
144     LOGW ("not implemented for %s", m_name.c_str ());
145 }
146 //SCIM_TRANS_CMD_SELECT_CANDIDATE
147 //this function called by two places, will send message to help(with uuid) or app
148 void PanelAgentBase::select_candidate (int client, uint32 context, uint32 item)
149 {
150     LOGW ("not implemented for %s", m_name.c_str ());
151 }
152
153 void PanelAgentBase::lookup_table_page_up (int client, uint32 context)
154 {
155     LOGW ("not implemented for %s", m_name.c_str ());
156 }
157
158 void PanelAgentBase::lookup_table_page_down (int client, uint32 context)
159 {
160     LOGW ("not implemented for %s", m_name.c_str ());
161 }
162
163 void PanelAgentBase::update_lookup_table_page_size (int client, uint32 context, uint32 size)
164 {
165     LOGW ("not implemented for %s", m_name.c_str ());
166 }
167
168 void PanelAgentBase::update_candidate_item_layout (int client, uint32 context, const std::vector<uint32>& row_items)
169 {
170     LOGW ("not implemented for %s", m_name.c_str ());
171 }
172
173 void PanelAgentBase::select_associate (int client, uint32 context, uint32 item)
174 {
175     LOGW ("not implemented for %s", m_name.c_str ());
176 }
177
178 void PanelAgentBase::associate_table_page_up (int client, uint32 context)
179 {
180     LOGW ("not implemented for %s", m_name.c_str ());
181 }
182
183 void PanelAgentBase::associate_table_page_down (int client, uint32 context)
184 {
185     LOGW ("not implemented for %s", m_name.c_str ());
186 }
187
188 void PanelAgentBase::update_associate_table_page_size (int client, uint32 context, uint32 size)
189 {
190     LOGW ("not implemented for %s", m_name.c_str ());
191 }
192
193 void PanelAgentBase::update_displayed_candidate_number (int client, uint32 context, uint32 size)
194 {
195     LOGW ("not implemented for %s", m_name.c_str ());
196 }
197
198 void PanelAgentBase::send_longpress_event (int client, uint32 context, uint32 index)
199 {
200     LOGW ("not implemented for %s", m_name.c_str ());
201 }
202
203 void PanelAgentBase::trigger_property (int client, uint32 context, const String&  property)
204 {
205     LOGW ("not implemented for %s", m_name.c_str ());
206 }
207
208 void PanelAgentBase::socket_start_helper (int client, uint32 context, const String& ic_uuid)
209 {
210     LOGW ("not implemented for %s", m_name.c_str ());
211 }
212
213
214 void PanelAgentBase::exit (int client, uint32 context)
215 {
216     LOGW ("not implemented for %s", m_name.c_str ());
217 }
218
219 void PanelAgentBase::focus_out_helper (int client, uint32 context, const String& uuid)
220 {
221     LOGW ("not implemented for %s", m_name.c_str ());
222 }
223
224 void PanelAgentBase::focus_in_helper (int client, uint32 context, const String& uuid)
225 {
226     LOGW ("not implemented for %s", m_name.c_str ());
227 }
228
229 void PanelAgentBase::show_helper (int client, uint32 context, const String& uuid, char* data, size_t& len)
230 {
231     LOGW ("not implemented for %s", m_name.c_str ());
232 }
233
234 void PanelAgentBase::hide_helper (int client, uint32 context, const String& uuid)
235 {
236     LOGW ("not implemented for %s", m_name.c_str ());
237 }
238
239 void PanelAgentBase::set_helper_mode (int client, uint32 context, const String& uuid, uint32& mode)
240 {
241     LOGW ("not implemented for %s", m_name.c_str ());
242 }
243
244 void PanelAgentBase::set_helper_language (int client, uint32 context, const String& uuid, uint32& language)
245 {
246     LOGW ("not implemented for %s", m_name.c_str ());
247 }
248
249 void PanelAgentBase::set_helper_imdata (int client, uint32 context, const String& uuid, const char* imdata, size_t& len)
250 {
251     LOGW ("not implemented for %s", m_name.c_str ());
252 }
253
254 void PanelAgentBase::set_helper_return_key_type (int client, uint32 context, const String& uuid, uint32 type)
255 {
256     LOGW ("not implemented for %s", m_name.c_str ());
257 }
258
259 void PanelAgentBase::get_helper_return_key_type (int client, uint32 context, const String& uuid, _OUT_ uint32& type)
260 {
261     LOGW ("not implemented for %s", m_name.c_str ());
262 }
263
264 void PanelAgentBase::set_helper_return_key_disable (int client, uint32 context, const String& uuid, uint32 disabled)
265 {
266     LOGW ("not implemented for %s", m_name.c_str ());
267 }
268
269 void PanelAgentBase::get_helper_return_key_disable (int client, uint32 context, const String& uuid, _OUT_ uint32& disabled)
270 {
271     LOGW ("not implemented for %s", m_name.c_str ());
272 }
273
274 void PanelAgentBase::set_helper_layout (int client, uint32 context, const String& uuid, uint32& layout)
275 {
276     LOGW ("not implemented for %s", m_name.c_str ());
277 }
278
279 void PanelAgentBase::set_helper_input_mode (int client, uint32 context, const String& uuid, uint32& mode)
280 {
281     LOGW ("not implemented for %s", m_name.c_str ());
282 }
283
284 void PanelAgentBase::set_helper_input_hint (int client, uint32 context, const String& uuid, uint32& hint)
285 {
286     LOGW ("not implemented for %s", m_name.c_str ());
287 }
288
289 void PanelAgentBase::set_helper_bidi_direction (int client, uint32 context, const String& uuid, uint32& direction)
290 {
291     LOGW ("not implemented for %s", m_name.c_str ());
292 }
293
294 void PanelAgentBase::set_helper_caps_mode (int client, uint32 context, const String& uuid, uint32& mode)
295 {
296     LOGW ("not implemented for %s", m_name.c_str ());
297 }
298
299 void PanelAgentBase::show_helper_option_window (int client, uint32 context, const String& uuid)
300 {
301     LOGW ("not implemented for %s", m_name.c_str ());
302 }
303
304 void PanelAgentBase::resume_helper_option_window (int client, uint32 context, const String& uuid)
305 {
306     LOGW ("not implemented for %s", m_name.c_str ());
307 }
308
309 void PanelAgentBase::set_helper_keyboard_mode (int client, uint32 context, const String& uuid, uint32& mode)
310 {
311     LOGW ("not implemented for %s", m_name.c_str ());
312 }
313
314 bool PanelAgentBase::process_key_event (int client, uint32 context, const String& uuid, KeyEvent& key, uint32 serial)
315 {
316     LOGW ("not implemented for %s", m_name.c_str ());
317     return false;
318 }
319
320 bool PanelAgentBase::get_helper_geometry (int client, uint32 context, String& uuid, _OUT_ struct rectinfo& info)
321 {
322     LOGW ("not implemented for %s", m_name.c_str ());
323     return false;
324 }
325
326 void PanelAgentBase::get_helper_imdata (int client, uint32 context, String& uuid, _OUT_ char** imdata, _OUT_ size_t& len)
327 {
328     LOGW ("not implemented for %s", m_name.c_str ());
329 }
330
331 void PanelAgentBase::get_helper_layout (int client, uint32 context, String& uuid, uint32& layout)
332 {
333     LOGW ("not implemented for %s", m_name.c_str ());
334 }
335
336
337 void PanelAgentBase::get_ise_language_locale (int client, uint32 context, String& uuid, _OUT_ char** data, _OUT_ size_t& len)
338 {
339     LOGW ("not implemented for %s", m_name.c_str ());
340 }
341
342 void PanelAgentBase::check_option_window (int client, uint32 context, String& uuid, _OUT_ uint32& avail)
343 {
344     LOGW ("not implemented for %s", m_name.c_str ());
345 }
346
347 void PanelAgentBase::reset_ise_option (int client, uint32 context)
348 {
349     LOGW ("not implemented for %s", m_name.c_str ());
350 }
351
352 void PanelAgentBase::reset_helper_context (int client, uint32 context, const String& uuid)
353 {
354     LOGW ("not implemented for %s", m_name.c_str ());
355 }
356
357 void PanelAgentBase::reload_config (int client)
358 {
359     LOGW ("not implemented for %s", m_name.c_str ());
360 }
361
362 void PanelAgentBase::socket_update_surrounding_text (int client, uint32 context, const String& uuid, String& text, uint32 cursor)
363 {
364     LOGW ("not implemented for %s", m_name.c_str ());
365 }
366
367 void PanelAgentBase::socket_remoteinput_focus_in (int client)
368 {
369     LOGW ("not implemented for %s", m_name.c_str ());
370 }
371
372 void PanelAgentBase::socket_remoteinput_focus_out (int client)
373 {
374     LOGW ("not implemented for %s", m_name.c_str ());
375 }
376
377 void PanelAgentBase::socket_remoteinput_entry_metadata (int client, uint32 hint, uint32 layout, int variation, uint32 autocapital_type, int return_key_disabled)
378 {
379     LOGW ("not implemented for %s", m_name.c_str ());
380 }
381
382 void PanelAgentBase::socket_remoteinput_surrounding_text (int client, String& text, uint32 cursor)
383 {
384     LOGW ("not implemented for %s", m_name.c_str ());
385 }
386
387 void PanelAgentBase::socket_remoteinput_input_resource (int client, uint32 input_resource)
388 {
389     LOGW ("not implemented for %s", m_name.c_str ());
390 }
391
392 void PanelAgentBase::socket_update_selection (int client, uint32 context, String& uuid, String text)
393 {
394     LOGW ("not implemented for %s", m_name.c_str ());
395 }
396
397 void PanelAgentBase::socket_get_keyboard_ise_list (int client, uint32 context, const String& uuid, std::vector<String>& list)
398 {
399     LOGW ("not implemented for %s", m_name.c_str ());
400 }
401
402 void PanelAgentBase::socket_get_candidate_ui (int client, uint32 context, const String& uuid,  int style,  int mode)
403 {
404     LOGW ("not implemented for %s", m_name.c_str ());
405 }
406
407 void PanelAgentBase::socket_get_candidate_geometry (int client, uint32 context, const String& uuid, struct rectinfo& info)
408 {
409     LOGW ("not implemented for %s", m_name.c_str ());
410 }
411 void PanelAgentBase::socket_get_keyboard_ise (int client, uint32 context, const String& uuid, String& ise_name, String& ise_uuid)
412 {
413     LOGW ("not implemented for %s", m_name.c_str ());
414 }
415
416 void PanelAgentBase::helper_detach_input_context (int client, uint32 context, const String& ic_uuid)
417 {
418     LOGW ("not implemented for %s", m_name.c_str ());
419 }
420
421 void PanelAgentBase::helper_process_imengine_event (int client, uint32 context, const String& ic_uuid, const Transaction& nest_transaction)
422 {
423     LOGW ("not implemented for %s", m_name.c_str ());
424 }
425
426 void PanelAgentBase::process_helper_event (int client, uint32 context, String target_uuid, String active_uuid, Transaction& nest_trans)
427 {
428     LOGW ("not implemented for %s", m_name.c_str ());
429 }
430
431 void PanelAgentBase::socket_helper_key_event (int client, uint32 context, int cmd , KeyEvent& key)
432 {
433     LOGW ("not implemented for %s", m_name.c_str ());
434 }
435
436 //SCIM_TRANS_CMD_GET_SURROUNDING_TEXT
437 //socket_helper_get_surrounding_text
438 void PanelAgentBase::socket_helper_get_surrounding_text (int client, uint32 context, uint32 maxlen_before, uint32 maxlen_after)
439 {
440     LOGW ("not implemented for %s", m_name.c_str ());
441 }
442 //SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT
443 //socket_helper_delete_surrounding_text
444 void PanelAgentBase::socket_helper_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len)
445 {
446     LOGD ("not implemented ");
447 }
448 //SCIM_TRANS_CMD_GET_SELECTION
449 void PanelAgentBase::socket_helper_get_selection (int client, uint32 context)
450 {
451     LOGW ("not implemented for %s", m_name.c_str ());
452 }
453 //SCIM_TRANS_CMD_SET_SELECTION
454 void PanelAgentBase::socket_helper_set_selection (int client, uint32 context, uint32 start, uint32 end)
455 {
456     LOGW ("not implemented for %s", m_name.c_str ());
457 }
458
459 //socket_helper_update_input_context
460 //ISM_TRANS_CMD_UPDATE_ISE_INPUT_CONTEXT
461 void PanelAgentBase::update_ise_input_context (int client, uint32 context, uint32 type, uint32 value)
462 {
463     LOGW ("not implemented for %s", m_name.c_str ());
464 }
465
466 //socket_helper_send_private_command
467 //SCIM_TRANS_CMD_SEND_PRIVATE_COMMAND
468 void PanelAgentBase::send_private_command (int client, uint32 context, const String& command)
469 {
470     LOGW ("not implemented for %s", m_name.c_str ());
471 }
472
473 //SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
474 void PanelAgentBase::helper_all_update_spot_location (int client, uint32 context, String uuid, int x, int y)
475 {
476     LOGW ("not implemented for %s", m_name.c_str ());
477 }
478 //ISM_TRANS_CMD_UPDATE_CURSOR_POSITION
479 void PanelAgentBase::helper_all_update_cursor_position (int client, uint32 context, String uuid, int cursor_pos)
480 {
481     LOGW ("not implemented for %s", m_name.c_str ());
482 }
483 //SCIM_TRANS_CMD_UPDATE_SCREEN
484 void PanelAgentBase::helper_all_update_screen (int client, uint32 context, String uuid, int screen)
485 {
486     LOGW ("not implemented for %s", m_name.c_str ());
487 }
488
489 //socket_helper_commit_string
490 //SCIM_TRANS_CMD_COMMIT_STRING
491 void PanelAgentBase::commit_string (int client, uint32 context,const WideString& wstr)
492 {
493     LOGW ("not implemented for %s", m_name.c_str ());
494 }
495 //socket_helper_show_preedit_string
496 //SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
497 void PanelAgentBase::show_preedit_string (int client, uint32 context)
498 {
499     LOGW ("not implemented for %s", m_name.c_str ());
500 }
501 //socket_helper_hide_preedit_string
502 //SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
503 void PanelAgentBase::hide_preedit_string (int client, uint32 context)
504 {
505     LOGW ("not implemented for %s", m_name.c_str ());
506 }
507 //socket_helper_update_preedit_string
508 //SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
509 void PanelAgentBase::update_preedit_string (int client, uint32 context, WideString preedit, WideString commit, AttributeList& attrs, uint32 caret)
510 {
511     LOGW ("not implemented for %s", m_name.c_str ());
512 }
513 //socket_helper_update_preedit_caret
514 //SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
515 void PanelAgentBase::update_preedit_caret (int client, uint32 context, uint32 caret)
516 {
517     LOGW ("not implemented for %s", m_name.c_str ());
518 }
519 //socket_helper_recapture_string
520 //ISM_TRANS_CMD_RECAPTURE_STRING
521 void PanelAgentBase::recapture_string (int client, uint32 context, int offset, int len, WideString preedit, WideString commit, AttributeList& attrs)
522 {
523     LOGW ("not implemented for %s", m_name.c_str ());
524 }
525 //socket_helper_register_helper
526 //SCIM_TRANS_CMD_HELPER_ATTACH_INPUT_CONTEXT
527 //SCIM_TRANS_CMD_UPDATE_SCREEN
528 void PanelAgentBase::helper_attach_input_context_and_update_screen (int client, std::vector < std::pair <uint32, String> >& helper_ic_index,
529         uint32 current_screen)
530 {
531     LOGW ("not implemented for %s", m_name.c_str ());
532 }
533
534 void PanelAgentBase::hide_helper_ise (int client, uint32 context)
535 {
536     LOGW ("not implemented for %s", m_name.c_str ());
537 }
538
539 bool PanelAgentBase::process_input_device_event(int client, uint32 context, const String& uuid, uint32 type, const char *data, size_t len, _OUT_ uint32& result)
540 {
541     LOGW("not implemented for %s", m_name.c_str());
542     return false;
543 }
544
545 void PanelAgentBase::process_key_event_done(int client, uint32 context, KeyEvent &key, uint32 ret, uint32 serial)
546 {
547     LOGW("not implemented for %s", m_name.c_str());
548 }
549
550 void PanelAgentBase::request_ise_hide(int client, uint32 context)
551 {
552     LOGW("not implemented for %s", m_name.c_str());
553 }
554
555 void PanelAgentBase::set_autocapital_type(int client, uint32 context, String uuid, int mode)
556 {
557     LOGW("not implemented for %s", m_name.c_str());
558 }
559
560 void PanelAgentBase::update_ise_geometry (int client, uint32 context, uint32 x, uint32 y, uint32 width, uint32 height)
561 {
562     LOGW ("not implemented for %s", m_name.c_str ());
563 }
564
565 void PanelAgentBase::remote_update_preedit_string (int client, uint32 context, const WideString str, const WideString commit, const AttributeList &attrs, uint32 caret)
566 {
567     LOGW ("not implemented for %s", m_name.c_str ());
568 }
569
570 void PanelAgentBase::remote_send_key_event (int client, uint32 context, const KeyEvent &key)
571 {
572     LOGW ("not implemented for %s", m_name.c_str ());
573 }
574
575 void PanelAgentBase::remote_forward_key_event (int client, uint32 context, const KeyEvent &key)
576 {
577     LOGW ("not implemented for %s", m_name.c_str ());
578 }
579
580 void PanelAgentBase::remote_commit_string (int client, uint32 context,const WideString& wstr)
581 {
582     LOGW ("not implemented for %s", m_name.c_str ());
583 }
584
585 void PanelAgentBase::remote_delete_surrounding_text (int client, uint32 context, uint32 offset, uint32 len)
586 {
587     LOGD ("not implemented ");
588 }
589
590 void PanelAgentBase::set_prediction_allow (int client, uint32 context, String uuid, int mode)
591 {
592     LOGW ("not implemented for %s", m_name.c_str ());
593 }
594
595 void PanelAgentBase::send_fail_reply (int client)
596 {
597     LOGW ("not implemented for %s", m_name.c_str ());
598 }
599 } /* namespace scim */
600
601 /*
602 vi:ts=4:nowrap:ai:expandtab
603 */