Tizen 2.1 base
[framework/osp/uifw.git] / src / graphics / inc / FGrp_TextElementImpl.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_TextElementImpl.h
20  * @brief       This is the header file for the _TextElementImpl class.
21  *
22  * This header file contains the declarations of the %_TextElementImpl class.
23  *
24  */
25
26 #ifndef _FGRP_INTERNAL_TEXT_ELEMENT_IMPL_H_
27 #define _FGRP_INTERNAL_TEXT_ELEMENT_IMPL_H_
28
29 // Includes
30 #include <FBaseErrorDefine.h>
31 #include <FGrpTextElement.h>
32
33 #include "FGrp_TextCommon.h"
34
35 namespace Tizen { namespace Graphics { namespace _Text
36 {
37 class TextElement;
38 }}}
39
40 namespace Tizen { namespace Graphics
41 {
42 class _EnrichedTextImpl;
43
44 enum _CutLinkType
45 {
46         TEXT_CUTLINK_TYPE_INVALID = 0x0000,
47         TEXT_CUTLINK_TYPE_URL = 0x0001,
48         TEXT_CUTLINK_TYPE_EMAIL = 0x0002,
49         TEXT_CUTLINK_TYPE_PHONE_NUMBER = 0x0004,
50         TEXT_CUTLINK_TYPE_STREAMING_URL = 0x0008,  //Not use in OSP.
51         TEXT_CUTLINK_TYPE_MAX = 0x7FFF
52 };
53
54 class _TextElementImpl
55 {
56 public:
57         _TextElementImpl(void);
58         virtual ~_TextElementImpl(void);
59
60         result Construct(const Tizen::Base::String& text);
61         result Construct(const Tizen::Base::String& text, const Tizen::Graphics::Canvas& canvas);
62         result Construct(void);
63         result Construct(const Tizen::Base::String& text, Tizen::Base::Utility::LinkType linkType, const Tizen::Base::String& link);
64         result Construct(const Tizen::Base::String& text, unsigned long autoLink);
65         result Construct(const Tizen::Base::String& text, Tizen::Base::Utility::LinkType linkType, const Tizen::Base::String& link, const Tizen::Graphics::Canvas& canvas);
66         result Construct(const Tizen::Base::String& text, unsigned long autoLink, const Tizen::Graphics::Canvas& canvas);
67         Tizen::Base::String& GetLink(void) const;
68         result SetText(const Tizen::Base::String& text);
69         result SetFont(const Tizen::Graphics::Font& font);
70         result SetTextColor(const Tizen::Graphics::Color& color);
71         result SetBackgroundColor(const Tizen::Graphics::Color& color);
72         result SetOutlineColor(const Tizen::Graphics::Color& color);
73         Tizen::Base::String& GetText(void) const;
74         Tizen::Graphics::Color GetTextColor(void) const;
75         Tizen::Graphics::Color GetBackgroundColor(void) const;
76         Tizen::Graphics::Color GetOutlineColor(void) const;
77
78         _CutLinkType ConvertObjectLinkType(Tizen::Base::Utility::LinkType type);
79         Tizen::Base::Utility::LinkType ConvertObjectLinkType(_CutLinkType type);
80         const Tizen::Base::String& GetLinkText(void) const;
81         Tizen::Base::Utility::LinkType GetLinkType(void) const;
82         bool IsAuto(void) const;
83         _EnrichedTextImpl* GetRegisteringEnrichedText(void) const;
84         void SetRegisteringEnrichedText(_EnrichedTextImpl* pEnrichedTextImpl);
85
86         result Create(const Tizen::Base::String& text, int length, Tizen::Graphics::_Text::TextElementSourceType srcType);
87         result CreateUserLink(const Tizen::Base::String& text, _CutLinkType linkType);
88         result CreateAutoLink(const Tizen::Base::String& text, unsigned long autoLink);
89         void Destroy(void);
90         _CutLinkType ConvertLinkType(Tizen::Base::Utility::LinkType type) const;
91         _CutLinkType GetCutLinkType(void) const;
92         int GetLength(void) const;
93         int GetAutolinkSrcOffset(void) const;
94         result SetTextObjectFont(const Tizen::Graphics::Font& font);
95         Tizen::Graphics::_Text::TextElement* GetComponent(void) const;
96
97         const Tizen::Graphics::Font* GetFont(void) const;
98         unsigned long GetAutoLink(void) const;
99         bool IsBackgoundColorEnable(void) const;
100         bool IsOutlineColorEnable(void) const;
101         bool IsConstructed(void) const;
102
103         static _TextElementImpl* GetInstance(TextElement& element);
104         static const _TextElementImpl* GetInstance(const TextElement& element);
105
106 private:
107         Tizen::Base::String __strText;
108         Tizen::Graphics::Color __foregroundColor;
109         Tizen::Graphics::Color __backgroundColor;
110         Tizen::Graphics::Color __outlineColor;
111         Tizen::Graphics::Color __disableFGColor;
112
113         Tizen::Base::String __linkText;
114         Tizen::Base::Utility::LinkType __linkType;
115         const Tizen::Graphics::Font* __pFont;
116         bool __isAuto;
117         bool __bgColorEnable;
118         bool __outlineColorEnable;
119         unsigned long __autoLink;
120
121         _EnrichedTextImpl* __pRegisteringEnrichedText;
122
123         int __count;
124         int __linkOffset;
125         Tizen::Graphics::_Text::TextElement* __pTextComponent;
126
127 private:
128         _TextElementImpl(const _TextElementImpl& textElementImpl);
129         _TextElementImpl& operator =(const _TextElementImpl& rhs);
130
131 }; // _TextElementImpl
132
133 }} // Tizen::Graphics
134
135 #endif // _FGRP_INTERNAL_TEXT_ELEMENT_IMPL_H_