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