Update package version to 0.9.7
[platform/core/uifw/libscl-core.git] / src / sclcore.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 "sclcore.h"
19 #include "sclcoreimpl.h"
20
21 using namespace scl;
22
23 CSCLCore::CSCLCore(ISCLCoreEventCallback *callback)
24 {
25     m_impl = CSCLCoreImpl::get_instance();
26
27     if (m_impl) {
28         m_impl->set_core_event_callback(callback);
29     }
30 }
31
32 CSCLCore::~CSCLCore()
33 {
34     m_impl = NULL;
35 }
36
37 void CSCLCore::init()
38 {
39     if (m_impl) {
40         m_impl->init();
41     }
42 }
43
44 void CSCLCore::prepare()
45 {
46     if (m_impl) {
47         m_impl->prepare();
48     }
49 }
50
51 void CSCLCore::fini()
52 {
53     if (m_impl) {
54         m_impl->fini();
55     }
56 }
57
58 void CSCLCore::run()
59 {
60     if (m_impl) {
61         m_impl->run();
62     }
63 }
64
65 void CSCLCore::config_reload()
66 {
67     if (m_impl) {
68         m_impl->config_reload();
69     }
70 }
71
72 sclboolean CSCLCore::config_read_int(const sclchar *name, sclint &value)
73 {
74     sclboolean ret = FALSE;
75     if (m_impl) {
76         ret = m_impl->config_read_int(name, value);
77     }
78     return ret;
79 }
80
81 sclboolean CSCLCore::config_read_string(const sclchar *name, std::string &value)
82 {
83     sclboolean ret = FALSE;
84     if (m_impl) {
85         ret = m_impl->config_read_string(name, value);
86     }
87     return ret;
88 }
89
90 sclboolean CSCLCore::config_write_int(const sclchar *name, sclint value)
91 {
92     sclboolean ret = FALSE;
93     if (m_impl) {
94         ret = m_impl->config_write_int(name, value);
95     }
96     return ret;
97 }
98
99 sclboolean CSCLCore::config_write_string(const sclchar *name, const std::string value)
100 {
101     sclboolean ret = FALSE;
102     if (m_impl) {
103         ret = m_impl->config_write_string(name, value);
104     }
105     return ret;
106 }
107
108 sclboolean CSCLCore::config_erase(const sclchar *name)
109 {
110     sclboolean ret = FALSE;
111     if (m_impl) {
112         ret = m_impl->config_erase(name);
113     }
114     return ret;
115 }
116
117 sclboolean CSCLCore::config_flush(void)
118 {
119     sclboolean ret = FALSE;
120     if (m_impl) {
121         ret = m_impl->config_flush();
122     }
123     return ret;
124 }
125
126 void CSCLCore::send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value)
127 {
128     if (m_impl) {
129         m_impl->send_imengine_event(ic, ic_uuid, command, value);
130     }
131 }
132
133 void CSCLCore::reset_keyboard_ise()
134 {
135     if (m_impl) {
136         m_impl->reset_keyboard_ise();
137     }
138 }
139
140 void CSCLCore::flush_keyboard_ise()
141 {
142     if (m_impl) {
143         m_impl->flush_keyboard_ise();
144     }
145 }
146
147 void CSCLCore::send_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask)
148 {
149     if (m_impl) {
150         m_impl->send_key_event(ic, ic_uuid, keycode, keymask);
151     }
152 }
153
154 void CSCLCore::forward_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask)
155 {
156     if (m_impl) {
157         m_impl->forward_key_event(ic, ic_uuid, keycode, keymask);
158     }
159 }
160
161 void CSCLCore::commit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str)
162 {
163     if (m_impl) {
164         m_impl->commit_string(ic, ic_uuid, str);
165     }
166 }
167
168 void CSCLCore::select_candidate(int index)
169 {
170     if (m_impl) {
171         m_impl->select_candidate(index);
172     }
173 }
174
175 void CSCLCore::show_preedit_string(sclint ic, const sclchar *ic_uuid)
176 {
177     if (m_impl) {
178         m_impl->show_preedit_string(ic, ic_uuid);
179     }
180 }
181
182 void CSCLCore::show_aux_string(void)
183 {
184     if (m_impl) {
185         m_impl->show_aux_string();
186     }
187 }
188
189 void CSCLCore::show_candidate_string(void)
190 {
191     if (m_impl) {
192         m_impl->show_candidate_string();
193     }
194 }
195
196 void CSCLCore::show_associate_string(void)
197 {
198     if (m_impl) {
199         m_impl->show_associate_string();
200     }
201 }
202
203 void CSCLCore::hide_preedit_string(sclint ic, const sclchar *ic_uuid)
204 {
205     if (m_impl) {
206         m_impl->hide_preedit_string(ic, ic_uuid);
207     }
208 }
209
210 void CSCLCore::hide_aux_string(void)
211 {
212     if (m_impl) {
213         m_impl->hide_aux_string();
214     }
215 }
216
217 void CSCLCore::hide_candidate_string(void)
218 {
219     if (m_impl) {
220         m_impl->hide_candidate_string();
221     }
222 }
223
224 void CSCLCore::hide_associate_string(void)
225 {
226     if (m_impl) {
227         m_impl->hide_associate_string();
228     }
229 }
230
231 void CSCLCore::update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str)
232 {
233     if (m_impl) {
234         m_impl->update_preedit_string(ic, ic_uuid, str);
235     }
236 }
237
238 void CSCLCore::update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str, const scim::AttributeList &attrs)
239 {
240     if (m_impl) {
241         m_impl->update_preedit_string(ic, ic_uuid, str, attrs);
242     }
243 }
244
245 void CSCLCore::update_preedit_caret(sclint caret)
246 {
247     if (m_impl) {
248         m_impl->update_preedit_caret(caret);
249     }
250 }
251
252 void CSCLCore::update_aux_string(const sclchar *str)
253 {
254     if (m_impl) {
255         m_impl->update_aux_string(str);
256     }
257 }
258
259 void CSCLCore::update_input_context(sclu32 type, sclu32 value)
260 {
261     if (m_impl) {
262         m_impl->update_input_context(type, value);
263     }
264 }
265
266 void CSCLCore::update_geometry(sclint x, sclint y, sclint width, sclint height)
267 {
268     if (m_impl) {
269         m_impl->update_geometry(x, y, width, height);
270     }
271 }
272
273 void CSCLCore::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const
274 {
275     if (m_impl) {
276         m_impl->get_surrounding_text(ic_uuid, maxlen_before, maxlen_after);
277     }
278 }
279
280 sclint CSCLCore::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const
281 {
282     sclint ret = -1;
283     if (m_impl) {
284         ret = m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
285     }
286     return ret;
287 }
288
289 void CSCLCore::delete_surrounding_text(sclint offset, sclint len) const
290 {
291     if (m_impl) {
292         m_impl->delete_surrounding_text(offset, len);
293     }
294 }
295
296 void CSCLCore::set_candidate_position(sclint left, sclint top)
297 {
298     if (m_impl) {
299         m_impl->set_candidate_position(left, top);
300     }
301 }
302
303 void CSCLCore::enable_soft_candidate(sclboolean enable)
304 {
305     if (m_impl) {
306         m_impl->enable_soft_candidate(enable);
307     }
308 }
309
310 void CSCLCore::candidate_hide(void)
311 {
312     if (m_impl) {
313         m_impl->candidate_hide();
314     }
315 }
316
317 void CSCLCore::set_keyboard_ise_by_uuid(const sclchar *uuid)
318 {
319     if (m_impl) {
320         m_impl->set_keyboard_ise_by_uuid(uuid);
321     }
322 }
323
324 void CSCLCore::get_keyboard_ise(const sclchar *uuid)
325 {
326     if (m_impl) {
327         m_impl->get_keyboard_ise(uuid);
328     }
329 }
330
331 sclwindow CSCLCore::get_main_window()
332 {
333     sclwindow ret = SCLWINDOW_INVALID;
334     if (m_impl) {
335         ret = m_impl->get_main_window();
336     }
337     return ret;
338 }
339
340 void CSCLCore::set_keyboard_size_hints(SclSize portrait, SclSize landscape)
341 {
342     if (m_impl) {
343         m_impl->set_keyboard_size_hints(portrait, landscape);
344     }
345 }
346
347 sclwindow CSCLCore::create_option_window()
348 {
349     sclwindow ret = SCLWINDOW_INVALID;
350     if (m_impl) {
351         ret = m_impl->create_option_window();
352     }
353     return ret;
354 }
355
356 void CSCLCore::destroy_option_window(sclwindow window)
357 {
358     if (m_impl) {
359         m_impl->destroy_option_window(window);
360     }
361 }
362
363 void CSCLCore::set_selection(sclint start, sclint end)
364 {
365     if (m_impl) {
366         m_impl->set_selection(start, end);
367     }
368 }
369
370 void CSCLCore::send_private_command(const sclchar *command)
371 {
372     if (m_impl) {
373         m_impl->send_private_command(command);
374     }
375 }
376
377 void CSCLCore::get_selection_text(sclchar **text) const
378 {
379     if (m_impl) {
380         m_impl->get_selection_text(text);
381     }
382 }
383
384 void CSCLCore::request_ise_hide() const
385 {
386     if (m_impl) {
387         m_impl->request_ise_hide();
388     }
389 }
390
391 void CSCLCore::commit_content(const sclchar *content, const sclchar *description, const sclchar *mime_types)
392 {
393     if (m_impl) {
394         m_impl->commit_content(content, description, mime_types);
395     }
396 }
397
398 void CSCLCore::update_preedit_string_with_commit(const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs, sclint caret)
399 {
400     if (m_impl) {
401         m_impl->update_preedit_string_with_commit(preedit, commit, attrs, caret);
402     }
403 }
404
405 void CSCLCore::recapture_string(sclint offset, sclint len, const sclchar *preedit, const sclchar *commit, const scim::AttributeList &attrs)
406 {
407     if (m_impl) {
408         m_impl->recapture_string(offset, len, preedit, commit, attrs);
409     }
410 }
411
412 void CSCLCore::update_lookup_table(const scim::LookupTable &table)
413 {
414     if (m_impl) {
415         m_impl->update_lookup_table(table);
416     }
417 }
418
419 void CSCLCore::register_properties(const scim::PropertyList &properties)
420 {
421     if (m_impl) {
422         m_impl->register_properties(properties);
423     }
424 }
425
426 void CSCLCore::update_property(const scim::Property &property)
427 {
428     if (m_impl) {
429         m_impl->update_property(property);
430     }
431 }
432
433 void CSCLCore::expand_candidate(void)
434 {
435     if (m_impl) {
436         m_impl->expand_candidate();
437     }
438 }
439
440 void CSCLCore::contract_candidate(void)
441 {
442     if (m_impl) {
443         m_impl->contract_candidate();
444     }
445 }
446
447 void CSCLCore::set_candidate_style(scim::ISF_CANDIDATE_PORTRAIT_LINE_T portrait_line, scim::ISF_CANDIDATE_MODE_T mode)
448 {
449     if (m_impl) {
450         m_impl->set_candidate_style(portrait_line, mode);
451     }
452 }
453
454 void CSCLCore::set_floating_mode(sclboolean floating_mode)
455 {
456     if (m_impl) {
457         m_impl->set_floating_mode(floating_mode);
458     }
459 }
460
461 void CSCLCore::set_floating_drag_enabled(sclboolean enabled)
462 {
463     if (m_impl) {
464         m_impl->set_floating_drag_enabled(enabled);
465     }
466 }
467
468 void CSCLCore::set_window_creation_defer_flag(sclboolean flag)
469 {
470     if (m_impl) {
471         m_impl->set_window_creation_defer_flag(flag);
472     }
473 }
474
475 void CSCLCore::set_engine_loader_flag(sclboolean flag)
476 {
477     if (m_impl) {
478         m_impl->set_engine_loader_flag(flag);
479     }
480 }
481
482 void CSCLCore::send_key_event_processing_result(scim::KeyEvent &key, sclu32 serial, sclboolean is_success)
483 {
484     if (m_impl) {
485         m_impl->send_key_event_processing_result(key, serial, is_success);
486     }
487 }
488
489 void CSCLCore::set_dotnet_flag(sclboolean flag)
490 {
491     if (m_impl) {
492         m_impl->set_dotnet_flag(flag);
493     }
494 }