Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / src / graphics / inc / FGrp_TextTextObject.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /*
19  * @file        FGrp_TextTextObject.h
20  * @brief       This is the header file for the TextObject class.
21  *
22  * This file contains the declarations of TextObject class.
23  */
24
25 #ifndef _FGRP_INTERNAL_TEXT_OBJECT_H_
26 #define _FGRP_INTERNAL_TEXT_OBJECT_H_
27
28 // Includes
29 #include "FGrp_TextCommon.h"
30
31 // Forward Declarations
32 namespace Tizen { namespace Graphics {
33
34 class _CanvasImpl;
35 class Bitmap;
36 class Point;
37
38 namespace _Text
39 {
40 class TextElement;
41 class TextWidthManager;
42 class TextComposite;
43 class TextColumn;
44
45 class _OSP_EXPORT_ TextObject
46 {
47 public:
48         TextObject(void);
49
50         virtual ~TextObject(void);
51
52 public:
53         result Construct(void);
54
55         result Construct(const Rectangle& rect);
56
57         TextObject* CloneN(void);
58
59         result Draw(_CanvasImpl& canvasImpl);
60
61         result DrawLine(_CanvasImpl& canvasImpl, int lineIndex);
62
63         result DrawWithOffset(_CanvasImpl& canvasImpl);
64
65         bool IsChanged(void) const;
66
67         result Compose(void);
68
69         result GetChangedLineRange(int& startChangedLineIndex, int& endChangedLineIndex);
70
71         int GetText(wchar_t* pCopiedText, int textLength) const;
72
73         result RemoveAll(bool deallocate = true);
74
75         result RemoveElement(TextElement& textElement, bool deallocate);
76
77         result RemoveElementAt(int elementIndex, bool deallocate);
78
79         result AppendElement(TextElement& textElement);
80
81         result AppendElement(Bitmap& bitmap, TextElementSourceType sourceType);
82
83         result InsertElementAt(int textIndex, TextElement& textElement);
84
85         result InsertElementAt(int textIndex, Bitmap& bitmap, TextElementSourceType sourceType);
86
87         int GetElementIndexOf(TextElement& textElement) const;
88
89         int GetElementCount(void) const;
90
91         TextElement* GetElementAtElementIndex(int elementIndex) const;
92
93         TextElement* GetElementAtTextIndex(int textIndex) const;
94
95         int GetTextIndexFromPosition(int lcX, int lcY, bool cursorMode = false) const;
96
97         int GetTextIndexFromPositionAtLine(int lineIndex, int lcX, bool cursorMode = false) const;
98
99         result ChangeTextOffset(wchar_t* pText, int textIndex, int gap);
100
101         result NotifyTextChanged(wchar_t* pText, int textOffset, int textLength, int gap);
102
103         int GetTotalLineCount(void) const;
104
105         int GetLineIndexAtTextIndex(int textIndex) const;
106
107         int GetTotalHeight(void) const;
108
109         int GetLineHeightAt(int lineIndex) const;
110
111         int GetLineWidthAt(int lineIndex) const;
112
113         int GetDisplayLineCount(void) const;
114
115         int GetLineIndexAtPositionY(int lcY) const;
116
117         int GetFirstTextIndexAt(int lineIndex) const;
118
119         int GetTextLengthAt(int lineIndex) const;
120
121         int GetMaxLineHeight(void) const;
122
123         int GetTextLength(void) const;
124
125         Dimension GetTextExtent(int startTextIndex, int textLength) const;
126
127         result SetAction(TextObjectActionType action);
128
129         TextObjectActionType GetAction(void) const;
130
131         result SetAlignment(TextObjectAlignment alignment);
132
133         TextObjectAlignment GetAlignment(void) const;
134
135         result SetElementVerticalAlignment(TextObjectAlignment alignment);
136
137         TextObjectAlignment GetElementVerticalAlignment(void) const;
138
139         result SetBounds(const Rectangle& lcRect);
140
141         Rectangle GetBounds(void) const;
142
143         result SetLineSpace(int lcLineSpacing);
144
145         int GetLineSpace(void) const;
146
147         result SetRange(int startTextIndex, int textLength);
148
149         void GetRange(int& startTextIndex, int& textLength) const;
150
151         result SetFont(Font* pFont, int startTextIndex, int textLength);
152
153         const Font* GetFont(int textIndex) const;
154
155         result SetForegroundColor(const Color& color, int startTextIndex, int textLength);
156
157         Color GetForegroundColor(int textIndex) const;
158
159         result SetBackgroundColor(const Color& color, int startTextIndex, int textLength);
160
161         Color GetBackgroundColor(int textIndex) const;
162
163         result SetOutlineColor(const Color& color, int startTextIndex, int textLength);
164
165         Color GetOutlineColor(int textIndex) const;
166
167         result SetWrap(TextObjectWrapType wrap);
168
169         TextObjectWrapType GetWrap(void) const;
170
171         result SetCursorIndex(int cursorIndex);
172
173         int GetCursorIndex(void) const;
174
175         result SetBlock(bool enable);
176
177         bool GetBlock(void) const;
178
179         result SetBlockRange(int startTextIndex, int textLength);
180
181         void GetBlockRange(int& startTextIndex, int& textLength);
182
183         result SetSlidingStep(int lcSlidingStep);
184
185         int GetSlidingStep(void) const;
186
187         result SetAlternateLookEnabled(bool enable);
188
189         bool IsAlternateLookEnabled(void) const;
190
191         result SetWidthManagerEnabled(bool widthManagerEnable);
192
193         bool IsWidthManagerEnabled(void) const;
194
195         result SetFirstDisplayLineIndexFromTextIndex(int textIndex);
196
197         result SetFirstDisplayLineIndex(int lineIndex);
198
199         int GetFirstDisplayLineIndex(void) const;
200
201         result SetFirstDisplayPositionY(int lcY);
202
203         int GetFirstDisplayPositionY(void) const;
204
205         result SetPartialComposingModeEnabled(bool enable);
206
207         bool IsPartialComposingModeEnabled(void) const;
208
209         result SetTextObjectEllipsisType(TextObjectEllipsisType type);
210
211         TextObjectEllipsisType GetTextObjectEllipsisType(void) const;
212
213         result HideFrontSpace(TextObjectSpaceHideType mode);
214
215         result HideRearSpace(TextObjectSpaceHideType mode);
216
217         result SetAlternativeForegroundColor(const Color& color);
218
219         result SetCutLinkViewMode(bool enable);
220
221         int GetTotalCutLinkElementCount(void) const;
222
223         int GetCutLinkIndexFromPositionData(int lcX, int lcY) const;
224
225         TextElement* GetCutLinkElementAtCutLinkElementIndex(int linkIndex) const;
226
227         result ChangeCutLinkState(int linkIndex, bool select);
228
229         result ResetAllCutLinkElementsState(void);
230
231         result SetCutLinkColor(Tizen::Base::Utility::LinkType linkType, const Color& color, const Color& colorInSelect);
232
233         result ResetCutLinkColor(Tizen::Base::Utility::LinkType linkType);
234
235         result GetCutLinkBounds(int cutLinkIndex, Point& startPoint, Point& endPoint) const;
236
237         bool IsActionOn(void) const;
238
239         bool IsDisplayedAtStartPosition(void) const;
240
241         bool IsDisplayedAtEndPosition(void) const;
242
243         result GetTextPositionInfoAt(int textIndex, int& width, int& height, int& absX, int& absY, int& logicalX, int& logicalY) const;
244
245         TextObjectSweepInfo GetSweepInfo(void) const;
246
247         result ResetSweepInfo(void);
248
249         result GetSweepComposeLineInfo(int lineIndex, TextObjectSweepComposeLineInfo& textSweepComposeLineInfo) const;
250
251         int GetTextOffsetAtLine(int lineIndex) const;
252
253         int GetTextLengthAtLine(int lineIndex) const;
254
255         Rectangle GetBoundsAtLine(int lineIndex) const;
256
257         result SetBlockColor(const Color& color);
258
259         Color GetBlockColor(void) const;
260
261 private:
262         result DrawByLine(_CanvasImpl& canvasImpl, const Rectangle& displayRect);
263
264         int GetTotalComposedHeight(void) const;
265
266         result GetTextPositionInfoInWrapAt(int textIndex, int& width, int& height, int& absX, int& absY,
267                         int& logicalX, int& logicalY) const;
268
269         result GetTextPositionInfoInNoneWrapAt(int textIndex, int& width, int& height, int& absX, int& absY,
270                         int& logicalX, int& logicalY) const;
271
272         int GetTextIndexFromPositionInWrap(int pcX, int pcY, bool cursorMode = true) const;
273
274         int GetTextIndexFromPositionInNoneWrap(int pcX, int pcY, bool cursorMode = true) const;
275
276         result UpdateChangedInfo(int startTextIndex, int textLength = -1, bool initTextWidthManager = true);
277
278         result NotifyTextAdded(int textIndex, int textLength);
279
280         result NotifyTextDeleted(int textIndex, int textLength);
281
282         result SetFirstDisplayLineIndexFromTextIndexInWrap(int textIndex);
283
284         result SetFirstDisplayLineIndexFromTextIndexInNoneWrap(int textIndex);
285
286         result ChangeText(int textIndex);
287
288         result InputText(int textIndex);
289
290         result RemoveText(int textIndex);
291
292         Point GetDisplayPositionAtLine(int lineIndex, int textIndexFromLineOffset);
293
294 // Attribute
295 private:
296         Rectangle __rect;
297         Rectangle __pcRect;
298         TextObjectActionType __action;
299         TextObjectAlignment __align;
300         TextObjectWrapType __wrap;
301         TextComposite* __pCompositeText;
302         TextColumn* __pTextColumn;
303         bool __isActionOn;
304         bool __isChanged;
305         bool __isAlternateLookEnabled;
306         Font* __pDefaultFont;
307         Color __defaultForegroundColor;
308         Color __defaultBackgroundColor;
309         Color __defaultOutlineColor;
310         int __slidingStep;
311         int __slidingGap;
312         TextObjectEllipsisType __textObjectEllipsisType;
313         bool __isFirstDisplayPositionYChanged;
314         bool __linkViewModeEnabled;
315         bool __isUrlLinkColorDefined;
316         bool __isEmailLinkColorDefined;
317         bool __isPhoneNumberLinkColorDefined;
318         Color __linkColor[TEXT_OBJECT_LINK_COLOR_TYPE_MAX];
319         TextWidthManager* __pTextWidthManager;
320
321         TextObjectSweepInfo __sweepInfo;
322
323 private:
324         TextObject(const TextObject& other); // NOT IMPLMENTED
325
326         TextObject& operator =(const TextObject& rhs); // NOT IMPLMENTED
327
328 }; // TextObject
329
330 }}} // Tizen::Graphics::_Text
331
332 #endif // _FGRP_INTERNAL_TEXT_OBJECT_H_