Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / text-view / text-view-processor.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_PROCESSOR_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_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 "text-view-impl.h"
22 #include "text-view-processor-types.h"
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal
31 {
32
33 namespace TextViewProcessor
34 {
35
36 /**
37  * Creates a data structure with info to layout the text, and data structures with useful info to modify the layout data structure if characters are added or removed.
38  *
39  * @param[in] text The given styled text.
40  * @param[in] layoutParameters Layout configuration.
41  * @param[out] relayoutData Natural size (metrics), layout, text-actor info and conversion from visual to logical order and vice versa (for RTL text).
42  */
43 void CreateTextInfo( const MarkupProcessor::StyledTextArray& text,
44                      const TextView::LayoutParameters& layoutParameters,
45                      TextView::RelayoutData& relayoutData );
46
47 /**
48  *  Updates the layout data structures with the new inserted text.
49  *
50  * @note Does nothing if text has no characters.
51  * @note It asserts if position is bigger than the number of characters of the whole text.
52  *
53  * @param[in] position Where the text is going to be inserted.
54  * @param[in] text New styled text to be inserted.
55  * @param[in] layoutParameters Layout configuration.
56  * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info and conversion from visual to logical order and vice versa (for RTL text).
57  */
58 void UpdateTextInfo( std::size_t position,
59                      const MarkupProcessor::StyledTextArray& text,
60                      const TextView::LayoutParameters& layoutParameters,
61                      TextView::RelayoutData& relayoutData );
62
63 /**
64  *  Updates the layout data structures by removing text.
65  *
66  * @note Does nothing if number of characters to be deleted is zero.
67  * @note It asserts if trying to delete text out of bounds.
68  *
69  * @param[in] position Position of the first character to be removed.
70  * @param[in] numberOfCharacters The number of characters to be removed.
71  * @param[in] layoutParameters Layout configuration.
72  * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info and conversion from visual to logical order and vice versa (for RTL text).
73  * @param[in] clearText Whether to clear text-actor's text before insert the text-actors into the cache.
74  */
75 void UpdateTextInfo( std::size_t position,
76                      std::size_t numberOfCharacters,
77                      const TextView::LayoutParameters& layoutParameters,
78                      TextView::RelayoutData& relayoutData,
79                      TextOperationOnRemove clearText );
80
81 /**
82  * Updates the layout data structures by replacing text.
83  *
84  * @param[in] position Position of the first character to be replaced.
85  * @param[in] numberOfCharacters The number of characters to be replaced.
86  * @param[in] text The new styled text.
87  * @param[in] layoutParameters Layout configuration.
88  * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info and conversion from visual to logical order and vice versa (for RTL text).
89  */
90 void UpdateTextInfo( std::size_t position,
91                      std::size_t numberOfCharacters,
92                      const MarkupProcessor::StyledTextArray& text,
93                      const TextView::LayoutParameters& layoutParameters,
94                      TextView::RelayoutData& relayoutData );
95
96 /**
97  * Updates the layout data structure by modifying the space between lines.
98  *
99  * @param[in] lineHeightOffset The new space between lines.
100  * @param[in,out] textLayoutInfo Layout info for all groups of characters, words, groups of words, lines and the whole text.
101  */
102 void UpdateTextInfo( float lineHeightOffset,
103                      TextLayoutInfo& textLayoutInfo );
104
105 /**
106  * Updates the text-actor data structures by replacing the style.
107  *
108  * @note This operation is called only if the new style doesn't modify the metrics. Consequently it doesn't modify any size info.
109  *
110  * @param[in] style The new style.
111  * @param[in] mask The style mask.
112  * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
113  */
114 void UpdateTextInfo( const TextStyle& style,
115                      TextStyle::Mask mask,
116                      TextView::RelayoutData& relayoutData );
117
118 /**
119  * Traverse all text initializing all non initialized text-actor handles.
120  *
121  * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
122  */
123 void InitializeTextActorInfo( TextView::RelayoutData& relayoutData );
124
125 } // namespace TextViewProcessor
126
127 } // namespace Internal
128
129 } // namespace Toolkit
130
131 } // namespace Dali
132
133 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_PROCESSOR_H__