2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 * @file FGrp_TextTextObject.h
20 * @brief This is the header file for the TextObject class.
22 * This file contains the declarations of TextObject class.
25 #ifndef _FGRP_INTERNAL_TEXT_OBJECT_H_
26 #define _FGRP_INTERNAL_TEXT_OBJECT_H_
29 #include "FGrp_TextCommon.h"
31 // Forward Declarations
32 namespace Tizen { namespace Graphics {
41 class TextWidthManager;
45 class _OSP_EXPORT_ TextObject
50 virtual ~TextObject(void);
53 result Construct(void);
55 result Construct(const Rectangle& rect);
57 TextObject* CloneN(void);
59 result Draw(_CanvasImpl& canvasImpl);
61 result DrawLine(_CanvasImpl& canvasImpl, int lineIndex);
63 result DrawWithOffset(_CanvasImpl& canvasImpl);
65 bool IsChanged(void) const;
69 result GetChangedLineRange(int& startChangedLineIndex, int& endChangedLineIndex);
71 int GetText(wchar_t* pCopiedText, int textLength) const;
73 result RemoveAll(bool deallocate = true);
75 result RemoveElement(TextElement& textElement, bool deallocate);
77 result RemoveElementAt(int elementIndex, bool deallocate);
79 result AppendElement(TextElement& textElement);
81 result AppendElement(Bitmap& bitmap, TextElementSourceType sourceType);
83 result InsertElementAt(int textIndex, TextElement& textElement);
85 result InsertElementAt(int textIndex, Bitmap& bitmap, TextElementSourceType sourceType);
87 int GetElementIndexOf(TextElement& textElement) const;
89 int GetElementCount(void) const;
91 TextElement* GetElementAtElementIndex(int elementIndex) const;
93 TextElement* GetElementAtTextIndex(int textIndex) const;
95 int GetTextIndexFromPosition(int lcX, int lcY, bool cursorMode = false) const;
97 int GetTextIndexFromPositionAtLine(int lineIndex, int lcX, bool cursorMode = false) const;
99 result ChangeTextOffset(wchar_t* pText, int textIndex, int gap);
101 result NotifyTextChanged(wchar_t* pText, int textOffset, int textLength, int gap);
103 int GetTotalLineCount(void) const;
105 int GetLineIndexAtTextIndex(int textIndex) const;
107 int GetTotalHeight(void) const;
109 int GetLineHeightAt(int lineIndex) const;
111 int GetLineWidthAt(int lineIndex) const;
113 int GetDisplayLineCount(void) const;
115 int GetLineIndexAtPositionY(int lcY) const;
117 int GetFirstTextIndexAt(int lineIndex) const;
119 int GetTextLengthAt(int lineIndex) const;
121 int GetMaxLineHeight(void) const;
123 int GetTextLength(void) const;
125 Dimension GetTextExtent(int startTextIndex, int textLength) const;
127 result SetAction(TextObjectActionType action);
129 TextObjectActionType GetAction(void) const;
131 result SetAlignment(TextObjectAlignment alignment);
133 TextObjectAlignment GetAlignment(void) const;
135 result SetElementVerticalAlignment(TextObjectAlignment alignment);
137 TextObjectAlignment GetElementVerticalAlignment(void) const;
139 result SetBounds(const Rectangle& lcRect);
141 Rectangle GetBounds(void) const;
143 result SetLineSpace(int lcLineSpacing);
145 int GetLineSpace(void) const;
147 result SetRange(int startTextIndex, int textLength);
149 void GetRange(int& startTextIndex, int& textLength) const;
151 result SetFont(Font* pFont, int startTextIndex, int textLength);
153 const Font* GetFont(int textIndex) const;
155 result SetForegroundColor(const Color& color, int startTextIndex, int textLength);
157 Color GetForegroundColor(int textIndex) const;
159 result SetBackgroundColor(const Color& color, int startTextIndex, int textLength);
161 Color GetBackgroundColor(int textIndex) const;
163 result SetOutlineColor(const Color& color, int startTextIndex, int textLength);
165 Color GetOutlineColor(int textIndex) const;
167 result SetWrap(TextObjectWrapType wrap);
169 TextObjectWrapType GetWrap(void) const;
171 result SetCursorIndex(int cursorIndex);
173 int GetCursorIndex(void) const;
175 result SetBlock(bool enable);
177 bool GetBlock(void) const;
179 result SetBlockRange(int startTextIndex, int textLength);
181 void GetBlockRange(int& startTextIndex, int& textLength);
183 result SetSlidingStep(int lcSlidingStep);
185 int GetSlidingStep(void) const;
187 result SetAlternateLookEnabled(bool enable);
189 bool IsAlternateLookEnabled(void) const;
191 result SetWidthManagerEnabled(bool widthManagerEnable);
193 bool IsWidthManagerEnabled(void) const;
195 result SetFirstDisplayLineIndexFromTextIndex(int textIndex);
197 result SetFirstDisplayLineIndex(int lineIndex);
199 int GetFirstDisplayLineIndex(void) const;
201 result SetFirstDisplayPositionY(int lcY);
203 int GetFirstDisplayPositionY(void) const;
205 result SetPartialComposingModeEnabled(bool enable);
207 bool IsPartialComposingModeEnabled(void) const;
209 result SetTextObjectEllipsisType(TextObjectEllipsisType type);
211 TextObjectEllipsisType GetTextObjectEllipsisType(void) const;
213 result HideFrontSpace(TextObjectSpaceHideType mode);
215 result HideRearSpace(TextObjectSpaceHideType mode);
217 result SetAlternativeForegroundColor(const Color& color);
219 result SetCutLinkViewMode(bool enable);
221 int GetTotalCutLinkElementCount(void) const;
223 int GetCutLinkIndexFromPositionData(int lcX, int lcY) const;
225 TextElement* GetCutLinkElementAtCutLinkElementIndex(int linkIndex) const;
227 result ChangeCutLinkState(int linkIndex, bool select);
229 result ResetAllCutLinkElementsState(void);
231 result SetCutLinkColor(Tizen::Base::Utility::LinkType linkType, const Color& color, const Color& colorInSelect);
233 result ResetCutLinkColor(Tizen::Base::Utility::LinkType linkType);
235 result GetCutLinkBounds(int cutLinkIndex, Point& startPoint, Point& endPoint) const;
237 bool IsActionOn(void) const;
239 bool IsDisplayedAtStartPosition(void) const;
241 bool IsDisplayedAtEndPosition(void) const;
243 result GetTextPositionInfoAt(int textIndex, int& width, int& height, int& absX, int& absY, int& logicalX, int& logicalY) const;
245 TextObjectSweepInfo GetSweepInfo(void) const;
247 result ResetSweepInfo(void);
249 result GetSweepComposeLineInfo(int lineIndex, TextObjectSweepComposeLineInfo& textSweepComposeLineInfo) const;
251 int GetTextOffsetAtLine(int lineIndex) const;
253 int GetTextLengthAtLine(int lineIndex) const;
255 Rectangle GetBoundsAtLine(int lineIndex) const;
257 result SetBlockColor(const Color& color);
259 Color GetBlockColor(void) const;
262 result DrawByLine(_CanvasImpl& canvasImpl, const Rectangle& displayRect);
264 int GetTotalComposedHeight(void) const;
266 result GetTextPositionInfoInWrapAt(int textIndex, int& width, int& height, int& absX, int& absY,
267 int& logicalX, int& logicalY) const;
269 result GetTextPositionInfoInNoneWrapAt(int textIndex, int& width, int& height, int& absX, int& absY,
270 int& logicalX, int& logicalY) const;
272 int GetTextIndexFromPositionInWrap(int pcX, int pcY, bool cursorMode = true) const;
274 int GetTextIndexFromPositionInNoneWrap(int pcX, int pcY, bool cursorMode = true) const;
276 result UpdateChangedInfo(int startTextIndex, int textLength = -1, bool initTextWidthManager = true);
278 result NotifyTextAdded(int textIndex, int textLength);
280 result NotifyTextDeleted(int textIndex, int textLength);
282 result SetFirstDisplayLineIndexFromTextIndexInWrap(int textIndex);
284 result SetFirstDisplayLineIndexFromTextIndexInNoneWrap(int textIndex);
286 result ChangeText(int textIndex);
288 result InputText(int textIndex);
290 result RemoveText(int textIndex);
292 Point GetDisplayPositionAtLine(int lineIndex, int textIndexFromLineOffset);
298 TextObjectActionType __action;
299 TextObjectAlignment __align;
300 TextObjectWrapType __wrap;
301 TextComposite* __pCompositeText;
302 TextColumn* __pTextColumn;
305 bool __isAlternateLookEnabled;
306 Font* __pDefaultFont;
307 Color __defaultForegroundColor;
308 Color __defaultBackgroundColor;
309 Color __defaultOutlineColor;
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;
321 TextObjectSweepInfo __sweepInfo;
324 TextObject(const TextObject& other); // NOT IMPLMENTED
326 TextObject& operator =(const TextObject& rhs); // NOT IMPLMENTED
330 }}} // Tizen::Graphics::_Text
332 #endif // _FGRP_INTERNAL_TEXT_OBJECT_H_