--- /dev/null
+Bumsung Cho <bs0111.cho at samsung dot com>\r
+Jonghyun Yoon <jh2.yoon at samsung dot com>
\ No newline at end of file
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET (this_target osp-ime)
+
+SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/cmake_build_tmp/output)
+
+INCLUDE_DIRECTORIES(
+ inc
+ src
+ /usr/include/chromium
+ /usr/include/dlog
+ /usr/include/dbus-1.0
+ /usr/lib/dbus-1.0/include
+ /usr/include/e_dbus-1
+ /usr/include/elementary-1
+ /usr/include/efreet-1
+ /usr/include/ecore-1
+ /usr/include/edje-1
+ /usr/include/evas-1
+ /usr/include/eet-1
+ /usr/include/eina-1
+ /usr/include/eina-1/eina
+ /usr/include/ethumb-1
+ /usr/include/libxml2
+ /usr/include/media
+ /usr/include/osp
+ /usr/include/osp/base
+ /usr/include/osp/app
+ /usr/include/osp/net
+ /usr/include/osp/security
+ /usr/include/osp/io
+ /usr/include/osp/ui
+ /usr/include/scim-1.0
+ )
+
+SET (${this_target}_SOURCE_FILES
+ src/app/FApp_ImeEntry.cpp
+ src/FUiImeInputMethod.cpp
+ src/FUiImeInputMethodInfo.cpp
+ src/FUiImeInputMethodManager.cpp
+ src/FUiIme_EcoreFdHandler.cpp
+ src/FUiIme_ImeInfo.cpp
+ src/FUiIme_InputMethodImpl.cpp
+ src/FUiIme_InputMethodInfoImpl.cpp
+ src/FUiIme_InputMethodManagerImpl.cpp
+ src/FUiIme_InputServiceBinder.cpp
+ src/FUiIme_InputServiceSignalListener.cpp
+ src/FUiIme_ScimDataConverter.cpp
+)
+
+## Definitions
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+## SET LINKER FLAGS
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed")
+
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw")
+TARGET_LINK_LIBRARIES(${this_target} "-losp-uifw")
+TARGET_LINK_LIBRARIES(${this_target} "-ldlog")
+TARGET_LINK_LIBRARIES(${this_target} "-ldl")
+TARGET_LINK_LIBRARIES(${this_target} "-lecore")
+TARGET_LINK_LIBRARIES(${this_target} "-lecore_x")
+TARGET_LINK_LIBRARIES(${this_target} "-lelementary")
+TARGET_LINK_LIBRARIES(${this_target} "-levas" )
+TARGET_LINK_LIBRARIES(${this_target} "-lpkgmgr-info" )
+TARGET_LINK_LIBRARIES(${this_target} "-lscim-1.0")
+TARGET_LINK_LIBRARIES(${this_target} "-lxml2" )
+
+SET_TARGET_PROPERTIES(${this_target}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+ )
+
+ADD_CUSTOM_COMMAND(TARGET ${this_target}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER}
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${MAJORVER}
+ COMMAND ${CMAKE_STRIP} --strip-unneeded ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
+ COMMENT "strip ${this_target}"
+ )
+
+INSTALL(DIRECTORY ${LIBRARY_OUTPUT_PATH}/ DESTINATION lib/osp
+ FILES_MATCHING PATTERN "*.so*"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ GROUP_EXECUTE GROUP_READ
+ WORLD_EXECUTE WORLD_READ)
+INSTALL(DIRECTORY ${LIBRARY_OUTPUT_PATH}/debug/ DESTINATION lib/osp/debug
+ FILES_MATCHING PATTERN "*"
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ GROUP_EXECUTE GROUP_READ
+ WORLD_EXECUTE WORLD_READ)
+
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/inc/ DESTINATION include/osp FILES_MATCHING PATTERN "*.h")
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/src/inc/ DESTINATION include/osp/media FILES_MATCHING PATTERN "*.h")
+
+# pkgconfig file
+CONFIGURE_FILE(${this_target}.pc.in ${CMAKE_SOURCE_DIR}/${this_target}.pc @ONLY)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${this_target}.pc DESTINATION lib/pkgconfig)
--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
--- /dev/null
+Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
\ No newline at end of file
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme.h\r
+ * @brief This is the header file for the %Tizen::Ui::Ime namespace.\r
+ *\r
+ * This header file contains the declarations and descriptions of the %Tizen::Ui::Ime namespace.\r
+ */\r
+\r
+#ifndef _FUI_IME_H_\r
+#define _FUI_IME_H_\r
+\r
+#include <FUiImeInputMethodInfo.h>\r
+#include <FUiImeInputMethodManager.h>\r
+\r
+/**\r
+ * @namespace Tizen::Ui::Ime\r
+ * @brief This namespace contains the classes and interfaces for an input method.\r
+ * @since 2.0\r
+ *\r
+ * @remarks @b Header @b %file: @b \#include @b <FUiIme.h> @n\r
+ * @b Library : @b osp-ime\r
+ *\r
+ * The %Ui::Ime namespace provides a way to input a language in the associated text input UI control.\r
+ *\r
+ * For more information on the %Ui::Ime namespace features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/input.htm">Input Guide</a>.\r
+ *\r
+ * The following diagram illustrates the relationships between the classes belonging to the %Ime namespace.\r
+ *\r
+ * @image html ui_ime_namespace_classdiagram.png\r
+ */\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_H_\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiImeInputMethodInfo.h\r
+ * @brief This is the header file for the %InputMethodInfo class.\r
+ *\r
+ * This header file contains the declarations of the %InputMethodInfo class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INPUT_METHOD_INFO_H_\r
+#define _FUI_IME_INPUT_METHOD_INFO_H_\r
+\r
+#include <FAppTypes.h>\r
+#include <FBaseColIList.h>\r
+#include <FBaseObject.h>\r
+#include <FBaseString.h>\r
+#include <FOspConfig.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+class _InputMethodInfoImpl;\r
+\r
+/**\r
+ * @if VISPARTNER\r
+ * @class InputMethodInfo\r
+ * @brief This class provides a standard implementation of the %InputMethodInfo.\r
+ * @since 2.0\r
+ *\r
+ * @final This class is not intended for extension.\r
+ * @remarks A user can get the general information of the input method.\r
+ *\r
+ * @visibility partner-manufacturer\r
+ * @privilege %http://tizen.org/privilege/imemanager\r
+ *\r
+ * The %InputMethodInfo class provides a standard implementation of the %InputMethodInfo.\r
+ *\r
+ * @endif\r
+ */\r
+class _OSP_EXPORT_ InputMethodInfo\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ /**\r
+ * @if VISPARTNER\r
+ * This destructor overrides Tizen::Base::Object::~Object().\r
+ *\r
+ * @since 2.0\r
+ * @visibility partner-manufacturer\r
+ * @privilege %http://tizen.org/privilege/imemanager\r
+ * @endif\r
+ */\r
+ virtual ~InputMethodInfo(void);\r
+\r
+ /**\r
+ * @if VISPARTNER\r
+ * Gets the application ID of an input method.\r
+ *\r
+ * @since 2.0\r
+ * @visibility partner-manufacturer\r
+ * @privilege %http://tizen.org/privilege/imemanager\r
+ *\r
+ * @return The application ID\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @endif\r
+ */\r
+ Tizen::App::AppId GetAppId(void) const;\r
+\r
+ /**\r
+ * @if VISPARTNER\r
+ * Gets the language list that an input method supports.\r
+ *\r
+ * @since 2.0\r
+ * @visibility partner-manufacturer\r
+ * @privilege %http://tizen.org/privilege/imemanager\r
+ *\r
+ * @return An instance of the language list that consists of the Locale instances\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @remarks The %InputMethodInfo automatically deallocates the memory of the language list when it is destroyed. Therefore a user should not\r
+ * manually deallocate the memory of the language list.\r
+ * @endif\r
+ */\r
+ const Tizen::Base::Collection::IList* GetLanguageList(void) const;\r
+\r
+ /**\r
+ * @if VISPARTNER\r
+ * Gets the name of an input method.\r
+ *\r
+ * @since 2.0\r
+ * @visibility partner-manufacturer\r
+ * @privilege %http://tizen.org/privilege/imemanager\r
+ *\r
+ * @return The name\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @endif\r
+ */\r
+ Tizen::Base::String GetName(void) const;\r
+\r
+private:\r
+ //\r
+ // This Equals() is intentionally declared as private so that only the platform can compare the object received as an input parameter with this object.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ // @return @c true if the object received as an input parameter equals this object, @n\r
+ // else @c false\r
+ // @param[in] object A reference to the %InputMethodInfo\r
+ //\r
+ virtual bool Equals(const Object& object) const;\r
+\r
+ //\r
+ // This default constructor is intentionally declared as private so that only the platform can create an instance.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ InputMethodInfo(void);\r
+\r
+ //\r
+ // This copy constructor is intentionally declared as private so that only the platform can copy objects.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ // @param[in] info A reference to the %InputMethodInfo\r
+ //\r
+ InputMethodInfo(const InputMethodInfo& info);\r
+\r
+ //\r
+ // This copy assignment operator is intentionally declared as private so that only the platform can copy objects.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ // @param[in] info A reference to the %InputMethodInfo\r
+ //\r
+ InputMethodInfo& operator=(const InputMethodInfo& info);\r
+\r
+private:\r
+ friend class _InputMethodInfoImpl;\r
+ friend class _InputMethodManagerImpl;\r
+\r
+ _InputMethodInfoImpl* __pInputMethodInfoImpl;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INPUT_METHOD_INFO_H_\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiImeInputMethodManager.h\r
+ * @brief This is the header file for the %InputMethodManager class.\r
+ *\r
+ * This header file contains the declarations of the %InputMethodManager class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INPUT_METHOD_MANAGER_H_\r
+#define _FUI_IME_INPUT_METHOD_MANAGER_H_\r
+\r
+#include <FAppTypes.h>\r
+#include <FBaseColIList.h>\r
+#include <FBaseDataType.h>\r
+#include <FBaseObject.h>\r
+#include <FOspConfig.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+class _InputMethodManagerImpl;\r
+\r
+/**\r
+ * @if VISPARTNER\r
+ * @class InputMethodManager\r
+ * @brief This class provides a standard implementation of the %InputMethodManager.\r
+ * @since 2.0\r
+ *\r
+ * @final This class is not intended for extension.\r
+ * @remarks A user can manage input methods installed in the system.\r
+ *\r
+ * @visibility partner-manufacturer\r
+ * @privilege %http://tizen.org/privilege/imemanager\r
+ *\r
+ * The %InputMethodManager provides a standard implementation of the %InputMethodManager.\r
+ *\r
+ * @endif\r
+ */\r
+class _OSP_EXPORT_ InputMethodManager\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ /**\r
+ * @if VISPARTNER\r
+ * Gets an instance of the %InputMethodManager.\r
+ *\r
+ * @since 2.0\r
+ * @visibility partner-manufacturer\r
+ * @privilege %http://tizen.org/privilege/imemanager\r
+ *\r
+ * @return An instance of the %InputMethodManager\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method and OOM might be thrown by this method.\r
+ * @endif\r
+ */\r
+ static InputMethodManager* GetInstance(void);\r
+\r
+ /**\r
+ * @if VISPARTNER\r
+ * Gets the list of the %InputMethodInfo of the input methods installed in the system.\r
+ *\r
+ * @since 2.0\r
+ * @visibility partner-manufacturer\r
+ * @privilege %http://tizen.org/privilege/imemanager\r
+ *\r
+ * @return An instance of the list that consists of the InputMethodInfo instances\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @remarks The specific error code can be accessed using the GetLastResult() method.\r
+ * @endif\r
+ */\r
+ Tizen::Base::Collection::IList* GetInputMethodInfoListN(void) const;\r
+\r
+ /**\r
+ * @if VISPARTNER\r
+ * Sets an input method.\r
+ *\r
+ * @since 2.0\r
+ * @visibility partner-manufacturer\r
+ * @privilege %http://tizen.org/privilege/imemanager\r
+ *\r
+ * @return An error code\r
+ * @param[in] id An application ID\r
+ * @exception E_SUCCESS The method is successful.\r
+ * @exception E_APP_NOT_INSTALLED The specified ID doesn't match with any of the application ID for the input method installed in the system.\r
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.\r
+ * @endif\r
+ */\r
+ result SetInputMethod(Tizen::App::AppId id);\r
+\r
+private:\r
+ //\r
+ // This default constructor is intentionally declared as private to implement the Singleton semantic.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ InputMethodManager(void);\r
+\r
+ //\r
+ // This destructor is intentionally declared as private to implement the Singleton semantic.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ virtual ~InputMethodManager(void);\r
+\r
+ //\r
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ InputMethodManager(const InputMethodManager& rhs);\r
+\r
+ //\r
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.\r
+ //\r
+ // @since 2.0\r
+ //\r
+ InputMethodManager& operator=(const InputMethodManager& rhs);\r
+\r
+private:\r
+ _InputMethodManagerImpl* __pInputMethodManagerImpl;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INPUT_METHOD_MANAGER_H_\r
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
\ No newline at end of file
--- /dev/null
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib/osp
+includedir=/usr/include/osp
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
\ No newline at end of file
--- /dev/null
+%define debug_package %{nil}
+%define __strip /bin/true
+
+Name: osp-ime
+Summary: The IME library of OSP
+Version: 1.2.0.0
+Release: 1
+Group: TO_BE/FILLED_IN
+License: TO BE FILLED IN
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(isf)
+BuildRequires: pkgconfig(libwbxml2)
+BuildRequires: pkgconfig(osp-appfw)
+BuildRequires: pkgconfig(pkgmgr)
+BuildRequires: osp-appfw-internal-devel
+BuildRequires: pkgconfig(osp-uifw)
+BuildRequires: osp-uifw-internal-devel
+BuildRequires: pkgconfig(libprivilege-control)
+
+# runtime requires
+Requires: osp-appfw
+Requires: osp-uifw
+
+Provides: libosp-ime.so.1
+
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+The IME library of OSP
+
+%package devel
+Summary: The IME library of OSP (Development)
+Group: TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+The IME library of OSP (DEV)
+
+%package debug
+Summary: The IME library of OSP (Development)
+Group: TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description debug
+The IME library of OSP (DEV)
+
+%prep
+%setup -q
+
+%build
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%ifarch %{ix86}
+CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_OSP_X86_ -D_OSP_EMUL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DOBS=1 -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DARCH=x86
+%else
+CXXFLAGS="-O2 -g -pipe -Wall -fno-exceptions -Wformat -Wformat-security -Wl,--as-needed -fmessage-length=0 -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -D__SOFTFP__ -mthumb -Wa,-mimplicit-it=thumb -funwind-tables -D_OSP_DEBUG_ -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DOBS=1 -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DARCH=arm
+%endif
+
+# Call make instruction with smp support
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{name}-%{version}/LICENSE.APLv2.0 %{buildroot}/usr/share/license/%{name}
+
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest osp-ime.manifest
+/usr/share/license/%{name}
+%{_libdir}/osp/libosp-ime.so*
+
+%files devel
+%{_includedir}/osp/*.h
+%{_libdir}/pkgconfig/osp-ime.pc
+
+%files debug
+%{_libdir}/osp/debug/*.so*
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FUiImeIInputMethodListener.h
+ * @brief This is the header file for the %IInputMethodListener interface.
+ *
+ * This header file contains the declarations of the %IInputMethodListener interface.
+ */
+
+#ifndef _FUI_IME_IINPUT_METHOD_LISTENER_H_
+#define _FUI_IME_IINPUT_METHOD_LISTENER_H_
+
+#include <FBaseRtIEventListener.h>
+#include <FBaseString.h>
+#include <FGrpRectangle.h>
+#include <FOspConfig.h>
+#include <FUiInputConnectionTypes.h>
+
+namespace Tizen { namespace Ui { namespace Ime {
+
+/**
+ * @if VISPARTNER
+ * @interface IInputMethodListener
+ * @brief This interface provides a listener for the InputMethod class to receive asynchronous callbacks from the input service.
+ * @since 2.0
+ *
+ * @remarks IME application developers can implement a class that is derived from %IInputMethodListener and use it to receive asynchronous callbacks
+ * from the input service.
+ *
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * The %IInputMethodListener provides a listener for the %InputMethod class to receive asynchronous callbacks from the input service.
+ *
+ * The following example demonstrates how to use the %IInputMethodListener interface.
+ * @code
+ * #include <FUi.h>
+ *
+ * class MyListener
+ * : public IInputMethodListener
+ * {
+ * ...
+ * virtual void OnCursorPositionChanged(int position);
+ * ...
+ * };
+ * @endcode
+ *
+ * @endif
+ */
+class _OSP_EXPORT_ IInputMethodListener
+ : virtual public Tizen::Base::Runtime::IEventListener
+{
+public:
+ /**
+ * @if VISPARTNER
+ * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this
+ * interface is called.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ * @endif
+ */
+ virtual ~IInputMethodListener(void) {}
+
+ /**
+ * @if VISPARTNER
+ * Called when the position of the cursor in an associated text input UI control changes.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @param[in] position The position of the cursor
+ * @endif
+ */
+ virtual void OnCursorPositionChanged(int position) {}
+
+ /**
+ * @if VISPARTNER
+ * Called when an associated text input UI control responds to a request with the surrounding text.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @param[in] text The surrounding text
+ * @param[in] cursorPosition The position of the cursor
+ * @remarks The surrounding text can be requested by the Tizen::Ui::Ime::InputMethod::RequestSurroundingText() method. The length of the
+ * surrounding text can be less than that requested by the user.
+ * @endif
+ */
+ virtual void OnSurroundingTextReceived(const Tizen::Base::String& text, int cursorPosition) {}
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodListener_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodListener_Reserved3(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodListener_Reserved4(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodListener_Reserved5(void) {}
+};
+
+}}} // Tizen::Ui::Ime
+
+#endif // _FUI_IME_IINPUT_METHOD_LISTENER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FUiImeIInputMethodProvider.h
+ * @brief This is the header file for the %IInputMethodProvider interface.
+ *
+ * This header file contains the declarations of the %IInputMethodProvider interface.
+ */
+
+#ifndef _FUI_IME_IINPUT_METHOD_PROVIDER_H_
+#define _FUI_IME_IINPUT_METHOD_PROVIDER_H_
+
+#include <FGrpRectangle.h>
+#include <FOspConfig.h>
+#include <FUiInputConnectionTypes.h>
+
+namespace Tizen { namespace Ui { namespace Ime {
+
+/**
+ * @if VISPARTNER
+ * @interface IInputMethodProvider
+ * @brief This is an interface for the InputMethod class that interacts with the associated text input UI control.
+ * @since 2.0
+ *
+ * @remarks The IME application developers can implement a class derived from %IInputMethodProvider and set it as the provider of the InputMethod class.
+ * The IME application can then provide attributes for the soft input panel and operate according to the commands of the associated text input UI control. For
+ * example, when ShowInputPanel() or HideInputPanel() are called, the IME application's frame should either be hidden or made visible.
+ *
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * The %IInputMethodProvider interface is an interface for the InputMethod class that interacts with the associated text input UI control.
+ *
+ * The following example demonstrates how to use the %IInputMethodProvider interface.
+ * @code
+ * #include <FUi.h>
+ *
+ * class MyProvider
+ * : public IInputMethodProvider
+ * {
+ * ...
+ * virtual Tizen::Ui::InputPanelAction GetEnterKeyAction(void);
+ * virtual Tizen::Graphics::Rectangle GetInputPanelBounds(void);
+ * ...
+ * };
+ * @endcode
+ *
+ * @endif
+ */
+class _OSP_EXPORT_ IInputMethodProvider
+{
+public:
+ /**
+ * @if VISPARTNER
+ * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this
+ * interface is called.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ * @endif
+ */
+ virtual ~IInputMethodProvider(void) {}
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control requests the enter key action of the input panel.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return The enter key action of the input panel
+ * @endif
+ */
+ virtual Tizen::Ui::InputPanelAction GetEnterKeyAction(void) {return Tizen::Ui::INPUT_PANEL_ACTION_ENTER;}
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control requests the position and size of the input panel.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return The position and size of the input panel
+ * @remarks The associated text input UI control can change its position on the screen to avoid becoming positioned behind the input panel.
+ * @endif
+ */
+ virtual Tizen::Graphics::Rectangle GetInputPanelBounds(void) = 0;
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control requests the style of the input panel.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return A style of the input panel
+ * @endif
+ */
+ virtual Tizen::Ui::InputPanelStyle GetInputPanelStyle(void) {return Tizen::Ui::INPUT_PANEL_STYLE_NORMAL;}
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control requests the input panel to enable or disable the caps mode.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @param[in] enable The state of the caps mode
+ * @endif
+ */
+ virtual void SetCapsModeEnabled(bool enable) {}
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control requests the input panel to set the enter key action.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @param[in] action The enter key action
+ * @remarks The input panel can show text on the enter button according to the enter key action.
+ * @endif
+ */
+ virtual void SetEnterKeyAction(Tizen::Ui::InputPanelAction action) {}
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control requests the input panel to enable or disable the enter key action.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @param[in] enable The state of the enter key action
+ * @endif
+ */
+ virtual void SetEnterKeyActionEnabled(bool enable) {}
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control requests the input panel to set its style.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @param[in] style The style of the input panel
+ * @endif
+ */
+ virtual void SetInputPanelStyle(Tizen::Ui::InputPanelStyle style) {}
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control requests the input panel to hide itself.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @remarks The IME application developer should implement this interface.
+ * @endif
+ */
+ virtual void HideInputPanel(void) = 0;
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control checks whether the enter key action is enabled or not.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return The state of the enter key action
+ * @endif
+ */
+ virtual bool IsEnterKeyActionEnabled(void) {return false;}
+
+ /**
+ * @if VISPARTNER
+ * Called when the associated text input UI control requests the input panel to show itself.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @remarks The IME application developer should implement this interface.
+ * @endif
+ */
+ virtual void ShowInputPanel(void) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodProvider_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodProvider_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodProvider_Reserved3(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodProvider_Reserved4(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related,
+ // and consistency-related issues in the application.
+ //
+ // Following method is reserved and may change its name at any time without
+ // prior notice.
+ //
+ // @since 2.0
+ //
+ virtual void IInputMethodProvider_Reserved5(void) {}
+};
+
+}}} // Tizen::Ui::Ime
+
+#endif // _FUI_IME_IINPUT_METHOD_PROVIDER_H_
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiImeInputMethod.cpp\r
+ * @brief This is the implementation file for the %InputMethod class.\r
+ *\r
+ * This implementation file contains definition of the %InputMethod class.\r
+ */\r
+\r
+#include <new>\r
+\r
+#include <FBaseSysLog.h>\r
+#include <FUiImeInputMethod.h>\r
+\r
+#include <FSec_AccessController.h>\r
+#include "FUiIme_InputMethodImpl.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Security;\r
+using namespace Tizen::Ui;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+static InputMethod* __pInputMethod = null;\r
+\r
+InputMethod::InputMethod(void)\r
+ :__pInputMethodImpl(null)\r
+{\r
+}\r
+\r
+InputMethod::~InputMethod(void)\r
+{\r
+ __pInputMethod = null;\r
+ __pInputMethodImpl = null;\r
+}\r
+\r
+result\r
+InputMethod::Construct(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __pInputMethodImpl = _InputMethodImpl::GetInstance(*this);\r
+ r = GetLastResult();\r
+ SysTryReturnResult(NID_UI_IME, __pInputMethodImpl, r, "Propagating.");\r
+\r
+ return r;\r
+}\r
+\r
+InputMethod*\r
+InputMethod::GetInstance(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = _AccessController::CheckUserPrivilege(_PRV_IME);\r
+ SysTryReturn(NID_UI_IME, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");\r
+\r
+ if (__pInputMethod == null)\r
+ {\r
+ __pInputMethod = new(std::nothrow) InputMethod();\r
+ SysTryReturn(NID_UI_IME, __pInputMethod, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = __pInputMethod->Construct();\r
+ r = ((r == E_SUCCESS) || (r == E_CONNECTION_FAILED) || (r == E_SYSTEM)) ? r : E_SYSTEM;\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+\r
+ return __pInputMethod;\r
+\r
+CATCH:\r
+ delete __pInputMethod;\r
+ __pInputMethod = null;\r
+\r
+ return null;\r
+}\r
+\r
+void\r
+InputMethod::SetInputMethodProvider(IInputMethodProvider* pProvider)\r
+{\r
+ __pInputMethodImpl->SetInputMethodProvider(pProvider);\r
+\r
+ return;\r
+}\r
+\r
+void\r
+InputMethod::SetInputMethodListener(IInputMethodListener* pListener)\r
+{\r
+ __pInputMethodImpl->SetInputMethodListener(pListener);\r
+\r
+ return;\r
+}\r
+\r
+result\r
+InputMethod::DeleteText(int cursorOffset, int length)\r
+{\r
+ return __pInputMethodImpl->DeleteText(cursorOffset, length);\r
+}\r
+\r
+result\r
+InputMethod::NotifyInputPanelState(InputPanelShowState state)\r
+{\r
+ return __pInputMethodImpl->NotifyInputPanelState(state);\r
+}\r
+\r
+result\r
+InputMethod::RequestSurroundingText(int lengthBeforeCursor, int lengthAfterCursor)\r
+{\r
+ return __pInputMethodImpl->RequestSurroundingText(lengthBeforeCursor, lengthAfterCursor);\r
+}\r
+\r
+result\r
+InputMethod::SendCompositeText(const String& text)\r
+{\r
+ return __pInputMethodImpl->SendCompositeText(text);\r
+}\r
+\r
+result\r
+InputMethod::SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state)\r
+{\r
+ return __pInputMethodImpl->SendKeyEvent(code, state);\r
+}\r
+\r
+result\r
+InputMethod::SendText(const String& text)\r
+{\r
+ return __pInputMethodImpl->SendText(text);\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FUiImeInputMethod.h
+ * @brief This is the header file for the %InputMethod class.
+ *
+ * This header file contains the declarations of the %InputMethod class.
+ */
+
+#ifndef _FUI_IME_INPUT_METHOD_H_
+#define _FUI_IME_INPUT_METHOD_H_
+
+#include <FBaseDataType.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FOspConfig.h>
+#include <FUiIKeyEventListener.h>
+#include <FUiImeIInputMethodListener.h>
+#include <FUiImeIInputMethodProvider.h>
+
+namespace Tizen { namespace Ui { namespace Ime {
+
+class _InputMethodImpl;
+
+/**
+ * @if VISPARTNER
+ * @class InputMethod
+ * @brief This class provides a standard implementation of the %InputMethod.
+ * @since 2.0
+ *
+ * @final This class is not intended for extension.
+ * @remarks IME application developers can use the %InputMethod to communicate with the associated text input UI control. First, set the provider which
+ * provides attributes of the soft input panel. Next, set the listener which lets the IME application receive asynchronous callbacks from the input service. These
+ * allow the IME application to interact with the associated text input UI control properly. After that, request the %InputMethod to send a text or a key event
+ * which is to be displayed in the associated text input UI control.
+ *
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * The %InputMethod provides a standard implementation of the %InputMethod.
+ *
+ * The following example demonstrates how to use the %InputMethod class.
+ * @code
+ * #include <new>
+ * #include <FUi.h>
+ *
+ * using namespace Tizen::Ui::Ime;
+ *
+ * class MyProvider
+ * : public IInputMethodProvider
+ * {
+ * ...
+ * };
+ *
+ * class MyListener
+ * : public IInputMethodListener
+ * {
+ * ...
+ * };
+ *
+ * class MyImeApp
+ * {
+ * public:
+ * ...
+ * void Construct();
+ * };
+ *
+ * void
+ * MyImeApp::Construct()
+ * {
+ * // Gets an instance of InputMethod
+ * InputMethod* pInputMethod = InputMethod::GetInstance();
+ *
+ * // Creates an instance of MyProvider and sets it as a provider
+ * MyProvider* pMyProvider = new(std::nothrow) MyProvider();
+ * pInputMethod->SetInputMethodProvider(pMyProvider);
+ *
+ * // Creates an instance of MyListener and adds it to the input method
+ * MyListener* pMyListener = new(std::nothrow) MyListener();
+ * pInputMethod->SetInputMethodListener(pMyListener);
+ * }
+ * @endcode
+ *
+ * @endif
+ */
+
+class _OSP_EXPORT_ InputMethod
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ * @if VISPARTNER
+ * Gets an instance of the %InputMethod.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return An instance of the %InputMethod
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_CONNECTION_FAILED The connection to the input service fails.
+ * @exception E_SYSTEM A failure occurs from the underlying system.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method and OOM might be thrown by this method.
+ * @endif
+ */
+ static InputMethod* GetInstance(void);
+
+ /**
+ * @if VISPARTNER
+ * Sets an instance of the IInputMethodProvider.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @param[in] pProvider An instance of the IInputMethodProvider
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The %InputMethod accepts only one provider. So users should unregister the provider by setting @c pProvider as @c null before
+ * deallocating an instance of the provider.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @endif
+ */
+ void SetInputMethodProvider(IInputMethodProvider* pProvider);
+
+ /**
+ * @if VISPARTNER
+ * Sets an instance of the IInputMethodListener.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @param[in] pListener An instance of the IInputMethodListener
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The %InputMethod accepts only one listener. So users should unregister the listener by setting @c pListener as @c null before
+ * deallocating an instance of the listener.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @endif
+ */
+ void SetInputMethodListener(IInputMethodListener* pListener);
+
+ /**
+ * @if VISPARTNER
+ * Deletes text at the position of the cursor.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return An error code
+ * @param[in] cursorOffset The offset value from the cursor position
+ * @param[in] length The length of the text to delete
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The @c length is less than or equal to @c 0.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @endif
+ */
+ result DeleteText(int cursorOffset, int length);
+
+ /**
+ * @if VISPARTNER
+ * Notifies the state of the input panel to the associated text input UI control when the state of an input panel changes.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return An error code
+ * @param[in] state The state of the input panel
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @endif
+ */
+ result NotifyInputPanelState(Tizen::Ui::InputPanelShowState state);
+
+ /**
+ * @if VISPARTNER
+ * Requests the surrounding text from the position of the cursor.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return An error code
+ * @param[in] lengthBeforeCursor The length of the surrounding text before the cursor
+ * @param[in] lengthAfterCursor The length of the surrounding text after the cursor
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The arguments are less than @c 0.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The requested surrounding text can be received using the Tizen::Ui::Ime::IInputMethodListener::OnSurroundingTextReceived() method.
+ * @endif
+ */
+ result RequestSurroundingText(int lengthBeforeCursor, int lengthAfterCursor);
+
+ /**
+ * @if VISPARTNER
+ * Sends a composite text to the associated text input UI control.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return An error code
+ * @param[in] text The composite text to send
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The composite text means a text which is being modified.
+ * @endif
+ */
+ result SendCompositeText(const Tizen::Base::String& text);
+
+ /**
+ * @if VISPARTNER
+ * Sends a key event directly to the associated text input UI control.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return An error code
+ * @param[in] code The key code
+ * @param[in] state The key state
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @endif
+ */
+ result SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state);
+
+ /**
+ * @if VISPARTNER
+ * Sends text to the associated text input UI control.
+ *
+ * @since 2.0
+ * @visibility partner
+ * @privilege http://tizen.org/privilege/ime
+ *
+ * @return An error code
+ * @param[in] text The text to send
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @endif
+ */
+ result SendText(const Tizen::Base::String& text);
+
+private:
+ //
+ // This Construct() is intentionally declared as private so that only the platform can create an instance.
+ //
+ // @since 2.0
+ //
+ // @return An error code
+ // @exception E_SUCCESS The method is successful.
+ // @exception E_CONNECTION_FAILED The connection to the input service fails.
+ // @exception E_SYSTEM A failure occurs from the underlying system.
+ // @remarks OOM might be thrown by this method.
+ //
+ result Construct(void);
+
+ //
+ // This default constructor is intentionally declared as private to implement the Singleton semantic.
+ //
+ // @since 2.0
+ //
+ InputMethod(void);
+
+ //
+ // This destructor is intentionally declared as private to implement the Singleton semantic.
+ //
+ // @since 2.0
+ //
+ virtual ~InputMethod(void);
+
+ //
+ // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.0
+ //
+ InputMethod(const InputMethod& rhs);
+
+ //
+ // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ //
+ // @since 2.0
+ //
+ InputMethod& operator=(const InputMethod& rhs);
+
+private:
+ _InputMethodImpl* __pInputMethodImpl;
+};
+
+}}} // Tizen::Ui::Ime
+
+#endif // _FUI_IME_INPUT_METHOD_H_
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiImeInputMethodInfo.cpp\r
+ * @brief This is the implementation file for the %InputMethodInfo class.\r
+ *\r
+ * This implementation file contains definition of the %InputMethodInfo class.\r
+ */\r
+\r
+#include <FBaseSysLog.h>\r
+#include <FUiImeInputMethodInfo.h>\r
+\r
+#include <FSec_AccessController.h>\r
+#include "FUiIme_InputMethodInfoImpl.h"\r
+\r
+using namespace Tizen::Security;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+InputMethodInfo::InputMethodInfo(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __pInputMethodInfoImpl = _InputMethodInfoImpl::CreateInputMethodInfoImplN();\r
+ r = GetLastResult();\r
+ SysTryReturnVoidResult(NID_UI_IME, __pInputMethodInfoImpl, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return;\r
+}\r
+\r
+InputMethodInfo::~InputMethodInfo(void)\r
+{\r
+ delete __pInputMethodInfoImpl;\r
+ __pInputMethodInfoImpl = null;\r
+}\r
+\r
+InputMethodInfo::InputMethodInfo(const InputMethodInfo& info)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __pInputMethodInfoImpl = _InputMethodInfoImpl::CreateInputMethodInfoImplN(*(info.__pInputMethodInfoImpl));\r
+ r = GetLastResult();\r
+ SysTryReturnVoidResult(NID_UI_IME, __pInputMethodInfoImpl, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return;\r
+}\r
+\r
+InputMethodInfo&\r
+InputMethodInfo::operator=(const InputMethodInfo& info)\r
+{\r
+ *__pInputMethodInfoImpl = *(info.__pInputMethodInfoImpl);\r
+\r
+ return *this;\r
+}\r
+\r
+bool\r
+InputMethodInfo::Equals(const Object& object) const\r
+{\r
+ const InputMethodInfo* pInputMethodInfo = static_cast<const InputMethodInfo*>(&object);\r
+ SysTryReturn(NID_UI_IME, pInputMethodInfo, false, E_INVALID_ARG, "Invalid argument(s) is used. The object is not the InputMethodInfo.");\r
+\r
+ return __pInputMethodInfoImpl->Equals(*(pInputMethodInfo->__pInputMethodInfoImpl));\r
+}\r
+\r
+Tizen::App::AppId\r
+InputMethodInfo::GetAppId(void) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
+ SysTryReturn(NID_UI_IME, r == E_SUCCESS, "", E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");\r
+\r
+ return __pInputMethodInfoImpl->GetAppId();\r
+}\r
+\r
+const Tizen::Base::Collection::IList*\r
+InputMethodInfo::GetLanguageList(void) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
+ SysTryReturn(NID_UI_IME, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");\r
+\r
+ return __pInputMethodInfoImpl->GetLanguageList();\r
+}\r
+\r
+Tizen::Base::String\r
+InputMethodInfo::GetName(void) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
+ SysTryReturn(NID_UI_IME, r == E_SUCCESS, "", E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");\r
+\r
+ return __pInputMethodInfoImpl->GetName();\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiImeInputMethodManager.cpp\r
+ * @brief This is the implementation file for the %InputMethodManager class.\r
+ *\r
+ * This implementation file contains definition of the %InputMethodManager class.\r
+ */\r
+\r
+#include <new>\r
+\r
+#include <FBaseSysLog.h>\r
+#include <FUiImeInputMethodManager.h>\r
+\r
+#include <FSec_AccessController.h>\r
+#include "FUiIme_InputMethodManagerImpl.h"\r
+\r
+using namespace Tizen::Security;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+static InputMethodManager* __pInputMethodManager = null;\r
+\r
+InputMethodManager::InputMethodManager(void)\r
+ :__pInputMethodManagerImpl(null)\r
+{\r
+}\r
+\r
+InputMethodManager::~InputMethodManager(void)\r
+{\r
+ __pInputMethodManager = null;\r
+ __pInputMethodManagerImpl = null;\r
+}\r
+\r
+InputMethodManager*\r
+InputMethodManager::GetInstance(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
+ SysTryReturn(NID_UI_IME, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");\r
+\r
+ if (__pInputMethodManager == null)\r
+ {\r
+ __pInputMethodManager = new(std::nothrow) InputMethodManager();\r
+ SysTryReturn(NID_UI_IME, __pInputMethodManager, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ __pInputMethodManager->__pInputMethodManagerImpl = _InputMethodManagerImpl::GetInstance(*__pInputMethodManager);\r
+ r = GetLastResult();\r
+ SysTryCatch(NID_UI_IME, __pInputMethodManager->__pInputMethodManagerImpl, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+\r
+ return __pInputMethodManager;\r
+\r
+CATCH:\r
+ delete __pInputMethodManager;\r
+ __pInputMethodManager = null;\r
+\r
+ __pInputMethodManager->__pInputMethodManagerImpl = null;\r
+\r
+ return null;\r
+}\r
+\r
+Tizen::Base::Collection::IList*\r
+InputMethodManager::GetInputMethodInfoListN(void) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
+ SysTryReturn(NID_UI_IME, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");\r
+\r
+ return __pInputMethodManagerImpl->GetInputMethodInfoListN();\r
+}\r
+\r
+result\r
+InputMethodManager::SetInputMethod(Tizen::App::AppId id)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);\r
+ SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");\r
+\r
+ return __pInputMethodManagerImpl->SetInputMethod(id);\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_EcoreFdHandler.cpp\r
+ * @brief This is the implementation file for the %_EcoreFdHandler class.\r
+ *\r
+ * This implementation file contains definition of the %_EcoreFdHandler class.\r
+ */\r
+\r
+#include <new>\r
+\r
+#include <FBaseSysLog.h>\r
+\r
+#include "FUiIme_EcoreFdHandler.h"\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+_EcoreFdHandler* _EcoreFdHandler::__pEcoreFdHandler = null;\r
+\r
+_EcoreFdHandler::_EcoreFdHandler(void)\r
+ :__fd(-1)\r
+ ,__pHelperAgent(null)\r
+ ,__pFdHandler(null)\r
+{\r
+}\r
+\r
+_EcoreFdHandler::~_EcoreFdHandler(void)\r
+{\r
+ __fd = -1;\r
+ __pHelperAgent = null;\r
+\r
+ if (__pFdHandler)\r
+ {\r
+ ecore_main_fd_handler_del(__pFdHandler);\r
+ __pFdHandler = null;\r
+ }\r
+}\r
+\r
+result\r
+_EcoreFdHandler::Construct(int fd, scim::HelperAgent& helperAgent)\r
+{\r
+ SysTryReturnResult(NID_UI_IME, fd > -1, E_INVALID_ARG, "Invalid argument(s) is used. The fd is not greater than -1.");\r
+\r
+ result r = E_SUCCESS;\r
+\r
+ __fd = fd;\r
+ __pHelperAgent = &helperAgent;\r
+\r
+ return r;\r
+}\r
+\r
+_EcoreFdHandler*\r
+_EcoreFdHandler::GetInstance(int fd, scim::HelperAgent& helperAgent)\r
+{\r
+ SysTryReturn(NID_UI_IME, fd > -1, null, E_INVALID_ARG, "Invalid argument(s) is used. The fd is not greater than -1.");\r
+\r
+ result r = E_SUCCESS;\r
+\r
+ if (!__pEcoreFdHandler)\r
+ {\r
+ __pEcoreFdHandler = new(std::nothrow) _EcoreFdHandler();\r
+ SysTryReturn(NID_UI_IME, __pEcoreFdHandler, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+ \r
+ r = __pEcoreFdHandler->Construct(fd, helperAgent);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+ else\r
+ {\r
+ SysTryReturn(NID_UI_IME, (__pEcoreFdHandler->__fd == fd) && (__pEcoreFdHandler->__pHelperAgent == &helperAgent), null, E_INVALID_ARG,\r
+ "Invalid argument(s) is used. The instance of the _EcoreFdHandler is already occupied.");\r
+ }\r
+\r
+ return __pEcoreFdHandler;\r
+\r
+CATCH:\r
+ delete __pEcoreFdHandler;\r
+ __pEcoreFdHandler = null;\r
+\r
+ return null;\r
+}\r
+\r
+result\r
+_EcoreFdHandler::Activate(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ r = Deactivate();\r
+ SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");\r
+\r
+ __pFdHandler = ecore_main_fd_handler_add(__fd, ECORE_FD_READ, FdHandler, null, null, null);\r
+ SysTryReturnResult(NID_UI_IME, __pFdHandler, E_SYSTEM, "A failure occurs from the underlying system.");\r
+\r
+ return r;\r
+}\r
+\r
+result\r
+_EcoreFdHandler::Deactivate(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ if (__pFdHandler)\r
+ {\r
+ void* data = null;\r
+ data = ecore_main_fd_handler_del(__pFdHandler);\r
+ SysTryReturnResult(NID_UI_IME, data, E_SYSTEM, "A failure occurs from the underlying system.");\r
+\r
+ __pFdHandler = null;\r
+ }\r
+\r
+ return r;\r
+}\r
+\r
+Eina_Bool\r
+_EcoreFdHandler::FdHandler(void *data, Ecore_Fd_Handler *handler)\r
+{\r
+ if (!__pEcoreFdHandler)\r
+ {\r
+ return EINA_FALSE;\r
+ }\r
+\r
+ if (__pEcoreFdHandler->HasPendingEvent())\r
+ {\r
+ __pEcoreFdHandler->ProcessEvent();\r
+ }\r
+\r
+ return ECORE_CALLBACK_RENEW;\r
+}\r
+\r
+bool\r
+_EcoreFdHandler::HasPendingEvent(void) const\r
+{\r
+ return __pHelperAgent->has_pending_event();\r
+}\r
+\r
+result\r
+_EcoreFdHandler::ProcessEvent(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ bool connected = false;\r
+\r
+ connected = __pHelperAgent->filter_event();\r
+ SysTryReturnResult(NID_UI_IME, connected == true, E_HOST_NOT_FOUND, "The destination host is not found.");\r
+\r
+ return r;\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_EcoreFdHander.h\r
+ * @brief This is the header file for the %_EcoreFdHander class.\r
+ *\r
+ * This header file contains the declarations of the %_EcoreFdHander class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INTERNAL_ECORE_FD_HANDLER_H_\r
+#define _FUI_IME_INTERNAL_ECORE_FD_HANDLER_H_\r
+\r
+#include <Ecore.h> // Ecore_Fd_Handler\r
+#include <Eina.h> // Eina_Bool\r
+\r
+#define Uses_SCIM_HELPER\r
+#define Uses_SCIM_TYPES\r
+#undef null\r
+#include <scim.h>\r
+#define null 0\r
+\r
+#include <FBaseDataType.h>\r
+#include <FBaseObject.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+/**\r
+* @class _EcoreFdHander\r
+* @brief This class is a concrete class of the %_EcoreFdHander class.\r
+* @since 2.0\r
+*\r
+*/\r
+class _EcoreFdHandler\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ virtual ~_EcoreFdHandler(void);\r
+\r
+ static _EcoreFdHandler* GetInstance(int fd, scim::HelperAgent& helperAgent);\r
+\r
+ result Activate(void);\r
+ result Deactivate(void);\r
+\r
+private:\r
+ _EcoreFdHandler();\r
+\r
+ _EcoreFdHandler(const _EcoreFdHandler& rhs);\r
+ _EcoreFdHandler& operator=(const _EcoreFdHandler& rhs);\r
+\r
+ result Construct(int fd, scim::HelperAgent& helperAgent);\r
+\r
+ static Eina_Bool FdHandler(void *data, Ecore_Fd_Handler *fdHandler);\r
+\r
+ bool HasPendingEvent(void) const;\r
+ result ProcessEvent(void);\r
+\r
+private:\r
+ static _EcoreFdHandler* __pEcoreFdHandler;\r
+\r
+ int __fd;\r
+ scim::HelperAgent* __pHelperAgent;\r
+\r
+ Ecore_Fd_Handler* __pFdHandler;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INTERNAL_ECORE_FD_HANDLER_H_\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_ImeInfo.cpp\r
+ * @brief This is the implementation file for the %_ImeInfo class.\r
+ *\r
+ * This implementation file contains definition of the %_ImeInfo class.\r
+ */\r
+\r
+#include <FBaseSysLog.h>\r
+\r
+#include "FUiIme_ImeInfo.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif // __cplusplus\r
+\r
+ void\r
+ InitImeInfo(const char* uuid, const char* name, const char* language)\r
+ {\r
+ result r = E_SUCCESS;\r
+\r
+ r = Tizen::Ui::Ime::_ImeInfo::GetInstance()->Construct(uuid, name, language);\r
+ SysTryLog(NID_UI_IME, r == E_SUCCESS, "Initializing _ImeInfo has failed.");\r
+\r
+ return;\r
+ }\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif // __cplusplus\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+_ImeInfo::_ImeInfo(void)\r
+ :__uuid("")\r
+ ,__name("")\r
+ ,__language("")\r
+{\r
+\r
+}\r
+\r
+_ImeInfo::~_ImeInfo(void)\r
+{\r
+\r
+}\r
+\r
+_ImeInfo*\r
+_ImeInfo::GetInstance(void)\r
+{\r
+ static _ImeInfo imeInfo;\r
+\r
+ return &imeInfo;\r
+}\r
+\r
+result\r
+_ImeInfo::Construct(const char* uuid, const char* name, const char* language)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __uuid = uuid;\r
+ __name = name;\r
+ __language = language;\r
+\r
+ SysLog(NID_UI_IME, "The _ImeInfo has been constructed. The uuid is %s, the name is %s, and the language is %s.", uuid, name, language);\r
+\r
+ return r;\r
+}\r
+\r
+scim::String\r
+_ImeInfo::GetUuid(void) const\r
+{\r
+ return __uuid;\r
+}\r
+\r
+scim::String\r
+_ImeInfo::GetName(void) const\r
+{\r
+ return __name;\r
+}\r
+\r
+scim::String\r
+_ImeInfo::GetLanguage(void) const\r
+{\r
+ return __language;\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_ImeInfo.h\r
+ * @brief This is the header file for the %_ImeInfo class.\r
+ *\r
+ * This header file contains the declarations of the %_ImeInfo class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INTERNAL_IME_INFO_H_\r
+#define _FUI_IME_INTERNAL_IME_INFO_H_\r
+\r
+#define Uses_SCIM_TYPES\r
+#undef null\r
+#include <scim.h>\r
+#define null 0\r
+\r
+#include <FBaseDataType.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+/**\r
+* @class _ImeInfo\r
+* @brief This class is a concrete class of the %_ImeInfo class.\r
+* @since 2.0\r
+*\r
+*/\r
+class _ImeInfo\r
+{\r
+public:\r
+ ~_ImeInfo(void);\r
+\r
+ static _ImeInfo* GetInstance(void);\r
+\r
+ result Construct(const char* uuid, const char* name, const char* language);\r
+\r
+ scim::String GetUuid(void) const;\r
+ scim::String GetName(void) const;\r
+ scim::String GetLanguage(void) const;\r
+\r
+private:\r
+ _ImeInfo(void);\r
+\r
+ _ImeInfo(const _ImeInfo& rhs);\r
+ _ImeInfo& operator=(const _ImeInfo& rhs);\r
+\r
+private:\r
+ scim::String __uuid;\r
+ scim::String __name;\r
+ scim::String __language;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INTERNAL_IME_INFO_H_\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FUiIme_InputMethodImpl.cpp
+ * @brief This is the implementation file for the %_InputMethodImpl class.
+ *
+ * This implementation file contains definition of the %_InputMethodImpl class.
+ */
+
+#include <new>
+
+#include <Ecore_IMF.h>
+#include <Ecore_X.h> // ecore_x_icccm_hints_get
+#include <Elementary.h> // elm_win_keyboard_win_set
+
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+
+#include "FUi_EcoreEvas.h"
+#include "FUi_EcoreEvasMgr.h"
+
+#include "FUiIme_EcoreFdHandler.h"
+#include "FUiIme_ImeInfo.h"
+#include "FUiIme_InputMethodImpl.h"
+#include "FUiIme_InputServiceSignalListener.h"
+#include "FUiIme_ScimDataConverter.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Graphics;
+using namespace Tizen::Locales;
+using namespace Tizen::Ui;
+
+namespace Tizen { namespace Ui { namespace Ime {
+
+_InputMethodImpl* _InputMethodImpl::__pInputMethodImpl = null;
+
+_InputMethodImpl::_InputMethodImpl(void)
+ :__pHelperAgent(null)
+ ,__pInputMethod(null)
+ ,__pEcoreFdHandler(null)
+ ,__pInputServiceBinder(null)
+ ,__pInputServiceSignalListener(null)
+ ,__pScimDataConverter(null)
+{
+}
+
+_InputMethodImpl::~_InputMethodImpl(void)
+{
+ __pInputMethodImpl = null;
+ __pHelperAgent = null;
+ __pInputMethod = null;
+
+ if (__pEcoreFdHandler)
+ {
+ __pEcoreFdHandler->Deactivate();
+ __pEcoreFdHandler = null;
+ }
+
+ if (__pInputServiceBinder)
+ {
+ __pInputServiceBinder->Unbind();
+ __pInputServiceBinder = null;
+ }
+
+ delete __pInputServiceSignalListener;
+ __pInputServiceSignalListener = null;
+
+ delete __pScimDataConverter;
+ __pScimDataConverter = null;
+}
+
+result
+_InputMethodImpl::Construct(InputMethod& inputMethod)
+{
+ result r = E_SUCCESS;
+
+ __pInputServiceBinder = _InputServiceBinder::GetInstance();
+ r = GetLastResult();
+ SysTryReturnResult(NID_UI_IME, __pInputServiceBinder, r, "Propagating.");
+
+ BindingId bindingId = -1;
+ bindingId = __pInputServiceBinder->Bind();
+ r = GetLastResult();
+ SysTryCatch(NID_UI_IME, bindingId > -1, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pHelperAgent = __pInputServiceBinder->GetHelperAgent();
+ __pInputMethod = &inputMethod;
+
+ __pInputServiceSignalListener = new(std::nothrow) _InputServiceSignalListener();
+ SysTryCatch(NID_UI_IME, __pInputServiceSignalListener, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ __pScimDataConverter = new(std::nothrow) _ScimDataConverter();
+ SysTryCatch(NID_UI_IME, __pScimDataConverter, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ SetInputServiceSignalCallback();
+
+ r = SetEcoreEvasAttribute();
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ __pEcoreFdHandler = _EcoreFdHandler::GetInstance(bindingId, *__pHelperAgent);
+ r = GetLastResult();
+ SysTryCatch(NID_UI_IME, __pEcoreFdHandler, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = __pEcoreFdHandler->Activate();
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+
+CATCH:
+ __pInputServiceBinder->Unbind();
+ __pInputServiceBinder = null;
+
+ __pHelperAgent = null;
+ __pInputMethod = null;
+
+ delete __pInputServiceSignalListener;
+ __pInputServiceSignalListener = null;
+
+ delete __pScimDataConverter;
+ __pScimDataConverter = null;
+
+ if (__pEcoreFdHandler)
+ {
+ __pEcoreFdHandler->Deactivate();
+ __pEcoreFdHandler = null;
+ }
+
+ return r;
+}
+
+_InputMethodImpl*
+_InputMethodImpl::GetInstance(InputMethod& inputMethod)
+{
+ result r = E_SUCCESS;
+
+ if (!__pInputMethodImpl)
+ {
+ __pInputMethodImpl = new(std::nothrow) _InputMethodImpl();
+ SysTryReturn(NID_UI_IME, __pInputMethodImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+ r = __pInputMethodImpl->Construct(inputMethod);
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+
+ return __pInputMethodImpl;
+
+CATCH:
+ delete __pInputMethodImpl;
+ __pInputMethodImpl = null;
+
+ return null;
+}
+
+void
+_InputMethodImpl::SetInputMethodProvider(IInputMethodProvider* pProvider)
+{
+ __pInputServiceSignalListener->SetInputMethodProvider(pProvider);
+
+ return;
+}
+
+void
+_InputMethodImpl::SetInputMethodListener(IInputMethodListener* pListener)
+{
+ __pInputServiceSignalListener->SetInputMethodListener(pListener);
+
+ return;
+}
+
+result
+_InputMethodImpl::DeleteText(int cursorOffset, int length)
+{
+ SysTryReturnResult(NID_UI_IME, length > 0, E_INVALID_ARG, "Invalid argument(s) is used. The length is not greater than 0.");
+
+ result r = E_SUCCESS;
+
+ __pHelperAgent->delete_surrounding_text(cursorOffset, length);
+
+ return r;
+}
+
+result
+_InputMethodImpl::NotifyInputPanelState(InputPanelShowState state)
+{
+ SysTryReturnResult(NID_UI_IME, (state == INPUT_PANEL_SHOW_STATE_SHOW) || (state == INPUT_PANEL_SHOW_STATE_HIDE), E_INVALID_ARG,
+ "Invalid argument(s) is used. The state is beyond the scope.");
+
+ result r = E_SUCCESS;
+
+ Ecore_IMF_Input_Panel_State inputPanelState;
+
+ switch (state)
+ {
+ case INPUT_PANEL_SHOW_STATE_SHOW:
+ inputPanelState = ECORE_IMF_INPUT_PANEL_STATE_SHOW;
+ break;
+ case INPUT_PANEL_SHOW_STATE_HIDE:
+ inputPanelState = ECORE_IMF_INPUT_PANEL_STATE_HIDE;
+ break;
+ default:
+ break;
+ }
+
+ __pHelperAgent->update_input_context(ECORE_IMF_INPUT_PANEL_STATE_EVENT, inputPanelState);
+
+ return r;
+}
+
+result
+_InputMethodImpl::RequestSurroundingText(int lengthBeforeCursor, int lengthAfterCursor)
+{
+ SysTryReturnResult(NID_UI_IME, (lengthBeforeCursor >= 0) && (lengthAfterCursor >= 0), E_INVALID_ARG,
+ "[E_INVALID_ARG] Invalid argument(s) is used. The length is not greater than or equal to 0.");
+
+ result r = E_SUCCESS;
+
+ _ImeInfo* pImeInfo = _ImeInfo::GetInstance();
+ scim::String uuid = pImeInfo->GetUuid();
+
+ __pHelperAgent->get_surrounding_text(uuid, lengthBeforeCursor, lengthAfterCursor);
+
+ return r;
+}
+
+result
+_InputMethodImpl::SendCompositeText(const Tizen::Base::String& text)
+{
+ result r = E_SUCCESS;
+
+ scim::WideString compositeText;
+ r = __pScimDataConverter->ConvertString(text, compositeText);
+ SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");
+
+ scim::AttributeList attributeList;
+ __pHelperAgent->update_preedit_string(-1, "", compositeText, attributeList);
+
+ return r;
+}
+
+result
+_InputMethodImpl::SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state)
+{
+ SysTryReturnResult(NID_UI_IME, (code > KEY_INVALID) && (code < KEY_HARDWARE_MAX), E_INVALID_ARG,
+ "Invalid argument(s) is used. The key code is beyond the scope.");
+ SysTryReturnResult(NID_UI_IME, (state >= KEY_PRESSED) && (state <= KEY_LONGPRESSED), E_INVALID_ARG,
+ "Invalid argument(s) is used. The key state is beyond the scope.");
+
+ result r = E_SUCCESS;
+
+ scim::KeyEvent keyEvent;
+ __pScimDataConverter->ConvertKey(code, state, keyEvent);
+ __pHelperAgent->forward_key_event(-1, "", keyEvent);
+
+ return r;
+}
+
+result
+_InputMethodImpl::SendText(const Tizen::Base::String& text)
+{
+ result r = E_SUCCESS;
+
+ scim::String scimText;
+ r = __pScimDataConverter->ConvertString(text, scimText);
+ SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");
+
+ scim::WideString wideString = scim::utf8_mbstowcs(scimText);
+
+ __pHelperAgent->commit_string(-1, "", wideString);
+
+ return r;
+}
+
+bool
+_InputMethodImpl::HasPendingEvent(void) const
+{
+ return __pHelperAgent->has_pending_event();
+}
+
+result
+_InputMethodImpl::ProcessPendingEvent(void)
+{
+ result r = E_SUCCESS;
+
+ bool bound = false;
+
+ bound = __pHelperAgent->filter_event();
+ SysTryReturnResult(NID_UI_IME, bound == true, E_HOST_NOT_FOUND, "The destination host is not found.");
+
+ return r;
+}
+
+result
+_InputMethodImpl::SetEcoreEvasAttribute(void)
+{
+ result r = E_SUCCESS;
+
+ _EcoreEvasMgr* pEcoreEvasMgr = null;
+ pEcoreEvasMgr = GetEcoreEvasMgr();
+ r = GetLastResult();
+ SysTryReturnResult(NID_UI_IME, pEcoreEvasMgr, r, "Propagating.");
+
+ _EcoreEvas* pEcoreEvas = null;
+ pEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
+ r = GetLastResult();
+ SysTryReturnResult(NID_UI_IME, pEcoreEvas, r, "Propagating.");
+
+ elm_win_keyboard_win_set(pEcoreEvas->GetWindowObject(), EINA_TRUE);
+
+ Eina_Bool accepts_focus = EINA_TRUE;
+ Ecore_X_Window_State_Hint initial_state = ECORE_X_WINDOW_STATE_HINT_NONE;
+ Ecore_X_Pixmap icon_pixmap = 0;
+ Ecore_X_Pixmap icon_mask = 0;
+ Ecore_X_Window icon_window = 0;
+ Ecore_X_Window window_group = 0;
+ Eina_Bool is_urgent = EINA_FALSE;
+
+ Eina_Bool result = EINA_FALSE;
+ result = ecore_x_icccm_hints_get(pEcoreEvas->GetXWindow(), &accepts_focus, &initial_state, &icon_pixmap, &icon_mask, &icon_window, &window_group, &is_urgent);
+ SysTryReturnResult(NID_UI_IME, result == EINA_TRUE, E_SYSTEM, "A failure occurs from the underlying system.");
+
+ ecore_x_icccm_hints_set(pEcoreEvas->GetXWindow(), EINA_FALSE, initial_state, icon_pixmap, icon_mask, icon_window, window_group, is_urgent);
+
+ return r;
+}
+
+void
+_InputMethodImpl::SetInputServiceSignalCallback(void)
+{
+ __pHelperAgent->signal_connect_exit(scim::slot(_InputServiceSignalListener::OnTerminate));
+ __pHelperAgent->signal_connect_get_geometry(scim::slot(_InputServiceSignalListener::GetInputPanelBounds));
+ __pHelperAgent->signal_connect_ise_hide(scim::slot(_InputServiceSignalListener::HideInputPanel));
+ __pHelperAgent->signal_connect_ise_show(scim::slot(_InputServiceSignalListener::ShowInputPanel));
+ __pHelperAgent->signal_connect_update_cursor_position(scim::slot(_InputServiceSignalListener::OnCursorPositionChanged));
+ __pHelperAgent->signal_connect_update_surrounding_text(scim::slot(_InputServiceSignalListener::OnSurroundingTextReceived));
+ __pHelperAgent->signal_connect_set_language(scim::slot(_InputServiceSignalListener::SetLanguage));
+ __pHelperAgent->signal_connect_set_return_key_type(scim::slot(_InputServiceSignalListener::SetEnterKeyAction));
+ __pHelperAgent->signal_connect_get_return_key_type(scim::slot(_InputServiceSignalListener::GetEnterKeyAction));
+ __pHelperAgent->signal_connect_set_return_key_disable(scim::slot(_InputServiceSignalListener::SetEnterKeyActionEnabled));
+ __pHelperAgent->signal_connect_get_return_key_disable(scim::slot(_InputServiceSignalListener::IsEnterKeyActionEnabled));
+ __pHelperAgent->signal_connect_get_layout(scim::slot(_InputServiceSignalListener::GetInputPanelStyle));
+ __pHelperAgent->signal_connect_set_layout(scim::slot(_InputServiceSignalListener::SetInputPanelStyle));
+ __pHelperAgent->signal_connect_set_caps_mode(scim::slot(_InputServiceSignalListener::SetCapsModeEnabled));
+
+ SysLog(NID_UI_IME, "The signal callback functions of the input service have been set");
+
+ return;
+}
+
+void
+_InputMethodImpl::HideInputPanel(void)
+{
+ _EcoreEvasMgr* pEcoreEvasMgr = null;
+ pEcoreEvasMgr = GetEcoreEvasMgr();
+ SysTryReturnVoidResult(NID_UI_IME, pEcoreEvasMgr, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");
+
+ _EcoreEvas* pEcoreEvas = null;
+ pEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
+ SysTryReturnVoidResult(NID_UI_IME, pEcoreEvas, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");
+
+ Evas_Object* pEvasObject = null;
+ pEvasObject = pEcoreEvas->GetWindowObject();
+ SysTryReturnVoidResult(NID_UI_IME, pEvasObject, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");
+
+ if (evas_object_visible_get(pEvasObject))
+ {
+ evas_object_hide(pEvasObject);
+ }
+
+ return;
+}
+
+void
+_InputMethodImpl::ShowInputPanel(void)
+{
+ _EcoreEvasMgr* pEcoreEvasMgr = null;
+ pEcoreEvasMgr = GetEcoreEvasMgr();
+ SysTryReturnVoidResult(NID_UI_IME, pEcoreEvasMgr, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");
+
+ _EcoreEvas* pEcoreEvas = null;
+ pEcoreEvas = pEcoreEvasMgr->GetEcoreEvas();
+ SysTryReturnVoidResult(NID_UI_IME, pEcoreEvas, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");
+
+ Evas_Object* pEvasObject = null;
+ pEvasObject = pEcoreEvas->GetWindowObject();
+ SysTryReturnVoidResult(NID_UI_IME, pEvasObject, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");
+
+ if (evas_object_visible_get(pEvasObject) == false)
+ {
+ evas_object_show(pEvasObject);
+ }
+
+ return;
+}
+
+}}} // Tizen::Ui::Ime
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_InputMethodImpl.h\r
+ * @brief This is the header file for the %_InputMethodImpl class.\r
+ *\r
+ * This header file contains the declarations of the %_InputMethodImpl class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INTERNAL_INPUT_METHOD_IMPL_H_\r
+#define _FUI_IME_INTERNAL_INPUT_METHOD_IMPL_H_\r
+\r
+#include <Ecore.h> // Ecore_Fd_Handler\r
+#include <Eina.h> // Eina_Bool\r
+\r
+#define Uses_SCIM_HELPER\r
+#define Uses_SCIM_TYPES\r
+#undef null\r
+#include <scim.h>\r
+#define null 0\r
+\r
+#include <FBaseDataType.h>\r
+#include <FBaseObject.h>\r
+#include <FBaseString.h>\r
+#include <FGrpRectangle.h>\r
+#include <FLclLocale.h>\r
+#include <FUiImeIInputMethodListener.h>\r
+#include <FUiImeIInputMethodProvider.h>\r
+#include <FUiImeInputMethod.h>\r
+\r
+#include "FUiIme_Key.h"\r
+#include "FUiIme_InputServiceBinder.h"\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+class _EcoreFdHandler;\r
+class _ScimDataConverter;\r
+class _InputServiceSignalListener;\r
+\r
+/**\r
+* @class _InputMethodImpl\r
+* @brief This class is a concrete class of the %_InputMethodImpl class.\r
+* @since 2.0\r
+*\r
+*/\r
+class _InputMethodImpl\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ virtual ~_InputMethodImpl(void);\r
+\r
+ static _InputMethodImpl* GetInstance(InputMethod& inputMethod);\r
+\r
+ void SetInputMethodProvider(IInputMethodProvider* pProvider);\r
+ void SetInputMethodListener(IInputMethodListener* pListener);\r
+\r
+ result DeleteText(int cursorOffset, int length);\r
+ result NotifyInputPanelState(Tizen::Ui::InputPanelShowState state);\r
+ result RequestSurroundingText(int lengthBeforeCursor, int lengthAfterCursor);\r
+ result SendCompositeText(const Tizen::Base::String& text);\r
+ result SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state);\r
+ result SendText(const Tizen::Base::String& text);\r
+\r
+private:\r
+ _InputMethodImpl(void);\r
+\r
+ _InputMethodImpl(const _InputMethodImpl& rhs);\r
+ _InputMethodImpl& operator=(const _InputMethodImpl& rhs);\r
+\r
+ result Construct(InputMethod& inputMethod);\r
+\r
+ bool HasPendingEvent(void) const;\r
+ result ProcessPendingEvent(void);\r
+ result SetEcoreEvasAttribute(void);\r
+ void SetInputServiceSignalCallback(void);\r
+\r
+ void HideInputPanel(void);\r
+ void ShowInputPanel(void);\r
+\r
+private:\r
+ static _InputMethodImpl* __pInputMethodImpl;\r
+\r
+ scim::HelperAgent* __pHelperAgent;\r
+\r
+ InputMethod* __pInputMethod;\r
+\r
+ _EcoreFdHandler* __pEcoreFdHandler;\r
+ _InputServiceBinder* __pInputServiceBinder;\r
+ _InputServiceSignalListener* __pInputServiceSignalListener;\r
+ _ScimDataConverter* __pScimDataConverter;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INTERNAL_INPUT_METHOD_IMPL_H_\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_InputMethodInfoImpl.cpp\r
+ * @brief This is the implementation file for the %_InputMethodInfoImpl class.\r
+ *\r
+ * This implementation file contains definition of the %_InputMethodInfoImpl class.\r
+ */\r
+\r
+#include <new>\r
+#include <string.h>\r
+\r
+#include <FBaseColTypes.h>\r
+#include <FBaseSysLog.h>\r
+\r
+#include <FBase_StringConverter.h>\r
+\r
+#include "FUiIme_InputMethodInfoImpl.h"\r
+#include "FUiIme_ScimDataConverter.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Collection;\r
+using namespace Tizen::Locales;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+_InputMethodInfoImpl::_InputMethodInfoImpl(void)\r
+ :__pUuid(null)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __pLanguageList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
+ SysTryReturnVoidResult(NID_UI_IME, __pLanguageList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = __pLanguageList->Construct();\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return;\r
+\r
+CATCH:\r
+ delete __pLanguageList;\r
+ __pLanguageList = null;\r
+\r
+ return;\r
+}\r
+\r
+_InputMethodInfoImpl::_InputMethodInfoImpl(const _InputMethodInfoImpl& impl)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __appId = impl.__appId;\r
+ __name = impl.__name;\r
+\r
+ __pLanguageList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
+ SysTryReturnVoidResult(NID_UI_IME, __pLanguageList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = __pLanguageList->Construct();\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ r = SetLanguageList(*(impl.__pLanguageList));\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ __pUuid = _StringConverter::CopyToCharArrayN(impl.__uuid);\r
+\r
+ return;\r
+\r
+CATCH:\r
+ delete __pLanguageList;\r
+ __pLanguageList = null;\r
+\r
+ return;\r
+}\r
+\r
+_InputMethodInfoImpl::~_InputMethodInfoImpl(void)\r
+{\r
+ delete __pLanguageList;\r
+ __pLanguageList = null;\r
+\r
+ delete[] __pUuid;\r
+ __pUuid = null;\r
+}\r
+\r
+_InputMethodInfoImpl*\r
+_InputMethodInfoImpl::CreateInputMethodInfoImplN(void)\r
+{\r
+ _InputMethodInfoImpl* pInputMethodInfoImpl = new(std::nothrow) _InputMethodInfoImpl();\r
+ SysTryReturn(NID_UI_IME, pInputMethodInfoImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ return pInputMethodInfoImpl;\r
+}\r
+\r
+_InputMethodInfoImpl*\r
+_InputMethodInfoImpl::CreateInputMethodInfoImplN(const _InputMethodInfoImpl& impl)\r
+{\r
+ _InputMethodInfoImpl* pInputMethodInfoImpl = new(std::nothrow) _InputMethodInfoImpl(impl);\r
+ SysTryReturn(NID_UI_IME, pInputMethodInfoImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ return pInputMethodInfoImpl;\r
+}\r
+\r
+_InputMethodInfoImpl*\r
+_InputMethodInfoImpl::GetInstance(InputMethodInfo& inputMethodInfo)\r
+{\r
+ return inputMethodInfo.__pInputMethodInfoImpl;\r
+}\r
+\r
+_InputMethodInfoImpl&\r
+_InputMethodInfoImpl::operator=(const _InputMethodInfoImpl& impl)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ if (&impl != this)\r
+ {\r
+ __appId = impl.__appId;\r
+ __name = impl.__name;\r
+\r
+ r = SetLanguageList(*(impl.__pLanguageList));\r
+ SysTryReturn(NID_UI_IME, r == E_SUCCESS, *this, r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ if (__pUuid)\r
+ {\r
+ delete[] __pUuid;\r
+ }\r
+ __pUuid = _StringConverter::CopyToCharArrayN(impl.__uuid);\r
+ }\r
+\r
+ return *this;\r
+}\r
+\r
+bool\r
+_InputMethodInfoImpl::Equals(const Object& object) const\r
+{\r
+ const _InputMethodInfoImpl* pInputMethodInfoImpl = static_cast<const _InputMethodInfoImpl*>(&object);\r
+ SysTryReturn(NID_UI_IME, pInputMethodInfoImpl, false, E_INVALID_ARG, "Invalid argument(s) is used. The object is not the _InputMethodInfoImpl.");\r
+\r
+ return __appId.Equals(pInputMethodInfoImpl->__appId, true);\r
+}\r
+\r
+Tizen::App::AppId\r
+_InputMethodInfoImpl::GetAppId(void) const\r
+{\r
+ return __appId;\r
+}\r
+\r
+const Tizen::Base::Collection::IList*\r
+_InputMethodInfoImpl::GetLanguageList(void) const\r
+{\r
+ return __pLanguageList;\r
+}\r
+\r
+Tizen::Base::String\r
+_InputMethodInfoImpl::GetName(void) const\r
+{\r
+ return __name;\r
+}\r
+\r
+const char*\r
+_InputMethodInfoImpl::GetUuid(void) const\r
+{\r
+ return __pUuid;\r
+}\r
+\r
+void\r
+_InputMethodInfoImpl::SetAppId(Tizen::App::AppId id)\r
+{\r
+ __appId = id;\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputMethodInfoImpl::SetUuid(Tizen::Base::String id)\r
+{\r
+ __uuid = id;\r
+\r
+ if (__pUuid)\r
+ {\r
+ delete[] __pUuid;\r
+ }\r
+ __pUuid = _StringConverter::CopyToCharArrayN(id);\r
+\r
+ return;\r
+}\r
+\r
+result\r
+_InputMethodInfoImpl::SetLanguageList(const Tizen::Base::Collection::IList& list)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __pLanguageList->RemoveAll();\r
+\r
+ const ArrayList* pLanguageList = static_cast<const ArrayList*>(&list);\r
+ int languageCount = pLanguageList->GetCount();\r
+\r
+ r = __pLanguageList->SetCapacity(languageCount);\r
+ SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");\r
+\r
+ Locale* pDestLanguage = null;\r
+ for (int i = 0; i < languageCount; i++)\r
+ {\r
+ const Locale* pLanguage = static_cast<const Locale*>(pLanguageList->GetAt(i));\r
+ r = GetLastResult();\r
+ SysTryReturnResult(NID_UI_IME, pLanguage, r, "Propagating.");\r
+\r
+ pDestLanguage = new(std::nothrow) Locale(*pLanguage);\r
+ SysTryCatch(NID_UI_IME, pDestLanguage, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = __pLanguageList->Add(pDestLanguage);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+\r
+ return r;\r
+\r
+CATCH:\r
+ __pLanguageList->RemoveAll();\r
+\r
+ delete pDestLanguage;\r
+\r
+ return r;\r
+}\r
+\r
+void\r
+_InputMethodInfoImpl::SetName(const Tizen::Base::String& name)\r
+{\r
+ __name = name;\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputMethodInfoImpl::SetName(const scim::String& name)\r
+{\r
+ _ScimDataConverter converter;\r
+ converter.ConvertString(name, __name);\r
+\r
+ return;\r
+}\r
+\r
+result\r
+_InputMethodInfoImpl::AddLanguage(const char* language)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ // verify the input parameter\r
+ const int ISO_639_2_LENGTH = 6;\r
+ const int ISO_639_2_LANGUAGE_CODE_LENGTH = 3;\r
+ const int COUNTRY_CODE_LENGTH = 2;\r
+\r
+ int length = strlen(language);\r
+ SysTryReturnResult(NID_UI_IME, (length == ISO_639_2_LENGTH), E_INVALID_ARG,\r
+ "Invalid argument(s) is used. The language is not a type of ISO 639-2 and is %s.", language);\r
+\r
+ LanguageCode languageCode = LANGUAGE_INVALID;\r
+ CountryCode countryCode = COUNTRY_INVALID;\r
+\r
+ // LanguageCode\r
+ char srcLanguage[ISO_639_2_LANGUAGE_CODE_LENGTH + 1];\r
+ strncpy(srcLanguage, language, ISO_639_2_LANGUAGE_CODE_LENGTH);\r
+ srcLanguage[ISO_639_2_LANGUAGE_CODE_LENGTH] = '\0';\r
+\r
+ languageCode = Locale::StringToLanguageCode(srcLanguage);\r
+ SysTryReturnResult(NID_UI_IME, languageCode != LANGUAGE_INVALID, E_INVALID_ARG,\r
+ "Invalid argument(s) is used. The srcLanguage is %s.", srcLanguage);\r
+\r
+ // CountryCode\r
+ char srcCountry[COUNTRY_CODE_LENGTH + 1];\r
+ strncpy(srcCountry, language + ISO_639_2_LANGUAGE_CODE_LENGTH + 1, COUNTRY_CODE_LENGTH);\r
+ srcCountry[COUNTRY_CODE_LENGTH] = '\0';\r
+\r
+ countryCode = Locale::StringToCountryCode(srcCountry);\r
+ SysTryReturnResult(NID_UI_IME, countryCode != COUNTRY_INVALID, E_INVALID_ARG,\r
+ "Invalid argument(s) is used. The srcCountry is %s.", srcCountry);\r
+\r
+ // add the language\r
+ Locale* pLanguage = new(std::nothrow) Locale(languageCode, countryCode);\r
+ SysTryReturnResult(NID_UI_IME, pLanguage, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = __pLanguageList->Add(pLanguage);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return r;\r
+\r
+CATCH:\r
+ delete pLanguage;\r
+\r
+ return r;\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_InputMethodInfoImpl.h\r
+ * @brief This is the header file for the %_InputMethodInfoImpl class.\r
+ *\r
+ * This header file contains the declarations of the %_InputMethodInfoImpl class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INTERNAL_INPUT_METHOD_INFO_IMPL_H_\r
+#define _FUI_IME_INTERNAL_INPUT_METHOD_INFO_IMPL_H_\r
+\r
+#define Uses_SCIM_TYPES\r
+#undef null\r
+#include <scim.h>\r
+#define null 0\r
+\r
+#include <FAppTypes.h>\r
+#include <FBaseColArrayList.h>\r
+#include <FBaseColIList.h>\r
+#include <FBaseDataType.h>\r
+#include <FBaseObject.h>\r
+#include <FBaseString.h>\r
+#include <FLclLocale.h>\r
+#include <FUiImeInputMethodInfo.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+/**\r
+* @class _InputMethodInfoImpl\r
+* @brief This class is a concrete class of the %_InputMethodInfoImpl class.\r
+* @since 2.0\r
+*\r
+*/\r
+class _InputMethodInfoImpl\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ virtual ~_InputMethodInfoImpl(void);\r
+\r
+ static _InputMethodInfoImpl* CreateInputMethodInfoImplN(void);\r
+ static _InputMethodInfoImpl* CreateInputMethodInfoImplN(const _InputMethodInfoImpl& impl);\r
+\r
+ static _InputMethodInfoImpl* GetInstance(InputMethodInfo& inputMethodInfo);\r
+\r
+ _InputMethodInfoImpl& operator=(const _InputMethodInfoImpl& impl);\r
+ virtual bool Equals(const Object& object) const;\r
+\r
+ Tizen::App::AppId GetAppId(void) const;\r
+ const Tizen::Base::Collection::IList* GetLanguageList(void) const;\r
+ Tizen::Base::String GetName(void) const;\r
+ const char* GetUuid(void) const;\r
+\r
+ void SetAppId(Tizen::App::AppId id);\r
+ void SetUuid(Tizen::Base::String id);\r
+ result SetLanguageList(const Tizen::Base::Collection::IList& list);\r
+ void SetName(const Tizen::Base::String& name);\r
+ void SetName(const scim::String& name);\r
+\r
+ result AddLanguage(const char* language);\r
+\r
+private:\r
+ _InputMethodInfoImpl(void);\r
+ _InputMethodInfoImpl(const _InputMethodInfoImpl& impl);\r
+\r
+private:\r
+ Tizen::App::AppId __appId;\r
+ Tizen::Base::String __uuid;\r
+ Tizen::Base::String __name;\r
+\r
+ Tizen::Base::Collection::ArrayList* __pLanguageList;\r
+\r
+ char* __pUuid;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INTERNAL_INPUT_METHOD_INFO_IMPL_H_\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_InputMethodManagerImpl.cpp\r
+ * @brief This is the implementation file for the %_InputMethodManagerImpl class.\r
+ *\r
+ * This implementation file contains definition of the %_InputMethodManagerImpl class.\r
+ */\r
+\r
+#include <new>\r
+#include <string.h>\r
+#include <unique_ptr.h>\r
+\r
+#include <isf_control.h>\r
+\r
+#include <FAppPkgPackageInfo.h>\r
+#include <FBaseColArrayList.h>\r
+#include <FBaseColTypes.h>\r
+#include <FBaseString.h>\r
+#include <FBaseSysLog.h>\r
+#include <FLclLocale.h>\r
+#include <FUiImeInputMethodInfo.h>\r
+\r
+#include <FApp_AppManagerImpl.h>\r
+#include <FBase_StringConverter.h>\r
+\r
+#include "FUiIme_InputMethodInfoImpl.h"\r
+#include "FUiIme_InputMethodManagerImpl.h"\r
+\r
+using namespace Tizen::App;\r
+using namespace Tizen::App::Package;\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Collection;\r
+using namespace Tizen::Locales;\r
+\r
+const AppId PRELOADED_IME_APPID = "sja4pgHCvq.Tizen";\r
+const char* PRELOADED_IME_UUID = "12aa3425-f88d-45f4-a509-cee8dfe904e3";\r
+const char* PRELOADED_IME_LANGUAGE = "eng-US";\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+_InputMethodManagerImpl* _InputMethodManagerImpl::__pInputMethodManagerImpl = null;\r
+\r
+_InputMethodManagerImpl::_InputMethodManagerImpl(void)\r
+ :__pInputMethodManager(null)\r
+ ,__pInputMethodAppIdList(null)\r
+{\r
+}\r
+\r
+_InputMethodManagerImpl::~_InputMethodManagerImpl(void)\r
+{\r
+ __pInputMethodManagerImpl = null;\r
+\r
+ delete __pInputMethodAppIdList;\r
+ __pInputMethodAppIdList = null;\r
+\r
+ __pInputMethodManager = null;\r
+}\r
+\r
+result\r
+_InputMethodManagerImpl::Construct(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __pInputMethodAppIdList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
+ SysTryReturnResult(NID_UI_IME, __pInputMethodAppIdList, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = __pInputMethodAppIdList->Construct();\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ return r;\r
+\r
+CATCH:\r
+ delete __pInputMethodAppIdList;\r
+ __pInputMethodAppIdList = null;\r
+\r
+ return r;\r
+}\r
+\r
+_InputMethodManagerImpl*\r
+_InputMethodManagerImpl::GetInstance(InputMethodManager& inputMethodManager)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ if (!__pInputMethodManagerImpl)\r
+ {\r
+ __pInputMethodManagerImpl = new(std::nothrow) _InputMethodManagerImpl();\r
+ SysTryReturn(NID_UI_IME, __pInputMethodManagerImpl, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = __pInputMethodManagerImpl->Construct();\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ __pInputMethodManagerImpl->__pInputMethodManager = &inputMethodManager;\r
+ }\r
+\r
+ return __pInputMethodManagerImpl;\r
+\r
+CATCH:\r
+ delete __pInputMethodManagerImpl;\r
+ __pInputMethodManagerImpl = null;\r
+\r
+ return null;\r
+}\r
+\r
+InputMethodInfo*\r
+_InputMethodManagerImpl::GetInputMethodInfoN(const char* pAppRootPath)\r
+{\r
+ SysLog(NID_UI_IME, "The root path of the application is %s.", pAppRootPath);\r
+\r
+ result r = E_SUCCESS;\r
+\r
+ // declare variables\r
+ xmlDocPtr pXmlDoc = null;\r
+ xmlNodePtr pXmlRootElement = null;\r
+ InputMethodInfo* pInputMethodInfo = null;\r
+\r
+ // get the manifest file path\r
+ const char* MANIFEST_FILE_PATH = "/info/manifest.xml";\r
+\r
+ int length = strlen(pAppRootPath) + strlen(MANIFEST_FILE_PATH) + 1;\r
+ char manifestFilePath[length];\r
+ memset(manifestFilePath, '\0', length);\r
+\r
+ strncpy(manifestFilePath, pAppRootPath, strlen(pAppRootPath));\r
+ strcat(manifestFilePath, MANIFEST_FILE_PATH);\r
+\r
+ // get InputMethodInfo\r
+ pXmlDoc = xmlParseFile(manifestFilePath);\r
+ SysTryReturn(NID_UI_IME, pXmlDoc, null, E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
+\r
+ pXmlRootElement = xmlDocGetRootElement(pXmlDoc);\r
+ SysTryCatch(NID_UI_IME, pXmlRootElement, , E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
+\r
+ pInputMethodInfo = new(std::nothrow) InputMethodInfo();\r
+ SysTryCatch(NID_UI_IME, pInputMethodInfo, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = ParseInputMethodInfo(pXmlRootElement, pInputMethodInfo);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ if (pXmlDoc)\r
+ {\r
+ xmlFreeDoc(pXmlDoc);\r
+ pXmlDoc = null;\r
+ }\r
+\r
+ xmlCleanupParser();\r
+\r
+ return pInputMethodInfo;\r
+\r
+CATCH:\r
+ if (pXmlDoc)\r
+ {\r
+ xmlFreeDoc(pXmlDoc);\r
+ pXmlDoc = null;\r
+ }\r
+\r
+ xmlCleanupParser();\r
+\r
+ delete pInputMethodInfo;\r
+\r
+ return null;\r
+}\r
+\r
+result\r
+_InputMethodManagerImpl::ParseInputMethodInfo(const xmlNodePtr pXmlRootElement, InputMethodInfo* pInfo)\r
+{\r
+ SysTryReturnResult(NID_UI_IME, pXmlRootElement && pInfo, E_INVALID_ARG, "Invalid argument(s) is used. The pXmlRootElement or the pInfo is null.");\r
+\r
+ result r = E_SUCCESS;\r
+\r
+ _InputMethodInfoImpl* pInputMethodInfoImpl = _InputMethodInfoImpl::GetInstance(*pInfo);\r
+\r
+ xmlNodePtr pItorNode = null;\r
+\r
+ for (pItorNode = pXmlRootElement; pItorNode != null; pItorNode = pItorNode->next)\r
+ {\r
+ if (pItorNode->type == XML_ELEMENT_NODE)\r
+ {\r
+ if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("Id")))\r
+ {\r
+ xmlChar* pXmlChar = xmlNodeGetContent(pItorNode);\r
+ if (pXmlChar)\r
+ {\r
+ pInputMethodInfoImpl->SetAppId(reinterpret_cast<char*>(pXmlChar));\r
+ SysLog(NID_UI_IME, "The package ID is %s.", reinterpret_cast<char*>(pXmlChar));\r
+ xmlFree(pXmlChar);\r
+ }\r
+ }\r
+ else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("Uuid")))\r
+ {\r
+ xmlChar* pXmlChar = xmlNodeGetContent(pItorNode);\r
+ if (pXmlChar)\r
+ {\r
+ pInputMethodInfoImpl->SetUuid(reinterpret_cast<char*>(pXmlChar));\r
+ SysLog(NID_UI_IME, "The UUID is %s.", reinterpret_cast<char*>(pXmlChar));\r
+ xmlFree(pXmlChar);\r
+ }\r
+ }\r
+ else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("DisplayName")))\r
+ {\r
+ xmlChar* pXmlChar = xmlNodeGetContent(pItorNode);\r
+ if (pXmlChar)\r
+ {\r
+ AppId appId = pInputMethodInfoImpl->GetAppId();\r
+ appId += String(".");\r
+ appId += String(reinterpret_cast<char*>(pXmlChar));\r
+ pInputMethodInfoImpl->SetAppId(appId);\r
+\r
+ pInputMethodInfoImpl->SetName(String(reinterpret_cast<char*>(pXmlChar)));\r
+ SysLog(NID_UI_IME, "The name is %s.", reinterpret_cast<char*>(pXmlChar));\r
+ xmlFree(pXmlChar);\r
+ }\r
+ }\r
+ else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("Language")))\r
+ {\r
+ xmlChar* pXmlChar = xmlNodeGetContent(pItorNode);\r
+ if (pXmlChar)\r
+ {\r
+ pInputMethodInfoImpl->AddLanguage(reinterpret_cast<char*>(pXmlChar));\r
+ SysLog(NID_UI_IME, "The language is %s.", reinterpret_cast<char*>(pXmlChar));\r
+ xmlFree(pXmlChar);\r
+ }\r
+ }\r
+\r
+ if (pItorNode->children)\r
+ {\r
+ ParseInputMethodInfo(pItorNode->children, pInfo);\r
+ }\r
+ }\r
+ }\r
+\r
+ return r;\r
+}\r
+\r
+int\r
+_InputMethodManagerImpl::PackageManagerAppIdHandler(pkgmgrinfo_appinfo_h handle, void* pUserData)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ char* appId = NULL;\r
+ pkgmgrinfo_appinfo_get_appid(handle, &appId);\r
+\r
+ ArrayList* pInputMethodAppIdList = null;\r
+\r
+ AppId* pAppId = new(std::nothrow) AppId(appId);\r
+ SysTryReturn(NID_UI_IME, pAppId, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ pInputMethodAppIdList = static_cast<ArrayList*>(__pInputMethodManagerImpl->GetInputMethodAppIdList());\r
+ r = pInputMethodAppIdList->Add(pAppId);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ SysLog(NID_UI_IME, "The application ID of the input method installed in the system is %s.", appId);\r
+\r
+ return 0;\r
+\r
+CATCH:\r
+ delete pAppId;\r
+ \r
+ return 0;\r
+}\r
+\r
+InputMethodInfo*\r
+_InputMethodManagerImpl::GetCurrentInputMethodInfoN(void) const\r
+{\r
+ InputMethodInfo* pInputMethodInfo = null;\r
+\r
+ int length = -1;\r
+ char* pUuid = null;\r
+ length = scim::isf_control_get_active_ise(&pUuid);\r
+ SysTryReturn(NID_UI_IME, (length != -1) && pUuid, null, E_SYSTEM,\r
+ "[E_SYSTEM] A failure occurs from the underlying system. The uuid length of the current input method is %d", length);\r
+\r
+ // need to implement\r
+\r
+ free(pUuid);\r
+\r
+ return pInputMethodInfo;\r
+}\r
+\r
+IList*\r
+_InputMethodManagerImpl::GetInputMethodAppIdList(void) const\r
+{\r
+ return __pInputMethodAppIdList;\r
+}\r
+\r
+IList*\r
+_InputMethodManagerImpl::GetInputMethodInfoListN(void) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ int ospImeCount = 0;\r
+\r
+ ArrayList* pInputMethodInfoList = null;\r
+ InputMethodInfo* pInputMethodInfo = null;\r
+ _InputMethodInfoImpl* pInputMethodInfoImpl = null;\r
+\r
+ char* pAppRootPath = null;\r
+\r
+ // get preloaded IME info\r
+ char** dpList = null;\r
+ int preloadedImeCount = scim::isf_control_get_ise_list(&dpList);\r
+ SysTryReturn(NID_UI_IME, (dpList != null) && (preloadedImeCount > 0), null, E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
+\r
+ int ret = -1;\r
+ char* pName = null;\r
+ char* pLanguage = null;\r
+ scim::ISE_TYPE_T type;\r
+ int option = 0;\r
+\r
+ int preloadedImeIndex = -1;\r
+\r
+ for (int i = 0; i < preloadedImeCount; i++)\r
+ {\r
+ if (!strcmp(dpList[i], PRELOADED_IME_UUID))\r
+ {\r
+ ret = scim::isf_control_get_ise_info(dpList[i], &pName, &pLanguage, type, option);\r
+ SysTryCatch(NID_UI_IME, ret == 0, , E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
+\r
+ preloadedImeCount = 1;\r
+ preloadedImeIndex = i;\r
+ break;\r
+ }\r
+ }\r
+\r
+ // get osp IME info\r
+ r = RequestInputMethodAppIdList();\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ ospImeCount = __pInputMethodAppIdList->GetCount();\r
+\r
+ // make a InputMethodInfo list\r
+ pInputMethodInfoList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
+ SysTryCatch(NID_UI_IME, pInputMethodInfoList, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = pInputMethodInfoList->Construct(preloadedImeCount + ospImeCount);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ // add preloaded IME info\r
+ pInputMethodInfo = new(std::nothrow) InputMethodInfo();\r
+ SysTryCatch(NID_UI_IME, pInputMethodInfo, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ pInputMethodInfoImpl = _InputMethodInfoImpl::GetInstance(*pInputMethodInfo);\r
+ r = GetLastResult();\r
+ SysTryCatch(NID_UI_IME, pInputMethodInfoImpl, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ pInputMethodInfoImpl->SetAppId(PRELOADED_IME_APPID);\r
+ pInputMethodInfoImpl->SetUuid(dpList[preloadedImeIndex]);\r
+ pInputMethodInfoImpl->SetName(String(pName));\r
+ pInputMethodInfoImpl->AddLanguage(PRELOADED_IME_LANGUAGE);\r
+\r
+ SysLog(NID_UI_IME, "The UUID of the preloaded IME application is %s.", dpList[preloadedImeIndex]);\r
+\r
+ r = pInputMethodInfoList->Add(pInputMethodInfo);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+ pInputMethodInfo = null;\r
+\r
+ free(dpList);\r
+ free(pName);\r
+ free(pLanguage);\r
+\r
+ // add osp IME info\r
+ for (int i = 0; i < ospImeCount; i++)\r
+ {\r
+ AppId* pAppId = static_cast<AppId*>(__pInputMethodAppIdList->GetAt(i));\r
+ r = GetLastResult();\r
+ SysTryCatch(NID_UI_IME, pAppId, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ String appRootPath;\r
+ r = _AppManagerImpl::GetAppRootPath(*pAppId, appRootPath);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ pAppRootPath = _StringConverter::CopyToCharArrayN(appRootPath.GetPointer());\r
+ r = GetLastResult();\r
+ SysTryCatch(NID_UI_IME, pAppRootPath, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ pInputMethodInfo = GetInputMethodInfoN(pAppRootPath);\r
+ r = GetLastResult();\r
+ SysTryCatch(NID_UI_IME, pInputMethodInfo, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ r = pInputMethodInfoList->Add(pInputMethodInfo);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ delete[] pAppRootPath;\r
+ }\r
+\r
+ return pInputMethodInfoList;\r
+\r
+CATCH:\r
+ free(dpList);\r
+ free(pName);\r
+ free(pLanguage);\r
+\r
+ delete pInputMethodInfoList;\r
+ delete pInputMethodInfo;\r
+ delete[] pAppRootPath;\r
+\r
+ return null;\r
+}\r
+\r
+result\r
+_InputMethodManagerImpl::SetInputMethod(AppId id)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ std::unique_ptr<char[]> pLog(_StringConverter::CopyToCharArrayN(id.GetPointer()));\r
+ SysLog(NID_UI_IME, "The application ID is %s.", pLog.get());\r
+\r
+ if (id == PRELOADED_IME_APPID)\r
+ {\r
+ char** dpList = null;\r
+ int preloadedImeCount = scim::isf_control_get_ise_list(&dpList);\r
+ SysTryReturnResult(NID_UI_IME, (dpList != null) && (preloadedImeCount > 0), E_SYSTEM, "A failure occurs from the underlying system.");\r
+\r
+ for (int i = 0; i < preloadedImeCount; i++)\r
+ {\r
+ if (!strcmp(dpList[i], PRELOADED_IME_UUID))\r
+ {\r
+ scim::isf_control_set_active_ise_by_uuid(dpList[i]);\r
+ break;\r
+ }\r
+ }\r
+\r
+ free(dpList);\r
+\r
+ return r;\r
+ }\r
+\r
+ String appRootPath;\r
+ char* pAppRootPath = null;\r
+ InputMethodInfo* pInputMethodInfo = null;\r
+ _InputMethodInfoImpl* pInputMethodInfoImpl = null;\r
+\r
+ r = _AppManagerImpl::GetAppRootPath(id, appRootPath);\r
+ SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, r, "Propagating.");\r
+\r
+ pAppRootPath = _StringConverter::CopyToCharArrayN(appRootPath.GetPointer());\r
+ r = GetLastResult();\r
+ SysTryReturnResult(NID_UI_IME, pAppRootPath, r, "Propagating.");\r
+\r
+ pInputMethodInfo = GetInputMethodInfoN(pAppRootPath);\r
+ r = GetLastResult();\r
+ SysTryCatch(NID_UI_IME, pInputMethodInfo, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ pInputMethodInfoImpl = _InputMethodInfoImpl::GetInstance(*pInputMethodInfo);\r
+ scim::isf_control_set_active_ise_by_uuid(pInputMethodInfoImpl->GetUuid());\r
+\r
+ // Fall through\r
+CATCH:\r
+ delete[] pAppRootPath;\r
+ delete pInputMethodInfo;\r
+\r
+ return r;\r
+}\r
+\r
+IList*\r
+_InputMethodManagerImpl::GetInputMethodLanguageListN(const char* pLanguageList) const\r
+{\r
+ SysTryReturn(NID_UI_IME, pLanguageList, null, E_INVALID_ARG, "Invalid argument(s) is used. The pLanguageList is null.");\r
+\r
+ result r = E_SUCCESS;\r
+\r
+ const char* pItor = pLanguageList;\r
+\r
+ const int ISO_639_1_CODE_LENGTH = 5;\r
+ char arrayLanguage[ISO_639_1_CODE_LENGTH + 1];\r
+ memset(arrayLanguage, '\0', sizeof(arrayLanguage));\r
+\r
+ const int LANGUAGE_CODE_LENGTH = 2;\r
+ char arrayLanguageCode[LANGUAGE_CODE_LENGTH + 1];\r
+ memset(arrayLanguageCode, '\0', sizeof(arrayLanguageCode));\r
+\r
+ const int COUNTRY_CODE_LENGTH = 2;\r
+ char arrayCountryCode[COUNTRY_CODE_LENGTH + 1];\r
+ memset(arrayCountryCode, '\0', sizeof(arrayCountryCode));\r
+\r
+ Locale* pLanguage = null;\r
+\r
+ ArrayList* pInputMethodLanguageList = new(std::nothrow) ArrayList(SingleObjectDeleter);\r
+ SysTryReturn(NID_UI_IME, pInputMethodLanguageList, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = pInputMethodLanguageList->Construct();\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ while ( pItor != null)\r
+ {\r
+ strncpy(arrayLanguage, pItor, ISO_639_1_CODE_LENGTH);\r
+\r
+ strncpy(arrayLanguageCode, arrayLanguage, LANGUAGE_CODE_LENGTH);\r
+ strncpy(arrayCountryCode, arrayLanguage + LANGUAGE_CODE_LENGTH + 1, COUNTRY_CODE_LENGTH);\r
+\r
+ LanguageCode languageCode = Locale::TwoLetterLanguageCodeStringToLanguageCode(String(arrayLanguageCode));\r
+ r = GetLastResult();\r
+ SysTryCatch(NID_UI_IME, languageCode < LANGUAGE_MAX, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ CountryCode countryCode = Locale::StringToCountryCode(String(arrayCountryCode));\r
+ r = GetLastResult();\r
+ SysTryCatch(NID_UI_IME, countryCode < COUNTRY_MAX, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+\r
+ pLanguage = new(std::nothrow) Locale(languageCode, countryCode);\r
+ SysTryCatch(NID_UI_IME, pLanguage, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ r = pInputMethodLanguageList->Add(pLanguage);\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+ pLanguage = null;\r
+\r
+ memset(arrayLanguage, '\0', sizeof(arrayLanguage));\r
+ memset(arrayLanguageCode, '\0', sizeof(arrayLanguageCode));\r
+ memset(arrayCountryCode, '\0', sizeof(arrayCountryCode));\r
+\r
+ int ch = ',';\r
+ pItor = strchr(pItor, ch);\r
+ if (pItor)\r
+ {\r
+ pItor++;\r
+ }\r
+ }\r
+\r
+ return pInputMethodLanguageList;\r
+\r
+CATCH:\r
+ delete pLanguage;\r
+ delete pInputMethodLanguageList;\r
+\r
+ return null;\r
+}\r
+\r
+result\r
+_InputMethodManagerImpl::RequestInputMethodAppIdList(void) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __pInputMethodAppIdList->RemoveAll();\r
+\r
+ int ret = 0;\r
+ pkgmgrinfo_appinfo_filter_h handle;\r
+ ret = pkgmgrinfo_appinfo_filter_create(&handle);\r
+ SysTryReturnResult(NID_UI_IME, ret == PMINFO_R_OK, E_SYSTEM, "A failure occurs from the underlying system.");\r
+\r
+ ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/ime");\r
+ SysTryCatch(NID_UI_IME, ret == PMINFO_R_OK, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
+\r
+ ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, PackageManagerAppIdHandler, NULL);\r
+ SysTryCatch(NID_UI_IME, ret == PMINFO_R_OK, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A failure occurs from the underlying system.");\r
+\r
+ // Fall through\r
+CATCH:\r
+ pkgmgrinfo_appinfo_filter_destroy(handle);\r
+\r
+ return r;\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_InputMethodManagerImpl.h\r
+ * @brief This is the header file for the %_InputMethodManagerImpl class.\r
+ *\r
+ * This header file contains the declarations of the %_InputMethodManagerImpl class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INTERNAL_INPUT_METHOD_MANAGER_IMPL_H_\r
+#define _FUI_IME_INTERNAL_INPUT_METHOD_MANAGER_IMPL_H_\r
+\r
+#include <libxml/tree.h>\r
+#include <pkgmgr-info.h>\r
+\r
+#include <FAppTypes.h>\r
+#include <FBaseColIList.h>\r
+#include <FBaseDataType.h>\r
+#include <FBaseObject.h>\r
+#include <FUiImeInputMethodInfo.h>\r
+#include <FUiImeInputMethodManager.h>\r
+\r
+namespace Tizen { namespace Base { namespace Collection {\r
+\r
+class ArrayList;\r
+\r
+}}} // Tizen::Base::Collection\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+/**\r
+* @class _InputMethodManagerImpl\r
+* @brief This class is a concrete class of the %_InputMethodManagerImpl class.\r
+* @since 2.0\r
+*\r
+*/\r
+class _InputMethodManagerImpl\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ virtual ~_InputMethodManagerImpl(void);\r
+\r
+ static _InputMethodManagerImpl* GetInstance(InputMethodManager& inputMethodManager);\r
+\r
+ static InputMethodInfo* GetInputMethodInfoN(const char* pAppRootPath);\r
+ static result ParseInputMethodInfo(const xmlNodePtr pXmlRootElement, InputMethodInfo* pInfo);\r
+ static int PackageManagerAppIdHandler(pkgmgrinfo_appinfo_h handle, void* pUserData);\r
+\r
+ InputMethodInfo* GetCurrentInputMethodInfoN(void) const;\r
+ Tizen::Base::Collection::IList* GetInputMethodAppIdList(void) const;\r
+ Tizen::Base::Collection::IList* GetInputMethodInfoListN(void) const;\r
+\r
+ result SetInputMethod(Tizen::App::AppId id);\r
+\r
+private:\r
+ _InputMethodManagerImpl(void);\r
+\r
+ _InputMethodManagerImpl(const _InputMethodManagerImpl& rhs);\r
+ _InputMethodManagerImpl& operator=(const _InputMethodManagerImpl& rhs);\r
+\r
+ result Construct(void);\r
+\r
+ Tizen::Base::Collection::IList* GetInputMethodLanguageListN(const char* pLanguageList) const;\r
+ result RequestInputMethodAppIdList(void) const;\r
+\r
+private:\r
+ static _InputMethodManagerImpl* __pInputMethodManagerImpl;\r
+\r
+ InputMethodManager* __pInputMethodManager;\r
+ Tizen::Base::Collection::ArrayList* __pInputMethodAppIdList;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INTERNAL_INPUT_METHOD_MANAGER_IMPL_H_\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_InputServiceBinder.cpp\r
+ * @brief This is the implementation file for the %_InputServiceBinder class.\r
+ *\r
+ * This implementation file contains definition of the %_InputServiceBinder class.\r
+ */\r
+\r
+#include <new>\r
+\r
+#include <FBaseSysLog.h>\r
+\r
+#include "FUiIme_ImeInfo.h"\r
+#include "FUiIme_InputServiceBinder.h"\r
+#include "FUiIme_ScimDataConverter.h"\r
+\r
+using namespace Tizen::Base;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+_InputServiceBinder* _InputServiceBinder::__pInputServiceBinder = null;\r
+\r
+_InputServiceBinder::_InputServiceBinder(void)\r
+ :__pHelperAgent(null)\r
+ ,__pScimDataConverter(null)\r
+{\r
+}\r
+\r
+_InputServiceBinder::~_InputServiceBinder(void)\r
+{\r
+ if (IsBound() == true)\r
+ {\r
+ Unbind();\r
+ }\r
+\r
+ delete __pHelperAgent;\r
+ __pHelperAgent = null;\r
+\r
+ delete __pScimDataConverter;\r
+ __pScimDataConverter = null;\r
+}\r
+\r
+result\r
+_InputServiceBinder::Construct(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ __pHelperAgent = new(std::nothrow) scim::HelperAgent();\r
+ SysTryReturnResult(NID_UI_IME, __pHelperAgent, E_OUT_OF_MEMORY, "Memory allocation failed.");\r
+\r
+ __pScimDataConverter = new(std::nothrow) _ScimDataConverter();\r
+ SysTryCatch(NID_UI_IME, __pScimDataConverter, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+\r
+ return r;\r
+\r
+CATCH:\r
+ delete __pHelperAgent;\r
+ __pHelperAgent = null;\r
+\r
+ return r;\r
+}\r
+\r
+_InputServiceBinder*\r
+_InputServiceBinder::GetInstance(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ if (!__pInputServiceBinder)\r
+ {\r
+ __pInputServiceBinder = new(std::nothrow) _InputServiceBinder();\r
+ SysTryReturn(NID_UI_IME, __pInputServiceBinder, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");\r
+ \r
+ r = __pInputServiceBinder->Construct();\r
+ SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+\r
+ return __pInputServiceBinder;\r
+\r
+CATCH:\r
+ delete __pInputServiceBinder;\r
+ __pInputServiceBinder = null;\r
+\r
+ return null;\r
+}\r
+\r
+scim::HelperAgent*\r
+_InputServiceBinder::GetHelperAgent(void) const\r
+{\r
+ return __pHelperAgent;\r
+}\r
+\r
+BindingId\r
+_InputServiceBinder::Bind(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ int bindingId = -1;\r
+\r
+ _ImeInfo* pImeInfo = _ImeInfo::GetInstance();\r
+\r
+ scim::String uuid = pImeInfo->GetUuid();\r
+ scim::String name = pImeInfo->GetName();\r
+\r
+ scim::HelperInfo helperInfo(uuid, name, "", "",\r
+ scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO | scim::SCIM_HELPER_AUTO_RESTART);\r
+\r
+ if (IsBound() == true)\r
+ {\r
+ r = Unbind();\r
+ SysTryReturn(NID_UI_IME, r == E_SUCCESS, -1, r, "[%s] Propagating.", GetErrorMessage(r));\r
+ }\r
+\r
+ bindingId = __pHelperAgent->open_connection(helperInfo, ":0");\r
+ SysTryReturn(NID_UI_IME, bindingId > -1, bindingId, E_CONNECTION_FAILED, "[E_CONNECTION_FAILED] The connection to the specific destination fails.");\r
+\r
+ SysLog(NID_UI_IME, "The binding ID is %d.", bindingId);\r
+\r
+ return bindingId;\r
+}\r
+\r
+result\r
+_InputServiceBinder::Unbind(void)\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ SysTryReturnResult(NID_UI_IME, IsBound() == true, E_HOST_NOT_FOUND, "The destination host is not found.");\r
+\r
+ __pHelperAgent->close_connection();\r
+\r
+ return r;\r
+}\r
+\r
+bool\r
+_InputServiceBinder::IsBound(void) const\r
+{\r
+ return __pHelperAgent->is_connected();\r
+}\r
+\r
+BindingId\r
+_InputServiceBinder::GetBindingId(void) const\r
+{\r
+ int bindingId = __pHelperAgent->get_connection_number();\r
+ SysTryReturn(NID_UI_IME, bindingId > -1, bindingId, E_HOST_NOT_FOUND, "[E_HOST_NOT_FOUND] The destination host is not found.");\r
+\r
+ return bindingId;\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_InputServiceBinder.h\r
+ * @brief This is the header file for the %_InputServiceBinder class.\r
+ *\r
+ * This header file contains the declarations of the %_InputServiceBinder class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INTERNAL_INPUT_SERVICE_BINDER_H_\r
+#define _FUI_IME_INTERNAL_INPUT_SERVICE_BINDER_H_\r
+\r
+#define Uses_SCIM_HELPER\r
+#define Uses_SCIM_TYPES\r
+#undef null\r
+#include <scim.h>\r
+#define null 0\r
+\r
+#include <FBaseDataType.h>\r
+#include <FBaseObject.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+class _ScimDataConverter;\r
+\r
+/**\r
+ * ID of a binding with the input service\r
+ *\r
+ * @since 2.0\r
+ */\r
+typedef int BindingId;\r
+\r
+/**\r
+* @class _InputServiceBinder\r
+* @brief This class is a concrete class of the %_InputServiceBinder class.\r
+* @since 2.0\r
+*\r
+*/\r
+class _InputServiceBinder\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ virtual ~_InputServiceBinder(void);\r
+\r
+ static _InputServiceBinder* GetInstance(void);\r
+\r
+ scim::HelperAgent* GetHelperAgent(void) const;\r
+\r
+ BindingId Bind(void);\r
+ result Unbind(void);\r
+ bool IsBound(void) const;\r
+ BindingId GetBindingId(void) const;\r
+\r
+private:\r
+ _InputServiceBinder(void);\r
+\r
+ _InputServiceBinder(const _InputServiceBinder& rhs);\r
+ _InputServiceBinder& operator=(const _InputServiceBinder& rhs);\r
+\r
+ result Construct(void);\r
+\r
+private:\r
+ static _InputServiceBinder* __pInputServiceBinder;\r
+\r
+ scim::HelperAgent* __pHelperAgent;\r
+ _ScimDataConverter* __pScimDataConverter;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INTERNAL_INPUT_SERVICE_BINDER_H_\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_InputServiceSignalListener.cpp\r
+ * @brief This is the implementation file for the %_InputServiceSignalListener class.\r
+ *\r
+ * This implementation file contains definition of the %_InputServiceSignalListener class.\r
+ */\r
+\r
+#include <Ecore_IMF.h>\r
+\r
+#include <FAppApp.h>\r
+#include <FBaseString.h>\r
+#include <FBaseSysLog.h>\r
+#include <FGrpRectangle.h>\r
+#include <FUiInputConnectionTypes.h>\r
+\r
+#include "FUiIme_InputMethodImpl.h"\r
+#include "FUiIme_InputServiceSignalListener.h"\r
+#include "FUiIme_ScimDataConverter.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Graphics;\r
+using namespace Tizen::Ui;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+IInputMethodProvider* _InputServiceSignalListener::__pIInputMethodProvider = null;\r
+IInputMethodListener* _InputServiceSignalListener::__pIInputMethodListener = null;\r
+\r
+_InputServiceSignalListener::_InputServiceSignalListener()\r
+{\r
+}\r
+\r
+_InputServiceSignalListener::~_InputServiceSignalListener()\r
+{\r
+ __pIInputMethodProvider = null;\r
+ __pIInputMethodListener = null;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::SetInputMethodProvider(IInputMethodProvider* pProvider)\r
+{\r
+ __pIInputMethodProvider = pProvider;\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::SetInputMethodListener(IInputMethodListener* pListener)\r
+{\r
+ __pIInputMethodListener = pListener;\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::GetEnterKeyAction(const scim::HelperAgent* pHelperAgent, scim::uint32& action)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ InputPanelAction inputPanelAction = __pIInputMethodProvider->GetEnterKeyAction();\r
+ SysTryReturnVoidResult(NID_UI_IME, (inputPanelAction >= INPUT_PANEL_ACTION_ENTER) && (inputPanelAction <= INPUT_PANEL_ACTION_DONE), E_INVALID_DATA, "[E_INVALID_DATA] A requested data is invalid.");\r
+\r
+ switch (inputPanelAction)\r
+ {\r
+ case INPUT_PANEL_ACTION_ENTER:\r
+ action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;\r
+ break;\r
+ case INPUT_PANEL_ACTION_DONE:\r
+ action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE;\r
+ break;\r
+ case INPUT_PANEL_ACTION_GO:\r
+ action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO;\r
+ break;\r
+ case INPUT_PANEL_ACTION_JOIN:\r
+ action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN;\r
+ break;\r
+ case INPUT_PANEL_ACTION_LOGIN:\r
+ action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN;\r
+ break;\r
+ case INPUT_PANEL_ACTION_NEXT:\r
+ action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT;\r
+ break;\r
+ case INPUT_PANEL_ACTION_SEARCH:\r
+ action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH;\r
+ break;\r
+ case INPUT_PANEL_ACTION_SEND:\r
+ action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND;\r
+ break;\r
+ default:\r
+ action = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT;\r
+ break;\r
+ }\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::GetInputPanelBounds(const scim::HelperAgent* pHelperAgent, struct scim::rectinfo& bounds)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ SysLog(NID_UI_IME, "The bounds of the input panel have been requested.");\r
+\r
+ Rectangle inputPanelBounds = __pIInputMethodProvider->GetInputPanelBounds();\r
+\r
+ _ScimDataConverter converter;\r
+ converter.ConvertRectangle(inputPanelBounds, bounds);\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::GetInputPanelStyle(const scim::HelperAgent* pHelperAgent, scim::uint32& style)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ InputPanelStyle inputPanelStyle = __pIInputMethodProvider->GetInputPanelStyle();\r
+ SysTryReturnVoidResult(NID_UI_IME, (inputPanelStyle >= INPUT_PANEL_STYLE_NORMAL) && (inputPanelStyle <= INPUT_PANEL_STYLE_IP), E_INVALID_DATA, "[E_INVALID_DATA] A requested data is invalid.");\r
+\r
+ switch (inputPanelStyle)\r
+ {\r
+ case INPUT_PANEL_STYLE_NORMAL:\r
+ style = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;\r
+ break;\r
+ case INPUT_PANEL_STYLE_EMAIL:\r
+ style = ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL;\r
+ break;\r
+ case INPUT_PANEL_STYLE_IP:\r
+ style = ECORE_IMF_INPUT_PANEL_LAYOUT_IP;\r
+ break;\r
+ case INPUT_PANEL_STYLE_NUMBER:\r
+ style = ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY;\r
+ break;\r
+ case INPUT_PANEL_STYLE_PHONE_NUMBER:\r
+ style = ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER;\r
+ break;\r
+ case INPUT_PANEL_STYLE_URL:\r
+ style = ECORE_IMF_INPUT_PANEL_LAYOUT_URL;\r
+ break;\r
+ default:\r
+ style = ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL;\r
+ break;\r
+ } \r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::SetCapsModeEnabled(const scim::HelperAgent* pHelperAgent, scim::uint32& mode)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ bool enable = (mode != 0 ? true : false);\r
+\r
+ __pIInputMethodProvider->SetCapsModeEnabled(enable);\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::SetEnterKeyAction(const scim::HelperAgent* pHelperAgent, scim::uint32& action)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+ SysTryReturnVoidResult(NID_UI_IME, action <= ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND, E_INVALID_ARG,\r
+ "[E_INVALID_ARG] Invalid argument(s) is used. The enter key action is beyond the scope.");\r
+\r
+ InputPanelAction inputPanelAction;\r
+\r
+ switch (action)\r
+ {\r
+ case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT:\r
+ inputPanelAction = INPUT_PANEL_ACTION_ENTER;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE:\r
+ inputPanelAction = INPUT_PANEL_ACTION_DONE;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_GO:\r
+ inputPanelAction = INPUT_PANEL_ACTION_GO;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_JOIN:\r
+ inputPanelAction = INPUT_PANEL_ACTION_JOIN;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_LOGIN:\r
+ inputPanelAction = INPUT_PANEL_ACTION_LOGIN;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT:\r
+ inputPanelAction = INPUT_PANEL_ACTION_NEXT;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEARCH:\r
+ inputPanelAction = INPUT_PANEL_ACTION_SEARCH;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_SEND:\r
+ inputPanelAction = INPUT_PANEL_ACTION_SEND;\r
+ break;\r
+ default:\r
+ inputPanelAction = INPUT_PANEL_ACTION_ENTER;\r
+ break;\r
+ }\r
+\r
+ __pIInputMethodProvider->SetEnterKeyAction(inputPanelAction);\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::SetEnterKeyActionEnabled(const scim::HelperAgent* pHelperAgent, scim::uint32& disable)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ bool enable = (disable != 0 ? false : true);\r
+\r
+ __pIInputMethodProvider->SetEnterKeyActionEnabled(enable);\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::SetInputPanelStyle(const scim::HelperAgent* pHelperAgent, scim::uint32& style)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+ SysTryReturnVoidResult(NID_UI_IME, style < ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID, E_INVALID_ARG,\r
+ "[E_INVALID_ARG] Invalid argument(s) is used. The input panel style is beyond the scope.");\r
+\r
+ InputPanelStyle inputPanelStyle;\r
+\r
+ switch (style)\r
+ {\r
+ case ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL:\r
+ inputPanelStyle = INPUT_PANEL_STYLE_NORMAL;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL:\r
+ inputPanelStyle = INPUT_PANEL_STYLE_EMAIL;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_LAYOUT_IP:\r
+ inputPanelStyle = INPUT_PANEL_STYLE_IP;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY:\r
+ inputPanelStyle = INPUT_PANEL_STYLE_NUMBER;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER:\r
+ inputPanelStyle = INPUT_PANEL_STYLE_PHONE_NUMBER;\r
+ break;\r
+ case ECORE_IMF_INPUT_PANEL_LAYOUT_URL:\r
+ inputPanelStyle = INPUT_PANEL_STYLE_URL;\r
+ break;\r
+ default:\r
+ inputPanelStyle = INPUT_PANEL_STYLE_NORMAL;\r
+ break;\r
+ } \r
+\r
+ __pIInputMethodProvider->SetInputPanelStyle(inputPanelStyle);\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::SetLanguage(const scim::HelperAgent* pHelperAgent, scim::uint32& language)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ Tizen::Locales::LanguageCode languageCode = (language == ECORE_IMF_INPUT_PANEL_LANG_ALPHABET ? Tizen::Locales::LANGUAGE_ENG : Tizen::Locales::LANGUAGE_INVALID);\r
+\r
+ if (languageCode == Tizen::Locales::LANGUAGE_INVALID)\r
+ {\r
+ return;\r
+ }\r
+\r
+ //__pIInputMethodProvider->SetLanguage(languageCode);\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::HideInputPanel(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ SysLog(NID_UI_IME, "Hiding the input panel has been requested.");\r
+\r
+ __pIInputMethodProvider->HideInputPanel();\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::IsEnterKeyActionEnabled(const scim::HelperAgent* pHelperAgent, scim::uint32& enable)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ enable = static_cast<scim::uint32>(__pIInputMethodProvider->IsEnterKeyActionEnabled());\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::ShowInputPanel(const scim::HelperAgent* pHelperAgent, int inputContext, char* pBuffer, size_t& length)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodProvider, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ SysLog(NID_UI_IME, "Showing the input panel has been requested.");\r
+\r
+ __pIInputMethodProvider->ShowInputPanel();\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::OnCursorPositionChanged(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid, int position)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodListener, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ __pIInputMethodListener->OnCursorPositionChanged(position);\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::OnSurroundingTextReceived(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& text, int cursorPosition)\r
+{\r
+ SysTryReturnVoidResult(NID_UI_IME, __pIInputMethodListener, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The required instance does not exist.");\r
+\r
+ String ospText;\r
+\r
+ _ScimDataConverter converter;\r
+ converter.ConvertString(text, ospText);\r
+\r
+ __pIInputMethodListener->OnSurroundingTextReceived(ospText, cursorPosition);\r
+\r
+ return;\r
+}\r
+\r
+void\r
+_InputServiceSignalListener::OnTerminate (const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid)\r
+{\r
+ Tizen::App::App::GetInstance()->Terminate();\r
+\r
+ return;\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_InputServiceSignalListener.h\r
+ * @brief This is the header file for the %_InputServiceSignalListener class.\r
+ *\r
+ * This header file contains the declarations of the %_InputServiceSignalListener class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INPUT_SERVICE_SIGNAL_LISTENER_H_\r
+#define _FUI_IME_INPUT_SERVICE_SIGNAL_LISTENER_H_\r
+\r
+#define Uses_SCIM_HELPER\r
+#define Uses_SCIM_TYPES\r
+#undef null\r
+#include <scim.h>\r
+#define null 0\r
+\r
+#include <FBaseObject.h>\r
+#include <FUiImeIInputMethodListener.h>\r
+#include <FUiImeIInputMethodProvider.h>\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+/**\r
+* @class _InputServiceSignalListener\r
+* @brief This class is a concrete class of the %_InputServiceSignalListener class.\r
+* @since 2.0\r
+*\r
+*/\r
+class _InputServiceSignalListener\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ _InputServiceSignalListener();\r
+ virtual ~_InputServiceSignalListener();\r
+\r
+ void SetInputMethodProvider(IInputMethodProvider* pProvider);\r
+ void SetInputMethodListener(IInputMethodListener* pListener);\r
+\r
+ static void GetEnterKeyAction(const scim::HelperAgent* pHelperAgent, scim::uint32& action);\r
+ static void GetInputPanelBounds(const scim::HelperAgent* pHelperAgent, scim::rectinfo& bounds);\r
+ static void GetInputPanelStyle(const scim::HelperAgent* pHelperAgent, scim::uint32& style);\r
+\r
+ static void SetCapsModeEnabled(const scim::HelperAgent* pHelperAgent, scim::uint32& mode);\r
+ static void SetEnterKeyAction(const scim::HelperAgent* pHelperAgent, scim::uint32& action);\r
+ static void SetEnterKeyActionEnabled(const scim::HelperAgent* pHelperAgent, scim::uint32& disable);\r
+ static void SetInputPanelStyle(const scim::HelperAgent* pHelperAgent, scim::uint32& style);\r
+ static void SetLanguage(const scim::HelperAgent* pHelperAgent, scim::uint32& language);\r
+\r
+ static void HideInputPanel(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid);\r
+ static void IsEnterKeyActionEnabled(const scim::HelperAgent* pHelperAgent, scim::uint32& enable);\r
+ static void ShowInputPanel(const scim::HelperAgent* pHelperAgent, int inputContext, char* pBuffer, size_t& length);\r
+\r
+ static void OnCursorPositionChanged(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid,\r
+ int position);\r
+ static void OnSurroundingTextReceived(const scim::HelperAgent* pHelperAgent, int inputContext,\r
+ const scim::String& text, int cursorPosition);\r
+ static void OnTerminate(const scim::HelperAgent* pHelperAgent, int inputContext, const scim::String& uuid);\r
+\r
+private:\r
+ _InputServiceSignalListener(const _InputServiceSignalListener& rhs);\r
+ _InputServiceSignalListener& operator=(const _InputServiceSignalListener& rhs);\r
+\r
+private:\r
+ static IInputMethodProvider* __pIInputMethodProvider;\r
+ static IInputMethodListener* __pIInputMethodListener;\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif // _FUI_IME_INPUT_SERVICE_SIGNAL_LISTENER_H_\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FUiIme_Key.h
+ * @brief This is the header file for types related to the key which are used in the Tizen::Ui::Ime namespace.
+ *
+ * This header file contains types related to the key and the key map between OSP and SCIM.
+ */
+
+#ifndef _FUI_IME_INTERNAL_KEY_H_
+#define _FUI_IME_INTERNAL_KEY_H_
+
+#include "FUiIKeyEventListener.h"
+
+namespace Tizen { namespace Ui { namespace Ime {
+
+/**
+* @struct _KeyCode
+* Structure to hold the information of the input method key.
+* @since 2.0
+*/
+struct _KeyCode
+{
+ Tizen::Ui::KeyCode keyCode;
+ scim::KeyCode scimKeyCode;
+};
+
+/**
+* @brief KEY_CODE_MAP
+* Table to map osp keys and scim keys.
+* @since 2.0
+*/
+static const _KeyCode KEY_CODE_MAP[] = {
+ {Tizen::Ui::KEY_CLEAR, scim::SCIM_KEY_Clear},
+ {Tizen::Ui::KEY_0, scim::SCIM_KEY_0},
+ {Tizen::Ui::KEY_1, scim::SCIM_KEY_1},
+ {Tizen::Ui::KEY_2, scim::SCIM_KEY_2},
+ {Tizen::Ui::KEY_3, scim::SCIM_KEY_3},
+ {Tizen::Ui::KEY_4, scim::SCIM_KEY_4},
+ {Tizen::Ui::KEY_5, scim::SCIM_KEY_5},
+ {Tizen::Ui::KEY_6, scim::SCIM_KEY_6},
+ {Tizen::Ui::KEY_7, scim::SCIM_KEY_7},
+ {Tizen::Ui::KEY_8, scim::SCIM_KEY_8},
+ {Tizen::Ui::KEY_9, scim::SCIM_KEY_9},
+ {Tizen::Ui::KEY_ASTERISK, scim::SCIM_KEY_asterisk},
+ {Tizen::Ui::KEY_SHARP, scim::SCIM_KEY_ssharp},
+ {Tizen::Ui::KEY_LEFT, scim::SCIM_KEY_Left},
+ {Tizen::Ui::KEY_UP, scim::SCIM_KEY_Up},
+ {Tizen::Ui::KEY_DOWN, scim::SCIM_KEY_Down},
+ {Tizen::Ui::KEY_RIGHT, scim::SCIM_KEY_Right},
+ {Tizen::Ui::KEY_A, scim::SCIM_KEY_A},
+ {Tizen::Ui::KEY_B, scim::SCIM_KEY_B},
+ {Tizen::Ui::KEY_C, scim::SCIM_KEY_C},
+ {Tizen::Ui::KEY_D, scim::SCIM_KEY_D},
+ {Tizen::Ui::KEY_E, scim::SCIM_KEY_E},
+ {Tizen::Ui::KEY_F, scim::SCIM_KEY_F},
+ {Tizen::Ui::KEY_G, scim::SCIM_KEY_G},
+ {Tizen::Ui::KEY_H, scim::SCIM_KEY_H},
+ {Tizen::Ui::KEY_I, scim::SCIM_KEY_I},
+ {Tizen::Ui::KEY_J, scim::SCIM_KEY_J},
+ {Tizen::Ui::KEY_K, scim::SCIM_KEY_K},
+ {Tizen::Ui::KEY_L, scim::SCIM_KEY_L},
+ {Tizen::Ui::KEY_M, scim::SCIM_KEY_M},
+ {Tizen::Ui::KEY_N, scim::SCIM_KEY_N},
+ {Tizen::Ui::KEY_O, scim::SCIM_KEY_O},
+ {Tizen::Ui::KEY_P, scim::SCIM_KEY_P},
+ {Tizen::Ui::KEY_Q, scim::SCIM_KEY_Q},
+ {Tizen::Ui::KEY_R, scim::SCIM_KEY_R},
+ {Tizen::Ui::KEY_S, scim::SCIM_KEY_S},
+ {Tizen::Ui::KEY_T, scim::SCIM_KEY_T},
+ {Tizen::Ui::KEY_U, scim::SCIM_KEY_U},
+ {Tizen::Ui::KEY_V, scim::SCIM_KEY_V},
+ {Tizen::Ui::KEY_W, scim::SCIM_KEY_W},
+ {Tizen::Ui::KEY_X, scim::SCIM_KEY_X},
+ {Tizen::Ui::KEY_Y, scim::SCIM_KEY_Y},
+ {Tizen::Ui::KEY_Z, scim::SCIM_KEY_Z},
+ {Tizen::Ui::KEY_BACKSPACE,scim::SCIM_KEY_BackSpace},
+ {Tizen::Ui::KEY_COMMA, scim::SCIM_KEY_comma},
+ {Tizen::Ui::KEY_ENTER, scim::SCIM_KEY_Return},
+ {Tizen::Ui::KEY_CAPSLOCK, scim::SCIM_KEY_Caps_Lock},
+ {Tizen::Ui::KEY_QUESTION, scim::SCIM_KEY_question},
+ {Tizen::Ui::KEY_ALT, scim::SCIM_KEY_Alt_L},
+ {Tizen::Ui::KEY_SPACE, scim::SCIM_KEY_space},
+ {Tizen::Ui::KEY_DOT, scim::SCIM_KEY_period}
+};
+
+static const int MAX_KEY_CODE = sizeof(KEY_CODE_MAP) / sizeof(KEY_CODE_MAP[0]);
+
+}}} // Tizen::Ui::Ime
+
+#endif // _FUI_IME_INTERNAL_KEY_H_
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_ScimDataConverter.cpp\r
+ * @brief This is the implementation file for the %_ScimDataConverter class.\r
+ *\r
+ * This implementation file contains definition of the %_ScimDataConverter class.\r
+ */\r
+\r
+#include <vector> // vector in scim_event.h\r
+\r
+#define Uses_SCIM_EVENT\r
+#define Uses_SCIM_UTILITY\r
+#undef null\r
+#include <scim.h> // SCIM_KEY_NullKey, SCIM_KEY_NullMask, SCIM_KEY_ReleaseMask\r
+#define null 0\r
+\r
+#include <FBaseSysLog.h>\r
+#include <FBaseString.h>\r
+#include <FBase_StringConverter.h>\r
+\r
+#include "FUiIme_Key.h"\r
+#include "FUiIme_ScimDataConverter.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Locales;\r
+using namespace Tizen::Ui;\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+_ScimDataConverter::_ScimDataConverter()\r
+{\r
+\r
+}\r
+\r
+_ScimDataConverter::~_ScimDataConverter()\r
+{\r
+\r
+}\r
+\r
+result\r
+_ScimDataConverter::ConvertKey(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state, scim::KeyEvent& event) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ event.code = scim::SCIM_KEY_NullKey;\r
+ event.mask = scim::SCIM_KEY_NullMask;\r
+ event.layout = scim::SCIM_KEYBOARD_Default;\r
+\r
+ // event.code\r
+ for (int i = 0; i < MAX_KEY_CODE; i++)\r
+ {\r
+ if (code == KEY_CODE_MAP[i].keyCode)\r
+ {\r
+ event.code = KEY_CODE_MAP[i].scimKeyCode;\r
+ break;\r
+ }\r
+ }\r
+\r
+ // event.mask\r
+ switch (state)\r
+ {\r
+ case KEY_PRESSED:\r
+ event.mask = scim::SCIM_KEY_NullMask; // The NullMask means the PressMask.\r
+ break;\r
+ case KEY_RELEASED:\r
+ event.mask = scim::SCIM_KEY_ReleaseMask;\r
+ break;\r
+ case KEY_LONGPRESSED:\r
+ // Fall through\r
+ default:\r
+ break;\r
+ } \r
+\r
+ return r;\r
+}\r
+\r
+void \r
+_ScimDataConverter::ConvertRectangle(const Tizen::Graphics::Rectangle& src, scim::rectinfo& dest) const\r
+{\r
+ dest.pos_x = src.x;\r
+ dest.pos_y = src.y;\r
+ dest.width = src.width;\r
+ dest.height = src.height;\r
+\r
+ return;\r
+}\r
+\r
+result\r
+_ScimDataConverter::ConvertString(const Tizen::Base::String& src, scim::String& dest) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ char* pCharSrc = null;\r
+\r
+ pCharSrc = _StringConverter::CopyToCharArrayN(src);\r
+ r = GetLastResult();\r
+ SysTryReturnResult(NID_UI_IME, pCharSrc, r, "Propagating.");\r
+\r
+ dest = pCharSrc;\r
+\r
+ delete[] pCharSrc;\r
+\r
+ return r;\r
+}\r
+\r
+result\r
+_ScimDataConverter::ConvertString(const Tizen::Base::String& src, scim::WideString& dest) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ char* pCharSrc = null;\r
+\r
+ pCharSrc = _StringConverter::CopyToCharArrayN(src);\r
+ r = GetLastResult();\r
+ SysTryReturnResult(NID_UI_IME, pCharSrc, r, "Propagating.");\r
+\r
+ dest = scim::utf8_mbstowcs(pCharSrc, strlen(pCharSrc));\r
+\r
+ delete[] pCharSrc;\r
+\r
+ return r;\r
+}\r
+\r
+result\r
+_ScimDataConverter::ConvertString(const scim::String& src, Tizen::Base::String& dest) const\r
+{\r
+ result r = E_SUCCESS;\r
+\r
+ const char* pCharSrc = null;\r
+\r
+ pCharSrc = src.c_str();\r
+ SysTryReturnResult(NID_UI_IME, pCharSrc, E_INVALID_ARG, "Invalid argument(s) is used. The source is invalid.");\r
+\r
+ String destString(pCharSrc);\r
+\r
+ dest = destString;\r
+\r
+ return r;\r
+}\r
+\r
+}}} // Tizen::Ui::Ime\r
--- /dev/null
+//\r
+// Open Service Platform\r
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file FUiIme_ScimDataConverter.h\r
+ * @brief This is the header file for the %_ScimDataConverter class.\r
+ *\r
+ * This header file contains the declarations of the %_ScimDataConverter class.\r
+ */\r
+\r
+#ifndef _FUI_IME_INTERNAL_SCIM_DATA_CONVERTER_H_\r
+#define _FUI_IME_INTERNAL_SCIM_DATA_CONVERTER_H_\r
+\r
+#include <string> // basic_string in scim_types.h\r
+\r
+#define Uses_SCIM_TYPES\r
+#undef null\r
+#include <scim.h>\r
+#define null 0\r
+\r
+#include <FBaseDataType.h>\r
+#include <FBaseObject.h>\r
+#include <FGrpRectangle.h>\r
+#include <FLclLocale.h>\r
+#include <FUiIKeyEventListener.h>\r
+\r
+namespace scim\r
+{\r
+struct KeyEvent;\r
+} // scim\r
+\r
+namespace Tizen { namespace Base\r
+{\r
+class String;\r
+}} // Tizen::Base\r
+\r
+namespace Tizen { namespace Ui { namespace Ime {\r
+\r
+/**\r
+* @class _ScimDataConverter\r
+* @brief This class is a concrete class of the %_ScimDataConverter class.\r
+* @since 2.0\r
+*\r
+*/\r
+class _ScimDataConverter\r
+ : public Tizen::Base::Object\r
+{\r
+public:\r
+ _ScimDataConverter();\r
+ virtual ~_ScimDataConverter();\r
+\r
+ result ConvertKey(Tizen::Ui::KeyCode keyCode, Tizen::Ui::KeyState keyState, scim::KeyEvent& keyEvent) const;\r
+\r
+ void ConvertRectangle(const Tizen::Graphics::Rectangle& src, scim::rectinfo& dest) const;\r
+\r
+ result ConvertString(const Tizen::Base::String& src, scim::String& dest) const;\r
+ result ConvertString(const Tizen::Base::String& src, scim::WideString& dest) const;\r
+ result ConvertString(const scim::String& src, Tizen::Base::String& dest) const;\r
+\r
+private:\r
+ _ScimDataConverter(const _ScimDataConverter&);\r
+ _ScimDataConverter& operator=(const _ScimDataConverter&);\r
+};\r
+\r
+}}} // Tizen::Ui::Ime\r
+\r
+#endif//_FUI_IME_INTERNAL_SCIM_DATA_CONVERTER_H_\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FApp_ImeEntry.cpp
+ * @brief This is the entry point for the IME application.
+ */
+
+#include <dlfcn.h>
+#include <dlog.h> // LOG()
+#include <fcntl.h> // open()
+#include <libxml/tree.h>
+#include <limits.h> // PATH_MAX
+#include <linux/capability.h>
+#include <privilege-control.h>
+#include <string.h>
+#include <unistd.h> // readlink()
+
+#define Uses_SCIM_CONFIG_BASE
+#define Uses_SCIM_HELPER
+#define Uses_SCIM_TYPES
+#undef null
+#include <scim.h>
+#define null 0
+
+#include <FBaseString.h>
+#include <FLclLocale.h>
+#include <FOspConfig.h>
+
+#include <FBase_StringConverter.h>
+
+static const char* LOG_TAG_IME = "IME";
+
+static const int MAX_LANGUAGE_BUFFER_SIZE = 371; // 53*7
+static const int MAX_BUFFER_SIZE = 256;
+static const int MAX_PACKAGE_NAME = 100;
+static const char* MANIFEST_FILE_PATH = "info/manifest.xml";
+
+static int __argc = 0;
+static char** __pArgv = NULL;
+
+static char __appId[MAX_BUFFER_SIZE];
+static char __uuid[MAX_BUFFER_SIZE];
+static char __name[MAX_BUFFER_SIZE];
+static char __language[MAX_LANGUAGE_BUFFER_SIZE];
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+extern void InitAppInfo(const char* appId, const char* exeName, int argc, char* pArgv[], int fd);
+extern void InitImeInfo(const char* uuid, const char* name, const char* language);
+extern int OspMain(int argc, char* pArgv[]) __attribute__((weak));
+
+static void
+AdjustPrivilege(const char* pkgname)
+{
+ void* handle = dlopen("libprivilege-control.so.0", RTLD_LAZY | RTLD_LOCAL);
+ if (!handle)
+ {
+ fprintf(stderr, "Cannot open libprivilege-control.so.0\n");
+ return;
+ }
+
+ char* msg = 0;
+ dlerror();
+
+ int (* ppriv_func)(const char*) = NULL;
+
+ ppriv_func = reinterpret_cast <int (*)(const char*)>(dlsym(handle, "set_privilege"));
+ msg = dlerror();
+ if (msg != NULL)
+ {
+ fprintf(stderr, "Dlsym error: %s\n", msg);
+
+ dlclose(handle);
+ return;
+ }
+
+ int ret = (*ppriv_func)(pkgname);
+ if (ret < 0)
+ {
+ fprintf(stderr, "set_privilege() returned %d\n", ret);
+ }
+
+ dlclose(handle);
+}
+
+extern "C" int capset(cap_user_header_t hdrp, const cap_user_data_t datap);
+
+static int
+AdjustCapability(void)
+{
+ cap_user_header_t head = 0;
+ cap_user_data_t data = 0;
+
+ head = static_cast<cap_user_header_t>(malloc(sizeof(*head)));
+ if (head == NULL)
+ {
+ fprintf(stderr, "Memory allocation failure.\n");
+ return -1;
+ }
+
+ head->version = _LINUX_CAPABILITY_VERSION;
+ head->pid = getpid();
+
+ data = static_cast<cap_user_data_t>(calloc(sizeof(*data), _LINUX_CAPABILITY_U32S));
+ if (data == NULL)
+ {
+ fprintf(stderr, "Memory allocation failure.\n");
+
+ free(head);
+ return -1;
+ }
+
+ data[CAP_TO_INDEX(CAP_NET_RAW)].effective |= CAP_TO_MASK(CAP_NET_RAW);
+ data[CAP_TO_INDEX(CAP_NET_RAW)].permitted |= CAP_TO_MASK(CAP_NET_RAW);
+
+ if (capset(head, data) < 0)
+ {
+ fprintf(stderr, "Capability setting error\n");
+
+ free(data);
+ free(head);
+ return -1;
+ }
+
+ free(data);
+ free(head);
+
+ return 0;
+}
+
+static int
+DoPreExec(const char* bin_path)
+{
+ void* handle = NULL;
+ char* errormsg = 0;
+ int (* DoPreExecFunc)(const char*, const char*) = NULL;
+ int ret = 0;
+
+ handle = dlopen("libosp-env-config.so", RTLD_LAZY | RTLD_GLOBAL);
+ if (!handle)
+ {
+ LOG(LOG_DEBUG, LOG_TAG_IME, "IME > Failed to dlopen libosp-env-config.so (%s)", dlerror());
+ return -1;
+ }
+ LOG(LOG_DEBUG, LOG_TAG_IME, "IME > dlopen() ok");
+
+ DoPreExecFunc = reinterpret_cast <int (*)(const char*, const char*)>(dlsym(handle, "do_pre_exec"));
+ errormsg = dlerror();
+ if (errormsg != NULL)
+ {
+ LOG(LOG_DEBUG, LOG_TAG_IME, "IME > Failed to dlsym() (%s)", errormsg);
+ dlclose(handle);
+ return -1;
+ }
+ LOG(LOG_DEBUG, LOG_TAG_IME, "IME > dlsym() ok");
+
+ ret = DoPreExecFunc(NULL, bin_path);
+ if (ret < 0)
+ {
+ LOG(LOG_DEBUG, LOG_TAG_IME, "IME > Failed to do_pre_exe() (%d)", ret);
+ }
+ LOG(LOG_DEBUG, LOG_TAG_IME, "IME > do_pre_exe() ok");
+
+ dlclose(handle);
+
+ return 0;
+}
+
+static int
+GetDirFdFromPath(const char* pPath)
+{
+ int count = 0;
+ const int len = strlen(pPath);
+ char dname[PATH_MAX];
+ memset(dname, 0, PATH_MAX);
+
+ const char* p = pPath + len;
+ for (int i = 0; i < len; i++, p--)
+ {
+ if (*p == '/')
+ {
+ count++;
+
+ if (count == 2)
+ {
+ goto OUT;
+ }
+ }
+ }
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > wrong path format: %s.", __func__, __LINE__, pPath);
+
+ return -1;
+
+OUT:
+ strncpy(dname, pPath, p - pPath);
+
+ const int fd = open(dname, O_RDONLY | O_CLOEXEC | O_DIRECTORY);
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > directory path: %s, fd: %d", __func__, __LINE__, dname, fd);
+
+ return fd;
+}
+
+static bool
+GetPackageNameFromAppIdAppExecutableName(const char appId[], const char exeName[], char* pkgName, int maxPkgName)
+{
+ // package name is "[appid].[executable]"
+
+ snprintf(pkgName, maxPkgName, "%s.%s", appId, exeName);
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "IME, packageName is %s", pkgName);
+
+ return true;
+}
+
+static void
+PrintArgs(int argc, char* argv[])
+{
+ const char* value = NULL;
+ int i = 0;
+
+ do
+ {
+ value = argv[i];
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > %dth arg: [%s]", __func__, __LINE__, i, value);
+ i++;
+ }
+ while (value);
+}
+
+static void
+ParseXmlNode(const xmlNodePtr pXmlNode)
+{
+ xmlNodePtr pItorNode = null;
+
+ for (pItorNode = pXmlNode; pItorNode != null; pItorNode = pItorNode->next)
+ {
+ if (pItorNode->type == XML_ELEMENT_NODE)
+ {
+ if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("Id")))
+ {
+ xmlChar* pXmlChar = null;
+ pXmlChar = xmlNodeGetContent(pItorNode);
+
+ if (pXmlChar)
+ {
+ strncpy(__appId, reinterpret_cast<char*>(pXmlChar), strlen(reinterpret_cast<char*>(pXmlChar)));
+ xmlFree(pXmlChar);
+ }
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __appId is %s.", __func__, __LINE__, __appId);
+ }
+ else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("Uuid")))
+ {
+ xmlChar* pXmlChar = null;
+ pXmlChar = xmlNodeGetContent(pItorNode);
+
+ if (pXmlChar)
+ {
+ strncpy(__uuid, reinterpret_cast<char*>(pXmlChar), strlen(reinterpret_cast<char*>(pXmlChar)));
+ xmlFree(pXmlChar);
+ }
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __uuid is %s.", __func__, __LINE__, __uuid);
+ }
+ else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("DisplayName")))
+ {
+ xmlChar* pXmlChar = null;
+ pXmlChar = xmlNodeGetContent(pItorNode);
+
+ if (pXmlChar)
+ {
+ strncpy(__name, reinterpret_cast<char*>(pXmlChar), strlen(reinterpret_cast<char*>(pXmlChar)));
+ xmlFree(pXmlChar);
+ }
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __name is %s.", __func__, __LINE__, __name);
+ }
+ else if (!xmlStrcmp(pItorNode->name, reinterpret_cast<const xmlChar*>("Language")))
+ {
+ const int LANGUAGE_CODE_LENGTH = 3;
+
+ xmlChar* pXmlChar = null;
+ pXmlChar = xmlNodeGetContent(pItorNode);
+
+ if (pXmlChar)
+ {
+ if (strlen(__language) != 0)
+ {
+ strcat(__language, ",");
+ }
+
+ char languageCode[LANGUAGE_CODE_LENGTH + 1];
+ strncpy(languageCode, reinterpret_cast<char*>(pXmlChar), LANGUAGE_CODE_LENGTH);
+
+ Tizen::Base::String twoLetterLanguageCode = Tizen::Locales::Locale::LanguageCodeToTwoLetterLanguageCodeString(Tizen::Locales::Locale::StringToLanguageCode(languageCode));
+
+ // append language code
+ char* pLanguageCode = null;
+ pLanguageCode = Tizen::Base::_StringConverter::CopyToCharArrayN(twoLetterLanguageCode.GetPointer());
+
+ if (pLanguageCode)
+ {
+ strcat(__language, pLanguageCode);
+ delete[] pLanguageCode;
+ }
+
+ // append country code
+ strcat(__language, reinterpret_cast<char*>(pXmlChar + LANGUAGE_CODE_LENGTH));
+
+ xmlFree(pXmlChar);
+ }
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __language is %s.", __func__, __LINE__, __language);
+ }
+
+ if (pItorNode->children)
+ {
+ ParseXmlNode(pItorNode->children);
+ }
+ }
+ }
+
+ return;
+}
+
+static void
+ParseImeInfo(const char* filePath)
+{
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > The filePath is %s.", __func__, __LINE__, filePath);
+
+ xmlDocPtr pXmlDoc = null;
+ xmlNodePtr pRootElement = null;
+
+ pXmlDoc = xmlParseFile(filePath);
+ if (!pXmlDoc)
+ {
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > xmlParseFile() has failed.", __func__, __LINE__);
+ goto CATCH;
+ }
+
+ pRootElement = xmlDocGetRootElement(pXmlDoc);
+ if (!pRootElement)
+ {
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > xmlDocGetRootElement() has falied.", __func__, __LINE__);
+ goto CATCH;
+ }
+
+ ParseXmlNode(pRootElement);
+
+ // Fall through
+CATCH:
+ if (pXmlDoc)
+ {
+ xmlFreeDoc(pXmlDoc);
+ }
+
+ xmlCleanupParser();
+
+ return;
+}
+
+void _OSP_EXPORT_
+scim_module_init (void)
+{
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_module_init() has been called.", __func__, __LINE__);
+
+ return;
+}
+
+void _OSP_EXPORT_
+scim_module_exit (void)
+{
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_module_exit() has been called.", __func__, __LINE__);
+
+ return;
+}
+
+void _OSP_EXPORT_
+scim_helper_module_set_path_info(const char* path)
+{
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > The path is %s.", __func__, __LINE__, path);
+
+ memset(__appId, '\0', MAX_BUFFER_SIZE);
+ memset(__uuid, '\0', MAX_BUFFER_SIZE);
+ memset(__name, '\0', MAX_BUFFER_SIZE);
+ memset(__language, '\0', MAX_LANGUAGE_BUFFER_SIZE);
+
+ char symbolicLinkPath[MAX_BUFFER_SIZE];
+ memset(symbolicLinkPath, '\0', MAX_BUFFER_SIZE);
+ ssize_t numberOfBytes = -1;
+ numberOfBytes = readlink(path, symbolicLinkPath, MAX_BUFFER_SIZE);
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > The numberOfBytes is %d.", __func__, __LINE__, numberOfBytes);
+
+ // parse ime info
+ const char* pSeparator = strstr(symbolicLinkPath, "/bin");
+
+ char manifestFilePath[MAX_BUFFER_SIZE];
+ memset(manifestFilePath, '\0', MAX_BUFFER_SIZE);
+
+ strncpy(manifestFilePath, symbolicLinkPath, pSeparator - symbolicLinkPath + 1);
+ strcat(manifestFilePath, MANIFEST_FILE_PATH);
+
+ ParseImeInfo(manifestFilePath);
+
+ // initialize ime info
+ InitImeInfo(__uuid, __name, __language);
+
+ return;
+}
+
+bool _OSP_EXPORT_
+scim_helper_module_get_helper_info (unsigned int idx, scim::HelperInfo& info)
+{
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_helper_module_get_helper_info() has been called.", __func__, __LINE__);
+
+ if (idx == 0)
+ {
+ info = scim::HelperInfo(__uuid, __name, "", "",
+ scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO | scim::SCIM_HELPER_AUTO_RESTART);
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __uuid is %s and __name is %s.", __func__, __LINE__, __uuid, __name);
+
+ return true;
+ }
+
+ return false;
+}
+
+scim::String _OSP_EXPORT_
+scim_helper_module_get_helper_language (unsigned int idx)
+{
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __language is %s.", __func__, __LINE__, __language);
+
+ return __language;
+}
+
+unsigned int _OSP_EXPORT_
+scim_helper_module_number_of_helpers (void)
+{
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_helper_module_number_of_helpers() has been called.", __func__, __LINE__);
+
+ return 1;
+}
+
+void _OSP_EXPORT_
+scim_helper_module_set_arg_info(int argc, char* argv[])
+{
+ __argc = argc;
+ __pArgv = argv;
+
+ return;
+}
+
+void _OSP_EXPORT_
+scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointer& config, const scim::String& display)
+{
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_helper_module_run_helper() has been called.", __func__, __LINE__);
+
+ // get binaryPath
+ char binaryPath[MAX_BUFFER_SIZE];
+ memset(binaryPath, '\0', MAX_BUFFER_SIZE);
+
+ snprintf(binaryPath, MAX_BUFFER_SIZE, "/opt/apps/%s/bin/%s", __appId, __name);
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > The binary path is %s.", __func__, __LINE__, binaryPath);
+
+ // set __pArgv
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > __pArgv[0] is %s.", __func__, __LINE__, __pArgv[0]);
+ snprintf(*__pArgv, strlen(binaryPath) + 1, "%s", binaryPath);
+ PrintArgs(__argc, __pArgv);
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > uid is %d and euid is %d.", __func__, __LINE__, getuid(), geteuid());
+
+ if (getuid() == 0)
+ {
+ // self caging
+ DoPreExec(binaryPath);
+
+ // adjust privilege
+ char packageName[MAX_PACKAGE_NAME];
+ memset(packageName, '\0', MAX_PACKAGE_NAME);
+
+ GetPackageNameFromAppIdAppExecutableName(__appId, __name, packageName, MAX_PACKAGE_NAME);
+ AdjustPrivilege(packageName);
+ }
+
+ AdjustCapability();
+
+ // InitAppInfo
+ int fd = GetDirFdFromPath(__pArgv[0]);
+ if (fd == -1)
+ {
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > Openning a executable binary in the designated path has failed."
+ , __func__, __LINE__);
+ return;
+ }
+
+ InitAppInfo(__appId, __name, __argc, __pArgv, fd);
+
+ //
+ OspMain(__argc, __pArgv);
+
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > scim_helper_module_run_helper() has been terminated.", __func__, __LINE__);
+ LOG(LOG_DEBUG, LOG_TAG_IME, "%s {%d) > uid is %d and euid is %d.", __func__, __LINE__, getuid(), geteuid());
+
+ return;
+}
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus