MS Word with UIA: heading quicknav no longer keeps repeating the last heading (#13013)
Fixes #9540
Summary of the issue:
When accessing MS Word documents with UIA, if the last bit of text is formatted as a heading, pressing quicknav by heading (h) in browse mode keeps repeating that heding. Similarly, The elements list when set to show headings, lists the final heading twice.
This is due to the fact that most UIA providers when on the last unit, move to the collapsed exclusive end if asked to move forward 1 by that unit. Only after that does the move fail.
We could add some specific checks in the UIABrowseMode.UIAHeadingQuicknavIterator function to take this into account, or we can rewrite that algorithm to make use of iterUIARangeByUnit which is used in many other places and avoids that bug all together.
Description of how this pull request fixes the issue:
Rewrite the UIABrowseMode.UIAHeadingQuicknavIterator function to make use of iterUIARangeByUnit. It is now much more similar to the UIABrowseMode.UIATextAttributeQuicknavIterator function, which we know does not have the repeating bug.