X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Flogical-model-impl.cpp;h=85026297fdcf6e67c4da978c6038420d1b615817;hb=HEAD;hp=4516662c76469cfd8838eefe5811ca98a2176857;hpb=7562b511d06c8a8157883e35308aaa65e4e10810;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/logical-model-impl.cpp b/dali-toolkit/internal/text/logical-model-impl.cpp index 4516662..8502629 100644 --- a/dali-toolkit/internal/text/logical-model-impl.cpp +++ b/dali-toolkit/internal/text/logical-model-impl.cpp @@ -19,6 +19,7 @@ #include // INTERNAL INCLUDES +#include #include #include @@ -145,8 +146,8 @@ CharacterIndex LogicalModel::GetLogicalCursorIndex(CharacterIndex visualCursorIn // 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(previousVisualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex)) + bidirectionalLineInfo->characterRun.characterIndex; + const CharacterIndex currentLogicalCursorIndex = *(bidirectionalLineInfo->visualToLogicalMap + static_cast(visualCursorIndex - bidirectionalLineInfo->characterRun.characterIndex)) + bidirectionalLineInfo->characterRun.characterIndex; const CharacterDirection previousCharacterDirection = *(modelCharacterDirections + previousLogicalCursorIndex); const CharacterDirection currentCharacterDirection = *(modelCharacterDirections + currentLogicalCursorIndex); @@ -198,7 +199,7 @@ CharacterIndex LogicalModel::GetLogicalCharacterIndex(CharacterIndex visualChara // 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(visualCharacterIndex - bidirectionalLineInfo->characterRun.characterIndex)) + bidirectionalLineInfo->characterRun.characterIndex; } bool LogicalModel::FetchBidirectionalLineInfo(CharacterIndex characterIndex) @@ -331,6 +332,26 @@ void LogicalModel::UpdateTextStyleRuns(CharacterIndex index, int numberOfCharact // Free memory allocated for the font family name. FreeFontFamilyNames(removedFontDescriptionRuns); + + // Process the bounded paragraph runs + MergeBoundedParagraphRunsWhenRemoveCharacters(mText, + index, + numberOfCharacters, + mBoundedParagraphRuns); + + Vector removedBoundedParagraphRuns; + UpdateCharacterRuns(index, + numberOfCharacters, + totalNumberOfCharacters, + mBoundedParagraphRuns, + removedBoundedParagraphRuns); + + Vector removedCharacterSpacingCharacterRuns; + UpdateCharacterRuns(index, + numberOfCharacters, + totalNumberOfCharacters, + mCharacterSpacingCharacterRuns, + removedCharacterSpacingCharacterRuns); } void LogicalModel::RetrieveStyle(CharacterIndex index, InputStyle& style) @@ -476,6 +497,11 @@ void LogicalModel::ClearStrikethroughRuns() mStrikethroughCharacterRuns.Clear(); } +void LogicalModel::ClearUnderlineRuns() +{ + mUnderlinedCharacterRuns.Clear(); +} + void LogicalModel::CreateParagraphInfo(CharacterIndex startIndex, Length numberOfCharacters) { @@ -522,7 +548,7 @@ void LogicalModel::CreateParagraphInfo(CharacterIndex startIndex, if(updateCurrentParagraphs) { for(Vector::ConstIterator it = mParagraphInfo.Begin(), - endIt = mParagraphInfo.Begin() + totalNumberOfParagraphs - numberOfNewParagraphs; + endIt = mParagraphInfo.Begin() + static_cast(totalNumberOfParagraphs - numberOfNewParagraphs); it != endIt; ++it) { @@ -600,6 +626,26 @@ void LogicalModel::FindParagraphs(CharacterIndex index, } } +Length LogicalModel::GetNumberOfBoundedParagraphRuns() const +{ + return mBoundedParagraphRuns.Count(); +} + +const Vector& LogicalModel::GetBoundedParagraphRuns() const +{ + return mBoundedParagraphRuns; +} + +Length LogicalModel::GetNumberOfCharacterSpacingCharacterRuns() const +{ + return mCharacterSpacingCharacterRuns.Count(); +} + +const Vector& LogicalModel::GetCharacterSpacingCharacterRuns() const +{ + return mCharacterSpacingCharacterRuns; +} + void LogicalModel::ClearEmbeddedImages() { FreeEmbeddedItems(mEmbeddedItems); @@ -617,7 +663,11 @@ LogicalModel::~LogicalModel() } LogicalModel::LogicalModel() -: mBidirectionalLineIndex(0u) +: mBidirectionalLineIndex(0u), + mSpannedTextPlaced(false), + mUnderlineRunsUpdated(false), + mCharacterSpacingRunsUpdated(false), + mStrikethroughRunsUpdated(false) { }