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_TextTextComposite.h
20 * @brief This file contains the declarations of TextComposite class.
23 #ifndef _FGRP_INTERNAL_TEXT_COMPOSITE_H_
24 #define _FGRP_INTERNAL_TEXT_COMPOSITE_H_
26 #include <FBaseColLinkedList.h>
27 #include "FGrp_TextCommon.h"
28 #include "FGrp_TextTextElement.h"
30 namespace Tizen { namespace Graphics
41 class TextCutLinkListInfo;
42 class TextWidthManager;
43 struct NoneWrapComposeInfo;
48 TextComposite(TextElement* pTextElement = null);
50 virtual ~TextComposite(void);
53 virtual int ForwardAnalyze(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap,
54 int& actualLength, int& width, int& height);
56 virtual int ForwardAnalyzeWithBaseline(int startTextIndex, int textLength, int maxWidth, TextObjectWrapType wrap,
57 int& actualLength, int& width, int& height, int& baseline);
59 virtual int ForwardAnalyzeWithFocusedObjectType(int textIndex, int textLength, int maxWidth,
60 int& cursorIndex, TextElementType& type);
62 virtual result Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
63 const TextObjectActionType action);
65 virtual result GetRegion(int textIndex, int textLength, int& width, int& height) const;
67 virtual int GetHeight(int textIndex) const;
69 virtual int GetTextLength(void) const;
71 virtual int Compose(Rectangle& rect, TextColumn* pTextColumn);
73 result DrawWithBaseline(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment alignment,
74 const TextObjectActionType action, int baseline);
76 result InsertElementAt(TextElement& textElement, int textIndex);
78 result AppendElement(TextElement& textElement);
80 result RemoveElementAt(int elementIndex, bool deallocate = true);
82 result RemoveAllElements(bool deallocate = true);
84 result DrawLine(_CanvasImpl& canvasImpl, TextLine* pTextLine, const Rectangle& displayRect, const TextObjectAlignment align, const TextObjectActionType action);
86 result DrawPartial(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength);
88 result DrawAbbrev(_CanvasImpl& canvasImpl, const Rectangle& displayRect, const TextObjectAlignment align);
90 result GetText(TextComposite* pTargetCompsiteText, int textIndex, int textLength);
92 result Optimize(int startElementIndex, int endElementIndex);
94 bool IsComposeDone(void) const;
96 result ChangeTextOffset(wchar_t* pText, int elementIndex, int gap);
98 result NotifyTextChanged(wchar_t* pText, int startTextIndex, int textLength, int gap, Font* pFont,
99 const Color& fgColor, const Color& bgColor, const Color& outlineColor);
101 void HideFrontSpace(TextObjectSpaceHideType mode);
103 void HideRearSpace(TextObjectSpaceHideType mode);
105 result GetValue(TextElement* pTextElement, TextComponentInfoValueType type, unsigned int* value) const;
107 int GetElementCount(void) const;
109 int GetElementIndexOf(TextElement& textElement) const;
111 TextElement* GetElementAtElementIndex(int elementIndex) const;
113 TextElement* GetElementAtTextIndex(int textIndex, int& elementTextOffset, int& elementIndex, int& elementTextLength,
114 int& textIndexFromElementOffset) const;
116 TextElement* GetElementAtTextIndex(int textIndex) const;
118 result SetFont(Font* pFont);
120 Font* GetFont(int textIndex) const;
122 result SetForegroundColor(const Color& color);
124 Color GetForegroundColor(int textIndex) const;
126 result SetBackgroundColor(const Color& color);
128 Color GetBackgroundColor(int textIndex) const;
130 result SetOutlineColor(const Color& color);
132 Color GetOutlineColor(int textIndex) const;
134 Color GetAlternativeForegroundColor(int textIndex) const;
136 result SetRange(int textStartIndex, int textLength);
138 void GetRange(int& startTextIndex, int& textLength) const;
140 void SetLineSpace(int gap);
142 int GetLineSpace(void) const;
144 void SetElementVerticalAlignment(TextObjectAlignment alignment);
146 TextObjectAlignment GetElementVerticalAlignment(void) const;
148 result SetWrap(TextObjectWrapType wrap);
150 TextObjectWrapType GetWrap(void) const;
152 void SetBlock(bool enable);
154 bool GetBlock(void) const;
156 result SetImageAlign(TextObjectAlignment align);
158 TextObjectAlignment GetImageAlign(int textIndex) const;
160 void SetCursorIndex(int cursorIndex);
162 int GetCursorIndex(void) const;
164 void SetTextAbbreviationEnabled(bool enable);
166 bool IsTextAbbreviationEnabled(void) const;
168 void SetPartialComposingModeEnabled(bool enable);
170 bool IsPartialComposingModeEnabled(void) const;
172 void SetComposePartialLimitHeight(int limitHeight);
174 int GetComposePartialLimitHeight(void) const;
176 void SetWidthManagerEnabled(bool widthManagerEnable);
178 bool IsWidthManagerEnabled(void) const;
180 void SetTextObjectEllipsisType(TextObjectEllipsisType type);
182 TextObjectEllipsisType GetTextObjectEllipsisType(void) const;
184 int ForwardAnalyzeInNoneCursorMode(int startTextIndex, int textLength, int maxWidth, int& textIndex);
186 int GetTotalComposedHeight(void) const;
188 int GetAnalysedTotalHeight(void) const;
190 bool IsChanged(void) const;
192 result ChangeCutLinkState(int linkIndex, bool select);
194 result ResetAllCutLinkElementsState(void);
196 int GetCutLinkElementCount(void) const;
198 int GetCutLinkElementIndexAt(int textIndex) const;
200 TextCutLink* GetCutLinkElementAtCutLinkElementIndex(int index) const;
202 result GetCutLinkObjectInfo(int cutLinkIndex, int& textStartIndex, int& textLength) const;
204 bool InitPartialComposeMode(void);
206 void SetTextWidthManager(TextWidthManager* pTextWidthManager);
208 TextElement* SearchTextElement(TextElementType type, int textIndex, int& elementTextOffset) const;
210 TextElementType GetObjectType(int textIndex) const;
212 int GetMaxLineHeight(void) const;
214 int GetWorkStart(void) const;
216 int GetWorkLength(void) const;
218 result SetAlternateLookEnabled(bool enable);
220 result SetWorkWidth(Font* pFont, wchar_t* pText, int workStart, int textLength);
222 int GetWorkWidth(void);
224 void SetTextSweepInfo(TextObjectSweepInfo* pTextSweepInfo);
226 void GetTextSweepInfo(TextObjectSweepInfo& textSweepInfo);
228 void UpdateTextSweepInfo(TextObjectSweepInfo* pTextSweepInfo);
230 void SetBlockColor(const Color& color);
232 Color GetBlockColor(void) const;
235 int ComposeInNoneWrap(Rectangle& rect, NoneWrapComposeInfo* pNoneWrapComposeInfo = null);
237 int ComposeInNormalWrap(Rectangle& rect);
239 int ComposeInWordWrap(Rectangle& rect);
241 int ComposeInWrap(Rectangle& rect);
243 int ComposeInWrapByTextWidth(Rectangle& rect);
245 int ComposeInNoneWrapMiddleEllipsis(Rectangle& rect);
247 int ComposeInNoneWrapHeadEllipsis(Rectangle& rect);
249 int ComposeInPartialMode(Rectangle& rect);
251 bool BackwardAnalyze(int startTextIndex, int maxWidth, int* actualLength, int* width, int* height);
253 result DrawAbbrevInMiddleEllipsis(_CanvasImpl& canvasImpl, const Rectangle& displayRect, const TextObjectAlignment alignment);
255 result DrawAbbrevInHeadEllipsis(_CanvasImpl& canvasImpl, const Rectangle& displayRect, const TextObjectAlignment alignmen);
257 result SetValueToAllTextElements(TextComponentInfoValueType type, unsigned int value);
259 bool SetAbbrevObjectFontInfo(TextSimple* pSimpleTextElement);
261 result GetValue(int textIndex, TextComponentInfoValueType type, unsigned int* value) const;
263 int GetFirstTextIndexAt(int elementIndex) const;
267 TextObjectWrapType __wrap;
269 Tizen::Base::Collection::LinkedList* __pTextElementList;
270 Color __defaultBlockColor;
276 bool __ignoreRearBlank;
277 bool __ignoreFrontBlank;
278 TextObjectSpaceHideType __rearSpaceHideMode;
279 TextObjectSpaceHideType __frontSpaceHideMode;
281 TextObjectAlignment __elementVertialAlignment;
282 TextColumn* __pCurrentTextColumn;
283 TextSimple* __pAbbrevTextElement;
284 bool __partialComposingModeEnabled;
285 int __lineIndexCompositeDone;
286 int __totalComposedHeight;
287 int __composePartialLimitHeight;
288 TextCutLinkListInfo* __pCutLinkListInfo;
289 TextObjectEllipsisType __TextObjectEllipsisType;
290 bool __drawAbbrevText;
291 bool __drawTextEllipsis;
292 int __middleEllipsisTextLengthInHead;
293 int __middleEllipsisHeadWidth;
294 int __middleEllipsisWidth;
295 int __middleEllipsisTextLengthInTail;
296 int __headEllipsisWidth;
297 int __headEllipsisTextLength;
298 TextWidthManager* __pTextWidthManager;
299 bool __widthManagerEnabled;
301 TextObjectSweepInfo* __pSweepInfo;
304 TextComposite(const TextComposite&); // NOT IMPLMENTED
306 TextComposite& operator =(const TextComposite&); // NOT IMPLMENTED
310 }}} // Tizen::Graphics::_Text
312 #endif // _FGRP_INTERNAL_TEXT_COMPOSITE_H_