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