+ * @brief Processes anchor tag for the color-run & underline-run.
+ *
+ * @param[in,out] markupProcessData The markup process data
+ * @param[in] tag The tag we are currently processing
+ * @param[in,out] anchorStack The anchors stack
+ * @param[in,out] colorRuns The container containing all the color runs
+ * @param[in,out] underlinedCharacterRuns The container containing all the underlined character runs
+ * @param[in,out] colorRunIndex The color run index
+ * @param[in,out] underlinedCharacterRunIndex The underlined character run index
+ * @param[in] characterIndex The current character index
+ * @param[in] tagReference The tagReference we should increment/decrement
+ */
+void ProcessAnchorForRun(
+ MarkupProcessData& markupProcessData,
+ const Tag& tag,
+ StyleStack<AnchorForStack>& anchorStack,
+ Vector<ColorRun>& colorRuns,
+ Vector<UnderlinedCharacterRun>& underlinedCharacterRuns,
+ RunIndex& colorRunIndex,
+ RunIndex& underlinedCharacterRunIndex,
+ const CharacterIndex characterIndex,
+ int& tagReference)
+{
+ if(!tag.isEndTag)
+ {
+ // Create an anchor instance.
+ Anchor anchor;
+ anchor.href = nullptr;
+ anchor.startIndex = characterIndex;
+ anchor.endIndex = 0u;
+ anchor.colorRunIndex = colorRunIndex;
+ anchor.underlinedCharacterRunIndex = underlinedCharacterRunIndex;
+
+ // Create a new run.
+ ColorRun colorRun;
+ Initialize(colorRun);
+
+ UnderlinedCharacterRun underlinedCharacterRun;
+ Initialize(underlinedCharacterRun);
+
+ AnchorForStack anchorForStack;
+ Initialize(anchorForStack);
+
+ // Fill the run with the parameters.
+ colorRun.characterRun.characterIndex = characterIndex;
+ underlinedCharacterRun.characterRun.characterIndex = characterIndex;
+
+ anchorForStack.colorRunIndex = colorRunIndex;
+ anchorForStack.underlinedCharacterRunIndex = underlinedCharacterRunIndex;
+
+ // Init default color
+ colorRun.color = Color::MEDIUM_BLUE;
+ underlinedCharacterRun.properties.color = Color::MEDIUM_BLUE;
+ underlinedCharacterRun.properties.colorDefined = true;
+
+ ProcessAnchorTag(tag, anchor, colorRun, underlinedCharacterRun);
+
+ markupProcessData.anchors.PushBack(anchor);
+
+ // Push the anchor into the stack.
+ anchorStack.Push(anchorForStack);
+
+ // Push the run in the logical model.
+ colorRuns.PushBack(colorRun);
+ ++colorRunIndex;
+
+ // Push the run in the logical model.
+ underlinedCharacterRuns.PushBack(underlinedCharacterRun);
+ ++underlinedCharacterRunIndex;
+
+ // Increase reference
+ ++tagReference;
+ }
+ else
+ {
+ if(tagReference > 0)
+ {
+ // Update end index.
+ unsigned int count = markupProcessData.anchors.Count();
+ if(count > 0)
+ {
+ markupProcessData.anchors[count - 1].endIndex = characterIndex;
+ }
+
+ // Pop the top of the stack and set the number of characters of the run.
+ AnchorForStack anchorForStack = anchorStack.Pop();
+
+ ColorRun& colorRun = *(colorRuns.Begin() + anchorForStack.colorRunIndex);
+ colorRun.characterRun.numberOfCharacters = characterIndex - colorRun.characterRun.characterIndex;
+
+ UnderlinedCharacterRun& underlinedCharacterRun = *(underlinedCharacterRuns.Begin() + anchorForStack.underlinedCharacterRunIndex);
+ underlinedCharacterRun.characterRun.numberOfCharacters = characterIndex - underlinedCharacterRun.characterRun.characterIndex;
+
+ --tagReference;
+ }
+ }
+}
+
+/**