1 /* 2 * Copyright (C) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "input_method_ability_interface.h" 17 18 #include "global.h" 19 #include "input_method_ability.h" 20 namespace OHOS { 21 namespace MiscServices { GetInstance()22InputMethodAbilityInterface &InputMethodAbilityInterface::GetInstance() 23 { 24 static InputMethodAbilityInterface interface; 25 return interface; 26 } 27 RegisteredProxy()28int32_t InputMethodAbilityInterface::RegisteredProxy() 29 { 30 return InputMethodAbility::GetInstance()->SetCoreAndAgent(); 31 } 32 UnRegisteredProxy(UnRegisteredType type)33int32_t InputMethodAbilityInterface::UnRegisteredProxy(UnRegisteredType type) 34 { 35 return InputMethodAbility::GetInstance()->UnRegisteredProxyIme(type); 36 } 37 InsertText(const std::string & text)38int32_t InputMethodAbilityInterface::InsertText(const std::string &text) 39 { 40 return InputMethodAbility::GetInstance()->InsertText(text); 41 } 42 DeleteForward(int32_t length)43int32_t InputMethodAbilityInterface::DeleteForward(int32_t length) 44 { 45 return InputMethodAbility::GetInstance()->DeleteForward(length); 46 } 47 DeleteBackward(int32_t length)48int32_t InputMethodAbilityInterface::DeleteBackward(int32_t length) 49 { 50 return InputMethodAbility::GetInstance()->DeleteBackward(length); 51 } 52 MoveCursor(int32_t keyCode)53int32_t InputMethodAbilityInterface::MoveCursor(int32_t keyCode) 54 { 55 return InputMethodAbility::GetInstance()->MoveCursor(keyCode); 56 } 57 SetImeListener(std::shared_ptr<InputMethodEngineListener> imeListener)58void InputMethodAbilityInterface::SetImeListener(std::shared_ptr<InputMethodEngineListener> imeListener) 59 { 60 InputMethodAbility::GetInstance()->SetImeListener(imeListener); 61 } 62 SetKdListener(std::shared_ptr<KeyboardListener> kdListener)63void InputMethodAbilityInterface::SetKdListener(std::shared_ptr<KeyboardListener> kdListener) 64 { 65 InputMethodAbility::GetInstance()->SetKdListener(kdListener); 66 } 67 } // namespace MiscServices 68 } // namespace OHOS 69