BasicRenderer reworked for RGBA8888
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / bidirectional-support.h
1 #ifndef __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__
2 #define __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_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 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-vector.h>
23 #include <dali-toolkit/internal/text/bidirectional-line-info-run.h>
24 #include <dali-toolkit/internal/text/bidirectional-paragraph-info-run.h>
25
26 namespace Dali
27 {
28
29 namespace Toolkit
30 {
31
32 namespace Text
33 {
34
35 class LogicalModel;
36 class VisualModel;
37
38 /**
39  * Sets the bidirectional info into the logical model.
40  *
41  * @param[in] text Vector of UTF-32 characters.
42  * @param[in] lineBreakInfo The line break info.
43  * @param[out] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
44  */
45 void SetBidirectionalInfo( const Vector<Character>& text,
46                            const Vector<LineBreakInfo>& lineBreakInfo,
47                            Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo );
48
49 /**
50  * Replaces the bidirectional info from the logical model.
51  *
52  * @pre The @p model needs to have a text set.
53  * @pre The @p model needs to have the line break info set.
54  *
55  * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
56  * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
57  *
58  * @param[in,out] model The text's logical model.
59  * @param[in] characterIndex Index to the first character.
60  * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
61  * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
62  */
63 void ReplaceBidirectionalInfo( LogicalModel& model,
64                                CharacterIndex characterIndex,
65                                Length numberOfCharactersToRemove,
66                                Length numberOfCharactersToInsert );
67
68 /**
69  * Sets the visual to logical and logical to visual map tables.
70  *
71  * Any map tables previously set are removed.
72  *
73  * @pre The @p logicalModel needs to have a text set.
74  * @pre The @p logicalModel needs to have the bidirectional info indices for each paragraph set.
75  * @pre The @p visualModel needs to have the laid-out lines info set.
76  *
77  * @param[in] bidirectionalInfo Vector with the bidirectional infor for each paragraph.
78  * @param[in] lineRuns The line runs converted to characters.
79  * @param[out] lineInfoRuns line runs with the visual to logical and logical to visual conversion maps.
80  */
81 void ReorderLines( const Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo,
82                    const Vector<CharacterRun>& lineRuns,
83                    Vector<BidirectionalLineInfoRun>& lineInfoRuns );
84
85 /**
86  * Replaces the visual to logical and logical to visual map tables.
87  *
88  * @pre The @p logicalModel needs to have a text set.
89  * @pre The @p logicalModel needs to have the line break info set.
90  * @pre The @p visualModel needs to have the laid-out lines info set.
91  *
92  * If the @p numberOfCharactersToRemove is zero, this operation is like an insert.
93  * If the @p numberOfCharactersToInsert is zero, this operation is like a remove.
94  *
95  * @param[in,out] logicalModel The text's logical model.
96  * @param[in] visualModel The text's visual model.
97  * @param[in] characterIndex Index to the first character.
98  * @param[in] numberOfCharactersToRemove The number of characters removed from the text.
99  * @param[in] numberOfCharactersToInsert The number of characters inserted in the text.
100  */
101 void ReorderLines( LogicalModel& logicalModel,
102                    const VisualModel& visualModel,
103                    CharacterIndex characterIndex,
104                    Length numberOfCharactersToRemove,
105                    Length numberOfCharactersToInsert );
106
107 } // namespace Text
108
109 } // namespace Toolkit
110
111 } // namespace Dali
112
113 #endif // __DALI_TOOLKIT_TEXT_BIDIRECTIONAL_SUPPORT_H__