Revert "[Tizen] Add codes for Dali Windows Backend"
[platform/core/uifw/dali-adaptor.git] / dali / internal / text / text-abstraction / bidirectional-support-impl.h
1 #ifndef __DALI_INTERNAL_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_IMPL_H__
2 #define __DALI_INTERNAL_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_IMPL_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 #include <dali/public-api/object/base-object.h>
24
25 // INTERNAL INCLUDES
26 #include <dali/devel-api/text-abstraction/bidirectional-support.h>
27
28 namespace Dali
29 {
30
31 namespace TextAbstraction
32 {
33
34 namespace Internal
35 {
36
37 /**
38  * Implementation of the BidirectionalSupport
39  */
40 class BidirectionalSupport : public BaseObject
41 {
42 public:
43
44   /**
45    * Constructor
46    */
47   BidirectionalSupport();
48
49   /**
50    * Destructor
51    */
52   ~BidirectionalSupport();
53
54   /**
55    * @copydoc Dali::BidirectionalSupport::Get()
56    */
57   static TextAbstraction::BidirectionalSupport Get();
58
59   /**
60    * @copydoc Dali::BidirectionalSupport::CreateInfo()
61    */
62   BidiInfoIndex CreateInfo( const Character* const paragraph,
63                             Length numberOfCharacters );
64
65   /**
66    * @copydoc Dali::BidirectionalSupport::DestroyInfo()
67    */
68   void DestroyInfo( BidiInfoIndex bidiInfoIndex );
69
70   /**
71    * @copydoc Dali::BidirectionalSupport::Reorder()
72    */
73   void Reorder( BidiInfoIndex bidiInfoIndex,
74                 CharacterIndex firstCharacterIndex,
75                 Length numberOfCharacters,
76                 CharacterIndex* visualToLogicalMap );
77
78   /**
79    * @copydoc Dali::BidirectionalSupport::GetMirroredText()
80    */
81   bool GetMirroredText( Character* text,
82                         CharacterDirection* directions,
83                         Length numberOfCharacters );
84
85   /**
86    * @copydoc Dali::BidirectionalSupport::GetParagraphDirection()
87    */
88   bool GetParagraphDirection( BidiInfoIndex bidiInfoIndex ) const;
89
90   /**
91    * @copydoc Dali::BidirectionalSupport::GetCharactersDirection()
92    */
93   void GetCharactersDirection( BidiInfoIndex bidiInfoIndex,
94                                CharacterDirection* directions,
95                                Length numberOfCharacters );
96
97 private:
98
99   /**
100    * Helper for lazy initialization.
101    */
102   void CreatePlugin();
103
104 private:
105
106   // Undefined copy constructor.
107   BidirectionalSupport( const BidirectionalSupport& );
108
109   // Undefined assignment constructor.
110   BidirectionalSupport& operator=( const BidirectionalSupport& );
111
112 private:
113
114   struct Plugin;
115   Plugin* mPlugin;
116
117 }; // class BidirectionalSupport
118
119 } // namespace Internal
120
121 } // namespace TextAbstraction
122
123 inline static TextAbstraction::Internal::BidirectionalSupport& GetImplementation( TextAbstraction::BidirectionalSupport& bidirectionalSupport )
124 {
125   DALI_ASSERT_ALWAYS( bidirectionalSupport && "bidirectional support handle is empty" );
126   BaseObject& handle = bidirectionalSupport.GetBaseObject();
127   return static_cast<TextAbstraction::Internal::BidirectionalSupport&>(handle);
128 }
129
130 inline static const TextAbstraction::Internal::BidirectionalSupport& GetImplementation( const TextAbstraction::BidirectionalSupport& bidirectionalSupport )
131 {
132   DALI_ASSERT_ALWAYS( bidirectionalSupport && "bidirectional support handle is empty" );
133   const BaseObject& handle = bidirectionalSupport.GetBaseObject();
134   return static_cast<const TextAbstraction::Internal::BidirectionalSupport&>(handle);
135 }
136
137 } // namespace Dali
138
139 #endif // __DALI_INTERNAL_TEXT_ABSTRACTION_BIDIRECTIONAL_SUPPORT_IMPL_H__