+void LogicalModel::UpdateTextStyleRuns(CharacterIndex index, int numberOfCharacters)
+{
+ const Length totalNumberOfCharacters = mText.Count();
+
+ // Process the color runs.
+ Vector<ColorRun> removedColorRuns;
+ UpdateCharacterRuns<ColorRun>(index,
+ numberOfCharacters,
+ totalNumberOfCharacters,
+ 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,
+ numberOfCharacters,
+ totalNumberOfCharacters,
+ mBackgroundColorRuns,
+ removedBackgroundColorRuns);
+
+ // Process the font description runs.
+ Vector<FontDescriptionRun> removedFontDescriptionRuns;
+ UpdateCharacterRuns<FontDescriptionRun>(index,
+ numberOfCharacters,
+ totalNumberOfCharacters,
+ mFontDescriptionRuns,
+ removedFontDescriptionRuns);
+
+ // 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);
+}
+
+void LogicalModel::RetrieveStyle(CharacterIndex index, InputStyle& style)
+{
+ unsigned int runIndex = 0u;
+
+ // Set the text color.
+ bool colorOverriden = false;
+ unsigned int colorIndex = 0u;
+ const ColorRun* const colorRunsBuffer = mColorRuns.Begin();
+ for(Vector<ColorRun>::ConstIterator it = colorRunsBuffer,
+ endIt = mColorRuns.End();
+ it != endIt;
+ ++it, ++runIndex)
+ {
+ const ColorRun& colorRun = *it;
+
+ if((colorRun.characterRun.characterIndex <= index) &&
+ (index < colorRun.characterRun.characterIndex + colorRun.characterRun.numberOfCharacters))
+ {
+ colorIndex = runIndex;
+ colorOverriden = true;
+ }
+ }
+
+ // Set the text's color if it's overriden.
+ if(colorOverriden)
+ {
+ style.textColor = (*(colorRunsBuffer + colorIndex)).color;
+ style.isDefaultColor = false;
+ }