From 5b97e5b309cef306019266902aeff41c74e003fc Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 20 Jan 2015 11:22:45 +0900 Subject: [PATCH] Add get_surrounding_text and delete_surrounding_text Change-Id: I4f16f41770421cc10a7a4940116184de3d681a3e --- src/sclconnection-isf.cpp | 18 ++++++++++++++++++ src/sclconnection-isf.h | 2 ++ src/sclconnection.cpp | 14 ++++++++++++++ src/sclconnection.h | 2 ++ src/sclcore.cpp | 16 +++++++++++++++- src/sclcore.h | 6 +++--- src/sclcoreimpl.cpp | 12 +++++++++++- src/sclcoreimpl.h | 9 +++------ 8 files changed, 68 insertions(+), 11 deletions(-) diff --git a/src/sclconnection-isf.cpp b/src/sclconnection-isf.cpp index d5053ed..3066a15 100644 --- a/src/sclconnection-isf.cpp +++ b/src/sclconnection-isf.cpp @@ -847,6 +847,24 @@ void CSCLConnectionISF::update_input_context(sclu32 type, sclu32 value) } } +void CSCLConnectionISF::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const +{ + if (m_initialized) { + scim::String uuid; + if (ic_uuid) { + uuid = scim::String(ic_uuid); + } + m_helper_agent.get_surrounding_text(uuid, maxlen_before, maxlen_after); + } +} + +void CSCLConnectionISF::delete_surrounding_text(sclint offset, sclint len) const +{ + if (m_initialized) { + m_helper_agent.delete_surrounding_text(offset, len); + } +} + void CSCLConnectionISF::set_candidate_position(sclint left, sclint top) { if (m_initialized) { diff --git a/src/sclconnection-isf.h b/src/sclconnection-isf.h index bd66e42..3a6808c 100644 --- a/src/sclconnection-isf.h +++ b/src/sclconnection-isf.h @@ -71,6 +71,8 @@ public: void update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str); void update_aux_string(const sclchar *str); void update_input_context(sclu32 type, sclu32 value); + void get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const; + void delete_surrounding_text(sclint offset, sclint len) const; void set_candidate_position(sclint left, sclint top); void candidate_hide(void); void set_keyboard_ise_by_uuid(const sclchar *uuid); diff --git a/src/sclconnection.cpp b/src/sclconnection.cpp index 8cd59aa..68464ed 100644 --- a/src/sclconnection.cpp +++ b/src/sclconnection.cpp @@ -243,6 +243,20 @@ void CSCLConnection::update_input_context(sclu32 type, sclu32 value) } } +void CSCLConnection::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const +{ + if (m_impl) { + m_impl->get_surrounding_text(ic_uuid, maxlen_before, maxlen_after); + } +} + +void CSCLConnection::delete_surrounding_text(sclint offset, sclint len) const +{ + if (m_impl) { + m_impl->delete_surrounding_text(offset, len); + } +} + void CSCLConnection::set_candidate_position(sclint left, sclint top) { if (m_impl) { diff --git a/src/sclconnection.h b/src/sclconnection.h index 0179d25..5eec308 100644 --- a/src/sclconnection.h +++ b/src/sclconnection.h @@ -68,6 +68,8 @@ public: virtual void update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str); virtual void update_aux_string(const sclchar *str); virtual void update_input_context(sclu32 type, sclu32 value); + virtual void get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const; + virtual void delete_surrounding_text(sclint offset, sclint len) const; virtual void set_candidate_position(sclint left, sclint top); virtual void candidate_hide(void); virtual void set_keyboard_ise_by_uuid(const sclchar *uuid); diff --git a/src/sclcore.cpp b/src/sclcore.cpp index 9a27e93..4275f55 100644 --- a/src/sclcore.cpp +++ b/src/sclcore.cpp @@ -205,6 +205,20 @@ void CSCLCore::update_input_context(sclu32 type, sclu32 value) } } +void CSCLCore::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const +{ + if (m_impl) { + m_impl->get_surrounding_text(ic_uuid, maxlen_before, maxlen_after); + } +} + +void CSCLCore::delete_surrounding_text(sclint offset, sclint len) const +{ + if (m_impl) { + m_impl->delete_surrounding_text(offset, len); + } +} + void CSCLCore::set_candidate_position(sclint left, sclint top) { if (m_impl) { @@ -263,4 +277,4 @@ void CSCLCore::destroy_option_window(sclwindow window) if (m_impl) { m_impl->destroy_option_window(window); } -} \ No newline at end of file +} diff --git a/src/sclcore.h b/src/sclcore.h index 78dd569..a74adc2 100644 --- a/src/sclcore.h +++ b/src/sclcore.h @@ -221,11 +221,11 @@ public: /** * @ brief Request to get surrounding text. * - * @param[in] uuid The helper ISE UUID. + * @param[in] ic_uuid The helper ISE UUID. * @param[in] maxlen_before The max length of before. * @param[in] maxlen_after The max length of after. */ - void get_surrounding_text(const sclchar *uuid, sclint maxlen_before, sclint maxlen_after) const; + void get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const; /** * @ brief Request to delete surrounding text. @@ -233,7 +233,7 @@ public: * @param[in] offset The offset for cursor position. * @param[in] len The length for delete text. */ - void delete_surrounding_text(int offset, int len) const; + void delete_surrounding_text(sclint offset, sclint len) const; /** * @ brief Set candidate position in screen. diff --git a/src/sclcoreimpl.cpp b/src/sclcoreimpl.cpp index 43b1ca4..5103a16 100644 --- a/src/sclcoreimpl.cpp +++ b/src/sclcoreimpl.cpp @@ -195,6 +195,16 @@ void CSCLCoreImpl::update_input_context(sclu32 type, sclu32 value) m_connection.update_input_context(type, value); } +void CSCLCoreImpl::get_surrounding_text(const sclchar* ic_uuid, sclint maxlen_before, sclint maxlen_after) const +{ + m_connection.get_surrounding_text(ic_uuid, maxlen_before, maxlen_after); +} + +void CSCLCoreImpl::delete_surrounding_text(sclint offset, sclint len) const +{ + m_connection.delete_surrounding_text(offset, len); +} + void CSCLCoreImpl::set_candidate_position(sclint left, sclint top) { m_connection.set_candidate_position(left, top); @@ -249,4 +259,4 @@ sclwindow CSCLCoreImpl::create_option_window() void CSCLCoreImpl::destroy_option_window(sclwindow window) { m_core_ui.destroy_option_window(window); -} \ No newline at end of file +} diff --git a/src/sclcoreimpl.h b/src/sclcoreimpl.h index e11a04c..4ef1194 100644 --- a/src/sclcoreimpl.h +++ b/src/sclcoreimpl.h @@ -76,11 +76,8 @@ public: //void update_candidate_string (const LookupTable &table) const; //void update_associate_string (const LookupTable &table) const; void update_input_context(sclu32 type, sclu32 value); - //void get_surrounding_text (const String &uuid, - // int maxlen_before, - // int maxlen_after) const; - //void delete_surrounding_text (int offset, - // int len) const; + void get_surrounding_text(const sclchar* ic_uuid, sclint maxlen_before, sclint maxlen_after) const; + void delete_surrounding_text(sclint offset, sclint len) const; void set_candidate_position(sclint left, sclint top); void candidate_hide(void); //void get_candidate_window_geometry (const String &uuid) const; @@ -107,4 +104,4 @@ private: //SCL_END_DECLS -#endif //__SCL_CORE_IMPL_H__ \ No newline at end of file +#endif //__SCL_CORE_IMPL_H__ -- 2.7.4