1 /* 2 * Copyright (c) 2021-2022 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_CORE_COMPONENTS_TEXT_SPAN_TEXT_SPAN_COMPONENT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEXT_SPAN_TEXT_SPAN_COMPONENT_H 18 19 #include "core/components/common/properties/text_style.h" 20 #include "core/components/text_span/text_span_element.h" 21 #include "core/pipeline/base/component_group.h" 22 #include "core/components/declaration/span/span_declaration.h" 23 24 namespace OHOS::Ace { 25 26 class ACE_EXPORT TextSpanComponent : public ComponentGroup { 27 DECLARE_ACE_TYPE(TextSpanComponent, ComponentGroup); 28 29 public: 30 explicit TextSpanComponent(const std::string& spanData); 31 ~TextSpanComponent() override = default; 32 33 RefPtr<RenderNode> CreateRenderNode() override; 34 RefPtr<Element> CreateElement() override; 35 36 const std::string& GetSpanData() const; 37 void SetSpanData(const std::string& data); 38 39 const TextStyle& GetTextStyle() const; 40 void SetTextStyle(const TextStyle& spanStyle); 41 42 bool IsShow() const; 43 void SetIsShow(bool isShow); 44 45 void SetOnClick(const EventMarker& onClick); 46 void SetRemoteMessageEventId(const EventMarker& eventId); 47 HasNewStyle()48 bool HasNewStyle() const 49 { 50 return hasNewStyle_; 51 } 52 53 const RefPtr<SpanDeclaration>& GetDeclaration() const; 54 void SetDeclaration(const RefPtr<SpanDeclaration>& declaration); 55 56 private: 57 bool hasNewStyle_ = false; 58 RefPtr<SpanDeclaration> declaration_; 59 }; 60 61 } // namespace OHOS::Ace 62 63 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEXT_SPAN_TEXT_SPAN_COMPONENT_H 64