1 #ifndef __DALI_TOOLKIT_TEXT_PROCESSOR_H__
2 #define __DALI_TOOLKIT_TEXT_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/public-api/markup-processor/markup-processor.h>
33 namespace TextProcessor
35 // Forward declarations.
36 struct BidirectionalParagraphInfo;
39 * Splits the given text in paragraphs.
41 * @note Assumes the StyledTextArray has 1 Character per Text element. (which is the case for text in TextInput, but
42 * not necessarily the case for text in TextView)
44 * @param [in] styledTextArray The given text.
45 * @param [out] paragraphs The text split in paragraphs.
46 * @param [out] styles The styles of each character of each paragraph.
48 void SplitInParagraphs( const MarkupProcessor::StyledTextArray& styledTextArray,
49 std::vector<Text>& paragraphs,
50 std::vector< Vector<TextStyle*> >& styles );
53 * Finds the position of all word separators (currently white spaces and new paragraph characters '\n') in the given text.
55 * @param [in] paragraph The given paragraph.
56 * @param [out] positions Positions within the paragraph of all word sepatators.
58 void SplitInWords( const Text& paragraph,
59 Vector<std::size_t>& positions );
62 * Finds the nearest word in a string to a specified
63 * offset (in Characters).
65 * @note Assumes the StyledTextArray has 1 Character per Text element. (which is the case for text in TextInput, but
66 * not necessarily the case for text in TextView)
68 * @param[in] text The text to search through.
69 * @param[in] offset The current offset position to begin search from.
70 * @param[out] start The start position of nearest word
71 * @param[out] end The end position of nearest word
73 void FindNearestWord( const MarkupProcessor::StyledTextArray& text, size_t offset, size_t& start, size_t& end);
75 } // namespace TextProcessor
77 } // namespace Internal
79 } // namespace DaliToolkit
83 #endif // __DALI_TOOLKIT_TEXT_PROCESSOR_H__