TextView - Rename Line to Paragraph.
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-view / text-view-processor-types.h
index 55be5a8..71fd214 100644 (file)
@@ -35,20 +35,11 @@ namespace TextViewProcessor
 {
 
 /**
- * Whether the direction is Right To Left or Left To Right.
- */
-enum Direction
-{
-  LTR, ///< Left To Right direction.
-  RTL  ///< Right To Left direction.
-};
-
-/**
- * Whether the text is a new line character, a white space or normal text.
+ * Whether the text is a new paragraph character '\n', a white space or normal text.
  */
 enum TextSeparatorType
 {
-  LineSeparator,
+  ParagraphSeparator,
   WordSeparator,
   NoSeparator
 };
@@ -70,14 +61,15 @@ struct TextInfoIndices
 {
   /**
    * Default constructor.
+   *
+   * Initializes all members to their default values.
    */
   TextInfoIndices();
 
   /**
    * Constructor.
    */
-  TextInfoIndices( std::size_t lineIndex,
-                   std::size_t groupIndex,
+  TextInfoIndices( std::size_t paragraphIndex,
                    std::size_t wordIndex,
                    std::size_t characterIndex );
 
@@ -89,10 +81,9 @@ struct TextInfoIndices
    */
   bool operator==( const TextInfoIndices& indices ) const;
 
-  std::size_t mLineIndex;
-  std::size_t mGroupIndex;
-  std::size_t mWordIndex;
-  std::size_t mCharacterIndex;
+  std::size_t mParagraphIndex;          ///< The paragraph index within the text.
+  std::size_t mWordIndex;               ///< The word index within the paragraph.
+  std::size_t mCharacterIndex;          ///< The character index within the word.
 };
 
 /**
@@ -109,6 +100,13 @@ struct CharacterLayoutInfo
   CharacterLayoutInfo();
 
   /**
+   * Default destructor.
+   *
+   * Deletes the gradient info.
+   */
+  ~CharacterLayoutInfo();
+
+  /**
    * Copy constructor.
    */
   CharacterLayoutInfo( const CharacterLayoutInfo& character );
@@ -158,6 +156,13 @@ struct WordLayoutInfo
   WordLayoutInfo();
 
   /**
+   * Default destructor.
+   *
+   * Clears all characters.
+   */
+  ~WordLayoutInfo();
+
+  /**
    * Copy constructor.
    */
   WordLayoutInfo( const WordLayoutInfo& word );
@@ -175,64 +180,41 @@ struct WordLayoutInfo
 typedef std::vector<WordLayoutInfo> WordLayoutInfoContainer;
 
 /**
- * Layout information for a group of words.
+ * Layout information for a paragraph.
  */
-struct WordGroupLayoutInfo
+struct ParagraphLayoutInfo
 {
   /**
    * Default constructor.
    *
    * Initializes all members to their default values.
    */
-  WordGroupLayoutInfo();
-
-  /**
-   * Copy constructor.
-   */
-  WordGroupLayoutInfo( const WordGroupLayoutInfo& group );
-
-  /**
-   * Assignment operator.
-   */
-  WordGroupLayoutInfo& operator=( const WordGroupLayoutInfo& group );
-
-  Size                    mSize;               ///< Size of the group of words.
-  float                   mAscender;           ///< Max of all ascenders of all words.
-  Direction               mDirection;          ///< Whether this group of words is Right To Left or Left To Right.
-  WordLayoutInfoContainer mWordsLayoutInfo;    ///< Layout info for all words.
-  std::size_t             mNumberOfCharacters; ///< Stores the number of characters.
-};
-typedef std::vector<WordGroupLayoutInfo> WordGroupLayoutInfoContainer;
+  ParagraphLayoutInfo();
 
-/**
- * Layout information for a line.
- */
-struct LineLayoutInfo
-{
   /**
-   * Default constructor.
+   * Default destructor.
    *
-   * Initializes all members to their default values.
+   * Clears all words and deletes all text styles.
    */
-  LineLayoutInfo();
+  ~ParagraphLayoutInfo();
 
   /**
    * Copy constructor.
    */
-  LineLayoutInfo( const LineLayoutInfo& line );
+  ParagraphLayoutInfo( const ParagraphLayoutInfo& paragraph );
 
   /**
    * Assignment operator.
    */
-  LineLayoutInfo& operator=( const LineLayoutInfo& line );
+  ParagraphLayoutInfo& operator=( const ParagraphLayoutInfo& paragraph );
 
-  Size                         mSize;                 ///< Size of the line.
-  float                        mAscender;             ///< Max of all ascenders of all groups of words.
-  float                        mLineHeightOffset;     ///< Line height offset.
-  WordGroupLayoutInfoContainer mWordGroupsLayoutInfo; ///< Layout info for all groups of words.
-  std::size_t                  mNumberOfCharacters;   ///< Stores the number of characters.
+  Size                                          mSize;                       ///< Size of the paragraph.
+  float                                         mAscender;                   ///< Max of all ascenders of all words.
+  float                                         mLineHeightOffset;           ///< Line height offset.
+  std::size_t                                   mNumberOfCharacters;         ///< Stores the number of characters.
+  WordLayoutInfoContainer                       mWordsLayoutInfo;            ///< Layout info for all words.
 };
-typedef std::vector<LineLayoutInfo> LineLayoutInfoContainer;
+typedef std::vector<ParagraphLayoutInfo> ParagraphLayoutInfoContainer;
 
 /**
  * Layout information for the whole text.
@@ -256,12 +238,12 @@ struct TextLayoutInfo
    */
   TextLayoutInfo& operator=( const TextLayoutInfo& text );
 
-  Size                    mWholeTextSize;                 ///< width and height of the whole text.
-  float                   mMaxWordWidth;                  ///< maximum width between all words.
-  LineLayoutInfoContainer mLinesLayoutInfo;               ///< Layout information for all lines.
-  std::size_t             mNumberOfCharacters;            ///< Stores the number of characters.
-  float                   mMaxItalicsOffset;              ///< When rendering text-view in offscreen an extra width offset is needed to prevent italic characters to be cut if they are in the right edge.
-  WordLayoutInfo          mEllipsizeLayoutInfo;           ///< Layout information for the ellipsize text.
+  Size                         mWholeTextSize;        ///< width and height of the whole text.
+  float                        mMaxWordWidth;         ///< maximum width between all words.
+  float                        mMaxItalicsOffset;     ///< When rendering text-view in offscreen an extra width offset is needed to prevent italic characters to be cut if they are in the right edge.
+  std::size_t                  mNumberOfCharacters;   ///< Stores the number of characters.
+  ParagraphLayoutInfoContainer mParagraphsLayoutInfo; ///< Layout information for all paragraphs.
+  WordLayoutInfo               mEllipsizeLayoutInfo;  ///< Layout information for the ellipsize text.
 };
 
 } // namespace TextViewProcessor