Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <editeng/AccessibleComponentBase.hxx>
30 : :
31 : : #include <com/sun/star/accessibility/AccessibleRole.hpp>
32 : : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
33 : : #include <com/sun/star/container/XChild.hpp>
34 : : #include <com/sun/star/beans/XPropertySet.hpp>
35 : : #include <com/sun/star/drawing/XShapes.hpp>
36 : : #include <com/sun/star/drawing/XShapeDescriptor.hpp>
37 : : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
38 : :
39 : : #include <tools/color.hxx>
40 : :
41 : : using namespace ::rtl;
42 : : using namespace ::com::sun::star;
43 : : using namespace ::com::sun::star::accessibility;
44 : :
45 : : namespace accessibility {
46 : :
47 : : //===== internal ============================================================
48 : :
49 : 28 : AccessibleComponentBase::AccessibleComponentBase (void)
50 : : {
51 : 28 : }
52 : :
53 : :
54 : :
55 : :
56 : 28 : AccessibleComponentBase::~AccessibleComponentBase (void)
57 : : {
58 [ - + ]: 28 : }
59 : :
60 : :
61 : :
62 : :
63 : : //===== XAccessibleComponent ================================================
64 : :
65 : 456 : sal_Bool SAL_CALL AccessibleComponentBase::containsPoint (
66 : : const ::com::sun::star::awt::Point& aPoint)
67 : : throw (::com::sun::star::uno::RuntimeException)
68 : : {
69 [ + - ]: 456 : awt::Size aSize (getSize());
70 : : return (aPoint.X >= 0)
71 : : && (aPoint.X < aSize.Width)
72 : : && (aPoint.Y >= 0)
73 [ + + ][ + + ]: 456 : && (aPoint.Y < aSize.Height);
[ + + ][ + + ]
74 : : }
75 : :
76 : :
77 : :
78 : :
79 : : uno::Reference<XAccessible > SAL_CALL
80 : 0 : AccessibleComponentBase::getAccessibleAtPoint (
81 : : const awt::Point& /*aPoint*/)
82 : : throw (uno::RuntimeException)
83 : : {
84 : 0 : return uno::Reference<XAccessible>();
85 : : }
86 : :
87 : :
88 : :
89 : :
90 : 0 : awt::Rectangle SAL_CALL AccessibleComponentBase::getBounds (void)
91 : : throw (uno::RuntimeException)
92 : : {
93 : 0 : return awt::Rectangle();
94 : : }
95 : :
96 : :
97 : :
98 : :
99 : 0 : awt::Point SAL_CALL AccessibleComponentBase::getLocation (void)
100 : : throw (::com::sun::star::uno::RuntimeException)
101 : : {
102 [ # # ]: 0 : awt::Rectangle aBBox (getBounds());
103 : 0 : return awt::Point (aBBox.X, aBBox.Y);
104 : : }
105 : :
106 : :
107 : :
108 : :
109 : 0 : awt::Point SAL_CALL AccessibleComponentBase::getLocationOnScreen (void)
110 : : throw (::com::sun::star::uno::RuntimeException)
111 : : {
112 : 0 : return awt::Point();
113 : : }
114 : :
115 : :
116 : :
117 : :
118 : 0 : ::com::sun::star::awt::Size SAL_CALL AccessibleComponentBase::getSize (void)
119 : : throw (::com::sun::star::uno::RuntimeException)
120 : : {
121 [ # # ]: 0 : awt::Rectangle aBBox (getBounds());
122 : 0 : return awt::Size (aBBox.Width, aBBox.Height);
123 : : }
124 : :
125 : :
126 : :
127 : :
128 : 0 : void SAL_CALL AccessibleComponentBase::addFocusListener (
129 : : const ::com::sun::star::uno::Reference<
130 : : ::com::sun::star::awt::XFocusListener >& /*xListener*/)
131 : : throw (::com::sun::star::uno::RuntimeException)
132 : : {
133 : : // Ignored
134 : 0 : }
135 : :
136 : :
137 : :
138 : :
139 : 0 : void SAL_CALL AccessibleComponentBase::removeFocusListener (const ::com::sun::star::uno::Reference<
140 : : ::com::sun::star::awt::XFocusListener >& /*xListener*/ )
141 : : throw (::com::sun::star::uno::RuntimeException)
142 : : {
143 : : // Ignored
144 : 0 : }
145 : :
146 : :
147 : :
148 : :
149 : 2 : void SAL_CALL AccessibleComponentBase::grabFocus (void)
150 : : throw (::com::sun::star::uno::RuntimeException)
151 : : {
152 [ + - ]: 2 : uno::Reference<XAccessibleContext> xContext (this, uno::UNO_QUERY);
153 : : uno::Reference<XAccessibleSelection> xSelection (
154 [ + - ][ + - ]: 2 : xContext->getAccessibleParent(), uno::UNO_QUERY);
[ + - ]
155 [ + - ]: 2 : if (xSelection.is())
156 : : {
157 : : // Do a single selection on this object.
158 [ + - ][ + - ]: 2 : xSelection->clearAccessibleSelection();
159 [ + - ][ + - ]: 2 : xSelection->selectAccessibleChild (xContext->getAccessibleIndexInParent());
[ + - ][ + - ]
160 : 2 : }
161 : 2 : }
162 : :
163 : :
164 : :
165 : :
166 : 0 : sal_Int32 SAL_CALL AccessibleComponentBase::getForeground (void)
167 : : throw (::com::sun::star::uno::RuntimeException)
168 : : {
169 : 0 : return Color(COL_BLACK).GetColor();
170 : : }
171 : :
172 : :
173 : :
174 : :
175 : 0 : sal_Int32 SAL_CALL AccessibleComponentBase::getBackground (void)
176 : : throw (::com::sun::star::uno::RuntimeException)
177 : : {
178 : 0 : return Color(COL_WHITE).GetColor();
179 : : }
180 : :
181 : :
182 : :
183 : :
184 : : //===== XAccessibleExtendedComponent ========================================
185 : :
186 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL
187 : 2 : AccessibleComponentBase::getFont (void)
188 : : throw (::com::sun::star::uno::RuntimeException)
189 : : {
190 : 2 : return uno::Reference<awt::XFont>();
191 : : }
192 : :
193 : :
194 : :
195 : :
196 : 2 : ::rtl::OUString SAL_CALL AccessibleComponentBase::getTitledBorderText (void)
197 : : throw (::com::sun::star::uno::RuntimeException)
198 : : {
199 : 2 : return ::rtl::OUString ("");
200 : : }
201 : :
202 : :
203 : :
204 : :
205 : 2 : ::rtl::OUString SAL_CALL AccessibleComponentBase::getToolTipText (void)
206 : : throw (::com::sun::star::uno::RuntimeException)
207 : : {
208 : 2 : return ::rtl::OUString ("");
209 : : }
210 : :
211 : :
212 : :
213 : :
214 : : //===== XTypeProvider ===================================================
215 : :
216 : : uno::Sequence<uno::Type> SAL_CALL
217 : 0 : AccessibleComponentBase::getTypes (void)
218 : : throw (uno::RuntimeException)
219 : : {
220 : : // Get list of types from the context base implementation...
221 [ # # ]: 0 : uno::Sequence<uno::Type> aTypeList (2);
222 : : // ...and add the additional type for the component.
223 : : const uno::Type aComponentType =
224 [ # # ]: 0 : ::getCppuType((const uno::Reference<XAccessibleComponent>*)0);
225 : : const uno::Type aExtendedComponentType =
226 [ # # ]: 0 : ::getCppuType((const uno::Reference<XAccessibleExtendedComponent>*)0);
227 [ # # ]: 0 : aTypeList[0] = aComponentType;
228 [ # # ]: 0 : aTypeList[1] = aExtendedComponentType;
229 : :
230 : 0 : return aTypeList;
231 : : }
232 : :
233 : :
234 : : } // end of namespace accessibility
235 : :
236 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|