Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/toolkit/source/controls/table/AccessibleGridControlHeaderCell.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 <com/sun/star/accessibility/AccessibleStateType.hpp>
21
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
22
#include <controls/table/AccessibleGridControlHeaderCell.hxx>
23
#include <vcl/svapp.hxx>
24
25
namespace accessibility
26
{
27
    using namespace ::com::sun::star::accessibility;
28
    using namespace ::com::sun::star::lang;
29
    using namespace ::com::sun::star::uno;
30
    using namespace ::vcl;
31
32
AccessibleGridControlHeaderCell::AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId,
33
                                  const Reference< XAccessible >& rxParent,
34
                                  svt::table::TableControl& rTable,
35
                                  AccessibleTableControlObjType  eObjType)
36
0
    : AccessibleGridControlCell(rxParent, rTable,
37
0
                            (eObjType == AccessibleTableControlObjType::ROWHEADERCELL) ? _nColumnRowId : 0,
38
0
                            (eObjType == AccessibleTableControlObjType::ROWHEADERCELL) ? 0 : _nColumnRowId,
39
0
                            eObjType)
40
0
    , m_nColumnRowId(_nColumnRowId)
41
0
{
42
0
    assert(eObjType == AccessibleTableControlObjType::ROWHEADERCELL || eObjType == AccessibleTableControlObjType::COLUMNHEADERCELL);
43
0
}
44
45
/** Return a bitset of states of the current object.
46
*/
47
sal_Int64 AccessibleGridControlHeaderCell::implCreateStateSet()
48
0
{
49
0
    sal_Int64 nStateSet = 0;
50
51
0
    if( isAlive() )
52
0
    {
53
        // SHOWING done with mxParent
54
0
        if( implIsShowing() )
55
0
            nStateSet |= AccessibleStateType::SHOWING;
56
57
0
        nStateSet |= AccessibleStateType::VISIBLE;
58
0
        nStateSet |= AccessibleStateType::FOCUSABLE;
59
0
        nStateSet |= AccessibleStateType::TRANSIENT;
60
0
        nStateSet |= AccessibleStateType::SELECTABLE;
61
62
0
        if ( m_aTable.IsRowSelected(m_nColumnRowId) )
63
0
            nStateSet |= AccessibleStateType::SELECTED;
64
0
    }
65
0
    else
66
0
        nStateSet |= AccessibleStateType::DEFUNC;
67
68
0
    return nStateSet;
69
0
}
70
71
/** @return
72
        The count of visible children.
73
*/
74
sal_Int64 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChildCount()
75
0
{
76
0
    return 0;
77
0
}
78
79
80
/** @return
81
        The XAccessible interface of the specified child.
82
*/
83
Reference<XAccessible > SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChild( sal_Int64 )
84
0
{
85
0
    throw IndexOutOfBoundsException();
86
0
}
87
88
/** Grabs the focus to the column header. */
89
void SAL_CALL AccessibleGridControlHeaderCell::grabFocus()
90
0
{
91
0
}
92
93
/** @return
94
        The name of this class.
95
*/
96
OUString SAL_CALL AccessibleGridControlHeaderCell::getImplementationName()
97
0
{
98
0
    return u"com.sun.star.accessibility.AccessibleGridControlHeaderCell"_ustr;
99
0
}
100
101
AbsoluteScreenPixelRectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen()
102
0
{
103
0
    AbsoluteScreenPixelRectangle aGridRect( m_aTable.GetWindowExtentsAbsolute() );
104
0
    sal_Int32 nIndex = getAccessibleIndexInParent();
105
0
    tools::Rectangle aCellRect;
106
0
    if (m_eObjType == AccessibleTableControlObjType::COLUMNHEADERCELL)
107
0
        aCellRect = m_aTable.calcHeaderCellRect(true, nIndex);
108
0
    else
109
0
        aCellRect = m_aTable.calcHeaderCellRect(false, nIndex);
110
0
    return AbsoluteScreenPixelRectangle(AbsoluteScreenPixelPoint(aGridRect.Left()+aCellRect.Left(),aGridRect.Top()+aCellRect.Top()), aCellRect.GetSize());
111
0
}
112
113
sal_Int64 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleIndexInParent()
114
0
{
115
0
    SolarMutexGuard g;
116
117
0
    ensureAlive();
118
0
    return m_nColumnRowId;
119
0
}
120
121
} // namespace accessibility
122
123
124
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */