[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/aqua

Boris Dušek me at dusek.me
Tue Aug 20 06:33:10 PDT 2013


 vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm |   25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

New commits:
commit b822f3c09689d3e494df3499caac034838b3f5c6
Author: Boris Dušek <me at dusek.me>
Date:   Sun Aug 11 16:37:48 2013 +0200

    fdo#67980 - VoiceOver does not inform about misspelled text
    
    Reviewed-on: https://gerrit.libreoffice.org/5351
    Reviewed-by: Tor Lillqvist <tml at iki.fi>
    Tested-by: Tor Lillqvist <tml at iki.fi>
    
    Conflicts:
    	vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
    
    Change-Id: I4aefa1c013e62942801dd38a06034103c0df24be
    Reviewed-on: https://gerrit.libreoffice.org/5497
    Reviewed-by: Tor Lillqvist <tml at iki.fi>
    Tested-by: Tor Lillqvist <tml at iki.fi>

diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
index e8a676e..6fb55f0 100644
--- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
@@ -28,6 +28,7 @@
 #include <com/sun/star/awt/FontUnderline.hpp>
 #include <com/sun/star/awt/FontWeight.hpp>
 #include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/text/TextMarkupType.hpp>
 
 namespace css_awt = ::com::sun::star::awt;
 using namespace ::com::sun::star::accessibility;
@@ -219,6 +220,28 @@ using namespace ::rtl;
     [ pool release ];
 }
 
++(void)addMarkup:(XAccessibleTextMarkup*)markup toString:(NSMutableAttributedString*)string inRange:(NSRange)range {
+    [AquaA11yTextAttributesWrapper addMarkup:markup withType:(::com::sun::star::text::TextMarkupType::SPELLCHECK) toString:string inRange:range];
+}
+
++(void)addMarkup:(XAccessibleTextMarkup*)markup withType:(long)type toString:(NSMutableAttributedString*)string inRange:(NSRange)range {
+    const long markupCount = markup->getTextMarkupCount(type);
+    for (long markupIndex = 0; markupIndex < markupCount; ++markupIndex) {
+        TextSegment markupSegment = markup->getTextMarkup(markupIndex, type);
+        NSRange markupRange = NSMakeRange(markupSegment.SegmentStart, markupSegment.SegmentEnd - markupSegment.SegmentStart);
+        markupRange = NSIntersectionRange(range, markupRange);
+        if (markupRange.length > 0) {
+            markupRange.location -= range.location;
+            switch(type) {
+                case ::com::sun::star::text::TextMarkupType::SPELLCHECK: {
+                    [string addAttribute:NSAccessibilityMisspelledTextAttribute value:[NSNumber numberWithBool:YES] range:markupRange];
+                    break;
+                }
+            }
+        }
+    }
+}
+
 +(NSMutableAttributedString *)createAttributedStringForElement:(AquaA11yWrapper *)wrapper inOrigRange:(id)origRange {
     static const Sequence < OUString > emptySequence;
     // vars
@@ -245,6 +268,8 @@ using namespace ::rtl;
                 [ AquaA11yTextAttributesWrapper applyAttributesFrom: attributes toString: string forRange: rangeForAttributeRun storeDefaultsTo: nil getDefaultsFrom: wrapper ];
                 currentIndex = textSegment.SegmentEnd;
             }
+            if ([wrapper accessibleTextMarkup])
+                [AquaA11yTextAttributesWrapper addMarkup:[wrapper accessibleTextMarkup] toString:string inRange:[origRange rangeValue]];
             [ string endEditing ];
         }
     } catch ( IllegalArgumentException & e ) {


More information about the Libreoffice-commits mailing list