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 <dali-toolkit/internal/controls/text-view/text-view-impl.h>
33 namespace TextViewProcessor
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.
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).
43 void CreateTextInfo( const MarkupProcessor::StyledTextArray& text,
44 const TextView::LayoutParameters& layoutParameters,
45 TextView::RelayoutData& relayoutData );
48 * Updates the layout data structures with the new inserted text.
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.
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).
58 void UpdateTextInfo( std::size_t position,
59 const MarkupProcessor::StyledTextArray& text,
60 const TextView::LayoutParameters& layoutParameters,
61 TextView::RelayoutData& relayoutData );
64 * Updates the layout data structures by removing text.
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.
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.
75 void UpdateTextInfo( std::size_t position,
76 std::size_t numberOfCharacters,
77 const TextView::LayoutParameters& layoutParameters,
78 TextView::RelayoutData& relayoutData,
79 TextOperationOnRemove clearText );
82 * Updates the layout data structures by replacing text.
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).
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 );
97 * Updates the layout data structure by modifying the space between lines.
99 * @param[in] lineHeightOffset The new space between lines.
100 * @param[in,out] textLayoutInfo Layout info for all characters, words, lines and the whole text.
102 void UpdateTextInfo( float lineHeightOffset,
103 TextLayoutInfo& textLayoutInfo );
106 * Updates the text-actor data structures by replacing the style.
108 * @note This operation is called only if the new style doesn't modify the metrics. Consequently it doesn't modify any size info.
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.
114 void UpdateTextInfo( const TextStyle& style,
115 TextStyle::Mask mask,
116 TextView::RelayoutData& relayoutData );
118 } // namespace TextViewProcessor
120 } // namespace Internal
122 } // namespace Toolkit
126 #endif // __DALI_TOOLKIT_INTERNAL_TEXT_VIEW_PROCESSOR_H__