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 ::rtl;
33 : using namespace ::com::sun::star;
34 : using namespace ::com::sun::star::accessibility;
35 :
36 : namespace accessibility {
37 :
38 : //===== internal ============================================================
39 :
40 0 : AccessibleComponentBase::AccessibleComponentBase (void)
41 : {
42 0 : }
43 :
44 :
45 :
46 :
47 0 : AccessibleComponentBase::~AccessibleComponentBase (void)
48 : {
49 0 : }
50 :
51 :
52 :
53 :
54 : //===== XAccessibleComponent ================================================
55 :
56 0 : sal_Bool SAL_CALL AccessibleComponentBase::containsPoint (
57 : const ::com::sun::star::awt::Point& aPoint)
58 : throw (::com::sun::star::uno::RuntimeException, std::exception)
59 : {
60 0 : awt::Size aSize (getSize());
61 0 : return (aPoint.X >= 0)
62 0 : && (aPoint.X < aSize.Width)
63 0 : && (aPoint.Y >= 0)
64 0 : && (aPoint.Y < aSize.Height);
65 : }
66 :
67 :
68 :
69 :
70 : uno::Reference<XAccessible > SAL_CALL
71 0 : AccessibleComponentBase::getAccessibleAtPoint (
72 : const awt::Point& /*aPoint*/)
73 : throw (uno::RuntimeException, std::exception)
74 : {
75 0 : return uno::Reference<XAccessible>();
76 : }
77 :
78 :
79 :
80 :
81 0 : awt::Rectangle SAL_CALL AccessibleComponentBase::getBounds (void)
82 : throw (uno::RuntimeException, std::exception)
83 : {
84 0 : return awt::Rectangle();
85 : }
86 :
87 :
88 :
89 :
90 0 : awt::Point SAL_CALL AccessibleComponentBase::getLocation (void)
91 : throw (::com::sun::star::uno::RuntimeException, std::exception)
92 : {
93 0 : awt::Rectangle aBBox (getBounds());
94 0 : return awt::Point (aBBox.X, aBBox.Y);
95 : }
96 :
97 :
98 :
99 :
100 0 : awt::Point SAL_CALL AccessibleComponentBase::getLocationOnScreen (void)
101 : throw (::com::sun::star::uno::RuntimeException, std::exception)
102 : {
103 0 : return awt::Point();
104 : }
105 :
106 :
107 :
108 :
109 0 : ::com::sun::star::awt::Size SAL_CALL AccessibleComponentBase::getSize (void)
110 : throw (::com::sun::star::uno::RuntimeException, std::exception)
111 : {
112 0 : awt::Rectangle aBBox (getBounds());
113 0 : return awt::Size (aBBox.Width, aBBox.Height);
114 : }
115 :
116 :
117 :
118 :
119 0 : void SAL_CALL AccessibleComponentBase::addFocusListener (
120 : const ::com::sun::star::uno::Reference<
121 : ::com::sun::star::awt::XFocusListener >& /*xListener*/)
122 : throw (::com::sun::star::uno::RuntimeException)
123 : {
124 : // Ignored
125 0 : }
126 :
127 :
128 :
129 :
130 0 : void SAL_CALL AccessibleComponentBase::removeFocusListener (const ::com::sun::star::uno::Reference<
131 : ::com::sun::star::awt::XFocusListener >& /*xListener*/ )
132 : throw (::com::sun::star::uno::RuntimeException)
133 : {
134 : // Ignored
135 0 : }
136 :
137 :
138 :
139 :
140 0 : void SAL_CALL AccessibleComponentBase::grabFocus (void)
141 : throw (::com::sun::star::uno::RuntimeException, std::exception)
142 : {
143 0 : uno::Reference<XAccessibleContext> xContext (this, uno::UNO_QUERY);
144 : uno::Reference<XAccessibleSelection> xSelection (
145 0 : xContext->getAccessibleParent(), uno::UNO_QUERY);
146 0 : if (xSelection.is())
147 : {
148 : // Do a single selection on this object.
149 0 : xSelection->clearAccessibleSelection();
150 0 : xSelection->selectAccessibleChild (xContext->getAccessibleIndexInParent());
151 0 : }
152 0 : }
153 :
154 :
155 :
156 :
157 0 : sal_Int32 SAL_CALL AccessibleComponentBase::getForeground (void)
158 : throw (::com::sun::star::uno::RuntimeException, std::exception)
159 : {
160 0 : return Color(COL_BLACK).GetColor();
161 : }
162 :
163 :
164 :
165 :
166 0 : sal_Int32 SAL_CALL AccessibleComponentBase::getBackground (void)
167 : throw (::com::sun::star::uno::RuntimeException, std::exception)
168 : {
169 0 : return Color(COL_WHITE).GetColor();
170 : }
171 :
172 :
173 :
174 :
175 : //===== XAccessibleExtendedComponent ========================================
176 :
177 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL
178 0 : AccessibleComponentBase::getFont (void)
179 : throw (::com::sun::star::uno::RuntimeException, std::exception)
180 : {
181 0 : return uno::Reference<awt::XFont>();
182 : }
183 :
184 :
185 :
186 :
187 0 : OUString SAL_CALL AccessibleComponentBase::getTitledBorderText (void)
188 : throw (::com::sun::star::uno::RuntimeException, std::exception)
189 : {
190 0 : return OUString();
191 : }
192 :
193 :
194 0 : OUString SAL_CALL AccessibleComponentBase::getToolTipText (void)
195 : throw (::com::sun::star::uno::RuntimeException, std::exception)
196 : {
197 0 : return OUString();
198 : }
199 :
200 :
201 :
202 :
203 : //===== XTypeProvider ===================================================
204 :
205 : uno::Sequence<uno::Type> SAL_CALL
206 0 : AccessibleComponentBase::getTypes (void)
207 : throw (uno::RuntimeException, std::exception)
208 : {
209 : // Get list of types from the context base implementation...
210 0 : uno::Sequence<uno::Type> aTypeList (2);
211 : // ...and add the additional type for the component.
212 : const uno::Type aComponentType =
213 0 : ::getCppuType((const uno::Reference<XAccessibleComponent>*)0);
214 : const uno::Type aExtendedComponentType =
215 0 : ::getCppuType((const uno::Reference<XAccessibleExtendedComponent>*)0);
216 0 : aTypeList[0] = aComponentType;
217 0 : aTypeList[1] = aExtendedComponentType;
218 :
219 0 : return aTypeList;
220 : }
221 :
222 :
223 : } // end of namespace accessibility
224 :
225 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|