X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fcontroller%2Ftext-controller-impl.h;h=cc6a8187aedd169784c0c69362aabd7f70715c57;hb=HEAD;hp=1844cb0eb93ff6f03b73837590a0423dd65c722e;hpb=9d8d52a56902e86c4495ea57680fdd0bb630b7a3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/controller/text-controller-impl.h b/dali-toolkit/internal/text/controller/text-controller-impl.h index 1844cb0..0b404cc 100644 --- a/dali-toolkit/internal/text/controller/text-controller-impl.h +++ b/dali-toolkit/internal/text/controller/text-controller-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ */ // EXTERNAL INCLUDES -#include #include #include @@ -27,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -331,17 +331,22 @@ struct Controller::Impl mEmbossDefaults(NULL), mOutlineDefaults(NULL), mEventData(NULL), + mIdleCallback(NULL), mFontClient(), mClipboard(), mView(), mMetrics(), mModifyEvents(), mTextColor(Color::BLACK), + mAnchorColor(Color::MEDIUM_BLUE), + mAnchorClickedColor(Color::DARK_MAGENTA), mTextUpdateInfo(), mOperationsPending(NO_OPERATION), mMaximumNumberOfCharacters(50u), mHiddenInput(NULL), mInputFilter(nullptr), + mTextFitContentSize(), + mTextFitArray(), mRecalculateNaturalSize(true), mMarkupProcessorEnabled(false), mClipboardHideEnabled(true), @@ -356,6 +361,7 @@ struct Controller::Impl mStrikethroughSetByString(false), mShouldClearFocusOnEscape(true), mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT), + mCurrentLineSize(0.f), mTextFitMinSize(DEFAULT_TEXTFIT_MIN), mTextFitMaxSize(DEFAULT_TEXTFIT_MAX), mTextFitStepSize(DEFAULT_TEXTFIT_STEP), @@ -365,15 +371,18 @@ struct Controller::Impl mFontSizeScaleEnabled(true), mTextFitEnabled(false), mTextFitChanged(false), + mTextFitArrayEnabled(false), mIsLayoutDirectionChanged(false), - mIsUserInteractionEnabled(true) + mIsUserInteractionEnabled(true), + mProcessorRegistered(false), + mTextCutout(false) { mModel = Model::New(); mFontClient = TextAbstraction::FontClient::Get(); - if(mEditableControlInterface != nullptr && TextClipboard::IsAvailable()) + if(mEditableControlInterface != nullptr && Clipboard::IsAvailable()) { - mClipboard = TextClipboard::Get(); + mClipboard = Clipboard::Get(); } mView.SetVisualModel(mModel->mVisualModel); @@ -390,8 +399,7 @@ struct Controller::Impl Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get(); if(styleManager) { - const Property::Map& config = Toolkit::DevelStyleManager::GetConfigurations(styleManager); - const auto clearFocusOnEscapeValue = config.Find("clearFocusOnEscape", Property::Type::BOOLEAN); + const auto clearFocusOnEscapeValue = Toolkit::DevelStyleManager::GetConfigurations(styleManager).Find("clearFocusOnEscape", Property::Type::BOOLEAN); // Default is true. If config don't have "clearFocusOnEscape" property, make it true. mShouldClearFocusOnEscape = (!clearFocusOnEscapeValue || clearFocusOnEscapeValue->Get()); @@ -436,6 +444,16 @@ struct Controller::Impl } /** + * @copydoc Text::Controller::ResetFontAndStyleData() + */ + void ResetFontAndStyleData() + { + ClearFontData(); + ClearStyleData(); + RequestRelayout(); + } + + /** * @brief Helper to move the cursor, grab handle etc. */ bool ProcessInputEvents(); @@ -513,6 +531,31 @@ struct Controller::Impl } /** + * @copydoc Controller::SetAnchorColor() + */ + void SetAnchorColor(const Vector4& color); + + /** + * @copydoc Controller::GetAnchorColor() + */ + const Vector4& GetAnchorColor() const; + + /** + * @copydoc Controller::SetAnchorClickedColor() + */ + void SetAnchorClickedColor(const Vector4& color); + + /** + * @copydoc Controller::GetAnchorClickedColor() + */ + const Vector4& GetAnchorClickedColor() const; + + /** + * @brief Updates the color of anchors. + */ + void UpdateAnchorColor(); + + /** * @brief Helper to notify InputMethodContext with surrounding text & cursor changes. */ void NotifyInputMethodContext(); @@ -568,25 +611,27 @@ struct Controller::Impl { if(!mClipboard) { - mClipboard = TextClipboard::Get(); + mClipboard = Clipboard::Get(); } return mClipboard != nullptr ? true : false; } - bool IsClipboardEmpty() - { - bool result(TextClipboard::IsAvailable() && EnsureClipboardCreated() && mClipboard.NumberOfItems()); - return !result; // If NumberOfItems greater than 0, return false - } - bool IsClipboardVisible() { - bool result(TextClipboard::IsAvailable() && EnsureClipboardCreated() && mClipboard.IsVisible()); + bool result(Clipboard::IsAvailable() && EnsureClipboardCreated() && mClipboard.IsVisible()); return result; } /** + * @brief Whether the clipboard is empty or not. + * Checks the types that the text controller can paste and returns the result. + * + * @return Return whether or not the clipboard is empty. + */ + bool IsClipboardEmpty(); + + /** * @copydoc Controller::GetLayoutDirection() */ Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const; @@ -734,8 +779,6 @@ struct Controller::Impl void SendSelectionToClipboard(bool deleteAfterSending); - void RequestGetTextFromClipboard(); - void RepositionSelectionHandles(); void RepositionSelectionHandles(float visualX, float visualY, Controller::NoTextTap::Action action); @@ -1015,13 +1058,16 @@ public: EmbossDefaults* mEmbossDefaults; ///< Avoid allocating this when the user does not specify emboss parameters. OutlineDefaults* mOutlineDefaults; ///< Avoid allocating this when the user does not specify outline parameters. EventData* mEventData; ///< Avoid allocating everything for text input until EnableTextInput(). + CallbackBase* mIdleCallback; ///< Callback what would be called at idler TextAbstraction::FontClient mFontClient; ///< Handle to the font client. - TextClipboard mClipboard; ///< Handle to the system clipboard + Clipboard mClipboard; ///< Handle to the system clipboard View mView; ///< The view interface to the rendering back-end. MetricsPtr mMetrics; ///< A wrapper around FontClient used to get metrics & potentially down-scaled Emoji metrics. Layout::Engine mLayoutEngine; ///< The layout engine. Vector mModifyEvents; ///< Temporary stores the text set until the next relayout. Vector4 mTextColor; ///< The regular text color + Vector4 mAnchorColor; ///< The anchor color + Vector4 mAnchorClickedColor; ///< The anchor clicked color TextUpdateInfo mTextUpdateInfo; ///< Info of the characters updated. OperationsMask mOperationsPending; ///< Operations pending to be done to layout the text. Length mMaximumNumberOfCharacters; ///< Maximum number of characters that can be inserted. @@ -1029,6 +1075,8 @@ public: std::unique_ptr mInputFilter; ///< Avoid allocating this when the user does not specify input filter mode. Vector2 mTextFitContentSize; ///< Size of Text fit content + std::vector mTextFitArray; ///< List of FitOption for TextFitArray operation. + bool mRecalculateNaturalSize : 1; ///< Whether the natural size needs to be recalculated. bool mMarkupProcessorEnabled : 1; ///< Whether the mark-up procesor is enabled. bool mClipboardHideEnabled : 1; ///< Whether the ClipboardHide function work or not @@ -1047,6 +1095,7 @@ public: Shader mShaderBackground; ///< The shader for text background. + float mCurrentLineSize; ///< Used to store the MinLineSize set by user when TextFitArray is enabled. float mTextFitMinSize; ///< Minimum Font Size for text fit. Default 10 float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100 float mTextFitStepSize; ///< Step Size for font intervalse. Default 1 @@ -1056,8 +1105,11 @@ public: bool mFontSizeScaleEnabled : 1; ///< Whether the font size scale is enabled. bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled. bool mTextFitChanged : 1; ///< Whether the text fit property has changed. + bool mTextFitArrayEnabled : 1; ///< Whether the text's fit array is enabled. bool mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed. bool mIsUserInteractionEnabled : 1; ///< Whether the user interaction is enabled. + bool mProcessorRegistered : 1; ///< Whether the text controller registered into processor or not. + bool mTextCutout : 1; ///< Whether the text cutout enabled. private: friend ControllerImplEventHandler;