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=faa8772fa4b450c4c0c3d4425eaf55f8082d9163;hpb=020b07151378db83ab8e12eb3e2d51db0ed69996;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 faa8772..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) 2022 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,14 +19,14 @@ */ // EXTERNAL INCLUDES -#include #include #include // INTERNAL INCLUDES #include -#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,21 +361,29 @@ 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), + mTextFitLineSize(0.f), mFontSizeScale(DEFAULT_FONT_SIZE_SCALE), mDisabledColorOpacity(DEFAULT_DISABLED_COLOR_OPACITY), 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(); - mClipboard = Clipboard::Get(); + if(mEditableControlInterface != nullptr && Clipboard::IsAvailable()) + { + mClipboard = Clipboard::Get(); + } mView.SetVisualModel(mModel->mVisualModel); mView.SetLogicalModel(mModel->mLogicalModel); @@ -386,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()); @@ -432,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(); @@ -509,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(); @@ -551,19 +598,40 @@ struct Controller::Impl */ void GetText(CharacterIndex index, std::string& text) const; - bool IsClipboardEmpty() + /** + * @brief Retrieves number of characters previously set. + * + * @return A length of UTF-32 characters. + * + * @see Dali::Toolkit::Text::Controller::GetNumberOfCharacters() + */ + Length GetNumberOfCharacters() const; + + bool EnsureClipboardCreated() { - bool result(mClipboard && mClipboard.NumberOfItems()); - return !result; // If NumberOfItems greater than 0, return false + if(!mClipboard) + { + mClipboard = Clipboard::Get(); + } + + return mClipboard != nullptr ? true : false; } bool IsClipboardVisible() { - bool result(mClipboard && 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; @@ -711,8 +779,6 @@ struct Controller::Impl void SendSelectionToClipboard(bool deleteAfterSending); - void RequestGetTextFromClipboard(); - void RepositionSelectionHandles(); void RepositionSelectionHandles(float visualX, float visualY, Controller::NoTextTap::Action action); @@ -992,6 +1058,7 @@ 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. Clipboard mClipboard; ///< Handle to the system clipboard View mView; ///< The view interface to the rendering back-end. @@ -999,6 +1066,8 @@ public: 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. @@ -1006,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 @@ -1024,16 +1095,21 @@ 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 + float mTextFitLineSize; ///< This is the LineSize that is the standard when performing TextFit. float mFontSizeScale; ///< Scale value for Font Size. Default 1.0 float mDisabledColorOpacity; ///< Color opacity when disabled. 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;