1 /* 2 * Copyright (C) 2021 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_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H 17 #define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H 18 #include <errors.h> 19 #include "iremote_broker.h" 20 #include "global.h" 21 #include "input_method_utils.h" 22 23 /** 24 * brief Definition of interface IInputDataChannel 25 * It defines the remote calls from input method service to input client 26 */ 27 namespace OHOS { 28 namespace MiscServices { 29 class IInputDataChannel : public IRemoteBroker { 30 public: 31 enum { 32 INSERT_TEXT = 0, 33 DELETE_FORWARD, 34 DELETE_BACKWARD, 35 GET_TEXT_BEFORE_CURSOR, 36 GET_TEXT_AFTER_CURSOR, 37 GET_ENTER_KEY_TYPE, 38 GET_INPUT_PATTERN, 39 SEND_KEYBOARD_STATUS, 40 SEND_FUNCTION_KEY, 41 MOVE_CURSOR, 42 HANDLE_SET_SELECTION, 43 HANDLE_EXTEND_ACTION, 44 HANDLE_SELECT, 45 }; 46 47 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputDataChannel"); 48 49 virtual int32_t InsertText(const std::u16string& text) = 0; 50 virtual int32_t DeleteForward(int32_t length) = 0; 51 virtual int32_t DeleteBackward(int32_t length) = 0; 52 virtual int32_t GetTextBeforeCursor(int32_t number, std::u16string &text) = 0; 53 virtual int32_t GetTextAfterCursor(int32_t number, std::u16string &text) = 0; 54 virtual void SendKeyboardStatus(int32_t status) = 0; 55 virtual int32_t SendFunctionKey(int32_t funcKey) = 0; 56 virtual int32_t MoveCursor(int32_t keyCode) = 0; 57 virtual int32_t GetEnterKeyType(int32_t &keyType) = 0; 58 virtual int32_t GetInputPattern(int32_t &inputPattern) = 0; 59 virtual void HandleSetSelection(int32_t start, int32_t end) = 0; 60 virtual void HandleExtendAction(int32_t action) = 0; 61 virtual void HandleSelect(int32_t keyCode, int32_t cursorMoveSkip) = 0; 62 virtual void NotifyGetOperationCompletion() = 0; 63 }; 64 } // namespace MiscServices 65 } // namespace OHOS 66 #endif // FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H 67