1*323de322SAndrew Rist/************************************************************** 2cdf0e10cSrcweir * 3*323de322SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*323de322SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*323de322SAndrew Rist * distributed with this work for additional information 6*323de322SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*323de322SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*323de322SAndrew Rist * "License"); you may not use this file except in compliance 9*323de322SAndrew Rist * with the License. You may obtain a copy of the License at 10*323de322SAndrew Rist * 11*323de322SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*323de322SAndrew Rist * 13*323de322SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*323de322SAndrew Rist * software distributed under the License is distributed on an 15*323de322SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*323de322SAndrew Rist * KIND, either express or implied. See the License for the 17*323de322SAndrew Rist * specific language governing permissions and limitations 18*323de322SAndrew Rist * under the License. 19*323de322SAndrew Rist * 20*323de322SAndrew Rist *************************************************************/ 21*323de322SAndrew Rist 22*323de322SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir// MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir#include "precompiled_vcl.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir#include "aqua/salinst.h" 28cdf0e10cSrcweir 29cdf0e10cSrcweir#include "aqua11yactionwrapper.h" 30cdf0e10cSrcweir 31cdf0e10cSrcweir// Wrapper for XAccessibleAction 32cdf0e10cSrcweir 33cdf0e10cSrcweir@implementation AquaA11yActionWrapper : NSObject 34cdf0e10cSrcweir 35cdf0e10cSrcweir+(NSString *)nativeActionNameFor:(NSString *)actionName { 36cdf0e10cSrcweir // TODO: Optimize ? 37cdf0e10cSrcweir // Use NSAccessibilityActionDescription 38cdf0e10cSrcweir if ( [ actionName isEqualToString: @"click" ] ) { 39cdf0e10cSrcweir return NSAccessibilityPressAction; 40cdf0e10cSrcweir } else if ( [ actionName isEqualToString: @"togglePopup" ] ) { 41cdf0e10cSrcweir return NSAccessibilityShowMenuAction; 42cdf0e10cSrcweir } else if ( [ actionName isEqualToString: @"select" ] ) { 43cdf0e10cSrcweir return NSAccessibilityPickAction; 44cdf0e10cSrcweir } else if ( [ actionName isEqualToString: @"incrementLine" ] ) { 45cdf0e10cSrcweir return NSAccessibilityIncrementAction; 46cdf0e10cSrcweir } else if ( [ actionName isEqualToString: @"decrementLine" ] ) { 47cdf0e10cSrcweir return NSAccessibilityDecrementAction; 48cdf0e10cSrcweir } else if ( [ actionName isEqualToString: @"incrementBlock" ] ) { 49cdf0e10cSrcweir return NSAccessibilityIncrementAction; // TODO ? 50cdf0e10cSrcweir } else if ( [ actionName isEqualToString: @"decrementBlock" ] ) { 51cdf0e10cSrcweir return NSAccessibilityDecrementAction; // TODO ? 52cdf0e10cSrcweir } else if ( [ actionName isEqualToString: @"Browse" ] ) { 53cdf0e10cSrcweir return NSAccessibilityPressAction; // TODO ? 54cdf0e10cSrcweir } else { 55cdf0e10cSrcweir return [ NSString string ]; 56cdf0e10cSrcweir } 57cdf0e10cSrcweir} 58cdf0e10cSrcweir 59cdf0e10cSrcweir+(NSArray *)actionNamesForElement:(AquaA11yWrapper *)wrapper { 60cdf0e10cSrcweir NSMutableArray * actionNames = [ [ NSMutableArray alloc ] init ]; 61cdf0e10cSrcweir if ( [ wrapper accessibleAction ] != nil ) { 62cdf0e10cSrcweir for ( int cnt = 0; cnt < [ wrapper accessibleAction ] -> getAccessibleActionCount(); cnt++ ) { 63cdf0e10cSrcweir [ actionNames addObject: [ AquaA11yActionWrapper nativeActionNameFor: CreateNSString ( [ wrapper accessibleAction ] -> getAccessibleActionDescription ( cnt ) ) ] ]; 64cdf0e10cSrcweir } 65cdf0e10cSrcweir } 66cdf0e10cSrcweir return actionNames; 67cdf0e10cSrcweir} 68cdf0e10cSrcweir 69cdf0e10cSrcweir+(void)doAction:(NSString *)action ofElement:(AquaA11yWrapper *)wrapper { 70cdf0e10cSrcweir if ( [ wrapper accessibleAction ] != nil ) { 71cdf0e10cSrcweir for ( int cnt = 0; cnt < [ wrapper accessibleAction ] -> getAccessibleActionCount(); cnt++ ) { 72cdf0e10cSrcweir if ( [ action isEqualToString: [ AquaA11yActionWrapper nativeActionNameFor: CreateNSString ( [ wrapper accessibleAction ] -> getAccessibleActionDescription ( cnt ) ) ] ] ) { 73cdf0e10cSrcweir [ wrapper accessibleAction ] -> doAccessibleAction ( cnt ); 74cdf0e10cSrcweir break; 75cdf0e10cSrcweir } 76cdf0e10cSrcweir } 77cdf0e10cSrcweir } 78cdf0e10cSrcweir} 79cdf0e10cSrcweir 80cdf0e10cSrcweir@end 81