Fix text AutoScroll ellipsis issue
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / layouts / layout-engine.h
old mode 100755 (executable)
new mode 100644 (file)
index af693da..9fa22c6
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H
 
 /*
- * Copyright (c) 2016 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.
  */
 
 // EXTERNAL INCLUDE
+#include <dali/public-api/actors/actor-enumerations.h>
 #include <dali/public-api/common/dali-vector.h>
 #include <dali/public-api/math/vector2.h>
-#include <dali/public-api/actors/actor-enumerations.h>
 
 // INTERNAL INCLUDE
-#include <dali-toolkit/public-api/text/text-enumerations.h>
 #include <dali-toolkit/internal/text/line-run.h>
 #include <dali-toolkit/internal/text/metrics.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
+
+//DEVEL INCLUDE
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
 namespace Text
 {
-
 namespace Layout
 {
-
 struct Parameters;
 
 /**
@@ -48,7 +47,6 @@ struct Parameters;
 class Engine
 {
 public:
-
   enum Type
   {
     SINGLE_LINE_BOX,
@@ -70,14 +68,14 @@ public:
    *
    * @param[in] metrics Used to get metrics
    */
-  void SetMetrics( MetricsPtr& metrics );
+  void SetMetrics(MetricsPtr& metrics);
 
   /**
    * @brief Choose the required layout.
    *
    * @param[in] layout The required layout.
    */
-  void SetLayout( Type layout );
+  void SetLayout(Type layout);
 
   /**
    * @brief Query the required layout.
@@ -91,7 +89,7 @@ public:
    *
    * @param[in] width The width of the cursor in pixels.
    */
-  void SetCursorWidth( int width );
+  void SetCursorWidth(int width);
 
   /**
    * @brief Retrieves the width of the cursor.
@@ -109,13 +107,17 @@ public:
    * @param[out] layoutSize The size of the text after it has been laid-out.
    * @param[in] elideTextEnabled Whether the text elide is enabled.
    * @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
+   * @param[in] isAutoScrollMaxTextureExceeded If isAutoScrollMaxTextureExceeded is true, enable ellipsis during auro scroll.
+   * @param[in] ellipsisPosition The location of the text ellipsis
    *
    * @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
    */
-  bool LayoutText( Parameters& layoutParameters,
-                   Size& layoutSize,
-                   bool elideTextEnabled,
-                   bool& isAutoScrollEnabled );
+  bool LayoutText(Parameters&                       layoutParameters,
+                  Size&                             layoutSize,
+                  bool                              elideTextEnabled,
+                  bool&                             isAutoScrollEnabled,
+                  bool                              isAutoScrollMaxTextureExceeded,
+                  DevelText::EllipsisPosition::Type ellipsisPosition);
 
   /**
    * @brief Aligns the laid out lines.
@@ -126,24 +128,24 @@ public:
    * @param[in] horizontalAlignment The horizontal alignment.
    * @param[in,out] lines The laid-out lines.
    * @param[out] alignmentOffset The alignment offset.
-   * @param[in] layoutDirection The direction of the system language.
-   * @param[in] matchSystemLanguageDirection Whether match align for system language direction or not.
+   * @param[in] layoutDirection The direction of the layout.
+   * @param[in] matchLayoutDirection Whether match align for layout direction or not.
    */
-  void Align( const Size& size,
-              CharacterIndex startIndex,
-              Length numberOfCharacters,
-              Text::HorizontalAlignment::Type horizontalAlignment,
-              Vector<LineRun>& lines,
-              float& alignmentOffset,
-              Dali::LayoutDirection::Type layoutDirection,
-              bool matchSystemLanguageDirection );
+  void Align(const Size&                     size,
+             CharacterIndex                  startIndex,
+             Length                          numberOfCharacters,
+             Text::HorizontalAlignment::Type horizontalAlignment,
+             Vector<LineRun>&                lines,
+             float&                          alignmentOffset,
+             Dali::LayoutDirection::Type     layoutDirection,
+             bool                            matchLayoutDirection);
 
   /**
    * @brief Sets the default line spacing.
    *
    * @param[in] lineSpacing The line spacing.
    */
-  void SetDefaultLineSpacing( float lineSpacing );
+  void SetDefaultLineSpacing(float lineSpacing);
 
   /**
    * @brief Retrieves the default line spacing.
@@ -152,16 +154,42 @@ public:
    */
   float GetDefaultLineSpacing() const;
 
-private:
+  /**
+   * @brief Sets the default line size.
+   *
+   * @param[in] lineSize The line size.
+   */
+  void SetDefaultLineSize(float lineSize);
 
+  /**
+   * @brief Retrieves the default line size.
+   *
+   * @return The line size.
+   */
+  float GetDefaultLineSize() const;
+
+  /**
+   * @brief Sets relative line size to the original line size.
+   *
+   * @param[in] relativeLineSize The relative line size.
+   */
+  void SetRelativeLineSize(float relativeLineSize);
+
+  /**
+   * @brief Retrieves the relative line size.
+   *
+   * @return The relative line size.
+   */
+  float GetRelativeLineSize() const;
+
+private:
   // Undefined
-  Engine( const Engine& handle );
+  Engine(const Engine& handle);
 
   // Undefined
-  Engine& operator=( const Engine& handle );
+  Engine& operator=(const Engine& handle);
 
 private:
-
   struct Impl;
   Impl* mImpl;
 };