/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
constexpr float MAX_FLOAT = std::numeric_limits<float>::max();
-const char* EMPTY_STRING = "";
+const char* EMPTY_STRING = "";
const char* MIME_TYPE_TEXT_PLAIN = "text/plain;charset=utf-8";
+const char* MIME_TYPE_HTML = "application/xhtml+xml";
} // namespace
if(mModel->mLogicalModel->mColorRuns.Count() > anchor.colorRunIndex)
{
ColorRun& colorRun = *(mModel->mLogicalModel->mColorRuns.Begin() + anchor.colorRunIndex);
- colorRun.color = mAnchorColor;
- updateNeeded = true;
+ colorRun.color = mAnchorColor;
+ updateNeeded = true;
}
if(mModel->mLogicalModel->mUnderlinedCharacterRuns.Count() > anchor.underlinedCharacterRunIndex)
{
UnderlinedCharacterRun& underlineRun = *(mModel->mLogicalModel->mUnderlinedCharacterRuns.Begin() + anchor.underlinedCharacterRunIndex);
- underlineRun.properties.color = mAnchorColor;
- updateNeeded = true;
+ underlineRun.properties.color = mAnchorColor;
+ updateNeeded = true;
}
}
else if(!anchor.isMarkupClickedColorSet && anchor.isClicked)
if(mModel->mLogicalModel->mColorRuns.Count() > anchor.colorRunIndex)
{
ColorRun& colorRun = *(mModel->mLogicalModel->mColorRuns.Begin() + anchor.colorRunIndex);
- colorRun.color = mAnchorClickedColor;
- updateNeeded = true;
+ colorRun.color = mAnchorClickedColor;
+ updateNeeded = true;
}
if(mModel->mLogicalModel->mUnderlinedCharacterRuns.Count() > anchor.underlinedCharacterRunIndex)
{
UnderlinedCharacterRun& underlineRun = *(mModel->mLogicalModel->mUnderlinedCharacterRuns.Begin() + anchor.underlinedCharacterRunIndex);
- underlineRun.properties.color = mAnchorClickedColor;
- updateNeeded = true;
+ underlineRun.properties.color = mAnchorClickedColor;
+ updateNeeded = true;
}
}
}
mTextUpdateInfo.mRequestedNumberOfCharacters = mTextUpdateInfo.mNumberOfCharactersToAdd - mTextUpdateInfo.mNumberOfCharactersToRemove;
mTextUpdateInfo.mStartGlyphIndex = mModel->mVisualModel->mGlyphs.Count();
- mTextUpdateInfo.mStartLineIndex = mModel->mVisualModel->mLines.Count() - 1u;
+ mTextUpdateInfo.mStartLineIndex = (mModel->mVisualModel->mLines.Count() > 0u) ? mModel->mVisualModel->mLines.Count() - 1u : 0u;
// Nothing else to do;
return;
{
bool decoratorEditable = editable && mIsUserInteractionEnabled;
mEventData->mDecorator->SetEditable(decoratorEditable);
+ mEventData->mDecoratorUpdated = true;
+ RequestRelayout();
}
}
}
return false;
}
+bool Controller::Impl::IsClipboardEmpty()
+{
+ bool result(Clipboard::IsAvailable() && EnsureClipboardCreated() && (mClipboard.HasType(MIME_TYPE_TEXT_PLAIN) || mClipboard.HasType(MIME_TYPE_HTML)));
+ return !result;
+}
+
void Controller::Impl::SendSelectionToClipboard(bool deleteAfterSending)
{
std::string selectedText;
else
{
Length textLength = mModel->mVisualModel->mCharactersToGlyph.Count();
- cursorIndex = cursorIndex + numberOfCharacters > textLength ? textLength : cursorIndex + numberOfCharacters;
+ cursorIndex = cursorIndex + numberOfCharacters > textLength ? textLength : cursorIndex + numberOfCharacters;
}
// Will update the cursor hook position.
{
bool editable = mEventData->mEditingEnabled && enabled;
mEventData->mDecorator->SetEditable(editable);
+ mEventData->mDecoratorUpdated = true;
+ RequestRelayout();
}
}