Fix for klockwork minor issues.
[platform/framework/native/uifw.git] / inc / FGrpEnrichedText.h
1 //
2 //
3 // Open Service Platform
4 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 //
6 // Licensed under the Apache License, Version 2.0 (the License);
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0/
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 //
18
19 /**
20  * @file        FGrpEnrichedText.h
21  * @brief       This is the header file for the %EnrichedText class.
22  *
23  * This header file contains the definitions of the %EnrichedText class.
24  *
25  */
26
27 #ifndef _FGRP_ENRICHED_TEXT_H_
28 #define _FGRP_ENRICHED_TEXT_H_
29
30 #include <FBase.h>
31 #include <FBaseUtilLinkInfo.h>
32 #include <FGrpTextElement.h>
33
34 namespace Tizen { namespace Graphics
35 {
36 /**
37  * @enum TextHorizontalAlignment
38  *
39  * Defines the horizontal alignment of the text.
40  *
41  * @since               2.0
42  */
43 enum TextHorizontalAlignment
44 {
45         TEXT_ALIGNMENT_LEFT = 1,                    /**< The position of the text is towards the left of the object */
46         TEXT_ALIGNMENT_CENTER,                  /**< The position of the text is towards the center of the object */
47         TEXT_ALIGNMENT_RIGHT,                   /**< The position of the text is towards the right of the object */
48         TEXT_ALIGNMENT_HORIZONTAL_MAX,          // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
49         TEXT_ALIGNMENT_HORIZONTAL_MIN = 0          // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
50 };
51
52 /**
53  * @enum TextVerticalAlignment
54  *
55  * Defines the vertical alignment of the text.
56  *
57  * @since               2.0
58  */
59 enum TextVerticalAlignment
60 {
61         TEXT_ALIGNMENT_TOP = 1,                                 /**< The position of the text is towards the top of the object */
62         TEXT_ALIGNMENT_MIDDLE,                                  /**< The position of the text is towards the middle of the object */
63         TEXT_ALIGNMENT_BOTTOM,                                  /**< The position of the text is towards the bottom of the object */
64         TEXT_ALIGNMENT_BASELINE,                                /**< The position of the text is aligned along the baseline of the object */
65         TEXT_ALIGNMENT_VERTICAL_MAX,                    // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
66         TEXT_ALIGNMENT_VERTICAL_MIN = 0                 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
67 };
68
69 /**
70  * @enum TextWrap
71  *
72  * Defines the style of wrapping of the text in %EnrichedText.
73  *
74  * @since               2.0
75  */
76 enum TextWrap
77 {
78         TEXT_WRAP_NONE = 1,                     /**< The wrapping of text is not applied */
79         TEXT_WRAP_CHARACTER_WRAP,           /**< The wrapping of text is applied at the character unit */
80         TEXT_WRAP_WORD_WRAP,                /**< The wrapping of text is applied at the word unit */
81         TEXT_WRAP_MAX,                      // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
82         TEXT_WRAP_MIN = 0                      // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
83 };
84
85 /**
86  * @class       EnrichedText
87  * @brief       This class provides enriched text content.
88  *
89  * @since       2.0
90  *
91  * @final       This class is not intended for extension.
92  *
93  * The %EnrichedText class provides methods that enable your application to support texts with various styles, such
94  * as font, color, and layout. An %EnrichedText instance can be drawn to a Canvas.
95  *
96  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/graphics/enriched_text.htm">EnrichedText</a>.
97  *
98  * The following example demonstrates how to use the %EnrichedText class.
99  *
100  * @code
101 #include <FApp.h>
102 #include <FBase.h>
103 #include <FGraphics.h>
104
105 using namespace Tizen::App;
106 using namespace Tizen::Graphics;
107
108 bool
109 MyClass::EnrichedTextSample(Canvas& canvas)
110 {
111     result r = E_SUCCESS;
112     EnrichedText* pEnrichedText = null;
113     TextElement* pTextElement1 = null;
114     TextElement* pTextElement2 = null;
115
116     // Creates an EnrichedText instance and sets the attributes
117     pEnrichedText = new EnrichedText();
118     r = pEnrichedText->Construct(Dimension(200, 200));
119     if (IsFailed(r))
120     {
121         goto CATCH;
122     }
123     pEnrichedText->SetHorizontalAlignment(TEXT_ALIGNMENT_RIGHT);
124     pEnrichedText->SetVerticalAlignment(TEXT_ALIGNMENT_BOTTOM);
125     pEnrichedText->SetTextWrapStyle(TEXT_WRAP_CHARACTER_WRAP);
126     pEnrichedText->SetTextAbbreviationEnabled(true);
127
128     // Creates a TextElement and sets attributes
129     pTextElement1 = new TextElement();
130     r = pTextElement1->Construct(L"0123456789");
131     if (IsFailed(r))
132     {
133         goto CATCH;
134     }
135     pTextElement1->SetTextColor(Color::GetColor(COLOR_ID_BLUE));
136     {
137         Font font;
138         font.Construct(FONT_STYLE_BOLD, 40);
139         pTextElement1->SetFont(font);
140     }
141
142     // Creates another TextElement and sets the attributes
143     pTextElement2 = new TextElement();
144     r = pTextElement2->Construct(L"abcdefghijklmn\nABCDEFGHIJKLMN");
145     if (IsFailed(r))
146     {
147         goto CATCH;
148     }
149     pTextElement2->SetTextColor(Color::GetColor(COLOR_ID_VIOLET));
150
151     // Adds the TextElement and the bitmap to the EnrichedText
152     pEnrichedText->Add(*pTextElement1);
153     pEnrichedText->Add(*pTextElement2);
154
155     // Draws
156     {
157         canvas.SetBackgroundColor(Color::GetColor(COLOR_ID_BLACK));
158         canvas.Clear();
159         canvas.FillRectangle(Color::GetColor(COLOR_ID_WHITE), Rectangle(50, 50, 380, 380));
160
161         // Draws the covered area of the EnrichedText in the Canvas coordinate
162         int width, height;
163         pEnrichedText->GetSize(width, height);
164         canvas.FillRectangle(Color::GetColor(COLOR_ID_GREY), Rectangle(60, 60, width, height));
165
166         // Draws the EnrichedText at the specified Point
167         canvas.DrawText(Point(60, 60), *pEnrichedText);
168         canvas.Show();
169     }
170
171     // Cleans up
172     pEnrichedText->RemoveAll(true);
173     delete pEnrichedText;
174
175     return true;
176
177 CATCH:
178     if (pEnrichedText)
179     {
180         pEnrichedText->RemoveAll(true);
181         delete pEnrichedText;
182     }
183
184     return false;
185 }
186  *      @endcode
187  *
188  *
189  *
190  *
191  */
192
193 class _OSP_EXPORT_ EnrichedText
194         : public Tizen::Base::Object
195 {
196 public:
197         /**
198          * This is the default constructor for this class.
199          *
200          * @since               2.0
201          *
202          * @remarks             After creating an instance of this class, one of the Construct() methods must be called explicitly
203          *                              to initialize this instance.
204          */
205         EnrichedText(void);
206
207         /**
208          * This is the destructor for this class.
209          *
210          * @since               2.0
211          */
212         virtual ~EnrichedText(void);
213
214         /**
215          * Initializes this instance of %EnrichedText with the specified parameter.
216          *
217          * @since               2.0
218          *
219          * @return              An error code
220          * @param[in]   dim                                     The dimension to set for %EnrichedText @n
221          *                                                                      The width and height must be greater than @c 0.
222          * @exception   E_SUCCESS                       The method is successful.
223          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
224          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
225          */
226         result Construct(const Tizen::Graphics::Dimension& dim);
227
228         /**
229          * Initializes this instance of %EnrichedText with a specified parameter.
230          *
231          * @since               2.1
232          *
233          * @return              An error code
234          * @param[in]   dim                                     The FloatDimension to set for %EnrichedText @n
235          *                                                                      The width and height must be greater than @c 0.0f.
236          * @exception   E_SUCCESS                       The method is successful.
237          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
238          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
239          */
240         result Construct(const Tizen::Graphics::FloatDimension& dim);
241
242         /**
243          * Inserts the TextElement instance in the %EnrichedText instance at the specified index.
244          *
245          * @since               2.0
246          *
247          * @return              An error code
248          * @param[in]   elementIndex            The index at which the text element is to add
249          * @param[in]   element                         The TextElement to add
250          * @exception   E_SUCCESS                       The method is successful.
251          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
252          */
253         result InsertAt(int elementIndex, TextElement& element);
254
255         /**
256          * Removes the TextElement instance at the specified index of the %EnrichedText instance.
257          *
258          * @since               2.0
259          *
260          * @return              An error code
261          * @param[in]   elementIndex            The index of TextElement
262          * @param[in]   deallocate                      Set to @c true to deallocate the TextElement instance, @n
263          *                                                                      else @c false
264          * @exception   E_SUCCESS                       The method is successful.
265          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
266          *
267          */
268         result RemoveAt(int elementIndex, bool deallocate);
269
270         /**
271          * Removes the TextElement instance from the %EnrichedText instance.
272          *
273          * @since               2.0
274          *
275          * @return              An error code
276          * @param[in]   element                 The TextElement to remove
277          * @param[in]   deallocate                      Set to @c true to deallocate the TextElement instance, @n
278          *                                                                              else @c false
279          * @exception   E_SUCCESS                       The method is successful.
280          *
281          */
282         result Remove(TextElement& element, bool deallocate);
283
284         /**
285          * Adds the specified TextElement instance to the %EnrichedText instance.
286          *
287          * @since               2.0
288          *
289          * @return              An error code
290          * @param[in]   element                         The TextElement to append
291          * @exception   E_SUCCESS                       The method is successful.
292          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
293          *
294          */
295         result Add(TextElement& element);
296
297         /**
298          * @if OSPDEPREC
299          * Removes all the %TextElement instances from the %EnrichedText instance.
300          *
301          * @brief       <i> [Deprecated] </i>
302          * @deprecated  This method is deprecated. Instead of this method, use the RemoveAll().
303          * @since               2.0
304          * @endif
305          *
306          * @return              An error code
307          * @param[in]   deallocate                      Set to @c true to deallocate the %TextElement instance, @n
308          *                                                                      else @c false
309          * @exception   E_SUCCESS                       The method is successful.
310          * @see         RemoveAll()
311          *
312          */
313         result RemoveAllTextElements(bool deallocate);
314
315         /**
316          * Removes all the text and image elements from the %EnrichedText instance.
317          *
318          * @since          2.0
319          *
320          * @return         An error code
321          * @param[in]      deallocate                   Set to @c true to deallocate the elements to remove, @n
322          *                                                                              else @c false
323          * @exception      E_SUCCESS            The method is successful.
324          * @exception      E_SYSTEM             An unknown operating system error has occurred.
325          *
326          */
327         result RemoveAll(bool deallocate);
328
329         /**
330          * Gets the %TextElement instance at the specified index from the %EnrichedText instance.
331          *
332          * @since               2.0
333          *
334          * @return              The %TextElement instance at the specified index, @n
335          *                              else @c null if the method fails
336          * @param[in]   elementIndex            The index of the %TextElement
337          * @exception   E_SUCCESS                       The method is successful.
338          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
339          * @remarks             The specific error code can be accessed using the GetLastResult() method.
340          */
341         TextElement* GetTextElementAt(int elementIndex) const;
342
343         /**
344          * Gets the count of the %TextElement instances.
345          *
346          * @since               2.0
347          *
348          * @return              The count of the %TextElement instances
349          */
350         int GetTextElementCount(void) const;
351
352         /**
353          * Sets the text size.
354          *
355          * @since               2.0
356          *
357          * @return      An error code
358          * @param[in]   size                The new size of the %EnrichedText instance @n
359          *                                  The width and height must be greater than @c 0.
360          * @exception   E_SUCCESS           The method is successful.
361          * @exception   E_OUT_OF_RANGE      The value of the parameter is outside the valid range defined by the method.
362          */
363         result SetSize(const Tizen::Graphics::Dimension& size);
364
365         /**
366          * Sets the text size.
367          *
368          * @since               2.1
369          *
370          * @return      An error code
371          * @param[in]   size                The new size of the %EnrichedText instance @n
372          *                                  The width and height must be greater than @c 0.0f.
373          * @exception   E_SUCCESS           The method is successful.
374          * @exception   E_OUT_OF_RANGE      The value of the parameter is outside the valid range defined by the method.
375          */
376         result SetSize(const Tizen::Graphics::FloatDimension& size);
377
378         /**
379          * Sets the text size.
380          *
381          * @since               2.0
382          *
383          * @return      An error code
384          * @param[in]   width   The new width of %EnrichedText @n
385          *                                      It must be greater than @c 0.
386          * @param[in]   height  The new height of %EnrichedText @n
387          *                                      It must be greater than @c 0.
388          * @exception   E_SUCCESS           The method is successful.
389          * @exception   E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
390          */
391         result SetSize(int width, int height);
392
393         /**
394          * Sets the text size.
395          *
396          * @since               2.1
397          *
398          * @return      An error code
399          * @param[in]   width   The new width of %EnrichedText @n
400          *                                      It must be greater than @c 0.0f.
401          * @param[in]   height  The new height of %EnrichedText @n
402          *                                      It must be greater than @c 0.0f.
403          * @exception   E_SUCCESS           The method is successful.
404          * @exception   E_OUT_OF_RANGE      The value of the argument is outside the valid range defined by the method.
405          */
406         result SetSize(float width, float height);
407
408         /**
409          * Gets the size.
410          *
411          * @since               2.0
412          *
413          * @return              An instance of %Dimension containing the width and the height of the %EnrichedText instance
414          *
415          */
416         Tizen::Graphics::Dimension GetSize(void) const;
417
418         /**
419          * Gets the size.
420          *
421          * @since               2.1
422          *
423          * @return              An instance of FloatDimension containing the width and the height of the %EnrichedText instance
424          *
425          */
426         Tizen::Graphics::FloatDimension GetSizeF(void) const;
427
428         /**
429          * Gets the size of the %EnrichedText instance.
430          *
431          * @since               2.0
432          *
433          * @param[out]  width           The width of the control
434          * @param[out]  height          The height of the control
435          */
436         void GetSize(int& width, int& height) const;
437
438         /**
439          * Gets the size of the %EnrichedText instance.
440          *
441          * @since               2.1
442          *
443          * @param[out]  width           The width of the control
444          * @param[out]  height          The height of the control
445          */
446         void GetSize(float& width, float& height) const;
447
448         /**
449          * Gets the width of the %EnrichedText instance.
450          *
451          * @since               2.0
452          *
453          * @return              The width
454          */
455         int GetWidth(void) const;
456
457         /**
458          * Gets the width of the %EnrichedText instance.
459          *
460          * @since               2.1
461          *
462          * @return              The width
463          */
464         float GetWidthF(void) const;
465
466         /**
467          * Gets the height of the %EnrichedText instance.
468          *
469          * @since               2.0
470          *
471          * @return              The height
472          */
473         int GetHeight(void) const;
474
475         /**
476          * Gets the height of the %EnrichedText instance.
477          *
478          * @since               2.1
479          *
480          * @return              The height
481          */
482         float GetHeightF(void) const;
483
484         /**
485          * Sets the vertical alignment.
486          *
487          * @since               2.0
488          *
489          * @return              An error code
490          * @param[in]   alignment               The vertical alignment of the text
491          * @exception   E_SUCCESS                       The method is successful.
492          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
493          */
494         result SetVerticalAlignment(TextVerticalAlignment alignment);
495
496         /**
497          * Sets the horizontal alignment.
498          *
499          * @since               2.0
500          *
501          * @return              An error code
502          * @param[in]   alignment                       The horizontal alignment of the text
503          * @exception   E_SUCCESS                       The method is successful.
504          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
505          */
506         result SetHorizontalAlignment(TextHorizontalAlignment alignment);
507
508         /**
509          * Gets the vertical alignment.
510          *
511          * @since               2.0
512          *
513          * @return              alignment                       The vertical alignment of the text
514          */
515         TextVerticalAlignment GetVerticalAlignment(void) const;
516
517         /**
518          * Gets the horizontal alignment.
519          *
520          * @since               2.0
521          *
522          * @return              alignment               The horizontal alignment of the text
523          */
524         TextHorizontalAlignment GetHorizontalAlignment(void) const;
525
526         /**
527          * Sets the text wrap style.
528          *
529          * @since               2.0
530          *
531          * @return              An error code
532          * @param[in]   wrap                            The text wrapping style
533          * @exception   E_SUCCESS                       The method is successful.
534          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
535          */
536         result SetTextWrapStyle(TextWrap wrap);
537
538         /**
539          * Gets the text wrap style.
540          *
541          * @since               2.0
542          *
543          * @return              wrap            The text wrapping style in the %EnrichedText bounds
544          */
545         TextWrap GetTextWrapStyle(void) const;
546
547         /**
548          * Sets the text abbreviation status.
549          *
550          * @since               2.0
551          *
552          * @return              An error code
553          * @param[in]   enable                          Set to @c true to enable text abbreviation, @n
554          *                                                                      else @c false
555          * @exception   E_SUCCESS                       The method is successful.
556          */
557         result SetTextAbbreviationEnabled(bool enable);
558
559         /**
560          * Checks whether the text abbreviation is enabled.
561          *
562          * @since               2.0
563          *
564          * @return              @c true if the text abbreviation is enabled, @n
565          *                              else @c false
566          */
567         bool IsTextAbbreviationEnabled(void) const;
568
569         /**
570          * Sets the line spacing.
571          *
572          * @since               2.0
573          *
574          * @return              An error code
575          * @param[in]   lineSpace                       The space between lines
576          * @exception   E_SUCCESS                       The method is successful.
577          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
578          *
579          */
580         result SetLineSpace(int lineSpace);
581
582         /**
583          * Sets the line spacing.
584          *
585          * @since               2.1
586          *
587          * @return              An error code
588          * @param[in]   lineSpace                       The space between lines
589          * @exception   E_SUCCESS                       The method is successful.
590          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
591          *
592          */
593         result SetLineSpace(float lineSpace);
594
595         /**
596          * Gets the line spacing.
597          *
598          * @since               2.0
599          *
600          * @return              space           The space between lines
601          */
602         int GetLineSpace(void) const;
603
604         /**
605          * Gets the line spacing.
606          *
607          * @since               2.1
608          *
609          * @return              space           The space between lines
610          */
611         float GetLineSpaceF(void) const;
612
613         /**
614          * Refreshes the texts and bitmap according to the %EnrichedText instance's attributes. @n
615          * If some attributes are changed (such as changes using @ref SetSize), you can get the exact
616          * information of the text position or the number of lines after this method is called.
617          *
618          * @since               2.0
619          */
620         void Refresh(void);
621
622         /**
623          * Gets the total line count of the text in the %EnrichedText instance.
624          *
625          * @since               2.0
626          *
627          * @return              The total line count
628          */
629         int GetTotalLineCount(void) const;
630
631         /**
632          * Gets the height of the text in the %EnrichedText instance.
633          *
634          * @since               2.0
635          *
636          * @return              The line height
637          */
638         int GetTotalLineHeight(void) const;
639
640         /**
641          * Gets the height of the text in the %EnrichedText instance.
642          *
643          * @since               2.1
644          *
645          * @return              The line height
646          */
647         float GetTotalLineHeightF(void) const;
648
649         /**
650          * Gets the displayed line count of the text in the %EnrichedText instance.
651          *
652          * @since               2.0
653          *
654          * @return              The displayed line count
655          */
656         int GetDisplayLineCount(void) const;
657
658         /**
659          * Gets the length of the specified line.
660          *
661          * @since               2.0
662          *
663          * @return              The line length, @n
664          *                              else @c -1 if the method fails
665          * @param[in]   lineIndex                       The index of the specified line
666          * @exception   E_SUCCESS                       The method is successful.
667          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
668          * @remarks             The specific error code can be accessed using the GetLastResult() method.
669          */
670         int GetLineLength(int lineIndex) const;
671
672         /**
673          * Gets the first character index of the specified line.
674          *
675          * @since               2.0
676          *
677          * @return              The first text offset, @n
678          *                              else @c -1 if the method fails
679          * @param[in]   lineIndex                       The line index of the %EnrichedText object
680          * @exception   E_SUCCESS                       The method is successful.
681          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
682          * @remarks             The specific error code can be accessed using the GetLastResult() method.
683          */
684         int GetFirstTextIndex(int lineIndex) const;
685
686         /**
687          * Gets the line index of the specified character.
688          *
689          * @since               2.0
690          *
691          * @return              The line index, @n
692          *                              else @c -1 if the method fails
693          * @param[in]   textIndex                       The text index
694          * @exception   E_SUCCESS                       The method is successful.
695          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
696          * @remarks             The specific error code can be accessed using the GetLastResult() method.
697          */
698         int GetLineIndex(int textIndex) const;
699
700         /**
701          * Gets the line height of the specified line.
702          *
703          * @since               2.0
704          *
705          * @return              The line height, @n
706          *                              else @c -1 if the method fails
707          * @param[in]   lineIndex                       The line index
708          * @exception   E_SUCCESS                       The method is successful.
709          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
710          * @remarks             The specific error code can be accessed using the GetLastResult() method.
711          */
712         int GetLineHeight(int lineIndex) const;
713
714         /**
715          * Gets the line height of a specified line.
716          *
717          * @since               2.1
718          *
719          * @return              The line height, @n
720          *                              else @c -1.0f if the method fails
721          * @param[in]   lineIndex                       The line index
722          * @exception   E_SUCCESS                       The method is successful.
723          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
724          * @remarks             The specific error code can be accessed using the GetLastResult() method.
725          */
726         float GetLineHeightF(int lineIndex) const;
727
728         /**
729          * Gets the text length of the %EnrichedText object.
730          *
731          * @since               2.0
732          *
733          * @return              The text length
734          */
735         int GetTextLength(void) const;
736
737         /**
738          * Gets the extent of the %EnrichedText instance on the assumption that all TextElements are
739          * expanded to one line.
740          *
741          * @since               2.0
742          *
743          * @return              An error code
744          * @param[in]   startTextIndex          The starting text index of the %EnrichedText instance
745          * @param[in]   textLength                      The length of the specified text @n
746          *                                                                      It must be greater than or equal to @c 0.
747          * @param[out]  width                           The width of the specified text
748          * @param[out]  height                          The height of the specified text
749          * @param[out]  actualLength            The actual text length measured
750          * @exception   E_SUCCESS                       The method is successful.
751          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
752          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
753          */
754         result GetTextExtent(int startTextIndex, int textLength, int& width, int& height, int& actualLength) const;
755
756         /**
757          * Gets the extent of the %EnrichedText instance on the assumption that all TextElements are
758          * expanded to one line.
759          *
760          * @since               2.1
761          *
762          * @return              An error code
763          * @param[in]   startTextIndex          The starting text index of the %EnrichedText instance
764          * @param[in]   textLength                      The length of the specified text @n
765          *                                                                      It must be greater than or equal to @c 0.
766          * @param[out]  width                           The width of the specified text
767          * @param[out]  height                          The height of the specified text
768          * @param[out]  actualLength            The actual text length measured
769          * @exception   E_SUCCESS                       The method is successful.
770          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
771          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
772          */
773         result GetTextExtent(int startTextIndex, int textLength, float& width, float& height, int& actualLength) const;
774
775         /**
776          * Gets the extent of the %EnrichedText instance on the assumption that all TextElements are
777          * expanded to one line.
778          *
779          * @since 2.0
780          *
781          * @return              An error code
782          * @param[in]   startTextIndex          The starting text index of the EnrichedText
783          * @param[in]   textLength                      The length of the specified text @n
784          *                                                                      It must be greater than or equal to @c 0.
785          * @param[out]  size                            The extent of the specified text
786          * @param[out]  actualLength            The actual text length measured
787          * @exception   E_SUCCESS                       The method is successful.
788          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
789          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
790          */
791         result GetTextExtent(int startTextIndex, int textLength, Tizen::Graphics::Dimension& size, int& actualLength) const;
792
793         /**
794          * Gets the extent of the %EnrichedText instance on the assumption that all TextElements are
795          * expanded to one line.
796          *
797          * @since 2.1
798          *
799          * @return              An error code
800          * @param[in]   startTextIndex          The starting text index of the %EnrichedText instance
801          * @param[in]   textLength                      The length of the specified text @n
802          *                                                                      It must be greater than or equal to @c 0.
803          * @param[out]  size                            The extent of the specified text
804          * @param[out]  actualLength            The actual text length measured
805          * @exception   E_SUCCESS                       The method is successful.
806          * @exception   E_OUT_OF_RANGE          The value of the argument is outside the valid range defined by the method.
807          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
808          */
809         result GetTextExtent(int startTextIndex, int textLength, Tizen::Graphics::FloatDimension& size, int& actualLength) const;
810
811         /**
812          * Gets the extent of the %EnrichedText instance on the assumption that all TextElements are
813          * not expanded to one line. @n The %GetTextExtent() method is useful for finding the extent of %EnrichedText spanning multiple lines.
814          *
815          * @since 2.0
816          * @return              An instance of Dimension containing the extent of the %EnrichedText instance, @n
817          *                              else (-1, -1) if the method fails
818          */
819         Tizen::Graphics::Dimension GetTextExtent(void) const;
820
821         /**
822          * Gets the extent of the %EnrichedText instance on the assumption that all TextElements are
823          * not expanded to one line. @n The %GetTextExtentF() method is useful for finding the extent of %EnrichedText spanning multiple lines.
824          *
825          * @since 2.1
826          * @return              An instance of FloatDimension containing the extent of the %EnrichedText instance, @n
827          *                              else (-1.0f, -1.0f) if the method fails
828          */
829         Tizen::Graphics::FloatDimension GetTextExtentF(void) const;
830
831         /**
832          * Adds the specified bitmap image to the %EnrichedText instance.
833          *
834          * @since                       2.0
835          *
836          * @return              An error code
837          * @param[in]   bitmap                                  The bitmap to draw @n
838          *                                              The bitmap must be constructed before being passed to this method.
839          * @exception   E_SUCCESS                               The method is successful.
840          * @exception   E_SYSTEM                An unknown operating system error has occurred.
841          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
842          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
843          */
844         result Add(const Tizen::Graphics::Bitmap& bitmap);
845
846         /**
847          * Inserts the specified bitmap image to the %EnrichedText instance at the specified index.
848          *
849          * @since 2.0
850          *
851          * @return              An error code
852          * @param[in]   bitmap                                  The @c bitmap to draw @n
853          *                                              The bitmap must be constructed before being passed to this method.
854          * @param[in]   elementIndex                The index at which the @c bitmap image is to add
855          * @exception   E_SUCCESS                               The method is successful.
856          * @exception   E_SYSTEM                An unknown operating system error has occurred.
857          * @exception   E_OUT_OF_RANGE                  The value of the argument is outside the valid range defined by the method.
858          * @exception   E_OUT_OF_MEMORY                 The memory is insufficient.
859          * @exception   E_INVALID_ARG                   A specified input parameter is invalid.
860          */
861         result InsertAt(int elementIndex, const Tizen::Graphics::Bitmap& bitmap);
862
863         /**
864          * Gets the information about the link at the specified position.
865          *
866          * @since      2.0
867          *
868          * @return     An error code
869          * @param[in]  point              A point that is within the %EnrichedText object
870          * @param[out] linkInfo           The LinkInfo object that represents the link at the specified position
871          * @exception  E_SUCCESS          The method is successful.
872          * @exception  E_INVALID_ARG      A specified input parameter is invalid.
873          * @exception  E_OBJ_NOT_FOUND    The required instance is not found.
874          * @remarks    This method throws @c E_OBJ_NOT_FOUND if there is no linked text at the specified position.
875          * @see        Tizen::Base::Utility::LinkInfo
876          */
877         result GetLinkInfoFromPosition(const Point& point, Tizen::Base::Utility::LinkInfo& linkInfo) const;
878
879         /*
880          * Gets the information about the link at the specified position.
881          *
882          * @since      2.1
883          *
884          * @return     An error code
885          * @param[in]  point              A point that is within the %EnrichedText object
886          * @param[out] linkInfo           The LinkInfo object that represents the link at the specified position
887          * @exception  E_SUCCESS          The method is successful.
888          * @exception  E_INVALID_ARG      A specified input parameter is invalid.
889          * @exception  E_OBJ_NOT_FOUND    The required instance is not found.
890          * @remarks    This method throws @c E_OBJ_NOT_FOUND if there is no linked text at the specified position.
891          * @see        Tizen::Base::Utility::LinkInfo
892          */
893         result GetLinkInfoFromPosition(const FloatPoint& point, Tizen::Base::Utility::LinkInfo& linkInfo) const;
894
895         /**
896          * Gets the information about the link at the specified position.
897          *
898          * @since      2.0
899          *
900          * @return     An error code
901          * @param[in]  x                  The x-coordinate of a point that is within the %EnrichedText object
902          * @param[in]  y                  The y-coordinate of a point that is within the %EnrichedText object
903          * @param[out] linkInfo           The LinkInfo object that represents the link at the specified position
904          * @exception  E_SUCCESS          The method is successful.
905          * @exception  E_INVALID_ARG      A specified input parameter is invalid.
906          * @exception  E_OBJ_NOT_FOUND    The required instance is not found.
907          * @remarks    This method throws @c E_OBJ_NOT_FOUND if there is no linked text at the specified position.
908          * @see        Tizen::Base::Utility::LinkInfo
909          */
910         result GetLinkInfoFromPosition(int x, int y, Tizen::Base::Utility::LinkInfo& linkInfo) const;
911
912         /**
913          * Gets the information about the link at a specified position.
914          *
915          * @since      2.1
916          *
917          * @return     An error code
918          * @param[in]  x                  The x-coordinate of a point that is within the %EnrichedText object
919          * @param[in]  y                  The y-coordinate of a point that is within the %EnrichedText object
920          * @param[out] linkInfo           The LinkInfo object that represents the link at the specified position
921          * @exception  E_SUCCESS          The method is successful.
922          * @exception  E_INVALID_ARG      A specified input parameter is invalid.
923          * @exception  E_OBJ_NOT_FOUND    The required instance is not found.
924          * @remarks    This method throws @c E_OBJ_NOT_FOUND if there is no linked text at the specified position.
925          * @see        Tizen::Base::Utility::LinkInfo
926          */
927         result GetLinkInfoFromPosition(float x, float y, Tizen::Base::Utility::LinkInfo& linkInfo) const;
928
929         /**
930          * Gets the vertical alignment among text and bitmap element.
931          *
932          * @since               2.0
933          *
934          * @return              The vertical alignment among the text and the bitmap element
935          */
936         TextVerticalAlignment GetElementVerticalAlignment(void) const;
937
938         /**
939          * Sets the vertical alignment among text and bitmap element.
940          *
941          * @since               2.0
942          *
943          * @return              An error code
944          * @param[in]   alignment               The vertical alignment among the text and the bitmap element
945          * @exception   E_SUCCESS                       The method is successful.
946          * @exception   E_INVALID_ARG           The specified input parameter is invalid.
947          * @remarks             This method sets how one element is positioned relative to the other elements. @n
948          *                              The vertical alignment of text and bitmap elements are decided based on the maximum height among elements.
949          * @remarks             The default alignment @c TEXT_ALIGNMENT_BOTTOM.
950          */
951         result SetElementVerticalAlignment(TextVerticalAlignment alignment);
952
953 private:
954         friend class _EnrichedTextImpl;
955
956         //
957         // This value is for internal use only. Using this value can cause behavioral, security-related,
958         // and consistency-related issues in the application.
959         //
960         /**
961          * @since 2.0
962          */
963         class _EnrichedTextImpl * __pImpl;
964
965         EnrichedText(const EnrichedText& font);
966         EnrichedText& operator =(const EnrichedText& rhs);
967
968 }; // EnrichedText
969
970 } } // Tizen::Graphics
971
972 #endif  //  _FGRP_ENRICHED_TEXT_H_