Fixup #19394: Prevent Word with UIA reporting "page -1" on final line of page (#19424)
Fixes #19423
### Summary of the issue:
When using UIA to access Microsoft Word documents, NVDA reports "page
-1" when navigating to the final line of a page. This regression was
introduced in PR #19394 which added support for retrieving page numbers
via Word's Custom Attributes API.
The issue occurs because Word's Custom Attributes API returns `-1` when
the page number value is not yet available. The original code accepted
any integer value without validation, causing NVDA to announce "page -1"
to users.
### Description of user facing changes:
NVDA will now correctly announce the page number (e.g., "page 2")
instead of "page -1" when reaching the final line of a page.
### Description of developer facing changes:
N/A
### Description of development approach:
The fix implements a two-layer validation and fallback mechanism:
1. **Custom Attributes API Validation**: Page numbers from the Custom
Attributes API are now validated to reject invalid values (< 1). When
Word returns -1, the value is not used.
2. **Enhanced Fallback Mechanism**: The existing control field fallback
(which uses automation IDs like `UIA_AutomationId_Word_Page_2`) now:
- Runs regardless of UIARemote support status (previously it was
disabled when UIARemote was supported)
- Only propagates page numbers from control fields, not format fields
- Only fills in missing page numbers, preserving valid Custom Attributes
API values
- Converts control field page numbers (strings) to integers to match
Custom Attributes API type
This ensures type consistency and prevents false page change detections
due to type mismatches between string `"2"` and integer `2`.
Since this is a fixup pr, I did not include a changelog entry.
### Testing strategy:
Manual testing with:
- Multi-page Word documents
- Forward navigation (down arrow) - page changes announced correctly
- Backward navigation (up arrow) - page changes announced correctly
- Navigation within tables - continues to work as fixed in #19394
- Navigation outside tables - now works correctly in both directions
### Known issues with pull request:
None known