/src/libreoffice/vcl/source/accessibility/accessiblebrowseboxcell.cxx
Line | Count | Source |
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 <sal/types.h> |
21 | | #include <vcl/accessibility/AccessibleBrowseBoxCell.hxx> |
22 | | #include <vcl/accessibletableprovider.hxx> |
23 | | |
24 | | using namespace ::com::sun::star::uno; |
25 | | using namespace ::com::sun::star::awt; |
26 | | using namespace ::com::sun::star::accessibility; |
27 | | |
28 | | // AccessibleBrowseBoxCell |
29 | | AccessibleBrowseBoxCell::AccessibleBrowseBoxCell( |
30 | | const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, ::vcl::IAccessibleTableProvider& _rBrowseBox, |
31 | | const css::uno::Reference< css::awt::XWindow >& _xFocusWindow, |
32 | | sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleBrowseBoxObjType _eType ) |
33 | 0 | :AccessibleBrowseBoxBase( _rxParent, _rBrowseBox, _xFocusWindow, _eType ) |
34 | 0 | ,m_nRowPos( _nRowPos ) |
35 | 0 | ,m_nColPos( _nColPos ) |
36 | 0 | { |
37 | | // set accessible name here, because for that we need the position of the cell |
38 | | // and so the base class isn't capable of doing this |
39 | 0 | sal_Int32 nPos = _nRowPos * _rBrowseBox.GetColumnCount() + _nColPos; |
40 | 0 | OUString aAccName = _rBrowseBox.GetAccessibleObjectName( AccessibleBrowseBoxObjType::TableCell, nPos ); |
41 | 0 | implSetName( aAccName ); |
42 | 0 | } |
43 | | |
44 | | AccessibleBrowseBoxCell::~AccessibleBrowseBoxCell() |
45 | 0 | { |
46 | 0 | } |
47 | | |
48 | | void SAL_CALL AccessibleBrowseBoxCell::grabFocus() |
49 | 0 | { |
50 | 0 | SolarMethodGuard aGuard(getMutex()); |
51 | 0 | ensureIsAlive(); |
52 | |
|
53 | 0 | mpBrowseBox->GoToCell( m_nRowPos, m_nColPos ); |
54 | 0 | } |
55 | | |
56 | | ::tools::Rectangle AccessibleBrowseBoxCell::implGetBoundingBox() |
57 | 0 | { |
58 | 0 | tools::Rectangle aCellRect = mpBrowseBox->calcFieldRectPixel(m_nRowPos, m_nColPos, false); |
59 | | // above rect is relative to the browse box, convert it to be relative to the table (which is the cell's parent) |
60 | 0 | aCellRect.SetPos(aCellRect.TopLeft() - mpBrowseBox->calcTableRect().TopLeft()); |
61 | 0 | return aCellRect; |
62 | 0 | } |
63 | | |
64 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |