• 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 #include "ohos_nweb/bridge/ark_web_drag_data_impl.h"
17 
18 #include "base/bridge/ark_web_bridge_macros.h"
19 
20 namespace OHOS::ArkWeb {
21 
ArkWebDragDataImpl(std::shared_ptr<OHOS::NWeb::NWebDragData> nweb_drag_data)22 ArkWebDragDataImpl::ArkWebDragDataImpl(std::shared_ptr<OHOS::NWeb::NWebDragData> nweb_drag_data)
23     : nweb_drag_data_(nweb_drag_data)
24 {}
25 
SetFileUri(const ArkWebString & uri)26 bool ArkWebDragDataImpl::SetFileUri(const ArkWebString& uri)
27 {
28     return nweb_drag_data_->SetFileUri(ArkWebStringStructToClass(uri));
29 }
30 
GetLinkURL()31 ArkWebString ArkWebDragDataImpl::GetLinkURL()
32 {
33     return ArkWebStringClassToStruct(nweb_drag_data_->GetLinkURL());
34 }
35 
SetLinkURL(const ArkWebString & url)36 bool ArkWebDragDataImpl::SetLinkURL(const ArkWebString& url)
37 {
38     return nweb_drag_data_->SetLinkURL(ArkWebStringStructToClass(url));
39 }
40 
GetLinkTitle()41 ArkWebString ArkWebDragDataImpl::GetLinkTitle()
42 {
43     return ArkWebStringClassToStruct(nweb_drag_data_->GetLinkTitle());
44 }
45 
SetLinkTitle(const ArkWebString & title)46 bool ArkWebDragDataImpl::SetLinkTitle(const ArkWebString& title)
47 {
48     return nweb_drag_data_->SetLinkTitle(ArkWebStringStructToClass(title));
49 }
50 
GetFragmentText()51 ArkWebString ArkWebDragDataImpl::GetFragmentText()
52 {
53     return ArkWebStringClassToStruct(nweb_drag_data_->GetFragmentText());
54 }
55 
SetFragmentText(const ArkWebString & text)56 bool ArkWebDragDataImpl::SetFragmentText(const ArkWebString& text)
57 {
58     return nweb_drag_data_->SetFragmentText(ArkWebStringStructToClass(text));
59 }
60 
GetFragmentHtml()61 ArkWebString ArkWebDragDataImpl::GetFragmentHtml()
62 {
63     return ArkWebStringClassToStruct(nweb_drag_data_->GetFragmentHtml());
64 }
65 
SetFragmentHtml(const ArkWebString & html)66 bool ArkWebDragDataImpl::SetFragmentHtml(const ArkWebString& html)
67 {
68     return nweb_drag_data_->SetFragmentHtml(ArkWebStringStructToClass(html));
69 }
70 
GetImageFileName()71 ArkWebString ArkWebDragDataImpl::GetImageFileName()
72 {
73     return ArkWebStringClassToStruct(nweb_drag_data_->GetImageFileName());
74 }
75 
GetPixelMapSetting(const void ** data,size_t & len,int & width,int & height)76 bool ArkWebDragDataImpl::GetPixelMapSetting(const void** data, size_t& len, int& width, int& height)
77 {
78     return nweb_drag_data_->GetPixelMapSetting(data, len, width, height);
79 }
80 
SetPixelMapSetting(const void * data,size_t len,int width,int height)81 bool ArkWebDragDataImpl::SetPixelMapSetting(const void* data, size_t len, int width, int height)
82 {
83     return nweb_drag_data_->SetPixelMapSetting(data, len, width, height);
84 }
85 
ClearImageFileNames()86 void ArkWebDragDataImpl::ClearImageFileNames()
87 {
88     nweb_drag_data_->ClearImageFileNames();
89 }
90 
IsSingleImageContent()91 bool ArkWebDragDataImpl::IsSingleImageContent()
92 {
93     return nweb_drag_data_->IsSingleImageContent();
94 }
95 
GetDragStartPosition(int & x,int & y)96 void ArkWebDragDataImpl::GetDragStartPosition(int& x, int& y)
97 {
98     nweb_drag_data_->GetDragStartPosition(x, y);
99 }
100 
IsDragNewStyle()101 bool ArkWebDragDataImpl::IsDragNewStyle()
102 {
103     return nweb_drag_data_->IsDragNewStyle();
104 }
105 
106 } // namespace OHOS::ArkWeb
107