c95b698bb595795ef88540bd30eef4b572aa2577
[platform/core/uifw/dali-adaptor.git] / text / dali / public-api / text-abstraction / bidirectional-support.h
1 #ifndef __DALI_PLATFORM_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_H__
2 #define __DALI_PLATFORM_TEXT_ABSTRACTION_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/text-abstraction/text-abstraction.h>
23
24 // EXTERNAL INCLUDES
25 #include <dali/public-api/object/base-handle.h>
26
27 namespace Dali
28 {
29
30 namespace TextAbstraction
31 {
32
33 namespace Internal DALI_INTERNAL
34 {
35
36 class BidirectionalSupport;
37
38 } // Internal
39
40 } // TextAbstraction
41
42 namespace TextAbstraction
43 {
44
45 /**
46  * BidirectionalSupport API
47  *
48  */
49 class DALI_IMPORT_API BidirectionalSupport : public BaseHandle
50 {
51
52 public:
53
54   /**
55    * @brief Create an uninitialized TextAbstraction handle.
56    *
57    */
58   BidirectionalSupport();
59
60   /**
61    * @brief Destructor
62    *
63    * This is non-virtual since derived Handle types must not contain data or virtual methods.
64    */
65   ~BidirectionalSupport();
66
67   /**
68    * @brief This constructor is used by BidirectionalSupport::Get().
69    *
70    * @param[in] implementation a pointer to the internal bidirectional support object.
71    */
72   explicit DALI_INTERNAL BidirectionalSupport( Internal::BidirectionalSupport* implementation );
73
74   /**
75    * @brief Retrieve a handle to the BidirectionalSupport instance.
76    *
77    * @return A handle to the BidirectionalSupport
78    */
79   static BidirectionalSupport Get();
80
81   /**
82    * @brief Creates bidirectional data for the whole paragraph.
83    *
84    * @param[in] paragraph Pointer to the first character of the paragraph coded in UTF32.
85    * @param[in] numberOfCharacters The number of characters of the paragraph.
86    *
87    * @return An index of an object inside a table storing the bidirectional data.
88    */
89   BidiInfoIndex CreateInfo( const Character* const paragraph,
90                             Length numberOfCharacters );
91
92   /**
93    * @brief Destroys the bidirectional data.
94    *
95    * @param[in] bidiInfoIndex The index to the of the object inside the table storing the bidirectional data for the current paragraph.
96    */
97   void DestroyInfo( BidiInfoIndex bidiInfoIndex );
98
99   /**
100    * @brief Reorders a line of a paragraph.
101    *
102    * @pre visualToLogicalMap must have enough space allocated for @p numberOfCharacters.
103    *
104    * @param[in] bidiInfoIndex The index to the of the object inside the table storing the bidirectional data for the current paragraph.
105    * @param[in] firstCharacterIndex The first character of the line within the whole paragraph.
106    * @param[in] numberOfCharacters The number of characters of the line.
107    * @param[out] visualToLogicalMap The visual to logical conversion map.
108    */
109   void Reorder( BidiInfoIndex bidiInfoIndex,
110                 CharacterIndex firstCharacterIndex,
111                 Length numberOfCharacters,
112                 CharacterIndex* visualToLogicalMap );
113 };
114
115 } // namespace TextAbstraction
116
117 } // namespace Dali
118
119 #endif // __DALI_PLATFORM_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_H__