2 // Open Service Platform
\r
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
\r
5 // Licensed under the Apache License, Version 2.0 (the License);
\r
6 // you may not use this file except in compliance with the License.
\r
7 // You may obtain a copy of the License at
\r
9 // http://www.apache.org/licenses/LICENSE-2.0
\r
11 // Unless required by applicable law or agreed to in writing, software
\r
12 // distributed under the License is distributed on an "AS IS" BASIS,
\r
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 // See the License for the specific language governing permissions and
\r
15 // limitations under the License.
\r
19 * @file FUiImeInputMethod.cpp
\r
20 * @brief This is the implementation file for the %InputMethod class.
\r
22 * This implementation file contains definition of the %InputMethod class.
\r
27 #include <FBaseSysLog.h>
\r
28 #include <FUiImeInputMethod.h>
\r
30 #include <FSec_AccessController.h>
\r
31 #include "FUiIme_InputMethodImpl.h"
\r
33 using namespace Tizen::Base;
\r
34 using namespace Tizen::Security;
\r
35 using namespace Tizen::Ui;
\r
37 namespace Tizen { namespace Ui { namespace Ime {
\r
39 static InputMethod* __pInputMethod = null;
\r
41 InputMethod::InputMethod(void)
\r
42 :__pInputMethodImpl(null)
\r
46 InputMethod::~InputMethod(void)
\r
48 __pInputMethod = null;
\r
49 __pInputMethodImpl = null;
\r
53 InputMethod::Construct(void)
\r
55 result r = E_SUCCESS;
\r
57 __pInputMethodImpl = _InputMethodImpl::GetInstance(*this);
\r
58 r = GetLastResult();
\r
59 SysTryReturnResult(NID_UI_IME, __pInputMethodImpl, r, "Propagating.");
\r
65 InputMethod::GetInstance(void)
\r
67 result r = E_SUCCESS;
\r
69 r = _AccessController::CheckUserPrivilege(_PRV_IME);
\r
70 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
72 if (__pInputMethod == null)
\r
74 __pInputMethod = new(std::nothrow) InputMethod();
\r
75 SysTryReturn(NID_UI_IME, __pInputMethod, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
\r
77 r = __pInputMethod->Construct();
\r
78 r = ((r == E_SUCCESS) || (r == E_CONNECTION_FAILED) || (r == E_SYSTEM)) ? r : E_SYSTEM;
\r
79 SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
\r
82 return __pInputMethod;
\r
85 delete __pInputMethod;
\r
86 __pInputMethod = null;
\r
92 InputMethod::SetInputMethodProvider(IInputMethodProvider* pProvider)
\r
94 __pInputMethodImpl->SetInputMethodProvider(pProvider);
\r
100 InputMethod::SetInputMethodListener(IInputMethodListener* pListener)
\r
102 __pInputMethodImpl->SetInputMethodListener(pListener);
\r
108 InputMethod::DeleteText(int cursorOffset, int length)
\r
110 return __pInputMethodImpl->DeleteText(cursorOffset, length);
\r
114 InputMethod::NotifyInputPanelState(InputPanelShowState state)
\r
116 return __pInputMethodImpl->NotifyInputPanelState(state);
\r
120 InputMethod::RequestSurroundingText(int lengthBeforeCursor, int lengthAfterCursor)
\r
122 return __pInputMethodImpl->RequestSurroundingText(lengthBeforeCursor, lengthAfterCursor);
\r
126 InputMethod::SendCompositeText(const String& text)
\r
128 return __pInputMethodImpl->SendCompositeText(text);
\r
132 InputMethod::SendKeyEvent(Tizen::Ui::KeyCode code, Tizen::Ui::KeyState state)
\r
134 return __pInputMethodImpl->SendKeyEvent(code, state);
\r
138 InputMethod::SendText(const String& text)
\r
140 return __pInputMethodImpl->SendText(text);
\r
143 }}} // Tizen::Ui::Ime
\r