Update package version to 0.9.7
[platform/core/uifw/libscl-core.git] / src / sclconnection.cpp
1 /*
2  * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include "sclconnection.h"
19
20 #include "sclconnection-isf.h"
21
22 using namespace scl;
23
24 CSCLConnection::CSCLConnection()
25 {
26     m_backend_identifier = "undefined";
27     m_impl = NULL;
28 }
29
30 CSCLConnection::~CSCLConnection()
31 {
32 }
33
34 std::string CSCLConnection::get_backend_identifier()
35 {
36     return m_backend_identifier;
37 }
38
39 sclboolean CSCLConnection::init()
40 {
41     sclboolean ret = FALSE;
42     if (m_impl == NULL) {
43         /* There could be other backend implementations.. */
44         m_impl = new CSCLConnectionISF;
45     }
46     if (m_impl) {
47         ret = m_impl->init();
48     }
49     return ret;
50 }
51
52 void CSCLConnection::fini()
53 {
54     if (m_impl) {
55         m_impl->fini();
56         delete m_impl;
57         m_impl = NULL;
58     }
59 }
60
61 void CSCLConnection::open_connection(const sclchar *display)
62 {
63     if (m_impl) {
64         m_impl->open_connection(display);
65     }
66 }
67
68 void CSCLConnection::close_connection()
69 {
70     if (m_impl) {
71         m_impl->close_connection();
72     }
73 }
74
75 void CSCLConnection::config_reload()
76 {
77     if (m_impl) {
78         m_impl->config_reload();
79     }
80 }
81
82 sclboolean CSCLConnection::config_read_int(const sclchar *name, sclint &value)
83 {
84     sclboolean ret = FALSE;
85     if (m_impl) {
86         ret = m_impl->config_read_int(name, value);
87     }
88     return ret;
89 }
90
91 sclboolean CSCLConnection::config_read_string(const sclchar *name, std::string &value)
92 {
93     sclboolean ret = FALSE;
94     if (m_impl) {
95         ret = m_impl->config_read_string(name, value);
96     }
97     return ret;
98 }
99
100 sclboolean CSCLConnection::config_write_int(const sclchar *name, sclint value)
101 {
102     sclboolean ret = FALSE;
103     if (m_impl) {
104         ret = m_impl->config_write_int(name, value);
105     }
106     return ret;
107 }
108
109 sclboolean CSCLConnection::config_write_string(const sclchar *name, const std::string value)
110 {
111     sclboolean ret = FALSE;
112     if (m_impl) {
113         ret = m_impl->config_write_string(name, value);
114     }
115     return ret;
116 }
117
118 sclboolean CSCLConnection::config_erase(const sclchar *name)
119 {
120     sclboolean ret = FALSE;
121     if (m_impl) {
122         ret = m_impl->config_erase(name);
123     }
124     return ret;
125 }
126
127 sclboolean CSCLConnection::config_flush(void)
128 {
129     sclboolean ret = FALSE;
130     if (m_impl) {
131         ret = m_impl->config_flush();
132     }
133     return ret;
134 }
135
136 void CSCLConnection::send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value)
137 {
138     if (m_impl) {
139         m_impl->send_imengine_event(ic, ic_uuid, command, value);
140     }
141 }
142
143 void CSCLConnection::reset_keyboard_ise()
144 {
145     if (m_impl) {
146         m_impl->reset_keyboard_ise();
147     }
148 }
149
150 void CSCLConnection::flush_keyboard_ise()
151 {
152     if (m_impl) {
153         m_impl->flush_keyboard_ise();
154     }
155 }
156
157 void CSCLConnection::send_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask)
158 {
159     if (m_impl) {
160         m_impl->send_key_event(ic, ic_uuid, keycode, keymask);
161     }
162 }
163
164 void CSCLConnection::forward_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask)
165 {
166     if (m_impl) {
167         m_impl->forward_key_event(ic, ic_uuid, keycode, keymask);
168     }
169 }
170
171 void CSCLConnection::commit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str)
172 {
173     if (m_impl) {
174         m_impl->commit_string(ic, ic_uuid, str);
175     }
176 }
177
178 void CSCLConnection::select_candidate(int index)
179 {
180     if (m_impl) {
181         m_impl->select_candidate(index);
182     }
183 }
184
185 void CSCLConnection::show_preedit_string(sclint ic, const sclchar *ic_uuid)
186 {
187     if (m_impl) {
188         m_impl->show_preedit_string(ic, ic_uuid);
189     }
190 }
191
192 void CSCLConnection::show_aux_string(void)
193 {
194     if (m_impl) {
195         m_impl->show_aux_string();
196     }
197 }
198
199 void CSCLConnection::show_candidate_string(void)
200 {
201     if (m_impl) {
202         m_impl->show_candidate_string();
203     }
204 }
205
206 void CSCLConnection::show_associate_string(void)
207 {
208     if (m_impl) {
209         m_impl->show_associate_string();
210     }
211 }
212
213 void CSCLConnection::hide_preedit_string(sclint ic, const sclchar *ic_uuid)
214 {
215     if (m_impl) {
216         m_impl->hide_preedit_string(ic, ic_uuid);
217     }
218 }
219
220 void CSCLConnection::hide_aux_string(void)
221 {
222     if (m_impl) {
223         m_impl->hide_aux_string();
224     }
225 }
226
227 void CSCLConnection::hide_candidate_string(void)
228 {
229     if (m_impl) {
230         m_impl->hide_candidate_string();
231     }
232 }
233
234 void CSCLConnection::hide_associate_string(void)
235 {
236     if (m_impl) {
237         m_impl->hide_associate_string();
238     }
239 }
240
241 void CSCLConnection::update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str)
242 {
243     if (m_impl) {
244         m_impl->update_preedit_string(ic, ic_uuid, str);
245     }
246 }
247
248 void CSCLConnection::update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str, const scim::AttributeList &attrs)
249 {
250     if (m_impl) {
251         m_impl->update_preedit_string(ic, ic_uuid, str, attrs);
252     }
253 }
254
255 void CSCLConnection::update_preedit_caret(sclint caret)
256 {
257     if (m_impl) {
258         m_impl->update_preedit_caret(caret);
259     }
260 }
261
262 void CSCLConnection::update_aux_string(const sclchar *str)
263 {
264     if (m_impl) {
265         m_impl->update_aux_string(str);
266     }
267 }
268
269 void CSCLConnection::update_input_context(sclu32 type, sclu32 value)
270 {
271     if (m_impl) {
272         m_impl->update_input_context(type, value);
273     }
274 }
275
276 void CSCLConnection::update_geometry(sclint x, sclint y, sclint width, sclint height)
277 {
278     if (m_impl) {
279         m_impl->update_geometry(x, y, width, height);
280     }
281 }
282
283 void CSCLConnection::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const
284 {
285     if (m_impl) {
286         m_impl->get_surrounding_text(ic_uuid, maxlen_before, maxlen_after);
287     }
288 }
289
290 sclint CSCLConnection::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
291 {
292     sclint ret = -1;
293     if (m_impl) {
294         ret = m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
295     }
296     return ret;
297 }
298
299 void CSCLConnection::delete_surrounding_text(sclint offset, sclint len) const
300 {
301     if (m_impl) {
302         m_impl->delete_surrounding_text(offset, len);
303     }
304 }
305
306 void CSCLConnection::set_candidate_position(sclint left, sclint top)
307 {
308     if (m_impl) {
309         m_impl->set_candidate_position(left, top);
310     }
311 }
312
313 void CSCLConnection::enable_soft_candidate(sclboolean enable)
314 {
315     if (m_impl) {
316         m_impl->enable_soft_candidate(enable);
317     }
318 }
319
320 void CSCLConnection::candidate_hide(void)
321 {
322     if (m_impl) {
323         m_impl->candidate_hide();
324     }
325 }
326
327 void CSCLConnection::set_keyboard_ise_by_uuid(const sclchar *uuid)
328 {
329     if (m_impl) {
330         m_impl->set_keyboard_ise_by_uuid(uuid);
331     }
332 }
333
334 void CSCLConnection::get_keyboard_ise(const sclchar *uuid)
335 {
336     if (m_impl) {
337         m_impl->get_keyboard_ise(uuid);
338     }
339 }
340
341 void CSCLConnection::set_selection(sclint start, sclint end)
342 {
343     if (m_impl) {
344         m_impl->set_selection(start, end);
345     }
346 }
347
348 void CSCLConnection::send_private_command(const sclchar *command)
349 {
350     if (m_impl) {
351         m_impl->send_private_command(command);
352     }
353 }
354
355 void CSCLConnection::get_selection_text(sclchar **text)
356 {
357     if (m_impl) {
358         m_impl->get_selection_text(text);
359     }
360 }
361
362 void CSCLConnection::request_ise_hide()
363 {
364     if (m_impl) {
365         m_impl->request_ise_hide();
366     }
367 }
368
369 void CSCLConnection::commit_content(const sclchar *content, const sclchar *description, const sclchar *mime_types)
370 {
371     if (m_impl) {
372         m_impl->commit_content(content, description, mime_types);
373     }
374 }
375
376 void CSCLConnection::update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret)
377 {
378     if (m_impl) {
379         m_impl->update_preedit_string_with_commit(preedit, commit, attrs, caret);
380     }
381 }
382
383 void CSCLConnection::recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs)
384 {
385     if (m_impl) {
386         m_impl->recapture_string(offset, len, preedit, commit, attrs);
387     }
388 }
389
390 void CSCLConnection::update_lookup_table(const scim::LookupTable &table)
391 {
392     if (m_impl) {
393         m_impl->update_lookup_table(table);
394     }
395 }
396
397 void CSCLConnection::register_properties(const scim::PropertyList &properties)
398 {
399     if (m_impl) {
400         m_impl->register_properties(properties);
401     }
402 }
403
404 void CSCLConnection::update_property(const scim::Property &property)
405 {
406     if (m_impl) {
407         m_impl->update_property(property);
408     }
409 }
410
411 void CSCLConnection::expand_candidate(void)
412 {
413     if (m_impl) {
414         m_impl->expand_candidate();
415     }
416 }
417
418 void CSCLConnection::contract_candidate(void)
419 {
420     if (m_impl) {
421         m_impl->contract_candidate();
422     }
423 }
424
425 void CSCLConnection::set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode)
426 {
427     if (m_impl) {
428         m_impl->set_candidate_style(portrait_line, mode);
429     }
430 }
431
432 void CSCLConnection::set_engine_loader_flag(sclboolean flag)
433 {
434     if (m_impl) {
435         m_impl->set_engine_loader_flag(flag);
436     }
437 }
438
439 void CSCLConnection::send_key_event_processing_result(scim::KeyEvent &key, sclu32 serial, sclboolean is_success)
440 {
441     if (m_impl) {
442         m_impl->send_key_event_processing_result(key, serial, is_success);
443     }
444 }
445
446 void CSCLConnection::set_floating_mode(sclboolean floating_mode)
447 {
448     if (m_impl) {
449         m_impl->set_floating_mode(floating_mode);
450     }
451 }
452
453 void CSCLConnection::set_floating_drag_enabled(sclboolean enabled)
454 {
455     if (m_impl) {
456         m_impl->set_floating_drag_enabled(enabled);
457     }
458 }