diff options
author | Boris Dušek <me@dusek.me> | 2013-08-02 00:04:35 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-08-07 19:07:33 +0000 |
commit | 58464deee44db80657885e39ead33d7ccc7dda30 (patch) | |
tree | 1100245d2aedbfccf4e4458fa6a0ea837890c04b /vcl | |
parent | e83f61b29eb74286dbdb053bb3d067fe3e2f8073 (diff) |
Fix accessibility of text attributes on OS X
The applyAttributesFrom:... method takes range parameter that specifies
a range in the 'string' parameter passed to that method, not in the whole
string of the UI element as retrievd in createAttributedStringForElement:...
(the former string is a substring of the latter).
In other words, the 'range' parameter in applyAttributesFrom: is relative
to the string passed to that method, not to the whole string of the UI
element.
This enables proper reading of text attributes in Writer - when moving
cursor through text, VoiceOver now announces e.g. "bold" or "plain" to
indicate changes in text formatting.
Change-Id: I21a633af0bf426759f639435581fcd3bfeafa598
Reviewed-on: https://gerrit.libreoffice.org/5236
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm index d35a53f5cbbf..2e4ab40a5034 100644 --- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm @@ -222,12 +222,12 @@ using namespace ::rtl; [ string beginEditing ]; // add default attributes for whole string Sequence < PropertyValue > defaultAttributes = [ wrapper accessibleTextAttributes ] -> getDefaultAttributes ( emptySequence ); - [ AquaA11yTextAttributesWrapper applyAttributesFrom: defaultAttributes toString: string forRange: [ origRange rangeValue ] storeDefaultsTo: wrapper getDefaultsFrom: nil ]; + [ AquaA11yTextAttributesWrapper applyAttributesFrom: defaultAttributes toString: string forRange: NSMakeRange ( 0, len ) storeDefaultsTo: wrapper getDefaultsFrom: nil ]; // add attributes for attribute run(s) while ( currentIndex < endIndex ) { TextSegment textSegment = [ wrapper accessibleText ] -> getTextAtIndex ( currentIndex, AccessibleTextType::ATTRIBUTE_RUN ); int endOfRange = endIndex > textSegment.SegmentEnd ? textSegment.SegmentEnd : endIndex; - NSRange rangeForAttributeRun = NSMakeRange ( currentIndex, endOfRange - currentIndex ); + NSRange rangeForAttributeRun = NSMakeRange ( currentIndex - loc , endOfRange - currentIndex ); // add run attributes Sequence < PropertyValue > attributes = [ wrapper accessibleTextAttributes ] -> getRunAttributes ( currentIndex, emptySequence ); [ AquaA11yTextAttributesWrapper applyAttributesFrom: attributes toString: string forRange: rangeForAttributeRun storeDefaultsTo: nil getDefaultsFrom: wrapper ]; |