Line data Source code
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 : #ifndef INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX
21 : #define INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX
22 :
23 : #include <toolkit/dllapi.h>
24 : #include <com/sun/star/accessibility/XAccessible.hpp>
25 : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
26 : #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
27 : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
28 : #include <com/sun/star/awt/XWindow.hpp>
29 : #include <com/sun/star/lang/XServiceInfo.hpp>
30 : #include <cppuhelper/compbase3.hxx>
31 : #include <cppuhelper/implbase1.hxx>
32 : #include <comphelper/accimplaccess.hxx>
33 : #include <comphelper/accessiblecomponenthelper.hxx>
34 :
35 : #include <tools/link.hxx>
36 :
37 : namespace vcl { class Window; }
38 : class VCLXWindow;
39 : class VclSimpleEvent;
40 : class VclWindowEvent;
41 :
42 : namespace utl {
43 : class AccessibleRelationSetHelper;
44 : class AccessibleStateSetHelper;
45 : }
46 :
47 :
48 :
49 : // class VCLXAccessibleComponent
50 :
51 :
52 : typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE;
53 :
54 : typedef ::cppu::ImplHelper1<
55 : ::com::sun::star::lang::XServiceInfo > VCLXAccessibleComponent_BASE;
56 :
57 : class VCLExternalSolarLock;
58 :
59 : class TOOLKIT_DLLPUBLIC VCLXAccessibleComponent
60 : :public AccessibleExtendedComponentHelper_BASE
61 : ,public ::comphelper::OAccessibleImplementationAccess
62 : ,public VCLXAccessibleComponent_BASE
63 : {
64 : private:
65 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> mxWindow;
66 : VCLXWindow* mpVCLXindow;
67 :
68 : VCLExternalSolarLock* m_pSolarLock;
69 :
70 : protected:
71 : DECL_LINK( WindowEventListener, VclSimpleEvent* );
72 : DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
73 :
74 : virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
75 : virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
76 : virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
77 : virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
78 :
79 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent );
80 :
81 : public:
82 : VCLXAccessibleComponent( VCLXWindow* pVCLXindow );
83 : virtual ~VCLXAccessibleComponent();
84 :
85 114294 : VCLXWindow* GetVCLXWindow() const { return mpVCLXindow; }
86 : vcl::Window* GetWindow() const;
87 :
88 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
89 :
90 : // ::com::sun::star::uno::XInterface
91 : DECLARE_XINTERFACE()
92 : // ::com::sun::star::lang::XTypeProvider
93 : DECLARE_XTYPEPROVIDER()
94 :
95 : // XServiceInfo
96 : virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 : virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 :
100 : // ::com::sun::star::accessibility::XAccessibleContext
101 : sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 : sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 : OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 : OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
108 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 : ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 :
112 : // ::com::sun::star::accessibility::XAccessibleComponent
113 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 : ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 : void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 : virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 : virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 :
119 : // ::com::sun::star::accessibility::XAccessibleExtendedComponent
120 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 : virtual OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 :
124 : protected:
125 : // base class overridables
126 : ::com::sun::star::awt::Rectangle implGetBounds( ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
127 :
128 : private:
129 : /** we may be reparented (if external components use OAccessibleImplementationAccess base class),
130 : so this method here returns the parent in the VCL world, in opposite to the parent
131 : an external component gave us
132 : @precond
133 : the caller must ensure thread safety, i.e. our mutex must be locked
134 : */
135 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
136 : getVclParent() const;
137 : };
138 :
139 : /* ----------------------------------------------------------
140 : Accessibility only for the Window hierarchy!
141 : Maybe derived classes must overwrite these Accessibility interfaces:
142 :
143 : // XAccessibleContext:
144 : sal_Int16 getAccessibleRole() => VCL Window::GetAccessibleRole()
145 : OUString getAccessibleDescription() => VCL Window::GetAccessibleDescription
146 : OUString getAccessibleName() => VCL Window::GetAccessibleText() => Most windows return Window::GetText()
147 : Reference< XAccessibleRelationSet > getAccessibleRelationSet()
148 : Reference< XAccessibleStateSet > getAccessibleStateSet() => overload FillAccessibleStateSet( ... )
149 :
150 : ---------------------------------------------------------- */
151 :
152 :
153 : #endif // INCLUDED_TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX
154 :
155 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|