Add synchronous API to get surrounding text 24/67224/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 26 Apr 2016 02:29:11 +0000 (11:29 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 26 Apr 2016 02:29:11 +0000 (11:29 +0900)
Change-Id: I4f83a0b96a65584bdf180b74d31464fcb0868501

src/sclconnection-isf.cpp
src/sclconnection-isf.h
src/sclconnection.cpp
src/sclconnection.h
src/sclcore.cpp
src/sclcore.h
src/sclcoreimpl.cpp
src/sclcoreimpl.h

index 5d2f74ce0144730ba55bc9d6ab26efe34be02a5d..f4dbdfef9e950a02a145b3ce45b4c000d54e5c9a 100644 (file)
@@ -949,6 +949,17 @@ void CSCLConnectionISF::get_surrounding_text(const sclchar *ic_uuid, sclint maxl
     }
 }
 
+void CSCLConnectionISF::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
+{
+    if (m_initialized) {
+        scim::String surrounding_text;
+        m_helper_agent.get_surrounding_text(maxlen_before, maxlen_after, surrounding_text, cursor);
+
+        if (text)
+            *text = strdup(surrounding_text.c_str());
+    }
+}
+
 void CSCLConnectionISF::delete_surrounding_text(sclint offset, sclint len) const
 {
     if (m_initialized) {
index 26781a53661c5d524099029ec667d5cc53b392a3..bdce63ebe0c6e83a527c1f297e789ecbfa6ee5a5 100644 (file)
@@ -83,6 +83,7 @@ public:
     void get_keyboard_ise(const sclchar *uuid);
     void set_selection(sclint start, sclint end);
     void send_private_command(const char *command);
+    void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
 private:
     sclboolean m_initialized;
 
index fba5e8f51b7d1d9105b3095137227386711d814b..2ab7aa1b3cceb7a9167d0750f2d8bdb7577ce028 100644 (file)
@@ -273,6 +273,13 @@ void CSCLConnection::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_
     }
 }
 
+void CSCLConnection::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
+{
+    if (m_impl) {
+        m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
+    }
+}
+
 void CSCLConnection::delete_surrounding_text(sclint offset, sclint len) const
 {
     if (m_impl) {
index c6cb71ed8bb8e3c882e911aee3508da9a792b894..a8a63885928913b6719d1fb209d79690dc2bcedf 100644 (file)
@@ -83,6 +83,7 @@ public:
     virtual void get_keyboard_ise(const sclchar *uuid);
     virtual void set_selection(sclint start, sclint end);
     virtual void send_private_command(const sclchar *command);
+    virtual void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
 protected:
     std::string m_backend_identifier;
 
index 7fa21c2a9d90e9af852482229a18787ee2a68f40..001488cc8ab78e866af010a66ed2308710459c34 100644 (file)
@@ -242,6 +242,13 @@ void CSCLCore::get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before
     }
 }
 
+void CSCLCore::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const
+{
+    if (m_impl) {
+        m_impl->get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
+    }
+}
+
 void CSCLCore::delete_surrounding_text(sclint offset, sclint len) const
 {
     if (m_impl) {
index 7669d400413a43634fdbb9d8b603c52f51bbb4ca..d560553bad468ceb9f1783906974ead33d8d2e97 100644 (file)
@@ -249,7 +249,7 @@ public:
     void update_geometry(sclint x, sclint y, sclint width, sclint height);
 
     /**
-     * @brief Request to get surrounding text.
+     * @brief Request to get surrounding text asynchronously.
      *
      * @param[in] ic_uuid The helper ISE UUID.
      * @param[in] maxlen_before The max length of before.
@@ -343,6 +343,15 @@ public:
 
     void send_private_command(const sclchar *command);
 
+    /**
+     * @brief Request to get surrounding text synchronously.
+     *
+     * @param[in] maxlen_before The max length of before.
+     * @param[in] maxlen_after The max length of after.
+     * @param[out] text The surrounding text.
+     * @param[out] cursor The cursor position.
+     */
+    void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor) const;
 private:
     CSCLCoreImpl *m_impl;
 };
index 84a69353542eaf00354bb988c202d8792e586d7b..8c2da0cea24bfbc749aaec06190ee5ccc17ac8b6 100644 (file)
@@ -232,6 +232,11 @@ void CSCLCoreImpl::get_surrounding_text(const sclchar* ic_uuid, sclint maxlen_be
     m_connection.get_surrounding_text(ic_uuid, maxlen_before, maxlen_after);
 }
 
+void CSCLCoreImpl::get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor)
+{
+    m_connection.get_surrounding_text(maxlen_before, maxlen_after, text, cursor);
+}
+
 void CSCLCoreImpl::delete_surrounding_text(sclint offset, sclint len) const
 {
     m_connection.delete_surrounding_text(offset, len);
index 40d774ac40b94ec4b5c04053a097f4869c3d9277..4df078228f46f7d068c66ed7c20ba2f4c82cc3c4 100644 (file)
@@ -101,6 +101,7 @@ public:
 
     void set_selection(sclint start, sclint end);
     void send_private_command(const sclchar *command);
+    void get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
 
 private:
     ISCLCoreEventCallback *m_event_callback;