summaryrefslogtreecommitdiff
path: root/vcl/aqua/source/a11y
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2008-07-25 08:06:45 +0000
committerOliver Bolte <obo@openoffice.org>2008-07-25 08:06:45 +0000
commitef50b51bf0e2d8ce91d89b86b05a149738da8873 (patch)
treef51ecc54bde5cb7c935bacfbc3f11ba8e725dc7a /vcl/aqua/source/a11y
parent18e6bc2ea019c1067e7bf45f7c37b60051ca2f38 (diff)
INTEGRATION: CWS aqua11y02 (1.2.30); FILE MERGED
2008/06/05 08:21:49 fne 1.2.30.2: #i85851# attributes are now supported 2008/05/15 12:08:33 fne 1.2.30.1: #i87833# when caret pos is -1, VO tries to access invalid memory position
Diffstat (limited to 'vcl/aqua/source/a11y')
-rw-r--r--vcl/aqua/source/a11y/aqua11ytextwrapper.mm34
1 files changed, 31 insertions, 3 deletions
diff --git a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
index 026fab545d54..5859e5f661ba 100644
--- a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
@@ -8,7 +8,7 @@
*
* $RCSfile: aqua11ytextwrapper.mm,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
* This file is part of OpenOffice.org.
*
@@ -45,7 +45,7 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
using namespace ::rtl;
-// Wrapper for XAccessibleText and XAccessibleEditableText
+// Wrapper for XAccessibleText, XAccessibleEditableText and XAccessibleMultiLineText
@implementation AquaA11yTextWrapper : NSObject
@@ -85,7 +85,11 @@ using namespace ::rtl;
if ( start != end ) {
return [ NSValue valueWithRange: NSMakeRange ( start, end - start ) ]; // true selection
} else {
- return [ NSValue valueWithRange: NSMakeRange ( [ wrapper accessibleText ] -> getCaretPosition(), 0 ) ]; // insertion point
+ long caretPos = [ wrapper accessibleText ] -> getCaretPosition();
+ if ( caretPos < 0 || caretPos > [ wrapper accessibleText ] -> getCharacterCount() ) {
+ return nil;
+ }
+ return [ NSValue valueWithRange: NSMakeRange ( caretPos, 0 ) ]; // insertion point
}
}
@@ -144,9 +148,33 @@ using namespace ::rtl;
NSAccessibilityBoundsForRangeParameterizedAttribute,
NSAccessibilityStyleRangeForIndexParameterizedAttribute,
NSAccessibilityRTFForRangeParameterizedAttribute,
+ NSAccessibilityLineForIndexParameterizedAttribute,
+ NSAccessibilityRangeForLineParameterizedAttribute,
nil ];
}
++(id)lineForIndexAttributeForElement:(AquaA11yWrapper *)wrapper forParameter:(id)index {
+ NSNumber * lineNumber = nil;
+ try {
+ sal_Int32 line = [ wrapper accessibleMultiLineText ] -> getLineNumberAtIndex ( (sal_Int32) [ index intValue ] );
+ lineNumber = [ NSNumber numberWithInt: line ];
+ } catch ( IndexOutOfBoundsException & e ) {
+ // empty
+ }
+ return lineNumber;
+}
+
++(id)rangeForLineAttributeForElement:(AquaA11yWrapper *)wrapper forParameter:(id)line {
+ NSValue * range = nil;
+ try {
+ TextSegment textSegment = [ wrapper accessibleMultiLineText ] -> getTextAtLineNumber ( [ line intValue ] );
+ range = [ NSValue valueWithRange: NSMakeRange ( textSegment.SegmentStart, textSegment.SegmentEnd - textSegment.SegmentStart ) ];
+ } catch ( IndexOutOfBoundsException & e ) {
+ // empty
+ }
+ return range;
+}
+
+(id)stringForRangeAttributeForElement:(AquaA11yWrapper *)wrapper forParameter:(id)range {
int loc = [ range rangeValue ].location;
int len = [ range rangeValue ].length;