Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / segmentation.h
1 #ifndef __DALI_TOOLKIT_TEXT_SEGMENTATION_H__
2 #define __DALI_TOOLKIT_TEXT_SEGMENTATION_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
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
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/dali-vector.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/internal/text/text-definitions.h>
26
27 namespace Dali
28 {
29
30 namespace Toolkit
31 {
32
33 namespace Text
34 {
35
36 class LogicalModel;
37
38 /**
39  * Sets line break info.
40  *
41  * Possible values for LineBreakInfo are:
42  *
43  *  - 0 is a LINE_MUST_BREAK.  Text must be broken into a new line.
44  *  - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
45  *  - 2 is a LINE_NO_BREAK.    Text can't be broken into a new line.
46  *
47  * @param[in] text Vector of UTF-32 characters.
48  * @param[out] lineBreakInfo The line break info
49  */
50 void SetLineBreakInfo( const Vector<Character>& text,
51                        Vector<LineBreakInfo>& lineBreakInfo );
52
53 /**
54  * Replaces line break info.
55  *
56  * @pre The @p model needs to have a text set.
57  *
58  * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
59  * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
60  *
61  * @param[in,out] model The text's logical model.
62  * @param[in] characterIndex Index to the first character.
63  * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
64  * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
65  */
66 void ReplaceLineBreakInfo( LogicalModel& model,
67                            CharacterIndex characterIndex,
68                            Length numberOfCharactersToRemove,
69                            Length numberOfCharactersToInsert );
70
71 /**
72  * Sets word break info.
73  *
74  * - 0 is a WORD_BREAK.    Text can be broken into a new word.
75  * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
76  *
77  * @param[in] text Vector of UTF-32 characters.
78  * @param[out] wordBreakInfo The word break info.
79  */
80 void SetWordBreakInfo( const Vector<Character>& text,
81                        Vector<WordBreakInfo>& wordBreakInfo );
82
83 /**
84  * Replaces word break info.
85  *
86  * @pre The @p model needs to have a text set.
87  *
88  * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
89  * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
90  *
91  * @param[in,out] model The text's logical model.
92  * @param[in] characterIndex Index to the first character.
93  * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
94  * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
95  */
96 void ReplaceWordBreakInfo( LogicalModel& model,
97                            CharacterIndex characterIndex,
98                            Length numberOfCharactersToRemove,
99                            Length numberOfCharactersToInsert );
100
101 } // namespace Text
102
103 } // namespace Toolkit
104
105 } // namespace Dali
106
107 #endif // __DALI_TOOLKIT_TEXT_SEGMENTATION_H__