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 FUiImeInputMethodManager.cpp
\r
20 * @brief This is the implementation file for the %InputMethodManager class.
\r
22 * This implementation file contains definition of the %InputMethodManager class.
\r
27 #include <FBaseSysLog.h>
\r
28 #include <FUiImeInputMethodManager.h>
\r
30 #include <FSec_AccessController.h>
\r
31 #include "FUiIme_InputMethodManagerImpl.h"
\r
33 using namespace Tizen::App;
\r
34 using namespace Tizen::Base::Collection;
\r
35 using namespace Tizen::Security;
\r
37 namespace Tizen { namespace Ui { namespace Ime {
\r
39 static InputMethodManager* __pInputMethodManager = null;
\r
41 InputMethodManager::InputMethodManager(void)
\r
42 :__pInputMethodManagerImpl(null)
\r
46 InputMethodManager::~InputMethodManager(void)
\r
48 __pInputMethodManager = null;
\r
49 __pInputMethodManagerImpl = null;
\r
53 InputMethodManager::GetInstance(void)
\r
55 result r = E_SUCCESS;
\r
57 r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);
\r
58 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
60 _InputMethodManagerImpl* pImpl = null;
\r
62 if (__pInputMethodManager == null)
\r
64 __pInputMethodManager = new(std::nothrow) InputMethodManager();
\r
65 SysTryReturn(NID_UI_IME, __pInputMethodManager, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
\r
67 pImpl = new(std::nothrow) _InputMethodManagerImpl();
\r
68 SysTryCatch(NID_UI_IME, pImpl, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
\r
70 r = pImpl->Construct();
\r
71 SysTryCatch(NID_UI_IME, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
\r
73 __pInputMethodManager->__pInputMethodManagerImpl = pImpl;
\r
76 return __pInputMethodManager;
\r
79 delete __pInputMethodManager;
\r
80 __pInputMethodManager = null;
\r
88 InputMethodManager::GetActiveInputMethodInfoN(void) const
\r
90 result r = E_SUCCESS;
\r
92 r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);
\r
93 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
95 return __pInputMethodManagerImpl->GetActiveInputMethodInfoN();
\r
99 InputMethodManager::GetInputMethodInfoListN(void) const
\r
101 result r = E_SUCCESS;
\r
103 r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);
\r
104 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
106 return __pInputMethodManagerImpl->GetInputMethodInfoListN();
\r
110 InputMethodManager::SetInputMethod(const AppId& id)
\r
112 result r = E_SUCCESS;
\r
114 r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);
\r
115 SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
\r
117 return __pInputMethodManagerImpl->SetInputMethod(id);
\r
121 InputMethodManager::IsActiveInputMethod(const AppId& id) const
\r
123 result r = E_SUCCESS;
\r
125 r = _AccessController::CheckUserPrivilege(_PRV_IMEMANAGER);
\r
126 SysTryReturnResult(NID_UI_IME, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
\r
128 return __pInputMethodManagerImpl->IsActiveInputMethod(id);
\r
131 }}} // Tizen::Ui::Ime
\r