1 /*
2  * Copyright (c) 2024 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 ARK_WEB_DRAG_DATA_H_
17 #define ARK_WEB_DRAG_DATA_H_
18 #pragma once
19 
20 #include "base/include/ark_web_base_ref_counted.h"
21 #include "base/include/ark_web_types.h"
22 
23 namespace OHOS::ArkWeb {
24 
25 /*--ark web(source=webcore)--*/
26 class ArkWebDragData : public virtual ArkWebBaseRefCounted {
27 public:
28     /**
29      * @brief set the image file name that is being dragged.
30      */
31     /*--ark web()--*/
32     virtual bool SetFileUri(const ArkWebString& uri) = 0;
33 
34     /**
35      * @brief get the link URL that is being dragged.
36      */
37     /*--ark web()--*/
38     virtual ArkWebString GetLinkURL() = 0;
39 
40     /**
41      * @brief set the link URL that is being dragged.
42      */
43     /*--ark web()--*/
44     virtual bool SetLinkURL(const ArkWebString& url) = 0;
45 
46     /**
47      * @brief get the title associated with the link that is being dragged.
48      */
49     /*--ark web()--*/
50     virtual ArkWebString GetLinkTitle() = 0;
51 
52     /**
53      * @brief set the title associated with the link that is being dragged.
54      */
55     /*--ark web()--*/
56     virtual bool SetLinkTitle(const ArkWebString& title) = 0;
57 
58     /**
59      * @brief get the plain text that is being dragged.
60      */
61     /*--ark web()--*/
62     virtual ArkWebString GetFragmentText() = 0;
63 
64     /**
65      * @brief set the plain text that is being dragged.
66      */
67     /*--ark web()--*/
68     virtual bool SetFragmentText(const ArkWebString& text) = 0;
69 
70     /**
71      * @brief get the text/html fragment that is being dragged.
72      */
73     /*--ark web()--*/
74     virtual ArkWebString GetFragmentHtml() = 0;
75 
76     /**
77      * @brief set the text/html fragment that is being dragged.
78      */
79     /*--ark web()--*/
80     virtual bool SetFragmentHtml(const ArkWebString& html) = 0;
81 
82     /**
83      * @brief get the image file name that is being dragged.
84      */
85     /*--ark web()--*/
86     virtual ArkWebString GetImageFileName() = 0;
87 
88     /**
89      * @brief get the image representation data that is beging dragged.
90      */
91     /*--ark web()--*/
92     virtual bool GetPixelMapSetting(const void** data, size_t& len, int& width, int& height) = 0;
93 
94     /**
95      * @brief set the image representation data that is beging dragged.
96      */
97     /*--ark web()--*/
98     virtual bool SetPixelMapSetting(const void* data, size_t len, int width, int height) = 0;
99 
100     /**
101      * @brief clear the exist image file names.
102      */
103     /*--ark web()--*/
104     virtual void ClearImageFileNames() = 0;
105 
106     /**
107      * @brief is single image that is being dragged.
108      */
109     /*--ark web()--*/
110     virtual bool IsSingleImageContent() = 0;
111 
112     /**
113      * @brief get the positon point that is beging dragged.
114      */
115     /*--ark web()--*/
116     virtual void GetDragStartPosition(int& x, int& y) = 0;
117 
118     /**
119      * @Description: Obtains whether the drag style is new.
120      * @Return: Returns an drag style, true is drag a new style, otherwise, drag a old style.
121      */
122     /*--ark web()--*/
123     virtual bool IsDragNewStyle() = 0;
124 };
125 
126 } // namespace OHOS::ArkWeb
127 
128 #endif // ARK_WEB_DRAG_DATA_H_
129