Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <editeng/AccessibleComponentBase.hxx>
21 :
22 : #include <com/sun/star/accessibility/AccessibleRole.hpp>
23 : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
24 : #include <com/sun/star/container/XChild.hpp>
25 : #include <com/sun/star/beans/XPropertySet.hpp>
26 : #include <com/sun/star/drawing/XShapes.hpp>
27 : #include <com/sun/star/drawing/XShapeDescriptor.hpp>
28 : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
29 :
30 : #include <tools/color.hxx>
31 :
32 : using namespace ::com::sun::star;
33 : using namespace ::com::sun::star::accessibility;
34 :
35 : namespace accessibility {
36 :
37 : //===== internal ============================================================
38 :
39 28 : AccessibleComponentBase::AccessibleComponentBase (void)
40 : {
41 28 : }
42 :
43 :
44 :
45 :
46 28 : AccessibleComponentBase::~AccessibleComponentBase (void)
47 : {
48 28 : }
49 :
50 :
51 :
52 :
53 : //===== XAccessibleComponent ================================================
54 :
55 444 : sal_Bool SAL_CALL AccessibleComponentBase::containsPoint (
56 : const ::com::sun::star::awt::Point& aPoint)
57 : throw (::com::sun::star::uno::RuntimeException, std::exception)
58 : {
59 444 : awt::Size aSize (getSize());
60 444 : return (aPoint.X >= 0)
61 354 : && (aPoint.X < aSize.Width)
62 264 : && (aPoint.Y >= 0)
63 580 : && (aPoint.Y < aSize.Height);
64 : }
65 :
66 :
67 :
68 :
69 : uno::Reference<XAccessible > SAL_CALL
70 0 : AccessibleComponentBase::getAccessibleAtPoint (
71 : const awt::Point& /*aPoint*/)
72 : throw (uno::RuntimeException, std::exception)
73 : {
74 0 : return uno::Reference<XAccessible>();
75 : }
76 :
77 :
78 :
79 :
80 0 : awt::Rectangle SAL_CALL AccessibleComponentBase::getBounds (void)
81 : throw (uno::RuntimeException, std::exception)
82 : {
83 0 : return awt::Rectangle();
84 : }
85 :
86 :
87 :
88 :
89 0 : awt::Point SAL_CALL AccessibleComponentBase::getLocation (void)
90 : throw (::com::sun::star::uno::RuntimeException, std::exception)
91 : {
92 0 : awt::Rectangle aBBox (getBounds());
93 0 : return awt::Point (aBBox.X, aBBox.Y);
94 : }
95 :
96 :
97 :
98 :
99 0 : awt::Point SAL_CALL AccessibleComponentBase::getLocationOnScreen (void)
100 : throw (::com::sun::star::uno::RuntimeException, std::exception)
101 : {
102 0 : return awt::Point();
103 : }
104 :
105 :
106 :
107 :
108 0 : ::com::sun::star::awt::Size SAL_CALL AccessibleComponentBase::getSize (void)
109 : throw (::com::sun::star::uno::RuntimeException, std::exception)
110 : {
111 0 : awt::Rectangle aBBox (getBounds());
112 0 : return awt::Size (aBBox.Width, aBBox.Height);
113 : }
114 :
115 :
116 :
117 :
118 0 : void SAL_CALL AccessibleComponentBase::addFocusListener (
119 : const ::com::sun::star::uno::Reference<
120 : ::com::sun::star::awt::XFocusListener >& /*xListener*/)
121 : throw (::com::sun::star::uno::RuntimeException)
122 : {
123 : // Ignored
124 0 : }
125 :
126 :
127 :
128 :
129 0 : void SAL_CALL AccessibleComponentBase::removeFocusListener (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 2 : void SAL_CALL AccessibleComponentBase::grabFocus (void)
140 : throw (::com::sun::star::uno::RuntimeException, std::exception)
141 : {
142 2 : uno::Reference<XAccessibleContext> xContext (this, uno::UNO_QUERY);
143 : uno::Reference<XAccessibleSelection> xSelection (
144 4 : xContext->getAccessibleParent(), uno::UNO_QUERY);
145 2 : if (xSelection.is())
146 : {
147 : // Do a single selection on this object.
148 2 : xSelection->clearAccessibleSelection();
149 2 : xSelection->selectAccessibleChild (xContext->getAccessibleIndexInParent());
150 2 : }
151 2 : }
152 :
153 :
154 :
155 :
156 0 : sal_Int32 SAL_CALL AccessibleComponentBase::getForeground (void)
157 : throw (::com::sun::star::uno::RuntimeException, std::exception)
158 : {
159 0 : return Color(COL_BLACK).GetColor();
160 : }
161 :
162 :
163 :
164 :
165 0 : sal_Int32 SAL_CALL AccessibleComponentBase::getBackground (void)
166 : throw (::com::sun::star::uno::RuntimeException, std::exception)
167 : {
168 0 : return Color(COL_WHITE).GetColor();
169 : }
170 :
171 :
172 :
173 :
174 : //===== XAccessibleExtendedComponent ========================================
175 :
176 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL
177 2 : AccessibleComponentBase::getFont (void)
178 : throw (::com::sun::star::uno::RuntimeException, std::exception)
179 : {
180 2 : return uno::Reference<awt::XFont>();
181 : }
182 :
183 :
184 :
185 :
186 2 : OUString SAL_CALL AccessibleComponentBase::getTitledBorderText (void)
187 : throw (::com::sun::star::uno::RuntimeException, std::exception)
188 : {
189 2 : return OUString();
190 : }
191 :
192 :
193 2 : OUString SAL_CALL AccessibleComponentBase::getToolTipText (void)
194 : throw (::com::sun::star::uno::RuntimeException, std::exception)
195 : {
196 2 : return OUString();
197 : }
198 :
199 :
200 :
201 :
202 : //===== XTypeProvider ===================================================
203 :
204 : uno::Sequence<uno::Type> SAL_CALL
205 0 : AccessibleComponentBase::getTypes (void)
206 : throw (uno::RuntimeException, std::exception)
207 : {
208 : // Get list of types from the context base implementation...
209 0 : uno::Sequence<uno::Type> aTypeList (2);
210 : // ...and add the additional type for the component.
211 : const uno::Type aComponentType =
212 0 : cppu::UnoType<XAccessibleComponent>::get();
213 : const uno::Type aExtendedComponentType =
214 0 : cppu::UnoType<XAccessibleExtendedComponent>::get();
215 0 : aTypeList[0] = aComponentType;
216 0 : aTypeList[1] = aExtendedComponentType;
217 :
218 0 : return aTypeList;
219 : }
220 :
221 :
222 : } // end of namespace accessibility
223 :
224 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|