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 <vcl/svapp.hxx>
22 #include <osx/salinst.h>
24 #include "a11ywrapperscrollarea.h"
25 #include "a11ywrapperscrollbar.h"
26 #include "a11yrolehelper.h"
28 // Wrapper for AXScrollArea role
30 @implementation AquaA11yWrapperScrollArea : AquaA11yWrapper
32 -(id)scrollBarWithOrientation:(NSString *)orientation {
33 AquaA11yWrapper * theScrollBar = nil;
34 NSAutoreleasePool * pool = [ [ NSAutoreleasePool alloc ] init ];
35 NSArray * elementChildren = [ self accessibilityAttributeValue: NSAccessibilityChildrenAttribute ];
36 if ( [ elementChildren count ] > 0 ) {
37 NSEnumerator * enumerator = [ elementChildren objectEnumerator ];
39 while ( ( child = [ enumerator nextObject ] ) ) {
40 AquaA11yWrapper * element = static_cast<AquaA11yWrapper *>(child);
41 if ( [ element isKindOfClass: [ AquaA11yWrapperScrollBar class ] ] ) {
42 AquaA11yWrapperScrollBar * scrollBar = static_cast<AquaA11yWrapperScrollBar *>(element);
43 if ( [ [ scrollBar orientationAttribute ] isEqualToString: orientation ] ) {
44 theScrollBar = scrollBar;
54 -(id)verticalScrollBarAttribute {
55 return [ self scrollBarWithOrientation: NSAccessibilityVerticalOrientationValue ];
58 -(id)horizontalScrollBarAttribute {
59 return [ self scrollBarWithOrientation: NSAccessibilityHorizontalOrientationValue ];
62 -(NSArray *)accessibilityAttributeNames {
63 // Related: tdf#148453 Acquire solar mutex during native accessibility calls
64 SolarMutexGuard aGuard;
66 return [ NSArray array ];
69 NSMutableArray * attributeNames = [ NSMutableArray arrayWithArray: [ super accessibilityAttributeNames ] ];
70 // Special Attributes and removing unwanted attributes depending on role
71 [ attributeNames removeObject: NSAccessibilityEnabledAttribute ];
72 [ attributeNames addObjectsFromArray: [ NSArray arrayWithObjects:
73 NSAccessibilityContentsAttribute,
74 NSAccessibilityVerticalScrollBarAttribute,
75 NSAccessibilityHorizontalScrollBarAttribute,
78 return attributeNames;
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */