bump product version to 6.4.0.3
[LibreOffice.git] / editeng / source / accessibility / AccessibleComponentBase.cxx
blob4647f074ab76b1a74f25e0d7d632a43c30820fc7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/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>
30 #include <tools/color.hxx>
32 using namespace ::com::sun::star;
33 using namespace ::com::sun::star::accessibility;
35 namespace accessibility {
37 // internal
39 AccessibleComponentBase::AccessibleComponentBase()
44 AccessibleComponentBase::~AccessibleComponentBase()
48 // XAccessibleComponent
50 sal_Bool SAL_CALL AccessibleComponentBase::containsPoint (
51 const css::awt::Point& aPoint)
53 awt::Size aSize (getSize());
54 return (aPoint.X >= 0)
55 && (aPoint.X < aSize.Width)
56 && (aPoint.Y >= 0)
57 && (aPoint.Y < aSize.Height);
61 uno::Reference<XAccessible > SAL_CALL
62 AccessibleComponentBase::getAccessibleAtPoint (
63 const awt::Point& /*aPoint*/)
65 return uno::Reference<XAccessible>();
69 awt::Rectangle SAL_CALL AccessibleComponentBase::getBounds()
71 return awt::Rectangle();
75 awt::Point SAL_CALL AccessibleComponentBase::getLocation()
77 awt::Rectangle aBBox (getBounds());
78 return awt::Point (aBBox.X, aBBox.Y);
82 awt::Point SAL_CALL AccessibleComponentBase::getLocationOnScreen()
84 return awt::Point();
88 css::awt::Size SAL_CALL AccessibleComponentBase::getSize()
90 awt::Rectangle aBBox (getBounds());
91 return awt::Size (aBBox.Width, aBBox.Height);
95 void SAL_CALL AccessibleComponentBase::grabFocus()
97 uno::Reference<XAccessibleContext> xContext (this, uno::UNO_QUERY);
98 uno::Reference<XAccessibleSelection> xSelection (
99 xContext->getAccessibleParent(), uno::UNO_QUERY);
100 if (xSelection.is())
102 // Do a single selection on this object.
103 xSelection->clearAccessibleSelection();
104 xSelection->selectAccessibleChild (xContext->getAccessibleIndexInParent());
109 sal_Int32 SAL_CALL AccessibleComponentBase::getForeground()
111 return sal_Int32(COL_BLACK);
115 sal_Int32 SAL_CALL AccessibleComponentBase::getBackground()
117 return sal_Int32(COL_WHITE);
121 // XAccessibleExtendedComponent
123 css::uno::Reference< css::awt::XFont > SAL_CALL
124 AccessibleComponentBase::getFont()
126 return uno::Reference<awt::XFont>();
130 OUString SAL_CALL AccessibleComponentBase::getTitledBorderText()
132 return OUString();
136 OUString SAL_CALL AccessibleComponentBase::getToolTipText()
138 return OUString();
141 // XTypeProvider
143 uno::Sequence<uno::Type>
144 AccessibleComponentBase::getTypes()
146 static const uno::Sequence aTypeList {
147 cppu::UnoType<XAccessibleComponent>::get(),
148 cppu::UnoType<XAccessibleExtendedComponent>::get() };
149 return aTypeList;
153 } // end of namespace accessibility
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */