fix incorrect calculaion of natural size in text
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-relayouter.h
index 4c62d89..a98ed53 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_CONTROLLER_RELAYOUTER_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
 namespace Text
 {
-
 /**
  * Contains all the relayouting related methods for Text::Controller
  */
@@ -88,21 +85,47 @@ struct Controller::Relayouter
   /**
    * @brief Called by the Controller to do certain operations when relayouting.
    *
-   * @param[in] controller A reference to the controller class
+   * @param[in] impl A reference to the controller impl class
    * @param[in] size The size to set
    * @param[in] operationsRequired The operations we need to do
    * @param[in/out] layoutSize The Layout size which can be updated depending on the result of the performed operations
    * @return
    */
-  static bool DoRelayout(Controller& controller, const Size& size, OperationsMask operationsRequired, Size& layoutSize );
+
+  static bool DoRelayout(Controller::Impl& impl, const Size& size, OperationsMask operationsRequired, Size& layoutSize);
 
   /**
    * @brief Called by the Controller to calculate the veritcal offset give the control size.
    *
-   * @param[in] controller A reference to the controller class
+   * @param[in] impl A reference to the controller impl class
    * @param[in] controlSize The control size
    */
-  static void CalculateVerticalOffset(Controller& controller, const Size& controlSize);
+  static void CalculateVerticalOffset(Controller::Impl& impl, const Size& controlSize);
+
+  /**
+  * @brief Calculates the layout size of control according to @p requestedControllerSize and @p requestedOperationsMask
+  *
+  * GetNaturalSize() and GetHeightForWidth() calls this method.
+  *
+  * @param[in] controller The controller to calcualte size on it.
+  * @param[in] requestedControllerSize The requested size of controller to calcualte layout size on it.
+  * @param[in] requestedOperationsMask The requested operations-mask to calcualte layout size according to it.
+  *
+  * @return The calculated layout-size.
+  */
+  static Size CalculateLayoutSizeOnRequiredControllerSize(Controller& controller, const Size& requestedControllerSize, const OperationsMask& requestedOperationsMask);
+
+private:
+  /**
+   * @brief Called by the DoRelayout to do HorizontalAlignment operation when relayouting.
+   *
+   * @param[in] impl A reference to the controller impl class
+   * @param[in] size The size to set
+   * @param[in] startIndex The start index for relayouting
+   * @param[in] requestedNumberOfCharacters The number Of characters for relayouting
+   */
+
+  static void DoRelayoutHorizontalAlignment(Controller::Impl& impl, const Size& size, const CharacterIndex startIndex, const Length requestedNumberOfCharacters);
 };
 
 } // namespace Text