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 FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_LAYOUT_INFO_INTERFACE_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_LAYOUT_INFO_INTERFACE_H 18 19 #include "core/components/common/properties/text_layout_info.h" 20 #include "core/components_ng/pattern/text/layout_info_interface.h" 21 #include "core/components_ng/render/paragraph.h" 22 #include "core/components_ng/pattern/rich_editor/paragraph_manager.h" 23 24 namespace OHOS::Ace::NG { 25 class LayoutInfoInterface : public virtual AceType { 26 public: 27 LayoutInfoInterface() = default; 28 ~LayoutInfoInterface() = default; GetLayoutInfoInterface()29 virtual WeakPtr<OHOS::Ace::NG::LayoutInfoInterface> GetLayoutInfoInterface() 30 { 31 return WeakClaim(this); 32 } 33 GetLineCount()34 virtual size_t GetLineCount() const 35 { 36 return 0; 37 } 38 DidExceedMaxLines()39 virtual bool DidExceedMaxLines() const 40 { 41 return false; 42 } 43 GetLineMetrics(int32_t lineNumber)44 virtual TextLineMetrics GetLineMetrics(int32_t lineNumber) 45 { 46 return TextLineMetrics(); 47 } 48 GetRectsForRange(int32_t start,int32_t end,RectHeightStyle heightStyle,RectWidthStyle widthStyle)49 virtual std::vector<ParagraphManager::TextBox> GetRectsForRange(int32_t start, int32_t end, 50 RectHeightStyle heightStyle, RectWidthStyle widthStyle) 51 { 52 return {}; 53 } 54 GetGlyphPositionAtCoordinate(int32_t x,int32_t y)55 virtual PositionWithAffinity GetGlyphPositionAtCoordinate(int32_t x, int32_t y) 56 { 57 PositionWithAffinity finalResult(0, TextAffinity::UPSTREAM); 58 return finalResult; 59 } 60 }; 61 } // namespace OHOS::Ace::NG 62 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_RICH_EDITOR_RICH_EDITOR_MODEL_H