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 20 #include <unordered_map> 21 22 #include "global.h" 23 #include "input_method_utils.h" 24 #include "iremote_broker.h" 25 26 /** 27 * brief Definition of interface IInputDataChannel 28 * It defines the remote calls from input method service to input client 29 */ 30 namespace OHOS { 31 namespace MiscServices { 32 class IInputDataChannel : public IRemoteBroker { 33 public: 34 enum { 35 DATA_CHANNEL_CMD_BEGIN, 36 INSERT_TEXT = DATA_CHANNEL_CMD_BEGIN, 37 DELETE_FORWARD, 38 DELETE_BACKWARD, 39 GET_TEXT_BEFORE_CURSOR, 40 GET_TEXT_AFTER_CURSOR, 41 GET_ENTER_KEY_TYPE, 42 GET_INPUT_PATTERN, 43 SEND_KEYBOARD_STATUS, 44 SEND_FUNCTION_KEY, 45 MOVE_CURSOR, 46 SELECT_BY_RANGE, 47 SELECT_BY_MOVEMENT, 48 HANDLE_EXTEND_ACTION, 49 GET_TEXT_INDEX_AT_CURSOR, 50 GET_TEXT_CONFIG, 51 NOTIFY_PANEL_STATUS_INFO, 52 NOTIFY_KEYBOARD_HEIGHT, 53 SEND_PRIVATE_COMMAND, 54 SET_PREVIEW_TEXT, 55 FINISH_TEXT_PREVIEW, 56 DATA_CHANNEL_CMD_END 57 }; 58 59 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputDataChannel"); 60 61 virtual int32_t InsertText(const std::u16string &text) = 0; 62 virtual int32_t DeleteForward(int32_t length) = 0; 63 virtual int32_t DeleteBackward(int32_t length) = 0; 64 virtual int32_t GetTextBeforeCursor(int32_t number, std::u16string &text) = 0; 65 virtual int32_t GetTextAfterCursor(int32_t number, std::u16string &text) = 0; 66 virtual int32_t GetTextConfig(TextTotalConfig &textConfig) = 0; 67 virtual void SendKeyboardStatus(KeyboardStatus status) = 0; 68 virtual int32_t SendFunctionKey(int32_t funcKey) = 0; 69 virtual int32_t MoveCursor(int32_t keyCode) = 0; 70 virtual int32_t GetEnterKeyType(int32_t &keyType) = 0; 71 virtual int32_t GetInputPattern(int32_t &inputPattern) = 0; 72 virtual int32_t SelectByRange(int32_t start, int32_t end) = 0; 73 virtual int32_t SelectByMovement(int32_t direction, int32_t cursorMoveSkip) = 0; 74 virtual int32_t HandleExtendAction(int32_t action) = 0; 75 virtual int32_t GetTextIndexAtCursor(int32_t &index) = 0; 76 virtual void NotifyPanelStatusInfo(const PanelStatusInfo &info) = 0; 77 virtual void NotifyKeyboardHeight(uint32_t height) = 0; 78 virtual int32_t SendPrivateCommand(const std::unordered_map<std::string, PrivateDataValue> &privateCommand) = 0; 79 virtual int32_t SetPreviewText(const std::string &text, const Range &range) = 0; 80 virtual int32_t FinishTextPreview(bool isAsync) = 0; 81 }; 82 } // namespace MiscServices 83 } // namespace OHOS 84 #endif // FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H 85