1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX
21 #define INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX
23 #include <toolkit/dllapi.h>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <cppuhelper/implbase.hxx>
26 #include <comphelper/accessiblecomponenthelper.hxx>
29 #include <tools/link.hxx>
30 #include <vcl/vclptr.hxx>
32 namespace com::sun::star::accessibility
{ class XAccessible
; }
34 namespace vcl
{ class Window
; }
39 class AccessibleRelationSetHelper
;
44 class TOOLKIT_DLLPUBLIC
SAL_LOPLUGIN_ANNOTATE("crosscast") VCLXAccessibleComponent
45 :public cppu::ImplInheritanceHelper
<
46 comphelper::OAccessibleExtendedComponentHelper
, css::lang::XServiceInfo
>
49 rtl::Reference
<VCLXWindow
> m_xVCLXWindow
;
50 VclPtr
<vcl::Window
> m_xEventSource
;
52 DECL_DLLPRIVATE_LINK( WindowEventListener
, VclWindowEvent
&, void );
53 DECL_DLLPRIVATE_LINK( WindowChildEventListener
, VclWindowEvent
&, void );
54 void DisconnectEvents();
57 virtual void ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
);
58 virtual void ProcessWindowChildEvent( const VclWindowEvent
& rVclWindowEvent
);
59 virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper
& rRelationSet
);
60 virtual void FillAccessibleStateSet( sal_Int64
& rStateSet
);
62 virtual css::uno::Reference
< css::accessibility::XAccessible
> GetChildAccessible( const VclWindowEvent
& rVclWindowEvent
);
65 VCLXAccessibleComponent( VCLXWindow
* pVCLXWindow
);
66 virtual ~VCLXAccessibleComponent() override
;
68 VCLXWindow
* GetVCLXWindow() const;
69 vcl::Window
* GetWindow() const;
70 template< class derived_type
> derived_type
* GetAs() const {
71 return static_cast< derived_type
* >( GetWindow() ); }
72 template< class derived_type
> derived_type
* GetAsDynamic() const {
73 return dynamic_cast< derived_type
* >( GetWindow() ); }
75 virtual void SAL_CALL
disposing() override
;
78 virtual OUString SAL_CALL
getImplementationName() override
;
79 virtual sal_Bool SAL_CALL
supportsService( const OUString
& rServiceName
) override
;
80 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
82 // css::accessibility::XAccessibleContext
83 sal_Int64 SAL_CALL
getAccessibleChildCount( ) override
;
84 css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int64 i
) override
;
85 css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) override
;
86 sal_Int64 SAL_CALL
getAccessibleIndexInParent( ) override
;
87 sal_Int16 SAL_CALL
getAccessibleRole( ) override
;
88 OUString SAL_CALL
getAccessibleDescription( ) override
;
89 OUString SAL_CALL
getAccessibleName( ) override
;
90 OUString SAL_CALL
getAccessibleId( ) override
;
91 css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) override
;
92 sal_Int64 SAL_CALL
getAccessibleStateSet( ) override
;
93 css::lang::Locale SAL_CALL
getLocale( ) override
;
95 // css::accessibility::XAccessibleComponent
96 css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& aPoint
) override
;
97 css::awt::Point SAL_CALL
getLocationOnScreen( ) override
;
98 void SAL_CALL
grabFocus( ) override
;
99 virtual sal_Int32 SAL_CALL
getForeground( ) override
;
100 virtual sal_Int32 SAL_CALL
getBackground( ) override
;
102 // css::accessibility::XAccessibleExtendedComponent
103 virtual css::uno::Reference
< css::awt::XFont
> SAL_CALL
getFont( ) override
;
104 virtual OUString SAL_CALL
getTitledBorderText( ) override
;
105 virtual OUString SAL_CALL
getToolTipText( ) override
;
108 // base class overridables
109 css::awt::Rectangle
implGetBounds( ) override
;
112 /* ----------------------------------------------------------
113 Accessibility only for the Window hierarchy!
114 Maybe derived classes must overwrite these Accessibility interfaces:
116 // XAccessibleContext:
117 sal_Int16 getAccessibleRole() => VCL Window::GetAccessibleRole()
118 OUString getAccessibleDescription() => VCL Window::GetAccessibleDescription
119 OUString getAccessibleName() => VCL Window::GetAccessibleText() => Most windows return Window::GetText()
120 OUString getAccessibleId() => VCL Window::get_id()
121 Reference< XAccessibleRelationSet > getAccessibleRelationSet()
122 sal_Int64 getAccessibleStateSet() => override FillAccessibleStateSet( ... )
124 ---------------------------------------------------------- */
127 #endif // INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */