Coverage Report

Created: 2026-05-16 09:25

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