Coverage Report

Created: 2026-05-16 09:25

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