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().RegisterProxyIme(); 31 } 32 UnRegisteredProxy(UnRegisteredType type)33int32_t InputMethodAbilityInterface::UnRegisteredProxy(UnRegisteredType type) 34 { 35 return InputMethodAbility::GetInstance().UnRegisteredProxyIme(type); 36 } 37 RegisterProxyIme(uint64_t displayId)38int32_t InputMethodAbilityInterface::RegisterProxyIme(uint64_t displayId) 39 { 40 return InputMethodAbility::GetInstance().RegisterProxyIme(displayId); 41 } 42 UnregisterProxyIme(uint64_t displayId)43int32_t InputMethodAbilityInterface::UnregisterProxyIme(uint64_t displayId) 44 { 45 return InputMethodAbility::GetInstance().UnregisterProxyIme(displayId); 46 } 47 BindImeMirror()48int32_t InputMethodAbilityInterface::BindImeMirror() 49 { 50 return InputMethodAbility::GetInstance().BindImeMirror(); 51 } 52 UnbindImeMirror()53int32_t InputMethodAbilityInterface::UnbindImeMirror() 54 { 55 return InputMethodAbility::GetInstance().UnbindImeMirror(); 56 } 57 InsertText(const std::string & text)58int32_t InputMethodAbilityInterface::InsertText(const std::string &text) 59 { 60 return InputMethodAbility::GetInstance().InsertText(text); 61 } 62 DeleteForward(int32_t length)63int32_t InputMethodAbilityInterface::DeleteForward(int32_t length) 64 { 65 return InputMethodAbility::GetInstance().DeleteForward(length); 66 } 67 DeleteBackward(int32_t length)68int32_t InputMethodAbilityInterface::DeleteBackward(int32_t length) 69 { 70 return InputMethodAbility::GetInstance().DeleteBackward(length); 71 } 72 MoveCursor(int32_t keyCode)73int32_t InputMethodAbilityInterface::MoveCursor(int32_t keyCode) 74 { 75 return InputMethodAbility::GetInstance().MoveCursor(keyCode); 76 } 77 GetInputAttribute(InputAttribute & attribute)78int32_t InputMethodAbilityInterface::GetInputAttribute(InputAttribute &attribute) 79 { 80 TextTotalConfig config; 81 auto ret = InputMethodAbility::GetInstance().GetTextConfig(config); 82 attribute = config.inputAttribute; 83 return ret; 84 } 85 SendFunctionKey(int32_t funcKey)86int32_t InputMethodAbilityInterface::SendFunctionKey(int32_t funcKey) 87 { 88 return InputMethodAbility::GetInstance().SendFunctionKey(funcKey); 89 } 90 SetImeListener(std::shared_ptr<InputMethodEngineListener> imeListener)91void InputMethodAbilityInterface::SetImeListener(std::shared_ptr<InputMethodEngineListener> imeListener) 92 { 93 InputMethodAbility::GetInstance().SetImeListener(imeListener); 94 } 95 SetKdListener(std::shared_ptr<KeyboardListener> kdListener)96void InputMethodAbilityInterface::SetKdListener(std::shared_ptr<KeyboardListener> kdListener) 97 { 98 InputMethodAbility::GetInstance().SetKdListener(kdListener); 99 } 100 SelectByRange(int32_t start,int32_t end)101int32_t InputMethodAbilityInterface::SelectByRange(int32_t start, int32_t end) 102 { 103 return InputMethodAbility::GetInstance().SelectByRange(start, end); 104 } 105 } // namespace MiscServices 106 } // namespace OHOS 107