Author: hdu
Date: Wed Jun 25 11:51:19 2014
New Revision: 1605360

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

Merged from trunk revision 1605355

Modified:
    openoffice/branches/AOO410/   (props changed)
    openoffice/branches/AOO410/main/   (props changed)
    
openoffice/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
    openoffice/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm

Propchange: openoffice/branches/AOO410/
------------------------------------------------------------------------------
  Merged /openoffice/trunk:r1605355

Propchange: openoffice/branches/AOO410/main/
------------------------------------------------------------------------------
  Merged /openoffice/trunk/main:r1605355

Modified: 
openoffice/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm?rev=1605360&r1=1605359&r2=1605360&view=diff
==============================================================================
--- 
openoffice/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
 (original)
+++ 
openoffice/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
 Wed Jun 25 11:51:19 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/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm?rev=1605360&r1=1605359&r2=1605360&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm 
(original)
+++ openoffice/branches/AOO410/main/vcl/aqua/source/a11y/aqua11ytextwrapper.mm 
Wed Jun 25 11:51:19 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