Coverage Report

Created: 2026-10-14 09:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/vcl/accessibility/vclxaccessiblecomponent.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
20
#pragma once
21
22
#include <vcl/dllapi.h>
23
#include <cppuhelper/implbase.hxx>
24
#include <comphelper/OAccessible.hxx>
25
26
27
#include <tools/link.hxx>
28
#include <vcl/vclptr.hxx>
29
30
namespace com::sun::star::accessibility { class XAccessible; }
31
32
namespace vcl { class Window; }
33
class VclWindowEvent;
34
35
namespace utl {
36
class AccessibleRelationSetHelper;
37
}
38
39
class VCL_DLLPUBLIC VCLXAccessibleComponent : public comphelper::OAccessible
40
{
41
private:
42
    VclPtr<vcl::Window> m_xWindow;
43
44
    DECL_DLLPRIVATE_LINK( WindowEventListener, VclWindowEvent&, void );
45
    DECL_DLLPRIVATE_LINK( WindowChildEventListener, VclWindowEvent&, void );
46
    void            DisconnectEvents();
47
48
protected:
49
    virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
50
    virtual void    ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
51
    virtual void    FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
52
    virtual void    FillAccessibleStateSet( sal_Int64& rStateSet );
53
54
    virtual css::uno::Reference< css::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent );
55
56
public:
57
    VCLXAccessibleComponent(vcl::Window* pWindow);
58
    virtual ~VCLXAccessibleComponent() override;
59
60
    vcl::Window* GetWindow() const;
61
0
    template< class derived_type > derived_type* GetAs() const {
62
0
        return static_cast< derived_type * >( GetWindow() ); }
Unexecuted instantiation: PushButton* VCLXAccessibleComponent::GetAs<PushButton>() const
Unexecuted instantiation: CheckBox* VCLXAccessibleComponent::GetAs<CheckBox>() const
Unexecuted instantiation: Edit* VCLXAccessibleComponent::GetAs<Edit>() const
Unexecuted instantiation: Control* VCLXAccessibleComponent::GetAs<Control>() const
Unexecuted instantiation: RadioButton* VCLXAccessibleComponent::GetAs<RadioButton>() const
Unexecuted instantiation: ScrollBar* VCLXAccessibleComponent::GetAs<ScrollBar>() const
Unexecuted instantiation: SvtIconChoiceCtrl* VCLXAccessibleComponent::GetAs<SvtIconChoiceCtrl>() const
Unexecuted instantiation: SvTreeListBox* VCLXAccessibleComponent::GetAs<SvTreeListBox>() const
Unexecuted instantiation: FormattedField* VCLXAccessibleComponent::GetAs<FormattedField>() const
Unexecuted instantiation: StatusBar* VCLXAccessibleComponent::GetAs<StatusBar>() const
Unexecuted instantiation: TabControl* VCLXAccessibleComponent::GetAs<TabControl>() const
Unexecuted instantiation: TabPage* VCLXAccessibleComponent::GetAs<TabPage>() const
Unexecuted instantiation: ToolBox* VCLXAccessibleComponent::GetAs<ToolBox>() const
Unexecuted instantiation: vcl::Window* VCLXAccessibleComponent::GetAs<vcl::Window>() const
Unexecuted instantiation: ComboBox* VCLXAccessibleComponent::GetAs<ComboBox>() const
Unexecuted instantiation: ListBox* VCLXAccessibleComponent::GetAs<ListBox>() const
63
0
    template< class derived_type > derived_type* GetAsDynamic() const {
64
0
        return dynamic_cast< derived_type * >( GetWindow() ); }
65
66
    virtual void SAL_CALL disposing() override;
67
68
    // css::accessibility::XAccessibleContext
69
    sal_Int64 SAL_CALL getAccessibleChildCount(  ) override;
70
    css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
71
    css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) override;
72
    sal_Int16 SAL_CALL getAccessibleRole(  ) override;
73
    OUString SAL_CALL getAccessibleDescription(  ) override;
74
    OUString SAL_CALL getAccessibleName(  ) override;
75
    OUString SAL_CALL getAccessibleId(  ) override;
76
    css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) override;
77
    sal_Int64 SAL_CALL getAccessibleStateSet(  ) override;
78
    css::lang::Locale SAL_CALL getLocale(  ) override;
79
80
    // css::accessibility::XAccessibleComponent
81
    css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
82
    css::awt::Point SAL_CALL getLocationOnScreen(  ) override;
83
    void SAL_CALL grabFocus(  ) override;
84
    virtual sal_Int32 SAL_CALL getForeground(  ) override;
85
    virtual sal_Int32 SAL_CALL getBackground(  ) override;
86
87
    // css::accessibility::XAccessibleExtendedComponent
88
    virtual OUString SAL_CALL getTitledBorderText(  ) override;
89
    virtual OUString SAL_CALL getToolTipText(  ) override;
90
91
protected:
92
    // base class overridables
93
    css::awt::Rectangle implGetBounds(  ) override;
94
};
95
96
/* ----------------------------------------------------------
97
  Accessibility only for the Window hierarchy!
98
  Maybe derived classes must overwrite these Accessibility interfaces:
99
100
    // XAccessibleContext:
101
    sal_Int16 getAccessibleRole() => VCL Window::GetAccessibleRole()
102
    OUString getAccessibleDescription() => VCL Window::GetAccessibleDescription
103
    OUString getAccessibleName() => VCL Window::GetAccessibleText() => Most windows return Window::GetText()
104
    OUString getAccessibleId() => VCL Window::get_id()
105
    Reference< XAccessibleRelationSet > getAccessibleRelationSet()
106
    sal_Int64 getAccessibleStateSet() => override FillAccessibleStateSet( ... )
107
108
---------------------------------------------------------- */
109
110
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */