Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/toolkit/inc/controls/table/AccessibleGridControlTableCell.hxx
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
#pragma once
20
21
#include <controls/table/AccessibleGridControlBase.hxx>
22
#include <controls/table/tablecontrol.hxx>
23
24
#include <comphelper/accessibletexthelper.hxx>
25
#include <cppuhelper/implbase2.hxx>
26
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
27
28
namespace accessibility
29
{
30
class AccessibleGridControlCell : public AccessibleGridControlBase
31
{
32
private:
33
    sal_Int32 m_nRowPos; // the row number of the table cell
34
    sal_Int32 m_nColPos; // the column id of the table cell
35
36
protected:
37
    // attribute access
38
0
    sal_Int32 getRowPos() const { return m_nRowPos; }
39
0
    sal_Int32 getColumnPos() const { return m_nColPos; }
40
41
    // XAccessibleComponent
42
    virtual void SAL_CALL grabFocus() override;
43
44
public:
45
    // XAccessibleContext
46
    virtual OUString SAL_CALL getAccessibleName() override;
47
48
protected:
49
    AccessibleGridControlCell(const css::uno::Reference<css::accessibility::XAccessible>& _rxParent,
50
                              svt::table::TableControl& _rTable, sal_Int32 _nRowPos,
51
                              sal_uInt16 _nColPos, AccessibleTableControlObjType _eType);
52
53
    virtual ~AccessibleGridControlCell() override = default;
54
55
private:
56
    AccessibleGridControlCell(const AccessibleGridControlCell&) = delete;
57
    AccessibleGridControlCell& operator=(const AccessibleGridControlCell&) = delete;
58
};
59
60
// implementation of a table cell of GridControl
61
class AccessibleGridControlTableCell final
62
    : public cppu::ImplInheritanceHelper<AccessibleGridControlCell,
63
                                         css::accessibility::XAccessibleText>,
64
      public ::comphelper::OCommonAccessibleText
65
{
66
private:
67
    // OCommonAccessibleText
68
    virtual OUString implGetText() override;
69
    virtual css::lang::Locale implGetLocale() override;
70
    virtual void implGetSelection(sal_Int32& nStartIndex, sal_Int32& nEndIndex) override final;
71
    virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override;
72
73
public:
74
    AccessibleGridControlTableCell(
75
        const css::uno::Reference<css::accessibility::XAccessible>& _rxParent,
76
        svt::table::TableControl& _rTable, sal_Int32 _nRowId, sal_uInt16 _nColId);
77
78
    /** @return  The index of this object among the parent's children. */
79
    virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override;
80
81
    /** @return
82
                The name of this class.
83
        */
84
    virtual OUString SAL_CALL getImplementationName() override;
85
86
    /** @return
87
                The count of visible children.
88
        */
89
    virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
90
91
    /** @return
92
                The XAccessible interface of the specified child.
93
        */
94
    virtual css::uno::Reference<css::accessibility::XAccessible>
95
        SAL_CALL getAccessibleChild(sal_Int64 nChildIndex) override;
96
97
    /** Return a bitset of states of the current object.
98
        */
99
    sal_Int64 implCreateStateSet() override;
100
101
    // XAccessibleText
102
    virtual sal_Int32 SAL_CALL getCaretPosition() override;
103
    virtual sal_Bool SAL_CALL setCaretPosition(sal_Int32 nIndex) override;
104
    virtual sal_Unicode SAL_CALL getCharacter(sal_Int32 nIndex) override;
105
    virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getCharacterAttributes(
106
        sal_Int32 nIndex, const css::uno::Sequence<OUString>& aRequestedAttributes) override;
107
    virtual css::awt::Rectangle SAL_CALL getCharacterBounds(sal_Int32 nIndex) override;
108
    virtual sal_Int32 SAL_CALL getCharacterCount() override;
109
    virtual sal_Int32 SAL_CALL getIndexAtPoint(const css::awt::Point& aPoint) override;
110
    virtual OUString SAL_CALL getSelectedText() override;
111
    virtual sal_Int32 SAL_CALL getSelectionStart() override;
112
    virtual sal_Int32 SAL_CALL getSelectionEnd() override;
113
    virtual sal_Bool SAL_CALL setSelection(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
114
    virtual OUString SAL_CALL getText() override;
115
    virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
116
    virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex(sal_Int32 nIndex,
117
                                                                    sal_Int16 aTextType) override;
118
    virtual css::accessibility::TextSegment SAL_CALL
119
    getTextBeforeIndex(sal_Int32 nIndex, sal_Int16 aTextType) override;
120
    virtual css::accessibility::TextSegment SAL_CALL
121
    getTextBehindIndex(sal_Int32 nIndex, sal_Int16 aTextType) override;
122
    virtual sal_Bool SAL_CALL copyText(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
123
    virtual sal_Bool SAL_CALL
124
    scrollSubstringTo(sal_Int32 nStartIndex, sal_Int32 nEndIndex,
125
                      css::accessibility::AccessibleScrollType aScrollType) override;
126
};
127
}
128
129
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */