Fix issues related with cameras.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-view / text-processor.h
1 #ifndef __DALI_TOOLKIT_TEXT_PROCESSOR_H__
2 #define __DALI_TOOLKIT_TEXT_PROCESSOR_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 // INTERNAL INCLUDES
21 #include <dali-toolkit/public-api/markup-processor/markup-processor.h>
22
23 namespace Dali
24 {
25
26 namespace Toolkit
27 {
28
29 namespace Internal
30 {
31
32 namespace TextProcessor
33 {
34
35 /**
36  * Splits the given text in lines.
37  *
38  * @note Assumes the StyledTextArray has 1 Character per Text element. (which is the case for text in TextInput, but
39  * not necessarily the case for text in TextView)
40  *
41  * @param [in] text The given text.
42  * @param [out] lines The text split in lines.
43  */
44 void SplitInLines( const MarkupProcessor::StyledTextArray& text,
45                    std::vector<MarkupProcessor::StyledTextArray>& lines );
46
47 /**
48  * Splits the given line in words.
49  *
50  * @note Assumes the StyledTextArray has 1 Character per Text element. (which is the case for text in TextInput, but
51  * not necessarily the case for text in TextView)
52  *
53  * @param [in] line The given line.
54  * @param [out] words The line split in words.
55  */
56 void SplitInWords( const MarkupProcessor::StyledTextArray& line,
57                    std::vector<MarkupProcessor::StyledTextArray>& words );
58
59 /**
60  * Whether the text begins with right-to-left (bidirectional) character.
61  * @param [in] text The given text.
62  * @return \e true if the text begins right-to-left character.
63  */
64 bool BeginsRightToLeftCharacter( const Text& text );
65
66 /**
67  * @copydoc BeginsRightToLeftCharacter( const Text& text )
68  */
69 bool BeginsRightToLeftCharacter( const MarkupProcessor::StyledTextArray& text );
70
71 /**
72  * Whether the text contains any right-to-left (bidirectional) character.
73  * @param [in] text The given text.
74  * @return \e true if the text contains right-to-left character.
75  */
76 bool ContainsRightToLeftCharacter( const Text& text );
77
78 /**
79  * @copydoc ContainsRightToLeftCharacter( const Text& text )
80  */
81 bool ContainsRightToLeftCharacter( const MarkupProcessor::StyledTextArray& text );
82
83 /**
84  * Convert the text as specified by the Unicode Bidirectional Algorithm.
85  * The text is converted only if it is bidirectional.
86  * @param[in] line The line of text to be converted.
87  * @param[out] convertedText The text converted. Text is grouped in chunks which only have one direction.
88  * @param[out] logicalToVisualMap The character position map from the logical input text to the visual output text.
89  * @param[out] visualToLogicalMap The character position map from the visual output text to the logical input text.
90  */
91  void ConvertBidirectionalText( const MarkupProcessor::StyledTextArray& line,
92                                 std::vector<MarkupProcessor::StyledTextArray>& convertedText,
93                                 std::vector<int>& logicalToVisualMap,
94                                 std::vector<int>& visualToLogicalMap );
95
96 /**
97  * Finds the nearest word in a string to a specified
98  * offset (in Characters).
99  *
100  * @note Assumes the StyledTextArray has 1 Character per Text element. (which is the case for text in TextInput, but
101  * not necessarily the case for text in TextView)
102  *
103  * @param[in] text The text to search through.
104  * @param[in] offset The current offset position to begin search from.
105  * @param[out] start The start position of nearest word
106  * @param[out] end The end position of nearest word
107  */
108 void FindNearestWord( const MarkupProcessor::StyledTextArray& text, size_t offset, size_t& start, size_t& end);
109
110 } // namespace TextProcessor
111
112 } // namespace Internal
113
114 } // namespace DaliToolkit
115
116 } // namespace Dali
117
118 #endif // __DALI_TOOLKIT_TEXT_PROCESSOR_H__