Extending Text Styles - Adding Dashed/Double Underline
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.h
index e49971a..e697d81 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -356,8 +356,10 @@ struct Controller::Impl
     mTextFitMinSize(DEFAULT_TEXTFIT_MIN),
     mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
     mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
-    mTextFitEnabled(false),
     mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
+    mFontSizeScaleEnabled(true),
+    mTextFitEnabled(false),
+    mTextFitChanged(false),
     mIsLayoutDirectionChanged(false)
   {
     mModel = Model::New();
@@ -496,6 +498,11 @@ struct Controller::Impl
     }
   }
 
+  float GetFontSizeScale()
+  {
+    return mFontSizeScaleEnabled ? mFontSizeScale : 1.0f;
+  }
+
   /**
    * @brief Helper to notify InputMethodContext with surrounding text & cursor changes.
    */
@@ -523,6 +530,13 @@ struct Controller::Impl
   Length GetNumberOfWhiteSpaces(CharacterIndex index) const;
 
   /**
+   * @brief Retrieve any text previously set.
+   *
+   * @param[out] text A string of UTF-8 characters.
+   */
+  void GetText(std::string& text) const;
+
+  /**
    * @brief Retrieve any text previously set starting from the given @p index.
    *
    * @param[in] index The character index from where to retrieve the text.
@@ -550,6 +564,12 @@ struct Controller::Impl
   Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
 
   /**
+   * @brief Checks text direction.
+   * @return The text direction.
+   */
+  Toolkit::DevelText::TextDirection::Type GetTextDirection();
+
+  /**
    * @brief Calculates the start character index of the first paragraph to be updated and
    * the end character index of the last paragraph to be updated.
    *
@@ -615,6 +635,21 @@ struct Controller::Impl
   bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
 
   /**
+   * @copydoc Text::SelectableControlInterface::GetSelectedText()
+   */
+  string GetSelectedText();
+
+  /**
+   * @copydoc Text::EditableControlInterface::CopyText()
+   */
+  string CopyText();
+
+  /**
+   * @copydoc Text::EditableControlInterface::CutText()
+   */
+  string CutText();
+
+  /**
    * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
    */
   void SetTextSelectionRange(const uint32_t* pStart, const uint32_t* pEndf);
@@ -755,13 +790,6 @@ struct Controller::Impl
   void ScrollTextToMatchCursor();
 
   /**
-   * @brief Create an actor that renders the text background color
-   *
-   * @return the created actor or an empty handle if no background color needs to be rendered.
-   */
-  Actor CreateBackgroundActor();
-
-  /**
    * @brief fill needed relayout parameters when line size is changed & request relayout.
    */
   void RelayoutForNewLineSize();
@@ -945,6 +973,7 @@ public:
   bool                  mShadowSetByString : 1;        ///< Set when shadow is set by string (legacy) instead of map
   bool                  mOutlineSetByString : 1;       ///< Set when outline is set by string (legacy) instead of map
   bool                  mFontStyleSetByString : 1;     ///< Set when font style is set by string (legacy) instead of map
+  bool                  mStrikethroughSetByString : 1; ///< Set when strikethrough is set by string (legacy) instead of map
   bool                  mShouldClearFocusOnEscape : 1; ///< Whether text control should clear key input focus
   LayoutDirection::Type mLayoutDirection;              ///< Current system language direction
 
@@ -953,9 +982,10 @@ public:
   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
-  bool  mTextFitEnabled : 1;           ///< Whether the text's fit is enabled.
-  float mTextFitChanged;               ///< Whether the text fit property has changed.
   float mFontSizeScale;                ///< Scale value for Font Size. Default 1.0
+  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  mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
 
 private: