Fix text AutoScroll ellipsis issue
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller.h
index a582110..0def96f 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_CONTROLLER_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.
@@ -23,9 +23,9 @@
 #include <dali/public-api/events/gesture.h>
 
 // INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/text-controls/text-anchor-devel.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
-#include <dali-toolkit/devel-api/controls/text-controls/text-anchor-devel.h>
 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
 #include <dali-toolkit/internal/text/decorator/text-decorator.h>
 #include <dali-toolkit/internal/text/hidden-text.h>
@@ -257,6 +257,15 @@ public: // Configure the text controller.
   void SetAutoScrollEnabled(bool enable);
 
   /**
+   * @brief Whether the auto scrolling texture exceed max texture.
+   *
+   * By default is false.
+   *
+   * @param[in] exceed Whether the auto scrolling texture exceed max texture.
+   */
+  void SetAutoScrollMaxTextureExceeded(bool exceed);
+
+  /**
    * @brief Retrieves whether auto text scrolling is enabled.
    *
    * By default is disabled.
@@ -504,6 +513,20 @@ public: // Configure the text controller.
   bool IsTextFitChanged() const;
 
   /**
+   * @brief Sets disabled color opacity.
+   *
+   * @param[in] opacity The color opacity value in disabled state.
+   */
+  void SetDisabledColorOpacity(float opacity);
+
+  /**
+   * @brief Retrieves the disabled color opacity.
+   *
+   * @return The disabled color opacity value for disabled state.
+   */
+  float GetDisabledColorOpacity() const;
+
+  /**
    * @brief Enable or disable the placeholder text elide.
    * @param enabled Whether to enable the placeholder text elide.
    */
@@ -659,6 +682,60 @@ public: // Configure the text controller.
    */
   void FontStyleSetByString(bool setByString);
 
+  /**
+   * @brief Query if Strikethrough settings were provided by string or map
+   * @return bool true if set by string
+   */
+  bool IsStrikethroughSetByString();
+
+  /**
+   * Set method Strikethrough setting were set by
+   * @param[in] bool, true if set by string
+   */
+  void StrikethroughSetByString(bool setByString);
+
+  /**
+   * @brief Set the override used for strikethrough height, 0 indicates height will be supplied by font metrics
+   *
+   * @param[in] height The height in pixels of the strikethrough
+   */
+  void SetStrikethroughHeight(float height);
+
+  /**
+   * @brief Retrieves the override height of an strikethrough, 0 indicates height is supplied by font metrics
+   *
+   * @return The height of the strikethrough, or 0 if height is not overrided.
+   */
+  float GetStrikethroughHeight() const;
+
+  /**
+   * @brief Set the strikethrough color.
+   *
+   * @param[in] color color of strikethrough.
+   */
+  void SetStrikethroughColor(const Vector4& color);
+
+  /**
+   * @brief Retrieve the strikethrough color.
+   *
+   * @return The strikethrough color.
+   */
+  const Vector4& GetStrikethroughColor() const;
+
+  /**
+   * @brief Set the strikethrough enabled flag.
+   *
+   * @param[in] enabled The strikethrough enabled flag.
+   */
+  void SetStrikethroughEnabled(bool enabled);
+
+  /**
+   * @brief Returns whether the text has a strikethrough or not.
+   *
+   * @return The strikethrough state.
+   */
+  bool IsStrikethroughEnabled() const;
+
 public: // Update.
   /**
    * @brief Replaces any text previously set.
@@ -908,6 +985,20 @@ public: // Default style & Input style
   float GetFontSizeScale() const;
 
   /**
+   * @brief Set the font size scale enabled flag.
+   *
+   * @param[in] enabled whether to enable the font size scale.
+   */
+  void SetFontSizeScaleEnabled(bool enabled);
+
+  /**
+   * @brief Returns whether the font size scale is enabled or not.
+   *
+   * @return @e true if the font size scale is enabled, otherwise returns @e false.
+   */
+  bool IsFontSizeScaleEnabled() const;
+
+  /**
    * @brief Sets the Placeholder text font size.
    * @param[in] fontSize The placeholder text font size
    * @param[in] type The font size type is point size or pixel size
@@ -936,6 +1027,20 @@ public: // Default style & Input style
   const Vector4& GetDefaultColor() const;
 
   /**
+   * @brief Sets the user interaction enabled.
+   *
+   * @param enabled whether to enable the user interaction.
+   */
+  void SetUserInteractionEnabled(bool enabled);
+
+  /**
+   * @brief Whether the user interaction is enabled.
+   *
+   * @return true if the user interaction is enabled, false otherwise.
+   */
+  bool IsUserInteractionEnabled() const;
+
+  /**
    * @brief Set the text color
    *
    * @param textColor The text color
@@ -1034,6 +1139,46 @@ public: // Default style & Input style
   float GetUnderlineHeight() const;
 
   /**
+   * @brief Sets the underline type.
+   * @param[in] type The underline type.
+   */
+  void SetUnderlineType(Text::Underline::Type type);
+
+  /**
+   * @brief Retrieve underline type.
+   * @return The underline type.
+   */
+  Text::Underline::Type GetUnderlineType() const;
+
+  /**
+   * @brief Set the width of the dashes of the dashed underline.
+   *
+   * @param[in] width The width in pixels of the dashes of the dashed underline.
+   */
+  void SetDashedUnderlineWidth(float width);
+
+  /**
+   * @brief Retrieves the width of the dashes of the dashed underline.
+   *
+   * @return The width of the dashes of the dashed underline.
+   */
+  float GetDashedUnderlineWidth() const;
+
+  /**
+   * @brief Set the gap between the dashes of the dashed underline.
+   *
+   * @param[in] gap The gap between the dashes of the dashed underline.
+   */
+  void SetDashedUnderlineGap(float gap);
+
+  /**
+   * @brief Retrieves the gap between the dashes of the dashed underline.
+   *
+   * @return The The gap between the dashes of the dashed underline.
+   */
+  float GetDashedUnderlineGap() const;
+
+  /**
    * @brief Set the outline color.
    *
    * @param[in] color color of outline.
@@ -1154,6 +1299,22 @@ public: // Default style & Input style
   float GetDefaultLineSize() const;
 
   /**
+   * @brief Sets the relative line size to the original line size.
+   *
+   * @param[in] relativeLineSize The relativeline size.
+   *
+   * @return True if relativeLineSize has been updated, false otherwise
+   */
+  bool SetRelativeLineSize(float lineSize);
+
+  /**
+   * @brief Retrieves the relative line size.
+   *
+   * @return The relative line size.
+   */
+  float GetRelativeLineSize() const;
+
+  /**
    * @brief Sets the input text's color.
    *
    * @param[in] color The input text's color.
@@ -1331,6 +1492,22 @@ public: // Default style & Input style
   const std::string& GetInputOutlineProperties() const;
 
   /**
+   * @brief Sets the input strikethrough's properties string.
+   *
+   * @note The string is stored to be recovered.
+   *
+   * @param[in] strikethroughProperties The strikethrough's properties string.
+   */
+  void SetInputStrikethroughProperties(const std::string& strikethroughProperties);
+
+  /**
+   * @brief Retrieves the input strikethrough's properties string.
+   *
+   * @return The strikethrough's properties string.
+   */
+  const std::string& GetInputStrikethroughProperties() const;
+
+  /**
    * @brief Set the control's interface.
    *
    * @param[in] controlInterface The control's interface.
@@ -1344,6 +1521,24 @@ public: // Default style & Input style
    */
   void SetAnchorControlInterface(AnchorControlInterface* anchorControlInterface);
 
+  /**
+   * @brief Sets the character spacing.
+   *
+   * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
+   *
+   * @param[in] characterSpacing The character spacing.
+   */
+  void SetCharacterSpacing(float characterSpacing);
+
+  /**
+   * @brief Retrieves the character spacing.
+   *
+   * @note A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
+   *
+   * @return The character spacing.
+   */
+  const float GetCharacterSpacing() const;
+
 public: // Queries & retrieves.
   /**
    * @brief Return the layout engine.
@@ -1516,6 +1711,37 @@ public: // Queries & retrieves.
   Dali::LayoutDirection::Type GetLayoutDirection(Dali::Actor& actor) const;
 
   /**
+   * @brief Get the rendered size of a specific text range.
+   * if the requested text is at multilines, multiple sizes will be returned for each text located in a separate line.
+   * if a line contains characters with different directions, multiple sizes will be returned for each block of contiguous characters with the same direction.
+   *
+   * @param[in] startIndex start index of the text requested to calculate size for.
+   * @param[in] endIndex end index(included) of the text requested to calculate size for.
+   * @return list of sizes of the reuested text.
+   */
+  Vector<Vector2> GetTextSize(CharacterIndex startIndex, CharacterIndex endIndex);
+
+  /**
+   * @brief Get the top/left rendered position of a specific text range.
+   * if the requested text is at multilines, multiple positions will be returned for each text located in a separate line.
+   * if a line contains characters with different directions, multiple positions will be returned for each block of contiguous characters with the same direction.
+   *
+   * @param[in] startIndex start index of the text requested to get position to.
+   * @param[in] endIndex end index(included) of the text requested to get position to.
+   * @return list of positions of the requested text.
+   */
+  Vector<Vector2> GetTextPosition(CharacterIndex startIndex, CharacterIndex endIndex);
+
+  /**
+   * @brief Gets the bounding box of a specific text range.
+   *
+   * @param[in] startIndex start index of the text requested to get bounding box to.
+   * @param[in] endIndex end index(included) of the text requested to get bounding box to.
+   * @return bounding box of the requested text.
+   */
+  Rect<> GetTextBoundingRectangle(CharacterIndex startIndex, CharacterIndex endIndex);
+
+  /**
    * @brief Sets the layout direction changed.
    */
   void ChangedLayoutDirection();
@@ -1771,7 +1997,7 @@ protected: // Inherit from Text::Decorator::ControllerInterface.
   /**
    * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::AddDecoration()
    */
-  void AddDecoration(Actor& actor, bool needsClipping) override;
+  void AddDecoration(Actor& actor, DecorationType type, bool needsClipping) override;
 
   /**
    * @copydoc Dali::Toolkit::Text::Decorator::ControllerInterface::DecorationEvent()