bump product version to 4.2.0.1
[LibreOffice.git] / toolkit / test / accessibility / AccessibleExtendedComponentHandler.java
blob6bfbc48ef391677cd4cfed7f1a2c43352fc73f36
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 import com.sun.star.uno.UnoRuntime;
20 import com.sun.star.accessibility.XAccessibleContext;
21 import com.sun.star.accessibility.XAccessibleExtendedComponent;
24 class AccessibleExtendedComponentHandler
25 extends NodeHandler
27 public NodeHandler createHandler (XAccessibleContext xContext)
29 XAccessibleExtendedComponent xEComponent =
30 UnoRuntime.queryInterface (
31 XAccessibleExtendedComponent.class, xContext);
32 if (xEComponent != null)
33 return new AccessibleExtendedComponentHandler (xEComponent);
34 else
35 return null;
38 public AccessibleExtendedComponentHandler ()
42 public AccessibleExtendedComponentHandler (XAccessibleExtendedComponent xEComponent)
44 if (xEComponent != null)
45 maChildList.setSize (0);
48 private static XAccessibleExtendedComponent getComponent (AccTreeNode aNode)
50 return UnoRuntime.queryInterface (
51 XAccessibleExtendedComponent.class,
52 aNode.getContext());
56 public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
58 AccessibleTreeNode aChild = null;
59 if (aParent instanceof AccTreeNode)
61 XAccessibleExtendedComponent xEComponent = getComponent ((AccTreeNode)aParent);
63 if (xEComponent != null)
65 int nColor;
66 switch( nIndex )
68 case 0:
69 nColor = xEComponent.getForeground();
70 aChild = new StringNode ("Depricated Foreground color: R"
71 + (nColor>>16&0xff)
72 + "G" + (nColor>>8&0xff)
73 + "B" + (nColor>>0&0xff)
74 + "A" + (nColor>>24&0xff),
75 aParent);
76 break;
77 case 1:
78 nColor = xEComponent.getBackground();
79 aChild = new StringNode ("Depricated Background color: R"
80 + (nColor>>16&0xff)
81 + "G" + (nColor>>8&0xff)
82 + "B" + (nColor>>0&0xff)
83 + "A" + (nColor>>24&0xff),
84 aParent);
85 break;
89 return aChild;