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 #ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_ABILITY_INTERFACE_H 17 #define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_ABILITY_INTERFACE_H 18 19 #include <cstdint> 20 #include <memory> 21 #include <mutex> 22 23 #include "input_method_engine_listener.h" 24 #include "keyboard_listener.h" 25 #include "input_method_types.h" 26 27 namespace OHOS { 28 namespace MiscServices { 29 class InputMethodAbilityInterface { 30 public: 31 static InputMethodAbilityInterface &GetInstance(); 32 int32_t RegisteredProxy(); 33 int32_t UnRegisteredProxy(UnRegisteredType type); 34 int32_t InsertText(const std::string &text); 35 int32_t DeleteForward(int32_t length); 36 int32_t DeleteBackward(int32_t length); 37 int32_t MoveCursor(int32_t keyCode); 38 void SetImeListener(std::shared_ptr<InputMethodEngineListener> imeListener); 39 void SetKdListener(std::shared_ptr<KeyboardListener> kdListener); 40 41 private: 42 InputMethodAbilityInterface() = default; 43 }; 44 } // namespace MiscServices 45 } // namespace OHOS 46 #endif // FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_ABILITY_INTERFACE_H 47