1 /*
2  * Copyright (c) 2023-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 FOUNDATION_ACE_FRAMEWORKS_BASE_VIEW_DATA_WRAP_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BASE_VIEW_DATA_WRAP_H
18 
19 #include "base/memory/ace_type.h"
20 #include "base/view_data/page_node_info_wrap.h"
21 
22 namespace OHOS::AbilityBase {
23 struct ViewData;
24 enum class AutoFillType;
25 } // namespace OHOS::AbilityBase
26 
27 namespace OHOS::Ace {
28 class ACE_EXPORT ViewDataWrap : public AceType {
29     DECLARE_ACE_TYPE(ViewDataWrap, AceType);
30 
31 public:
32     static RefPtr<ViewDataWrap> CreateViewDataWrap();
33     static RefPtr<ViewDataWrap> CreateViewDataWrap(const AbilityBase::ViewData& viewData);
34     static AbilityBase::AutoFillType ViewDataToType(const AbilityBase::ViewData& viewData);
35     static bool GetPlaceHolderValue(AbilityBase::ViewData& viewData);
36     static bool LoadHint2Type(const std::vector<std::string>& placeHolder, std::vector<int>& type,
37                                     std::vector<std::string>& metadata);
38     static AbilityBase::AutoFillType HintToAutoFillType(const int& intType);
39 
SetBundleName(const std::string & bundleName)40     virtual void SetBundleName(const std::string& bundleName) {}
41     virtual const std::string& GetBundleName() const = 0;
42 
SetModuleName(const std::string & moduleName)43     virtual void SetModuleName(const std::string& moduleName) {}
44     virtual const std::string& GetModuleName() const = 0;
45 
SetAbilityName(const std::string & abilityName)46     virtual void SetAbilityName(const std::string& abilityName) {}
47     virtual const std::string& GetAbilityName() const = 0;
48 
SetPageUrl(const std::string & pageUrl)49     virtual void SetPageUrl(const std::string& pageUrl) {}
50     virtual const std::string& GetPageUrl() const = 0;
51 
AddPageNodeInfoWrap(RefPtr<PageNodeInfoWrap> pageNodeInfoWrap)52     virtual void AddPageNodeInfoWrap(RefPtr<PageNodeInfoWrap> pageNodeInfoWrap) {}
53     virtual const std::vector<RefPtr<PageNodeInfoWrap>>& GetPageNodeInfoWraps() = 0;
54 
SetPageRect(const NG::RectF & rect)55     virtual void SetPageRect(const NG::RectF& rect) {}
56     virtual const NG::RectF& GetPageRect() const = 0;
57 
SetUserSelected(bool isUserSelected)58     virtual void SetUserSelected(bool isUserSelected) {}
59     virtual bool GetUserSelected() const = 0;
60 
SetOtherAccount(bool isOtherAccount)61     virtual void SetOtherAccount(bool isOtherAccount) {}
62     virtual bool GetOtherAccount() const = 0;
63 };
64 } // namespace OHOS::Ace
65 #endif // FOUNDATION_ACE_FRAMEWORKS_BASE_VIEW_DATA_WRAP_H
66