/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
#include <dali-toolkit/internal/text/logical-model-impl.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/bounded-paragraph-helper-functions.h>
#include <dali-toolkit/internal/text/input-style.h>
#include <dali-toolkit/internal/text/text-run-container.h>
// both characters and the direction of the paragraph.
const CharacterIndex previousVisualCursorIndex = visualCursorIndex - 1u;
- const CharacterIndex previousLogicalCursorIndex = *(bidirectionalLineInfo->visualToLogicalMap + previousVisualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex) + bidirectionalLineInfo->characterRun.characterIndex;
- const CharacterIndex currentLogicalCursorIndex = *(bidirectionalLineInfo->visualToLogicalMap + visualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex) + bidirectionalLineInfo->characterRun.characterIndex;
+ const CharacterIndex previousLogicalCursorIndex = *(bidirectionalLineInfo->visualToLogicalMap + static_cast<std::size_t>(previousVisualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex)) + bidirectionalLineInfo->characterRun.characterIndex;
+ const CharacterIndex currentLogicalCursorIndex = *(bidirectionalLineInfo->visualToLogicalMap + static_cast<std::size_t>(visualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex)) + bidirectionalLineInfo->characterRun.characterIndex;
const CharacterDirection previousCharacterDirection = *(modelCharacterDirections + previousLogicalCursorIndex);
const CharacterDirection currentCharacterDirection = *(modelCharacterDirections + currentLogicalCursorIndex);
// The bidirectional line info.
const BidirectionalLineInfoRun* const bidirectionalLineInfo = mBidirectionalLineInfo.Begin() + mBidirectionalLineIndex;
- return *(bidirectionalLineInfo->visualToLogicalMap + visualCharacterIndex - bidirectionalLineInfo->characterRun.characterIndex) + bidirectionalLineInfo->characterRun.characterIndex;
+ return *(bidirectionalLineInfo->visualToLogicalMap + static_cast<std::size_t>(visualCharacterIndex - bidirectionalLineInfo->characterRun.characterIndex)) + bidirectionalLineInfo->characterRun.characterIndex;
}
bool LogicalModel::FetchBidirectionalLineInfo(CharacterIndex characterIndex)
mColorRuns,
removedColorRuns);
+ // This is needed until now for underline tag in mark-up processor
+ // Process the underlined runs.
+ Vector<UnderlinedCharacterRun> removedUnderlinedCharacterRuns;
+ UpdateCharacterRuns<UnderlinedCharacterRun>(index,
+ numberOfCharacters,
+ totalNumberOfCharacters,
+ mUnderlinedCharacterRuns,
+ removedUnderlinedCharacterRuns);
+
+ // Process the strikethrough runs.
+ Vector<StrikethroughCharacterRun> removedStrikethroughCharacterRuns;
+ UpdateCharacterRuns<StrikethroughCharacterRun>(index,
+ numberOfCharacters,
+ totalNumberOfCharacters,
+ mStrikethroughCharacterRuns,
+ removedStrikethroughCharacterRuns);
+
// Process the background color runs.
Vector<ColorRun> removedBackgroundColorRuns;
UpdateCharacterRuns<ColorRun>(index,
// Free memory allocated for the font family name.
FreeFontFamilyNames(removedFontDescriptionRuns);
+
+ // Process the bounded paragraph runs
+ MergeBoundedParagraphRunsWhenRemoveCharacters(mText,
+ index,
+ numberOfCharacters,
+ mBoundedParagraphRuns);
+
+ Vector<BoundedParagraphRun> removedBoundedParagraphRuns;
+ UpdateCharacterRuns<BoundedParagraphRun>(index,
+ numberOfCharacters,
+ totalNumberOfCharacters,
+ mBoundedParagraphRuns,
+ removedBoundedParagraphRuns);
+
+ Vector<CharacterSpacingCharacterRun> removedCharacterSpacingCharacterRuns;
+ UpdateCharacterRuns<CharacterSpacingCharacterRun>(index,
+ numberOfCharacters,
+ totalNumberOfCharacters,
+ mCharacterSpacingCharacterRuns,
+ removedCharacterSpacingCharacterRuns);
}
void LogicalModel::RetrieveStyle(CharacterIndex index, InputStyle& style)
FreeFontFamilyNames(mFontDescriptionRuns);
}
+void LogicalModel::ClearStrikethroughRuns()
+{
+ mStrikethroughCharacterRuns.Clear();
+}
+
void LogicalModel::CreateParagraphInfo(CharacterIndex startIndex,
Length numberOfCharacters)
{
if(updateCurrentParagraphs)
{
for(Vector<ParagraphRun>::ConstIterator it = mParagraphInfo.Begin(),
- endIt = mParagraphInfo.Begin() + totalNumberOfParagraphs - numberOfNewParagraphs;
+ endIt = mParagraphInfo.Begin() + static_cast<std::size_t>(totalNumberOfParagraphs - numberOfNewParagraphs);
it != endIt;
++it)
{
}
}
+Length LogicalModel::GetNumberOfBoundedParagraphRuns() const
+{
+ return mBoundedParagraphRuns.Count();
+}
+
+const Vector<BoundedParagraphRun>& LogicalModel::GetBoundedParagraphRuns() const
+{
+ return mBoundedParagraphRuns;
+}
+
+Length LogicalModel::GetNumberOfCharacterSpacingCharacterRuns() const
+{
+ return mCharacterSpacingCharacterRuns.Count();
+}
+
+const Vector<CharacterSpacingCharacterRun>& LogicalModel::GetCharacterSpacingCharacterRuns() const
+{
+ return mCharacterSpacingCharacterRuns;
+}
+
void LogicalModel::ClearEmbeddedImages()
{
FreeEmbeddedItems(mEmbeddedItems);
}
LogicalModel::LogicalModel()
-: mBidirectionalLineIndex(0u)
+: mBidirectionalLineIndex(0u),
+ mSpannedTextPlaced(false),
+ mUnderlineRunsUpdated(false)
{
}