Author: hdu
Date: Wed Jun 25 11:40:58 2014
New Revision: 1605355

URL: http://svn.apache.org/r1605355
Log:
#i122471# make the Mac lookup feature handle the correct word

Modified:
    openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
    openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm

Modified: 
openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm?rev=1605355&r1=1605354&r2=1605355&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm 
(original)
+++ openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm 
Wed Jun 25 11:40:58 2014
@@ -227,12 +227,13 @@ 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 ];
+            NSRange offsetRange = NSMakeRange ( 0, len );
+            [ AquaA11yTextAttributesWrapper applyAttributesFrom: 
defaultAttributes toString: string forRange: offsetRange 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 ];

Modified: openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm?rev=1605355&r1=1605354&r2=1605355&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm (original)
+++ openoffice/trunk/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm Wed Jun 25 
11:40:58 2014
@@ -210,7 +210,11 @@ using namespace ::rtl;
 
 +(id)rangeForPositionAttributeForElement:(AquaA11yWrapper *)wrapper 
forParameter:(id)point {
     NSValue * value = nil;
-    sal_Int32 index = [ wrapper accessibleText ] -> getIndexAtPoint ( [ 
AquaA11yUtil nsPointToVclPoint: point ] );
+    Point aPoint( [ AquaA11yUtil nsPointToVclPoint: point ]);
+    const Point screenPos = [ wrapper accessibleComponent ] -> 
getLocationOnScreen();
+    aPoint.X -= screenPos.X;
+    aPoint.Y -= screenPos.Y;
+    sal_Int32 index = [ wrapper accessibleText ] -> getIndexAtPoint( aPoint );
     if ( index > -1 ) {
         value = [ AquaA11yTextWrapper rangeForIndexAttributeForElement: 
wrapper forParameter: [ NSNumber numberWithLong: index ] ];
     }


Reply via email to