TextView - Right to Left implementation.
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-view / text-view-word-processor.h
index ab03c6b..82f36f0 100644 (file)
@@ -19,8 +19,7 @@
  */
 
 // INTERNAL INCLUDES
-#include "text-view-impl.h"
-#include "text-view-processor-types.h"
+#include <dali-toolkit/internal/controls/text-view/text-view-impl.h>
 
 namespace Dali
 {
@@ -37,11 +36,23 @@ namespace TextViewProcessor
 /**
  * Creates a data structure with info to layout the word, and data structures with useful info to modify the layout data structure if characters are added or removed.
  *
- * @param[in] word The styled word.
+ * @param[in] paragraphText The paragraph's text.
+ * @param[in] textStyles The styles for each character of the paragraph.
  * @param[out] wordLayoutInfo Layout info for all characters of the word.
  */
-void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
-                         TextViewProcessor::WordLayoutInfo& wordLayoutInfo );
+void CreateWordTextInfo( const Text& paragraphText,
+                         Vector<TextStyle*>& textStyles,
+                         WordLayoutInfo& wordLayoutInfo );
+
+/**
+ * Updates the word size and ascender.
+ *
+ * It's called after deleting some characters, split a word in two,
+ * or when a new word is created when right to left text is reordered.
+ *
+ * @param[in] wordLayout The word layout info.
+ */
+void UpdateLayoutInfo( WordLayoutInfo& wordLayout );
 
 /**
  * Removes a given number of characters from the given word.
@@ -49,28 +60,28 @@ void CreateWordTextInfo( const MarkupProcessor::StyledTextArray& word,
  * It calls the RemoveCharactersFromWord() function to remove characters from the word.
  *
  * If the word is a white space \e mergeWords will return \e true and \e textInfoMergeIndicesBegin and \e textInfoMergeIndicesEnd will be set to merge the two adjacent words.
- * If the word is a new line character \e mergeLines will return \e true and \e textInfoMergeIndicesBegin and \e textInfoMergeIndicesEnd will be set to merge the two lines.
+ * If the word is a new paragraph character \e mergeParagraphs will return \e true and \e textInfoMergeIndicesBegin and \e textInfoMergeIndicesEnd will be set to merge the two paragraphs.
  *
  * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
  * @param[in] numberOfCharacters The number of characters to be deleted.
  * @param[out] mergeWords Whether adjacent words need to be merged.
- * @param[out] mergeLines Whether current line need to be merged with the next one.
- * @param[in,out] textInfoIndicesBegin Indices to the line, word and characters from where to delete characters. It returns from where words need to be removed.
- * @param[out] textInfoIndicesEnd If lines or words need to be merged it returns info to delete them (If a word is merged, it has to be removed. Equal for lines).
- * @param[out] textInfoMergeIndicesBegin The indices to the first part of the line, group and word to be merged.
- * @param[out] textInfoMergeIndicesEnd The indices to the last part of the line, group and word to be merged.
- * @param[in,out] groupLayout Layout info of the group of words where the word is located.
+ * @param[out] mergeParagraphs Whether current paragraph need to be merged with the next one.
+ * @param[in,out] textInfoIndicesBegin Indices to the paragraph, word and characters from where to delete characters. It returns from where words need to be removed.
+ * @param[out] textInfoIndicesEnd If paragraphs or words need to be merged it returns info to delete them (If a word is merged, it has to be removed. Equal for paragraphs).
+ * @param[out] textInfoMergeIndicesBegin The indices to the first part of the paragraph and word to be merged.
+ * @param[out] textInfoMergeIndicesEnd The indices to the last part of the paragraph and word to be merged.
+ * @param[in,out] paragraphLayout Layout info of the paragraph where the word is located.
  * @param[out] removedTextActors Stores handles of temoved text-actors.
  */
 void RemoveCharactersFromWordInfo( TextView::RelayoutData& relayoutData,
                                    std::size_t numberOfCharacters,
                                    bool& mergeWords,
-                                   bool& mergeLines,
-                                   TextViewProcessor::TextInfoIndices& textInfoIndicesBegin,
-                                   TextViewProcessor::TextInfoIndices& textInfoIndicesEnd,
-                                   TextViewProcessor::TextInfoIndices& textInfoMergeIndicesBegin,
-                                   TextViewProcessor::TextInfoIndices& textInfoMergeIndicesEnd,
-                                   TextViewProcessor::WordGroupLayoutInfo& groupLayout,
+                                   bool& mergeParagraphs,
+                                   TextInfoIndices& textInfoIndicesBegin,
+                                   TextInfoIndices& textInfoIndicesEnd,
+                                   TextInfoIndices& textInfoMergeIndicesBegin,
+                                   TextInfoIndices& textInfoMergeIndicesEnd,
+                                   ParagraphLayoutInfo& paragraphLayout,
                                    std::vector<TextActor>& removedTextActors );
 /**
  * Removes a given number of characters from the given word.
@@ -107,7 +118,7 @@ void SplitWord( std::size_t position,
  *
  * @note Does nothing if last part of the word is empty.
  * @note If the first part of the word is empty it just copy the last part to it.
- * @note It asserts if the first or the last word is a word separator (white space) or a line separator (new line character)
+ * @note It asserts if the first or the last word is a word separator (white space) or a paragraph separator (new paragraph character)
  *
  * @param[in,out] firstWordLayoutInfo The input is the layout info of the first word. The output is the layout info of the merged word.
  * @param[in] lastWordLayoutInfo Layout info of the last word.
@@ -143,14 +154,14 @@ CharacterLayoutInfo GetLastCharacterLayoutInfo( const WordLayoutInfo& wordLayout
 void CollectTextActors( std::vector<TextActor>& textActors, const WordLayoutInfo& word, std::size_t characterIndexBegin, std::size_t characterIndexEnd );
 
 /**
- * Collects text-actors from the given group of words, within the given indices, and stores them into the text-actor vector.
+ * Collects text-actors from the given paragraph, within the given indices, and stores them into the text-actor vector.
  *
- * @param[out] textActors Stores the text-actors of the given group of words.
- * @param[in] group The group of words.
+ * @param[out] textActors Stores the text-actors of the given paragraph.
+ * @param[in] paragraph The paragraph with the words.
  * @param[in] wordIndexBegin Index to the first word.
  * @param[in] wordIndexEnd Index to the last word.
  */
-void CollectTextActorsFromWords( std::vector<TextActor>& textActors, const WordGroupLayoutInfo& group, std::size_t wordIndexBegin, std::size_t wordIndexEnd );
+void CollectTextActorsFromWords( std::vector<TextActor>& textActors, const ParagraphLayoutInfo& paragraph, std::size_t wordIndexBegin, std::size_t wordIndexEnd );
 
 } //namespace TextViewProcessor