1 /* 2 * Copyright (c) 2022-2023 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 FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_TEXT_MODEL_IMPL_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_TEXT_MODEL_IMPL_H 18 19 #include <functional> 20 #include <string> 21 22 #include "core/components/text/text_component_v2.h" 23 #include "core/components_ng/pattern/text/text_model.h" 24 25 namespace OHOS::Ace::Framework { 26 class ACE_EXPORT TextModelImpl : public TextModel { 27 public: 28 void Create(const std::string& content) override; 29 void SetFont(const Font& value) override; 30 void SetFontSize(const Dimension& value) override; 31 void SetTextColor(const Color& value) override; 32 void SetTextShadow(const std::vector<Shadow>& value) override; SetTextSelection(int32_t startIndex,int32_t endIndex)33 void SetTextSelection(int32_t startIndex, int32_t endIndex) override {}; 34 void SetItalicFontStyle(Ace::FontStyle value) override; 35 void SetFontWeight(FontWeight value) override; 36 void SetFontFamily(const std::vector<std::string>& value) override; 37 void SetTextAlign(TextAlign value) override; 38 void SetTextOverflow(TextOverflow value) override; 39 void SetMaxLines(uint32_t value) override; 40 void SetTextIndent(const Dimension& value) override; 41 void SetLineHeight(const Dimension& value) override; 42 void SetTextDecoration(TextDecoration value) override; 43 void SetTextDecorationColor(const Color& value) override; 44 void SetTextDecorationStyle(TextDecorationStyle value) override; 45 void SetBaselineOffset(const Dimension& value) override; 46 void SetTextCase(TextCase value) override; SetWordBreak(WordBreak value)47 void SetWordBreak(WordBreak value) override {}; 48 void SetLetterSpacing(const Dimension& value) override; 49 void SetAdaptMinFontSize(const Dimension& value) override; 50 void SetAdaptMaxFontSize(const Dimension& value) override; 51 void SetHeightAdaptivePolicy(TextHeightAdaptivePolicy value) override; 52 void SetTextDetectEnable(bool value) override; 53 void SetTextDetectConfig(const std::string& value, std::function<void(const std::string&)>&& onResult) override; 54 void OnSetHeight() override; 55 void OnSetWidth() override; 56 void OnSetAlign() override; 57 void SetOnClick(std::function<void(const BaseEventInfo*)>&& click) override; ClearOnClick()58 void ClearOnClick() override {}; 59 void SetRemoteMessage(std::function<void()>&& event) override; 60 void SetCopyOption(CopyOptions copyOption) override; SetOnCopy(std::function<void (const std::string &)> && func)61 void SetOnCopy(std::function<void(const std::string&)>&& func) override {}; SetEllipsisMode(EllipsisMode modal)62 void SetEllipsisMode(EllipsisMode modal) override {}; SetClipEdge()63 void SetClipEdge() override {}; 64 65 void SetOnDragStart(NG::OnDragStartFunc&& onDragStart) override; 66 void SetOnDragEnter(NG::OnDragDropFunc&& onDragEnter) override; 67 void SetOnDragMove(NG::OnDragDropFunc&& onDragMove) override; 68 void SetOnDragLeave(NG::OnDragDropFunc&& onDragLeave) override; 69 void SetOnDrop(NG::OnDragDropFunc&& onDrop) override; 70 void SetDraggable(bool draggable) override; 71 void SetMenuOptionItems(std::vector<NG::MenuOptionsParam>&& menuOptionsItems) override; 72 73 private: 74 static RefPtr<TextComponentV2> GetComponent(); 75 }; 76 } // namespace OHOS::Ace::Framework 77 78 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_TEXT_MODEL_IMPL_H 79