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_EnrichedTextImpl.cpp
20 * @brief This is the cpp file for _EnrichedTextImpl class.
26 #include "FGrp_EnrichedTextImpl.h"
27 #include "FGrp_TextElementImpl.h"
28 #include "FGrp_TextTextElement.h"
29 #include "FGrp_TextTextObject.h"
30 #include "util/FGrp_Util.h"
31 #include "FGrp_CoordinateSystemUtils.h"
34 using namespace Tizen::Base;
35 using namespace Tizen::Base::Utility;
36 using namespace Tizen::Graphics::_Text;
37 using namespace Tizen::Graphics;
39 namespace Tizen { namespace Graphics
42 _EnrichedTextImpl::_EnrichedTextImpl(void)
48 __verticalAlignment = TEXT_ALIGNMENT_VERTICAL_MIN;
49 __horizontalAlignment = TEXT_ALIGNMENT_HORIZONTAL_MIN;
50 __elementVerticalAlignment = TEXT_ALIGNMENT_VERTICAL_MIN;
51 __pLinkedListTextElementList = null;
52 __pTextElement = null;
53 __isCopiedEnrichedText = false;
54 __pLinkedListTextElementList = null;
55 __pTextElement = null;
58 _EnrichedTextImpl::~_EnrichedTextImpl(void)
60 if (GetTextElementCount() > 0)
62 RemoveAllTextElements(false);
67 delete __pTextElement;
68 __pTextElement = null;
71 if (__pLinkedListTextElementList)
73 delete __pLinkedListTextElementList;
74 __pLinkedListTextElementList = null;
79 _EnrichedTextImpl::Construct(const Tizen::Graphics::Dimension& dim)
81 FloatDimension dimF = _CoordinateSystemUtils::ConvertToFloat(dim);
83 return Construct(dimF);
87 _EnrichedTextImpl::Construct(const Tizen::Graphics::FloatDimension& dim)
89 SysTryReturn(NID_GRP, (dim.width > 0.0f) && (dim.height > 0.0f), E_INVALID_ARG, E_INVALID_ARG
90 , "[E_INVALID_ARG] The argument is invalid. (width = %d height = %d)", dim.width, dim.height);
95 __height = dim.height;
98 __pLinkedListTextElementList = new (std::nothrow) Tizen::Base::Collection::LinkedList;
100 , __pLinkedListTextElementList
101 , r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Fails to create a element list.", GetErrorMessage(r));
103 __pTextElement = new (std::nothrow) TextElement();
106 , r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Fails to create a element.", GetErrorMessage(r));
108 __pTextObject.reset(new (std::nothrow)TextObject);
111 , r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Fails to create a TextObject.", GetErrorMessage(r));
113 __pTextObject->Construct();
114 __pTextObject->SetBounds(FloatRectangle(0.0f, 0.0f, __width, __height));
115 __pTextObject->SetCutLinkViewMode(true);
116 __pTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
117 __pTextObject->HideFrontSpace(TEXT_OBJECT_SPACE_HIDE_TYPE_ONE);
119 // this is only to manage user's bitmap
120 r = __elements.Construct();
125 if (__pLinkedListTextElementList)
127 delete __pLinkedListTextElementList;
128 __pLinkedListTextElementList = null;
133 delete __pTextElement;
134 __pTextElement = null;
141 _EnrichedTextImpl::InsertAt(int elementIndex, Tizen::Graphics::TextElement& element)
143 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
144 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
145 SysTryReturn(NID_GRP, elementIndex >= 0 && elementIndex <= GetTextElementCount()
146 , E_INVALID_ARG, E_INVALID_ARG
147 , "[E_INVALID_ARG] The argument is invalid.");
149 result r = E_SUCCESS;
152 _TextElementImpl* pTextElementImpl = _TextElementImpl::GetInstance(element);
153 if (pTextElementImpl == null)
155 return E_INVALID_ARG;
158 if (pTextElementImpl->GetRegisteringEnrichedText() != null)
160 return E_INVALID_ARG;
162 pTextElementImpl->SetRegisteringEnrichedText(this);
164 count = __pTextObject->GetElementCount();
165 if (elementIndex > count)
167 return E_INVALID_ARG;
170 for (int i = 0; i < elementIndex; i++)
172 _Text::TextElement* pTextComponent = __pTextObject->GetElementAtElementIndex(i);
173 if (pTextComponent != null)
175 textLength = textLength + pTextComponent->GetTextLength();
179 __pTextObject->InsertElementAt(textLength, *(pTextElementImpl->GetComponent()));
180 __pTextObject->Compose();
182 r = __pLinkedListTextElementList->InsertAt(element, elementIndex);
184 if (__isCopiedEnrichedText == false)
188 __elements.InsertAt(*__pTextElement, elementIndex);
196 _EnrichedTextImpl::RemoveAt(int elementIndex, bool deallocate)
198 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
199 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
200 SysTryReturn(NID_GRP, elementIndex >= 0 && elementIndex <= GetTextElementCount()
201 , E_INVALID_ARG, E_INVALID_ARG
202 , "[E_INVALID_ARG] The argument is invalid.");
204 if (__pTextObject.use_count() > 1)
209 result r = E_SUCCESS;
210 int count = GetTextElementCount();
211 TextElement* pTextElement = null;
218 pTextElement = dynamic_cast < TextElement* >(__pLinkedListTextElementList->GetAt(elementIndex));
219 if (pTextElement == null) //Bitmap??
221 __pTextObject->RemoveElementAt(elementIndex, true);
222 __pLinkedListTextElementList->RemoveAt(elementIndex, true);
224 if (__isCopiedEnrichedText == false)
226 __elements.RemoveAt(elementIndex, deallocate);
231 _TextElementImpl* pTextElementImpl = _TextElementImpl::GetInstance(*pTextElement);
232 pTextElementImpl->SetRegisteringEnrichedText(null);
233 _Text::TextElement* pTextComponent = pTextElementImpl->GetComponent();
235 __pTextObject->RemoveElement(*pTextComponent, false);
236 __pLinkedListTextElementList->RemoveAt(elementIndex, deallocate);
238 if (__isCopiedEnrichedText == false)
240 __elements.RemoveAt(elementIndex, false);
248 _EnrichedTextImpl::Remove(Tizen::Graphics::TextElement& element, bool deallocate)
250 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
251 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
253 if (__pTextObject.use_count() > 1)
258 int textElementIndex = 0;
259 result r = E_SUCCESS;
260 TextElement* pTextElement = null;
262 r = __pLinkedListTextElementList->IndexOf(element, textElementIndex);
265 return E_INVALID_ARG;
268 pTextElement = dynamic_cast < TextElement* >(__pLinkedListTextElementList->GetAt(textElementIndex));
271 _TextElementImpl* pTextElementImpl = _TextElementImpl::GetInstance(*pTextElement);
272 pTextElementImpl->SetRegisteringEnrichedText(null);
273 _Text::TextElement* pTextComponent = pTextElementImpl->GetComponent();
275 if (__pTextObject->RemoveElement(*pTextComponent, false) != E_SUCCESS)
277 return E_INVALID_ARG;
280 __pLinkedListTextElementList->RemoveAt(textElementIndex, deallocate);
287 _EnrichedTextImpl::Add(Tizen::Graphics::TextElement& element)
289 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED, "[E_OPERATION_FAILED] This instance is not constructed yet.");
291 result r = E_SUCCESS;
293 _TextElementImpl* pTextElementImpl = _TextElementImpl::GetInstance(element);
296 , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
298 _Text::TextElement* pTextComponent = pTextElementImpl->GetComponent();
301 , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
303 if (pTextElementImpl->GetRegisteringEnrichedText() != null)
305 return E_INVALID_ARG;
307 pTextElementImpl->SetRegisteringEnrichedText(this);
309 __pTextObject->AppendElement(*pTextComponent);
310 __pTextObject->SetRange(0, __pTextObject->GetTextLength());
311 __pTextObject->Compose();
313 __pLinkedListTextElementList->Add(element);
315 if (__isCopiedEnrichedText == false)
319 __elements.Add(*__pTextElement);
327 _EnrichedTextImpl::RemoveAllTextElements(bool deallocate)
329 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED, "[E_OPERATION_FAILED] This instance is not constructed yet.");
331 result r = E_SUCCESS;
332 int elementCount = __pLinkedListTextElementList->GetCount();
334 for (int i = 0; i < elementCount; i++)
336 r = RemoveAt(0, deallocate);
349 _EnrichedTextImpl::RemoveAll(bool deallocate)
351 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED, "[E_OPERATION_FAILED] This instance is not constructed yet.");
353 result r = E_SUCCESS;
355 int elementCount = __pLinkedListTextElementList->GetCount();
357 for (int i = 0; i < elementCount; i++)
359 r = RemoveAt(0, deallocate);
372 _EnrichedTextImpl::GetTextElementAt(int elementIndex) const
374 SysTryReturn(NID_GRP, __pTextObject != null, null, E_OPERATION_FAILED
375 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
376 SysTryReturn(NID_GRP, elementIndex >= 0 && elementIndex < GetTextElementCount(), null, E_INVALID_ARG
377 , "[E_INVALID_ARG] The argument is invalid. elementIndex = %d total element count = %d", elementIndex, GetTextElementCount());
379 TextElement* pElement = null;
383 pElement = dynamic_cast < TextElement* >(__pLinkedListTextElementList->GetAt(elementIndex));
385 SetLastResult(E_SUCCESS);
390 _EnrichedTextImpl::GetTextElementCount(void) const
392 SysTryReturn(NID_GRP, __pTextObject != null, 0, E_OPERATION_FAILED
393 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
395 return __pLinkedListTextElementList->GetCount();
399 _EnrichedTextImpl::SetSize(const Tizen::Graphics::Dimension& size)
401 FloatDimension sizeF = _CoordinateSystemUtils::ConvertToFloat(size);
403 return SetSize(sizeF);
407 _EnrichedTextImpl::SetSize(const Tizen::Graphics::FloatDimension& size)
409 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
410 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
411 SysTryReturn(NID_GRP, (size.width > 0.0f) && (size.height > 0.0f), E_OUT_OF_RANGE, E_OUT_OF_RANGE
412 , "[E_OUT_OF_RANGE] The given rectangle(width:%d,height:%d) is out of range.\n", size.width, size.height);
414 FloatRectangle rect(0.0f, 0.0f, size.width, size.height);
416 __pTextObject->SetBounds(rect);
417 __width = rect.width;
418 __height = rect.height;
424 _EnrichedTextImpl::SetSize(int width, int height)
426 return SetSize(_CoordinateSystemUtils::ConvertToFloat(width),_CoordinateSystemUtils::ConvertToFloat(height));
430 _EnrichedTextImpl::SetSize(float width, float height)
432 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
433 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
434 SysTryReturn(NID_GRP, (width > 0.0f) && (height > 0.0f), E_OUT_OF_RANGE, E_OUT_OF_RANGE
435 , "[E_OUT_OF_RANGE] The given rectangle(width:%d,height:%d) is out of range.\n", width, height);
437 FloatDimension dim(width, height);
439 result r = SetSize(dim);
444 Tizen::Graphics::Dimension
445 _EnrichedTextImpl::GetSize(void) const
447 SysTryReturn(NID_GRP, __pTextObject != null, Dimension(0, 0), E_OPERATION_FAILED
448 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
452 dim.width = _CoordinateSystemUtils::ConvertToInteger(__width);
453 dim.height = _CoordinateSystemUtils::ConvertToInteger(__height);
458 Tizen::Graphics::FloatDimension
459 _EnrichedTextImpl::GetSizeF(void) const
461 SysTryReturn(NID_GRP, __pTextObject != null, FloatDimension(0.0f, 0.0f), E_OPERATION_FAILED
462 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
467 dim.height = __height;
473 _EnrichedTextImpl::GetSize(int& width, int& height) const
475 SysTryReturn(NID_GRP, __pTextObject != null, , E_OPERATION_FAILED
476 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
478 width = _CoordinateSystemUtils::ConvertToInteger(__width);
479 height = _CoordinateSystemUtils::ConvertToInteger(__height);
483 _EnrichedTextImpl::GetSize(float& width, float& height) const
485 SysTryReturn(NID_GRP, __pTextObject != null, , E_OPERATION_FAILED
486 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
493 _EnrichedTextImpl::GetWidth(void) const
495 SysTryReturn(NID_GRP, __pTextObject != null, 0, E_OPERATION_FAILED
496 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
498 return _CoordinateSystemUtils::ConvertToInteger(__width);
502 _EnrichedTextImpl::GetWidthF(void) const
504 SysTryReturn(NID_GRP, __pTextObject != null, 0.0f, E_OPERATION_FAILED
505 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
511 _EnrichedTextImpl::GetHeight(void) const
513 SysTryReturn(NID_GRP, __pTextObject != null, 0, E_OPERATION_FAILED
514 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
516 return _CoordinateSystemUtils::ConvertToInteger(__height);
520 _EnrichedTextImpl::GetHeightF(void) const
522 SysTryReturn(NID_GRP, __pTextObject != null, 0.0f, E_OPERATION_FAILED
523 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
529 _EnrichedTextImpl::SetVerticalAlignment(TextVerticalAlignment alignment)
531 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
532 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
534 TextObjectAlignment verticalAlign = ConvertVAlignment(alignment);
535 if (verticalAlign == TEXT_OBJECT_ALIGNMENT_INVALID)
537 return E_INVALID_ARG;
540 TextObjectAlignment align = static_cast < TextObjectAlignment >((static_cast < TextObjectAlignment >(__pTextObject->GetAlignment())
541 & TEXT_HORIZONTAL_ALIGNMENT) | (verticalAlign & TEXT_VERTICAL_ALIGNMENT));
543 __pTextObject->SetAlignment(align);
544 __verticalAlignment = alignment;
550 _EnrichedTextImpl::SetHorizontalAlignment(TextHorizontalAlignment alignment)
552 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
553 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
555 TextObjectAlignment horizontalAalign = ConvertHAlignment(alignment);
556 if (horizontalAalign == TEXT_OBJECT_ALIGNMENT_INVALID)
558 return E_INVALID_ARG;
561 TextObjectAlignment align = static_cast < TextObjectAlignment >((static_cast < TextObjectAlignment >(__pTextObject->GetAlignment())
562 & TEXT_VERTICAL_ALIGNMENT) | (horizontalAalign & TEXT_HORIZONTAL_ALIGNMENT));
564 __pTextObject->SetAlignment(align);
565 __horizontalAlignment = alignment;
570 TextVerticalAlignment
571 _EnrichedTextImpl::GetVerticalAlignment(void) const
573 SysTryReturn(NID_GRP, __pTextObject != null, TEXT_ALIGNMENT_VERTICAL_MIN, E_OPERATION_FAILED
574 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
576 return __verticalAlignment;
579 TextHorizontalAlignment
580 _EnrichedTextImpl::GetHorizontalAlignment(void) const
582 SysTryReturn(NID_GRP, __pTextObject != null, TEXT_ALIGNMENT_HORIZONTAL_MIN, E_OPERATION_FAILED
583 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
585 return __horizontalAlignment;
589 _EnrichedTextImpl::SetTextWrapStyle(TextWrap wrap)
591 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
592 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
594 SysTryReturn(NID_GRP, (TEXT_WRAP_MIN < wrap) && (wrap < TEXT_WRAP_MAX), E_INVALID_ARG, E_INVALID_ARG
595 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
597 _TextWrapType textWrap = ConvertWrapType(wrap);
599 if (__pTextObject->SetWrap(static_cast < TextObjectWrapType >(textWrap)) != E_SUCCESS)
601 return E_INVALID_ARG;
608 _EnrichedTextImpl::GetTextWrapStyle(void) const
610 SysTryReturn(NID_GRP, __pTextObject != null, TEXT_WRAP_MIN, E_OPERATION_FAILED
611 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
613 _TextWrapType textWrapType = static_cast < _TextWrapType >(__pTextObject->GetWrap());
614 TextWrap textWrap = ConvertWrap(textWrapType);
620 _EnrichedTextImpl::SetTextAbbreviationEnabled(bool enable)
622 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
623 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
625 TextObjectActionType action = TEXT_OBJECT_ACTION_TYPE_NONE;
629 action = TEXT_OBJECT_ACTION_TYPE_ABBREV;
632 __pTextObject->SetAction(action);
638 _EnrichedTextImpl::IsTextAbbreviationEnabled(void) const
640 SysTryReturn(NID_GRP, __pTextObject != null, false, E_OPERATION_FAILED
641 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
644 TextObjectActionType action = __pTextObject->GetAction();
646 if (action & TEXT_OBJECT_ACTION_TYPE_ABBREV)
655 _EnrichedTextImpl::SetLineSpace(int lineSpace)
657 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
658 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
659 SysTryReturn(NID_GRP, lineSpace > 0, E_INVALID_ARG, E_INVALID_ARG
660 , "[E_INVALID_ARG] The argument is invalid.");
662 __lineSpace = _CoordinateSystemUtils::ConvertToFloat(lineSpace);
663 __pTextObject->SetLineSpace(__lineSpace);
669 _EnrichedTextImpl::SetLineSpace(float lineSpace)
671 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
672 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
673 SysTryReturn(NID_GRP, lineSpace > 0.0f, E_INVALID_ARG, E_INVALID_ARG
674 , "[E_INVALID_ARG] The argument is invalid.");
676 __lineSpace = lineSpace;
677 __pTextObject->SetLineSpace(__lineSpace);
683 _EnrichedTextImpl::GetLineSpace(void) const
685 return _CoordinateSystemUtils::ConvertToInteger(__lineSpace);
689 _EnrichedTextImpl::GetLineSpaceF(void) const
695 _EnrichedTextImpl::Refresh(void)
697 SysTryReturn(NID_GRP, __pTextObject != null, , E_OPERATION_FAILED
698 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
700 __pTextObject->Compose();
704 _EnrichedTextImpl::GetTotalLineCount(void) const
706 SysTryReturn(NID_GRP, __pTextObject != null, 0, E_OPERATION_FAILED
707 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
709 __pTextObject->Compose();
711 return __pTextObject->GetTotalLineCount();
715 _EnrichedTextImpl::GetTotalLineHeight(void) const
717 return _CoordinateSystemUtils::ConvertToInteger(GetTotalLineHeightF());
721 _EnrichedTextImpl::GetTotalLineHeightF(void) const
723 SysTryReturn(NID_GRP, __pTextObject != null, 0.0f, E_OPERATION_FAILED
724 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
726 __pTextObject->Compose();
727 float height = __pTextObject->GetTotalHeightF();
733 _EnrichedTextImpl::GetDisplayLineCount(void) const
735 SysTryReturn(NID_GRP, __pTextObject != null, 0, E_OPERATION_FAILED
736 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
738 int count = __pTextObject->GetDisplayLineCount();
740 __pTextObject->Compose();
751 _EnrichedTextImpl::GetLineLength(int lineIndex) const
753 SysTryReturn(NID_GRP, __pTextObject != null, -1, E_OPERATION_FAILED
754 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
755 SysTryReturn(NID_GRP, GetTextElementCount() != 0, -1, E_OPERATION_FAILED
756 , "[E_OPERATION_FAILED] It doesn't have TextElement.");
757 SysTryReturn(NID_GRP, lineIndex >= 0, -1, E_INVALID_ARG
758 , "[E_INVALID_ARG] The invalid lineIndex(%d) is given.", lineIndex);
760 int totalLineCount = __pTextObject->GetTotalLineCount();
762 if (lineIndex > totalLineCount)
764 return E_INVALID_ARG;
771 __pTextObject->Compose();
773 lineLength = __pTextObject->GetTextLengthAt(lineIndex);
774 if (lineLength == -1)
776 SetLastResult(E_INVALID_ARG);
781 SetLastResult(E_SUCCESS);
787 _EnrichedTextImpl::GetFirstTextIndex(int lineIndex) const
789 SysTryReturn(NID_GRP, __pTextObject != null, -1, E_OPERATION_FAILED
790 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
791 SysTryReturn(NID_GRP, lineIndex >= 0, -1, E_INVALID_ARG
792 , "[E_INVALID_ARG] The invalid lineIndex(%d) is given.", lineIndex);
795 __pTextObject->Compose();
797 int totalLineCount = __pTextObject->GetTotalLineCount();
798 if (lineIndex >= totalLineCount)
800 SetLastResult(E_INVALID_ARG);
804 int textIndex = __pTextObject->GetFirstTextIndexAt(lineIndex);
807 SetLastResult(E_INVALID_ARG);
812 SetLastResult(E_SUCCESS);
818 _EnrichedTextImpl::GetLineIndex(int textIndex) const
820 SysTryReturn(NID_GRP, __pTextObject != null, -1, E_OPERATION_FAILED
821 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
822 SysTryReturn(NID_GRP, textIndex >= 0, -1, E_INVALID_ARG
823 , "[E_INVALID_ARG] The invalid lineIndex(%d) is given.", textIndex);
826 __pTextObject->Compose();
828 int totalLineCount = __pTextObject->GetTotalLineCount();
829 int lineIndex = __pTextObject->GetLineIndexAtTextIndex(textIndex);
831 if ((lineIndex > totalLineCount) || (textIndex > totalLineCount) || (lineIndex == -1))
833 SetLastResult(E_INVALID_ARG);
838 SetLastResult(E_SUCCESS);
844 _EnrichedTextImpl::GetLineHeight(int lineIndex) const
846 return _CoordinateSystemUtils::ConvertToInteger(GetLineHeightF(lineIndex));
850 _EnrichedTextImpl::GetLineHeightF(int lineIndex) const
852 SysTryReturn(NID_GRP, __pTextObject != null, -1, E_OPERATION_FAILED
853 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
854 SysTryReturn(NID_GRP, lineIndex >= 0, -1, E_INVALID_ARG
855 , "[E_INVALID_ARG] The invalid lineIndex(%d) is given.\n", lineIndex);
858 __pTextObject->Compose();
860 int totalLineCount = __pTextObject->GetTotalLineCount();
861 if (lineIndex >= totalLineCount)
863 SetLastResult(E_INVALID_ARG);
867 float height = __pTextObject->GetLineHeightAtF(lineIndex);
869 SetLastResult(E_SUCCESS);
874 _EnrichedTextImpl::GetTextLength(void) const
876 SysTryReturn(NID_GRP, __pTextObject != null, 0, E_OPERATION_FAILED, "[E_OPERATION_FAILED] This instance is not constructed yet.");
878 if (GetTextElementCount() == 0)
883 __pTextObject->Compose();
885 return __pTextObject->GetTextLength();
889 _EnrichedTextImpl::GetTextExtent(int startTextIndex, int textLength, int& width, int& height, int& actualLength) const
891 float widthF = _CoordinateSystemUtils::ConvertToFloat(width);
892 float heightF = _CoordinateSystemUtils::ConvertToFloat(height);
894 result r = GetTextExtent(startTextIndex, textLength, widthF, heightF, actualLength);
896 width = _CoordinateSystemUtils::ConvertToInteger(widthF);
897 height = _CoordinateSystemUtils::ConvertToInteger(heightF);
903 _EnrichedTextImpl::GetTextExtent(int startTextIndex, int textLength, float& width, float& height, int& actualLength) const
905 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
906 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
907 SysTryReturn(NID_GRP, textLength >= 0, E_INVALID_ARG, E_INVALID_ARG
908 , "[E_INVALID_ARG] The given text length(%d) is invalid\n", textLength);
909 SysTryReturn(NID_GRP, startTextIndex <= GetTextLength(), E_INVALID_ARG, E_INVALID_ARG
910 , "[E_INVALID_ARG] 'startTextIndex' is greater than or equal to the text length.");
912 FloatDimension textSize;
916 if (GetTextLength() == 0)
924 if (startTextIndex + textLength <= 0)
932 __pTextObject->Compose();
933 textSize = __pTextObject->GetTextExtentF(startTextIndex, textLength);
934 width = textSize.width;
935 height = textSize.height;
937 if (GetTextLength() - startTextIndex > textLength)
939 actualLength = textLength;
943 actualLength = GetTextLength() - startTextIndex;
951 _EnrichedTextImpl::GetTextExtent(int startTextIndex, int textLength, Tizen::Graphics::Dimension& size, int &actualLength) const
953 FloatDimension sizeF = _CoordinateSystemUtils::ConvertToFloat(size);
955 result r = GetTextExtent(startTextIndex, textLength, sizeF, actualLength);
957 size = _CoordinateSystemUtils::ConvertToInteger(sizeF);
963 _EnrichedTextImpl::GetTextExtent(int startTextIndex, int textLength, Tizen::Graphics::FloatDimension& size, int &actualLength) const
965 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED, "[E_OPERATION_FAILED] This instance is not constructed yet.\n");
966 SysTryReturn(NID_GRP, textLength >= 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The given text length(%d) is invalid\n", textLength);
967 SysTryReturn(NID_GRP, startTextIndex <= GetTextLength(), E_INVALID_ARG, E_INVALID_ARG,
968 "[E_INVALID_ARG] 'startTextIndex' is greater than or equal to the text length.\n");
972 if (GetTextLength() == 0)
980 if (startTextIndex + textLength <= 0)
988 __pTextObject->Compose();
990 size = __pTextObject->GetTextExtentF(startTextIndex, textLength);
991 if (GetTextLength() - startTextIndex > textLength)
993 actualLength = textLength;
997 actualLength = GetTextLength() - startTextIndex;
1003 Tizen::Graphics::Dimension
1004 _EnrichedTextImpl::GetTextExtent(void) const
1006 return _CoordinateSystemUtils::ConvertToInteger(GetTextExtentF());
1009 Tizen::Graphics::FloatDimension
1010 _EnrichedTextImpl::GetTextExtentF(void) const
1012 SysTryReturn(NID_GRP, __pTextObject != null, FloatDimension(-1, -1), E_OPERATION_FAILED, "[E_OPERATION_FAILED] This instance is not constructed yet.\n");
1014 FloatDimension size(0,0);
1015 if (GetTextLength() == 0)
1020 __pTextObject->Compose();
1022 FloatRectangle rtBound = __pTextObject->GetBoundsF();
1023 if (rtBound.width >= 0.0f && rtBound.height >= 0.0f)
1025 size.width = rtBound.width;
1026 size.height = __pTextObject->GetTotalHeightF();
1040 _EnrichedTextImpl::Add(const Tizen::Graphics::Bitmap& bitmap)
1042 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
1043 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
1044 SysTryReturn(NID_GRP, &bitmap, E_INVALID_ARG, E_INVALID_ARG
1045 , "[E_INVALID_ARG] The source bitmap is invalid.");
1046 SysTryReturn(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, E_INVALID_ARG
1047 , "[E_INVALID_ARG] The source bitmap is invalid.");
1049 result r = E_SUCCESS;
1051 Bitmap* pBitmap = const_cast < Bitmap* >(&bitmap);
1052 Bitmap* pNewBitmap = new (std::nothrow) Bitmap();
1053 if (pNewBitmap == null)
1055 SysLog(NID_GRP, "[E_OUT_OF_MEMORY] Fail to create a bitmap.");
1056 return E_OUT_OF_MEMORY;
1059 r = pNewBitmap->Construct(*pBitmap, FloatRectangle(0, 0, pBitmap->GetWidthF(), pBitmap->GetHeightF()));
1062 , , r, "[%s] Fails to append image.", GetErrorMessage(r));
1064 __pTextObject->AppendElement(*pNewBitmap, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1065 __pTextObject->Compose();
1067 r = __pLinkedListTextElementList->Add(*pNewBitmap);
1070 , , r, "[%s] Fails to add image.", GetErrorMessage(r));
1072 if (__isCopiedEnrichedText == false)
1074 __elements.Add(bitmap);
1089 _EnrichedTextImpl::InsertAt(int elementIndex, const Tizen::Graphics::Bitmap& bitmap)
1091 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
1092 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
1093 SysTryReturn(NID_GRP, &bitmap, E_INVALID_ARG, E_INVALID_ARG
1094 , "[E_INVALID_ARG] The source bitmap is invalid.");
1095 SysTryReturn(NID_GRP, _Util::CheckValidity(&bitmap), E_INVALID_ARG, E_INVALID_ARG
1096 , "[E_INVALID_ARG] The source bitmap is invalid.");
1097 SysTryReturn(NID_GRP, elementIndex >= 0 && elementIndex <= GetTextElementCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE
1098 , "[E_OUT_OF_RANGE] The given text index is invalid.");
1100 result r = E_SUCCESS;
1101 _Text::TextElement* pTextComponent = null;
1103 int count = __pTextObject->GetElementCount();
1104 if (elementIndex > count)
1106 return E_INVALID_ARG;
1109 Bitmap* pBitmap = const_cast < Bitmap* >(&bitmap);
1110 Bitmap* pNewBitmap = new (std::nothrow) Bitmap();
1111 if (pNewBitmap == null)
1113 SysLog(NID_GRP, "[E_OUT_OF_MEMORY] Fail to create a bitmap.");
1114 return E_OUT_OF_MEMORY;
1117 r = pNewBitmap->Construct(*pBitmap, FloatRectangle(0, 0, pBitmap->GetWidthF(), pBitmap->GetHeightF()));
1120 , , r, "[%s] Fails to insert image.", GetErrorMessage(r));
1122 for (int i = 0; i < elementIndex; i++)
1124 pTextComponent = __pTextObject->GetElementAtElementIndex(i);
1125 if (pTextComponent != null)
1127 textLength = textLength + pTextComponent->GetTextLength();
1131 __pTextObject->InsertElementAt(textLength, *pNewBitmap, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1132 __pTextObject->Compose();
1134 r = __pLinkedListTextElementList->InsertAt(*pNewBitmap, elementIndex);
1137 , , r, "[%s] Fails to insert image.", GetErrorMessage(r));
1139 if (__isCopiedEnrichedText == false)
1141 __elements.InsertAt(bitmap, elementIndex);
1157 _EnrichedTextImpl::GetLinkInfoFromPosition(const Point& point, Tizen::Base::Utility::LinkInfo& linkInfo) const
1159 return GetLinkInfoFromPosition(_CoordinateSystemUtils::ConvertToFloat(point), linkInfo);
1163 _EnrichedTextImpl::GetLinkInfoFromPosition(const FloatPoint& point, Tizen::Base::Utility::LinkInfo& linkInfo) const
1165 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
1166 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
1167 SysTryReturn(NID_GRP, GetTextElementCount() > 0, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND
1168 , "[E_OBJ_NOT_FOUND] The TextElement does not exist.");
1169 SysTryReturn(NID_GRP, point.x >= 0.0f && point.y >= 0.0f, E_INVALID_ARG, E_INVALID_ARG
1170 , "[E_INVALID_ARG] The invalid position is given.");
1171 SysTryReturn(NID_GRP, GetWidthF() >= point.x && GetHeightF() >= point.y, E_INVALID_ARG, E_INVALID_ARG
1172 , "[E_INVALID_ARG] The invalid position is given.");
1174 return GetLinkInfoFromPosition(point.x, point.y, linkInfo);
1178 _EnrichedTextImpl::GetLinkInfoFromPosition(int x, int y, Tizen::Base::Utility::LinkInfo& linkInfo) const
1180 return GetLinkInfoFromPosition(_CoordinateSystemUtils::ConvertToFloat(x), _CoordinateSystemUtils::ConvertToFloat(y), linkInfo);
1184 _EnrichedTextImpl::GetLinkInfoFromPosition(float x, float y, Tizen::Base::Utility::LinkInfo& linkInfo) const
1186 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
1187 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
1188 SysTryReturn(NID_GRP, GetTextElementCount() > 0, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND
1189 , "[E_OBJ_NOT_FOUND] The TextElement does not exist.");
1190 SysTryReturn(NID_GRP, x >= 0.0f && y >= 0.0f, E_INVALID_ARG, E_INVALID_ARG
1191 , "[E_INVALID_ARG] The invalid position is given.");
1192 SysTryReturn(NID_GRP, GetWidthF() >= x && GetHeightF() >= y, E_INVALID_ARG, E_INVALID_ARG
1193 , "[E_INVALID_ARG] The invalid position is given.");
1195 FloatPoint point(x, y);
1197 int textElementIndex = GetTextElementIndexFromPosition(point);
1199 TextElement* pTextElement = GetTextElementAt(textElementIndex);
1200 if (pTextElement == null)
1202 return E_OBJ_NOT_FOUND;
1204 _TextElementImpl* pTextElementImpl = _TextElementImpl::GetInstance(*pTextElement);
1205 if (pTextElementImpl != null)
1207 linkInfo.SetLinkType(pTextElementImpl->GetLinkType());
1208 linkInfo.SetText(pTextElementImpl->GetText());
1209 linkInfo.SetLink(pTextElementImpl->GetLinkText());
1215 TextVerticalAlignment
1216 _EnrichedTextImpl::GetElementVerticalAlignment(void) const
1218 SysTryReturn(NID_GRP, __pTextObject != null, TEXT_ALIGNMENT_VERTICAL_MIN, E_OPERATION_FAILED
1219 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
1221 return __elementVerticalAlignment;
1225 _EnrichedTextImpl::SetElementVerticalAlignment(TextVerticalAlignment alignment)
1227 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
1228 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
1230 TextObjectAlignment elementAlign = ConvertVAlignment(alignment);
1231 if (elementAlign == TEXT_OBJECT_ALIGNMENT_INVALID)
1233 return E_INVALID_ARG;
1236 TextObjectAlignment align =
1237 static_cast < TextObjectAlignment >((static_cast < TextObjectAlignment >(__pTextObject->GetAlignment())
1238 & TEXT_HORIZONTAL_ALIGNMENT) | (elementAlign & TEXT_VERTICAL_ALIGNMENT));
1240 __pTextObject->SetElementVerticalAlignment(align);
1241 __elementVerticalAlignment = alignment;
1246 Tizen::Graphics::Rectangle
1247 _EnrichedTextImpl::GetBounds() const
1249 Rectangle rect(0, 0, _CoordinateSystemUtils::ConvertToInteger(__width), _CoordinateSystemUtils::ConvertToInteger(__height));
1254 Tizen::Graphics::FloatRectangle
1255 _EnrichedTextImpl::GetBoundsF() const
1257 FloatRectangle rect(0, 0, __width, __height);
1263 _EnrichedTextImpl::IndexOfFromLinkedList(TextElement& textElement, int& index)
1265 return __pLinkedListTextElementList->IndexOf(textElement, index);
1269 _EnrichedTextImpl::GetTextElementIndexFromPosition(Tizen::Graphics::Point& point) const
1271 FloatPoint pointF = _CoordinateSystemUtils::ConvertToFloat(point);
1273 return GetTextElementIndexFromPosition(pointF);
1277 _EnrichedTextImpl::GetTextElementIndexFromPosition(Tizen::Graphics::FloatPoint& point) const
1279 _TextElementImpl* pElement = null;
1280 TextElementType type;
1285 offset = GetIndexFromTouchPosition(point.x, point.y);
1287 if (offset < 0 || offset > GetTextLength())
1292 count = GetTextElementCount();
1293 for (int i = 0; i < count; i++)
1295 type = GetTypeFromIndex(i);
1297 if (type == TEXT_ELEMENT_TYPE_IMAGE)
1299 length = length + 1;
1303 pElement = _TextElementImpl::GetInstance(*GetTextElementAt(i));
1306 if (pElement->IsAuto() == true)
1308 length = length + pElement->GetLinkText().GetLength();
1312 String text = pElement->GetText();
1313 length = length + text.GetLength();
1317 if (offset <= length)
1326 _EnrichedTextImpl::GetTextObject(void) const
1328 return __pTextObject.get();
1332 _EnrichedTextImpl::GetTypeFromIndex(int textObjectIndex) const
1334 TextElementType type = TEXT_ELEMENT_TYPE_NONE;
1336 _Text::TextElement* pTextComponent = null;
1338 pTextComponent = __pTextObject->GetElementAtElementIndex(textObjectIndex);
1342 type = pTextComponent->GetType();
1346 return TEXT_ELEMENT_TYPE_NONE;
1353 _EnrichedTextImpl::GetIndexFromTouchPosition(int posX, int posY) const
1355 return GetIndexFromTouchPosition(_CoordinateSystemUtils::ConvertToFloat(posX), _CoordinateSystemUtils::ConvertToFloat(posY));
1359 _EnrichedTextImpl::GetIndexFromTouchPosition(float posX, float posY) const
1361 return __pTextObject->GetTextIndexFromPosition(posX, posY, true);
1365 _EnrichedTextImpl::RemoveFromTextObject(_TextElementImpl* pTextElementImpl)
1367 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
1368 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
1370 _Text::TextElement* pTextComponent = pTextElementImpl->GetComponent();
1371 if (pTextComponent != null)
1373 __pTextObject->RemoveElement(*pTextComponent, false);
1380 _EnrichedTextImpl::InsertAtFromTextObject(int index, _TextElementImpl* pTextElementImpl)
1382 SysTryReturn(NID_GRP, __pTextObject != null, E_OPERATION_FAILED, E_OPERATION_FAILED
1383 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
1386 int count = __pTextObject->GetElementCount();
1389 return E_INVALID_ARG;
1392 _Text::TextElement* pInsertTextComponent = pTextElementImpl->GetComponent();
1393 if (pInsertTextComponent != null)
1395 for (int i = 0; i < index; i++)
1397 _Text::TextElement* pTextComponent = __pTextObject->GetElementAtElementIndex(i);
1398 if (pTextComponent != null)
1400 textLength = textLength + pTextComponent->GetTextLength();
1404 __pTextObject->InsertElementAt(textLength, *pInsertTextComponent);
1405 __pTextObject->Compose();
1412 _EnrichedTextImpl::GetTextElementIndex(_TextElementImpl* pTextElementImpl) const
1414 _Text::TextElement* pTextComponent = pTextElementImpl->GetComponent();
1415 if (pTextComponent != null)
1417 return __pTextObject->GetElementIndexOf(*pTextComponent);
1424 _EnrichedTextImpl::ConvertHAlignment(TextHorizontalAlignment halign)
1426 TextObjectAlignment align = TEXT_OBJECT_ALIGNMENT_LEFT;
1430 case TEXT_ALIGNMENT_LEFT:
1431 align = TEXT_OBJECT_ALIGNMENT_LEFT;
1434 case TEXT_ALIGNMENT_CENTER:
1435 align = TEXT_OBJECT_ALIGNMENT_CENTER;
1438 case TEXT_ALIGNMENT_RIGHT:
1439 align = TEXT_OBJECT_ALIGNMENT_RIGHT;
1443 align = TEXT_OBJECT_ALIGNMENT_INVALID;
1450 TextHorizontalAlignment
1451 _EnrichedTextImpl::ConvertHAlignment(TextObjectAlignment halign)
1453 TextHorizontalAlignment align;
1457 case TEXT_OBJECT_ALIGNMENT_RIGHT:
1458 align = TEXT_ALIGNMENT_RIGHT;
1461 case TEXT_OBJECT_ALIGNMENT_CENTER:
1462 align = TEXT_ALIGNMENT_CENTER;
1465 case TEXT_OBJECT_ALIGNMENT_LEFT:
1468 align = TEXT_ALIGNMENT_LEFT;
1476 _EnrichedTextImpl::ConvertVAlignment(TextVerticalAlignment valign)
1478 TextObjectAlignment align;
1482 case TEXT_ALIGNMENT_TOP:
1483 align = TEXT_OBJECT_ALIGNMENT_TOP;
1486 case TEXT_ALIGNMENT_MIDDLE:
1487 align = TEXT_OBJECT_ALIGNMENT_MIDDLE;
1490 case TEXT_ALIGNMENT_BOTTOM:
1491 align = TEXT_OBJECT_ALIGNMENT_BOTTOM;
1494 case TEXT_ALIGNMENT_BASELINE:
1495 align = TEXT_OBJECT_ALIGNMENT_BASELINE;
1499 align = TEXT_OBJECT_ALIGNMENT_INVALID;
1506 TextVerticalAlignment
1507 _EnrichedTextImpl::ConvertVAlignment(TextObjectAlignment valign)
1509 TextVerticalAlignment align = TEXT_ALIGNMENT_TOP;
1513 case TEXT_OBJECT_ALIGNMENT_TOP:
1514 align = TEXT_ALIGNMENT_TOP;
1517 case TEXT_OBJECT_ALIGNMENT_MIDDLE:
1518 align = TEXT_ALIGNMENT_MIDDLE;
1521 case TEXT_OBJECT_ALIGNMENT_BOTTOM:
1524 align = TEXT_ALIGNMENT_BOTTOM;
1532 _EnrichedTextImpl::ConvertWrapType(TextWrap warp)
1534 _TextWrapType twrap;
1538 case TEXT_WRAP_CHARACTER_WRAP:
1539 twrap = TEXT_WRAP_TYPE_WRAP;
1542 case TEXT_WRAP_WORD_WRAP:
1543 twrap = TEXT_WRAP_TYPE_WORDWRAP;
1547 twrap = TEXT_WRAP_TYPE_NONE;
1555 _EnrichedTextImpl::ConvertWrap(_TextWrapType warp) const
1561 case TEXT_WRAP_TYPE_WRAP:
1562 twrap = TEXT_WRAP_CHARACTER_WRAP;
1565 case TEXT_WRAP_TYPE_WORDWRAP:
1566 twrap = TEXT_WRAP_WORD_WRAP;
1570 twrap = TEXT_WRAP_NONE;
1578 _EnrichedTextImpl::GetCloneN(void) const
1580 SysTryReturn(NID_GRP, __pTextObject != null, null, E_OPERATION_FAILED
1581 , "[E_OPERATION_FAILED] This instance is not constructed yet.");
1583 result r = E_SUCCESS;
1584 _EnrichedTextImpl* pNewEnrichedTextImpl = null;
1586 pNewEnrichedTextImpl = new (std::nothrow)_EnrichedTextImpl(*this);
1587 r = GetLastResult();
1588 SysTryReturn(NID_GRP
1589 , pNewEnrichedTextImpl
1590 , null, r, "[%s] Propagating.", GetErrorMessage(r));
1592 return pNewEnrichedTextImpl;
1595 _EnrichedTextImpl::_EnrichedTextImpl(const _EnrichedTextImpl& rhs)
1597 SysTryReturnVoidResult(NID_GRP, rhs.__pTextObject, E_OPERATION_FAILED, "[E_OPERATION_FAILED] This instance is not initialized.");
1599 result r = E_SUCCESS;
1600 FloatDimension size = rhs.GetSizeF();
1602 __width = size.width;
1603 __height = size.height;
1604 __lineSpace = GetLineSpaceF();
1606 __verticalAlignment = rhs.GetVerticalAlignment();
1607 __horizontalAlignment = rhs.GetHorizontalAlignment();
1608 __elementVerticalAlignment = rhs.GetElementVerticalAlignment();
1609 __pLinkedListTextElementList = null;
1610 __pTextElement = null;
1611 __isCopiedEnrichedText = true;
1612 __pTextObject = rhs.__pTextObject;
1614 __pLinkedListTextElementList = new (std::nothrow) Tizen::Base::Collection::LinkedList;
1615 if (__pLinkedListTextElementList == null)
1617 SetLastResult(E_OUT_OF_MEMORY);
1618 SysLog(NID_GRP, "[E_OUT_OF_MEMORY] Fail to create element list.");
1621 __pTextElement = new (std::nothrow) TextElement();
1622 if (__pTextElement == null)
1624 delete __pLinkedListTextElementList;
1626 SetLastResult(E_OUT_OF_MEMORY);
1627 SysLog(NID_GRP, "[E_OUT_OF_MEMORY] Fail to create element.");
1630 r = __pTextElement->Construct();
1633 delete __pLinkedListTextElementList;
1634 delete __pTextElement;
1636 SysLog(NID_GRP, "[%s] Fail to construct text element.", GetErrorMessage(r));
1641 _EnrichedTextImpl::GetInstance(EnrichedText& enrichedText)
1643 return (&enrichedText != null) ? enrichedText.__pImpl : null;
1646 const _EnrichedTextImpl*
1647 _EnrichedTextImpl::GetInstance(const EnrichedText& enrichedText)
1649 return (&enrichedText != null) ? enrichedText.__pImpl : null;
1653 _EnrichedTextImpl::IsConstructed(void) const
1655 return (this->__pTextObject != null);
1658 }} // Tizen::Graphics