1 #ifndef __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_PROCESSOR_H__
2 #define __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_PROCESSOR_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include "text-view-impl.h"
23 #include "text-view-processor-types.h"
34 namespace TextViewProcessor
38 * 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.
40 * @param[in] text The given styled text.
41 * @param[in] layoutParameters Layout configuration.
42 * @param[out] relayoutData Natural size (metrics), layout, text-actor info and conversion from visual to logical order and vice versa (for RTL text).
44 void CreateTextInfo( const MarkupProcessor::StyledTextArray& text,
45 const TextView::LayoutParameters& layoutParameters,
46 TextView::RelayoutData& relayoutData );
49 * Updates the layout data structures with the new inserted text.
51 * @note Does nothing if text has no characters.
52 * @note It asserts if position is bigger than the number of characters of the whole text.
54 * @param[in] position Where the text is going to be inserted.
55 * @param[in] text New styled text to be inserted.
56 * @param[in] layoutParameters Layout configuration.
57 * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info and conversion from visual to logical order and vice versa (for RTL text).
59 void UpdateTextInfo( std::size_t position,
60 const MarkupProcessor::StyledTextArray& text,
61 const TextView::LayoutParameters& layoutParameters,
62 TextView::RelayoutData& relayoutData );
65 * Updates the layout data structures by removing text.
67 * @note Does nothing if number of characters to be deleted is zero.
68 * @note It asserts if trying to delete text out of bounds.
70 * @param[in] position Position of the first character to be removed.
71 * @param[in] numberOfCharacters The number of characters to be removed.
72 * @param[in] layoutParameters Layout configuration.
73 * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info and conversion from visual to logical order and vice versa (for RTL text).
74 * @param[in] clearText Whether to clear text-actor's text before insert the text-actors into the cache.
76 void UpdateTextInfo( std::size_t position,
77 std::size_t numberOfCharacters,
78 const TextView::LayoutParameters& layoutParameters,
79 TextView::RelayoutData& relayoutData,
80 TextOperationOnRemove clearText );
83 * Updates the layout data structures by replacing text.
85 * @param[in] position Position of the first character to be replaced.
86 * @param[in] numberOfCharacters The number of characters to be replaced.
87 * @param[in] text The new styled text.
88 * @param[in] layoutParameters Layout configuration.
89 * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info and conversion from visual to logical order and vice versa (for RTL text).
91 void UpdateTextInfo( std::size_t position,
92 std::size_t numberOfCharacters,
93 const MarkupProcessor::StyledTextArray& text,
94 const TextView::LayoutParameters& layoutParameters,
95 TextView::RelayoutData& relayoutData );
98 * Updates the layout data structure by modifying the space between lines.
100 * @param[in] lineHeightOffset The new space between lines.
101 * @param[in,out] textLayoutInfo Layout info for all groups of characters, words, groups of words, lines and the whole text.
103 void UpdateTextInfo( float lineHeightOffset,
104 TextLayoutInfo& textLayoutInfo );
107 * Updates the text-actor data structures by replacing the style.
109 * @note This operation is called only if the new style doesn't modify the metrics. Consequently it doesn't modify any size info.
111 * @param[in] style The new style.
112 * @param[in] mask The style mask.
113 * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
115 void UpdateTextInfo( const TextStyle& style,
116 TextStyle::Mask mask,
117 TextView::RelayoutData& relayoutData );
120 * Traverse all text initializing all non initialized text-actor handles.
122 * @param[in,out] relayoutData Natural size (metrics), layout, text-actor info.
124 void InitializeTextActorInfo( TextView::RelayoutData& relayoutData );
126 } // namespace TextViewProcessor
128 } // namespace Internal
130 } // namespace Toolkit
134 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_PROCESSOR_H__