1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <osx/salinst.h>
22 #include <osx/a11yfactory.h>
24 #include "a11yselectionwrapper.h"
26 using namespace ::com::sun::star::accessibility;
27 using namespace ::com::sun::star::uno;
29 @implementation AquaA11ySelectionWrapper : NSObject
31 +(id)selectedChildrenAttributeForElement:(AquaA11yWrapper *)wrapper
33 Reference< XAccessibleSelection > xAccessibleSelection = [ wrapper accessibleSelection ];
34 if( xAccessibleSelection.is() )
36 NSMutableArray * children = [ [ NSMutableArray alloc ] init ];
38 sal_Int32 n = xAccessibleSelection -> getSelectedAccessibleChildCount();
39 for ( sal_Int32 i=0 ; i < n ; ++i ) {
40 [ children addObject: [ AquaA11yFactory wrapperForAccessible: xAccessibleSelection -> getSelectedAccessibleChild( i ) ] ];
54 +(void)addAttributeNamesTo:(NSMutableArray *)attributeNames
56 [ attributeNames addObject: NSAccessibilitySelectedChildrenAttribute ];
59 +(BOOL)isAttributeSettable:(NSString *)attribute forElement:(AquaA11yWrapper *)wrapper
62 if ( [ attribute isEqualToString: NSAccessibilitySelectedChildrenAttribute ] )
72 +(void)setSelectedChildrenAttributeForElement:(AquaA11yWrapper *)wrapper to:(id)value
74 Reference< XAccessibleSelection > xAccessibleSelection = [ wrapper accessibleSelection ];
76 xAccessibleSelection -> clearAccessibleSelection();
78 unsigned c = [ value count ];
79 for ( unsigned i = 0 ; i < c ; ++i ) {
80 xAccessibleSelection -> selectAccessibleChild( [ [ value objectAtIndex: i ] accessibleContext ] -> getAccessibleIndexInParent() );
82 } catch ( Exception&) {
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */