Merge "fixed bug (TapGesture improvement)" into tizen_2.1
[platform/framework/native/uifw.git] / src / graphics / text / FGrp_TextTextCutLink.cpp
index 3c37ccb..64b5cf3 100644 (file)
@@ -2,14 +2,14 @@
 // Open Service Platform
 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Apache License, Version 2.0 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://floralicense.org/license/
+//     http://www.apache.org/licenses/LICENSE-2.0/
 //
 // Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// distributed under the License is distributed on an ”AS IS” BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
@@ -74,20 +74,17 @@ result
 TextCutLink::Draw(_CanvasImpl& canvasImpl, Rectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment align,
                                        const TextObjectActionType action)
 {
-       SysTryReturn(NID_GRP
-                       , displayRect.x >= 0 && displayRect.y >= 0
+       SysTryReturn(NID_GRP, displayRect.x >= 0 && displayRect.y >= 0
                        , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
 
-       return TextSimple::Draw(canvasImpl, displayRect, startTextIndex, textLength, align, action);
+       return Draw(canvasImpl, displayRect, startTextIndex, textLength, align, action);
 }
 
 result
 TextCutLink::Draw(_CanvasImpl& canvasImpl, FloatRectangle& displayRect, int startTextIndex, int textLength, const TextObjectAlignment align,
                                                const TextObjectActionType action)
 {
-       Rectangle intDisplayRect = _CoordinateSystemUtils::ConvertToInteger(displayRect);
-
-       return Draw(canvasImpl, intDisplayRect, startTextIndex, textLength, align, action);
+       return TextSimple::Draw(canvasImpl, displayRect, startTextIndex, textLength, align, action);
 }
 
 TextElement*
@@ -98,9 +95,7 @@ TextCutLink::CloneN(TextComponentInfoValueType type, unsigned int value)
        pLinkElement = new (std::nothrow) TextCutLink(__isEditable, __linkType, _pText, _length,
                        TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL, _pFont, _foregroundColor, _backgroundColor, _outlineColor);
 
-       SysTryReturn(NID_GRP
-               , pLinkElement
-               , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
+       SysTryReturn(NID_GRP, pLinkElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
 
        TextElement::CopyMembers(pLinkElement);
 
@@ -117,27 +112,21 @@ TextCutLink::CopyN(int textStartIndex, int textLength)
 
        TextCutLink* pLinkElement = null;
 
-       SysTryReturn(NID_GRP
-                       , textStartIndex < _length
-                       , null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+       SysTryReturn(NID_GRP, textStartIndex < _length, null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
 
        if (textStartIndex + textLength > _length)
        {
                textLength = _length - textStartIndex;
        }
 
-       SysTryReturn(NID_GRP
-                       , textLength >= 0
-                       , null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+       SysTryReturn(NID_GRP, textLength >= 0, null, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
 
        pText = &_pText[_offset + textStartIndex];
 
        pLinkElement = new (std::nothrow) TextCutLink(__isEditable, __linkType, pText, textLength, _sourceType,
                        _pFont, _foregroundColor, _backgroundColor, _outlineColor);
 
-       SysTryReturn(NID_GRP
-               , pLinkElement
-               , null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
+       SysTryReturn(NID_GRP, pLinkElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
 
        pLinkElement->_isBackgroundDrawingModeEnabled = _isBackgroundDrawingModeEnabled;
        pLinkElement->__isEdited = __isEdited;
@@ -230,9 +219,7 @@ TextCutLink::ResetUserColor(void)
 result
 TextCutLink::SetTextOffset(int offset)
 {
-       SysTryReturn(NID_GRP
-               , __isEdited == true
-               , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+       SysTryReturn(NID_GRP, __isEdited == true, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
 
        return TextSimple::SetTextOffset(offset);
 }
@@ -240,13 +227,22 @@ TextCutLink::SetTextOffset(int offset)
 result
 TextCutLink::ChangeTextOffset(wchar_t* pText, int gap)
 {
-       SysTryReturn(NID_GRP
-               , __isEdited == true
-               , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
+       SysTryReturn(NID_GRP, __isEdited == true, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
 
        return TextSimple::ChangeTextOffset(pText, gap);
 }
 
+const Font*
+TextCutLink::GetFont(void) const
+{
+       if (__isEdited)
+       {
+               return TextSimple::GetCurrentFont();
+       }
+
+       return __pLinkFont;
+}
+
 Font*
 TextCutLink::GetCurrentFont(void) const
 {