1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <editeng/AccessibleComponentBase.hxx>
22 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
24 #include <tools/color.hxx>
26 using namespace ::com::sun::star
;
27 using namespace ::com::sun::star::accessibility
;
29 namespace accessibility
{
33 AccessibleComponentBase::AccessibleComponentBase()
38 AccessibleComponentBase::~AccessibleComponentBase()
42 // XAccessibleComponent
44 sal_Bool SAL_CALL
AccessibleComponentBase::containsPoint (
45 const css::awt::Point
& aPoint
)
47 awt::Size
aSize (getSize());
48 return (aPoint
.X
>= 0)
49 && (aPoint
.X
< aSize
.Width
)
51 && (aPoint
.Y
< aSize
.Height
);
55 uno::Reference
<XAccessible
> SAL_CALL
56 AccessibleComponentBase::getAccessibleAtPoint (
57 const awt::Point
& /*aPoint*/)
59 return uno::Reference
<XAccessible
>();
63 awt::Rectangle SAL_CALL
AccessibleComponentBase::getBounds()
65 return awt::Rectangle();
69 awt::Point SAL_CALL
AccessibleComponentBase::getLocation()
71 awt::Rectangle
aBBox (getBounds());
72 return awt::Point (aBBox
.X
, aBBox
.Y
);
76 awt::Point SAL_CALL
AccessibleComponentBase::getLocationOnScreen()
82 css::awt::Size SAL_CALL
AccessibleComponentBase::getSize()
84 awt::Rectangle
aBBox (getBounds());
85 return awt::Size (aBBox
.Width
, aBBox
.Height
);
89 void SAL_CALL
AccessibleComponentBase::grabFocus()
91 uno::Reference
<XAccessibleContext
> xContext (this, uno::UNO_QUERY
);
92 uno::Reference
<XAccessibleSelection
> xSelection (
93 xContext
->getAccessibleParent(), uno::UNO_QUERY
);
96 // Do a single selection on this object.
97 xSelection
->clearAccessibleSelection();
98 xSelection
->selectAccessibleChild (xContext
->getAccessibleIndexInParent());
103 sal_Int32 SAL_CALL
AccessibleComponentBase::getForeground()
105 return sal_Int32(COL_BLACK
);
109 sal_Int32 SAL_CALL
AccessibleComponentBase::getBackground()
111 return sal_Int32(COL_WHITE
);
115 // XAccessibleExtendedComponent
117 css::uno::Reference
< css::awt::XFont
> SAL_CALL
118 AccessibleComponentBase::getFont()
120 return uno::Reference
<awt::XFont
>();
124 OUString SAL_CALL
AccessibleComponentBase::getTitledBorderText()
130 OUString SAL_CALL
AccessibleComponentBase::getToolTipText()
137 uno::Sequence
<uno::Type
>
138 AccessibleComponentBase::getTypes()
140 static const uno::Sequence aTypeList
{
141 cppu::UnoType
<XAccessibleComponent
>::get(),
142 cppu::UnoType
<XAccessibleExtendedComponent
>::get() };
147 } // end of namespace accessibility
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */