Add commit_content API
[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::run()
38 {
39     if (m_impl) {
40         m_impl->run();
41     }
42 }
43
44 void CSCLCore::config_reload()
45 {
46     if (m_impl) {
47         m_impl->config_reload();
48     }
49 }
50
51 sclboolean CSCLCore::config_read_int(const sclchar *name, sclint &value)
52 {
53     sclboolean ret = FALSE;
54     if (m_impl) {
55         ret = m_impl->config_read_int(name, value);
56     }
57     return ret;
58 }
59
60 sclboolean CSCLCore::config_read_string(const sclchar *name, std::string &value)
61 {
62     sclboolean ret = FALSE;
63     if (m_impl) {
64         ret = m_impl->config_read_string(name, value);
65     }
66     return ret;
67 }
68
69 sclboolean CSCLCore::config_write_int(const sclchar *name, sclint value)
70 {
71     sclboolean ret = FALSE;
72     if (m_impl) {
73         ret = m_impl->config_write_int(name, value);
74     }
75     return ret;
76 }
77
78 sclboolean CSCLCore::config_write_string(const sclchar *name, const std::string value)
79 {
80     sclboolean ret = FALSE;
81     if (m_impl) {
82         ret = m_impl->config_write_string(name, value);
83     }
84     return ret;
85 }
86
87 sclboolean CSCLCore::config_erase(const sclchar *name)
88 {
89     sclboolean ret = FALSE;
90     if (m_impl) {
91         ret = m_impl->config_erase(name);
92     }
93     return ret;
94 }
95
96 sclboolean CSCLCore::config_flush(void)
97 {
98     sclboolean ret = FALSE;
99     if (m_impl) {
100         ret = m_impl->config_flush();
101     }
102     return ret;
103 }
104
105 void CSCLCore::send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value)
106 {
107     if (m_impl) {
108         m_impl->send_imengine_event(ic, ic_uuid, command, value);
109     }
110 }
111
112 void CSCLCore::reset_keyboard_ise()
113 {
114     if (m_impl) {
115         m_impl->reset_keyboard_ise();
116     }
117 }
118
119 void CSCLCore::flush_keyboard_ise()
120 {
121     if (m_impl) {
122         m_impl->flush_keyboard_ise();
123     }
124 }
125
126 void CSCLCore::send_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask)
127 {
128     if (m_impl) {
129         m_impl->send_key_event(ic, ic_uuid, keycode, keymask);
130     }
131 }
132
133 void CSCLCore::forward_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask)
134 {
135     if (m_impl) {
136         m_impl->forward_key_event(ic, ic_uuid, keycode, keymask);
137     }
138 }
139
140 void CSCLCore::commit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str)
141 {
142     if (m_impl) {
143         m_impl->commit_string(ic, ic_uuid, str);
144     }
145 }
146
147 void CSCLCore::select_candidate(int index)
148 {
149     if (m_impl) {
150         m_impl->select_candidate(index);
151     }
152 }
153
154 void CSCLCore::show_preedit_string(sclint ic, const sclchar *ic_uuid)
155 {
156     if (m_impl) {
157         m_impl->show_preedit_string(ic, ic_uuid);
158     }
159 }
160
161 void CSCLCore::show_aux_string(void)
162 {
163     if (m_impl) {
164         m_impl->show_aux_string();
165     }
166 }
167
168 void CSCLCore::show_candidate_string(void)
169 {
170     if (m_impl) {
171         m_impl->show_candidate_string();
172     }
173 }
174
175 void CSCLCore::show_associate_string(void)
176 {
177     if (m_impl) {
178         m_impl->show_associate_string();
179     }
180 }
181
182 void CSCLCore::hide_preedit_string(sclint ic, const sclchar *ic_uuid)
183 {
184     if (m_impl) {
185         m_impl->hide_preedit_string(ic, ic_uuid);
186     }
187 }
188
189 void CSCLCore::hide_aux_string(void)
190 {
191     if (m_impl) {
192         m_impl->hide_aux_string();
193     }
194 }
195
196 void CSCLCore::hide_candidate_string(void)
197 {
198     if (m_impl) {
199         m_impl->hide_candidate_string();
200     }
201 }
202
203 void CSCLCore::hide_associate_string(void)
204 {
205     if (m_impl) {
206         m_impl->hide_associate_string();
207     }
208 }
209
210 void CSCLCore::update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str)
211 {
212     if (m_impl) {
213         m_impl->update_preedit_string(ic, ic_uuid, str);
214     }
215 }
216
217 void CSCLCore::update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str, const scim::AttributeList &attrs)
218 {
219     if (m_impl) {
220         m_impl->update_preedit_string(ic, ic_uuid, str, attrs);
221     }
222 }
223
224 void CSCLCore::update_aux_string(const sclchar *str)
225 {
226     if (m_impl) {
227         m_impl->update_aux_string(str);
228     }
229 }
230
231 void CSCLCore::update_input_context(sclu32 type, sclu32 value)
232 {
233     if (m_impl) {
234         m_impl->update_input_context(type, value);
235     }
236 }
237
238 void CSCLCore::update_geometry(sclint x, sclint y, sclint width, sclint height)
239 {
240     if (m_impl) {
241         m_impl->update_geometry(x, y, width, height);
242     }
243 }
244
245 void CSCLCore::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const
246 {
247     if (m_impl) {
248         m_impl->get_surrounding_text(ic_uuid, maxlen_before, maxlen_after);
249     }
250 }
251
252 sclint CSCLCore::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const
253 {
254     sclint ret = -1;
255     if (m_impl) {
256         ret = m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
257     }
258     return ret;
259 }
260
261 void CSCLCore::delete_surrounding_text(sclint offset, sclint len) const
262 {
263     if (m_impl) {
264         m_impl->delete_surrounding_text(offset, len);
265     }
266 }
267
268 void CSCLCore::set_candidate_position(sclint left, sclint top)
269 {
270     if (m_impl) {
271         m_impl->set_candidate_position(left, top);
272     }
273 }
274
275 void CSCLCore::enable_soft_candidate(sclboolean enable)
276 {
277     if (m_impl) {
278         m_impl->enable_soft_candidate(enable);
279     }
280 }
281
282 void CSCLCore::candidate_hide(void)
283 {
284     if (m_impl) {
285         m_impl->candidate_hide();
286     }
287 }
288
289 void CSCLCore::set_keyboard_ise_by_uuid(const sclchar *uuid)
290 {
291     if (m_impl) {
292         m_impl->set_keyboard_ise_by_uuid(uuid);
293     }
294 }
295
296 void CSCLCore::get_keyboard_ise(const sclchar *uuid)
297 {
298     if (m_impl) {
299         m_impl->get_keyboard_ise(uuid);
300     }
301 }
302
303 sclwindow CSCLCore::get_main_window()
304 {
305     sclwindow ret = SCLWINDOW_INVALID;
306     if (m_impl) {
307         ret = m_impl->get_main_window();
308     }
309     return ret;
310 }
311
312 void CSCLCore::set_keyboard_size_hints(SclSize portrait, SclSize landscape)
313 {
314     if (m_impl) {
315         m_impl->set_keyboard_size_hints(portrait, landscape);
316     }
317 }
318
319 sclwindow CSCLCore::create_option_window()
320 {
321     sclwindow ret = SCLWINDOW_INVALID;
322     if (m_impl) {
323         ret = m_impl->create_option_window();
324     }
325     return ret;
326 }
327
328 void CSCLCore::destroy_option_window(sclwindow window)
329 {
330     if (m_impl) {
331         m_impl->destroy_option_window(window);
332     }
333 }
334
335 void CSCLCore::set_selection(sclint start, sclint end)
336 {
337     if (m_impl) {
338         m_impl->set_selection(start, end);
339     }
340 }
341
342 void CSCLCore::send_private_command(const sclchar *command)
343 {
344     if (m_impl) {
345         m_impl->send_private_command(command);
346     }
347 }
348
349 void CSCLCore::get_selection_text(sclchar **text) const
350 {
351     if (m_impl) {
352         m_impl->get_selection_text(text);
353     }
354 }
355
356 void CSCLCore::request_ise_hide() const
357 {
358     if (m_impl) {
359         m_impl->request_ise_hide();
360     }
361 }
362
363 void CSCLCore::commit_content(const sclchar *content, const sclchar *description, const sclchar *mime_types)
364 {
365     if (m_impl) {
366         m_impl->commit_content(content, description, mime_types);
367     }
368 }