1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 package org.openoffice.java.accessibility;
24 
25 import com.sun.star.accessibility.*;
26 import com.sun.star.uno.*;
27 
28 
29 class ToggleButton extends AbstractButton implements javax.accessibility.Accessible {
ToggleButton(XAccessible xAccessible, XAccessibleContext xAccessibleContext)30     public ToggleButton(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
31         super(xAccessible, xAccessibleContext);
32     }
33 
34     /** Creates the AccessibleContext associated with this object */
createAccessibleContext()35     public javax.accessibility.AccessibleContext createAccessibleContext() {
36         return new AccessibleToggleButton();
37     }
38 
39     protected class AccessibleToggleButton extends AccessibleAbstractButton {
40         /** Gets the role of this object */
getAccessibleRole()41         public javax.accessibility.AccessibleRole getAccessibleRole() {
42             return javax.accessibility.AccessibleRole.TOGGLE_BUTTON;
43         }
44 
45         /** Gets the AccessibleValue associated with this object that has a graphical representation */
getAccessibleValue()46         public javax.accessibility.AccessibleValue getAccessibleValue() {
47             try {
48                 XAccessibleValue unoAccessibleValue = (XAccessibleValue) UnoRuntime.queryInterface(XAccessibleValue.class,
49                         unoAccessibleContext);
50 
51                 return (unoAccessibleValue != null)
52                 ? new AccessibleValueImpl(unoAccessibleValue) : null;
53             } catch (com.sun.star.uno.RuntimeException e) {
54                 return null;
55             }
56         }
57     }
58 }
59