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
.XAccessibleComponent
;
24 class AccessibleComponentHandler
29 public NodeHandler
createHandler (XAccessibleContext xContext
)
31 XAccessibleComponent xComponent
=
32 UnoRuntime
.queryInterface (
33 XAccessibleComponent
.class, xContext
);
34 if (xComponent
!= null)
35 return new AccessibleComponentHandler (xComponent
);
41 public AccessibleComponentHandler ()
45 private AccessibleComponentHandler (XAccessibleComponent xComponent
)
47 if (xComponent
!= null)
48 maChildList
.setSize (6);
52 public AccessibleTreeNode
createChild (AccessibleTreeNode aParent
, int nIndex
)
54 AccessibleTreeNode aChild
= null;
55 if (aParent
instanceof AccTreeNode
)
57 XAccessibleComponent xComponent
=
58 ((AccTreeNode
)aParent
).getComponent();
60 if (xComponent
!= null)
66 com
.sun
.star
.awt
.Point aLocation
= xComponent
.getLocation();
67 aChild
= new StringNode (
68 "Location: " + aLocation
.X
+ ", " + aLocation
.Y
,
72 com
.sun
.star
.awt
.Point aScreenLocation
= xComponent
.getLocationOnScreen();
73 aChild
= new StringNode (
74 "Location on Screen: " + aScreenLocation
.X
+ ", " + aScreenLocation
.Y
,
78 com
.sun
.star
.awt
.Size aSize
= xComponent
.getSize();
79 aChild
= new StringNode (
80 "Size: "+ aSize
.Width
+ ", " + aSize
.Height
,
84 com
.sun
.star
.awt
.Rectangle aBBox
= xComponent
.getBounds();
85 aChild
= new StringNode (
86 "Bounding Box: "+ aBBox
.X
+ ", " + aBBox
.Y
+ ","
87 + aBBox
.Width
+ ", " + aBBox
.Height
,
91 nColor
= xComponent
.getForeground();
92 aChild
= new StringNode ("Foreground color: R"
94 + "G" + (nColor
>>8&0xff)
96 + "A" + (nColor
>>24&0xff),
100 nColor
= xComponent
.getBackground();
101 aChild
= new StringNode ("Background color: R"
103 + "G" + (nColor
>>8&0xff)
104 + "B" + (nColor
&0xff)
105 + "A" + (nColor
>>24&0xff),
115 public void update (AccessibleTreeNode aNode
)
118 if (aNode
instanceof AccTreeNode
&& ((AccTreeNode
)aNode
).getComponent() != null)
119 maChildList
.setSize (4);