• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_IMPL_H_
17 #define ARK_WEB_DRAG_DATA_IMPL_H_
18 #pragma once
19 
20 #include "include/nweb_drag_data.h"
21 #include "ohos_nweb/include/ark_web_drag_data.h"
22 
23 namespace OHOS::ArkWeb {
24 
25 class ArkWebDragDataImpl : public ArkWebDragData {
26     IMPLEMENT_REFCOUNTING(ArkWebDragDataImpl);
27 
28 public:
29     ArkWebDragDataImpl(std::shared_ptr<OHOS::NWeb::NWebDragData> nweb_drag_data);
30     ~ArkWebDragDataImpl() = default;
31 
32     /**
33      * @brief set the image file name that is being dragged.
34      */
35     bool SetFileUri(const ArkWebString& uri) override;
36 
37     /**
38      * @brief get the link URL that is being dragged.
39      */
40     ArkWebString GetLinkURL() override;
41 
42     /**
43      * @brief set the link URL that is being dragged.
44      */
45     bool SetLinkURL(const ArkWebString& url) override;
46 
47     /**
48      * @brief get the title associated with the link that is being dragged.
49      */
50     ArkWebString GetLinkTitle() override;
51 
52     /**
53      * @brief set the title associated with the link that is being dragged.
54      */
55     bool SetLinkTitle(const ArkWebString& title) override;
56 
57     /**
58      * @brief get the plain text that is being dragged.
59      */
60     ArkWebString GetFragmentText() override;
61 
62     /**
63      * @brief set the plain text that is being dragged.
64      */
65     bool SetFragmentText(const ArkWebString& text) override;
66 
67     /**
68      * @brief get the text/html fragment that is being dragged.
69      */
70     ArkWebString GetFragmentHtml() override;
71 
72     /**
73      * @brief set the text/html fragment that is being dragged.
74      */
75     bool SetFragmentHtml(const ArkWebString& html) override;
76 
77     /**
78      * @brief get the image file name that is being dragged.
79      */
80     ArkWebString GetImageFileName() override;
81 
82     /**
83      * @brief get the image representation data that is beging dragged.
84      */
85     bool GetPixelMapSetting(const void** data, size_t& len, int& width, int& height) override;
86 
87     /**
88      * @brief set the image representation data that is beging dragged.
89      */
90     bool SetPixelMapSetting(const void* data, size_t len, int width, int height) override;
91 
92     /**
93      * @brief clear the exist image file names.
94      */
95     void ClearImageFileNames() override;
96 
97     /**
98      * @brief is single image that is being dragged.
99      */
100     bool IsSingleImageContent() override;
101 
102     /**
103      * @brief get the positon point that is beging dragged.
104      */
105     void GetDragStartPosition(int& x, int& y) override;
106 
107     /**
108      * @brief is drag new style.
109      */
110     bool IsDragNewStyle() override;
111 
112 private:
113     std::shared_ptr<OHOS::NWeb::NWebDragData> nweb_drag_data_;
114 };
115 
116 } // namespace OHOS::ArkWeb
117 
118 #endif // ARK_WEB_DRAG_DATA_IMPL_H_
119